X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fspamserv.c;h=e4bcf4bb76161800364b5c785ece033286c91af0;hb=a1775cf9d35312dc98c18bc8a3970bcd367c9e16;hp=82eb0dcc2720a9e721789e133d8c2a7605caea93;hpb=20cfe303d2a74a7e9ac5ee94ffdb4868aca172c1;p=srvx.git diff --git a/src/spamserv.c b/src/spamserv.c index 82eb0dc..e4bcf4b 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_privmsg(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 @@ -137,10 +139,13 @@ static const struct message_entry msgtab[] = { #define SSMSG_WARNING_2 "You are violating the network rules" #define SSMSG_WARNING_RULES "%s is against the network rules. Read the network rules at %s" #define SSMSG_WARNING_RULES_2 "You are violating the network rules. Read the network rules at %s" +#define SSMSG_CHANNEL_REGISTERED "%s (channel %s) registered by %s." +#define SSMSG_CHANNEL_UNREGISTERED "%s (channel %s) unregistered by %s." static struct { struct chanNode *debug_channel; + struct chanNode *oper_channel; struct string_list *global_exceptions; const char *network_rules; unsigned char trigger; @@ -284,7 +289,8 @@ spamserv_cs_move_merge(struct userNode *user, struct chanNode *channel, struct c else snprintf(reason, sizeof(reason), "$X (channel %s) merged into %s by %s.", channel->name, target->name, user->handle_info->handle); - global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, reason); + /*global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, reason);*/ + spamserv_oper_message("%s", reason); return 1; } @@ -320,7 +326,7 @@ spamserv_cs_unregister(struct userNode *user, struct chanNode *channel, enum cs_ spamserv_part_channel(channel, partmsg); spamserv_unregister_channel(cInfo); - global_message(MESSAGE_RECIPIENT_OPERS | MESSAGE_RECIPIENT_HELPERS, global); + spamserv_oper_message(SSMSG_CHANNEL_UNREGISTERED, spamserv->nick, channel->name, user->handle_info->handle); } } @@ -570,7 +576,11 @@ spamserv_user_join(struct modeNode *mNode) if(user->uplink->burst || !(cInfo = get_chanInfo(channel->name)) || !CHECK_JOINFLOOD(cInfo) || !(uInfo = get_userInfo(user->nick))) return 0; - + + if(IsOper(user)) + { + return; + } if(!CHECK_CHANOPS(cInfo)) { @@ -1054,7 +1064,6 @@ static SPAMSERV_FUNC(cmd_register) { struct chanInfo *cInfo; - char reason[MAXLEN]; if(!channel || !channel->channel_info) { @@ -1088,8 +1097,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; @@ -1138,8 +1146,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, channel->name, user->handle_info->handle); ss_reply("SSMSG_UNREG_SUCCESS", channel->name); return 1; @@ -1599,6 +1606,11 @@ spamserv_channel_message(struct chanNode *channel, struct userNode *user, char * if(!spamserv || quit_services || !GetUserMode(channel, spamserv) || !(cInfo = get_chanInfo(channel->name)) || !(uInfo = get_userInfo(user->nick))) return; + if(IsOper(user)) + { + return; + } + if(!CHECK_CHANOPS(cInfo)) { struct modeNode *mn = GetUserMode(channel, user); @@ -1930,7 +1942,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); @@ -1943,6 +1954,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);