Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    r674a01d r51e9a1d  
    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;
     
    112114        s = set_add( &b->set, "last_version", NULL, NULL, irc );
    113115        s->flags |= SET_HIDDEN;
    114         s->value = g_strdup_printf( "%d", BITLBEE_VERSION_CODE );
    115116        s = set_add( &b->set, "lcnicks", "true", set_eval_bool, irc );
    116117        s = set_add( &b->set, "nick_format", "%-@nick", NULL, irc );
     
    165166        nogaim_init();
    166167       
     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       
    167175        return irc;
    168176}
     
    208216void irc_free( irc_t * irc )
    209217{
     218        GSList *l;
     219       
    210220        irc->status |= USTATUS_SHUTDOWN;
    211221       
     
    215225                if( storage_save( irc, NULL, TRUE ) != STORAGE_OK )
    216226                        log_message( LOGLVL_WARNING, "Error while saving settings for user %s", irc->user->nick );
     227       
     228        for( l = irc_plugins; l; l = l->next )
     229        {
     230                irc_plugin_t *p = l->data;
     231                if( p->irc_free )
     232                        p->irc_free( irc );
     233        }
    217234       
    218235        irc_connection_list = g_slist_remove( irc_connection_list, irc );
     
    933950        return SET_INVALID;
    934951}
     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.