unsigned short user_level_from_name(const char *name, unsigned short clamp_level);
struct do_not_register *chanserv_is_dnr(const char *chan_name, struct handle_info *handle);
int check_user_level(struct chanNode *channel, struct userNode *user, enum levelOption opt, int allow_override, int exempt_owner);
+struct mod_chanmode *find_matching_bans(struct banList *bans, struct userNode *actee, const char *mask);
#endif
#include "gline.h"
#include "global.h"
#include "nickserv.h"
+#include "chanserv.h"
#include "modcmd.h"
#include "opserv.h"
#include "timeq.h"
#define KEY_EXPIRES "expires"
#define KEY_STAFF_AUTH_CHANNEL "staff_auth_channel"
#define KEY_STAFF_AUTH_CHANNEL_MODES "staff_auth_channel_modes"
+#define KEY_STAFF_AUTH_FORCE_OPS "staff_auth_force_opers"
#define KEY_CLONE_GLINE_DURATION "clone_gline_duration"
#define KEY_BLOCK_GLINE_DURATION "block_gline_duration"
#define KEY_ISSUER "issuer"
struct chanNode *debug_channel;
struct chanNode *alert_channel;
struct chanNode *staff_auth_channel;
+ int staff_auth_force;
struct policer_params *join_policer_params;
struct policer new_user_policer;
unsigned long untrusted_max;
return dict_find(opserv_devnull_classes, name, NULL);
}
+void operpart(struct chanNode *chan, struct userNode *user)
+{
+ if(opserv_conf.alert_channel && opserv_conf.staff_auth_force > 0 &&
+ !(irccasecmp(chan->name,opserv_conf.alert_channel->name))) {
+ struct mod_chanmode *change;
+ change = find_matching_bans(&chan->banlist, user, NULL); //don't join them if they're banned (exceptions from forced join)
+ if(change)
+ return;
+ irc_svsjoin(opserv,user,chan);
+ }
+}
+
+void operadd(struct userNode *user)
+{
+ if(opserv_conf.alert_channel && opserv_conf.staff_auth_force > 0)
+ irc_svsjoin(opserv,user,opserv_conf.alert_channel);
+}
+
+void operdel(struct userNode *user)
+{
+ if(opserv_conf.alert_channel && opserv_conf.staff_auth_force == 2)
+ irc_kick(opserv, user, opserv_conf.alert_channel, "mode -o");
+}
+
static void
opserv_conf_read(void)
{
str2 = "+timns";
opserv_conf.staff_auth_channel = AddChannel(str, now, str2, NULL);
AddChannelUser(opserv, opserv_conf.staff_auth_channel)->modes |= MODE_CHANOP;
+ str2 = database_get_data(conf_node, KEY_STAFF_AUTH_FORCE_OPS, RECDB_QSTRING);
+ opserv_conf.staff_auth_force = str2 ? atoi(str2) : 0;
} else {
opserv_conf.staff_auth_channel = NULL;
+ opserv_conf.staff_auth_force = 0;
}
str = database_get_data(conf_node, KEY_UNTRUSTED_MAX, RECDB_QSTRING);
opserv_conf.untrusted_max = str ? strtoul(str, NULL, 0) : 5;
{
if (argc < 3)
return 0;
+ if (GetUserN(argv[2]) && IsOper(GetUserN(argv[2])))
+ operpart(GetChannel(argv[1]), GetUserN(argv[2]));
ChannelUserKicked(GetUserH(origin), GetUserN(argv[2]), GetChannel(argv[1]));
return 1;
}
case 'o':
do_user_mode(FLAGS_OPER);
if (!add) {
+ operdel(user);
userList_remove(&curr_opers, user);
} else if (!userList_contains(&curr_opers, user)) {
+ operadd(user);
userList_append(&curr_opers, user);
call_oper_funcs(user);
}
// who to tell about staff auths?
"staff_auth_channel" "#opserv";
"staff_auth_channel_modes" "+tinms";
+ // Force Opers to be in staff_auth_channel
+ // 0 = don't force opers to be in the channel
+ // 1 = force opers to be in the channel
+ // 2 = force opers to be in the channel but kick them if they get mode -o set (deoper)
+ "staff_auth_force_opers" "2";
// how many clones to allow from an untrusted host?
"untrusted_max" "4";
// how long of a g-line should be issued if the max hosts is exceeded?
"size" "200";
"drain-rate" "3";
};
+
};
"chanserv" {