<commit_before>/* Copyright (c) 2005-2008 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "mail-storage.h"
#include "mailbox-list-private.h"
#include "quota.h"
#include "quota-plugin.h"

#include <stdlib.h>

/* defined by imap, pop3, lda */
extern void (*hook_mail_storage_created)(struct mail_storage *storage);

void (*quota_next_hook_mail_storage_created)(struct mail_storage *storage);
void (*quota_next_hook_mailbox_list_created)(struct mailbox_list *list);

const char *quota_plugin_version = PACKAGE_VERSION;
struct quota *quota_set;

static void quota_root_add_rules(const char *root_name, 
				 struct quota_root *root)
{
	const char *rule_name, *rule, *error;
	unsigned int i;

	rule_name = t_strconcat(root_name, "_RULE", NULL);
	for (i = 2;; i++) {
		rule = getenv(rule_name);

		if (rule == NULL)
			break;

		if (quota_root_add_rule(root, rule, &error) < 0) {
			i_fatal("Quota root %s: Invalid rule: %s",
				root_name, rule);
		}
		rule_name = t_strdup_printf("%s_RULE%d", root_name, i);
	}
}

static void quota_root_add_warning_rules(const char *root_name,
					 struct quota_root *root)
{
	const char *rule_name, *rule, *error;
	unsigned int i;

	rule_name = t_strconcat(root_name, "_WARNING", NULL);
	for (i = 2;; i++) {
		rule = getenv(rule_name);

		if (rule == NULL)
			break;<commit_msg>"Invalid quota rule" didn't specify the error message<commit_after>/* Copyright (c) 2005-2008 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "mail-storage.h"
#include "mailbox-list-private.h"
#include "quota.h"
#include "quota-plugin.h"

#include <stdlib.h>

/* defined by imap, pop3, lda */
extern void (*hook_mail_storage_created)(struct mail_storage *storage);

void (*quota_next_hook_mail_storage_created)(struct mail_storage *storage);
void (*quota_next_hook_mailbox_list_created)(struct mailbox_list *list);

const char *quota_plugin_version = PACKAGE_VERSION;
struct quota *quota_set;

static void quota_root_add_rules(const char *root_name, 
				 struct quota_root *root)
{
	const char *rule_name, *rule, *error;
	unsigned int i;

	rule_name = t_strconcat(root_name, "_RULE", NULL);
	for (i = 2;; i++) {
		rule = getenv(rule_name);

		if (rule == NULL)
			break;

		if (quota_root_add_rule(root, rule, &error) < 0) {
			i_fatal("Quota root %s: Invalid rule %s: %s",
				root_name, rule, error);
		}
		rule_name = t_strdup_printf("%s_RULE%d", root_name, i);
	}
}

static void quota_root_add_warning_rules(const char *root_name,
					 struct quota_root *root)
{
	const char *rule_name, *rule, *error;
	unsigned int i;

	rule_name = t_strconcat(root_name, "_WARNING", NULL);
	for (i = 2;; i++) {
		rule = getenv(rule_name);

		if (rule == NULL)
			break;
{'fraction_non_alphanumeric': 0.13379765395894427, 'fraction_numerical': 0.008797653958944282, 'mean_word_length': 5.037610619469026, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4916979', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1000, 'n_words': 258}