add and use Channel_IsModeless()

avoid "name[0] == '+'" where possible, having Channel_IsModeless()
makes things much more obvious.
This commit is contained in:
Florian Westphal 2009-03-07 00:13:25 +01:00
parent c09742c518
commit e9e7fc33f1
3 changed files with 3 additions and 4 deletions

View File

@ -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

View File

@ -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 */
}

View File

@ -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));