libpurple/protocols/silc/silc.c

Fri, 20 May 2022 02:55:51 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 20 May 2022 02:55:51 -0500
changeset 41396
2ef3d6eeffb3
parent 41348
74b1a5db343b
child 41467
5e0e6387ad84
permissions
-rw-r--r--

Update purple_core_init to take a PurpleUiInfo instance
Added an `id` property to `PurpleUiInfo`

Testing Done:
Ran the unit tests and verified I could run Pidgin and connect an account.

Reviewed at https://reviews.imfreedom.org/r/1456/

8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1 /*
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
3 silcpurple.c
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5 Author: Pekka Riikonen <priikone@silcnet.org>
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
7 Copyright (C) 2004 - 2007 Pekka Riikonen
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
9 This program is free software; you can redistribute it and/or modify
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
11 the Free Software Foundation; version 2 of the License.
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
12
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
13 This program is distributed in the hope that it will be useful,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
16 GNU General Public License for more details.
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
17
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
18 */
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
19
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
20 #include <glib/gi18n-lib.h>
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
21 #include <glib/gstdio.h>
40350
72271baf92bc Split PurpleKeyValuePair out to it's own file and try to do some cleanup in the files that need to include it.
Gary Kramlich <grim@reaperworld.com>
parents: 40331
diff changeset
22
40945
bbeb2e98ea5b Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
23 #include <gplugin.h>
bbeb2e98ea5b Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
24 #include <gplugin-native.h>
bbeb2e98ea5b Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
25
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
26 #include "silcpurple.h"
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
27 #include "ft.h"
12058
6d4b6e3bd0ba [gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents: 11837
diff changeset
28 #include "wb.h"
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
29
40865
82e45cd837fa Migrate gg, novel, null, sametime, silc, and zephyr to using G_DECLARE_FINAL_TYPE for their protocol objects
Gary Kramlich <grim@reaperworld.com>
parents: 40814
diff changeset
30 struct _SilcProtocol {
82e45cd837fa Migrate gg, novel, null, sametime, silc, and zephyr to using G_DECLARE_FINAL_TYPE for their protocol objects
Gary Kramlich <grim@reaperworld.com>
parents: 40814
diff changeset
31 PurpleProtocol parent;
82e45cd837fa Migrate gg, novel, null, sametime, silc, and zephyr to using G_DECLARE_FINAL_TYPE for their protocol objects
Gary Kramlich <grim@reaperworld.com>
parents: 40814
diff changeset
32 };
82e45cd837fa Migrate gg, novel, null, sametime, silc, and zephyr to using G_DECLARE_FINAL_TYPE for their protocol objects
Gary Kramlich <grim@reaperworld.com>
parents: 40814
diff changeset
33
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
34 extern SilcClientOperations ops;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
35
36595
d013a99e6d94 Refactored silc to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36593
diff changeset
36 static PurpleProtocol *my_protocol = NULL;
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
37 static GSList *cmds = NULL;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
38
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
39 /* Error log message callback */
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
40
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
41 static SilcBool silcpurple_log_error(SilcLogType type, char *message,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
42 void *context)
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
43 {
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
44 silc_say(NULL, NULL, SILC_CLIENT_MESSAGE_ERROR, message);
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
45 return TRUE;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
46 }
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
47
40114
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
48 static void
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
49 silcpurple_free(SilcPurple sg)
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
50 {
40116
29830983ace7 silc: Move more things to silcpurple_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40115
diff changeset
51 g_return_if_fail(sg != NULL);
29830983ace7 silc: Move more things to silcpurple_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40115
diff changeset
52
40115
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
53 g_cancellable_cancel(sg->cancellable);
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
54 g_clear_object(&sg->cancellable);
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
55 g_clear_object(&sg->sockconn);
40116
29830983ace7 silc: Move more things to silcpurple_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40115
diff changeset
56
29830983ace7 silc: Move more things to silcpurple_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40115
diff changeset
57 g_clear_pointer(&sg->client, silc_client_free);
29830983ace7 silc: Move more things to silcpurple_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40115
diff changeset
58 g_clear_pointer(&sg->sha1hash, silc_hash_free);
29830983ace7 silc: Move more things to silcpurple_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40115
diff changeset
59 g_clear_pointer(&sg->mimeass, silc_mime_assembler_free);
29830983ace7 silc: Move more things to silcpurple_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40115
diff changeset
60
29830983ace7 silc: Move more things to silcpurple_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40115
diff changeset
61 g_clear_pointer(&sg->public_key, silc_pkcs_public_key_free);
29830983ace7 silc: Move more things to silcpurple_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40115
diff changeset
62 g_clear_pointer(&sg->private_key, silc_pkcs_private_key_free);
29830983ace7 silc: Move more things to silcpurple_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40115
diff changeset
63
40114
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
64 silc_free(sg);
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
65 }
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
66
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
67 static const char *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
68 silcpurple_list_icon(PurpleAccount *a, PurpleBuddy *b)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
69 {
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
70 return (const char *)"silc";
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
71 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
72
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
73 static GList *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
74 silcpurple_away_states(PurpleAccount *account)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
75 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
76 PurpleStatusType *type;
9968
fc6684d1f454 [gaim-migrate @ 10878]
Luke Schierer <lschiere@pidgin.im>
parents: 9943
diff changeset
77 GList *types = NULL;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
78
25552
ffd94785b2ad For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25545
diff changeset
79 type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_AVAILABLE, NULL, TRUE, TRUE, FALSE);
9968
fc6684d1f454 [gaim-migrate @ 10878]
Luke Schierer <lschiere@pidgin.im>
parents: 9943
diff changeset
80 types = g_list_append(types, type);
25552
ffd94785b2ad For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25545
diff changeset
81 type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, SILCPURPLE_STATUS_ID_HYPER, _("Hyper Active"), TRUE, TRUE, FALSE);
9968
fc6684d1f454 [gaim-migrate @ 10878]
Luke Schierer <lschiere@pidgin.im>
parents: 9943
diff changeset
82 types = g_list_append(types, type);
25552
ffd94785b2ad For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25545
diff changeset
83 type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_AWAY, NULL, TRUE, TRUE, FALSE);
9968
fc6684d1f454 [gaim-migrate @ 10878]
Luke Schierer <lschiere@pidgin.im>
parents: 9943
diff changeset
84 types = g_list_append(types, type);
25552
ffd94785b2ad For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25545
diff changeset
85 type = purple_status_type_new_full(PURPLE_STATUS_UNAVAILABLE, SILCPURPLE_STATUS_ID_BUSY, _("Busy"), TRUE, TRUE, FALSE);
9968
fc6684d1f454 [gaim-migrate @ 10878]
Luke Schierer <lschiere@pidgin.im>
parents: 9943
diff changeset
86 types = g_list_append(types, type);
25552
ffd94785b2ad For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25545
diff changeset
87 type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_INDISPOSED, _("Indisposed"), TRUE, TRUE, FALSE);
9968
fc6684d1f454 [gaim-migrate @ 10878]
Luke Schierer <lschiere@pidgin.im>
parents: 9943
diff changeset
88 types = g_list_append(types, type);
25552
ffd94785b2ad For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25545
diff changeset
89 type = purple_status_type_new_full(PURPLE_STATUS_AWAY, SILCPURPLE_STATUS_ID_PAGE, _("Wake Me Up"), TRUE, TRUE, FALSE);
9968
fc6684d1f454 [gaim-migrate @ 10878]
Luke Schierer <lschiere@pidgin.im>
parents: 9943
diff changeset
90 types = g_list_append(types, type);
25552
ffd94785b2ad For some reason, all these statuses were set to saveable=FALSE. With the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25545
diff changeset
91 type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, SILCPURPLE_STATUS_ID_OFFLINE, NULL, TRUE, TRUE, FALSE);
12658
4aa7a873628d [gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents: 12645
diff changeset
92 types = g_list_append(types, type);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
93
9968
fc6684d1f454 [gaim-migrate @ 10878]
Luke Schierer <lschiere@pidgin.im>
parents: 9943
diff changeset
94 return types;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
95 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
96
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
97 static void
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
98 silcpurple_set_status(PurpleProtocolServer *protocol_server, PurpleAccount *account, PurpleStatus *status)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
99 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
100 PurpleConnection *gc = purple_account_get_connection(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
101 SilcPurple sg = NULL;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
102 SilcUInt32 mode;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
103 SilcBuffer idp;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
104 unsigned char mb[4];
9968
fc6684d1f454 [gaim-migrate @ 10878]
Luke Schierer <lschiere@pidgin.im>
parents: 9943
diff changeset
105 const char *state;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
106
10801
b5f44181183f [gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10751
diff changeset
107 if (gc != NULL)
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
108 sg = purple_connection_get_protocol_data(gc);
10801
b5f44181183f [gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10751
diff changeset
109
b5f44181183f [gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10751
diff changeset
110 if (status == NULL)
b5f44181183f [gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10751
diff changeset
111 return;
b5f44181183f [gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10751
diff changeset
112
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
113 state = purple_status_get_id(status);
10225
0dfea1bc8695 [gaim-migrate @ 11357]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10050
diff changeset
114
10801
b5f44181183f [gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10751
diff changeset
115 if (state == NULL)
b5f44181183f [gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10751
diff changeset
116 return;
10225
0dfea1bc8695 [gaim-migrate @ 11357]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 10050
diff changeset
117
10801
b5f44181183f [gaim-migrate @ 12447]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10751
diff changeset
118 if ((sg == NULL) || (sg->conn == NULL))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
119 return;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
120
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
121 mode = sg->conn->local_entry->mode;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
122 mode &= ~(SILC_UMODE_GONE |
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
123 SILC_UMODE_HYPER |
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
124 SILC_UMODE_BUSY |
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
125 SILC_UMODE_INDISPOSED |
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
126 SILC_UMODE_PAGE);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
127
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 35983
diff changeset
128 if (purple_strequal(state, "hyper"))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
129 mode |= SILC_UMODE_HYPER;
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 35983
diff changeset
130 else if (purple_strequal(state, "away"))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
131 mode |= SILC_UMODE_GONE;
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 35983
diff changeset
132 else if (purple_strequal(state, "busy"))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
133 mode |= SILC_UMODE_BUSY;
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 35983
diff changeset
134 else if (purple_strequal(state, "indisposed"))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
135 mode |= SILC_UMODE_INDISPOSED;
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 35983
diff changeset
136 else if (purple_strequal(state, "page"))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
137 mode |= SILC_UMODE_PAGE;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
138
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
139 /* Send UMODE */
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
140 idp = silc_id_payload_encode(sg->conn->local_id, SILC_ID_CLIENT);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
141 SILC_PUT32_MSB(mode, mb);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
142 silc_client_command_send(sg->client, sg->conn, SILC_COMMAND_UMODE,
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
143 silcpurple_command_reply, NULL, 2,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
144 1, idp->data, silc_buffer_len(idp),
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
145 2, mb, sizeof(mb));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
146 silc_buffer_free(idp);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
147 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
148
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
149
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
150 /*************************** Connection Routines *****************************/
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
151
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
152 static void
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
153 silcpurple_keepalive(PurpleProtocolServer *protocol_server, PurpleConnection *gc)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
154 {
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
155 SilcPurple sg = purple_connection_get_protocol_data(gc);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
156 silc_packet_send(sg->conn->stream, SILC_PACKET_HEARTBEAT, 0,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
157 NULL, 0);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
158 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
159
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
160 typedef struct {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
161 SilcPurple sg;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
162 SilcUInt32 fd;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
163 guint tag;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
164 } *SilcPurpleTask;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
165
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
166 /* A timeout occurred. Call SILC scheduler. */
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
167
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
168 static gboolean
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
169 silcpurple_scheduler_timeout(gpointer context)
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
170 {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
171 SilcPurpleTask task = (SilcPurpleTask)context;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
172 silc_client_run_one(task->sg->client);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
173 silc_dlist_del(task->sg->tasks, task);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
174 silc_free(task);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
175 return FALSE;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
176 }
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
177
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
178 /* An fd task event occurred. Call SILC scheduler. */
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
179
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
180 static void
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
181 silcpurple_scheduler_fd(gpointer data, gint fd, PurpleInputCondition cond)
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
182 {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
183 SilcClient client = (SilcClient)data;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
184 silc_client_run_one(client);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
185 }
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
186
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
187 /* SILC Scheduler notify callback. This is called whenever task is added to
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
188 or deleted from SILC scheduler. It's also called when fd task events
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
189 change. Here we add same tasks to glib's main loop. */
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
190
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
191 static void
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
192 silcpurple_scheduler(SilcSchedule schedule,
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
193 SilcBool added, SilcTask task,
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
194 SilcBool fd_task, SilcUInt32 fd,
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
195 SilcTaskEvent event,
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
196 long seconds, long useconds,
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
197 void *context)
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
198 {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
199 SilcClient client = (SilcClient)context;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
200 PurpleConnection *gc = client->application;
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
201 SilcPurple sg = purple_connection_get_protocol_data(gc);
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
202 SilcPurpleTask ptask = NULL;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
203
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
204 if (added) {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
205 if (fd_task) {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
206 /* Add fd or change fd events */
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
207 PurpleInputCondition e = 0;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
208
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
209 silc_dlist_start(sg->tasks);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
210 while ((ptask = silc_dlist_get(sg->tasks)))
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
211 if (ptask->fd == fd) {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
212 purple_input_remove(ptask->tag);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
213 break;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
214 }
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
215
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
216 if (event & SILC_TASK_READ)
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
217 e |= PURPLE_INPUT_READ;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
218 if (event & SILC_TASK_WRITE)
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
219 e |= PURPLE_INPUT_WRITE;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
220
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
221 if (e) {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
222 if (!ptask) {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
223 ptask = silc_calloc(1, sizeof(*ptask));
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
224 ptask->fd = fd;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
225 silc_dlist_add(sg->tasks, ptask);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
226 }
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
227 ptask->tag = purple_input_add(fd, e, silcpurple_scheduler_fd,
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
228 client);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
229 } else if (ptask) {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
230 silc_dlist_del(sg->tasks, ptask);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
231 silc_free(ptask);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
232 }
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
233 } else {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
234 /* Add timeout */
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
235 ptask = silc_calloc(1, sizeof(*ptask));
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
236 ptask->sg = sg;
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 38358
diff changeset
237 ptask->tag = g_timeout_add((seconds * 1000) +
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
238 (useconds / 1000),
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
239 silcpurple_scheduler_timeout,
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
240 ptask);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
241 silc_dlist_add(sg->tasks, ptask);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
242 }
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
243 } else {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
244 if (fd_task) {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
245 /* Remove fd */
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
246 silc_dlist_start(sg->tasks);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
247 while ((ptask = silc_dlist_get(sg->tasks)))
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
248 if (ptask->fd == fd) {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
249 purple_input_remove(ptask->tag);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
250 silc_dlist_del(sg->tasks, ptask);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
251 silc_free(ptask);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
252 break;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
253 }
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
254 }
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
255 }
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
256 }
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
257
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
258 static void
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
259 silcpurple_connect_cb(SilcClient client, SilcClientConnection conn,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
260 SilcClientConnectionStatus status, SilcStatus error,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
261 const char *message, void *context)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
262 {
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
263 PurpleConnection *gc = context;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
264 SilcPurple sg;
17677
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
265 SilcUInt32 mask;
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
266 char tz[16];
35833
a7bfc2479cbd imgstore: unref silc; fix inline images in silc
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35681
diff changeset
267 PurpleImage *img;
17677
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
268 #ifdef HAVE_SYS_UTSNAME_H
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
269 struct utsname u;
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
270 #endif
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
271
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
272 sg = purple_connection_get_protocol_data(gc);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
273
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
274 switch (status) {
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
275 case SILC_CLIENT_CONN_SUCCESS:
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
276 case SILC_CLIENT_CONN_SUCCESS_RESUME:
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
277 sg->conn = conn;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
278
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
279 /* Connection created successfully */
34746
dc9c911dbd35 Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents: 34699
diff changeset
280 purple_connection_set_state(gc, PURPLE_CONNECTION_CONNECTED);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
281
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
282 /* Send the server our buddy list */
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
283 silcpurple_send_buddylist(gc);
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
284
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
285 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account)));
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
286
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
287 /* Send any UMODEs configured for account */
17677
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
288 if (purple_account_get_bool(sg->account, "block-ims", FALSE)) {
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
289 silc_client_command_call(sg->client, sg->conn, NULL,
17677
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
290 "UMODE", "+P", NULL);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
291 }
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
292
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
293 /* Set default attributes */
17677
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
294 mask = SILC_ATTRIBUTE_MOOD_NORMAL;
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
295 silc_client_attribute_add(client, conn,
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
296 SILC_ATTRIBUTE_STATUS_MOOD,
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
297 SILC_32_TO_PTR(mask),
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
298 sizeof(SilcUInt32));
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
299 mask = SILC_ATTRIBUTE_CONTACT_CHAT;
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
300 silc_client_attribute_add(client, conn,
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
301 SILC_ATTRIBUTE_PREFERRED_CONTACT,
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
302 SILC_32_TO_PTR(mask),
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
303 sizeof(SilcUInt32));
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
304 #ifdef HAVE_SYS_UTSNAME_H
17677
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
305 if (!uname(&u)) {
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
306 SilcAttributeObjDevice dev;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
307 memset(&dev, 0, sizeof(dev));
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
308 dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
309 dev.version = u.release;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
310 dev.model = u.sysname;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
311 silc_client_attribute_add(client, conn,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
312 SILC_ATTRIBUTE_DEVICE_INFO,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
313 (void *)&dev, sizeof(dev));
17677
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
314 }
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
315 #endif
17677
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
316 silc_timezone(tz, sizeof(tz));
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
317 silc_client_attribute_add(client, conn,
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
318 SILC_ATTRIBUTE_TIMEZONE,
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
319 (void *)tz, strlen(tz));
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
320
17677
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
321 /* Set our buddy icon */
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
322 img = purple_buddy_icons_find_account_icon(sg->account);
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
323 silcpurple_buddy_set_icon(NULL, gc, img);
35833
a7bfc2479cbd imgstore: unref silc; fix inline images in silc
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35681
diff changeset
324 g_object_unref(img);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
325
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
326 return;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
327 break;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
328
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
329 case SILC_CLIENT_CONN_DISCONNECTED:
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
330 /* Disconnected */
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
331 if (sg->resuming && !sg->detaching)
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
332 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account)));
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
333
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
334 /* Close the connection */
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
335 if (!sg->detaching)
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31802
diff changeset
336 purple_connection_error(gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
337 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20458
446bd3a80bdc Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents: 19684
diff changeset
338 _("Disconnected by server"));
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
339 else
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
340 /* TODO: Does this work correctly? Maybe we need to set wants_to_die? */
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
341 purple_account_disconnect(purple_connection_get_account(gc));
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
342 break;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
343
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
344 case SILC_CLIENT_CONN_ERROR:
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31802
diff changeset
345 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 26482
diff changeset
346 _("Error connecting to SILC Server"));
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
347 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account)));
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
348 break;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
349
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
350 case SILC_CLIENT_CONN_ERROR_KE:
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31802
diff changeset
351 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
20458
446bd3a80bdc Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents: 19684
diff changeset
352 _("Key Exchange failed"));
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
353 break;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
354
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
355 case SILC_CLIENT_CONN_ERROR_AUTH:
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31802
diff changeset
356 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED,
20458
446bd3a80bdc Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents: 19684
diff changeset
357 _("Authentication failed"));
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
358 break;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
359
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
360 case SILC_CLIENT_CONN_ERROR_RESUME:
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31802
diff changeset
361 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
20458
446bd3a80bdc Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents: 19684
diff changeset
362 _("Resuming detached session failed. "
446bd3a80bdc Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents: 19684
diff changeset
363 "Press Reconnect to create new connection."));
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
364 g_unlink(silcpurple_session_file(purple_account_get_username(sg->account)));
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
365 break;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
366
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
367 case SILC_CLIENT_CONN_ERROR_TIMEOUT:
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31802
diff changeset
368 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 26482
diff changeset
369 _("Connection timed out"));
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
370 break;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
371 }
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
372
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
373 /* Error */
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
374 sg->conn = NULL;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
375 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
376
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
377 static void
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
378 silcpurple_stream_created(SilcSocketStreamStatus status, SilcStream stream,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
379 void *context)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
380 {
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
381 PurpleConnection *gc = context;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
382 SilcPurple sg;
9732
644615310076 [gaim-migrate @ 10593]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9597
diff changeset
383 SilcClient client;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
384 SilcClientConnectionParams params;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
385 const char *dfile;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
386
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
387 sg = purple_connection_get_protocol_data(gc);
13410
590ccd4c9bb1 [gaim-migrate @ 15784]
Richard Laager <rlaager@pidgin.im>
parents: 13297
diff changeset
388
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
389 if (status != SILC_SOCKET_OK) {
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31802
diff changeset
390 purple_connection_error(gc,
21513
02642f4cb3df Switch to purple_connection_error_reason in msnp9, and a few places I missed in
Will Thompson <resiak@pidgin.im>
parents: 21503
diff changeset
391 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
02642f4cb3df Switch to purple_connection_error_reason in msnp9, and a few places I missed in
Will Thompson <resiak@pidgin.im>
parents: 21503
diff changeset
392 _("Connection failed"));
40114
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
393 silcpurple_free(sg);
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
394 purple_connection_set_protocol_data(gc, NULL);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
395 return;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
396 }
9732
644615310076 [gaim-migrate @ 10593]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9597
diff changeset
397
644615310076 [gaim-migrate @ 10593]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9597
diff changeset
398 client = sg->client;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
399
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
400 /* Get session detachment data, if available */
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
401 memset(&params, 0, sizeof(params));
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
402 dfile = silcpurple_session_file(purple_account_get_username(sg->account));
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
403 params.detach_data = (unsigned char *)silc_file_readfile(dfile, &params.detach_data_len);
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
404 if (params.detach_data)
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
405 params.detach_data[params.detach_data_len] = 0;
17677
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
406 params.ignore_requested_attributes = FALSE;
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
407 params.pfs = purple_account_get_bool(sg->account, "pfs", FALSE);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
408
22847
fea937d28d73 Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
409 /* Progress */
fea937d28d73 Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
410 if (params.detach_data) {
fea937d28d73 Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
411 purple_connection_update_progress(gc, _("Resuming session"), 2, 5);
fea937d28d73 Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
412 sg->resuming = TRUE;
fea937d28d73 Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
413 } else {
fea937d28d73 Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
414 purple_connection_update_progress(gc, _("Performing key exchange"), 2, 5);
fea937d28d73 Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
415 }
fea937d28d73 Don't access uninitialized memory (I think this might actually fix some
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21630
diff changeset
416
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
417 /* Perform SILC Key Exchange. */
35983
029ab6fae0e6 Backport more warning fixes for prpls from default
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33801
diff changeset
418 silc_client_key_exchange(client, &params, sg->public_key,
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
419 sg->private_key, stream, SILC_CONN_SERVER,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
420 silcpurple_connect_cb, gc);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
421
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
422 silc_free(params.detach_data);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
423 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
424
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
425 static void
40115
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
426 silcpurple_login_connected(GObject *source, GAsyncResult *res, gpointer data)
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
427 {
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
428 PurpleConnection *gc = data;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
429 SilcPurple sg;
40115
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
430 GSocketConnection *conn;
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
431 GSocket *socket;
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
432 gint fd;
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
433 GError *error = NULL;
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
434
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
435 g_return_if_fail(gc != NULL);
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
436
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
437 sg = purple_connection_get_protocol_data(gc);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
438
40115
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
439 conn = g_socket_client_connect_to_host_finish(G_SOCKET_CLIENT(source),
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
440 res, &error);
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
441 if (conn == NULL) {
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
442 if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
443 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
444 _("Connection failed"));
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
445 silcpurple_free(sg);
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
446 purple_connection_set_protocol_data(gc, NULL);
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
447 }
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
448
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
449 g_clear_error(&error);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
450 return;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
451 }
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
452
40115
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
453 socket = g_socket_connection_get_socket(conn);
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
454 g_assert(socket != NULL);
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
455
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
456 fd = g_socket_get_fd(socket);
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
457 sg->sockconn = conn;
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
458
21522
db7633b6104d kill another compile warning
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21513
diff changeset
459 silc_hash_alloc((unsigned char *)"sha1", &sg->sha1hash);
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
460
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
461 /* Wrap socket to TCP stream */
40115
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
462 silc_socket_tcp_stream_create(fd, TRUE, FALSE,
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
463 sg->client->schedule,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
464 silcpurple_stream_created, gc);
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
465 }
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
466
22853
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
467 static void silcpurple_continue_running(SilcPurple sg)
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
468 {
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
469 PurpleConnection *gc = sg->gc;
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
470 PurpleAccount *account = purple_connection_get_account(gc);
40115
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
471 GSocketClient *client;
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
472 GError *error = NULL;
22853
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
473
40115
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
474 client = purple_gio_socket_client_new(account, &error);
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
475 if (client == NULL) {
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
476 /* Assume it's a proxy error */
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
477 purple_notify_error(NULL, NULL, _("Invalid proxy settings"),
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
478 error->message,
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
479 purple_request_cpar_from_account(account));
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
480 purple_connection_take_error(gc, error);
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
481 purple_connection_set_protocol_data(gc, NULL);
40114
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
482 silcpurple_free(sg);
22853
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
483 return;
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
484 }
40115
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
485
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
486 /* Connect to the SILC server */
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
487 g_socket_client_connect_to_host_async(client,
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
488 purple_account_get_string(account, "server",
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
489 "silc.silcnet.org"),
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
490 purple_account_get_int(account, "port", 706),
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
491 sg->cancellable, silcpurple_login_connected, gc);
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
492 g_object_unref(client);
22853
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
493 }
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
494
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
495 static void silcpurple_got_password_cb(PurpleConnection *gc, PurpleRequestFields *fields)
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
496 {
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
497 SilcPurple sg = purple_connection_get_protocol_data(gc);
22853
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
498 PurpleAccount *account = purple_connection_get_account(gc);
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
499 char pkd[256], prd[256];
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
500 const char *password;
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
501 gboolean remember;
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
502 PurpleCredentialManager *manager;
22853
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
503
36068
e9b9320a985a Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36055
diff changeset
504 /* TODO: the password prompt dialog doesn't get disposed if the account disconnects */
e9b9320a985a Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36055
diff changeset
505 PURPLE_ASSERT_CONNECTION_IS_VALID(gc);
22853
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
506
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
507 password = purple_request_fields_get_string(fields, "password");
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
508 remember = purple_request_fields_get_bool(fields, "remember");
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
509
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
510 if (!password || !*password)
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
511 {
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
512 purple_notify_error(gc, NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
513 _("Password is required to sign on."), NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
514 purple_request_cpar_from_connection(gc));
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
515 purple_connection_set_protocol_data(gc, NULL);
40114
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
516 silcpurple_free(sg);
22853
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
517 return;
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
518 }
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
519
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
520 if (remember)
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
521 purple_account_set_remember_password(account, TRUE);
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
522
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
523 manager = purple_credential_manager_get_default();
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
524 purple_credential_manager_write_password_async(manager, account, password,
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
525 NULL, NULL, NULL);
22853
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
526
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
527 /* Load SILC key pair */
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
528 g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir());
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
529 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir());
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
530 if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd),
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
531 (char *)purple_account_get_string(account, "private-key", prd),
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
532 password,
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
533 &sg->public_key, &sg->private_key)) {
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31802
diff changeset
534 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 26482
diff changeset
535 _("Unable to load SILC key pair"));
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
536 purple_connection_set_protocol_data(gc, NULL);
40114
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
537 silcpurple_free(sg);
22853
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
538 return;
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
539 }
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
540 silcpurple_continue_running(sg);
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
541 }
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
542
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
543 static void silcpurple_no_password_cb(PurpleConnection *gc, PurpleRequestFields *fields)
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
544 {
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
545 SilcPurple sg;
36068
e9b9320a985a Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36055
diff changeset
546
e9b9320a985a Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36055
diff changeset
547 /* TODO: the password prompt dialog doesn't get disposed if the account disconnects */
e9b9320a985a Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36055
diff changeset
548 PURPLE_ASSERT_CONNECTION_IS_VALID(gc);
e9b9320a985a Drop PURPLE_CONNECTION_IS_VALID in favor of (temporary) PURPLE_ASSERT_CONNECTION_IS_VALID
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36055
diff changeset
549
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
550 sg = purple_connection_get_protocol_data(gc);
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31802
diff changeset
551 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 26482
diff changeset
552 _("Unable to load SILC key pair"));
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
553 purple_connection_set_protocol_data(gc, NULL);
40114
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
554 silcpurple_free(sg);
22853
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
555 }
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
556
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
557 static void silcpurple_running(SilcClient client, void *context)
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
558 {
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
559 SilcPurple sg = context;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
560 PurpleConnection *gc = sg->gc;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
561 PurpleAccount *account = purple_connection_get_account(gc);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
562 char pkd[256], prd[256];
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
563
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
564
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
565 /* Progress */
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
566 purple_connection_update_progress(gc, _("Connecting to SILC Server"), 1, 5);
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
567
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
568 /* Load SILC key pair */
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
569 g_snprintf(pkd, sizeof(pkd), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir());
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
570 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir());
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
571 if (!silc_load_key_pair((char *)purple_account_get_string(account, "public-key", pkd),
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
572 (char *)purple_account_get_string(account, "private-key", prd),
32683
5376a35d461a Samtime: Move the "inpa" input watcher into protocol_data.
Andrew Victor <andrew.victor@mxit.com>
parents: 32678
diff changeset
573 (purple_connection_get_password(gc) == NULL) ? "" : purple_connection_get_password(gc),
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
574 &sg->public_key, &sg->private_key)) {
34022
c49f6e9ea27d Make all the prpls build.
Paul Aurich <darkrain42@pidgin.im>
parents: 27879
diff changeset
575 if (!purple_connection_get_password(gc)) {
22853
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
576 purple_account_request_password(account, G_CALLBACK(silcpurple_got_password_cb),
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
577 G_CALLBACK(silcpurple_no_password_cb), gc);
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
578 return;
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
579 }
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31802
diff changeset
580 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
27879
f53273ef4e7e Fix an incorrect string. Yes, this breaks the string freeze. But the string
Mark Doliner <markdoliner@pidgin.im>
parents: 27635
diff changeset
581 _("Unable to load SILC key pair"));
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
582 purple_connection_set_protocol_data(gc, NULL);
40114
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
583 silcpurple_free(sg);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
584 return;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
585 }
22853
02735afc5a47 Prompt for silc private key passphrase if it is not saved for the account
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22852
diff changeset
586 silcpurple_continue_running(sg);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
587 }
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
588
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
589 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
590 silcpurple_login(PurpleAccount *account)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
591 {
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
592 SilcClient client;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
593 PurpleConnection *gc;
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
594 SilcPurple sg;
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
595 SilcClientParams params;
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
596 const char *cipher, *hmac;
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
597 char *username, *hostname, *realname, **up;
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
598 int i;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
599
32624
f957ad287bcc Convert code to use the purple_account accessor functions.
Andrew Victor <andrew.victor@mxit.com>
parents: 32623
diff changeset
600 gc = purple_account_get_connection(account);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
601 if (!gc)
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
602 return;
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
603 purple_connection_set_protocol_data(gc, NULL);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
604
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
605 memset(&params, 0, sizeof(params));
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
606 strcat(params.nickname_format, "%n#a");
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
607
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
608 /* Allocate SILC client */
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
609 client = silc_client_alloc(&ops, &params, gc, NULL);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
610 if (!client) {
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31802
diff changeset
611 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
20458
446bd3a80bdc Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents: 19684
diff changeset
612 _("Out of memory"));
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
613 return;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
614 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
615
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
616 /* Get username, real name and local hostname for SILC library */
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
617 if (!purple_account_get_username(account))
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
618 purple_account_set_username(account, silc_get_username());
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
619
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
620 username = (char *)purple_account_get_username(account);
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
621 up = g_strsplit(username, "@", 2);
22972
2942c1995c22 Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents: 22853
diff changeset
622 username = g_strdup(up[0]);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
623 g_strfreev(up);
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
624
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
625 if (!purple_account_get_user_info(account)) {
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
626 purple_account_set_user_info(account, silc_get_real_name());
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
627 if (!purple_account_get_user_info(account))
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
628 purple_account_set_user_info(account,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
629 "John T. Noname");
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
630 }
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
631 realname = (char *)purple_account_get_user_info(account);
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
632 hostname = silc_net_localhost();
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
633
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
634 purple_connection_set_display_name(gc, username);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
635
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
636 /* Register requested cipher and HMAC */
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
637 cipher = purple_account_get_string(account, "cipher",
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
638 SILC_DEFAULT_CIPHER);
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
639 for (i = 0; silc_default_ciphers[i].name; i++)
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 35983
diff changeset
640 if (purple_strequal(silc_default_ciphers[i].name, cipher)) {
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
641 silc_cipher_register(&(silc_default_ciphers[i]));
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
642 break;
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
643 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
644 hmac = purple_account_get_string(account, "hmac", SILC_DEFAULT_HMAC);
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
645 for (i = 0; silc_default_hmacs[i].name; i++)
38258
9a6551eba09c Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 35983
diff changeset
646 if (purple_strequal(silc_default_hmacs[i].name, hmac)) {
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
647 silc_hmac_register(&(silc_default_hmacs[i]));
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
648 break;
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
649 }
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
650
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
651 sg = silc_calloc(1, sizeof(*sg));
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
652 if (!sg)
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
653 return;
40115
68872ce295a4 Convert SILC to GIO.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40114
diff changeset
654 sg->cancellable = g_cancellable_new();
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
655 sg->client = client;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
656 sg->gc = gc;
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
657 sg->account = account;
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
658 purple_connection_set_protocol_data(gc, sg);
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
659
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
660 /* Init SILC client */
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
661 if (!silc_client_init(client, username, hostname, realname,
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
662 silcpurple_running, sg)) {
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31802
diff changeset
663 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 26482
diff changeset
664 _("Unable to initialize SILC protocol"));
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
665 purple_connection_set_protocol_data(gc, NULL);
40114
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
666 silcpurple_free(sg);
22972
2942c1995c22 Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents: 22853
diff changeset
667 silc_free(hostname);
2942c1995c22 Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents: 22853
diff changeset
668 g_free(username);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
669 return;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
670 }
22972
2942c1995c22 Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents: 22853
diff changeset
671 silc_free(hostname);
2942c1995c22 Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents: 22853
diff changeset
672 g_free(username);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
673
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
674 /* Check the ~/.silc dir and create it, and new key pair if necessary. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
675 if (!silcpurple_check_silc_dir(gc)) {
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31802
diff changeset
676 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR,
20458
446bd3a80bdc Add disconnection reasons to silc.
Will Thompson <resiak@pidgin.im>
parents: 19684
diff changeset
677 _("Error loading SILC key pair"));
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
678 purple_connection_set_protocol_data(gc, NULL);
40114
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
679 silcpurple_free(sg);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
680 return;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
681 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
682
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
683 /* Run SILC scheduler */
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
684 sg->tasks = silc_dlist_init();
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
685 silc_schedule_set_notify(client->schedule, silcpurple_scheduler,
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
686 client);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
687 silc_client_run_one(client);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
688 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
689
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
690 static int
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
691 silcpurple_close_final(gpointer *context)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
692 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
693 SilcPurple sg = (SilcPurple)context;
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
694
31444
e39abb0b126b silc: Debug messages.
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
695 purple_debug_info("silc", "Finalizing SilcPurple %p\n", sg);
e39abb0b126b silc: Debug messages.
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
696
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
697 silc_client_stop(sg->client, NULL, NULL);
40116
29830983ace7 silc: Move more things to silcpurple_free.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40115
diff changeset
698
40114
349e6643afae silc: Add a simple free function for protocol data.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 40113
diff changeset
699 silcpurple_free(sg);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
700 return 0;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
701 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
702
40779
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
703 static gchar *
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
704 silcpurple_get_quit_message(void)
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
705 {
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
706 PurpleUiInfo *ui_info;
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
707 const char *ui_name = NULL, *ui_website = NULL;
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
708 char *quit_msg;
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
709
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
710 ui_info = purple_core_get_ui_info();
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
711 if (PURPLE_IS_UI_INFO(ui_info)) {
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
712 ui_name = purple_ui_info_get_name(ui_info);
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
713 ui_website = purple_ui_info_get_website(ui_info);
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
714 }
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
715
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
716 if (!ui_name || !ui_website) {
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
717 ui_name = "Pidgin";
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
718 ui_website = PURPLE_WEBSITE;
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
719 }
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
720
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
721 quit_msg = g_strdup_printf(_("Download %s: %s"), ui_name, ui_website);
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
722
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
723 return quit_msg;
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
724 }
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
725
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
726 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
727 silcpurple_close(PurpleConnection *gc)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
728 {
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
729 SilcPurple sg = purple_connection_get_protocol_data(gc);
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
730 SilcPurpleTask task;
23545
676b13ddfd2c Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents: 23542
diff changeset
731 char *quit_msg;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
732
10547
61f5540fc15a [gaim-migrate @ 11917]
Mark Doliner <markdoliner@pidgin.im>
parents: 10516
diff changeset
733 g_return_if_fail(sg != NULL);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
734
40779
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
735 quit_msg = silcpurple_get_quit_message();
23545
676b13ddfd2c Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents: 23542
diff changeset
736
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
737 /* Send QUIT */
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
738 silc_client_command_call(sg->client, sg->conn, NULL,
40779
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
739 "QUIT", quit_msg, NULL);
23545
676b13ddfd2c Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents: 23542
diff changeset
740 g_free(quit_msg);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
741
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
742 if (sg->conn)
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
743 silc_client_close_connection(sg->client, sg->conn);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
744
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
745 if (sg->conn)
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
746 silc_client_run_one(sg->client);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
747 silc_schedule_set_notify(sg->client->schedule, NULL, NULL);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
748
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
749 silc_dlist_start(sg->tasks);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
750 while ((task = silc_dlist_get(sg->tasks))) {
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
751 purple_input_remove(task->tag);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
752 silc_free(task);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
753 }
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
754 silc_dlist_uninit(sg->tasks);
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
755
35833
a7bfc2479cbd imgstore: unref silc; fix inline images in silc
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35681
diff changeset
756 if (sg->scheduler)
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 38358
diff changeset
757 g_source_remove(sg->scheduler);
31444
e39abb0b126b silc: Debug messages.
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
758
e39abb0b126b silc: Debug messages.
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
759 purple_debug_info("silc", "Scheduling destruction of SilcPurple %p\n", sg);
38433
361c801c4536 Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents: 38358
diff changeset
760 g_timeout_add(1, (GSourceFunc)silcpurple_close_final, sg);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
761 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
762
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
763
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
764 /****************************** Protocol Actions *****************************/
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
765
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
766 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
767 silcpurple_attrs_cancel(PurpleConnection *gc, PurpleRequestFields *fields)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
768 {
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
769 /* Nothing */
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
770 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
771
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
772 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
773 silcpurple_attrs_cb(PurpleConnection *gc, PurpleRequestFields *fields)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
774 {
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
775 SilcPurple sg = purple_connection_get_protocol_data(gc);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
776 SilcClient client = sg->client;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
777 SilcClientConnection conn = sg->conn;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
778 PurpleRequestField *f;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
779 char *tmp;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
780 SilcUInt32 tmp_len, mask;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
781 SilcAttributeObjService service;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
782 SilcAttributeObjDevice dev;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
783 SilcVCardStruct vcard;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
784 const char *val;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
785
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
786 sg = purple_connection_get_protocol_data(gc);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
787 if (!sg)
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
788 return;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
789
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
790 memset(&service, 0, sizeof(service));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
791 memset(&dev, 0, sizeof(dev));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
792 memset(&vcard, 0, sizeof(vcard));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
793
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
794 silc_client_attribute_del(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
795 SILC_ATTRIBUTE_USER_INFO, NULL);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
796 silc_client_attribute_del(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
797 SILC_ATTRIBUTE_SERVICE, NULL);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
798 silc_client_attribute_del(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
799 SILC_ATTRIBUTE_STATUS_MOOD, NULL);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
800 silc_client_attribute_del(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
801 SILC_ATTRIBUTE_STATUS_FREETEXT, NULL);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
802 silc_client_attribute_del(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
803 SILC_ATTRIBUTE_STATUS_MESSAGE, NULL);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
804 silc_client_attribute_del(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
805 SILC_ATTRIBUTE_PREFERRED_LANGUAGE, NULL);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
806 silc_client_attribute_del(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
807 SILC_ATTRIBUTE_PREFERRED_CONTACT, NULL);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
808 silc_client_attribute_del(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
809 SILC_ATTRIBUTE_TIMEZONE, NULL);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
810 silc_client_attribute_del(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
811 SILC_ATTRIBUTE_GEOLOCATION, NULL);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
812 silc_client_attribute_del(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
813 SILC_ATTRIBUTE_DEVICE_INFO, NULL);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
814
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
815 /* Set mood */
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
816 mask = 0;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
817 f = purple_request_fields_get_field(fields, "mood_normal");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
818 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
819 mask |= SILC_ATTRIBUTE_MOOD_NORMAL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
820 f = purple_request_fields_get_field(fields, "mood_happy");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
821 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
822 mask |= SILC_ATTRIBUTE_MOOD_HAPPY;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
823 f = purple_request_fields_get_field(fields, "mood_sad");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
824 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
825 mask |= SILC_ATTRIBUTE_MOOD_SAD;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
826 f = purple_request_fields_get_field(fields, "mood_angry");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
827 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
828 mask |= SILC_ATTRIBUTE_MOOD_ANGRY;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
829 f = purple_request_fields_get_field(fields, "mood_jealous");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
830 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
831 mask |= SILC_ATTRIBUTE_MOOD_JEALOUS;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
832 f = purple_request_fields_get_field(fields, "mood_ashamed");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
833 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
834 mask |= SILC_ATTRIBUTE_MOOD_ASHAMED;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
835 f = purple_request_fields_get_field(fields, "mood_invincible");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
836 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
837 mask |= SILC_ATTRIBUTE_MOOD_INVINCIBLE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
838 f = purple_request_fields_get_field(fields, "mood_inlove");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
839 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
840 mask |= SILC_ATTRIBUTE_MOOD_INLOVE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
841 f = purple_request_fields_get_field(fields, "mood_sleepy");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
842 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
843 mask |= SILC_ATTRIBUTE_MOOD_SLEEPY;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
844 f = purple_request_fields_get_field(fields, "mood_bored");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
845 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
846 mask |= SILC_ATTRIBUTE_MOOD_BORED;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
847 f = purple_request_fields_get_field(fields, "mood_excited");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
848 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
849 mask |= SILC_ATTRIBUTE_MOOD_EXCITED;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
850 f = purple_request_fields_get_field(fields, "mood_anxious");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
851 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
852 mask |= SILC_ATTRIBUTE_MOOD_ANXIOUS;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
853 silc_client_attribute_add(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
854 SILC_ATTRIBUTE_STATUS_MOOD,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
855 SILC_32_TO_PTR(mask),
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
856 sizeof(SilcUInt32));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
857
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
858 /* Set preferred contact */
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
859 mask = 0;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
860 f = purple_request_fields_get_field(fields, "contact_chat");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
861 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
862 mask |= SILC_ATTRIBUTE_CONTACT_CHAT;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
863 f = purple_request_fields_get_field(fields, "contact_email");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
864 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
865 mask |= SILC_ATTRIBUTE_CONTACT_EMAIL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
866 f = purple_request_fields_get_field(fields, "contact_call");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
867 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
868 mask |= SILC_ATTRIBUTE_CONTACT_CALL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
869 f = purple_request_fields_get_field(fields, "contact_sms");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
870 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
871 mask |= SILC_ATTRIBUTE_CONTACT_SMS;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
872 f = purple_request_fields_get_field(fields, "contact_mms");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
873 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
874 mask |= SILC_ATTRIBUTE_CONTACT_MMS;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
875 f = purple_request_fields_get_field(fields, "contact_video");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
876 if (f && purple_request_field_bool_get_value(f))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
877 mask |= SILC_ATTRIBUTE_CONTACT_VIDEO;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
878 if (mask)
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
879 silc_client_attribute_add(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
880 SILC_ATTRIBUTE_PREFERRED_CONTACT,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
881 SILC_32_TO_PTR(mask),
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
882 sizeof(SilcUInt32));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
883
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
884 /* Set status text */
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
885 val = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
886 f = purple_request_fields_get_field(fields, "status_text");
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
887 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
888 val = purple_request_field_string_get_value(f);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
889 if (val && *val)
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
890 silc_client_attribute_add(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
891 SILC_ATTRIBUTE_STATUS_FREETEXT,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
892 (void *)val, strlen(val));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
893
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
894 /* Set vcard */
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
895 val = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
896 f = purple_request_fields_get_field(fields, "vcard");
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
897 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
898 val = purple_request_field_string_get_value(f);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
899 if (val && *val) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
900 purple_account_set_string(sg->account, "vcard", val);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
901 tmp = silc_file_readfile(val, &tmp_len);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
902 if (tmp) {
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
903 tmp[tmp_len] = 0;
11318
13fa1d5134f3 [gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11257
diff changeset
904 if (silc_vcard_decode((unsigned char *)tmp, tmp_len, &vcard))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
905 silc_client_attribute_add(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
906 SILC_ATTRIBUTE_USER_INFO,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
907 (void *)&vcard,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
908 sizeof(vcard));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
909 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
910 silc_vcard_free(&vcard);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
911 silc_free(tmp);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
912 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
913 purple_account_set_string(sg->account, "vcard", "");
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
914 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
915
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
916 #ifdef HAVE_SYS_UTSNAME_H
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
917 /* Set device info */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
918 f = purple_request_fields_get_field(fields, "device");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
919 if (f && purple_request_field_bool_get_value(f)) {
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
920 struct utsname u;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
921 if (!uname(&u)) {
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
922 dev.type = SILC_ATTRIBUTE_DEVICE_COMPUTER;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
923 dev.version = u.release;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
924 dev.model = u.sysname;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
925 silc_client_attribute_add(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
926 SILC_ATTRIBUTE_DEVICE_INFO,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
927 (void *)&dev, sizeof(dev));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
928 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
929 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
930 #endif
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
931
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
932 /* Set timezone */
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
933 val = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
934 f = purple_request_fields_get_field(fields, "timezone");
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
935 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
936 val = purple_request_field_string_get_value(f);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
937 if (val && *val)
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
938 silc_client_attribute_add(client, conn,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
939 SILC_ATTRIBUTE_TIMEZONE,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
940 (void *)val, strlen(val));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
941 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
942
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
943 static void
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
944 silcpurple_attrs(PurpleProtocolAction *action)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
945 {
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
946 PurpleConnection *gc = action->connection;
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
947 SilcPurple sg = purple_connection_get_protocol_data(gc);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
948 SilcClient client = sg->client;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
949 SilcClientConnection conn = sg->conn;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
950 PurpleRequestFields *fields;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
951 PurpleRequestFieldGroup *g;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
952 PurpleRequestField *f;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
953 SilcHashTable attrs;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
954 SilcAttributePayload attr;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
955 gboolean mnormal = TRUE, mhappy = FALSE, msad = FALSE,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
956 mangry = FALSE, mjealous = FALSE, mashamed = FALSE,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
957 minvincible = FALSE, minlove = FALSE, msleepy = FALSE,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
958 mbored = FALSE, mexcited = FALSE, manxious = FALSE;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
959 gboolean cemail = FALSE, ccall = FALSE, csms = FALSE,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
960 cmms = FALSE, cchat = TRUE, cvideo = FALSE;
33896
fb896f14715b win32: fix most of easy warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33811
diff changeset
961 #ifdef HAVE_SYS_UTSNAME_H
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
962 gboolean device = TRUE;
33896
fb896f14715b win32: fix most of easy warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33811
diff changeset
963 #endif
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
964 char status[1024], tz[16];
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
965
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
966 sg = purple_connection_get_protocol_data(gc);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
967 if (!sg)
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
968 return;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
969
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
970 memset(status, 0, sizeof(status));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
971
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
972 attrs = silc_client_attributes_get(client, conn);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
973 if (attrs) {
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
974 if (silc_hash_table_find(attrs,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
975 SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_MOOD),
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
976 NULL, (void *)&attr)) {
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
977 SilcUInt32 mood = 0;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
978 silc_attribute_get_object(attr, &mood, sizeof(mood));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
979 mnormal = !mood;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
980 mhappy = (mood & SILC_ATTRIBUTE_MOOD_HAPPY);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
981 msad = (mood & SILC_ATTRIBUTE_MOOD_SAD);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
982 mangry = (mood & SILC_ATTRIBUTE_MOOD_ANGRY);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
983 mjealous = (mood & SILC_ATTRIBUTE_MOOD_JEALOUS);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
984 mashamed = (mood & SILC_ATTRIBUTE_MOOD_ASHAMED);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
985 minvincible = (mood & SILC_ATTRIBUTE_MOOD_INVINCIBLE);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
986 minlove = (mood & SILC_ATTRIBUTE_MOOD_INLOVE);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
987 msleepy = (mood & SILC_ATTRIBUTE_MOOD_SLEEPY);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
988 mbored = (mood & SILC_ATTRIBUTE_MOOD_BORED);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
989 mexcited = (mood & SILC_ATTRIBUTE_MOOD_EXCITED);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
990 manxious = (mood & SILC_ATTRIBUTE_MOOD_ANXIOUS);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
991 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
992
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
993 if (silc_hash_table_find(attrs,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
994 SILC_32_TO_PTR(SILC_ATTRIBUTE_PREFERRED_CONTACT),
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
995 NULL, (void *)&attr)) {
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
996 SilcUInt32 contact = 0;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
997 silc_attribute_get_object(attr, &contact, sizeof(contact));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
998 cemail = (contact & SILC_ATTRIBUTE_CONTACT_EMAIL);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
999 ccall = (contact & SILC_ATTRIBUTE_CONTACT_CALL);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1000 csms = (contact & SILC_ATTRIBUTE_CONTACT_SMS);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1001 cmms = (contact & SILC_ATTRIBUTE_CONTACT_MMS);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1002 cchat = (contact & SILC_ATTRIBUTE_CONTACT_CHAT);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1003 cvideo = (contact & SILC_ATTRIBUTE_CONTACT_VIDEO);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1004 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1005
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1006 if (silc_hash_table_find(attrs,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1007 SILC_32_TO_PTR(SILC_ATTRIBUTE_STATUS_FREETEXT),
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1008 NULL, (void *)&attr))
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1009 silc_attribute_get_object(attr, &status, sizeof(status));
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1010
33896
fb896f14715b win32: fix most of easy warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33811
diff changeset
1011 #ifdef HAVE_SYS_UTSNAME_H
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1012 if (!silc_hash_table_find(attrs,
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1013 SILC_32_TO_PTR(SILC_ATTRIBUTE_DEVICE_INFO),
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1014 NULL, (void *)&attr))
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1015 device = FALSE;
33896
fb896f14715b win32: fix most of easy warnings
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33811
diff changeset
1016 #endif
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1017 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1018
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1019 fields = purple_request_fields_new();
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1020
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1021 g = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1022 f = purple_request_field_label_new("l3", _("Your Current Mood"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1023 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1024 f = purple_request_field_bool_new("mood_normal", _("Normal"), mnormal);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1025 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1026 f = purple_request_field_bool_new("mood_happy", _("Happy"), mhappy);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1027 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1028 f = purple_request_field_bool_new("mood_sad", _("Sad"), msad);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1029 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1030 f = purple_request_field_bool_new("mood_angry", _("Angry"), mangry);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1031 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1032 f = purple_request_field_bool_new("mood_jealous", _("Jealous"), mjealous);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1033 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1034 f = purple_request_field_bool_new("mood_ashamed", _("Ashamed"), mashamed);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1035 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1036 f = purple_request_field_bool_new("mood_invincible", _("Invincible"), minvincible);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1037 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1038 f = purple_request_field_bool_new("mood_inlove", _("In love"), minlove);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1039 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1040 f = purple_request_field_bool_new("mood_sleepy", _("Sleepy"), msleepy);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1041 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1042 f = purple_request_field_bool_new("mood_bored", _("Bored"), mbored);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1043 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1044 f = purple_request_field_bool_new("mood_excited", _("Excited"), mexcited);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1045 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1046 f = purple_request_field_bool_new("mood_anxious", _("Anxious"), manxious);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1047 purple_request_field_group_add_field(g, f);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1048
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1049 f = purple_request_field_label_new("l4", _("\nYour Preferred Contact Methods"));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1050 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1051 f = purple_request_field_bool_new("contact_chat", _("Chat"), cchat);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1052 purple_request_field_group_add_field(g, f);
23325
a374a26fe217 Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents: 23278
diff changeset
1053 f = purple_request_field_bool_new("contact_email", _("Email"), cemail);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1054 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1055 f = purple_request_field_bool_new("contact_call", _("Phone"), ccall);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1056 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1057 f = purple_request_field_bool_new("contact_sms", _("SMS"), csms);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1058 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1059 f = purple_request_field_bool_new("contact_mms", _("MMS"), cmms);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1060 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1061 f = purple_request_field_bool_new("contact_video", _("Video conferencing"), cvideo);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1062 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1063 purple_request_fields_add_group(fields, g);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1064
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1065 g = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1066 f = purple_request_field_string_new("status_text", _("Your Current Status"),
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1067 status[0] ? status : NULL, TRUE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1068 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1069 purple_request_fields_add_group(fields, g);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1070
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1071 g = purple_request_field_group_new(NULL);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1072 #ifdef HAVE_SYS_UTSNAME_H
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1073 f = purple_request_field_bool_new("device",
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1074 _("Let others see what computer you are using"),
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1075 device);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1076 purple_request_field_group_add_field(g, f);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1077 #endif
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1078 purple_request_fields_add_group(fields, g);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1079
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1080 g = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1081 f = purple_request_field_string_new("vcard", _("Your VCard File"),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1082 purple_account_get_string(sg->account, "vcard", ""),
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1083 FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1084 purple_request_field_group_add_field(g, f);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1085
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1086 silc_timezone(tz, sizeof(tz));
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1087 f = purple_request_field_string_new("timezone", _("Timezone (UTC)"), tz, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1088 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1089 purple_request_fields_add_group(fields, g);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1090
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1091 purple_request_fields(gc, _("User Online Status Attributes"),
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1092 _("User Online Status Attributes"),
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1093 _("You can let other users see your online status information "
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1094 "and your personal information. Please fill the information "
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1095 "you would like other users to see about yourself."),
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1096 fields,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1097 _("OK"), G_CALLBACK(silcpurple_attrs_cb),
16492
4f0dc2d16e55 Update SILC to match resent request API changes
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15884
diff changeset
1098 _("Cancel"), G_CALLBACK(silcpurple_attrs_cancel),
34332
876483829700 Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34312
diff changeset
1099 purple_request_cpar_from_connection(gc), gc);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1100 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1101
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1102 static void
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1103 silcpurple_detach(PurpleProtocolAction *action)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1104 {
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1105 PurpleConnection *gc = action->connection;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1106 SilcPurple sg;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1107
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1108 if (!gc)
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1109 return;
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
1110 sg = purple_connection_get_protocol_data(gc);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1111 if (!sg)
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1112 return;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1113
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1114 /* Call DETACH */
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1115 silc_client_command_call(sg->client, sg->conn, "DETACH");
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1116 sg->detaching = TRUE;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1117 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1118
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1119 static void
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1120 silcpurple_view_motd(PurpleProtocolAction *action)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1121 {
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1122 PurpleConnection *gc = action->connection;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1123 SilcPurple sg;
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1124 char *tmp;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1125
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1126 if (!gc)
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1127 return;
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
1128 sg = purple_connection_get_protocol_data(gc);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1129 if (!sg)
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1130 return;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1131
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1132 if (!sg->motd) {
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
1133 purple_notify_error(gc, _("Message of the Day"), _("No Message "
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
1134 "of the Day available"), _("There is no Message of the "
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
1135 "Day associated with this connection"),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
1136 purple_request_cpar_from_connection(gc));
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1137 return;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1138 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1139
10732
5e314ab498bf [gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents: 10547
diff changeset
1140 tmp = g_markup_escape_text(sg->motd, -1);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1141 purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL,
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1142 tmp, NULL, NULL);
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1143 g_free(tmp);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1144 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1145
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1146 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1147 silcpurple_create_keypair_cancel(PurpleConnection *gc, PurpleRequestFields *fields)
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1148 {
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1149 /* Nothing */
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1150 }
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1151
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1152 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1153 silcpurple_create_keypair_cb(PurpleConnection *gc, PurpleRequestFields *fields)
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1154 {
31802
f54b3406b834 silc: Dead (redundant) initialization
Paul Aurich <darkrain42@pidgin.im>
parents: 31595
diff changeset
1155 SilcPurple sg;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1156 PurpleRequestField *f;
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1157 const char *val, *pkfile = NULL, *prfile = NULL;
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1158 const char *pass1 = NULL, *pass2 = NULL, *un = NULL, *hn = NULL;
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1159 const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL;
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1160 char *identifier;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1161 int keylen = SILCPURPLE_DEF_PKCS_LEN;
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1162 SilcPublicKey public_key;
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1163
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
1164 sg = purple_connection_get_protocol_data(gc);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1165 if (!sg)
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1166 return;
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1168 val = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1169 f = purple_request_fields_get_field(fields, "pass1");
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1170 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1171 val = purple_request_field_string_get_value(f);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1172 if (val && *val)
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1173 pass1 = val;
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1174 else
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1175 pass1 = "";
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1176 val = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1177 f = purple_request_fields_get_field(fields, "pass2");
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1178 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1179 val = purple_request_field_string_get_value(f);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1180 if (val && *val)
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1181 pass2 = val;
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1182 else
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1183 pass2 = "";
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1184
38259
c593fc9f5438 Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents: 38258
diff changeset
1185 if (!purple_strequal(pass1, pass2)) {
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
1186 purple_notify_error(gc, _("Create New SILC Key Pair"),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
1187 _("Passphrases do not match"), NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
1188 purple_request_cpar_from_connection(gc));
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1189 return;
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1190 }
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1191
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1192 val = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1193 f = purple_request_fields_get_field(fields, "key");
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1194 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1195 val = purple_request_field_string_get_value(f);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1196 if (val && *val)
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1197 keylen = atoi(val);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1198 f = purple_request_fields_get_field(fields, "pkfile");
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1199 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1200 pkfile = purple_request_field_string_get_value(f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1201 f = purple_request_fields_get_field(fields, "prfile");
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1202 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1203 prfile = purple_request_field_string_get_value(f);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1204
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1205 f = purple_request_fields_get_field(fields, "un");
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1206 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1207 un = purple_request_field_string_get_value(f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1208 f = purple_request_fields_get_field(fields, "hn");
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1209 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1210 hn = purple_request_field_string_get_value(f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1211 f = purple_request_fields_get_field(fields, "rn");
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1212 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1213 rn = purple_request_field_string_get_value(f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1214 f = purple_request_fields_get_field(fields, "e");
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1215 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1216 e = purple_request_field_string_get_value(f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1217 f = purple_request_fields_get_field(fields, "o");
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1218 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1219 o = purple_request_field_string_get_value(f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1220 f = purple_request_fields_get_field(fields, "c");
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1221 if (f)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1222 c = purple_request_field_string_get_value(f);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1223
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1224 identifier = silc_pkcs_silc_encode_identifier((char *)un, (char *)hn,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1225 (char *)rn, (char *)e,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1226 (char *)o, (char *)c,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1227 NULL);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1228
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1229 /* Create the key pair */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1230 if (!silc_create_key_pair(SILCPURPLE_DEF_PKCS, keylen, pkfile, prfile,
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1231 identifier, pass1, &public_key, NULL,
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1232 FALSE)) {
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
1233 purple_notify_error(gc, _("Create New SILC Key Pair"),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
1234 _("Key Pair Generation failed"), NULL,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
1235 purple_request_cpar_from_connection(gc));
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1236 return;
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1237 }
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1238
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1239 silcpurple_show_public_key(sg, NULL, public_key, NULL, NULL);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1240
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1241 silc_pkcs_public_key_free(public_key);
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1242 silc_free(identifier);
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1243 }
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1244
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1245 static void
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1246 silcpurple_create_keypair(PurpleProtocolAction *action)
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1247 {
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1248 PurpleConnection *gc = action->connection;
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
1249 SilcPurple sg = purple_connection_get_protocol_data(gc);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1250 PurpleRequestFields *fields;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1251 PurpleRequestFieldGroup *g;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1252 PurpleRequestField *f;
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1253 const char *username, *realname;
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1254 char *hostname, **u;
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1255 char tmp[256], pkd[256], pkd2[256], prd[256], prd2[256];
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1256
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1257 username = purple_account_get_username(sg->account);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1258 u = g_strsplit(username, "@", 2);
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1259 username = u[0];
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1260 realname = purple_account_get_user_info(sg->account);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1261 hostname = silc_net_localhost();
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1262 g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname);
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1263
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1264 g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcpurple_silcdir());
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1265 g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcpurple_silcdir());
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1266 g_snprintf(pkd, sizeof(pkd) - 1, "%s",
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32624
diff changeset
1267 purple_account_get_string(purple_connection_get_account(gc), "public-key", pkd2));
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1268 g_snprintf(prd, sizeof(prd) - 1, "%s",
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32624
diff changeset
1269 purple_account_get_string(purple_connection_get_account(gc), "private-key", prd2));
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1270
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1271 fields = purple_request_fields_new();
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1272
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1273 g = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1274 f = purple_request_field_string_new("key", _("Key length"), "2048", FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1275 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1276 f = purple_request_field_string_new("pkfile", _("Public key file"), pkd, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1277 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1278 f = purple_request_field_string_new("prfile", _("Private key file"), prd, FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1279 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1280 purple_request_fields_add_group(fields, g);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1281
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1282 g = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1283 f = purple_request_field_string_new("un", _("Username"), username ? username : "", FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1284 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1285 f = purple_request_field_string_new("hn", _("Hostname"), hostname ? hostname : "", FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1286 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1287 f = purple_request_field_string_new("rn", _("Real name"), realname ? realname : "", FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1288 purple_request_field_group_add_field(g, f);
23325
a374a26fe217 Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents: 23278
diff changeset
1289 f = purple_request_field_string_new("e", _("Email"), tmp, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1290 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1291 f = purple_request_field_string_new("o", _("Organization"), "", FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1292 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1293 f = purple_request_field_string_new("c", _("Country"), "", FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1294 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1295 purple_request_fields_add_group(fields, g);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1296
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1297 g = purple_request_field_group_new(NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1298 f = purple_request_field_string_new("pass1", _("Passphrase"), "", FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1299 purple_request_field_string_set_masked(f, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1300 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1301 f = purple_request_field_string_new("pass2", _("Passphrase (retype)"), "", FALSE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1302 purple_request_field_string_set_masked(f, TRUE);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1303 purple_request_field_group_add_field(g, f);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1304 purple_request_fields_add_group(fields, g);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1305
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1306 purple_request_fields(gc, _("Create New SILC Key Pair"),
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1307 _("Create New SILC Key Pair"), NULL, fields,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1308 _("Generate Key Pair"), G_CALLBACK(silcpurple_create_keypair_cb),
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1309 _("Cancel"), G_CALLBACK(silcpurple_create_keypair_cancel),
34332
876483829700 Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34312
diff changeset
1310 purple_request_cpar_from_connection(gc), gc);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1311
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1312 g_strfreev(u);
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1313 silc_free(hostname);
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1314 }
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1315
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1316 static void
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1317 silcpurple_change_pass(PurpleProtocolAction *action)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1318 {
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1319 PurpleConnection *gc = action->connection;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1320 purple_account_request_change_password(purple_connection_get_account(gc));
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1321 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1322
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1323 static void
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1324 silcpurple_change_passwd(PurpleProtocolServer *protocol_server, PurpleConnection *gc, const char *old, const char *new)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1325 {
22852
f6f9031e09fe Fix for changing silc private key passphrase to or from the empty string,
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22847
diff changeset
1326 char prd[256];
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1327 g_snprintf(prd, sizeof(prd), "%s" G_DIR_SEPARATOR_S "private_key.pub", silcpurple_silcdir());
32678
01f6312a4a7b On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents: 32624
diff changeset
1328 silc_change_private_key_passphrase(purple_account_get_string(purple_connection_get_account(gc),
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1329 "private-key",
22852
f6f9031e09fe Fix for changing silc private key passphrase to or from the empty string,
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 22847
diff changeset
1330 prd), old ? old : "", new ? new : "");
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1331 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1332
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1333 static void
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1334 silcpurple_show_set_info(PurpleProtocolAction *action)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1335 {
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1336 PurpleConnection *gc = action->connection;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1337 purple_account_request_change_user_info(purple_connection_get_account(gc));
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1338 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1339
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1340 static void
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1341 silcpurple_set_info(PurpleProtocolServer *protocol_server, PurpleConnection *gc, const char *text)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1342 {
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1343 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1344
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1345 static GList *
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1346 silcpurple_get_actions(PurpleProtocolClient *client, PurpleConnection *gc)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1347 {
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1348 GList *list = NULL;
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1349 PurpleProtocolAction *act;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1350
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1351 act = purple_protocol_action_new(_("Online Status"),
17677
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
1352 silcpurple_attrs);
c1ef813bddcf Remove the following SILC account options, as suggested by Pekka Riikonen
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17675
diff changeset
1353 list = g_list_append(list, act);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1354
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1355 act = purple_protocol_action_new(_("Detach From Server"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1356 silcpurple_detach);
9015
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 8993
diff changeset
1357 list = g_list_append(list, act);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1358
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1359 act = purple_protocol_action_new(_("View Message of the Day"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1360 silcpurple_view_motd);
9015
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 8993
diff changeset
1361 list = g_list_append(list, act);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1362
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1363 act = purple_protocol_action_new(_("Create SILC Key Pair..."),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1364 silcpurple_create_keypair);
12167
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1365 list = g_list_append(list, act);
f3ad3170f09d [gaim-migrate @ 14468]
Pekka Riikonen <priikone@silcnet.org>
parents: 12149
diff changeset
1366
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1367 act = purple_protocol_action_new(_("Change Password..."),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1368 silcpurple_change_pass);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1369 list = g_list_append(list, act);
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1370
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
1371 act = purple_protocol_action_new(_("Set User Info..."),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1372 silcpurple_show_set_info);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1373 list = g_list_append(list, act);
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1374
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1375 return list;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1376 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1377
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1378
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1379 /******************************* IM Routines *********************************/
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1380
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1381 typedef struct {
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1382 char *nick;
11318
13fa1d5134f3 [gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11257
diff changeset
1383 char *message;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1384 SilcUInt32 message_len;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1385 SilcMessageFlags flags;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1386 PurpleMessageFlags gflags;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1387 } *SilcPurpleIM;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1388
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1389 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1390 silcpurple_send_im_resolved(SilcClient client,
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1391 SilcClientConnection conn,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1392 SilcStatus status,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1393 SilcDList clients,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1394 void *context)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1395 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1396 PurpleConnection *gc = client->application;
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
1397 SilcPurple sg = purple_connection_get_protocol_data(gc);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1398 SilcPurpleIM im = context;
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40865
diff changeset
1399 PurpleConversation *convo;
40997
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1400 PurpleConversationManager *manager;
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1401 char tmp[256];
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1402 SilcClientEntry client_entry;
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
1403 SilcDList list;
25545
040ec50ba303 Plug a memory leak in SILC, thanks to Luke Petre.
Luke Petre <luke@petre.net>
parents: 23551
diff changeset
1404 gboolean free_list = FALSE;
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1405 const gchar *me;
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1406 PurpleMessage *msg;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1407
40997
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1408 manager = purple_conversation_manager_get_default();
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1409 convo = purple_conversation_manager_find_im(manager, sg->account, im->nick);
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1410 if (!convo) {
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1411 return;
40997
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1412 }
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1413
40997
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1414 if (!clients) {
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1415 goto err;
40997
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1416 }
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1417
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1418 if (silc_dlist_count(clients) > 1) {
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1419 /* Find the correct one. The im->nick might be a formatted nick
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1420 so this will find the correct one. */
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1421 clients = silc_client_get_clients_local(client, conn,
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1422 im->nick, FALSE);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1423 if (!clients)
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1424 goto err;
25545
040ec50ba303 Plug a memory leak in SILC, thanks to Luke Petre.
Luke Petre <luke@petre.net>
parents: 23551
diff changeset
1425
040ec50ba303 Plug a memory leak in SILC, thanks to Luke Petre.
Luke Petre <luke@petre.net>
parents: 23551
diff changeset
1426 free_list = TRUE;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1427 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1428
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1429 silc_dlist_start(clients);
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1430 client_entry = silc_dlist_get(clients);
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1431
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1432 me = purple_account_get_name_for_display(sg->account);
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1433
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
1434 /* Check for images */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1435 if (im->gflags & PURPLE_MESSAGE_IMAGES) {
33798
ab26d8e3da97 silc: Use appropriate datatype for SilcMessageFlags
Daniel Atallah <datallah@pidgin.im>
parents: 31802
diff changeset
1436 list = silcpurple_image_message(im->message, &im->flags);
12303
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1437 if (list) {
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1438 /* Send one or more MIME message. If more than one, they
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1439 are MIME fragments due to over large message */
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1440 SilcBuffer buf;
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
1441
12303
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1442 silc_dlist_start(list);
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1443 while ((buf = silc_dlist_get(list)) != SILC_LIST_END)
15081
7e978e8dc84a [gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents: 14899
diff changeset
1444 silc_client_send_private_message(client, conn,
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
1445 client_entry, im->flags, sg->sha1hash,
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1446 buf->data,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1447 silc_buffer_len(buf));
12303
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1448 silc_mime_partial_free(list);
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1449 msg = purple_message_new_outgoing(me, conn->local_entry->nickname, im->message, 0);
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40865
diff changeset
1450 purple_conversation_write_message(convo, msg);
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1451 g_object_unref(G_OBJECT(msg));
12303
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1452 goto out;
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1453 }
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1454 }
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
1455
12303
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1456 /* Send the message */
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1457 silc_client_send_private_message(client, conn, client_entry, im->flags,
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
1458 sg->sha1hash, (unsigned char *)im->message, im->message_len);
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1459 msg = purple_message_new_outgoing(me, conn->local_entry->nickname, im->message, 0);
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40865
diff changeset
1460 purple_conversation_write_message(convo, msg);
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1461 g_object_unref(G_OBJECT(msg));
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1462 goto out;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1463
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1464 err:
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1465 g_snprintf(tmp, sizeof(tmp),
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1466 _("User <I>%s</I> is not present in the network"), im->nick);
36089
c035b9a63457 Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36088
diff changeset
1467 purple_conversation_write_system_message(
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40865
diff changeset
1468 convo, tmp, 0);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1469
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1470 out:
25545
040ec50ba303 Plug a memory leak in SILC, thanks to Luke Petre.
Luke Petre <luke@petre.net>
parents: 23551
diff changeset
1471 if (free_list) {
040ec50ba303 Plug a memory leak in SILC, thanks to Luke Petre.
Luke Petre <luke@petre.net>
parents: 23551
diff changeset
1472 silc_client_list_free(client, conn, clients);
040ec50ba303 Plug a memory leak in SILC, thanks to Luke Petre.
Luke Petre <luke@petre.net>
parents: 23551
diff changeset
1473 }
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1474 g_free(im->nick);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1475 g_free(im->message);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1476 silc_free(im);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1477 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1478
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1479 static int
40507
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40358
diff changeset
1480 silcpurple_send_im(PurpleProtocolIM *pim, PurpleConnection *gc,
77d7bc9e5151 Make PurpleProtocolIM a proper interface
Gary Kramlich <grim@reaperworld.com>
parents: 40358
diff changeset
1481 PurpleMessage *pmsg)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1482 {
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
1483 SilcPurple sg = purple_connection_get_protocol_data(gc);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1484 SilcClient client = sg->client;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1485 SilcClientConnection conn = sg->conn;
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1486 SilcDList clients;
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1487 SilcClientEntry client_entry;
33798
ab26d8e3da97 silc: Use appropriate datatype for SilcMessageFlags
Daniel Atallah <datallah@pidgin.im>
parents: 31802
diff changeset
1488 SilcMessageFlags mflags;
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1489 char *msg, *tmp;
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
1490 int ret = 0;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1491 gboolean sign = purple_account_get_bool(sg->account, "sign-verify", FALSE);
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
1492 SilcDList list;
36098
4951752ad038 Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36089
diff changeset
1493 const gchar *rcpt = purple_message_get_recipient(pmsg);
36076
a0e5b68ff4ef Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36068
diff changeset
1494 const gchar *message = purple_message_get_contents(pmsg);
a0e5b68ff4ef Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36068
diff changeset
1495 PurpleMessageFlags flags = purple_message_get_flags(pmsg);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1496
36098
4951752ad038 Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36089
diff changeset
1497 if (!rcpt || purple_message_is_empty(pmsg))
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1498 return 0;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1499
9353
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1500 mflags = SILC_MESSAGE_FLAG_UTF8;
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1501
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1502 tmp = msg = purple_unescape_html(message);
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12167
diff changeset
1503
9353
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1504 if (!g_ascii_strncasecmp(msg, "/me ", 4)) {
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1505 msg += 4;
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12167
diff changeset
1506 if (!*msg) {
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12167
diff changeset
1507 g_free(tmp);
9353
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1508 return 0;
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12167
diff changeset
1509 }
9353
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1510 mflags |= SILC_MESSAGE_FLAG_ACTION;
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1511 } else if (strlen(msg) > 1 && msg[0] == '/') {
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1512 if (!silc_client_command_call(client, conn, msg + 1))
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1513 purple_notify_error(gc, _("Call Command"),
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1514 _("Cannot call command"),
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
1515 _("Unknown command"),
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34332
diff changeset
1516 purple_request_cpar_from_connection(gc));
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12167
diff changeset
1517 g_free(tmp);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1518 return 0;
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12167
diff changeset
1519 }
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1520
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1521 if (sign)
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1522 mflags |= SILC_MESSAGE_FLAG_SIGNED;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1523
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1524 /* Find client entry */
36098
4951752ad038 Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36089
diff changeset
1525 clients = silc_client_get_clients_local(client, conn, rcpt, FALSE);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1526 if (!clients) {
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1527 /* Resolve unknown user */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1528 SilcPurpleIM im = silc_calloc(1, sizeof(*im));
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12167
diff changeset
1529 if (!im) {
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12167
diff changeset
1530 g_free(tmp);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1531 return 0;
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12167
diff changeset
1532 }
36098
4951752ad038 Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36089
diff changeset
1533 im->nick = g_strdup(rcpt);
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
1534 im->message = g_strdup(message);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1535 im->message_len = strlen(im->message);
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1536 im->flags = mflags;
12303
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1537 im->gflags = flags;
36098
4951752ad038 Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36089
diff changeset
1538 silc_client_get_clients(client, conn, rcpt, NULL,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1539 silcpurple_send_im_resolved, im);
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12167
diff changeset
1540 g_free(tmp);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1541 return 0;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1542 }
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1543 silc_dlist_start(clients);
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1544 client_entry = silc_dlist_get(clients);
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1545
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
1546 /* Check for images */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1547 if (flags & PURPLE_MESSAGE_IMAGES) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1548 list = silcpurple_image_message(message, &mflags);
12303
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1549 if (list) {
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1550 /* Send one or more MIME message. If more than one, they
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1551 are MIME fragments due to over large message */
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1552 SilcBuffer buf;
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
1553
12303
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1554 silc_dlist_start(list);
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1555 while ((buf = silc_dlist_get(list)) != SILC_LIST_END)
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1556 ret =
15081
7e978e8dc84a [gaim-migrate @ 17801]
Daniel Atallah <datallah@pidgin.im>
parents: 14899
diff changeset
1557 silc_client_send_private_message(client, conn,
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
1558 client_entry, mflags, sg->sha1hash,
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1559 buf->data,
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1560 silc_buffer_len(buf));
12303
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1561 silc_mime_partial_free(list);
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1562 g_free(tmp);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1563 silc_client_list_free(client, conn, clients);
12303
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1564 return ret;
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1565 }
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1566 }
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1567
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1568 /* Send private message directly */
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1569 ret = silc_client_send_private_message(client, conn, client_entry,
20289
5c844288fbec applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19684
diff changeset
1570 mflags, sg->sha1hash,
12303
f2b594862195 [gaim-migrate @ 14607]
Pekka Riikonen <priikone@silcnet.org>
parents: 12217
diff changeset
1571 (unsigned char *)msg,
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1572 strlen(msg));
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1573
12216
d80739091a63 [gaim-migrate @ 14518]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12167
diff changeset
1574 g_free(tmp);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
1575 silc_client_list_free(client, conn, clients);
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1576 return ret;
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1577 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1578
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1579
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1580 static GList *silcpurple_blist_node_menu(PurpleProtocolClient *client, PurpleBlistNode *node) {
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9024
diff changeset
1581 /* split this single menu building function back into the two
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9024
diff changeset
1582 original: one for buddies and one for chats */
34696
6e0d13978666 Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents: 34627
diff changeset
1583 if(PURPLE_IS_CHAT(node)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1584 return silcpurple_chat_menu((PurpleChat *) node);
34696
6e0d13978666 Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents: 34627
diff changeset
1585 } else if(PURPLE_IS_BUDDY(node)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1586 return silcpurple_buddy_menu((PurpleBuddy *) node);
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9024
diff changeset
1587 } else {
9038
165198d63a81 [gaim-migrate @ 9814]
Tim Ringenbach <marv@pidgin.im>
parents: 9030
diff changeset
1588 g_return_val_if_reached(NULL);
9353
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1589 }
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9024
diff changeset
1590 }
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9024
diff changeset
1591
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1592 /********************************* Commands **********************************/
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1593
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1594 static PurpleCmdRet silcpurple_cmd_chat_part(PurpleConversation *conv,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1595 const char *cmd, char **args, char **error, void *data)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1596 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1597 PurpleConnection *gc;
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40865
diff changeset
1598 PurpleConversation *chat = conv;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1599 int id = 0;
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1600
32698
154e4a2a6287 Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32683
diff changeset
1601 gc = purple_conversation_get_connection(conv);
9353
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1602
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1603 if (gc == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1604 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1605
40997
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1606 if(args && args[0]) {
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1607 PurpleConversationManager *manager;
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1608
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1609 manager = purple_conversation_manager_get_default();
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1610
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1611 chat = purple_conversation_manager_find_chat(manager,
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1612 purple_connection_get_account(gc),
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1613 args[0]);
997ab408c113 Port the protocol plugins to the purple_conversation_manager_api
Gary Kramlich <grim@reaperworld.com>
parents: 40985
diff changeset
1614 }
9353
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1615
34897
a323e8b5a090 Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents: 34894
diff changeset
1616 if (chat != NULL)
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40865
diff changeset
1617 id = purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(chat));
9353
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1618
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1619 if (id == 0)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1620 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1621
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1622 silcpurple_chat_leave(NULL, gc, id);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1623
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1624 return PURPLE_CMD_RET_OK;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1625
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1626 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1627
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1628 static PurpleCmdRet silcpurple_cmd_chat_topic(PurpleConversation *conv,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1629 const char *cmd, char **args, char **error, void *data)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1630 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1631 PurpleConnection *gc;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1632 int id = 0;
9762
125f77c00102 [gaim-migrate @ 10630]
Tim Ringenbach <marv@pidgin.im>
parents: 9754
diff changeset
1633 char *buf, *tmp, *tmp2;
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1634 const char *topic;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1635
32698
154e4a2a6287 Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32683
diff changeset
1636 gc = purple_conversation_get_connection(conv);
34897
a323e8b5a090 Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents: 34894
diff changeset
1637 id = purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(conv));
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1638
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1639 if (gc == NULL || id == 0)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1640 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1641
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1642 if (!args || !args[0]) {
34897
a323e8b5a090 Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents: 34894
diff changeset
1643 topic = purple_chat_conversation_get_topic(PURPLE_CHAT_CONVERSATION(conv));
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1644 if (topic) {
10732
5e314ab498bf [gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents: 10547
diff changeset
1645 tmp = g_markup_escape_text(topic, -1);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1646 tmp2 = purple_markup_linkify(tmp);
9762
125f77c00102 [gaim-migrate @ 10630]
Tim Ringenbach <marv@pidgin.im>
parents: 9754
diff changeset
1647 buf = g_strdup_printf(_("current topic is: %s"), tmp2);
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1648 g_free(tmp);
9762
125f77c00102 [gaim-migrate @ 10630]
Tim Ringenbach <marv@pidgin.im>
parents: 9754
diff changeset
1649 g_free(tmp2);
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1650 } else
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1651 buf = g_strdup(_("No topic is set"));
36088
4c386387f6f3 Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36084
diff changeset
1652 purple_conversation_write_system_message(conv,
4c386387f6f3 Switch purple_conversation_write_message to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36084
diff changeset
1653 buf, PURPLE_MESSAGE_NO_LOG);
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1654 g_free(buf);
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1655
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1656 }
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1657
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1658 if (args && args[0] && (strlen(args[0]) > 255)) {
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1659 *error = g_strdup(_("Topic too long"));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1660 return PURPLE_CMD_RET_FAILED;
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1661 }
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1662
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1663 silcpurple_chat_set_topic(NULL, gc, id, args ? args[0] : NULL);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1664
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1665 return PURPLE_CMD_RET_OK;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1666 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1667
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1668 static PurpleCmdRet silcpurple_cmd_chat_join(PurpleConversation *conv,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1669 const char *cmd, char **args, char **error, void *data)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1670 {
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1671 GHashTable *comp;
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1672
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1673 if(!args || !args[0])
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1674 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1675
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1676 comp = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1677
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1678 g_hash_table_replace(comp, "channel", args[0]);
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1679 if(args[1])
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1680 g_hash_table_replace(comp, "passphrase", args[1]);
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1681
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1682 silcpurple_chat_join(NULL, purple_conversation_get_connection(conv), comp);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1683
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1684 g_hash_table_destroy(comp);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1685 return PURPLE_CMD_RET_OK;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1686 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1687
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1688 static PurpleCmdRet silcpurple_cmd_chat_list(PurpleConversation *conv,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1689 const char *cmd, char **args, char **error, void *data)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1690 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1691 PurpleConnection *gc;
32698
154e4a2a6287 Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32683
diff changeset
1692 gc = purple_conversation_get_connection(conv);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1693 purple_roomlist_show_with_account(purple_connection_get_account(gc));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1694 return PURPLE_CMD_RET_OK;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1695 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1696
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1697 static PurpleCmdRet silcpurple_cmd_whois(PurpleConversation *conv,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1698 const char *cmd, char **args, char **error, void *data)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1699 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1700 PurpleConnection *gc;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1701
32698
154e4a2a6287 Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32683
diff changeset
1702 gc = purple_conversation_get_connection(conv);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1703
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1704 if (gc == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1705 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1706
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1707 silcpurple_get_info(NULL, gc, args[0]);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1708
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1709 return PURPLE_CMD_RET_OK;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1710 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1711
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1712 static PurpleCmdRet silcpurple_cmd_msg(PurpleConversation *conv,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1713 const char *cmd, char **args, char **error, void *data)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1714 {
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1715 int ret;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1716 PurpleConnection *gc;
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1717 PurpleAccount *account;
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1718 const gchar *me;
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1719 PurpleMessage *msg;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1720
32698
154e4a2a6287 Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32683
diff changeset
1721 gc = purple_conversation_get_connection(conv);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1722
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1723 if (gc == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1724 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1725
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1726 account = purple_connection_get_account(gc);
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1727 me = purple_account_get_name_for_display(account);
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1728 msg = purple_message_new_outgoing(me, args[0], args[1], 0);
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1729 ret = silcpurple_send_im(NULL, gc, msg);
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1730 g_object_unref(G_OBJECT(msg));
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1731
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1732 if (ret)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1733 return PURPLE_CMD_RET_OK;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1734 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1735 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1736 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1737
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1738 static PurpleCmdRet silcpurple_cmd_query(PurpleConversation *conv,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1739 const char *cmd, char **args, char **error, void *data)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1740 {
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1741 int ret = 1;
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40865
diff changeset
1742 PurpleConversation *im;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1743 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1744 PurpleAccount *account;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1745
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1746 if (!args || !args[0]) {
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1747 *error = g_strdup(_("You must specify a nick"));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1748 return PURPLE_CMD_RET_FAILED;
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1749 }
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1750
32698
154e4a2a6287 Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32683
diff changeset
1751 gc = purple_conversation_get_connection(conv);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1752
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1753 if (gc == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1754 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1755
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1756 account = purple_connection_get_account(gc);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1757
34897
a323e8b5a090 Refactored silc to use the GObjectified conversation API
Ankit Vani <a@nevitus.org>
parents: 34894
diff changeset
1758 im = purple_im_conversation_new(account, args[0]);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1759
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1760 if (args[1]) {
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1761 const gchar *me = purple_account_get_name_for_display(account);
36098
4951752ad038 Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36089
diff changeset
1762 PurpleMessage *msg = purple_message_new_outgoing(
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1763 me, args[0], args[1], 0);
36076
a0e5b68ff4ef Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36068
diff changeset
1764
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1765 ret = silcpurple_send_im(NULL, gc, msg);
40885
87f6241da196 Update purple_conversations_find_* to return PurpleConversations instead of subclasses
Gary Kramlich <grim@reaperworld.com>
parents: 40865
diff changeset
1766 purple_conversation_write_message(im, msg);
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
1767 g_object_unref(G_OBJECT(msg));
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1768 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1769
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1770 if (ret)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1771 return PURPLE_CMD_RET_OK;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1772 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1773 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1774 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1775
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1776 static PurpleCmdRet silcpurple_cmd_motd(PurpleConversation *conv,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1777 const char *cmd, char **args, char **error, void *data)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1778 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1779 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1780 SilcPurple sg;
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1781 char *tmp;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1782
32698
154e4a2a6287 Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32683
diff changeset
1783 gc = purple_conversation_get_connection(conv);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1784
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1785 if (gc == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1786 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1787
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
1788 sg = purple_connection_get_protocol_data(gc);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1789
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1790 if (sg == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1791 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1792
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1793 if (!sg->motd) {
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1794 *error = g_strdup(_("There is no Message of the Day associated with this connection"));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1795 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1796 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1797
10732
5e314ab498bf [gaim-migrate @ 12334]
Richard Laager <rlaager@pidgin.im>
parents: 10547
diff changeset
1798 tmp = g_markup_escape_text(sg->motd, -1);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1799 purple_notify_formatted(gc, NULL, _("Message of the Day"), NULL,
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1800 tmp, NULL, NULL);
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1801 g_free(tmp);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1802
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1803 return PURPLE_CMD_RET_OK;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1804 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1805
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1806 static PurpleCmdRet silcpurple_cmd_detach(PurpleConversation *conv,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1807 const char *cmd, char **args, char **error, void *data)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1808 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1809 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1810 SilcPurple sg;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1811
32698
154e4a2a6287 Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32683
diff changeset
1812 gc = purple_conversation_get_connection(conv);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1813
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1814 if (gc == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1815 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1816
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
1817 sg = purple_connection_get_protocol_data(gc);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1818
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1819 if (sg == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1820 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1821
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1822 silc_client_command_call(sg->client, sg->conn, "DETACH");
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1823 sg->detaching = TRUE;
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1824
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1825 return PURPLE_CMD_RET_OK;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1826 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1827
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1828 static PurpleCmdRet silcpurple_cmd_cmode(PurpleConversation *conv,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1829 const char *cmd, char **args, char **error, void *data)
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1830 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1831 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1832 SilcPurple sg;
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1833 SilcChannelEntry channel;
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1834 char *silccmd, *silcargs, *msg, tmp[256];
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1835 const char *chname;
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1836
32698
154e4a2a6287 Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32683
diff changeset
1837 gc = purple_conversation_get_connection(conv);
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1838
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
1839 if (gc == NULL || !args || purple_connection_get_protocol_data(gc) == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1840 return PURPLE_CMD_RET_FAILED;
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1841
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
1842 sg = purple_connection_get_protocol_data(gc);
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1843
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1844 if (args[0])
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1845 chname = args[0];
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1846 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1847 chname = purple_conversation_get_name(conv);
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1848
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1849 if (!args[1]) {
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1850 channel = silc_client_get_channel(sg->client, sg->conn,
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1851 (char *)chname);
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1852 if (!channel) {
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1853 *error = g_strdup_printf(_("channel %s not found"), chname);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1854 return PURPLE_CMD_RET_FAILED;
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1855 }
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1856 if (channel->mode) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1857 silcpurple_get_chmode_string(channel->mode, tmp, sizeof(tmp));
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1858 msg = g_strdup_printf(_("channel modes for %s: %s"), chname, tmp);
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1859 } else {
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1860 msg = g_strdup_printf(_("no channel modes are set on %s"), chname);
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1861 }
36084
2172bd6dad3e Add purple_conversation_write_system_message
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36078
diff changeset
1862 purple_conversation_write_system_message(conv, msg, PURPLE_MESSAGE_NO_LOG);
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1863 g_free(msg);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1864 return PURPLE_CMD_RET_OK;
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1865 }
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1866
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1867 silcargs = g_strjoinv(" ", args);
33801
6dbfcd72998e Fix a few cases of dead code
Daniel Atallah <datallah@pidgin.im>
parents: 33798
diff changeset
1868 silccmd = g_strconcat(cmd, " ", silcargs, NULL);
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1869 g_free(silcargs);
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1870 if (!silc_client_command_call(sg->client, sg->conn, silccmd)) {
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1871 g_free(silccmd);
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1872 *error = g_strdup_printf(_("Failed to set cmodes for %s"), args[0]);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1873 return PURPLE_CMD_RET_FAILED;
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1874 }
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1875 g_free(silccmd);
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1876
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1877 return PURPLE_CMD_RET_OK;
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1878 }
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1879
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1880 static PurpleCmdRet silcpurple_cmd_generic(PurpleConversation *conv,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1881 const char *cmd, char **args, char **error, void *data)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1882 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1883 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1884 SilcPurple sg;
9353
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1885 char *silccmd, *silcargs;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1886
32698
154e4a2a6287 Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32683
diff changeset
1887 gc = purple_conversation_get_connection(conv);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1888
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1889 if (gc == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1890 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1891
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
1892 sg = purple_connection_get_protocol_data(gc);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1893
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1894 if (sg == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1895 return PURPLE_CMD_RET_FAILED;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1896
9353
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1897 silcargs = g_strjoinv(" ", args);
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1898 silccmd = g_strconcat(cmd, " ", args ? silcargs : NULL, NULL);
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1899 g_free(silcargs);
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1900 if (!silc_client_command_call(sg->client, sg->conn, silccmd)) {
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1901 g_free(silccmd);
15444
b793ef258d23 I think this changes every user-visible string that contains 'Gaim.' We probably want the UI to be able
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
1902 *error = g_strdup_printf(_("Unknown command: %s, (may be a client bug)"), cmd);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1903 return PURPLE_CMD_RET_FAILED;
9353
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1904 }
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
1905 g_free(silccmd);
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1906
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1907 return PURPLE_CMD_RET_OK;
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1908 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1909
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1910 static PurpleCmdRet silcpurple_cmd_quit(PurpleConversation *conv,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1911 const char *cmd, char **args, char **error, void *data)
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1912 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1913 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1914 SilcPurple sg;
23545
676b13ddfd2c Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents: 23542
diff changeset
1915 char *quit_msg;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30138
diff changeset
1916
32698
154e4a2a6287 Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32683
diff changeset
1917 gc = purple_conversation_get_connection(conv);
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1918
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1919 if (gc == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1920 return PURPLE_CMD_RET_FAILED;
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1921
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
1922 sg = purple_connection_get_protocol_data(gc);
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1923
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1924 if (sg == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1925 return PURPLE_CMD_RET_FAILED;
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1926
40779
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
1927 if (args && args[0]) {
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
1928 quit_msg = g_strdup(args[0]);
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
1929 } else {
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
1930 quit_msg = silcpurple_get_quit_message();
23545
676b13ddfd2c Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents: 23542
diff changeset
1931 }
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30138
diff changeset
1932
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1933 silc_client_command_call(sg->client, sg->conn, NULL,
40779
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
1934 "QUIT", quit_msg, NULL);
23545
676b13ddfd2c Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents: 23542
diff changeset
1935 g_free(quit_msg);
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1936
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1937 return PURPLE_CMD_RET_OK;
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1938 }
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1939
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1940 static PurpleCmdRet silcpurple_cmd_call(PurpleConversation *conv,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1941 const char *cmd, char **args, char **error, void *data)
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1942 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1943 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1944 SilcPurple sg;
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1945
32698
154e4a2a6287 Our API really shouldn't have a 'gc' in it anymore.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32683
diff changeset
1946 gc = purple_conversation_get_connection(conv);
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1947
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1948 if (gc == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1949 return PURPLE_CMD_RET_FAILED;
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1950
32281
0ef1a6d8ca53 Convert silc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32157
diff changeset
1951 sg = purple_connection_get_protocol_data(gc);
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1952
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1953 if (sg == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1954 return PURPLE_CMD_RET_FAILED;
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1955
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1956 if (!silc_client_command_call(sg->client, sg->conn, args[0])) {
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1957 *error = g_strdup_printf(_("Unknown command: %s"), args[0]);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1958 return PURPLE_CMD_RET_FAILED;
9488
9d6520fa53fd [gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9466
diff changeset
1959 }
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1960
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1961 return PURPLE_CMD_RET_OK;
9359
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1962 }
89c40efa7f7b [gaim-migrate @ 10167]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9353
diff changeset
1963
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9024
diff changeset
1964
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1965 /************************** Plugin Initialization ****************************/
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1966
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1967 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1968 silcpurple_register_commands(void)
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
1969 {
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1970 PurpleCmdId id;
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1971
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1972 id = purple_cmd_register("part", "w", PURPLE_CMD_P_PROTOCOL,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1973 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
1974 PURPLE_CMD_FLAG_PROTOCOL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1975 "prpl-silc", silcpurple_cmd_chat_part, _("part [channel]: Leave the chat"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1976 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1977
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1978 id = purple_cmd_register("leave", "w", PURPLE_CMD_P_PROTOCOL,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1979 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
1980 PURPLE_CMD_FLAG_PROTOCOL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1981 "prpl-silc", silcpurple_cmd_chat_part, _("leave [channel]: Leave the chat"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1982 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1983
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1984 id = purple_cmd_register("topic", "s", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
1985 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1986 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1987 silcpurple_cmd_chat_topic, _("topic [&lt;new topic&gt;]: View or change the topic"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1988 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1989
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1990 id = purple_cmd_register("join", "ws", PURPLE_CMD_P_PROTOCOL,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1991 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
1992 PURPLE_CMD_FLAG_PROTOCOL_ONLY | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1993 "prpl-silc", silcpurple_cmd_chat_join,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
1994 _("join &lt;channel&gt; [&lt;password&gt;]: Join a chat on this network"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1995 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1996
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
1997 id = purple_cmd_register("list", "", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
1998 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
1999 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2000 silcpurple_cmd_chat_list, _("list: List channels on this network"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2001 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2002
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2003 id = purple_cmd_register("whois", "w", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2004 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
2005 "prpl-silc",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2006 silcpurple_cmd_whois, _("whois &lt;nick&gt;: View nick's information"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2007 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2008
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2009 id = purple_cmd_register("msg", "ws", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2010 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2011 "prpl-silc", silcpurple_cmd_msg,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2012 _("msg &lt;nick&gt; &lt;message&gt;: Send a private message to a user"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2013 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2014
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2015 id = purple_cmd_register("query", "ws", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2016 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2017 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_query,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2018 _("query &lt;nick&gt; [&lt;message&gt;]: Send a private message to a user"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2019 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2020
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2021 id = purple_cmd_register("motd", "", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2022 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2023 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_motd,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2024 _("motd: View the server's Message Of The Day"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2025 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2026
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2027 id = purple_cmd_register("detach", "", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2028 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2029 "prpl-silc", silcpurple_cmd_detach,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2030 _("detach: Detach this session"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2031 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2032
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2033 id = purple_cmd_register("quit", "s", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2034 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2035 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_quit,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2036 _("quit [message]: Disconnect from the server, with an optional message"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2037 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2038
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2039 id = purple_cmd_register("call", "s", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2040 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2041 "prpl-silc", silcpurple_cmd_call,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2042 _("call &lt;command&gt;: Call any silc client command"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2043 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2044
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2045 /* These below just get passed through for the silc client library to deal
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2046 * with */
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2047 id = purple_cmd_register("kill", "ws", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2048 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2049 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2050 _("kill &lt;nick&gt; [-pubkey|&lt;reason&gt;]: Kill nick"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2051 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2052
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2053 id = purple_cmd_register("nick", "w", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2054 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2055 "prpl-silc", silcpurple_cmd_generic,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2056 _("nick &lt;newnick&gt;: Change your nickname"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2057 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2058
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2059 id = purple_cmd_register("whowas", "ww", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2060 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2061 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2062 _("whowas &lt;nick&gt;: View nick's information"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2063 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2064
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2065 id = purple_cmd_register("cmode", "wws", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2066 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2067 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_cmode,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2068 _("cmode &lt;channel&gt; [+|-&lt;modes&gt;] [arguments]: Change or display channel modes"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2069 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2070
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2071 id = purple_cmd_register("cumode", "wws", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2072 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2073 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2074 _("cumode &lt;channel&gt; +|-&lt;modes&gt; &lt;nick&gt;: Change nick's modes on channel"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2075 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2076
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2077 id = purple_cmd_register("umode", "w", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2078 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2079 "prpl-silc", silcpurple_cmd_generic,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2080 _("umode &lt;usermodes&gt;: Set your modes in the network"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2081 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2082
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2083 id = purple_cmd_register("oper", "s", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2084 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2085 "prpl-silc", silcpurple_cmd_generic,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2086 _("oper &lt;nick&gt; [-pubkey]: Get server operator privileges"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2087 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2088
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2089 id = purple_cmd_register("invite", "ws", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2090 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2091 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2092 _("invite &lt;channel&gt; [-|+]&lt;nick&gt;: invite nick or add/remove from channel invite list"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2093 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2094
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2095 id = purple_cmd_register("kick", "wws", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2096 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2097 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2098 _("kick &lt;channel&gt; &lt;nick&gt; [comment]: Kick client from channel"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2099 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2100
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2101 id = purple_cmd_register("info", "w", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2102 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2103 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2104 _("info [server]: View server administrative details"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2105 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2106
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2107 id = purple_cmd_register("ban", "ww", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2108 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY |
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2109 PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcpurple_cmd_generic,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2110 _("ban [&lt;channel&gt; +|-&lt;nick&gt;]: Ban client from channel"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2111 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2112
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2113 id = purple_cmd_register("getkey", "w", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2114 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2115 "prpl-silc", silcpurple_cmd_generic,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2116 _("getkey &lt;nick|server&gt;: Retrieve client's or server's public key"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2117 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2118
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2119 id = purple_cmd_register("stats", "", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2120 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2121 "prpl-silc", silcpurple_cmd_generic,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2122 _("stats: View server and network statistics"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2123 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2124
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2125 id = purple_cmd_register("ping", "", PURPLE_CMD_P_PROTOCOL,
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 36544
diff changeset
2126 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PROTOCOL_ONLY,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2127 "prpl-silc", silcpurple_cmd_generic,
9597
c6f672b593cb [gaim-migrate @ 10440]
Tim Ringenbach <marv@pidgin.im>
parents: 9552
diff changeset
2128 _("ping: Send PING to the connected server"), NULL);
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2129 cmds = g_slist_prepend(cmds, GUINT_TO_POINTER(id));
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
2130 }
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
2131
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2132 static void
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2133 silcpurple_unregister_commands(void)
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2134 {
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2135 while (cmds) {
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2136 PurpleCmdId id = GPOINTER_TO_UINT(cmds->data);
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2137 purple_cmd_unregister(id);
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2138 cmds = g_slist_delete_link(cmds, cmds);
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2139 }
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2140 }
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2141
36637
9b0109ae118d Renamed some prpl stuff to protocol stuff.
Ankit Vani <a@nevitus.org>
parents: 36628
diff changeset
2142 static PurpleWhiteboardOps silcpurple_wb_ops =
12058
6d4b6e3bd0ba [gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents: 11837
diff changeset
2143 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2144 silcpurple_wb_start,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2145 silcpurple_wb_end,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2146 silcpurple_wb_get_dimensions,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2147 silcpurple_wb_set_dimensions,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2148 silcpurple_wb_get_brush,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2149 silcpurple_wb_set_brush,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2150 silcpurple_wb_send,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2151 silcpurple_wb_clear,
16776
c9301dd6aa1f Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents: 16549
diff changeset
2152
c9301dd6aa1f Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents: 16549
diff changeset
2153 /* padding */
40779
a72067fee822 silc: Fix purple_core_get_ui_info usage
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40769
diff changeset
2154 { NULL, NULL, NULL, NULL }
12058
6d4b6e3bd0ba [gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents: 11837
diff changeset
2155 };
6d4b6e3bd0ba [gaim-migrate @ 14353]
Pekka Riikonen <priikone@silcnet.org>
parents: 11837
diff changeset
2156
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2157 static GList *
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2158 silcpurple_protocol_get_user_splits(G_GNUC_UNUSED PurpleProtocol *protocol)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2159 {
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2160 PurpleAccountUserSplit *split = purple_account_user_split_new(_("Network"), "silcnet.org", '@');
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2161
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2162 return g_list_append(NULL, split);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2163 }
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2164
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2165 static GList *
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2166 silcpurple_protocol_get_account_options(G_GNUC_UNUSED PurpleProtocol *protocol)
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2167 {
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2168 PurpleAccountOption *option;
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2169 GList *account_options = NULL;
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2170 GList *list;
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2171 char tmp[256];
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2172
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2173 option = purple_account_option_string_new(_("Connect server"), "server", "silc.silcnet.org");
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2174 account_options = g_list_append(account_options, option);
10825
986d260851e8 [gaim-migrate @ 12490]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10802
diff changeset
2175
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2176 option = purple_account_option_int_new(_("Port"), "port", 706);
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2177 account_options = g_list_append(account_options, option);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2178
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2179 g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "public_key.pub", silcpurple_silcdir());
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2180 option = purple_account_option_string_new(_("Public Key file"), "public-key", tmp);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2181 account_options = g_list_append(account_options, option);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2182
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2183 g_snprintf(tmp, sizeof(tmp), "%s" G_DIR_SEPARATOR_S "private_key.prv", silcpurple_silcdir());
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2184 option = purple_account_option_string_new(_("Private Key file"), "private-key", tmp);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2185 account_options = g_list_append(account_options, option);
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
2186
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2187 list = NULL;
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2188 for (int i = 0; silc_default_ciphers[i].name; i++) {
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2189 PurpleKeyValuePair *kvp = purple_key_value_pair_new_full(silc_default_ciphers[i].name,
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2190 g_strdup(silc_default_ciphers[i].name), g_free);
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
2191 list = g_list_append(list, kvp);
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
2192 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2193 option = purple_account_option_list_new(_("Cipher"), "cipher", list);
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2194 account_options = g_list_append(account_options, option);
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
2195
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
2196 list = NULL;
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2197 for (int i = 0; silc_default_hmacs[i].name; i++) {
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2198 PurpleKeyValuePair *kvp = purple_key_value_pair_new_full(silc_default_hmacs[i].name,
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2199 g_strdup(silc_default_hmacs[i].name), g_free);
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
2200 list = g_list_append(list, kvp);
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
2201 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2202 option = purple_account_option_list_new(_("HMAC"), "hmac", list);
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2203 account_options = g_list_append(account_options, option);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2204
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2205 option = purple_account_option_bool_new(_("Use Perfect Forward Secrecy"), "pfs", FALSE);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2206 account_options = g_list_append(account_options, option);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2207
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2208 option = purple_account_option_bool_new(_("Public key authentication"), "pubkey-auth", FALSE);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2209 account_options = g_list_append(account_options, option);
12217
ea610d8ab584 [gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents: 12216
diff changeset
2210
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2211 option = purple_account_option_bool_new(_("Block IMs without Key Exchange"), "block-ims", FALSE);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2212 account_options = g_list_append(account_options, option);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2213
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2214 option = purple_account_option_bool_new(_("Block messages to whiteboard"), "block-wb", FALSE);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2215 account_options = g_list_append(account_options, option);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2216
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2217 option = purple_account_option_bool_new(_("Automatically open whiteboard"), "open-wb", FALSE);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2218 account_options = g_list_append(account_options, option);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2219
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2220 option = purple_account_option_bool_new(_("Digitally sign and verify all messages"), "sign-verify", FALSE);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2221 account_options = g_list_append(account_options, option);
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
2222
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2223 return account_options;
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2224 }
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2225
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2226 static PurpleBuddyIconSpec *
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2227 silcpurple_protocol_get_buddy_icon_spec(G_GNUC_UNUSED PurpleProtocol *protocol)
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2228 {
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2229 return purple_buddy_icon_spec_new("jpeg,gif,png,bmp",
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2230 0, 0, 96, 96, 0,
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2231 PURPLE_ICON_SCALE_DISPLAY);
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2232 }
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2233
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2234 static PurpleWhiteboardOps *
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2235 silcpurple_protocol_get_whiteboard_ops(G_GNUC_UNUSED PurpleProtocol *protocol)
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2236 {
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2237 return &silcpurple_wb_ops;
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2238 }
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2239
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2240 static void
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2241 silcpurple_protocol_init(G_GNUC_UNUSED SilcProtocol *self)
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2242 {
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
2243 }
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
2244
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
2245 static void
39894
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2246 silcpurple_protocol_class_init(SilcProtocolClass *klass)
36684
ecc74498e088 Refactored other protocols to use instance init
Ankit Vani <a@nevitus.org>
parents: 36678
diff changeset
2247 {
39894
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2248 PurpleProtocolClass *protocol_class = PURPLE_PROTOCOL_CLASS(klass);
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2249
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2250 protocol_class->login = silcpurple_login;
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2251 protocol_class->close = silcpurple_close;
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2252 protocol_class->status_types = silcpurple_away_states;
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2253 protocol_class->list_icon = silcpurple_list_icon;
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2254
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2255 protocol_class->get_user_splits = silcpurple_protocol_get_user_splits;
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2256 protocol_class->get_account_options = silcpurple_protocol_get_account_options;
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2257 protocol_class->get_buddy_icon_spec = silcpurple_protocol_get_buddy_icon_spec;
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2258 protocol_class->get_whiteboard_ops = silcpurple_protocol_get_whiteboard_ops;
39894
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2259 }
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2260
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2261 static void
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2262 silcpurple_protocol_class_finalize(G_GNUC_UNUSED SilcProtocolClass *klass)
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2263 {
36663
c61b6dbc1f03 Make protocols unregister their commands when being removed
Ankit Vani <a@nevitus.org>
parents: 36660
diff changeset
2264 }
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2265
36595
d013a99e6d94 Refactored silc to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36593
diff changeset
2266 static void
39757
4a5ba806d8c9 Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39005
diff changeset
2267 silcpurple_protocol_client_iface_init(PurpleProtocolClientInterface *client_iface)
36595
d013a99e6d94 Refactored silc to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36593
diff changeset
2268 {
36736
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2269 client_iface->get_actions = silcpurple_get_actions;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2270 client_iface->status_text = silcpurple_status_text;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2271 client_iface->tooltip_text = silcpurple_tooltip_text;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2272 client_iface->blist_node_menu = silcpurple_blist_node_menu;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2273 }
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2274
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2275 static void
39757
4a5ba806d8c9 Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39005
diff changeset
2276 silcpurple_protocol_server_iface_init(PurpleProtocolServerInterface *server_iface)
36736
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2277 {
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2278 server_iface->set_info = silcpurple_set_info;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2279 server_iface->get_info = silcpurple_get_info;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2280 server_iface->set_status = silcpurple_set_status;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2281 server_iface->set_idle = silcpurple_idle_set;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2282 server_iface->change_passwd = silcpurple_change_passwd;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2283 server_iface->add_buddy = silcpurple_add_buddy;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2284 server_iface->remove_buddy = silcpurple_remove_buddy;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2285 server_iface->keepalive = silcpurple_keepalive;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2286 server_iface->set_buddy_icon = silcpurple_buddy_set_icon;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2287 }
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2288
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2289 static void
39757
4a5ba806d8c9 Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39005
diff changeset
2290 silcpurple_protocol_im_iface_init(PurpleProtocolIMInterface *im_iface)
36736
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2291 {
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2292 im_iface->send = silcpurple_send_im;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2293 }
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2294
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2295 static void
39757
4a5ba806d8c9 Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39005
diff changeset
2296 silcpurple_protocol_chat_iface_init(PurpleProtocolChatInterface *chat_iface)
36736
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2297 {
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2298 chat_iface->info = silcpurple_chat_info;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2299 chat_iface->info_defaults = silcpurple_chat_info_defaults;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2300 chat_iface->join = silcpurple_chat_join;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2301 chat_iface->get_name = silcpurple_get_chat_name;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2302 chat_iface->invite = silcpurple_chat_invite;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2303 chat_iface->leave = silcpurple_chat_leave;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2304 chat_iface->send = silcpurple_chat_send;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2305 chat_iface->set_topic = silcpurple_chat_set_topic;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2306 }
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2307
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2308 static void
39757
4a5ba806d8c9 Rename *Iface to more standard names.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39005
diff changeset
2309 silcpurple_protocol_roomlist_iface_init(PurpleProtocolRoomlistInterface *roomlist_iface)
36736
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2310 {
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2311 roomlist_iface->get_list = silcpurple_roomlist_get_list;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2312 roomlist_iface->cancel = silcpurple_roomlist_cancel;
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2313 }
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2314
36736
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2315 static void
38841
518362268798 make sure all the PurpleProtocolXfer parameters are named prplxfer
Gary Kramlich <grim@reaperworld.com>
parents: 38433
diff changeset
2316 silcpurple_protocol_xfer_iface_init(PurpleProtocolXferInterface *xfer_iface)
36736
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2317 {
39005
6a56e1366809 xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents: 38854
diff changeset
2318 xfer_iface->send_file = silcpurple_ftp_send_file;
6a56e1366809 xfer: Rename PurpleProtocolXferInterface.send() to send_file()
Mike Ruprecht <cmaiku@gmail.com>
parents: 38854
diff changeset
2319 xfer_iface->new_xfer = silcpurple_ftp_new_xfer;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2320 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2321
39894
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2322 G_DEFINE_DYNAMIC_TYPE_EXTENDED(
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2323 SilcProtocol, silcpurple_protocol, PURPLE_TYPE_PROTOCOL, 0,
36736
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2324
39894
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2325 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_CLIENT,
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2326 silcpurple_protocol_client_iface_init)
36736
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2327
39894
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2328 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_SERVER,
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2329 silcpurple_protocol_server_iface_init)
36736
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2330
39894
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2331 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_IM,
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2332 silcpurple_protocol_im_iface_init)
36736
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2333
39894
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2334 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_CHAT,
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2335 silcpurple_protocol_chat_iface_init)
36736
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2336
39894
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2337 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_ROOMLIST,
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2338 silcpurple_protocol_roomlist_iface_init)
36736
164cbd1113d4 Refactored sametime, silc, simple to use the new protocol interfaces
Ankit Vani <a@nevitus.org>
parents: 36729
diff changeset
2339
39894
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2340 G_IMPLEMENT_INTERFACE_DYNAMIC(PURPLE_TYPE_PROTOCOL_XFER,
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2341 silcpurple_protocol_xfer_iface_init));
36714
ec178f7d66da Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents: 36701
diff changeset
2342
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2343 static PurpleProtocol *
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2344 silcpurple_protocol_new(void) {
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2345 return PURPLE_PROTOCOL(g_object_new(
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2346 SILCPURPLE_TYPE_PROTOCOL,
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2347 "id", "prpl-silc",
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2348 "name", "SILC",
41348
74b1a5db343b Mark the protocol descriptions for translation and tweak them a bit.
Gary Kramlich <grim@reaperworld.com>
parents: 41078
diff changeset
2349 "description", _("Secure Internet Live Conferencing protocol."),
41074
c5d7adfc6c05 move the silc protocol plugins icons to a resource in the plugin
Gary Kramlich <grim@reaperworld.com>
parents: 40997
diff changeset
2350 "icon-name", "im-silc",
c5d7adfc6c05 move the silc protocol plugins icons to a resource in the plugin
Gary Kramlich <grim@reaperworld.com>
parents: 40997
diff changeset
2351 "icon-resource-path", "/im/pidgin/libpurple/silc/icons",
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2352 "options", OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME |
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2353 OPT_PROTO_PASSWORD_OPTIONAL |
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2354 OPT_PROTO_SLASH_COMMANDS_NATIVE,
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2355 NULL));
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2356 }
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2357
40945
bbeb2e98ea5b Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
2358 static GPluginPluginInfo *
bbeb2e98ea5b Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
2359 silc_query(GError **error)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2360 {
36642
b8ba53daa445 Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents: 36638
diff changeset
2361 const gchar * const authors[] = {
b8ba53daa445 Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents: 36638
diff changeset
2362 "Pekka Riikonen",
b8ba53daa445 Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents: 36638
diff changeset
2363 NULL
b8ba53daa445 Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents: 36638
diff changeset
2364 };
b8ba53daa445 Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents: 36638
diff changeset
2365
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
2366 return purple_plugin_info_new(
36985
9faafe43603e Rename protocol plugin IDs to prpl-*
Ankit Vani <a@nevitus.org>
parents: 36984
diff changeset
2367 "id", "prpl-silc",
36638
5f6dcd83e8c1 Seperate plugin and protocol IDs. Protocol ID example: "msn". Plugin ID example: "protocol-msn".
Ankit Vani <a@nevitus.org>
parents: 36637
diff changeset
2368 "name", "SILC Protocol",
36536
07f8c9889257 Added flags to all prpls
Ankit Vani <a@nevitus.org>
parents: 36533
diff changeset
2369 "version", "1.1",
07f8c9889257 Added flags to all prpls
Ankit Vani <a@nevitus.org>
parents: 36533
diff changeset
2370 "category", N_("Protocol"),
07f8c9889257 Added flags to all prpls
Ankit Vani <a@nevitus.org>
parents: 36533
diff changeset
2371 "summary", N_("SILC Protocol Plugin"),
07f8c9889257 Added flags to all prpls
Ankit Vani <a@nevitus.org>
parents: 36533
diff changeset
2372 "description", N_("Secure Internet Live Conferencing (SILC) Protocol"),
36642
b8ba53daa445 Updated libpurple to use current GPlugin
Ankit Vani <a@nevitus.org>
parents: 36638
diff changeset
2373 "authors", authors,
36536
07f8c9889257 Added flags to all prpls
Ankit Vani <a@nevitus.org>
parents: 36533
diff changeset
2374 "website", "http://silcnet.org/",
07f8c9889257 Added flags to all prpls
Ankit Vani <a@nevitus.org>
parents: 36533
diff changeset
2375 "abi-version", PURPLE_ABI_VERSION,
36653
4084c34c051d Override gplugin info's "flags" property. Added PURPLE_PLUGIN_INFO_FLAGS_INTERNAL and PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD.
Ankit Vani <a@nevitus.org>
parents: 36642
diff changeset
2376 "flags", PURPLE_PLUGIN_INFO_FLAGS_INTERNAL |
4084c34c051d Override gplugin info's "flags" property. Added PURPLE_PLUGIN_INFO_FLAGS_INTERNAL and PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD.
Ankit Vani <a@nevitus.org>
parents: 36642
diff changeset
2377 PURPLE_PLUGIN_INFO_FLAGS_AUTO_LOAD,
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
2378 NULL
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
2379 );
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
2380 }
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2381
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
2382 static gboolean
40945
bbeb2e98ea5b Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
2383 silc_load(GPluginPlugin *plugin, GError **error)
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2384 {
40800
be00e9c87cb7 Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents: 40779
diff changeset
2385 PurpleProtocolManager *manager = purple_protocol_manager_get_default();
be00e9c87cb7 Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents: 40779
diff changeset
2386
39894
7eab91ea30a1 Replace Purple type macros by GObject macros.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39760
diff changeset
2387 silcpurple_protocol_register_type(G_TYPE_MODULE(plugin));
36714
ec178f7d66da Refactored protocols to use the new type definition macros
Ankit Vani <a@nevitus.org>
parents: 36701
diff changeset
2388
40769
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
2389 silcpurple_xfer_register(G_TYPE_MODULE(plugin));
2214cc7b95ca Fix SILC compilation
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40507
diff changeset
2390
40814
9bdf61ddf211 Fix SILC build with modern PurpleProtocol
Arkadiy Illarionov <qarkai@gmail.com>
parents: 40800
diff changeset
2391 my_protocol = silcpurple_protocol_new();
40800
be00e9c87cb7 Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents: 40779
diff changeset
2392 if(!purple_protocol_manager_register(manager, my_protocol, error)) {
be00e9c87cb7 Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents: 40779
diff changeset
2393 g_clear_object(&my_protocol);
be00e9c87cb7 Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents: 40779
diff changeset
2394
36595
d013a99e6d94 Refactored silc to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36593
diff changeset
2395 return FALSE;
40800
be00e9c87cb7 Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents: 40779
diff changeset
2396 }
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2397
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2398 purple_prefs_remove("/plugins/prpl/silc");
9272
41e74d91931f [gaim-migrate @ 10075]
Ethan Blanton <elb@pidgin.im>
parents: 9039
diff changeset
2399
17675
e7069bf1de1a Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 17570
diff changeset
2400 silc_log_set_callback(SILC_LOG_ERROR, silcpurple_log_error, NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15524
diff changeset
2401 silcpurple_register_commands();
9353
ff6546387358 [gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 9308
diff changeset
2402
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
2403 return TRUE;
8849
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2404 }
4385d99b059c [gaim-migrate @ 9616]
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2405
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
2406 static gboolean
41078
84e48180ef67 Update to gplugin 0.35.0
Gary Kramlich <grim@reaperworld.com>
parents: 41074
diff changeset
2407 silc_unload(GPluginPlugin *plugin, gboolean shutdown, GError **error)
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
2408 {
40800
be00e9c87cb7 Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents: 40779
diff changeset
2409 PurpleProtocolManager *manager = purple_protocol_manager_get_default();
be00e9c87cb7 Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents: 40779
diff changeset
2410
be00e9c87cb7 Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents: 40779
diff changeset
2411 if(!purple_protocol_manager_unregister(manager, my_protocol, error)) {
be00e9c87cb7 Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents: 40779
diff changeset
2412 return FALSE;
be00e9c87cb7 Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents: 40779
diff changeset
2413 }
be00e9c87cb7 Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents: 40779
diff changeset
2414
36677
081733748bbc Only initialize/finalize protocol class data in *_base_init/finalize for protocols.
Ankit Vani <a@nevitus.org>
parents: 36663
diff changeset
2415 silcpurple_unregister_commands();
081733748bbc Only initialize/finalize protocol class data in *_base_init/finalize for protocols.
Ankit Vani <a@nevitus.org>
parents: 36663
diff changeset
2416
40800
be00e9c87cb7 Convert all of the protocols to use the new protocol_manager_ api
Gary Kramlich <grim@reaperworld.com>
parents: 40779
diff changeset
2417 g_clear_object(&my_protocol);
36595
d013a99e6d94 Refactored silc to use the new protocol API
Ankit Vani <a@nevitus.org>
parents: 36593
diff changeset
2418
36533
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
2419 return TRUE;
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
2420 }
1e87c79042a3 Refactored silc to use the new plugin API
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
2421
40945
bbeb2e98ea5b Use GPLUGIN_NATIVE_PLUGIN_DECLARE for all libpurple plugins and remove PURPLE_PLUGIN_INIT
Gary Kramlich <grim@reaperworld.com>
parents: 40885
diff changeset
2422 GPLUGIN_NATIVE_PLUGIN_DECLARE(silc)

mercurial