REACT_SVSJOIN,
REACT_SVSPART,
REACT_VERSION,
- REACT_MARK
+ REACT_MARK,
+ REACT_NOTICEUSER,
+ REACT_MSGUSER
} opserv_alert_reaction;
struct opserv_user_alert {
case REACT_SVSPART: reaction = "svspart"; break;
case REACT_VERSION: reaction = "version"; break;
case REACT_MARK: reaction = "mark"; break;
+ case REACT_NOTICEUSER: reaction = "noticeuser"; break;
+ case REACT_MSGUSER: reaction = "msguser"; break;
default: reaction = "<unknown>"; break;
}
reply("OSMSG_ALERT_IS", iter_key(it), reaction, alert->owner);
if (IsService(user))
return 0;
- dict_foreach(opserv_channel_alerts, alert_check_user, user);
+ /* Check for alerts, and stop if we find one that kills them. */
+ if (dict_foreach(opserv_user_alerts, alert_check_user, user))
+ return 1;
if (opserv && channel->bad_channel) {
opserv_debug("Found $b%s$b in bad-word channel $b%s$b; removing the user.", user->nick, channel->name);
reaction = REACT_VERSION;
else if (!irccasecmp(react, "mark"))
reaction = REACT_MARK;
+ else if (!irccasecmp(react, "noticeuser"))
+ reaction = REACT_NOTICEUSER;
+ else if (!irccasecmp(react, "msguser"))
+ reaction = REACT_MSGUSER;
else {
log_module(OS_LOG, LOG_ERROR, "Invalid reaction %s for alert %s.", react, key);
return 0;
case REACT_SVSPART: reaction = "svspart"; break;
case REACT_VERSION: reaction = "version"; break;
case REACT_MARK: reaction = "mark"; break;
+ case REACT_NOTICEUSER: reaction = "noticeuser"; break;
+ case REACT_MSGUSER: reaction = "msguser"; break;
default:
reaction = NULL;
log_module(OS_LOG, LOG_ERROR, "Invalid reaction type %d for alert %s (while writing database).", alert->reaction, iter_key(it));
add_track_user(user);
#endif
break;
+ case REACT_NOTICEUSER:
+ irc_notice_user(opserv, user, alert->discrim->reason);
+ break;
+ case REACT_MSGUSER:
+ irc_privmsg_user(opserv, user, alert->discrim->reason);
+ break;
}
return 0;
}
static void
-opserv_alert_check_account(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle))
+opserv_alert_check_account(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle), UNUSED_ARG(void *extra))
{
dict_foreach(opserv_account_based_alerts, alert_check_user, user);
}
}
static void
-opserv_staff_alert(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle))
+opserv_staff_alert(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle), UNUSED_ARG(void *extra))
{
const char *type;
reaction = REACT_VERSION;
else if(!irccasecmp(argv[2], "mark"))
reaction = REACT_MARK;
+ else if(!irccasecmp(argv[2], "noticeuser"))
+ reaction = REACT_NOTICEUSER;
+ else if(!irccasecmp(argv[2], "msguser"))
+ reaction = REACT_MSGUSER;
else {
reply("OSMSG_UNKNOWN_REACTION", argv[2]);
return 0;
}
static void
-opserv_db_cleanup(void)
+opserv_db_cleanup(UNUSED_ARG(void* extra))
{
unsigned int nn;
opserv_define_func("ACCESS", cmd_access, 0, 0, 0);
opserv_define_func("ADDALERT", cmd_addalert, 800, 0, 4);
opserv_define_func("ADDALERT NOTICE", NULL, 0, 0, 0);
+ opserv_define_func("ADDALERT NOTICEUSER", NULL, 0, 0, 0);
+ opserv_define_func("ADDALERT MSGUSER", NULL, 0, 0, 0);
opserv_define_func("ADDALERT SILENT", NULL, 900, 0, 0);
opserv_define_func("ADDALERT GLINE", NULL, 900, 0, 0);
opserv_define_func("ADDALERT SHUN", NULL, 900, 0, 0);
reg_new_channel_func(opserv_channel_check, NULL);
reg_del_channel_func(opserv_channel_delete, NULL);
reg_join_func(opserv_join_check, NULL);
- reg_auth_func(opserv_staff_alert);
- reg_auth_func(opserv_alert_check_account);
+ reg_auth_func(opserv_staff_alert, NULL);
+ reg_auth_func(opserv_alert_check_account, NULL);
reg_notice_func(opserv, opserv_notice_handler);
opserv_db_init();
/* start the karma timer, using the saved one if available */
routing_karma_timer(dict_find(opserv_routing_plan_options, "KARMA_TIMER", NULL));
- reg_exit_func(opserv_db_cleanup);
+ reg_exit_func(opserv_db_cleanup, NULL);
message_register_table(msgtab);
}