2 # Parent 639342abeae0ace46b4aa58ad05fb636a199a21f
4 diff -r 639342abeae0 include/channel.h
5 --- a/include/channel.h Sun Jul 14 00:21:33 2013 +0100
6 +++ b/include/channel.h Sun Jul 14 00:23:44 2013 +0100
8 int parc, char *parv[], int badop, int mtype);
9 extern struct Channel *get_channel(struct Client *cptr,
10 char *chname, ChannelGetType flag);
11 +extern int SetAutoChanModes(struct Channel *chptr);
12 extern struct Membership* find_member_link(struct Channel * chptr,
13 const struct Client* cptr);
14 extern int sub1_from_channel(struct Channel* chptr);
15 diff -r 639342abeae0 include/ircd_features.h
16 --- a/include/ircd_features.h Sun Jul 14 00:21:33 2013 +0100
17 +++ b/include/ircd_features.h Sun Jul 14 00:23:44 2013 +0100
23 + FEAT_AUTOCHANMODES_LIST,
25 /* features that probably should not be touched */
26 FEAT_KILLCHASETIMELIMIT,
27 diff -r 639342abeae0 ircd/channel.c
28 --- a/ircd/channel.c Sun Jul 14 00:21:33 2013 +0100
29 +++ b/ircd/channel.c Sun Jul 14 00:23:44 2013 +0100
30 @@ -1272,6 +1272,53 @@
34 +int SetAutoChanModes(struct Channel *chptr)
36 + static int chan_flags[] = {
39 + MODE_MODERATED, 'm',
40 + MODE_TOPICLIMIT, 't',
41 + MODE_INVITEONLY, 'i',
42 + MODE_NOPRIVMSGS, 'n',
44 +/* MODE_NOCOLOUR, 'c',
46 + MODE_NONOTICE, 'N',*/
48 + MODE_NOQUITPARTS, 'u'
51 + unsigned int *flag_p;
52 + unsigned int t_mode;
53 + const char *modestr;
59 + if (!feature_bool(FEAT_AUTOCHANMODES) || !feature_str(FEAT_AUTOCHANMODES_LIST) || strlen(feature_str(FEAT_AUTOCHANMODES_LIST)) <= 1)
62 + modestr = feature_str(FEAT_AUTOCHANMODES_LIST);
64 + for (; *modestr; modestr++) {
65 + for (flag_p = chan_flags; flag_p[0]; flag_p += 2) /* look up flag */
66 + if (flag_p[1] == *modestr)
69 + if (!flag_p[0]) /* didn't find it */
72 + t_mode |= flag_p[0];
74 + } /* for (; *modestr; modestr++) { */
77 + chptr->mode.mode = t_mode;
81 /** invite a user to a channel.
83 * Adds an invite for a user to a channel. Limits the number of invites
84 @@ -3602,6 +3649,15 @@
85 case JOINBUF_TYPE_CREATE:
86 sendcmdto_serv_butone(jbuf->jb_source, CMD_CREATE, jbuf->jb_connect,
87 "%s %Tu", chanlist, jbuf->jb_create);
88 + if (MyUser(jbuf->jb_source) && (feature_bool(FEAT_AUTOCHANMODES) &&
89 + feature_str(FEAT_AUTOCHANMODES_LIST) && (strlen(feature_str(FEAT_AUTOCHANMODES_LIST)) > 0))) {
92 + for (name = ircd_strtok(&p, chanlist, ","); name; name = ircd_strtok(&p, 0, ",")) {
93 + sendcmdto_serv_butone(jbuf->jb_source, CMD_MODE, jbuf->jb_connect,
94 + "%s %s%s", name, "+", feature_str(FEAT_AUTOCHANMODES_LIST));
99 case JOINBUF_TYPE_PART:
100 diff -r 639342abeae0 ircd/ircd_features.c
101 --- a/ircd/ircd_features.c Sun Jul 14 00:21:33 2013 +0100
102 +++ b/ircd/ircd_features.c Sun Jul 14 00:23:44 2013 +0100
104 F_B(LOCAL_CHANNELS, 0, 1, 0),
105 F_B(TOPIC_BURST, 0, 0, 0),
106 F_B(DISABLE_GLINES, 0, 0, 0),
107 + F_B(AUTOCHANMODES, 0, 1, 0),
108 + F_S(AUTOCHANMODES_LIST, FEAT_CASE | FEAT_NULL, "ntCN", 0),
110 /* features that probably should not be touched */
111 F_I(KILLCHASETIMELIMIT, 0, 30, 0),
112 diff -r 639342abeae0 ircd/m_join.c
113 --- a/ircd/m_join.c Sun Jul 14 00:21:33 2013 +0100
114 +++ b/ircd/m_join.c Sun Jul 14 00:23:44 2013 +0100
118 joinbuf_join(&create, chptr, CHFL_CHANOP | CHFL_CHANNEL_MANAGER);
119 + if (feature_bool(FEAT_AUTOCHANMODES) && feature_str(FEAT_AUTOCHANMODES_LIST) && strlen(feature_str(FEAT_AUTOCHANMODES_LIST)) > 0)
120 + SetAutoChanModes(chptr);
121 } else if (find_member_link(chptr, sptr)) {
122 continue; /* already on channel */
123 } else if (check_target_limit(sptr, chptr, chptr->chname, 0)) {