<commit_before>/* Copyright (C) 2002 <NAME> */

#include "common.h"
#include "ostream.h"
#include "mail-storage.h"
#include "commands-util.h"

static void alert_no_diskspace(struct mailbox *mailbox __attr_unused__,
			       void *context)
{
	struct client *client = context;

	client_send_line(client, "* NO [ALERT] "
			 "Disk space is full, delete some messages.");
}

static void notify_ok(struct mailbox *mailbox __attr_unused__,
		      const char *text, void *context)
{
	struct client *client = context;
	const char *str;

	if (o_stream_get_buffer_used_size(client->output) != 0)
		return;

	t_push();
	str = t_strconcat("* OK ", text, "\r\n", NULL);
	o_stream_send_str(client->output, str);
	t_pop();
}

static void notify_no(struct mailbox *mailbox __attr_unused__,
		      const char *text, void *context)
{
	struct client *client = context;
	const char *str;

	if (o_stream_get_buffer_used_size(client->output) != 0)
		return;

	t_push();
	str = t_strconcat("* NO ", text, "\r\n", NULL);
	o_stream_send_str(client->output, str);
	t_pop();
}

struct mail_storage_callbacks mail_storage_callbacks = {
	alert_no_diskspace,
	notify_ok,
	notify_no
};<commit_msg>Flush the output while writing the "will override lock file" messages, so that the output will actually be sent instead of just left in buffer.<commit_after>/* Copyright (C) 2002 <NAME> */

#include "common.h"
#include "ostream.h"
#include "mail-storage.h"
#include "commands-util.h"

static void alert_no_diskspace(struct mailbox *mailbox __attr_unused__,
			       void *context)
{
	struct client *client = context;

	client_send_line(client, "* NO [ALERT] "
			 "Disk space is full, delete some messages.");
}

static void notify_ok(struct mailbox *mailbox __attr_unused__,
		      const char *text, void *context)
{
	struct client *client = context;
	const char *str;

	if (o_stream_get_buffer_used_size(client->output) != 0)
		return;

	t_push();
	str = t_strconcat("* OK ", text, "\r\n", NULL);
	o_stream_send_str(client->output, str);
        o_stream_flush(client->output);
        t_pop();
}

static void notify_no(struct mailbox *mailbox __attr_unused__,
		      const char *text, void *context)
{
	struct client *client = context;
	const char *str;

	if (o_stream_get_buffer_used_size(client->output) != 0)
		return;

	t_push();
	str = t_strconcat("* NO ", text, "\r\n", NULL);
	o_stream_send_str(client->output, str);
        o_stream_flush(client->output);
	t_pop();
}

struct mail_storage_callbacks mail_storage_callbacks = {
	alert_no_diskspace,
	notify_ok,
	notify_no
};
{'fraction_non_alphanumeric': 0.12759295499021525, 'fraction_numerical': 0.004696673189823875, 'mean_word_length': 4.520518358531318, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '6592813', 'n_tokens_mistral': 929, 'n_tokens_neox': 892, 'n_words': 236}