Back to index

courier  0.68.2
Classes | Functions
fetchinfo.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fetchinfo

Functions

struct fetchinfofetchinfo_alloc (int)
void fetchinfo_free (struct fetchinfo *)
void fetch_free_cache ()
void save_cached_offsets (off_t, off_t, off_t)
int get_cached_offsets (off_t, off_t *, off_t *)

Class Documentation

struct fetchinfo

Definition at line 10 of file fetchinfo.h.

Collaboration diagram for fetchinfo:
Class Members
char * bodysection
struct fetchinfo * bodysublist
int ispartial
char * name
struct fetchinfo * next
unsigned long partialend
unsigned long partialstart

Function Documentation

void fetch_free_cache ( )

Definition at line 1598 of file fetch.c.

struct fetchinfo* fetchinfo_alloc ( int  ) [read]

Definition at line 26 of file fetchinfo.c.

{
struct fetchinfo *list, **listtail, *p;
struct imaptoken *tok;

       list=0;
       listtail= &list;

       while ((tok=currenttoken())->tokentype == IT_ATOM)
       {
              if (oneonly && list) break;
              *listtail=p=(struct fetchinfo *)malloc(sizeof(*list));
              if (!p)       write_error_exit(0);
              p->next=0;
              p->name=my_strdup(tok->tokenbuf);
              p->bodysection=0;
              p->bodysublist=0;
              p->ispartial=0;
              listtail= &p->next;

              if (strcmp(p->name, "ALL") == 0 ||
                     strcmp(p->name, "BODYSTRUCTURE") == 0 ||
                     strcmp(p->name, "ENVELOPE") == 0 ||
                     strcmp(p->name, "FLAGS") == 0 ||
                     strcmp(p->name, "FAST") == 0 ||
                     strcmp(p->name, "FULL") == 0 ||
                     strcmp(p->name, "INTERNALDATE") == 0 ||
                     strcmp(p->name, "RFC822") == 0 ||
                     strcmp(p->name, "RFC822.HEADER") == 0 ||
                     strcmp(p->name, "RFC822.SIZE") == 0 ||
                     strcmp(p->name, "RFC822.TEXT") == 0 ||
                     strcmp(p->name, "UID") == 0)
              {
                     nexttoken();
                     continue;
              }
              if (strcmp(p->name, "BODY") && strcmp(p->name, "BODY.PEEK"))
                     break;
              if (nexttoken()->tokentype != IT_LBRACKET)       continue;

              /* Parse BODY[ ... ] */

              if ((tok=nexttoken())->tokentype != IT_RBRACKET)
              {
              char   *s;

                     if ( (tok->tokentype != IT_ATOM &&
                            tok->tokentype != IT_NUMBER) ||
                            !(s=good_section(tok->tokenbuf)))
                     {
                            fetchinfo_free(list);
                            return (0);
                     }
                     p->bodysection=my_strdup(tok->tokenbuf);

                     if (strcmp(s, "HEADER.FIELDS") == 0 ||
                            strcmp(s, "HEADER.FIELDS.NOT") == 0)
                     {
                            /* Must be followed by header list */

                            if ((tok=nexttoken_nouc())->tokentype
                                          != IT_LPAREN)
                            {
                                   p->bodysublist=alloc_headerlist(1);
                                   if (p->bodysublist == 0)
                                   {
                                          fetchinfo_free(list);
                                          return (0);
                                   }
                            }
                            else
                            {
                                   nexttoken_nouc();
                                   p->bodysublist=alloc_headerlist(0);
                                   if ( currenttoken()->tokentype
                                          != IT_RPAREN)
                                   {
                                          fetchinfo_free(list);
                                          return (0);
                                   }
                            }
                     }
                     tok=nexttoken();
                     
              }
              else p->bodysection=my_strdup("");

              if (tok->tokentype != IT_RBRACKET)
              {
                     fetchinfo_free(list);
                     return (0);
              }
              tok=nexttoken();
              if (tok->tokentype == IT_ATOM && tok->tokenbuf[0] == '<' &&
                     tok->tokenbuf[strlen(tok->tokenbuf)-1] == '>' &&
                     (p->ispartial=sscanf(tok->tokenbuf+1, "%lu.%lu",
                            &p->partialstart, &p->partialend)) > 0)
                     nexttoken();
       }
       return (list);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void fetchinfo_free ( struct fetchinfo )

Definition at line 184 of file fetchinfo.c.

{
struct fetchinfo *q;

       while (p)
       {
              if (p->bodysublist)  fetchinfo_free(p->bodysublist);
              q=p->next;
              if (p->name)  free(p->name);
              if (p->bodysection) free(p->bodysection);
              free(p);
              p=q;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int get_cached_offsets ( off_t  ,
off_t *  ,
off_t *   
)

Definition at line 1616 of file fetch.c.

{
       if (!cached_fp)
              return (-1);
       if (base != cached_base_offset)
              return (-1);

       *virt=cached_virtual_offset;
       *phys=cached_phys_offset;
       return (0);
}

Here is the caller graph for this function:

void save_cached_offsets ( off_t  ,
off_t  ,
off_t   
)

Definition at line 1609 of file fetch.c.

Here is the caller graph for this function: