annotate libpurple/protocols/silc10/silc.c @ 30262:2a436e0ce977

Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
author Paul Aurich <paul@darkrain42.org>
date Thu, 29 Apr 2010 05:58:02 +0000
parents f541583e31bd
children a8cc50c2279f
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"
23408
4a4f733c4bf1 Added include for "core.h" to silc. Fix from phroggie, thanks. Fixes #6227
Evan Schoenberg <evan.s@dreskin.net>
parents: 23404
diff changeset
25 #include "core.h"
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
26
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
27 extern SilcClientOperations ops;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
28 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
29
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
30 static const char *
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
31 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
32 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
33 return (const char *)"silc";
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
36 static GList *
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
37 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
38 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
39 PurpleStatusType *type;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
40 GList *types = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
41
25050
b5c82724598c For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23408
diff changeset
42 type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_AVAILABLE, NULL, TRUE, TRUE, FALSE);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
43 types = g_list_append(types, type);
25050
b5c82724598c For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23408
diff changeset
44 type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_HYPER, _("Hyper Active"), TRUE, TRUE, FALSE);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
45 types = g_list_append(types, type);
25050
b5c82724598c For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23408
diff changeset
46 type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_AWAY, NULL, TRUE, TRUE, FALSE);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
47 types = g_list_append(types, type);
25050
b5c82724598c For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23408
diff changeset
48 type = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, SILCPURPLE_STATUS_ID_BUSY, _("Busy"), TRUE, TRUE, FALSE);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
49 types = g_list_append(types, type);
25050
b5c82724598c For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23408
diff changeset
50 type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_INDISPOSED, _("Indisposed"), TRUE, TRUE, FALSE);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
51 types = g_list_append(types, type);
25050
b5c82724598c For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23408
diff changeset
52 type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_PAGE, _("Wake Me Up"), TRUE, TRUE, FALSE);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
53 types = g_list_append(types, type);
25050
b5c82724598c For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23408
diff changeset
54 type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, SILCPURPLE_STATUS_ID_OFFLINE, NULL, TRUE, TRUE, FALSE);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
55 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
56
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
57 return types;
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
60 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
61 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
62 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
63 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
64 SilcPurple sg = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
65 SilcUInt32 mode;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
66 SilcBuffer idp;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
67 unsigned char mb[4];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
68 const char *state;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
69
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
70 if (gc != NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
71 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
72
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
73 if (status == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
74 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
75
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
76 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
77
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
78 if (state == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
79 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
80
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
81 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
82 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
83
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
84 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
85 mode &= ~(SILC_UMODE_GONE |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
86 SILC_UMODE_HYPER |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
87 SILC_UMODE_BUSY |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
88 SILC_UMODE_INDISPOSED |
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
89 SILC_UMODE_PAGE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
90
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
91 if (!strcmp(state, "hyper"))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
92 mode |= SILC_UMODE_HYPER;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
93 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
94 mode |= SILC_UMODE_GONE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
95 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
96 mode |= SILC_UMODE_BUSY;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
97 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
98 mode |= SILC_UMODE_INDISPOSED;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
99 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
100 mode |= SILC_UMODE_PAGE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
101
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
102 /* Send UMODE */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
103 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
104 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
105 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
106 ++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
107 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
108 2, mb, sizeof(mb));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
109 silc_buffer_free(idp);
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
113 /*************************** Connection Routines *****************************/
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
114
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
115 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
116 silcpurple_keepalive(PurpleConnection *gc)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
117 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
118 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
119 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
120 NULL, 0);
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
123 static gboolean
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
124 silcpurple_scheduler(gpointer *context)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
125 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
126 SilcPurple sg = (SilcPurple)context;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
127 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
128 return TRUE;
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
131 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
132 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
133 char **ret_nickname)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
134 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
135 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
136 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
137
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
138 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
139 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
140 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
141 PurpleConnection *gc = data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
142 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
143 SilcClient client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
144 SilcClientConnection conn;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
145 PurpleAccount *account;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
146 SilcClientConnectionParams params;
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
147 SilcUInt32 mask;
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
148 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
149 #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
150 PurpleStoredImage *img;
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
151 #endif
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
152 #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
153 struct utsname u;
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
154 #endif
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
155
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
156
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
157 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
158
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
159 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
160
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
161 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
162 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
163 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
164 _("Connection failed"));
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
165 return;
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
168 client = sg->client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
169 account = sg->account;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
170
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
171 /* 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
172 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
173 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
174 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
175 if (params.detach_data)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
176 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
177
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
178 /* 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
179 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
180 sg->client, &params,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
181 (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
182 "silc.silcnet.org"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
183 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
184 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
185 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
27463
f541583e31bd More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents: 26195
diff changeset
186 _("Unable to 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
187 gc->proto_data = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
188 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
189 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
190 sg->conn = conn;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
191
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
192 /* Progress */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
193 if (params.detach_data) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
194 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
195 sg->resuming = TRUE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
196 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
197 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
198 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
199
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
200 /* 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
201 eventually. */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
202 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
203
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
204 /* 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
205 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
206 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
207 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
208 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
209 sizeof(SilcUInt32));
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
210 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
211 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
212 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
213 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
214 sizeof(SilcUInt32));
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
215 #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
216 if (!uname(&u)) {
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
217 SilcAttributeObjDevice dev;
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
218 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
219 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
220 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
221 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
222 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
223 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
224 (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
225 }
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
226 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
227 #ifdef _WIN32
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
228 tmp = _tzname[0];
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
229 #else
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
230 tmp = tzname[0];
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
231 #endif
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
232 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
233 SILC_ATTRIBUTE_TIMEZONE,
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
234 (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
235
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
236 #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
237 /* 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
238 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
239 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
240 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
241 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
242
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
243 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
244 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
245
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
246 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
247 silcpurple_login(PurpleAccount *account)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
248 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
249 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
250 SilcClient client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
251 SilcClientParams params;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
252 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
253 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
254 const char *cipher, *hmac;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
255 char *realname;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
256 int i;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
257
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
258 gc = account->gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
259 if (!gc)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
260 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
261 gc->proto_data = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
262
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
263 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
264 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
265 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
266 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
267
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
268 /* Allocate SILC client */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
269 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
270 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
271 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
272 _("Out of memory"));
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
273 return;
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
276 /* 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
277 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
278 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
279 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
280 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
281 g_strfreev(up);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
282 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
283 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
284 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
285 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
286 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
287 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
288 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
289 free(realname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
290 } 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
291 client->realname = realname;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
292 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
293 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
294 free(realname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
295 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
296 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
297 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
298
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
299 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
300
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
301 /* 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
302 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
303 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
304 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
305 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
306 break;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
307 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
308 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
309 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
310 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
311 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
312 break;
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
315 /* Init SILC client */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
316 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
317 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
27463
f541583e31bd More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents: 26195
diff changeset
318 _("Unable to initialize SILC protocol"));
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
319 return;
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
322 /* 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
323 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
324 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
325 _("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
326 return;
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
329 /* Progress */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
330 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
331
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
332 /* Load SILC key pair */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
333 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
334 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
335 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
336 (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
337 (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
338 &client->public_key, &client->private_key)) {
27463
f541583e31bd More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents: 26195
diff changeset
339 g_snprintf(pkd, sizeof(pkd), _("Unable to 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
340 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
27463
f541583e31bd More uniformity among disconnect error messages
Mark Doliner <mark@kingant.net>
parents: 26195
diff changeset
341 pkd);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
342 return;
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
345 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
346 if (!sg)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
347 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
348 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
349 sg->client = client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
350 sg->gc = gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
351 sg->account = account;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
352 gc->proto_data = sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
353
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
354 /* 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
355 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
356 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
357 "silc.silcnet.org"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
358 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
359 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
360 {
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
361 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
362 _("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
363 return;
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
366 /* 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
367 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
368 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
369
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
370 static int
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
371 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
372 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
373 SilcPurple sg = (SilcPurple)context;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
374 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
375 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
376 #ifdef HAVE_SILCMIME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
377 if (sg->mimeass)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
378 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
379 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
380 silc_free(sg);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
381 return 0;
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
384 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
385 silcpurple_close(PurpleConnection *gc)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
386 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
387 SilcPurple sg = gc->proto_data;
23404
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
388 GHashTable *ui_info;
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
389 const char *ui_name = NULL, *ui_website = NULL;
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
390 char *quit_msg;
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
391
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
392 g_return_if_fail(sg != NULL);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
393
23404
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
394 ui_info = purple_core_get_ui_info();
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
395
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
396 if(ui_info) {
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
397 ui_name = g_hash_table_lookup(ui_info, "name");
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
398 ui_website = g_hash_table_lookup(ui_info, "website");
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
399 }
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
400
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
401 if(!ui_name || !ui_website) {
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
402 ui_name = "Pidgin";
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
403 ui_website = PURPLE_WEBSITE;
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
404 }
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
405 quit_msg = g_strdup_printf(_("Download %s: %s"),
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
406 ui_name, ui_website);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
407
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
408 /* Send QUIT */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
409 silc_client_command_call(sg->client, sg->conn, NULL,
23404
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
410 "QUIT", quit_msg, NULL);
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
411 g_free(quit_msg);
17805
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 if (sg->conn)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
414 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
415
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
416 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
417 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
418 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
419
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
420
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
421 /****************************** Protocol Actions *****************************/
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
422
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
423 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
424 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
425 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
426 /* Nothing */
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
429 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
430 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
431 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
432 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
433 SilcClient client = sg->client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
434 SilcClientConnection conn = sg->conn;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
435 PurpleRequestField *f;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
436 char *tmp;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
437 SilcUInt32 tmp_len, mask;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
438 SilcAttributeObjService service;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
439 SilcAttributeObjDevice dev;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
440 SilcVCardStruct vcard;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
441 const char *val;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
442
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
443 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
444 if (!sg)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
445 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
446
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
447 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
448 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
449 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
450
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
451 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
452 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
453 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
454 SILC_ATTRIBUTE_SERVICE, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
455 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
456 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
457 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
458 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
459 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
460 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
461 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
462 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
463 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
464 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
465 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
466 SILC_ATTRIBUTE_TIMEZONE, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
467 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
468 SILC_ATTRIBUTE_GEOLOCATION, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
469 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
470 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
471
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
472 /* Set mood */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
473 mask = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
474 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
475 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
476 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
477 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
478 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
479 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
480 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
481 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
482 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
483 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
484 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
485 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
486 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
487 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
488 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
489 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
490 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
491 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
492 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
493 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
494 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
495 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
496 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
497 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
498 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
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_MOOD_SLEEPY;
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, "mood_bored");
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_MOOD_BORED;
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, "mood_excited");
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_MOOD_EXCITED;
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, "mood_anxious");
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_MOOD_ANXIOUS;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
510 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
511 SILC_ATTRIBUTE_STATUS_MOOD,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
512 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
513 sizeof(SilcUInt32));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
514
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
515 /* Set preferred contact */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
516 mask = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
517 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
518 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
519 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
520 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
521 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
522 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
523 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
524 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
525 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
526 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
527 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
528 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
529 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
530 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
531 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
532 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
533 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
534 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
535 if (mask)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
536 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
537 SILC_ATTRIBUTE_PREFERRED_CONTACT,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
538 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
539 sizeof(SilcUInt32));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
540
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
541 /* Set status text */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
542 val = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
543 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
544 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
545 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
546 if (val && *val)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
547 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
548 SILC_ATTRIBUTE_STATUS_FREETEXT,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
549 (void *)val, strlen(val));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
550
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
551 /* Set vcard */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
552 val = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
553 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
554 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
555 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
556 if (val && *val) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
557 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
558 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
559 if (tmp) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
560 tmp[tmp_len] = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
561 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
562 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
563 SILC_ATTRIBUTE_USER_INFO,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
564 (void *)&vcard,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
565 sizeof(vcard));
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 silc_vcard_free(&vcard);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
568 silc_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
569 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
570 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
571 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
572
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
573 #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
574 /* Set device info */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
575 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
576 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
577 struct utsname u;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
578 if (!uname(&u)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
579 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
580 dev.version = u.release;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
581 dev.model = u.sysname;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
582 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
583 SILC_ATTRIBUTE_DEVICE_INFO,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
584 (void *)&dev, sizeof(dev));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
585 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
586 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
587 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
588
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
589 /* Set timezone */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
590 val = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
591 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
592 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
593 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
594 if (val && *val)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
595 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
596 SILC_ATTRIBUTE_TIMEZONE,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
597 (void *)val, strlen(val));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
598 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
599
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
600 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
601 silcpurple_attrs(PurplePluginAction *action)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
602 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
603 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
604 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
605 SilcClient client = sg->client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
606 SilcClientConnection conn = sg->conn;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
607 PurpleRequestFields *fields;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
608 PurpleRequestFieldGroup *g;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
609 PurpleRequestField *f;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
610 SilcHashTable attrs;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
611 SilcAttributePayload attr;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
612 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
613 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
614 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
615 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
616 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
617 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
618 gboolean device = TRUE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
619 char status[1024];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
620
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
621 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
622 if (!sg)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
623 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
624
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
625 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
626
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
627 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
628 if (attrs) {
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_STATUS_MOOD),
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 mood = 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, &mood, sizeof(mood));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
634 mnormal = !mood;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
635 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
636 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
637 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
638 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
639 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
640 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
641 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
642 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
643 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
644 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
645 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
646 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
647
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
648 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
649 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
650 NULL, (void *)&attr)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
651 SilcUInt32 contact = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
652 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
653 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
654 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
655 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
656 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
657 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
658 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
659 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
660
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
661 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
662 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
663 NULL, (void *)&attr))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
664 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
665
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
666 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
667 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
668 NULL, (void *)&attr))
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
669 device = FALSE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
670 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
671
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
672 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
673
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
674 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
675 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
676 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
677 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
678 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
679 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
680 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
681 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
682 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
683 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
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("mood_jealous", _("Jealous"), mjealous);
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("mood_ashamed", _("Ashamed"), mashamed);
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("mood_invincible", _("Invincible"), minvincible);
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("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
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("mood_sleepy", _("Sleepy"), msleepy);
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("mood_bored", _("Bored"), mbored);
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 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
698 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
699 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
700 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
701
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
702 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
703 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
704 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
705 purple_request_field_group_add_field(g, f);
23182
e0bcb8cfda74 Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents: 23112
diff changeset
706 f = purple_request_field_bool_new("contact_email", _("Email"), cemail);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
707 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
708 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
709 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
710 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
711 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
712 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
713 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
714 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
715 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
716 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
717
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
718 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
719 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
720 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
721 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
722 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
723
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
724 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
725 #if 0
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
726 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
727 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
728 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
729 _("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
730 TRUE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
731 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
732 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
733 #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
734 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
735 _("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
736 device);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
737 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
738 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
739 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
740
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
741 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
742 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
743 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
744 FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
745 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
746 #ifdef _WIN32
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
747 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
748 #else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
749 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
750 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
751 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
752 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
753
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
754 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
755 _("User Online Status Attributes"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
756 _("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
757 "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
758 "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
759 fields,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
760 _("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
761 _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel),
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
762 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
763 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
764
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
765 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
766 silcpurple_detach(PurplePluginAction *action)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
767 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
768 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
769 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
770
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
771 if (!gc)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
772 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
773 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
774 if (!sg)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
775 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
776
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
777 /* Call DETACH */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
778 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
779 sg->detaching = TRUE;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
780 }
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 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
783 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
784 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
785 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
786 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
787 char *tmp;
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 if (!gc)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
790 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
791 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
792 if (!sg)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
793 return;
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 if (!sg->motd) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
796 purple_notify_error(
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
797 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
798 _("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
799 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
800 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
801
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
802 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
803 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
804 tmp, NULL, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
805 g_free(tmp);
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
808 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
809 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
810 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
811 /* Nothing */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
812 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
813
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
814 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
815 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
816 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
817 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
818 PurpleRequestField *f;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
819 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
820 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
821 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
822 char *identifier;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
823 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
824 SilcPublicKey public_key;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
825
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
826 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
827 if (!sg)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
828 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
829
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
830 val = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
831 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
832 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
833 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
834 if (val && *val)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
835 pass1 = val;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
836 else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
837 pass1 = "";
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
838 val = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
839 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
840 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
841 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
842 if (val && *val)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
843 pass2 = val;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
844 else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
845 pass2 = "";
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 if (strcmp(pass1, pass2)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
848 purple_notify_error(
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
849 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
850 return;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
851 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
852
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
853 val = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
854 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
855 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
856 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
857 if (val && *val)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
858 keylen = atoi(val);
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, "pkfile");
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 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
862 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
863 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
864 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
865
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
866 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
867 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
868 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
869 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
870 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
871 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
872 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
873 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
874 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
875 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
876 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
877 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
878 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
879 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
880 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
881 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
882 if (f)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
883 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
884
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
885 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
886 (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
887
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
888 /* Create the key pair */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
889 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
890 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
891 FALSE)) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
892 purple_notify_error(
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
893 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
894 return;
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
897 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
898
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
899 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
900 silc_free(identifier);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
901 }
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 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
904 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
905 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
906 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
907 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
908 PurpleRequestFields *fields;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
909 PurpleRequestFieldGroup *g;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
910 PurpleRequestField *f;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
911 const char *username, *realname;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
912 char *hostname, **u;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
913 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
914
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
915 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
916 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
917 username = u[0];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
918 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
919 hostname = silc_net_localhost();
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
920 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
921
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
922 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
923 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
924 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
925 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
926 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
927 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
928
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
929 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
930
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
931 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
932 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
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 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
935 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
936 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
937 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
938 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
939
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
940 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
941 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
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 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
944 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
945 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
946 purple_request_field_group_add_field(g, f);
23182
e0bcb8cfda74 Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents: 23112
diff changeset
947 f = purple_request_field_string_new("e", _("Email"), tmp, FALSE);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
948 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
949 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
950 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
951 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
952 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
953 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
954
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
955 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
956 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
957 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
958 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
959 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
960 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
961 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
962 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
963
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
964 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
965 _("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
966 _("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
967 _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel),
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
968 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
969
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
970 g_strfreev(u);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
971 silc_free(hostname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
972 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
973
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
974 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
975 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
976 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
977 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
978 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
979 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
980
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
981 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
982 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
983 {
22692
3d092dd95ec1 Fix for changing silc private key passphrase to or from the empty string,
Stu Tomlinson <stu@nosnilmot.com>
parents: 22235
diff changeset
984 char prd[256];
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
985 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
986 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
987 "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
988 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
989 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
990
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
991 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
992 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
993 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
994 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
995 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
996 }
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 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
999 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
1000 {
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1003 static GList *
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1004 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
1005 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1006 GList *list = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1007 PurplePluginAction *act;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1008
17808
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
1009 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
1010 silcpurple_attrs);
b142c090eaf7 Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <stu@nosnilmot.com>
parents: 17805
diff changeset
1011 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
1012
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1013 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
1014 silcpurple_detach);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1015 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
1016
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1017 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
1018 silcpurple_view_motd);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1019 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
1020
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1021 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
1022 silcpurple_create_keypair);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1023 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
1024
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1025 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
1026 silcpurple_change_pass);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1027 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
1028
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1029 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
1030 silcpurple_show_set_info);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1031 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
1032
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1033 return list;
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1036
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1037 /******************************* IM Routines *********************************/
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1038
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1039 typedef struct {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1040 char *nick;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1041 char *message;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1042 SilcUInt32 message_len;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1043 SilcMessageFlags flags;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1044 PurpleMessageFlags gflags;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1045 } *SilcPurpleIM;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1046
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1047 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1048 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
1049 SilcClientConnection conn,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1050 SilcClientEntry *clients,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1051 SilcUInt32 clients_count,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1052 void *context)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1053 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1054 PurpleConnection *gc = client->application;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1055 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
1056 SilcPurpleIM im = context;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1057 PurpleConversation *convo;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1058 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
1059 SilcClientEntry client_entry;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1060 #ifdef HAVE_SILCMIME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1061 SilcDList list;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1062 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1063
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1064 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
1065 sg->account);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1066 if (!convo)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1067 return;
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 if (!clients)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1070 goto err;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1071
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1072 if (clients_count > 1) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1073 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
1074
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1075 /* 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
1076 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
1077 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
1078 nickname, im->nick,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1079 &clients_count);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1080 if (!clients)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1081 goto err;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1082 client_entry = clients[0];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1083 silc_free(clients);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1084 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1085 client_entry = clients[0];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1086 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1087
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1088 #ifdef HAVE_SILCMIME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1089 /* Check for images */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1090 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
1091 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
1092 if (list) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1093 /* 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
1094 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
1095 SilcBuffer buf;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1096
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1097 silc_dlist_start(list);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1098 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
1099 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
1100 client_entry, im->flags,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1101 buf->data, buf->len,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1102 TRUE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1103 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
1104 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
1105 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
1106 goto out;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1107 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1108 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1109 #endif
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 /* Send the message */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1112 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
1113 (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
1114 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
1115 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
1116 goto out;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1117
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1118 err:
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1119 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
1120 _("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
1121 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
1122
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1123 out:
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1124 g_free(im->nick);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1125 g_free(im->message);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1126 silc_free(im);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1127 silc_free(nickname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1128 }
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 static int
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1131 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
1132 PurpleMessageFlags flags)
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 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
1135 SilcClient client = sg->client;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1136 SilcClientConnection conn = sg->conn;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1137 SilcClientEntry *clients;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1138 SilcUInt32 clients_count, mflags;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1139 char *nickname, *msg, *tmp;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1140 int ret = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1141 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
1142 #ifdef HAVE_SILCMIME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1143 SilcDList list;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1144 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1145
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1146 if (!who || !message)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1147 return 0;
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 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
1150
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1151 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
1152
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1153 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
1154 msg += 4;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1155 if (!*msg) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1156 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1157 return 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1158 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1159 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
1160 } 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
1161 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
1162 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
1163 _("Unknown command"));
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1164 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1165 return 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1166 }
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1169 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
1170 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1171 return 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1172 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1173
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1174 if (sign)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1175 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
1176
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1177 /* Find client entry */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1178 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
1179 &clients_count);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1180 if (!clients) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1181 /* Resolve unknown user */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1182 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
1183 if (!im) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1184 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1185 return 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1186 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1187 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
1188 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
1189 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
1190 im->flags = mflags;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1191 im->gflags = flags;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1192 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
1193 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
1194 silc_free(nickname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1195 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1196 return 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1197 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1198
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1199 #ifdef HAVE_SILCMIME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1200 /* Check for images */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1201 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
1202 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
1203 if (list) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1204 /* 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
1205 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
1206 SilcBuffer buf;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1207
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1208 silc_dlist_start(list);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1209 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
1210 ret =
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1211 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
1212 clients[0], mflags,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1213 buf->data, buf->len,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1214 TRUE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1215 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
1216 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1217 silc_free(nickname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1218 silc_free(clients);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1219 return ret;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1220 }
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 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1223
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1224 /* Send private message directly */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1225 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
1226 mflags,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1227 (unsigned char *)msg,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1228 strlen(msg), TRUE);
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 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1231 silc_free(nickname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1232 silc_free(clients);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1233 return ret;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1234 }
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1237 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
1238 /* 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
1239 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
1240
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1241 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
1242 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
1243 } 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
1244 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
1245 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1246 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
1247 }
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1250 /********************************* Commands **********************************/
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 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
1253 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
1254 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1255 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1256 PurpleConversation *convo = conv;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1257 int id = 0;
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 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
1260
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1261 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1262 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
1263
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1264 if(args && args[0])
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1265 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
1266 gc->account);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1267
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1268 if (convo != NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1269 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
1270
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1271 if (id == 0)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1272 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
1273
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1274 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
1275
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1276 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
1277
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1278 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1279
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1280 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
1281 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
1282 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1283 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1284 int id = 0;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1285 char *buf, *tmp, *tmp2;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1286 const char *topic;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1287
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1288 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
1289 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
1290
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1291 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
1292 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
1293
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1294 if (!args || !args[0]) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1295 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
1296 if (topic) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1297 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
1298 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
1299 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
1300 g_free(tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1301 g_free(tmp2);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1302 } else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1303 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
1304 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
1305 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
1306 g_free(buf);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1307
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1310 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
1311 *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
1312 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
1313 }
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_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
1316
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1317 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
1318 }
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 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
1321 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
1322 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1323 GHashTable *comp;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1324
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1325 if(!args || !args[0])
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1326 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
1327
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1328 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
1329
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1330 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
1331 if(args[1])
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1332 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
1333
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1334 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
1335
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1336 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
1337 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
1338 }
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 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
1341 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
1342 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1343 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1344 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
1345 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
1346 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
1347 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1348
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1349 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
1350 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
1351 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1352 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1353
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1354 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
1355
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1356 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1357 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
1358
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1359 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
1360
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_OK;
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_msg(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;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1368 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1369
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1370 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
1371
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1372 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1373 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
1374
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1375 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
1376
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1377 if (ret)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1378 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
1379 else
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
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1383 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
1384 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
1385 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1386 int ret = 1;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1387 PurpleConversation *convo;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1388 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1389 PurpleAccount *account;
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 if (!args || !args[0]) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1392 *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
1393 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
1394 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1395
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1396 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
1397
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1398 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1399 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
1400
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1401 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
1402
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1403 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
1404
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1405 if (args[1]) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1406 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
1407 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
1408 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
1409 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1410
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1411 if (ret)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1412 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
1413 else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1414 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
1415 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1416
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1417 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
1418 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
1419 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1420 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1421 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1422 char *tmp;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1423
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1424 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
1425
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1426 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1427 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
1428
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1429 sg = gc->proto_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 if (sg == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1432 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
1433
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1434 if (!sg->motd) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1435 *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
1436 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
1437 }
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 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
1440 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
1441 tmp, NULL, NULL);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1442 g_free(tmp);
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 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
1445 }
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 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
1448 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
1449 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1450 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1451 SilcPurple sg;
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 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
1454
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1455 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1456 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
1457
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1458 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1459
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1460 if (sg == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1461 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
1462
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1463 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
1464 sg->detaching = TRUE;
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 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
1467 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1468
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1469 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
1470 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
1471 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1472 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1473 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1474 SilcChannelEntry channel;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1475 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
1476 const char *chname;
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 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
1479
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1480 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
1481 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
1482
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1483 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1484
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1485 if (args[0])
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1486 chname = args[0];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1487 else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1488 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
1489
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1490 if (!args[1]) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1491 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
1492 (char *)chname);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1493 if (!channel) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1494 *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
1495 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
1496 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1497 if (channel->mode) {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1498 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
1499 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
1500 } else {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1501 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
1502 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1503 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
1504 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
1505 g_free(msg);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1506 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
1507 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1508
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1509 silcargs = g_strjoinv(" ", args);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1510 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
1511 g_free(silcargs);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1512 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
1513 g_free(silccmd);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1514 *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
1515 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
1516 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1517 g_free(silccmd);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1518
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1519 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
1520 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1521
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1522 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
1523 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
1524 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1525 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1526 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1527 char *silccmd, *silcargs;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1528
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1529 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
1530
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1531 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1532 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
1533
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1534 sg = gc->proto_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 if (sg == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1537 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
1538
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1539 silcargs = g_strjoinv(" ", args);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1540 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
1541 g_free(silcargs);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1542 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
1543 g_free(silccmd);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1544 *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
1545 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
1546 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1547 g_free(silccmd);
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 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
1550 }
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 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
1553 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
1554 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1555 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1556 SilcPurple sg;
23404
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1557 GHashTable *ui_info;
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1558 const char *ui_name = NULL, *ui_website = NULL;
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1559 char *quit_msg;
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1560
17805
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
23404
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1571 ui_info = purple_core_get_ui_info();
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1572
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1573 if(ui_info) {
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1574 ui_name = g_hash_table_lookup(ui_info, "name");
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1575 ui_website = g_hash_table_lookup(ui_info, "website");
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1576 }
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1577
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1578 if(!ui_name || !ui_website) {
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1579 ui_name = "Pidgin";
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1580 ui_website = PURPLE_WEBSITE;
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1581 }
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1582 quit_msg = g_strdup_printf(_("Download %s: %s"),
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1583 ui_name, ui_website);
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1584
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1585 silc_client_command_call(sg->client, sg->conn, NULL,
23404
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1586 "QUIT", (args && args[0]) ? args[0] : quit_msg, NULL);
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1587 g_free(quit_msg);
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1588
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1589 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
1590 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1591
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1592 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
1593 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
1594 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1595 PurpleConnection *gc;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1596 SilcPurple sg;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1597
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1598 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
1599
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1600 if (gc == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1601 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
1602
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1603 sg = gc->proto_data;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1604
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1605 if (sg == NULL)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1606 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
1607
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1608 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
1609 *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
1610 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
1611 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1612
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1613 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
1614 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1615
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1616
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1617 /************************** Plugin Initialization ****************************/
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1618
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1619 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1620 silcpurple_register_commands(void)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1621 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1622 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
1623 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
1624 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
1625 "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
1626 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
1627 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
1628 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
1629 "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
1630 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
1631 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 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
1633 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
1634 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
1635 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
1636 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
1637 "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
1638 _("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
1639 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
1640 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
1641 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
1642 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
1643 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
1644 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
1645 "prpl-silc",
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1646 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
1647 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
1648 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
1649 "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
1650 _("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
1651 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
1652 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
1653 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
1654 _("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
1655 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
1656 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
1657 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
1658 _("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
1659 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
1660 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
1661 "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
1662 _("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
1663 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
1664 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
1665 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
1666 _("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
1667 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
1668 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
1669 "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
1670 _("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
1671 /* 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
1672 * with */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1673 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
1674 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
1675 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
1676 _("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
1677 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
1678 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
1679 "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
1680 _("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
1681 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
1682 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
1683 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
1684 _("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
1685 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
1686 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
1687 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
1688 _("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
1689 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
1690 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
1691 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
1692 _("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
1693 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
1694 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
1695 "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
1696 _("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
1697 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
1698 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
1699 "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
1700 _("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
1701 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
1702 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
1703 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
1704 _("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
1705 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
1706 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
1707 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
1708 _("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
1709 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
1710 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
1711 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
1712 _("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
1713 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
1714 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
1715 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
1716 _("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
1717 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
1718 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
1719 "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
1720 _("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
1721 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
1722 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
1723 "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
1724 _("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
1725 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
1726 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
1727 "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
1728 _("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
1729 #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
1730 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
1731 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
1732 "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
1733 _("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
1734 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
1735 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
1736 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
1737 _("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
1738 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1739 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1740
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1741 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
1742 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1743 silcpurple_wb_start,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1744 silcpurple_wb_end,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1745 silcpurple_wb_get_dimensions,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1746 silcpurple_wb_set_dimensions,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1747 silcpurple_wb_get_brush,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1748 silcpurple_wb_set_brush,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1749 silcpurple_wb_send,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1750 silcpurple_wb_clear,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1751
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1752 /* padding */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1753 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1754 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1755 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1756 NULL
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1757 };
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1758
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1759 static PurplePluginProtocolInfo prpl_info =
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1760 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1761 #ifdef HAVE_SILCMIME_H
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1762 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
1763 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
1764 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
1765 #else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1766 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
1767 OPT_PROTO_PASSWORD_OPTIONAL |
3162c5836fb8 Add OPT_PROTO_SLASH_COMMANDS_NATIVE support to silc10
Stu Tomlinson <stu@nosnilmot.com>
parents: 17808
diff changeset
1768 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
1769 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1770 NULL, /* user_splits */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1771 NULL, /* protocol_options */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1772 #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
1773 {"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
1774 #else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1775 NO_BUDDY_ICONS,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1776 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1777 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
1778 NULL, /* list_emblems */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1779 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
1780 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
1781 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
1782 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
1783 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
1784 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
1785 silcpurple_login, /* login */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1786 silcpurple_close, /* close */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1787 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
1788 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
1789 NULL, /* send_typing */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1790 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
1791 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
1792 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
1793 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
1794 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
1795 NULL, /* add_buddies */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1796 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
1797 NULL, /* remove_buddies */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1798 NULL, /* add_permit */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1799 NULL, /* add_deny */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1800 NULL, /* rem_permit */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1801 NULL, /* rem_deny */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1802 NULL, /* set_permit_deny */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1803 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
1804 NULL, /* reject_chat */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1805 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
1806 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
1807 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
1808 NULL, /* chat_whisper */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1809 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
1810 silcpurple_keepalive, /* keepalive */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1811 NULL, /* register_user */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1812 NULL, /* get_cb_info */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1813 NULL, /* get_cb_away */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1814 NULL, /* alias_buddy */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1815 NULL, /* group_buddy */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1816 NULL, /* rename_group */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1817 NULL, /* buddy_free */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1818 NULL, /* convo_closed */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1819 NULL, /* normalize */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1820 #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
1821 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
1822 #else
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1823 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1824 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1825 NULL, /* remove_group */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1826 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
1827 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
1828 NULL, /* find_blist_chat */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1829 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
1830 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
1831 NULL, /* roomlist_expand_category */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1832 NULL, /* can_receive_file */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1833 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
1834 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
1835 NULL, /* offline_message */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1836 &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
1837 NULL, /* send_raw */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1838 NULL, /* roomlist_room_serialize */
25657
ff29208e03ef propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23182 25637
diff changeset
1839 NULL, /* unregister_user */
ff29208e03ef propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23182 25637
diff changeset
1840 NULL, /* send_attention */
ff29208e03ef propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23182 25637
diff changeset
1841 NULL, /* get_attention_types */
23111
718a9c287839 Use up the last padding for PurplePluginProtocolInfo in a way that allows
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22692
diff changeset
1842 sizeof(PurplePluginProtocolInfo), /* struct_size */
25657
ff29208e03ef propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23182 25637
diff changeset
1843 NULL, /* get_account_text_table */
ff29208e03ef propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23182 25637
diff changeset
1844 NULL, /* initiate_media */
30262
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 27463
diff changeset
1845 NULL, /* get_media_caps */
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 27463
diff changeset
1846 NULL, /* get_moods */
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 27463
diff changeset
1847 NULL, /* set_public_alias */
2a436e0ce977 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <paul@darkrain42.org>
parents: 27463
diff changeset
1848 NULL /* get_public_alias */
17805
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1849 };
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1850
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1851 static PurplePluginInfo info =
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1852 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1853 PURPLE_PLUGIN_MAGIC,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1854 PURPLE_MAJOR_VERSION,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1855 PURPLE_MINOR_VERSION,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1856 PURPLE_PLUGIN_PROTOCOL, /**< type */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1857 NULL, /**< ui_requirement */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1858 0, /**< flags */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1859 NULL, /**< dependencies */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1860 PURPLE_PRIORITY_DEFAULT, /**< priority */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1861
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1862 "prpl-silc", /**< id */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1863 "SILC", /**< name */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1864 "1.0", /**< version */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1865 /** summary */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1866 N_("SILC Protocol Plugin"),
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1867 /** description */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1868 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
1869 "Pekka Riikonen", /**< author */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1870 "http://silcnet.org/", /**< homepage */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1871
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1872 NULL, /**< load */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1873 NULL, /**< unload */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1874 NULL, /**< destroy */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1875
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1876 NULL, /**< ui_info */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1877 &prpl_info, /**< extra_info */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1878 NULL, /**< prefs_info */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1879 silcpurple_actions,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1880
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1881 /* padding */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1882 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1883 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1884 NULL,
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1885 NULL
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1886 };
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1887
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1888 static void
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1889 init_plugin(PurplePlugin *plugin)
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1890 {
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1891 PurpleAccountOption *option;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1892 PurpleAccountUserSplit *split;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1893 char tmp[256];
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1894 int i;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1895 PurpleKeyValuePair *kvp;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1896 GList *list = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1897
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1898 silc_plugin = plugin;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1899
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1900 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
1901 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
1902
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1903 /* Account options */
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1904 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
1905 "server",
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1906 "silc.silcnet.org");
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_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
1909 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
1910 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
1911 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
1912 "public-key", tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1913 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
1914 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
1915 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
1916 "private-key", tmp);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1917 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
1918
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1919 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
1920 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
1921 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
1922 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
1923 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
1924 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1925 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
1926 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
1927
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1928 list = NULL;
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1929 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
1930 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
1931 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
1932 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
1933 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
1934 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1935 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
1936 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
1937
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1938 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
1939 "pubkey-auth", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1940 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
1941 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
1942 "block-ims", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1943 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
1944 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
1945 "block-wb", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1946 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
1947 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
1948 "open-wb", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1949 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
1950 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
1951 "sign-verify", FALSE);
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1952 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
1953
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1954 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
1955
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1956 silcpurple_register_commands();
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1957
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1958 #ifdef _WIN32
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1959 silc_net_win32_init();
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1960 #endif
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1961 }
ba1b50f114f6 Duplicate the current SILC prpl as silc10 for backwards compatibility with
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff changeset
1962
25124
ea62e934c80b Fix some more mis-identified plugins, like 3b3526a0...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25050
diff changeset
1963 PURPLE_INIT_PLUGIN(silc10, init_plugin, info);