free(alert);
}
-#define opserv_debug(format...) do { if (opserv_conf.debug_channel) send_channel_notice(opserv_conf.debug_channel , opserv , ## format); } while (0)
-#define opserv_alert(format...) do { if (opserv_conf.alert_channel) send_channel_notice(opserv_conf.alert_channel , opserv , ## format); } while (0)
-#define opserv_custom_alert(chan, format...) do { if (chan) send_target_message(4 , chan , opserv , ## format); else if (opserv_conf.alert_channel) send_channel_notice(opserv_conf.alert_channel , opserv , ## format); } while (0)
+#if defined(GCC_VARMACROS)
+# define opserv_debug(ARGS...) do { if (opserv_conf.debug_channel) send_channel_notice(opserv_conf.debug_channel, opserv, ARGS); } while (0)
+# define opserv_alert(ARGS...) do { if (opserv_conf.alert_channel) send_channel_notice(opserv_conf.alert_channel, opserv, ARGS); } while (0)
+# define opserv_custom_alert(CHAN, ARGS...) do { if (CHAN) send_target_message(4, (CHAN), opserv, ARGS); else if (opserv_conf.alert_channel) send_channel_notice(opserv_conf.alert_channel, opserv, ARGS); } while (0)
+#elif defined(C99_VARMACROS)
+# define opserv_debug(...) do { if (opserv_conf.debug_channel) send_channel_notice(opserv_conf.debug_channel, opserv, __VA_ARGS__); } while (0)
+# define opserv_alert(...) do { if (opserv_conf.alert_channel) send_channel_notice(opserv_conf.alert_channel, opserv, __VA_ARGS__); } while (0)
+# define opserv_custom_alert(chan, ...) do { if (chan) send_target_message(4, chan, opserv, __VA_ARGS__); else if (opserv_conf.alert_channel) send_channel_notice(opserv_conf.alert_channel, opserv, __VA_ARGS__); } while (0)
+#endif
/* A lot of these commands are very similar to what ChanServ can do,
* but OpServ can do them even on channels that aren't registered.
static int alert_check_user(const char *key, void *data, void *extra);
-static int
+static void
opserv_new_user_check(struct userNode *user)
{
struct opserv_hostinfo *ohi;
/* Check to see if we should ignore them entirely. */
if (IsLocal(user) || IsService(user))
- return 0;
+ return;
/* Check for alerts, and stop if we find one that kills them. */
if (dict_foreach(opserv_user_alerts, alert_check_user, user))
- return 1;
+ return;
/* Gag them if appropriate. */
for (gag = gagList; gag; gag = gag->next) {
gline_add(opserv->nick, target, opserv_conf.clone_gline_duration, "AUTO Excessive connections from a single host.", now, now, 1);
}
}
-
- return 0;
}
static void
dict_foreach(opserv_channel_alerts, alert_check_user, user);
- if (channel->bad_channel) {
+ 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);
if (channel->name[0] != '#')
DelUser(user, opserv, 1, "OSMSG_ILLEGAL_KILL_REASON");
reply("OSMSG_BAD_NUKING", orig_bad);
string_list_delete(opserv_bad_words, bad_idx);
bad_idx--;
- free(orig_bad);
}
return 1;
}
send_channel_notice(opserv_conf.staff_auth_channel, opserv, IDENT_FORMAT" authed to %s account %s", IDENT_DATA(user), type, user->handle_info->handle);
else
send_channel_notice(opserv_conf.staff_auth_channel, opserv, "%s [%s@%s] authed to %s account %s", user->nick, user->ident, user->hostname, type, user->handle_info->handle);
+}
- dict_foreach(opserv_account_alerts, alert_check_user, user);
+static void
+opserv_auth_alert(struct userNode *user, UNUSED_ARG(struct handle_info *old_handle))
+{
+ if (!user->uplink->burst && user->handle_info)
+ dict_foreach(opserv_account_alerts, alert_check_user, user);
}
static MODCMD_FUNC(cmd_log)
reg_del_channel_func(opserv_channel_delete);
reg_join_func(opserv_join_check);
reg_auth_func(opserv_staff_alert);
+ reg_auth_func(opserv_auth_alert);
opserv_db_init();
saxdb_register("OpServ", opserv_saxdb_read, opserv_saxdb_write);