diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-09-01 01:18:21 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-09-01 01:18:21 +0200 |
commit | 0c85c08d210e16bb10dc283b4a1478ce53c0c1b1 (patch) | |
tree | 4d7fb00a0467ba51337fdc84cacade43b6baab97 /irc.h | |
parent | f5c0d8e4dd3ce01945a6334a5d87c89a9f43b16b (diff) |
Pluginify this thing a little bit. Not so much in the dynamically loadable
sense of the word, more in a way that core files don't have to include otr.h.
Diffstat (limited to 'irc.h')
-rw-r--r-- | irc.h | 27 |
1 files changed, 24 insertions, 3 deletions
@@ -26,8 +26,6 @@ #ifndef _IRC_H #define _IRC_H -#include "otr.h" - #define IRC_MAX_LINE 512 #define IRC_MAX_ARGS 16 @@ -87,7 +85,8 @@ typedef struct irc gint ping_source_id; gint login_source_id; /* To slightly delay some events at login time. */ - otr_t *otr; /* OTR state and book keeping */ + struct otr *otr; /* OTR state and book keeping, used by the OTR plugin. + TODO: Some mechanism for plugindata. */ struct bee *b; } irc_t; @@ -220,6 +219,26 @@ typedef enum IRC_CDU_KICK, } irc_channel_del_user_type_t; +/* These are a glued a little bit to the core/bee layer and a little bit to + IRC. The first user is OTR, and I guess at some point we'll get to shape + this a little bit more as other uses come up. */ +typedef struct irc_plugin +{ + /* Called at the end of irc_new(). Can be used to add settings, etc. */ + gboolean (*irc_new)( irc_t *irc ); + /* At the end of irc_free(). */ + void (*irc_free)( irc_t *irc ); + + /* Called by bee_irc_user_privmsg_cb(). Return NULL if you want to + abort sending the msg. */ + char* (*filter_msg_out)( irc_user_t *iu, const char *msg, int flags ); + /* Called by bee_irc_user_msg(). Return NULL if you swallowed the + message and don't want anything to go to the user. */ + char* (*filter_msg_in)( irc_user_t *iu, const char *msg, int flags ); +} irc_plugin_t; + +extern GSList *irc_plugins; /* struct irc_plugin */ + /* irc.c */ extern GSList *irc_connection_list; @@ -245,6 +264,8 @@ int irc_check_login( irc_t *irc ); void irc_umode_set( irc_t *irc, const char *s, gboolean allow_priv ); +void register_irc_plugin( const struct irc_plugin *p ); + /* irc_channel.c */ irc_channel_t *irc_channel_new( irc_t *irc, const char *name ); irc_channel_t *irc_channel_by_name( irc_t *irc, const char *name ); |