Changeset 0c85c08 for irc.c


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.c

    rf5c0d8e r0c85c08  
    2929
    3030GSList *irc_connection_list;
     31GSList *irc_plugins;
    3132
    3233static gboolean irc_userping( gpointer _irc, gint fd, b_input_condition cond );
     
    4243        char *host = NULL, *myhost = NULL;
    4344        irc_user_t *iu;
     45        GSList *l;
    4446        set_t *s;
    4547        bee_t *b;
     
    164166        nogaim_init();
    165167       
     168        for( l = irc_plugins; l; l = l->next )
     169        {
     170                irc_plugin_t *p = l->data;
     171                if( p->irc_new )
     172                        p->irc_new( irc );
     173        }
     174       
    166175        return irc;
    167176}
     
    207216void irc_free( irc_t * irc )
    208217{
     218        GSList *l;
     219       
    209220        irc->status |= USTATUS_SHUTDOWN;
    210221       
    211222        log_message( LOGLVL_INFO, "Destroying connection with fd %d", irc->fd );
     223       
     224        for( l = irc_plugins; l; l = l->next )
     225        {
     226                irc_plugin_t *p = l->data;
     227                if( p->irc_free )
     228                        p->irc_free( irc );
     229        }
    212230       
    213231        if( irc->status & USTATUS_IDENTIFIED && set_getbool( &irc->b->set, "save_on_quit" ) )
     
    932950        return SET_INVALID;
    933951}
     952
     953void register_irc_plugin( const struct irc_plugin *p )
     954{
     955        irc_plugins = g_slist_prepend( irc_plugins, (gpointer) p );
     956}
Note: See TracChangeset for help on using the changeset viewer.