diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-10-09 11:41:19 -0700 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-10-09 11:41:19 -0700 |
commit | 619770237590e4a760346f2e12681d7e2220dda4 (patch) | |
tree | 8d0d391407280ab74e1fc876d6f272110b474897 /irc.c | |
parent | 23b29c67968f3dd39e7d6970acc5669556f4c8b9 (diff) | |
parent | 27b407fde1844a0e03f1a9d92d2a1c4a40435f9b (diff) |
Merging OTR branch. It's more or less a plugin if you enable it, and
otherwise a no-op. DO NOT INSTALL THIS ON PUBLIC SERVERS.
Diffstat (limited to 'irc.c')
-rw-r--r-- | irc.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -28,6 +28,7 @@ #include "dcc.h" GSList *irc_connection_list; +GSList *irc_plugins; static gboolean irc_userping( gpointer _irc, gint fd, b_input_condition cond ); static char *set_eval_charset( set_t *set, char *value ); @@ -41,6 +42,7 @@ irc_t *irc_new( int fd ) socklen_t socklen = sizeof( sock ); char *host = NULL, *myhost = NULL; irc_user_t *iu; + GSList *l; set_t *s; bee_t *b; @@ -164,6 +166,13 @@ irc_t *irc_new( int fd ) nogaim_init(); + for( l = irc_plugins; l; l = l->next ) + { + irc_plugin_t *p = l->data; + if( p->irc_new ) + p->irc_new( irc ); + } + return irc; } @@ -207,6 +216,8 @@ static gboolean irc_free_hashkey( gpointer key, gpointer value, gpointer data ); void irc_free( irc_t * irc ) { + GSList *l; + irc->status |= USTATUS_SHUTDOWN; log_message( LOGLVL_INFO, "Destroying connection with fd %d", irc->fd ); @@ -215,6 +226,13 @@ void irc_free( irc_t * irc ) if( storage_save( irc, NULL, TRUE ) != STORAGE_OK ) log_message( LOGLVL_WARNING, "Error while saving settings for user %s", irc->user->nick ); + for( l = irc_plugins; l; l = l->next ) + { + irc_plugin_t *p = l->data; + if( p->irc_free ) + p->irc_free( irc ); + } + irc_connection_list = g_slist_remove( irc_connection_list, irc ); while( irc->queries != NULL ) @@ -932,3 +950,8 @@ static char *set_eval_bw_compat( set_t *set, char *value ) return SET_INVALID; } + +void register_irc_plugin( const struct irc_plugin *p ) +{ + irc_plugins = g_slist_prepend( irc_plugins, (gpointer) p ); +} |