Changeset 1c40aa7 for irc_im.c


Ignore:
Timestamp:
2010-06-28T00:07:46Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
c7eb771
Parents:
134a02c
Message:

Mark nameless groupchat channels as temporary so they don't stick around
forever.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_im.c

    r134a02c r1c40aa7  
    455455                irc_channel_printf( ic, "Cleaning up channel, bye!" );
    456456       
    457         /* irc_channel_free( ic ); */
    458        
     457        ic->data = NULL;
    459458        irc_channel_del_user( ic, ic->irc->user, FALSE, "Chatroom closed by server" );
    460         ic->data = NULL;
    461459       
    462460        return TRUE;
     
    501499        irc_t *irc = bee->ui_data;
    502500       
     501        /* TODO: Possible bug here: If a module removes $user here instead of just
     502           using imcb_chat_free() and the channel was IRC_CHANNEL_TEMP, we get into
     503           a broken state around here. */
    503504        irc_channel_del_user( c->ui_data, bu == bee->user ? irc->user : bu->ui_data, FALSE, NULL );
    504505       
     
    696697
    697698static char *set_eval_room_account( set_t *set, char *value );
     699static char *set_eval_chat_type( set_t *set, char *value );
    698700
    699701static gboolean bee_irc_channel_init( irc_channel_t *ic )
    700702{
    701703        set_add( &ic->set, "account", NULL, set_eval_room_account, ic );
    702         set_add( &ic->set, "chat_type", "groupchat", NULL, ic );
     704        set_add( &ic->set, "chat_type", "groupchat", set_eval_chat_type, ic );
    703705        set_add( &ic->set, "nick", NULL, NULL, ic );
    704706        set_add( &ic->set, "room", NULL, NULL, ic );
     707       
     708        /* chat_type == groupchat */
     709        ic->flags |= IRC_CHANNEL_TEMP;
    705710       
    706711        return TRUE;
     
    721726       
    722727        return g_strdup_printf( "%s(%s)", acc->prpl->name, acc->user );
     728}
     729
     730static char *set_eval_chat_type( set_t *set, char *value )
     731{
     732        struct irc_channel *ic = set->data;
     733       
     734        if( strcmp( value, "groupchat" ) == 0 )
     735                ic->flags |= IRC_CHANNEL_TEMP;
     736        else if( strcmp( value, "room" ) == 0 )
     737                ic->flags &= ~IRC_CHANNEL_TEMP;
     738        else
     739                return NULL;
     740       
     741        return value;
    723742}
    724743
     
    729748        set_del( &ic->set, "nick" );
    730749        set_del( &ic->set, "room" );
     750       
     751        ic->flags &= ~IRC_CHANNEL_TEMP;
    731752       
    732753        return TRUE;
Note: See TracChangeset for help on using the changeset viewer.