Changeset 18da20b


Ignore:
Timestamp:
2010-06-06T00:33:33Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
1f0224c
Parents:
c1a8a16
Message:

Added /part msgs, and the ability to silently remove users from channels
(when sending a /quit instead, for example).

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • irc.h

    rc1a8a16 r18da20b  
    222222int irc_channel_free( irc_channel_t *ic );
    223223int irc_channel_add_user( irc_channel_t *ic, irc_user_t *iu );
    224 int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu );
     224int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu, gboolean silent, const char *msg );
    225225irc_channel_user_t *irc_channel_has_user( irc_channel_t *ic, irc_user_t *iu );
    226226int irc_channel_set_topic( irc_channel_t *ic, const char *topic, const irc_user_t *who );
  • irc_channel.c

    rc1a8a16 r18da20b  
    8181       
    8282        if( ic->flags & IRC_CHANNEL_JOINED )
    83                 irc_channel_del_user( ic, irc->user );
     83                irc_channel_del_user( ic, irc->user, FALSE, "Cleaning up channel" );
    8484       
    8585        irc->channels = g_slist_remove( irc->channels, ic );
     
    142142}
    143143
    144 int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu )
     144int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu, gboolean silent, const char *msg )
    145145{
    146146        irc_channel_user_t *icu;
     
    152152        g_free( icu );
    153153       
    154         if( ic->flags & IRC_CHANNEL_JOINED )
    155                 irc_send_part( ic, iu, "" );
     154        if( ic->flags & IRC_CHANNEL_JOINED && !silent )
     155                irc_send_part( ic, iu, msg );
    156156       
    157157        if( iu == ic->irc->user )
  • irc_commands.c

    rc1a8a16 r18da20b  
    177177                irc_send_num( irc, 403, "%s :No such channel", cmd[1] );
    178178        }
    179         else if( irc_channel_del_user( ic, irc->user ) )
     179        else if( irc_channel_del_user( ic, irc->user, FALSE, cmd[2] ) )
    180180        {
    181181                if( ic->f->part )
  • irc_im.c

    rc1a8a16 r18da20b  
    160160        if( !show )
    161161        {
    162                 irc_channel_del_user( ic, iu );
     162                irc_channel_del_user( ic, iu, FALSE, NULL );
    163163        }
    164164        else
     
    368368        /* irc_channel_free( ic ); */
    369369       
    370         irc_channel_del_user( ic, ic->irc->user );
     370        irc_channel_del_user( ic, ic->irc->user, FALSE, "Chatroom closed by server" );
    371371        ic->data = NULL;
    372372       
     
    412412        irc_t *irc = bee->ui_data;
    413413       
    414         irc_channel_del_user( c->ui_data, bu == bee->user ? irc->user : bu->ui_data );
     414        irc_channel_del_user( c->ui_data, bu == bee->user ? irc->user : bu->ui_data, FALSE, NULL );
    415415       
    416416        return TRUE;
  • irc_send.c

    rc1a8a16 r18da20b  
    150150void irc_send_part( irc_channel_t *ic, irc_user_t *iu, const char *reason )
    151151{
    152         irc_write( ic->irc, ":%s!%s@%s PART %s :%s", iu->nick, iu->user, iu->host, ic->name, reason );
     152        irc_write( ic->irc, ":%s!%s@%s PART %s :%s", iu->nick, iu->user, iu->host, ic->name, reason ? : "" );
    153153}
    154154
  • irc_user.c

    rc1a8a16 r18da20b  
    5858       
    5959        for( l = irc->channels; l; l = l->next )
    60                 irc_channel_del_user( (irc_channel_t*) l->data, iu );
     60                irc_channel_del_user( (irc_channel_t*) l->data, iu, FALSE, NULL );
    6161       
    6262        g_free( iu->nick );
Note: See TracChangeset for help on using the changeset viewer.