Changeset 006a84f


Ignore:
Timestamp:
2010-07-04T20:40:15Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
69b896b, 6c2404e
Parents:
f537044
Message:

Kick the user instead of parting him/her when cleaning up a channel. This is
what the older version also did so that Irssi won't clean up the window.

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • irc.h

    rf537044 r006a84f  
    206206extern const struct bee_ui_funcs irc_ui_funcs;
    207207
     208typedef enum
     209{
     210        IRC_CDU_SILENT,
     211        IRC_CDU_PART,
     212        IRC_CDU_KICK,
     213} irc_channel_del_user_type_t;
     214
    208215/* irc.c */
    209216extern GSList *irc_connection_list;
     
    233240void irc_channel_free_soon( irc_channel_t *ic );
    234241int irc_channel_add_user( irc_channel_t *ic, irc_user_t *iu );
    235 int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu, gboolean silent, const char *msg );
     242int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu, irc_channel_del_user_type_t type, const char *msg );
    236243irc_channel_user_t *irc_channel_has_user( irc_channel_t *ic, irc_user_t *iu );
    237244int irc_channel_set_topic( irc_channel_t *ic, const char *topic, const irc_user_t *who );
     
    256263void irc_send_part( irc_channel_t *ic, irc_user_t *iu, const char *reason );
    257264void irc_send_quit( irc_user_t *iu, const char *reason );
     265void irc_send_kick( irc_channel_t *ic, irc_user_t *iu, irc_user_t *kicker, const char *reason );
    258266void irc_send_names( irc_channel_t *ic );
    259267void irc_send_topic( irc_channel_t *ic, gboolean topic_change );
  • irc_channel.c

    rf537044 r006a84f  
    119119       
    120120        if( ic->flags & IRC_CHANNEL_JOINED )
    121                 irc_channel_del_user( ic, irc->user, FALSE, "Cleaning up channel" );
     121                irc_channel_del_user( ic, irc->user, IRC_CDU_KICK, "Cleaning up channel" );
    122122       
    123123        if( ic->f->_free )
     
    223223}
    224224
    225 int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu, gboolean silent, const char *msg )
     225int irc_channel_del_user( irc_channel_t *ic, irc_user_t *iu, irc_channel_del_user_type_t type, const char *msg )
    226226{
    227227        irc_channel_user_t *icu;
     
    233233        g_free( icu );
    234234       
    235         if( ic->flags & IRC_CHANNEL_JOINED && !silent )
     235        if( !( ic->flags & IRC_CHANNEL_JOINED ) || type == IRC_CDU_SILENT ) {}
     236                /* Do nothing. The caller should promise it won't screw
     237                   up state of the IRC client. :-) */
     238        else if( type == IRC_CDU_PART )
    236239                irc_send_part( ic, iu, msg );
     240        else if( type == IRC_CDU_KICK )
     241                irc_send_kick( ic, iu, ic->irc->root, msg );
    237242       
    238243        if( iu == ic->irc->user )
  • irc_im.c

    rf537044 r006a84f  
    183183        if( !show )
    184184        {
    185                 irc_channel_del_user( ic, iu, FALSE, NULL );
     185                irc_channel_del_user( ic, iu, IRC_CDU_PART, NULL );
    186186        }
    187187        else
     
    479479       
    480480        ic->data = NULL;
    481         irc_channel_del_user( ic, ic->irc->user, FALSE, "Chatroom closed by server" );
     481        irc_channel_del_user( ic, ic->irc->user, IRC_CDU_KICK, "Chatroom closed by server" );
    482482       
    483483        return TRUE;
     
    525525           using imcb_chat_free() and the channel was IRC_CHANNEL_TEMP, we get into
    526526           a broken state around here. */
    527         irc_channel_del_user( c->ui_data, bu == bee->user ? irc->user : bu->ui_data, FALSE, NULL );
     527        irc_channel_del_user( c->ui_data, bu == bee->user ? irc->user : bu->ui_data, IRC_CDU_PART, NULL );
    528528       
    529529        return TRUE;
  • irc_send.c

    rf537044 r006a84f  
    158158}
    159159
     160void irc_send_kick( irc_channel_t *ic, irc_user_t *iu, irc_user_t *kicker, const char *reason )
     161{
     162        irc_write( ic->irc, ":%s!%s@%s KICK %s %s :%s", kicker->nick, kicker->user,
     163                   kicker->host, ic->name, iu->nick, reason ? : "" );
     164}
     165
    160166void irc_send_names( irc_channel_t *ic )
    161167{
  • irc_user.c

    rf537044 r006a84f  
    205205       
    206206        for( l = iu->irc->channels; l; l = l->next )
    207                 send_quit |= irc_channel_del_user( (irc_channel_t*) l->data, iu, TRUE, NULL );
     207                send_quit |= irc_channel_del_user( (irc_channel_t*) l->data, iu, IRC_CDU_SILENT, NULL );
    208208       
    209209        if( send_quit )
Note: See TracChangeset for help on using the changeset viewer.