mirror of
https://github.com/osmarks/ngircd.git
synced 2025-03-12 12:08:12 +00:00
Merge branch 'master' into branch-0-12-x
Fixed bug 81: When trying to part a channel ("PART #channel") the client is not member of the daemon now correctly reports the numeric ERR_NOTONCHANNEL (442) insted of ERR_NOSUCHCHANNEL (403).
This commit is contained in:
commit
32bf6d4de0
@ -12,7 +12,7 @@
|
||||
# -- Initialisation --
|
||||
|
||||
AC_PREREQ(2.50)
|
||||
AC_INIT(ngircd, 0.12.0-pre1)
|
||||
AC_INIT(ngircd, 0.12-dev)
|
||||
AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
|
||||
AC_CANONICAL_TARGET
|
||||
AM_INIT_AUTOMAKE(1.6)
|
||||
|
@ -201,25 +201,38 @@ Channel_Join( CLIENT *Client, char *Name )
|
||||
} /* Channel_Join */
|
||||
|
||||
|
||||
/**
|
||||
* Remove client from channel.
|
||||
* This function lets a client lead a channel. First, the function checks
|
||||
* if the channel exists and the client is a member of it and sends out
|
||||
* appropriate error messages if not. The real work is done by the function
|
||||
* Remove_Client().
|
||||
*/
|
||||
GLOBAL bool
|
||||
Channel_Part( CLIENT *Client, CLIENT *Origin, const char *Name, const char *Reason )
|
||||
Channel_Part(CLIENT * Client, CLIENT * Origin, const char *Name, const char *Reason)
|
||||
{
|
||||
CHANNEL *chan;
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Name != NULL );
|
||||
assert( Reason != NULL );
|
||||
assert(Client != NULL);
|
||||
assert(Name != NULL);
|
||||
assert(Reason != NULL);
|
||||
|
||||
chan = Channel_Search( Name );
|
||||
if(( ! chan ) || ( ! Get_Cl2Chan( chan, Client )))
|
||||
{
|
||||
IRC_WriteStrClient( Client, ERR_NOSUCHCHANNEL_MSG, Client_ID( Client ), Name );
|
||||
chan = Channel_Search(Name);
|
||||
if (!chan) {
|
||||
IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
|
||||
Client_ID(Client), Name);
|
||||
return false;
|
||||
}
|
||||
if (!Get_Cl2Chan(chan, Client)) {
|
||||
IRC_WriteStrClient(Client, ERR_NOTONCHANNEL_MSG,
|
||||
Client_ID(Client), Name);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* User aus Channel entfernen */
|
||||
if( ! Remove_Client( REMOVE_PART, chan, Client, Origin, Reason, true)) return false;
|
||||
else return true;
|
||||
if (!Remove_Client(REMOVE_PART, chan, Client, Origin, Reason, true))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
} /* Channel_Part */
|
||||
|
||||
|
||||
|
@ -286,29 +286,36 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
|
||||
} /* IRC_JOIN */
|
||||
|
||||
|
||||
/**
|
||||
* Handler for the IRC "PART" command.
|
||||
*/
|
||||
GLOBAL bool
|
||||
IRC_PART( CLIENT *Client, REQUEST *Req )
|
||||
IRC_PART(CLIENT * Client, REQUEST * Req)
|
||||
{
|
||||
CLIENT *target;
|
||||
char *chan;
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
assert(Client != NULL);
|
||||
assert(Req != NULL);
|
||||
|
||||
if (Req->argc < 1 || Req->argc > 2)
|
||||
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
|
||||
Client_ID(Client), Req->command);
|
||||
Client_ID(Client), Req->command);
|
||||
|
||||
/* Wer ist der Absender? */
|
||||
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
|
||||
else target = Client;
|
||||
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix );
|
||||
/* Get the sender */
|
||||
if (Client_Type(Client) == CLIENT_SERVER)
|
||||
target = Client_Search(Req->prefix);
|
||||
else
|
||||
target = Client;
|
||||
if (!target)
|
||||
return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
|
||||
Client_ID(Client), Req->prefix);
|
||||
|
||||
/* Channel-Namen durchgehen */
|
||||
/* Loop over all the given channel names */
|
||||
chan = strtok(Req->argv[0], ",");
|
||||
while (chan) {
|
||||
Channel_Part(target, Client, chan, Req->argc > 1 ? Req->argv[1] : Client_ID(target));
|
||||
|
||||
Channel_Part(target, Client, chan,
|
||||
Req->argc > 1 ? Req->argv[1] : Client_ID(target));
|
||||
chan = strtok(NULL, ",");
|
||||
}
|
||||
return CONNECTED;
|
||||
|
Loading…
x
Reference in New Issue
Block a user