annotate libpurple/protocols/silc/silc.c @ 21044:6b02dba5bf41

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