Changeset 0c85c08 for irc.h


Ignore:
Timestamp:
2010-08-31T23:18:21Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
934db064
Parents:
f5c0d8e
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc.h

    rf5c0d8e r0c85c08  
    2626#ifndef _IRC_H
    2727#define _IRC_H
    28 
    29 #include "otr.h"
    3028
    3129#define IRC_MAX_LINE 512
     
    8886        gint login_source_id; /* To slightly delay some events at login time. */
    8987       
    90         otr_t *otr;            /* OTR state and book keeping */
     88        struct otr *otr; /* OTR state and book keeping, used by the OTR plugin.
     89                            TODO: Some mechanism for plugindata. */
    9190       
    9291        struct bee *b;
     
    221220} irc_channel_del_user_type_t;
    222221
     222/* These are a glued a little bit to the core/bee layer and a little bit to
     223   IRC. The first user is OTR, and I guess at some point we'll get to shape
     224   this a little bit more as other uses come up. */
     225typedef struct irc_plugin
     226{
     227        /* Called at the end of irc_new(). Can be used to add settings, etc. */
     228        gboolean (*irc_new)( irc_t *irc );
     229        /* At the end of irc_free(). */
     230        void (*irc_free)( irc_t *irc );
     231       
     232        /* Called by bee_irc_user_privmsg_cb(). Return NULL if you want to
     233           abort sending the msg. */
     234        char* (*filter_msg_out)( irc_user_t *iu, const char *msg, int flags );
     235        /* Called by bee_irc_user_msg(). Return NULL if you swallowed the
     236           message and don't want anything to go to the user. */
     237        char* (*filter_msg_in)( irc_user_t *iu, const char *msg, int flags );
     238} irc_plugin_t;
     239
     240extern GSList *irc_plugins; /* struct irc_plugin */
     241
    223242/* irc.c */
    224243extern GSList *irc_connection_list;
     
    245264
    246265void irc_umode_set( irc_t *irc, const char *s, gboolean allow_priv );
     266
     267void register_irc_plugin( const struct irc_plugin *p );
    247268
    248269/* irc_channel.c */
Note: See TracChangeset for help on using the changeset viewer.