*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. Important limitations are
* listed in the COPYING file that accompanies this software.
*
#define KEY_ISSUED "issued"
#define KEY_TRUSTED_ACCOUNTS "trusted"
#define KEY_DEBUG_CHANNEL "debug_channel"
+#define KEY_DEBUG_CHANNEL_MODES "debug_channel_modes"
#define KEY_GLOBAL_EXCEPTIONS "global_exceptions"
#define KEY_GLOBAL_BADWORDS "global_badwords"
#define KEY_NETWORK_RULES "network_rules"
cInfo->exceptfloodlevel = 100;
cInfo->capsmin = 10;
cInfo->capspercent = 25;
- if (sizeof(info) == 4)
+
+ /* XXX Rewrite the flag system */
+ if (strlen(info) < 5)
+ strcat(info, "s");
+ if (strlen(info) < 6)
strcat(info, "s");
safestrncpy(cInfo->info, info, sizeof(cInfo->info));
if(kNode)
{
+ /* free(kNode); dict_remove does this */
dict_remove(killed_users_dict, irc_ntoa(&user->ip));
- free(kNode);
}
}
}
static int
-spamserv_new_user_func(struct userNode *user)
+spamserv_new_user_func(struct userNode *user, UNUSED_ARG(void *extra))
{
if(!IsLocal(user))
spamserv_create_user(user);
}
static void
-spamserv_del_user_func(struct userNode *user, struct userNode *killer, UNUSED_ARG(const char *why))
+spamserv_del_user_func(struct userNode *user, struct userNode *killer, UNUSED_ARG(const char *why), UNUSED_ARG(void *extra))
{
struct userInfo *uInfo = get_userInfo(user->nick);
struct killNode *kNode;
}
static void
-spamserv_nick_change_func(struct userNode *user, const char *old_nick)
+spamserv_nick_change_func(struct userNode *user, const char *old_nick, UNUSED_ARG(void *extra))
{
struct userInfo *uInfo = get_userInfo(old_nick);
}
static int
-spamserv_user_join(struct modeNode *mNode)
+spamserv_user_join(struct modeNode *mNode, UNUSED_ARG(void *extra))
{
struct chanNode *channel = mNode->channel;
struct userNode *user = mNode->user;
}
static void
-spamserv_user_part(struct modeNode *mn, UNUSED_ARG(const char *reason))
+spamserv_user_part(struct modeNode *mn, UNUSED_ARG(const char *reason), UNUSED_ARG(void *extra))
{
struct userNode *user = mn->user;
struct chanNode *channel = mn->channel;
struct handle_info *hi;
if (!(channel = GetChannel(argv[2]))) {
- ss_reply("SSMSG_NOT_REGISTERED", channel->name);
+ ss_reply("SSMSG_NOT_REGISTERED", argv[2]);
return 0;
}
cInfo = get_chanInfo(channel->name);
cData = channel->channel_info;
- if (!cInfo || !channel->channel_info) {
+ if (!cInfo || !cData) {
ss_reply("SSMSG_NOT_REGISTERED", channel->name);
return 0;
}
struct handle_info *hi;
if (!(channel = GetChannel(argv[2]))) {
- ss_reply("SSMSG_NOT_REGISTERED", channel->name);
+ ss_reply("SSMSG_NOT_REGISTERED", argv[2]);
return 0;
}
cInfo = get_chanInfo(channel->name);
cData = channel->channel_info;
- if (!cInfo || !channel->channel_info) {
+ if (!cInfo || !cData) {
ss_reply("SSMSG_NOT_REGISTERED", channel->name);
return 0;
}
spamserv_conf_read(void)
{
dict_t conf_node;
- const char *str;
+ const char *str, *modes;
if(!(conf_node = conf_get_data(SPAMSERV_CONF_NAME, RECDB_OBJECT)))
{
if(str)
{
- spamserv_conf.debug_channel = AddChannel(str, now, "+tinms", NULL, NULL);
+ modes = database_get_data(conf_node, KEY_DEBUG_CHANNEL_MODES, RECDB_QSTRING);
+
+ spamserv_conf.debug_channel = AddChannel(str, now, (modes ? modes : "+tinms"), NULL, NULL);
if(spamserv_conf.debug_channel)
spamserv_join_channel(spamserv_conf.debug_channel);
}
static void
-spamserv_db_cleanup(void)
+spamserv_db_cleanup(UNUSED_ARG(void* extra))
{
dict_iterator_t it;
return;
const char *modes = conf_get_data("services/spamserv/modes", RECDB_QSTRING);
- spamserv = AddService(nick, modes ? modes : NULL, "Anti Spam Services", NULL);
+ spamserv = AddLocalUser(nick, nick, NULL, "Anti Spam Services", modes);
spamserv_service = service_register(spamserv);
conf_register_reload(spamserv_conf_read);
saxdb_register("SpamServ", spamserv_saxdb_read, spamserv_saxdb_write);
- reg_new_user_func(spamserv_new_user_func);
- reg_del_user_func(spamserv_del_user_func);
- reg_nick_change_func(spamserv_nick_change_func);
- reg_join_func(spamserv_user_join);
- reg_part_func(spamserv_user_part);
+ reg_new_user_func(spamserv_new_user_func, NULL);
+ reg_del_user_func(spamserv_del_user_func, NULL);
+ reg_nick_change_func(spamserv_nick_change_func, NULL);
+ reg_join_func(spamserv_user_join, NULL);
+ reg_part_func(spamserv_user_part, NULL);
timeq_add(now + FLOOD_TIMEQ_FREQ, timeq_flood, NULL);
timeq_add(now + JOINFLOOD_TIMEQ_FREQ, timeq_joinflood, NULL);
}
}
- reg_exit_func(spamserv_db_cleanup);
+ reg_exit_func(spamserv_db_cleanup, NULL);
message_register_table(msgtab);
crc32_init();
}