repo: ngircd
action: commit
revision: 
path_from: 
revision_from: 95e8320ca99eb9546102d10a329d708458257c56:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit 95e8320ca99eb9546102d10a329d708458257c56
Author: Florian Westphal 
Date:   Sun Jan 18 00:12:28 2009 +0100

    irc.c: Fix handling of channels containing dots

    commit 2546a13ad2949192eb70bf21e114ec60af287ee4
    ('Cumulative Message Patch') broke PRIVMSG to channels
    containing dots.

    Fix this by switching evaluation order:
    Check first if the target matches a existing channel and only do a check
    for target masks if that failed.

    PRIVMSG with host/server masks is described in RFC 2812, section 3.3.1.

    Makes one wonder how a server is _really_ supposed to tell the difference
    between hostmasks and channel names.

    Sigh.

diff --git a/src/ngircd/irc.c b/src/ngircd/irc.c
index 47f86528004d24a009504076108ded7fc7b2f8c6..
index ..e5f5bbd5ddeab864b153533fa36336f5cb5d009d 100644
--- a/src/ngircd/irc.c
+++ b/src/ngircd/irc.c
@@ -466,6 +466,12 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
 						      Req->command, Client_ID(cl),
 						      Req->argv[1]))
 				return DISCONNECTED;
+		} else if (ForceType != CLIENT_SERVICE
+			   && (chan = Channel_Search(currentTarget))) {
+			/* channel */
+			if (!Channel_Write(chan, from, Client, Req->command,
+					   SendErrors, Req->argv[1]))
+					return DISCONNECTED;
 		} else if (ForceType != CLIENT_SERVICE
 			   && strchr("$#", currentTarget[0])
 			   && strchr(currentTarget, '.')) {
@@ -473,12 +479,6 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors)
 			if (!Send_Message_Mask(from, Req->command, currentTarget,
 					       Req->argv[1], SendErrors))
 				return DISCONNECTED;
-		} else if (ForceType != CLIENT_SERVICE
-			   && (chan = Channel_Search(currentTarget))) {
-			/* channel */
-			if (!Channel_Write(chan, from, Client, Req->command,
-					   SendErrors, Req->argv[1]))
-					return DISCONNECTED;
 		} else {
 			if (!SendErrors)
 				return CONNECTED;

-----END OF PAGE-----