istream-raw-mbox.c revision 49a2d6ab6a746b4204517bc231f97734c13d79ed
/* Copyright (C) 2003 Timo Sirainen */
#include "lib.h"
#include "buffer.h"
#include "istream-internal.h"
#include "istream-raw-mbox.h"
#include "mbox-from.h"
struct raw_mbox_istream {
char *sender, *next_sender;
};
{
}
{
}
{
}
void (*timeout_cb)(void *), void *context)
{
}
{
const unsigned char *buf, *p;
char *sender;
int skip;
/* from_offset points to "\nFrom ", so unless we're at the beginning
of the file, skip the initial \n */
/* EOF - shouldn't happen */
return -1;
}
}
if (rstream->from_offset != 0) {
buf++;
pos--;
}
/* beginning of mbox */
/* broken From - should happen only at beginning of
file if this isn't a mbox.. */
return -1;
}
} else {
}
/* we'll skip over From-line */
return 0;
}
{
static const char *mbox_from = "\nFrom ";
const unsigned char *buf;
const char *fromp;
do {
/* EOF */
return -1;
}
if (mbox_read_from_line(rstream) < 0) {
return -1;
}
}
if (pos >= 31) {
&received_time, &sender) == 0) {
return -1;
}
} else if (ret == -1) {
/* last few bytes, can't contain From-line */
/* last LF doesn't belong to last message */
pos--;
}
return ret;
}
/* See if we have From-line here - note that it works right only
because all characters are different in mbox_from. */
eoh_char = '\0';
}
if (*++fromp == '\0') {
/* potential From-line - stop here */
i++;
break;
}
} else {
fromp++;
}
}
return ret;
}
{
}
{
struct raw_mbox_istream *rstream;
}
{
const unsigned char *data;
char *sender;
/* minimal: "From x Thu Nov 29 22:33:52 2001" = 31 chars */
return -1;
/* EOF */
return TRUE;
}
return FALSE;
break;
}
return FALSE;
return TRUE;
}
{
struct raw_mbox_istream *rstream =
return rstream->from_offset;
}
{
struct raw_mbox_istream *rstream =
return rstream->hdr_offset;
}
{
struct raw_mbox_istream *rstream =
const unsigned char *data;
}
if (istream_raw_mbox_is_valid_from(rstream) > 0) {
return body_size;
}
}
/* have to read through the message body */
}
{
struct raw_mbox_istream *rstream =
return rstream->received_time;
}
{
struct raw_mbox_istream *rstream =
}
{
struct raw_mbox_istream *rstream =
/* don't clear stream->eof if we don't have to */
}
{
struct raw_mbox_istream *rstream =
return;
}
/* back to beginning of current message */
} else {
}
}
{
struct raw_mbox_istream *rstream =
/* kludgy */
}