1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
/* DSTART */
/* */
/* maildrop - mail delivery agent with filtering abilities */
/* */
/* Copyright 1998, Double Precision Inc. */
/* */
/* This program is distributed under the terms of the GNU General Public */
/* License. See COPYING for additional information. */
/* DEND */
#include "messageinfo.h"
#include "message.h"
static const char rcsid[]="$Id: messageinfo.C 1.1 1998/04/16 23:53:22 mrsam Exp $";
void MessageInfo::info(Message &msg)
{
Buffer buf;
off_t msgstart=0;
msgoffset=0;
msg.Rewind();
fromname.reset();
for (;;)
{
msgstart=msg.tell();
buf.reset();
if (msg.appendline(buf) < 0) return;
int l=buf.Length();
const char *p=buf;
if (l && p[l-1] == '\n')
{
--l;
buf.Length(l);
}
if (l == 0) continue;
if (l < 5) break;
if (p[0] == 'F' && p[1] == 'r' && p[2] == 'o' && p[3] == 'm'
&& p[4] == ' ')
{
int i;
for (i=5; i<l; i++)
if (p[i] == ' ') break;
fromname.reset();
fromname.append(p+5, i-5);
}
else break;
}
msgoffset=msgstart;
}
|