Changeset 1c40aa7


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.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • irc.h

    r134a02c r1c40aa7  
    132132typedef enum
    133133{
    134         IRC_CHANNEL_JOINED = 1,
     134        IRC_CHANNEL_JOINED = 1, /* The user is currently in the channel. */
     135        IRC_CHANNEL_TEMP = 2,   /* Erase the channel when the user leaves,
     136                                   and don't save it. */
    135137       
    136138        /* Hack: Set this flag right before jumping into IM when we expect
  • irc_channel.c

    r134a02c r1c40aa7  
    202202       
    203203        if( iu == ic->irc->user )
     204        {
    204205                ic->flags &= ~IRC_CHANNEL_JOINED;
     206               
     207                if( ic->flags & IRC_CHANNEL_TEMP )
     208                        irc_channel_free( ic );
     209        }
    205210       
    206211        return 1;
  • 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;
  • storage_xml.c

    r134a02c r1c40aa7  
    517517                irc_channel_t *ic = l->data;
    518518               
     519                if( ic->flags & IRC_CHANNEL_TEMP )
     520                        continue;
     521               
    519522                if( !xml_printf( fd, 1, "<channel name=\"%s\" type=\"%s\">\n",
    520523                                 ic->name, set_getstr( &ic->set, "type" ) ) )
Note: See TracChangeset for help on using the changeset viewer.