mirror of
https://github.com/osmarks/ngircd.git
synced 2025-03-13 04:28:10 +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 --
|
# -- Initialisation --
|
||||||
|
|
||||||
AC_PREREQ(2.50)
|
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_CONFIG_SRCDIR(src/ngircd/ngircd.c)
|
||||||
AC_CANONICAL_TARGET
|
AC_CANONICAL_TARGET
|
||||||
AM_INIT_AUTOMAKE(1.6)
|
AM_INIT_AUTOMAKE(1.6)
|
||||||
|
@ -201,25 +201,38 @@ Channel_Join( CLIENT *Client, char *Name )
|
|||||||
} /* Channel_Join */
|
} /* 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
|
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;
|
CHANNEL *chan;
|
||||||
|
|
||||||
assert( Client != NULL );
|
assert(Client != NULL);
|
||||||
assert( Name != NULL );
|
assert(Name != NULL);
|
||||||
assert( Reason != NULL );
|
assert(Reason != NULL);
|
||||||
|
|
||||||
chan = Channel_Search( Name );
|
chan = Channel_Search(Name);
|
||||||
if(( ! chan ) || ( ! Get_Cl2Chan( chan, Client )))
|
if (!chan) {
|
||||||
{
|
IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
|
||||||
IRC_WriteStrClient( Client, ERR_NOSUCHCHANNEL_MSG, Client_ID( Client ), Name );
|
Client_ID(Client), Name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Get_Cl2Chan(chan, Client)) {
|
||||||
|
IRC_WriteStrClient(Client, ERR_NOTONCHANNEL_MSG,
|
||||||
|
Client_ID(Client), Name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* User aus Channel entfernen */
|
if (!Remove_Client(REMOVE_PART, chan, Client, Origin, Reason, true))
|
||||||
if( ! Remove_Client( REMOVE_PART, chan, Client, Origin, Reason, true)) return false;
|
return false;
|
||||||
else return true;
|
else
|
||||||
|
return true;
|
||||||
} /* Channel_Part */
|
} /* Channel_Part */
|
||||||
|
|
||||||
|
|
||||||
|
@ -286,29 +286,36 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
|
|||||||
} /* IRC_JOIN */
|
} /* IRC_JOIN */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler for the IRC "PART" command.
|
||||||
|
*/
|
||||||
GLOBAL bool
|
GLOBAL bool
|
||||||
IRC_PART( CLIENT *Client, REQUEST *Req )
|
IRC_PART(CLIENT * Client, REQUEST * Req)
|
||||||
{
|
{
|
||||||
CLIENT *target;
|
CLIENT *target;
|
||||||
char *chan;
|
char *chan;
|
||||||
|
|
||||||
assert( Client != NULL );
|
assert(Client != NULL);
|
||||||
assert( Req != NULL );
|
assert(Req != NULL);
|
||||||
|
|
||||||
if (Req->argc < 1 || Req->argc > 2)
|
if (Req->argc < 1 || Req->argc > 2)
|
||||||
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
|
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
|
||||||
Client_ID(Client), Req->command);
|
Client_ID(Client), Req->command);
|
||||||
|
|
||||||
/* Wer ist der Absender? */
|
/* Get the sender */
|
||||||
if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix );
|
if (Client_Type(Client) == CLIENT_SERVER)
|
||||||
else target = Client;
|
target = Client_Search(Req->prefix);
|
||||||
if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), 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], ",");
|
chan = strtok(Req->argv[0], ",");
|
||||||
while (chan) {
|
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, ",");
|
chan = strtok(NULL, ",");
|
||||||
}
|
}
|
||||||
return CONNECTED;
|
return CONNECTED;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user