Changeset 66b9e36a for irc_commands.c


Ignore:
Timestamp:
2010-05-08T21:52:25Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
eb37735
Parents:
e685657
Message:

Restored /invite for groupchats.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_commands.c

    re685657 r66b9e36a  
    370370}
    371371
    372 #if 0
    373372static void irc_cmd_invite( irc_t *irc, char **cmd )
    374373{
    375         char *nick = cmd[1], *channel = cmd[2];
    376         struct groupchat *c = irc_chat_by_channel( irc, channel );
    377         user_t *u = user_find( irc, nick );
    378        
    379         if( u && c && ( u->ic == c->ic ) )
    380                 if( c->ic && c->ic->acc->prpl->chat_invite )
    381                 {
    382                         c->ic->acc->prpl->chat_invite( c, u->handle, NULL );
    383                         irc_send_num( irc, 341, "%s %s", nick, channel );
    384                         return;
    385                 }
    386        
    387         irc_send_num( irc, 482, "%s :Invite impossible; User/Channel non-existent or incompatible", channel );
    388 }
    389 #endif
     374        irc_channel_t *ic;
     375        irc_user_t *iu;
     376       
     377        if( ( iu = irc_user_by_name( irc, cmd[1] ) ) == NULL )
     378        {
     379                irc_send_num( irc, 401, "%s :No such nick", cmd[1] );
     380                return;
     381        }
     382        else if( ( ic = irc_channel_by_name( irc, cmd[2] ) ) == NULL )
     383        {
     384                irc_send_num( irc, 403, "%s :No such channel", cmd[2] );
     385                return;
     386        }
     387       
     388        if( ic->f->invite )
     389                ic->f->invite( ic, iu );
     390        else
     391                irc_send_num( irc, 482, "%s :Can't invite people here", cmd[2] );
     392}
    390393
    391394static void irc_cmd_userhost( irc_t *irc, char **cmd )
     
    618621        { "ison",        1, irc_cmd_ison,        IRC_CMD_LOGGED_IN },
    619622        { "watch",       1, irc_cmd_watch,       IRC_CMD_LOGGED_IN },
     623        { "invite",      2, irc_cmd_invite,      IRC_CMD_LOGGED_IN },
    620624#if 0
    621         { "invite",      2, irc_cmd_invite,      IRC_CMD_LOGGED_IN },
    622625        { "notice",      1, irc_cmd_privmsg,     IRC_CMD_LOGGED_IN },
    623626        { "topic",       1, irc_cmd_topic,       IRC_CMD_LOGGED_IN },
Note: See TracChangeset for help on using the changeset viewer.