]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Report ERR_NOTONCHANNEL when trying to part a channel one is not member of. bug81-PART
authorAlexander Barton <alex@barton.de>
Thu, 24 Apr 2008 21:52:54 +0000 (23:52 +0200)
committerAlexander Barton <alex@barton.de>
Thu, 24 Apr 2008 21:52:54 +0000 (23:52 +0200)
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).

src/ngircd/channel.c

index a4eca1f18425f0b79a05ef225f129544b1f1f75d..32f911a200f6269eed0f51420a8523ea980c0b78 100644 (file)
@@ -218,11 +218,16 @@ Channel_Part(CLIENT * Client, CLIENT * Origin, const char *Name, const char *Rea
        assert(Reason != NULL);
 
        chan = Channel_Search(Name);
        assert(Reason != NULL);
 
        chan = Channel_Search(Name);
-       if ((!chan) || (!Get_Cl2Chan(chan, Client))) {
+       if (!chan) {
                IRC_WriteStrClient(Client, ERR_NOSUCHCHANNEL_MSG,
                                   Client_ID(Client), Name);
                return false;
        }
                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;
+       }
 
        if (!Remove_Client(REMOVE_PART, chan, Client, Origin, Reason, true))
                return false;
 
        if (!Remove_Client(REMOVE_PART, chan, Client, Origin, Reason, true))
                return false;