Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Initial cmodes should be configurable #31

Closed
rfinnie opened this issue Jul 10, 2013 · 9 comments
Closed

Initial cmodes should be configurable #31

rfinnie opened this issue Jul 10, 2013 · 9 comments

Comments

@rfinnie
Copy link

rfinnie commented Jul 10, 2013

Currently, m_join.c hardcodes the default cmodes on an initial channel creation to +nt. Could this be configurable? I'm thinking something like this to do an override of the server default:

channel {
default_cmodes = "+sn";
}

Thank you.

@Heartmender
Copy link
Contributor

channel::autochanmodes

channel {
    autochanmodes = "nt";
};

@rfinnie
Copy link
Author

rfinnie commented Jul 10, 2013

I don't see autochanmodes in the code.

@dwfreed
Copy link
Contributor

dwfreed commented Jul 12, 2013

I don't see autochanmodes in the code.

You don't see it because it doesn't exist. Here is where the code exists that sets channel modes on new channels, and it's hardcoded to +nt.

@kaniini
Copy link
Contributor

kaniini commented Sep 6, 2013

channel::autochanmodes is implemented in shadowircd if someone wants to port it over.

@Heartmender
Copy link
Contributor

I am porting it over

@Heartmender
Copy link
Contributor

I have ported the code over and it works. I would like someone to check it off before I commit it to the main tree.


My test cases are as following:

Case 1: Default config, channel::autochanmodes is set to nt. Expected that the IRCD will set the channel modes to +nt:

> JOIN #testchannel
< :Quora!~quora@127.0.0.1 JOIN #testchannel
< :bliss.quoranet.int MODE #testchannel +nt
< :bliss.quoranet.int 353 Quora = #testchannel :@Quora
< :bliss.quoranet.int 366 Quora #testchannel :End of /NAMES list.

Test passed.


Case 2: config::autochanmodes is set to sn. Expected that the IRCD will set the channel modes to +ns:

> JOIN #testchannel
< :Quora!~quora@127.0.0.1 JOIN #testchannel
< :bliss.quoranet.int MODE #testchannel +ns
< :bliss.quoranet.int 353 Quora @ #testchannel :@Quora
< :bliss.quoranet.int 366 Quora #testchannel :End of /NAMES list.

Test passed.


Case 3: config::autochanmodes is set to nsG. G is not a valid mode flag in charybdis. Expected that the IRCD will set mode +nt on the new channel or return some form of error message. User is set to SNOMASK +d:

> JOIN #testchannel
< :Quora!~quora@127.0.0.1 JOIN #testchannel
< :bliss.quoranet.int MODE #testchannel +ns
< :bliss.quoranet.int 353 Quora @ #testchannel :@Quora
< :bliss.quoranet.int 366 Quora #testchannel :End of /NAMES list.

Test results show that it will silently ignore mode flags that it does not recognize. Is this expected behavior?

@kaniini
Copy link
Contributor

kaniini commented Sep 8, 2013

Please also test without config::autochanmodes set. It should default to +nt if not set.

@Heartmender
Copy link
Contributor

Case 4: config::channelmodes is not set in the config file. Expected is that the IRCD set +nt on the channel:

> JOIN #testchannel
< :Quora!~quora@127.0.0.1 JOIN #testchannel
< :bliss.quoranet.int MODE #testchannel +nt
< :bliss.quoranet.int 353 Quora = #testchannel :@Quora
< :bliss.quoranet.int 366 Quora #testchannel :End of /NAMES list.

Test passed.

@Heartmender
Copy link
Contributor

@jillest has been suggesting that validation be done on channel joins and config rehashing.

I have added code that places log notices as well as firing server notices:

16:46 !bliss.quoranet.int *** Notice -- Quora!~quora@0::1{god} is rehashing server config file
16:46 !bliss.quoranet.int *** Notice -- Invalid channel mode G set in channel::autochanmodes

It is as simple as adding

    unsigned char * ch;
    for(ch = ConfigChannel.autochanmodes; *ch; *ch++) 
    {
        if(!chmode_table[*ch].set_func == chm_simple)
        {
            ilog(L_MAIN, "WARNING: Invalid channel mode %c set in channel::autochanmodes", *ch);
            sendto_realops_snomask(SNO_GENERAL, L_ALL,
                         "Invalid channel mode %c set in channel::autochanmodes", *ch);
            continue;
        }

        else if (chmode_table[*ch].set_func == chm_nosuch) {
            ilog(L_MAIN, "WARNING: Invalid channel mode %c set in channel::autochanmodes", *ch);
            sendto_realops_snomask(SNO_GENERAL, L_ALL,
                         "Invalid channel mode %c set in channel::autochanmodes", *ch);
            continue;
        }
    }

to the needed places, (src/s_conf.c and modules/core/m_join.c), but I think that having it generate logfile entries on channel joins is a bit unnessecary.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants