/* Copyright (c) 2007-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "istream-private.h"
#include "istream-metawrap.h"
struct metawrap_istream {
void *context;
bool in_metadata;
};
{
char *line, *p;
if (*line == '\0') {
return 1;
}
if (p == NULL) {
"Metadata header line is missing ':' at offset %"PRIuUOFF_T,
return -1;
}
*p++ = '\0';
}
} else {
"Metadata header is missing ending line at offset %"PRIuUOFF_T,
return -1;
}
return -1;
}
return 0;
}
{
int ret;
if (mstream->in_metadata) {
if (ret <= 0)
return ret;
/* this stream is kind of silently skipping over the metadata */
if (mstream->pending_seek != 0) {
}
}
/* after metadata header it's all just passthrough */
}
static void
{
if (!mstream->in_metadata) {
/* already read through metadata. we can skip directly. */
mstream->pending_seek = 0;
} else {
/* we need to read through the metadata first */
}
}
{
int ret;
return -1;
}
if (mstream->in_metadata) {
return -1;
if (ret == 0) {
return 0;
}
}
return 0;
}
struct istream *
{
i_stream_get_fd(input), 0);
}