libpurple/protocols/silc/silcpurple.h

changeset 41832
63f39d354a73
parent 41831
596940e90c68
child 41833
a6a511564c1b
equal deleted inserted replaced
41831:596940e90c68 41832:63f39d354a73
1 /*
2
3 silcpurple.h
4
5 Author: Pekka Riikonen <priikone@silcnet.org>
6
7 Copyright (C) 2004 - 2007 Pekka Riikonen
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
20 #ifndef PURPLE_SILC_SILCPURPLE_H
21 #define PURPLE_SILC_SILCPURPLE_H
22
23 #include <silc.h>
24 #include <silcclient.h>
25
26 /* Purple includes */
27 #include <purple.h>
28
29 #define SILCPURPLE_TYPE_PROTOCOL (silcpurple_protocol_get_type())
30 G_DECLARE_FINAL_TYPE(SilcProtocol, silcpurple_protocol, SILC, PROTOCOL,
31 PurpleProtocol)
32
33 /* Default public and private key file names */
34 #define SILCPURPLE_PUBLIC_KEY_NAME "public_key.pub"
35 #define SILCPURPLE_PRIVATE_KEY_NAME "private_key.prv"
36
37 /* Default settings for creating key pair */
38 #define SILCPURPLE_DEF_PKCS "rsa"
39 #define SILCPURPLE_DEF_PKCS_LEN 2048
40
41 #define SILCPURPLE_PRVGRP 0x001fffff
42
43 /* Status IDs */
44 #define SILCPURPLE_STATUS_ID_OFFLINE "offline"
45 #define SILCPURPLE_STATUS_ID_AVAILABLE "available"
46 #define SILCPURPLE_STATUS_ID_HYPER "hyper"
47 #define SILCPURPLE_STATUS_ID_AWAY "away"
48 #define SILCPURPLE_STATUS_ID_BUSY "busy"
49 #define SILCPURPLE_STATUS_ID_INDISPOSED "indisposed"
50 #define SILCPURPLE_STATUS_ID_PAGE "page"
51
52 typedef struct {
53 unsigned long id;
54 const char *channel;
55 unsigned long chid;
56 const char *parentch;
57 SilcChannelPrivateKey key;
58 } *SilcPurplePrvgrp;
59
60 /* The SILC Purple plugin context */
61 typedef struct SilcPurpleStruct {
62 GCancellable *cancellable;
63 GSocketConnection *sockconn;
64
65 SilcClient client;
66 SilcClientConnection conn;
67 SilcPublicKey public_key;
68 SilcPrivateKey private_key;
69 SilcHash sha1hash;
70
71 SilcDList tasks;
72 guint scheduler;
73 PurpleConnection *gc;
74 PurpleAccount *account;
75 unsigned long channel_ids;
76 GList *grps;
77
78 char *motd;
79 PurpleRoomlist *roomlist;
80 SilcMimeAssembler mimeass;
81 unsigned int detaching : 1;
82 unsigned int resuming : 1;
83 unsigned int roomlist_cancelled : 1;
84 unsigned int chpk : 1;
85 } *SilcPurple;
86
87 void silc_say(SilcClient client, SilcClientConnection conn,
88 SilcClientMessageType type, char *msg, ...);
89 SilcBool silcpurple_command_reply(SilcClient client, SilcClientConnection conn,
90 SilcCommand command, SilcStatus status,
91 SilcStatus error, void *context, va_list ap);
92 gboolean silcpurple_check_silc_dir(PurpleConnection *gc);
93 const char *silcpurple_silcdir(void);
94 const char *silcpurple_session_file(const char *account);
95 void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn,
96 const char *name,
97 SilcConnectionType conn_type,
98 SilcPublicKey public_key,
99 SilcVerifyPublicKey completion,
100 void *context);
101 GList *silcpurple_buddy_menu(PurpleBuddy *buddy);
102 void silcpurple_add_buddy(PurpleProtocolServer *protocol_server, PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message);
103 void silcpurple_send_buddylist(PurpleConnection *gc);
104 void silcpurple_remove_buddy(PurpleProtocolServer *protocol_server, PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group);
105 void silcpurple_buddy_keyagr_request(SilcClient client,
106 SilcClientConnection conn,
107 SilcClientEntry client_entry,
108 const char *hostname, SilcUInt16 port,
109 SilcUInt16 protocol);
110 void silcpurple_idle_set(PurpleProtocolServer *protocol_server, PurpleConnection *gc, int idle);
111 void silcpurple_tooltip_text(PurpleProtocolClient *ppclient, PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full);
112 char *silcpurple_status_text(PurpleProtocolClient *ppclient, PurpleBuddy *b);
113 gboolean silcpurple_ip_is_private(const char *ip);
114 void silcpurple_ftp_send_file(PurpleProtocolXfer *prplxfer, PurpleConnection *gc, const char *name, const char *file);
115 PurpleXfer *silcpurple_ftp_new_xfer(PurpleProtocolXfer *prplxfer, PurpleConnection *gc, const char *name);
116 void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn,
117 SilcClientEntry client_entry, SilcUInt32 session_id,
118 const char *hostname, SilcUInt16 port);
119 void silcpurple_show_public_key(SilcPurple sg,
120 const char *name, SilcPublicKey public_key,
121 GCallback callback, void *context);
122 void silcpurple_get_info(PurpleProtocolServer *protocol_server, PurpleConnection *gc, const char *who);
123 SilcAttributePayload
124 silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute);
125 void silcpurple_get_umode_string(SilcUInt32 mode, char *buf,
126 SilcUInt32 buf_size);
127 void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf,
128 SilcUInt32 buf_size);
129 void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf,
130 SilcUInt32 buf_size);
131 GList *silcpurple_chat_info(PurpleProtocolChat *protocol_chat, PurpleConnection *gc);
132 GHashTable *silcpurple_chat_info_defaults(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, const char *chat_name);
133 GList *silcpurple_chat_menu(PurpleChat *);
134 void silcpurple_chat_join(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, GHashTable *data);
135 char *silcpurple_get_chat_name(PurpleProtocolChat *protocol_chat, GHashTable *data);
136 void silcpurple_chat_invite(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, int id, const char *msg,
137 const char *name);
138 void silcpurple_chat_leave(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, int id);
139 int silcpurple_chat_send(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, int id, PurpleMessage *msg);
140 void silcpurple_chat_set_topic(PurpleProtocolChat *protocol_chat, PurpleConnection *gc, int id, const char *topic);
141 PurpleRoomlist *silcpurple_roomlist_get_list(PurpleProtocolRoomlist *protocol_roomlist, PurpleConnection *gc);
142 void silcpurple_roomlist_cancel(PurpleProtocolRoomlist *protocol_roomlist, PurpleRoomlist *list);
143 void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel,
144 SilcDList channel_pubkeys);
145 void silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr,
146 char **contactstr, char **langstr, char **devicestr,
147 char **tzstr, char **geostr);
148 void silcpurple_buddy_set_icon(PurpleProtocolServer *protocol_server, PurpleConnection *gc, PurpleImage *img);
149 SilcDList silcpurple_image_message(const char *msg, SilcMessageFlags *mflags);
150
151 #ifdef _WIN32
152 typedef int uid_t;
153
154 struct passwd {
155 char *pw_name; /* user name */
156 char *pw_passwd; /* user password */
157 int pw_uid; /* user id */
158 int pw_gid; /* group id */
159 char *pw_gecos; /* real name */
160 char *pw_dir; /* home directory */
161 char *pw_shell; /* shell program */
162 };
163
164 struct passwd *getpwuid(int uid);
165 int getuid(void);
166 int geteuid(void);
167 #endif
168
169 #endif /* PURPLE_SILC_SILCPURPLE_H */

mercurial