Changeset 7821ee8 for irc_commands.c


Ignore:
Timestamp:
2015-01-29T19:24:17Z (4 years ago)
Author:
jgeboski <jgeboski@…>
Branches:
master
Children:
e41cc40
Parents:
7b8238d
git-author:
jgeboski <jgeboski@…> (28-01-15 23:40:47)
git-committer:
jgeboski <jgeboski@…> (29-01-15 19:24:17)
Message:

irc_commands: implemented KICK support

With similar commands being supported, such as INVITE, the KICK command
should be supported as well. The key motivation behind supporting KICK
is having for having a way to remove users from group chats. As of now,
there is no way for a bitlbee user to remove a user from a group chat.
With no current KICK implementation, it made using this command a prime
candidate for the UI side of this implementation. In addition, the KICK
command has been supported in the control channel as well. This is to
keep the INVITE/KICK pair consistent.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_commands.c

    r7b8238d r7821ee8  
    498498        else if( ic->f->invite( ic, iu ) )
    499499                irc_send_num( irc, 341, "%s %s", iu->nick, ic->name );
     500}
     501
     502static void irc_cmd_kick( irc_t *irc, char **cmd )
     503{
     504        irc_channel_t *ic;
     505        irc_user_t *iu;
     506       
     507        if( ( iu = irc_user_by_name( irc, cmd[2] ) ) == NULL )
     508        {
     509                irc_send_num( irc, 401, "%s :No such nick", cmd[2] );
     510                return;
     511        }
     512        else if( ( ic = irc_channel_by_name( irc, cmd[1] ) ) == NULL )
     513        {
     514                irc_send_num( irc, 403, "%s :No such channel", cmd[1] );
     515                return;
     516        }
     517        else if( !ic->f->kick )
     518        {
     519                irc_send_num( irc, 482, "%s :Can't kick people here", cmd[1] );
     520                return;
     521        }
     522       
     523        ic->f->kick( ic, iu, cmd[3] ? cmd[3] : NULL );
    500524}
    501525
     
    746770        { "watch",       1, irc_cmd_watch,       IRC_CMD_LOGGED_IN },
    747771        { "invite",      2, irc_cmd_invite,      IRC_CMD_LOGGED_IN },
     772        { "kick",        2, irc_cmd_kick,        IRC_CMD_LOGGED_IN },
    748773        { "topic",       1, irc_cmd_topic,       IRC_CMD_LOGGED_IN },
    749774        { "oper",        2, irc_cmd_oper,        IRC_CMD_LOGGED_IN },
Note: See TracChangeset for help on using the changeset viewer.