Changeset 66b9e36a


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.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • irc.h

    re685657 r66b9e36a  
    158158        gboolean (*part)( irc_channel_t *ic, const char *msg );
    159159        gboolean (*topic)( irc_channel_t *ic, const char *new );
     160        gboolean (*invite)( irc_channel_t *ic, irc_user_t *iu );
    160161};
    161162
  • 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 },
  • irc_im.c

    re685657 r66b9e36a  
    413413}
    414414
     415static gboolean bee_irc_channel_chat_invite( irc_channel_t *ic, irc_user_t *iu )
     416{
     417        struct groupchat *c = ic->data;
     418       
     419        if( iu->bu->ic != c->ic )
     420                irc_send_num( ic->irc, 482, "%s :Can't mix different IM networks in one groupchat", ic->name );
     421        else if( c->ic->acc->prpl->chat_invite )
     422                c->ic->acc->prpl->chat_invite( c, iu->bu->handle, NULL );
     423        else
     424                irc_send_num( ic->irc, 482, "%s :IM protocol does not support room invitations", ic->name );
     425       
     426        return TRUE;
     427}
     428
    415429static const struct irc_channel_funcs irc_channel_im_chat_funcs = {
    416430        bee_irc_channel_chat_privmsg,
     
    418432        bee_irc_channel_chat_part,
    419433        bee_irc_channel_chat_topic,
     434        bee_irc_channel_chat_invite,
    420435};
    421436
Note: See TracChangeset for help on using the changeset viewer.