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