Back to index

courier  0.68.2
Public Member Functions | Static Private Member Functions | Private Attributes
Message Class Reference

#include <message.h>

Collaboration diagram for Message:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Message ()
 ~Message ()
void Init (int)
void Init ()
void Init (const void *, unsigned)
void ExtraHeaders (const Buffer &)
void Rewind ()
void RewindIgnore ()
int appendline (Buffer &, int=1)
void seek (off_t)
off_t tell ()
int get_c ()
int peek ()
off_t MessageSize ()
off_t MessageLines ()
void setmsgsize ()

Static Private Member Functions

static void readerr ()
static void seekerr ()

Private Attributes

Mio mio
TempFile tempfile
char * buffer
char * bufptr
char * extra_headers
char * extra_headersptr
off_t msgsize
off_t msglines

Detailed Description

Definition at line 48 of file message.h.


Constructor & Destructor Documentation


Member Function Documentation

int Message::appendline ( Buffer ,
int  = 1 
)
void Message::ExtraHeaders ( const Buffer )
int Message::get_c ( ) [inline]

Definition at line 102 of file message.h.

{
int    c;

       if (extra_headersptr)
       {
              c= (unsigned char) *extra_headersptr++;
              if (!*extra_headersptr)     extra_headersptr=0;
              return (c);
       }

       if (mio.fd() >= 0)
       {
              errno=0;

              c=mio.get();
              if (c < 0 && errno)  readerr();
              return (c);
       }

       if (bufptr >= buffer + msgsize)    return (-1);
       return ( (int)(unsigned char)*bufptr++ );
}

Here is the call graph for this function:

void Message::Init ( int  )
void Message::Init ( )
void Message::Init ( const void *  ,
unsigned   
)
off_t Message::MessageLines ( ) [inline]

Definition at line 76 of file message.h.

{ return (msglines); }
off_t Message::MessageSize ( ) [inline]

Definition at line 174 of file message.h.

{
       off_t s=msgsize;
       s -= maildrop.msginfo.msgoffset;
       if (extra_headers)
              s += strlen(extra_headers);

       return (s);
}
int Message::peek ( ) [inline]

Definition at line 83 of file message.h.

{
       if (extra_headersptr)
              return ( (unsigned char) *extra_headersptr );

       if (mio.fd() >= 0)
       {
              errno=0;

       int    c=mio.peek();

              if (c < 0 && errno)  readerr();
              return (c);
       }

       if (bufptr >= buffer + msgsize)    return (-1);
       return ( (int)(unsigned char)*bufptr );
}

Here is the call graph for this function:

static void Message::readerr ( ) [static, private]

Here is the caller graph for this function:

void Message::Rewind ( )
void Message::seek ( off_t  n) [inline]

Definition at line 147 of file message.h.

{
int    l=0;

       if (extra_headers && n < (l=strlen(extra_headers)))
       {
              extra_headersptr= extra_headers + n;
              n=0;
       }
       else
       {
              extra_headersptr=0;
              n -= l;
       }
       n += maildrop.msginfo.msgoffset;

       if (mio.fd() >= 0)
       {
              if (mio.seek(n, SEEK_SET) < 0)     seekerr();
       }
       else
       {
              if (n > msgsize)     n=msgsize;
              bufptr=buffer+n;
       }
}

Here is the call graph for this function:

static void Message::seekerr ( ) [static, private]

Here is the caller graph for this function:

off_t Message::tell ( ) [inline]

Definition at line 126 of file message.h.

{
off_t  pos;

       if ( mio.fd() < 0)
              pos=bufptr - buffer;
       else
       {
              pos=mio.tell();
              if (pos == -1)       seekerr();
       }
       pos -= maildrop.msginfo.msgoffset;
       if (extra_headersptr)
              pos += extra_headersptr-extra_headers;
       else
       {
              if (extra_headers)   pos += strlen(extra_headers);
       }
       return (pos);
}

Here is the call graph for this function:


Member Data Documentation

char* Message::buffer [private]

Definition at line 51 of file message.h.

char* Message::bufptr [private]

Definition at line 52 of file message.h.

char* Message::extra_headers [private]

Definition at line 53 of file message.h.

char* Message::extra_headersptr [private]

Definition at line 54 of file message.h.

Mio Message::mio [private]

Definition at line 49 of file message.h.

off_t Message::msglines [private]

Definition at line 56 of file message.h.

off_t Message::msgsize [private]

Definition at line 55 of file message.h.

Definition at line 50 of file message.h.


The documentation for this class was generated from the following file: