Author: Pekka Riikonen <priikone@silcnet.org> Copyright (C) 2004 - 2007 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. #ifndef PURPLE_SILC_SILCPURPLE_H #define PURPLE_SILC_SILCPURPLE_H #include "conversation.h" #define SILC_VERSION(a, b, c) (((a) << 24) + ((b) << 16) + ((c) << 8)) #define SILCPURPLE_TYPE_PROTOCOL (silcpurple_protocol_get_type()) #define SILCPURPLE_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SILCPURPLE_TYPE_PROTOCOL, SilcProtocol)) #define SILCPURPLE_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SILCPURPLE_TYPE_PROTOCOL, SilcProtocolClass)) #define SILCPURPLE_IS_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SILCPURPLE_TYPE_PROTOCOL)) #define SILCPURPLE_IS_PROTOCOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SILCPURPLE_TYPE_PROTOCOL)) #define SILCPURPLE_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SILCPURPLE_TYPE_PROTOCOL, SilcProtocolClass)) /* Default public and private key file names */ #define SILCPURPLE_PUBLIC_KEY_NAME "public_key.pub" #define SILCPURPLE_PRIVATE_KEY_NAME "private_key.prv" /* Default settings for creating key pair */ #define SILCPURPLE_DEF_PKCS "rsa" #define SILCPURPLE_DEF_PKCS_LEN 2048 #define SILCPURPLE_PRVGRP 0x001fffff #define SILCPURPLE_STATUS_ID_OFFLINE "offline" #define SILCPURPLE_STATUS_ID_AVAILABLE "available" #define SILCPURPLE_STATUS_ID_HYPER "hyper" #define SILCPURPLE_STATUS_ID_AWAY "away" #define SILCPURPLE_STATUS_ID_BUSY "busy" #define SILCPURPLE_STATUS_ID_INDISPOSED "indisposed" #define SILCPURPLE_STATUS_ID_PAGE "page" PurpleProtocolClass parent_class; SilcChannelPrivateKey key; /* The SILC Purple plugin context */ typedef struct SilcPurpleStruct { SilcClientConnection conn; SilcPublicKey public_key; SilcPrivateKey private_key; unsigned long channel_ids; PurpleRoomlist *roomlist; SilcMimeAssembler mimeass; unsigned int detaching : 1; unsigned int resuming : 1; unsigned int roomlist_cancelled : 1; G_MODULE_EXPORT GType silcpurple_protocol_get_type(void); void silc_say(SilcClient client, SilcClientConnection conn, SilcClientMessageType type, char *msg, ...); SilcBool silcpurple_command_reply(SilcClient client, SilcClientConnection conn, SilcCommand command, SilcStatus status, SilcStatus error, void *context, va_list ap); gboolean silcpurple_check_silc_dir(PurpleConnection *gc); const char *silcpurple_silcdir(void); const char *silcpurple_session_file(const char *account); void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, SilcConnectionType conn_type, SilcPublicKey public_key, SilcVerifyPublicKey completion, GList *silcpurple_buddy_menu(PurpleBuddy *buddy); void silcpurple_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group, const char *message); void silcpurple_send_buddylist(PurpleConnection *gc); void silcpurple_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group); void silcpurple_buddy_keyagr_request(SilcClient client, SilcClientConnection conn, SilcClientEntry client_entry, const char *hostname, SilcUInt16 port, void silcpurple_idle_set(PurpleConnection *gc, int idle); void silcpurple_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full); char *silcpurple_status_text(PurpleBuddy *b); gboolean silcpurple_ip_is_private(const char *ip); void silcpurple_ftp_send_file(PurpleConnection *gc, const char *name, const char *file); PurpleXfer *silcpurple_ftp_new_xfer(PurpleConnection *gc, const char *name); void silcpurple_ftp_request(SilcClient client, SilcClientConnection conn, SilcClientEntry client_entry, SilcUInt32 session_id, const char *hostname, SilcUInt16 port); void silcpurple_show_public_key(SilcPurple sg, const char *name, SilcPublicKey public_key, GCallback callback, void *context); void silcpurple_get_info(PurpleConnection *gc, const char *who); silcpurple_get_attr(SilcDList attrs, SilcAttribute attribute); void silcpurple_get_umode_string(SilcUInt32 mode, char *buf, void silcpurple_get_chmode_string(SilcUInt32 mode, char *buf, void silcpurple_get_chumode_string(SilcUInt32 mode, char *buf, GList *silcpurple_chat_info(PurpleConnection *gc); GHashTable *silcpurple_chat_info_defaults(PurpleConnection *gc, const char *chat_name); GList *silcpurple_chat_menu(PurpleChat *); void silcpurple_chat_join(PurpleConnection *gc, GHashTable *data); char *silcpurple_get_chat_name(GHashTable *data); void silcpurple_chat_invite(PurpleConnection *gc, int id, const char *msg, void silcpurple_chat_leave(PurpleConnection *gc, int id); int silcpurple_chat_send(PurpleConnection *gc, int id, PurpleMessage *msg); void silcpurple_chat_set_topic(PurpleConnection *gc, int id, const char *topic); PurpleRoomlist *silcpurple_roomlist_get_list(PurpleConnection *gc); void silcpurple_roomlist_cancel(PurpleRoomlist *list); void silcpurple_chat_chauth_show(SilcPurple sg, SilcChannelEntry channel, SilcDList channel_pubkeys); void silcpurple_parse_attrs(SilcDList attrs, char **moodstr, char **statusstr, char **contactstr, char **langstr, char **devicestr, char **tzstr, char **geostr); void silcpurple_buddy_set_icon(PurpleConnection *gc, PurpleImage *img); SilcDList silcpurple_image_message(const char *msg, SilcMessageFlags *mflags); char *pw_name; /* user name */ char *pw_passwd; /* user password */ int pw_uid; /* user id */ int pw_gid; /* group id */ char *pw_gecos; /* real name */ char *pw_dir; /* home directory */ char *pw_shell; /* shell program */ struct passwd *getpwuid(int uid); #endif /* PURPLE_SILC_SILCPURPLE_H */