X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fspamserv.c;h=f0ccca5d825f6f0226d072861493111f4fe71a60;hb=58d823d306b690515fbc6f671636d4ec152b867a;hp=8eb84f7aceba9f9d2357c28a60873a6f441ecc31;hpb=47230dc80d094d72a4a891afd2ad5854a9552931;p=srvx.git diff --git a/src/spamserv.c b/src/spamserv.c index 8eb84f7..f0ccca5 100644 --- a/src/spamserv.c +++ b/src/spamserv.c @@ -36,6 +36,7 @@ #define KEY_EXPIRY "expiry" #define KEY_DEBUG_CHANNEL "debug_channel" +#define KEY_OPER_CHANNEL "oper_channel" #define KEY_GLOBAL_EXCEPTIONS "global_exceptions" #define KEY_NETWORK_RULES "network_rules" #define KEY_TRIGGER "trigger" @@ -69,7 +70,8 @@ dict_t connected_users_dict; dict_t killed_users_dict; #define spamserv_notice(target, format...) send_message(target , spamserv , ## format) -#define spamserv_debug(format...) do { if(spamserv_conf.debug_channel) send_channel_notice(spamserv_conf.debug_channel , spamserv , ## format); } while(0) +#define spamserv_debug(format...) do { if(spamserv_conf.debug_channel) send_channel_message(spamserv_conf.debug_channel , spamserv , ## format); } while(0) +#define spamserv_oper_message(format...) do { if(spamserv_conf.oper_channel) send_channel_message(spamserv_conf.oper_channel , spamserv , ## format); } while(0) #define ss_reply(format...) send_message(user , spamserv , ## format) #define SET_SUBCMDS_SIZE 10 @@ -121,6 +123,8 @@ static const struct message_entry msgtab[] = { { "SSMSG_STATUS_MEMORY", "$bMemory Information:$b" }, { "SSMSG_STATUS_CHANNEL_LIST", "$bRegistered Channels:$b" }, { "SSMSG_STATUS_NO_CHANNEL", "No channels registered." }, + { "SSMSG_CHANNEL_REGISTERED", "%s (channel %s) registered by %s." }, + { "SSMSG_CHANNEL_UNREGISTERED", "%s (channel %s) unregistered by %s." }, { NULL, NULL } }; @@ -141,6 +145,7 @@ static const struct message_entry msgtab[] = { static struct { struct chanNode *debug_channel; + struct chanNode *oper_channel; struct string_list *global_exceptions; const char *network_rules; unsigned char trigger; @@ -513,13 +518,11 @@ spamserv_delete_user(struct userInfo *uInfo) free(uInfo); } -static int +static void spamserv_new_user_func(struct userNode *user) { if(!IsLocal(user)) spamserv_create_user(user); - - return 0; } static void @@ -1090,8 +1093,7 @@ SPAMSERV_FUNC(cmd_register) spamserv_join_channel(cInfo->channel); - snprintf(reason, sizeof(reason), "%s (channel %s) registered by %s.", spamserv->nick, channel->name, user->handle_info->handle); - global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, reason); + spamserv_oper_message("SSMSG_CHANNEL_REGISTERED", spamserv->nick, channel->name, user->handle_info->handle); ss_reply("SSMSG_REG_SUCCESS", channel->name); return 1; @@ -1140,8 +1142,7 @@ SPAMSERV_FUNC(cmd_unregister) spamserv_unregister_channel(cInfo); - snprintf(reason, sizeof(reason), "%s (channel %s) unregistered by %s.", spamserv->nick, channel->name, user->handle_info->handle); - global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, reason); + spamserv_oper_message("SSMSG_CHANNEL_UNREGISTERED", spamserv->nick, channel->name, user->handle_info->handle); ss_reply("SSMSG_UNREG_SUCCESS", channel->name); return 1; @@ -1805,7 +1806,7 @@ spamserv_channel_message(struct chanNode *channel, struct userNode *user, char * int size = strlen(user->hostname) + 3; char *mask = alloca(size); snprintf(mask, size, "*@%s", user->hostname); - gline_add(spamserv->nick, mask, spamserv_conf.gline_duration, reason, now, now, 1); + gline_add(spamserv->nick, mask, spamserv_conf.gline_duration, reason, now, now, 0, 1); spamserv_debug(SSMSG_DEBUG_GLINE, user->nick, user->hostname, channel->name); } else if(CHECK_KILL(uInfo)) @@ -1841,7 +1842,7 @@ spamserv_saxdb_read(struct dict *database) struct string_list *strlist; unsigned int flags,exceptlevel; char *str, *info; - time_t expiry; + unsigned long expiry; for(it = dict_first(database); it; it = iter_next(it)) { @@ -1932,7 +1933,6 @@ spamserv_conf_read(void) } str = database_get_data(conf_node, KEY_DEBUG_CHANNEL, RECDB_QSTRING); - if(str) { spamserv_conf.debug_channel = AddChannel(str, now, "+tinms", NULL); @@ -1945,6 +1945,16 @@ spamserv_conf_read(void) spamserv_conf.debug_channel = NULL; } + str = database_get_data(conf_node, KEY_OPER_CHANNEL, RECDB_QSTRING); + if(str) + { + spamserv_conf.oper_channel = AddChannel(str, now, "+tinms", NULL); + } + else + { + spamserv_conf.oper_channel = NULL; + } + spamserv_conf.global_exceptions = database_get_data(conf_node, KEY_GLOBAL_EXCEPTIONS, RECDB_STRING_LIST); str = database_get_data(conf_node, KEY_NETWORK_RULES, RECDB_QSTRING);