JOIN now supports more than one channel key at a time.

This commit is contained in:
Alexander Barton 2005-09-02 15:46:49 +00:00
parent 0dd0015d16
commit e708790566
2 changed files with 30 additions and 10 deletions

View File

@ -12,6 +12,7 @@
ngIRCd CVSHEAD ngIRCd CVSHEAD
- JOIN now supports more than one channel key at a time.
- Implementec numeric "333": Time and user name who set a channel topic. - Implementec numeric "333": Time and user name who set a channel topic.
- Fixed server NOTICEs to users with "s" mode ("server messages"). - Fixed server NOTICEs to users with "s" mode ("server messages").
- Enhanced the handler for PING and PONG commands: fix forwarding and enable - Enhanced the handler for PING and PONG commands: fix forwarding and enable
@ -638,4 +639,4 @@ ngIRCd 0.0.1, 31.12.2001
-- --
$Id: ChangeLog,v 1.292 2005/09/02 12:50:25 alex Exp $ $Id: ChangeLog,v 1.293 2005/09/02 15:46:49 alex Exp $

View File

@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-channel.c,v 1.31 2005/09/02 12:50:25 alex Exp $"; static char UNUSED id[] = "$Id: irc-channel.c,v 1.32 2005/09/02 15:46:49 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@ -43,7 +43,7 @@ static char UNUSED id[] = "$Id: irc-channel.c,v 1.31 2005/09/02 12:50:25 alex Ex
GLOBAL bool GLOBAL bool
IRC_JOIN( CLIENT *Client, REQUEST *Req ) IRC_JOIN( CLIENT *Client, REQUEST *Req )
{ {
char *channame, *key, *flags, *topic, modes[8]; char *channame, *channame_ptr, *key, *key_ptr, *flags, *topic, modes[8];
bool is_new_chan, is_invited, is_banned; bool is_new_chan, is_invited, is_banned;
CLIENT *target; CLIENT *target;
CHANNEL *chan; CHANNEL *chan;
@ -60,14 +60,22 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix ); if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
/* Are channel keys given? */ /* Are channel keys given? */
if( Req->argc > 1 ) key = Req->argv[1]; if (Req->argc > 1) {
else key = NULL; key = Req->argv[1];
key_ptr = strchr(key, ',');
if (key_ptr) *key_ptr = '\0';
}
else
key = key_ptr = NULL;
channame = Req->argv[0];
channame_ptr = strchr(channame, ',');
if (channame_ptr) *channame_ptr = '\0';
/* Channel-Namen durchgehen */ /* Channel-Namen durchgehen */
chan = NULL; while (channame)
channame = strtok( Req->argv[0], "," );
while( channame )
{ {
Log(LOG_INFO, "channame=%s, key=%s", channame, key ? key : "-");
chan = NULL; flags = NULL; chan = NULL; flags = NULL;
/* wird der Channel neu angelegt? */ /* wird der Channel neu angelegt? */
@ -229,8 +237,19 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
IRC_WriteStrClient( Client, RPL_ENDOFNAMES_MSG, Client_ID( Client ), Channel_Name( chan )); IRC_WriteStrClient( Client, RPL_ENDOFNAMES_MSG, Client_ID( Client ), Channel_Name( chan ));
} }
/* naechsten Namen ermitteln */ /* next channel? */
channame = strtok( NULL, "," ); channame = channame_ptr;
if (channame) {
channame++;
channame_ptr = strchr(channame, ',');
if (channame_ptr) *channame_ptr = '\0';
if (key_ptr) {
key = ++key_ptr;
key_ptr = strchr(key, ',');
if (key_ptr) *key_ptr = '\0';
}
}
} }
return CONNECTED; return CONNECTED;
} /* IRC_JOIN */ } /* IRC_JOIN */