| 1 /* |
|
| 2 |
|
| 3 silcpurple.h |
|
| 4 |
|
| 5 Author: Pekka Riikonen <priikone@silcnet.org> |
|
| 6 |
|
| 7 Copyright (C) 2004 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 SILCPURPLE_H |
|
| 21 #define SILCPURPLE_H |
|
| 22 |
|
| 23 /* Purple includes */ |
|
| 24 #include "internal.h" |
|
| 25 #include "account.h" |
|
| 26 #include "accountopt.h" |
|
| 27 #include "cmds.h" |
|
| 28 #include "conversation.h" |
|
| 29 #include "debug.h" |
|
| 30 #include "ft.h" |
|
| 31 #include "notify.h" |
|
| 32 #include "prpl.h" |
|
| 33 #include "request.h" |
|
| 34 #include "roomlist.h" |
|
| 35 #include "server.h" |
|
| 36 #include "util.h" |
|
| 37 |
|
| 38 /* Default public and private key file names */ |
|
| 39 #define SILCPURPLE_PUBLIC_KEY_NAME "public_key.pub" |
|
| 40 #define SILCPURPLE_PRIVATE_KEY_NAME "private_key.prv" |
|
| 41 |
|
| 42 /* Default settings for creating key pair */ |
|
| 43 #define SILCPURPLE_DEF_PKCS "rsa" |
|
| 44 #define SILCPURPLE_DEF_PKCS_LEN 2048 |
|
| 45 |
|
| 46 #define SILCPURPLE_PRVGRP 0x001fffff |
|
| 47 |
|
| 48 /* Status IDs */ |
|
| 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" |
|
| 56 |
|
| 57 typedef struct { |
|
| 58 unsigned long id; |
|
| 59 const char *channel; |
|
| 60 unsigned long chid; |
|
| 61 const char *parentch; |
|
| 62 SilcChannelPrivateKey key; |
|
| 63 } *SilcPurplePrvgrp; |
|
| 64 |
|
| 65 /* The SILC Purple plugin context */ |
|
| 66 typedef struct SilcPurpleStruct { |
|
| 67 SilcClient client; |
|
| 68 SilcClientConnection conn; |
|
| 69 |
|
| 70 guint scheduler; |
|
| 71 PurpleConnection *gc; |
|
| 72 PurpleAccount *account; |
|
| 73 unsigned long channel_ids; |
|
| 74 GList *grps; |
|
| 75 |
|
| 76 char *motd; |
|
| 77 PurpleRoomlist *roomlist; |
|
| 78 #ifdef HAVE_SILCMIME_H |
|
| 79 SilcMimeAssembler mimeass; |
|
| 80 #endif |
|
| 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 |
|
| 88 gboolean silcpurple_check_silc_dir(PurpleConnection *gc); |
|
| 89 void silcpurple_chat_join_done(SilcClient client, |
|
| 90 SilcClientConnection conn, |
|
| 91 SilcClientEntry *clients, |
|
| 92 SilcUInt32 clients_count, |
|
| 93 void *context); |
|
| 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, |
|
| 97 const char *name, SilcSocketType conn_type, |
|
| 98 unsigned char *pk, SilcUInt32 pk_len, |
|
| 99 SilcSKEPKType pk_type, |
|
| 100 SilcVerifyPublicKey completion, void *context); |
|
| 101 GList *silcpurple_buddy_menu(PurpleBuddy *buddy); |
|
| 102 void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); |
|
| 103 void silcpurple_send_buddylist(PurpleConnection *gc); |
|
| 104 void silcpurple_remove_buddy(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 void silcpurple_idle_set(PurpleConnection *gc, int idle); |
|
| 110 void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); |
|
| 111 char *silcpurple_status_text(PurpleBuddy *b); |
|
| 112 gboolean silcpurple_ip_is_private(const char *ip); |
|
| 113 void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file); |
|
| 114 PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name); |
|
| 115 void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, |
|
| 116 SilcClientEntry client_entry, SilcUInt32 session_id, |
|
| 117 const char *hostname, SilcUInt16 port); |
|
| 118 void silcpurple_show_public_key(SilcPurple sg, |
|
| 119 const char *name, SilcPublicKey public_key, |
|
| 120 GCallback callback, void *context); |
|
| 121 void silcpurple_get_info(PurpleConnection *gc, const char *who); |
|
| 122 SilcAttributePayload |
|
| 123 silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute); |
|
| 124 void silcpurple_get_umode_string(SilcUInt32 mode, char *buf, |
|
| 125 SilcUInt32 buf_size); |
|
| 126 void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf, |
|
| 127 SilcUInt32 buf_size); |
|
| 128 void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf, |
|
| 129 SilcUInt32 buf_size); |
|
| 130 GList *silcpurple_chat_info(PurpleConnection *gc); |
|
| 131 GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name); |
|
| 132 GList *silcpurple_chat_menu(PurpleChat *); |
|
| 133 void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data); |
|
| 134 char *silcpurple_get_chat_name(GHashTable *data); |
|
| 135 void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, |
|
| 136 const char *name); |
|
| 137 void silcpurple_chat_leave(PurpleConnection *gc, int id); |
|
| 138 int silcpurple_chat_send(PurpleConnection *gc, int id, const char *msg, PurpleMessageFlags flags); |
|
| 139 void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic); |
|
| 140 PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc); |
|
| 141 void silcpurple_roomlist_cancel(PurpleRoomlist *list); |
|
| 142 void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, |
|
| 143 SilcBuffer channel_pubkeys); |
|
| 144 void silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, |
|
| 145 char **contactstr, char **langstr, char **devicestr, |
|
| 146 char **tzstr, char **geostr); |
|
| 147 #ifdef SILC_ATTRIBUTE_USER_ICON |
|
| 148 void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleStoredImage *img); |
|
| 149 #endif |
|
| 150 #ifdef HAVE_SILCMIME_H |
|
| 151 char *silcpurple_file2mime(const char *filename); |
|
| 152 SilcDList silcpurple_image_message(const char *msg, SilcUInt32 *mflags); |
|
| 153 #endif |
|
| 154 |
|
| 155 #ifdef _WIN32 |
|
| 156 typedef int uid_t; |
|
| 157 |
|
| 158 struct passwd { |
|
| 159 char *pw_name; /* user name */ |
|
| 160 char *pw_passwd; /* user password */ |
|
| 161 int pw_uid; /* user id */ |
|
| 162 int pw_gid; /* group id */ |
|
| 163 char *pw_gecos; /* real name */ |
|
| 164 char *pw_dir; /* home directory */ |
|
| 165 char *pw_shell; /* shell program */ |
|
| 166 }; |
|
| 167 |
|
| 168 struct passwd *getpwuid(int uid); |
|
| 169 int getuid(void); |
|
| 170 int geteuid(void); |
|
| 171 #endif |
|
| 172 |
|
| 173 #endif /* SILCPURPLE_H */ |
|