Wed, 19 Sep 2007 15:03:59 +0000
Use PurpleDisconnectReasons in prpl-jabber.
| 8849 | 1 | /* |
| 2 | ||
| 15884 | 3 | silcpurple.h |
| 8849 | 4 | |
| 5 | Author: Pekka Riikonen <priikone@silcnet.org> | |
| 6 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
7 | Copyright (C) 2004 - 2007 Pekka Riikonen |
| 8849 | 8 | |
| 9 | This program is free software; you can redistribute it and/or modify | |
| 10 | it under the terms of the GNU General Public License as published by | |
| 11 | the Free Software Foundation; version 2 of the License. | |
| 12 | ||
| 13 | This program is distributed in the hope that it will be useful, | |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | GNU General Public License for more details. | |
| 17 | ||
| 18 | */ | |
| 19 | ||
| 15884 | 20 | #ifndef SILCPURPLE_H |
| 21 | #define SILCPURPLE_H | |
| 8849 | 22 | |
| 15884 | 23 | /* Purple includes */ |
| 8849 | 24 | #include "internal.h" |
| 25 | #include "account.h" | |
| 26 | #include "accountopt.h" | |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10050
diff
changeset
|
27 | #include "cmds.h" |
|
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10050
diff
changeset
|
28 | #include "conversation.h" |
| 8849 | 29 | #include "debug.h" |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10050
diff
changeset
|
30 | #include "ft.h" |
| 8849 | 31 | #include "notify.h" |
| 32 | #include "prpl.h" | |
| 33 | #include "request.h" | |
|
10246
aa5bff72f94c
[gaim-migrate @ 11386]
Mark Doliner <markdoliner@pidgin.im>
parents:
10050
diff
changeset
|
34 | #include "roomlist.h" |
| 8849 | 35 | #include "server.h" |
| 36 | #include "util.h" | |
| 37 | ||
| 38 | /* Default public and private key file names */ | |
| 15884 | 39 | #define SILCPURPLE_PUBLIC_KEY_NAME "public_key.pub" |
| 40 | #define SILCPURPLE_PRIVATE_KEY_NAME "private_key.prv" | |
| 8849 | 41 | |
| 42 | /* Default settings for creating key pair */ | |
| 15884 | 43 | #define SILCPURPLE_DEF_PKCS "rsa" |
| 44 | #define SILCPURPLE_DEF_PKCS_LEN 2048 | |
| 8849 | 45 | |
| 15884 | 46 | #define SILCPURPLE_PRVGRP 0x001fffff |
| 8849 | 47 | |
|
10050
78e480f768f2
[gaim-migrate @ 11011]
Dave West <kat@users.sourceforge.net>
parents:
9917
diff
changeset
|
48 | /* Status IDs */ |
| 15884 | 49 | #define SILCPURPLE_STATUS_ID_OFFLINE "offline" |
| 50 | #define SILCPURPLE_STATUS_ID_AVAILABLE "available" | |
| 51 | #define SILCPURPLE_STATUS_ID_HYPER "hyper" | |
| 52 | #define SILCPURPLE_STATUS_ID_AWAY "away" | |
| 53 | #define SILCPURPLE_STATUS_ID_BUSY "busy" | |
| 54 | #define SILCPURPLE_STATUS_ID_INDISPOSED "indisposed" | |
| 55 | #define SILCPURPLE_STATUS_ID_PAGE "page" | |
|
10050
78e480f768f2
[gaim-migrate @ 11011]
Dave West <kat@users.sourceforge.net>
parents:
9917
diff
changeset
|
56 | |
| 8849 | 57 | typedef struct { |
| 58 | unsigned long id; | |
| 59 | const char *channel; | |
| 60 | unsigned long chid; | |
| 61 | const char *parentch; | |
| 62 | SilcChannelPrivateKey key; | |
| 15884 | 63 | } *SilcPurplePrvgrp; |
| 8849 | 64 | |
| 15884 | 65 | /* The SILC Purple plugin context */ |
| 66 | typedef struct SilcPurpleStruct { | |
| 8849 | 67 | SilcClient client; |
| 68 | SilcClientConnection conn; | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
69 | SilcPublicKey public_key; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
70 | SilcPrivateKey private_key; |
| 8849 | 71 | |
| 72 | guint scheduler; | |
| 15884 | 73 | PurpleConnection *gc; |
| 74 | PurpleAccount *account; | |
| 8849 | 75 | unsigned long channel_ids; |
| 76 | GList *grps; | |
| 77 | ||
| 78 | char *motd; | |
| 15884 | 79 | PurpleRoomlist *roomlist; |
|
12217
ea610d8ab584
[gaim-migrate @ 14519]
Pekka Riikonen <priikone@silcnet.org>
parents:
12216
diff
changeset
|
80 | SilcMimeAssembler mimeass; |
| 8849 | 81 | unsigned int detaching : 1; |
| 82 | unsigned int resuming : 1; | |
| 83 | unsigned int roomlist_canceled : 1; | |
| 84 | unsigned int chpk : 1; | |
| 15884 | 85 | } *SilcPurple; |
| 8849 | 86 | |
| 87 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
88 | void silc_say(SilcClient client, SilcClientConnection conn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
89 | SilcClientMessageType type, char *msg, ...); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
90 | SilcBool silcpurple_command_reply(SilcClient client, SilcClientConnection conn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
91 | SilcCommand command, SilcStatus status, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
92 | SilcStatus error, void *context, va_list ap); |
| 15884 | 93 | gboolean silcpurple_check_silc_dir(PurpleConnection *gc); |
| 94 | const char *silcpurple_silcdir(void); | |
| 95 | const char *silcpurple_session_file(const char *account); | |
| 96 | void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
97 | const char *name, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
98 | SilcConnectionType conn_type, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
99 | SilcPublicKey public_key, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
100 | SilcVerifyPublicKey completion, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
101 | void *context); |
| 15884 | 102 | GList *silcpurple_buddy_menu(PurpleBuddy *buddy); |
| 103 | void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); | |
| 104 | void silcpurple_send_buddylist(PurpleConnection *gc); | |
| 105 | void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); | |
| 106 | void silcpurple_buddy_keyagr_request(SilcClient client, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
107 | SilcClientConnection conn, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
108 | SilcClientEntry client_entry, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
109 | const char *hostname, SilcUInt16 port, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
110 | SilcUInt16 protocol); |
| 15884 | 111 | void silcpurple_idle_set(PurpleConnection *gc, int idle); |
| 112 | void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); | |
| 113 | char *silcpurple_status_text(PurpleBuddy *b); | |
| 114 | gboolean silcpurple_ip_is_private(const char *ip); | |
| 115 | void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file); | |
| 116 | PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name); | |
| 117 | void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, | |
| 8849 | 118 | SilcClientEntry client_entry, SilcUInt32 session_id, |
| 119 | const char *hostname, SilcUInt16 port); | |
| 15884 | 120 | void silcpurple_show_public_key(SilcPurple sg, |
| 8849 | 121 | const char *name, SilcPublicKey public_key, |
| 122 | GCallback callback, void *context); | |
| 15884 | 123 | void silcpurple_get_info(PurpleConnection *gc, const char *who); |
| 8849 | 124 | SilcAttributePayload |
| 15884 | 125 | silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute); |
| 126 | void silcpurple_get_umode_string(SilcUInt32 mode, char *buf, | |
| 8849 | 127 | SilcUInt32 buf_size); |
| 15884 | 128 | void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf, |
| 8849 | 129 | SilcUInt32 buf_size); |
| 15884 | 130 | void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf, |
| 8849 | 131 | SilcUInt32 buf_size); |
| 15884 | 132 | GList *silcpurple_chat_info(PurpleConnection *gc); |
| 133 | GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name); | |
| 134 | GList *silcpurple_chat_menu(PurpleChat *); | |
| 135 | void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data); | |
| 136 | char *silcpurple_get_chat_name(GHashTable *data); | |
| 137 | void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, | |
| 8849 | 138 | const char *name); |
| 15884 | 139 | void silcpurple_chat_leave(PurpleConnection *gc, int id); |
| 140 | int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags flags); | |
| 141 | void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic); | |
| 142 | PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc); | |
| 143 | void silcpurple_roomlist_cancel(PurpleRoomlist *list); | |
| 144 | void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16549
diff
changeset
|
145 | SilcDList channel_pubkeys); |
| 15884 | 146 | void silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, |
|
9488
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
147 | char **contactstr, char **langstr, char **devicestr, |
|
9d6520fa53fd
[gaim-migrate @ 10313]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
148 | char **tzstr, char **geostr); |
|
16549
59e5ad39510c
Update SILC for imgstore changes.
Daniel Atallah <datallah@pidgin.im>
parents:
15906
diff
changeset
|
149 | void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img); |
| 15884 | 150 | char *silcpurple_file2mime(const char *filename); |
| 151 | SilcDList silcpurple_image_message(const char *msg, SilcUInt32 *mflags); | |
| 8849 | 152 | |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
153 | #ifdef _WIN32 |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
154 | typedef int uid_t; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
155 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
156 | struct passwd { |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
157 | char *pw_name; /* user name */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
158 | char *pw_passwd; /* user password */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
159 | int pw_uid; /* user id */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
160 | int pw_gid; /* group id */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
161 | char *pw_gecos; /* real name */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
162 | char *pw_dir; /* home directory */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
163 | char *pw_shell; /* shell program */ |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
164 | }; |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
165 | |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
166 | struct passwd *getpwuid(int uid); |
|
12323
f52908fb23b0
[gaim-migrate @ 14627]
Richard Laager <rlaager@pidgin.im>
parents:
12217
diff
changeset
|
167 | int getuid(void); |
|
f52908fb23b0
[gaim-migrate @ 14627]
Richard Laager <rlaager@pidgin.im>
parents:
12217
diff
changeset
|
168 | int geteuid(void); |
|
9353
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
169 | #endif |
|
ff6546387358
[gaim-migrate @ 10161]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9288
diff
changeset
|
170 | |
| 15884 | 171 | #endif /* SILCPURPLE_H */ |