summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2009-03-07 00:13:25 +0100
committerFlorian Westphal <fw@strlen.de>2009-03-07 00:13:25 +0100
commite9e7fc33f15d7ead5f547ebdfcc7836b75f54f83 (patch)
tree6c7e96a39cf2ac417e5504b60074ad28143c26b4
parentc09742c5189802103900fc84ded42f4f84f27ae9 (diff)
downloadngircd-e9e7fc33f15d7ead5f547ebdfcc7836b75f54f83.tar.gz
ngircd-e9e7fc33f15d7ead5f547ebdfcc7836b75f54f83.zip
add and use Channel_IsModeless()
avoid "name[0] == '+'" where possible, having Channel_IsModeless()
makes things much more obvious.
-rw-r--r--src/ngircd/channel.h2
-rw-r--r--src/ngircd/irc-channel.c2
-rw-r--r--src/ngircd/irc-mode.c3
3 files changed, 3 insertions, 4 deletions
diff --git a/src/ngircd/channel.h b/src/ngircd/channel.h
index 411c3458..b41cced2 100644
--- a/src/ngircd/channel.h
+++ b/src/ngircd/channel.h
@@ -132,7 +132,7 @@ GLOBAL bool Channel_CheckKey PARAMS((CHANNEL *Chan, CLIENT *Client,
 				     const char *Key));
 
 #define Channel_IsLocal(c) (Channel_Name(c)[0] == '&')
-
+#define Channel_IsModeless(c) (Channel_Name(c)[0] == '+')
 
 #endif
 
diff --git a/src/ngircd/irc-channel.c b/src/ngircd/irc-channel.c
index 6c478c83..af0f0668 100644
--- a/src/ngircd/irc-channel.c
+++ b/src/ngircd/irc-channel.c
@@ -303,7 +303,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
 		if (!chan) { /* channel is new; it has been created above */
 			chan = Channel_Search(channame);
 			assert(chan != NULL);
-			if (*channame == '+') { /* modeless channel... */
+			if (Channel_IsModeless(chan)) {
 				Channel_ModeAdd(chan, 't'); /* /TOPIC not allowed */
 				Channel_ModeAdd(chan, 'n'); /* no external msgs */
 			}
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c
index 9ada4f13..ba28f83e 100644
--- a/src/ngircd/irc-mode.c
+++ b/src/ngircd/irc-mode.c
@@ -290,8 +290,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
 	long l;
 	size_t len;
 
-	/* Are modes allowed on channel? */
-	if (Channel_Name(Channel)[0] == '+')
+	if (Channel_IsModeless(Channel))
 		return IRC_WriteStrClient(Client, ERR_NOCHANMODES_MSG,
 				Client_ID(Client), Channel_Name(Channel));