Back to index

courier  0.68.2
Defines | Functions | Variables
maildir.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include "folder.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define MAILDIRCURCACHE   "sqwebmail-curcache"
#define MAILDIRCOUNTCACHE   "sqwebmail-curcnt"

Functions

MSGINFOmaildir_ngetinfo (const char *)
void maildir_nfreeinfo (MSGINFO *)
void maildir_free (MSGINFO **, unsigned)
void matches_free (MATCHEDSTR **, unsigned)
void maildir_remcache (const char *)
void maildir_reload (const char *)
MSGINFO ** maildir_read (const char *, unsigned, size_t *, int *, int *)
void maildir_search (const char *dirname, size_t pos, const char *searchtxt, const char *charset, unsigned nfiles)
void maildir_loadsearch (unsigned nfiles, MSGINFO ***retmsginfo, MATCHEDSTR ***retmatches, unsigned long *last_message_searched)
void maildir_count (const char *, unsigned *, unsigned *)
char * maildir_basename (const char *)
char * maildir_find (const char *, const char *)
char * maildir_posfind (const char *, size_t *)
int maildir_name2pos (const char *, const char *, size_t *)
char maildirfile_type (const char *)
void maildir_markread (const char *, size_t)
void maildir_markreplied (const char *, const char *)
void maildir_msgdeletefile (const char *, const char *, size_t)
void maildir_msgpurge (const char *, size_t)
void maildir_msgpurgefile (const char *, const char *)
void maildir_purgemimegpg ()
void maildir_purgesearch ()
int maildir_msgmove (const char *, size_t, const char *)
int maildir_msgmovefile (const char *, const char *, const char *, size_t)
void maildir_autopurge ()
char * maildir_readheader (FILE *, char **, int)
char * maildir_readheader_mimepart (FILE *, char **, int, off_t *, const off_t *)
char * maildir_readline (FILE *)
char * maildir_readheader_nolc (FILE *, char **)
void maildir_listfolders (const char *inbox_name, const char *homedir, char ***)
void maildir_readfolders (char ***)
void maildir_freefolders (char ***)
int maildir_create (const char *)
int maildir_delete (const char *, int)
int maildir_rename_wrapper (const char *, const char *)
int maildir_createmsg (const char *, const char *, char **)
int maildir_recreatemsg (const char *, const char *, char **)
void maildir_writemsg (int, const char *, size_t)
void maildir_writemsgstr (int, const char *)
int maildir_closemsg (int, const char *, const char *, int, unsigned long)
void listrights ()
void getacl ()
int maildir_writemsg_flush (int)
void maildir_deletenewmsg (int n, const char *, const char *)
unsigned maildir_countof (const char *)
void maildir_savefoldermsgs (const char *)
char * folder_toutf7 (const char *)
char * folder_fromutf7 (const char *)

Variables

off_t writebufpos
int writebuf8bit

Define Documentation

#define MAILDIRCOUNTCACHE   "sqwebmail-curcnt"

Definition at line 119 of file maildir.h.

#define MAILDIRCURCACHE   "sqwebmail-curcache"

Definition at line 113 of file maildir.h.


Function Documentation

char* folder_fromutf7 ( const char *  )

Definition at line 3934 of file maildir.c.

{
       char *p;
       int converr;

       p=libmail_u_convert_tobuf(foldername,
                              unicode_x_imap_modutf7,
                              sqwebmail_content_charset,
                              &converr);

       if (p && converr)
       {
              free(p);
              p=NULL;
       }

       if (p)
              return (p);

       p=strdup(foldername);
       if (!p)
              enomem();
       return (p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* folder_toutf7 ( const char *  )

Definition at line 3911 of file maildir.c.

{
       char *p;
       int converr;

       p=libmail_u_convert_tobuf(foldername, sqwebmail_content_charset,
                              unicode_x_imap_modutf7, &converr);

       if (p && converr)
       {
              free(p);
              p=NULL;
       }

       if (p)
              return (p);

       p=strdup(foldername);
       if (!p)
              enomem();
       return (p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void getacl ( )

Definition at line 517 of file acl.c.

{
       maildir_aclt_list l;
       char buf[2];
       char *owner;
       const char *a;
       const char *editentity=cgi("editentity");
       const char *editaccess=cgi("editaccess");

       const char *entitytype="";
       const char *entityval="";
       int negate=0;

       if (acl_read(&l, sqwebmail_folder, &owner) < 0)
       {
              printf("%s", getarg("ACL_noaccess"));
              return;
       }
       strcpy(buf, ACL_ADMINISTER);
       acl_computeRights(&l, buf, owner);
       if (owner)
              free(owner);

       if (buf[0] == 0)
       {
              maildir_aclt_list_destroy(&l);
              return;
       }

       printf("<form method=\"post\" name=\"form1\" action=\"");
       output_scriptptr();
       printf("\">");
       output_scriptptrpostinfo();
       printf("<input type=\"hidden\" name=\"update\" value=\"1\" />\n"
              "<input type=\"hidden\" name=\"form\" value=\"acl\" />\n");
       printf("<table class=\"folder-acl-list\"><tbody>"
              "<tr><th align=\"left\">%s</th><th align=\"left\">%s</th></tr>\n",
              getarg("ENTITY"),
              getarg("ACCESSRIGHTS"));

       maildir_aclt_list_enum(&l, getacl_cb, NULL);

       if (*editentity == '-')
       {
              ++editentity;
              negate=1;
       }

       if (*editentity)
       {
              if (strncmp(editentity, "user=", 5) == 0)
              {
                     entitytype="user";
                     entityval=editentity+5;
              }
              else if (strncmp(editentity, "group=", 6) == 0)
              {
                     entitytype="group";
                     entityval=editentity+6;
              }
              else if (strcmp(editentity, "owner") == 0 ||
                      strcmp(editentity, "anonymous") == 0)
              {
                     entitytype=editentity;
              }
              else
              {
                     entitytype="other";
                     entityval=editentity;
              }
       }

       printf("<tr><td colspan=\"2\"><hr width=\"90%%\" />");
       printf("<table><tbody>\n");
       printf("<tr><th colspan=\"2\" align=\"left\">%s</th></tr>\n",
              getarg("UPDATEHDR"));
       printf("<tr align=\"top\"><td>"
              "<select name=\"negate\" id=\"negate\">\n"
              "<option value=\"\" > </option>\n"
              "<option value=\"-\" %s>-</option>\n"
              "</select>\n"
              "<select name=\"entitytype\" id=\"entitytype\" "
              "onchange=\"javascript:updent()\" >\n"
              "<option value=\"user\" %s >%s</option>\n"
              "<option value=\"group\" %s >%s</option>\n"
              "<option value=\"owner\" %s >%s</option>\n"
              "<option value=\"anonymous\" %s >%s</option>\n"
              "<option value=\"administrators\" %s >%s</option>\n"
              "<option value=\"other\" %s >%s</option>\n"
              "</select><input type=\"text\" name=\"entity\" "
              " id=\"entity\" value=\"",
              negate ? "selected=\"selected\"":"",
              strcmp(entitytype, "user") == 0 ? "selected=\"selected\"":"",
              getarg("USER"),

              strcmp(entitytype, "group") == 0 ? "selected=\"selected\"":"",
              getarg("GROUP"),

              strcmp(entitytype, "owner") == 0 ? "selected=\"selected\"":"",
              getarg("OWNER"),

              strcmp(entitytype, "anonymous") == 0 ? "selected=\"selected\"":"",
              getarg("ANONYMOUS"),

              strcmp(entitytype, "administrators") == 0 ? "selected=\"selected\"":"",
              getarg("ADMINISTRATORS"),

              strcmp(entitytype, "other") == 0 ? "selected=\"selected\"":"",
              getarg("OTHER"));

       p_ident_name(entityval);

       printf("\"/></td><td><table><tbody>");

       a=getarg("ACL_all");

       while (*a)
       {
              char buf2[40];

              sprintf(buf2, "ACL_%c", *a);

              printf("<tr><td><input type=\"checkbox\" name=\"acl_%c\" "
                     "id=\"acl_%c\" %s />"
                     "</td><td>%s</td></tr>\n",
                     *a, *a,
                     strchr(editaccess, *a) ? "checked=\"checked\"":"",
                     getarg(buf2));
              ++a;
       }

       printf("</tbody></table></td></tr>\n"
              "<tr><td>&nbsp;</td>"
              "<td><input type=\"submit\" name=\"do.update\" value=\"%s\" />"
              "</td>"
              "</table></tbody></td></tr>\n",
              getarg("UPDATE"));

       printf("</tbody></table></form>\n");
}

Here is the call graph for this function:

void listrights ( )

Definition at line 260 of file acl.c.

{
       maildir_aclt_list l;
       char buf[40];
       char *owner;

       if (*cgi("do.update") || *cgi("delentity"))
       {
              struct maildir_info minfo;

              if (maildir_info_imap_find(&minfo, sqwebmail_folder,
                                      login_returnaddr()) == 0)
              {
                     if (minfo.homedir)
                     {
                            struct maildirwatch *w;
                            char *lock;
                            int tryanyway;

                            w=maildirwatch_alloc(minfo.homedir);

                            if (!w)
                            {
                                   maildir_info_destroy(&minfo);
                                   enomem();
                                   return;
                            }

                            lock=maildir_lock(minfo.homedir, w,
                                            &tryanyway);

                            maildir_info_destroy(&minfo);

                            if (lock == NULL)
                            {
                                   if (!tryanyway)
                                   {
                                          printf("%s",
                                                 getarg("ACL_noaccess"));
                                          return;
                                   }
                            }
                            doupdate();
                            if (lock)
                            {
                                   unlink(lock);
                                   free(lock);
                            }
                            maildirwatch_free(w);
                     }
              }
       }

       if (acl_read(&l, sqwebmail_folder, &owner) < 0)
       {
              printf("%s", getarg("ACL_cantread"));
              return;
       }
       buf[0]=0;
       strncat(buf, getarg("ACL_all"), sizeof(buf)-2);
       acl_computeRights(&l, buf, owner);
       maildir_aclt_list_destroy(&l);
       if (owner)
              free(owner);

       if (!maildir_acl_canlistrights(buf))
       {
              printf("%s", getarg("ACL_cantread"));
              return;
       }

       showrights(buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1263 of file maildir.c.

{
       char   *dir;
       char   *dirbuf;
       struct stat   stat_buf;
       DIR    *dirp;
       struct dirent *dire;
       char   *filename;
       char buffer[80];
       size_t n, i;
       FILE *fp;

       /* This is called when logging in.  Version 0.18 supports maildir
       ** quotas, so automatically upgrade all folders.
       */

       for (dirp=opendir("."); dirp && (dire=readdir(dirp)) != 0; )
       {
              if (dire->d_name[0] != '.') continue;
              if (strcmp(dire->d_name, "..") == 0)      continue;

              if (strcmp(dire->d_name, "."))
              {
                     filename=alloc_filename(dire->d_name,
                                          "maildirfolder", "");
                     if (!filename)       enomem();
                     close(open(filename, O_RDWR|O_CREAT, 0644));
                     free(filename);
              }

              /* Eliminate obsoleted cache files */

              filename=alloc_filename(dire->d_name, MAILDIRCOUNTCACHE, "");

              if (!filename)       enomem();
              unlink(filename);
              free(filename);

              filename=alloc_filename(dire->d_name, MAILDIRCURCACHE, "");

              if (!filename)       enomem();
              unlink(filename);
              free(filename);

              filename=alloc_filename(dire->d_name, "", 
                                   MAILDIRCURCACHE "." DBNAME);
              if (!filename)       enomem();
              unlink(filename);
              free(filename);
       }

       /* Version 0.24 top level remove */

       unlink(MAILDIRCURCACHE);

       /* Version 4 top level remove */

       unlink(MAILDIRCURCACHE "." DBNAME);
       mkdir (MAILDIRCURCACHE, 0700);

       if (dirp)
              closedir(dirp);

       /*
       ** Periodically purge stale cache files of nonexistent folders.
       ** This is done by using a counter that runs from 0 up until the
       ** # of files in MAILDIRCURCACHE.  At each login, we check if
       ** file #n is for an existing folder.  If not, the stale file is
       ** removed.
       */

       n=0;

       if ((fp=fopen(MAILDIRCURCACHE "/.purgecnt", "r")) != NULL)
       {
              if (fgets(buffer, sizeof(buffer), fp) != NULL)
                     n=atoi(buffer);
              fclose(fp);
       }

       i=0;

       for (dirp=opendir(MAILDIRCURCACHE); dirp && (dire=readdir(dirp)); )
       {
              char *folderdir;

              if (dire->d_name[0] == '.')
                     continue;

              if (strncmp(dire->d_name, DBNAME ".", sizeof(DBNAME)) == 0 ||
                  strncmp(dire->d_name, "cnt.", 4) == 0)
              {
                     if (i == n)
                     {
                            if (!goodcache(strchr(dire->d_name, '.')+1))
                            {
                                   folderdir=malloc(sizeof(MAILDIRCURCACHE
                                                        "/")
                                                  + strlen(dire->
                                                          d_name));
                                   if (!folderdir)
                                          enomem();
                                   strcat(strcpy(folderdir,
                                                MAILDIRCURCACHE "/"),
                                          dire->d_name);
                                   unlink(folderdir);
                                   free(folderdir);
                            }
                            break;
                     }
                     ++i;
                     continue;
              }

              folderdir=malloc(sizeof(MAILDIRCURCACHE "/")
                             + strlen(dire->d_name));
              if (!folderdir)
                     enomem();
              strcat(strcpy(folderdir, MAILDIRCURCACHE "/"), dire->d_name);
              unlink(folderdir);
              free(folderdir);
       }
       if (dirp)
              closedir(dirp);

       if (i == n)
              ++i;
       else
              i=0;


       if ((fp=fopen(MAILDIRCURCACHE "/.purgecnt.tmp", "w")) == NULL ||
           fprintf(fp, "%lu\n", (unsigned long)i) < 0 ||
           fflush(fp) < 0)
              enomem();

       fclose(fp);
       if (rename(MAILDIRCURCACHE "/.purgecnt.tmp",
                 MAILDIRCURCACHE "/.purgecnt") < 0)
              enomem();

       dir=xlate_mdir(INBOX "." TRASH);

       /* Delete old files in tmp */

       time(&current_time);
       dirbuf=alloc_filename(dir, "cur", "");
       free(dir);

       for (dirp=opendir(dirbuf); dirp && (dire=readdir(dirp)) != 0; )
       {
              if (dire->d_name[0] == '.') continue;
              filename=alloc_filename(dirbuf, dire->d_name, "");
              if (stat(filename, &stat_buf) == 0 &&
                  pref_autopurge &&
                  stat_buf.st_ctime < current_time
                  - pref_autopurge * 24 * 60 * 60)
              {
                     if (maildirquota_countfolder(dirbuf) &&
                         maildirquota_countfile(filename))
                     {
                            unsigned long filesize=0;

                            if (maildir_parsequota(filename, &filesize))
                                   filesize=stat_buf.st_size;

                            if (filesize > 0)
                                   maildir_quota_deleted(".",
                                                       -(int64_t)filesize,
                                                       -1);
                     }

                     unlink(filename);
              }

              free(filename);
       }
       if (dirp)     closedir(dirp);
       free(dirbuf);

       maildir_purgemimegpg();
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* maildir_basename ( const char *  )

Definition at line 306 of file maildir.c.

{
const char *q=strrchr(filename, '/');
char   *p, *r;

       if (q) ++q;
       else   q=filename;
       p=alloc_filename("", "", q);
       if ((r=strchr(p, ':')) != 0)       *r='\0';
       return (p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int maildir_closemsg ( int  ,
const char *  ,
const char *  ,
int  ,
unsigned  long 
)

Definition at line 3773 of file maildir.c.

{
       char   *dir=xlate_mdir(folder);
       char   *oldname=alloc_filename(dir, "tmp", retname);
       char   *newname;
       struct stat   stat_buf;

 
       writeflush(n);       /* If there's still anything in the buffer */
       if (fstat(n, &stat_buf))
       {
              close(n);
              unlink(oldname);
              enomem();
       }

       newname=maildir_find(folder, retname);
              /* If we called recreatemsg before */

       if (!newname)
       {
              newname=alloc_filename(dir, "cur:2,S", retname);
              /* Hack of the century          ^^^^ */
              strcat(strcat(strcat(strcpy(newname, dir), "/cur/"),
                     retname), ":2,S");
       }

       if (writeerr)
       {
              close(n);
              unlink(oldname);
              enomem();
       }

       close(n);

       if (isok)
       {
              if (prevsize < stat_buf.st_size)
              {
                     struct maildirsize info;

                     if (maildir_quota_add_start(".", &info,
                                              stat_buf.st_size-prevsize,
                                              prevsize == 0 ? 1:0,
                                              NULL))
                     {
                            if (isok < 0) /* Force it */
                            {
                                   maildir_quota_deleted(".", (int64_t)
                                                       (stat_buf.st_size
                                                        -prevsize),
                                                       prevsize == 0
                                                       ? 1:0);
                                   isok= -2;
                            }
                            else
                                   isok=0;
                     }
                     maildir_quota_add_end(&info, stat_buf.st_size-prevsize,
                                         prevsize == 0 ? 1:0);
              }
              else if (prevsize != stat_buf.st_size)
              {
                     maildir_quota_deleted(".", (int64_t)
                                         (stat_buf.st_size-prevsize),
                                         prevsize == 0 ? 1:0);
              }
       }

       if (isok)
              rename(oldname, newname);
              
       unlink(oldname);

       if (isok)
       {
       char   *realnewname=maildir_requota(newname, stat_buf.st_size);

              if (strcmp(newname, realnewname))
                     rename(newname, realnewname);
              free(realnewname);
       }
       free(dir);
       free(oldname);
       free(newname);
       return (isok && isok != -2? 0:-1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_count ( const char *  ,
unsigned *  ,
unsigned *   
)

Definition at line 2570 of file maildir.c.

{
       struct maildir_info minfo;
       char *dir;

       *new_ptr=0;
       *other_ptr=0;

       if (maildir_info_imap_find(&minfo, folder,
                               login_returnaddr()) < 0)
              return;

       if (minfo.mailbox_type == MAILBOXTYPE_OLDSHARED)
       {
              dir=maildir_shareddir(".", strchr(folder, '.')+1);

              if (!dir)
              {
                     maildir_info_destroy(&minfo);
                     return;
              }

              maildir_shared_sync(dir);
       }
       else
       {
              if (minfo.homedir == NULL || minfo.maildir == NULL)
              {
                     maildir_info_destroy(&minfo);
                     return;
              }

              dir=maildir_name2dir(minfo.homedir, minfo.maildir);

              if (!dir)
              {
                     maildir_info_destroy(&minfo);
                     return;
              }
       }

       maildir_info_destroy(&minfo);
       maildir_checknew(folder, dir);
       dodirscan(folder, dir, new_ptr, other_ptr);
       free(dir);
}

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned maildir_countof ( const char *  )

Definition at line 2619 of file maildir.c.

{
       maildir_getfoldermsgs(folder);
       return (all_cnt);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int maildir_create ( const char *  )

Definition at line 3493 of file maildir.c.

{
       char   *dir;
       int    rc= -1;

       dir=xlate_mdir(foldername);
       if (!dir)
              return 0;

       if (mkdir(dir, 0700) == 0)
       {
       char *tmp=alloc_filename(dir, "tmp", "");

              if (mkdir(tmp, 0700) == 0)
              {
              char *tmp2=alloc_filename(dir, "new", "");

                     if (mkdir(tmp2, 0700) == 0)
                     {
                     char *tmp3=alloc_filename(dir, "cur", "");

                            if (mkdir(tmp3, 0700) == 0)
                            {
                            char *tmp4=alloc_filename(dir, "maildirfolder",
                                   "");

                                   close(open(tmp4, O_RDWR|O_CREAT, 0600));
                                   rc=0;
                                   free(tmp4);
                            }
                            free(tmp3);
                     }
                     if (rc)       rmdir(tmp2);
                     free (tmp2);
              }
              if (rc)       rmdir(tmp);
              free(tmp);
       }
       if (rc)       rmdir(dir);
       free(dir);
       return (rc);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int maildir_createmsg ( const char *  ,
const char *  ,
char **   
)

Definition at line 3599 of file maildir.c.

{
       char   *p;
       char   *dir=xlate_mdir(foldername);
       char   *filename;
       int    n;
       struct maildir_tmpcreate_info createInfo;

       /* Create a new file in the tmp directory. */

       maildir_tmpcreate_init(&createInfo);

       createInfo.maildir=dir;
       createInfo.uniq=seq;
       createInfo.doordie=1;

       if ((n=maildir_tmpcreate_fd(&createInfo)) < 0)
       {
              error("maildir_createmsg: cannot create temp file.");
       }

       /*
       ** Ok, new maildir semantics: filename in new is different than in tmp.
       ** Originally this whole scheme was designed with the filenames being
       ** the same.  We can fix it like this:
       */

       close(n);

       memcpy(strrchr(createInfo.newname, '/')-3, "tmp", 3); /* Hack */

       if (rename(createInfo.tmpname, createInfo.newname) < 0 ||
           (n=open(createInfo.newname, O_RDWR)) < 0)
       {
              error("maildir_createmsg: cannot create temp file.");
       }


       filename=createInfo.newname;
       createInfo.newname=NULL;

       maildir_tmpcreate_free(&createInfo);

       p=strrchr(filename, '/');
       *retname=strdup(p+1);

       if (*retname == 0)
       {
              close(n);
              free(filename);
              enomem();
       }
       free(filename);

       /* Buffer writes */

       writebufcnt=0;
       writebufpos=0;
       writebuf8bit=0;
       writebufleft=0;
       writeerr=0;
       return (n);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int maildir_delete ( const char *  ,
int   
)

Definition at line 3536 of file maildir.c.

{
       char   *dir, *tmp, *new, *cur;
       int    rc=0;

       struct maildir_info minfo;

       if (maildir_info_imap_find(&minfo, foldername, login_returnaddr())<0)
              return -1;

       if (strcmp(minfo.maildir, INBOX) == 0 ||
           strcmp(minfo.maildir, INBOX "." SENT) == 0 ||
           strcmp(minfo.maildir, INBOX "." TRASH) == 0 ||
           strcmp(minfo.maildir, INBOX "." DRAFTS) == 0 ||
           (dir=maildir_name2dir(minfo.homedir, minfo.maildir)) == NULL)

       {
              maildir_info_destroy(&minfo);
              return (-1);
       }

       tmp=alloc_filename(dir, "tmp", "");
       cur=alloc_filename(dir, "cur", "");
       new=alloc_filename(dir, "new", "");

       if (!deletecontent)
       {
              if (rmdir(new) || rmdir(cur))
              {
                     mkdir(new, 0700);
                     mkdir(cur, 0700);
                     rc= -1;
              }
       }

       if (rc == 0 && maildir_del(dir))
              rc= -1;

       if (rc == 0)
              maildir_acl_delete(minfo.homedir,
                               strchr(minfo.maildir, '.'));

       maildir_info_destroy(&minfo);
       free(tmp);
       free(new);
       free(cur);
       free(dir);
       return (rc);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_deletenewmsg ( int  n,
const char *  ,
const char *   
)

Definition at line 3870 of file maildir.c.

{
char   *dir=xlate_mdir(folder);
char   *oldname=alloc_filename(dir, "tmp", retname);

       close(n);
       unlink(oldname);
       free(oldname);
       free(dir);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* maildir_find ( const char *  ,
const char *   
)

Definition at line 279 of file maildir.c.

{
char   *p;
char   *d=xlate_shmdir(folder);
int    fd;

       if (!d)       return (0);
       p=maildir_filename(d, 0, filename);
       free(d);

       if (!p)       enomem();

       if ((fd=open(p, O_RDONLY)) >= 0)
       {
              close(fd);
              return (p);
       }
       free(p);
       return (0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_free ( MSGINFO **  ,
unsigned   
)

Definition at line 2736 of file maildir.c.

{
unsigned i;

       for (i=0; i<nfiles; i++)
       {
              if ( files[i] )
                     maildir_nfreeinfo( files[i] );
       }
       free(files);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_freefolders ( char ***  )

Definition at line 3484 of file maildir.c.

{
size_t cnt;

       for (cnt=0; (*fp)[cnt]; cnt++)
              free( (*fp)[cnt] );
       free(*fp);
}

Here is the caller graph for this function:

void maildir_listfolders ( const char *  inbox_name,
const char *  homedir,
char ***   
)

Definition at line 3441 of file maildir.c.

{
       size_t fbsize=0;
       size_t fbcnt=0;
       struct add_shared_info info;
       size_t sh_cnt;

       *fp=0;

       info.p=fp;
       info.s= &fbsize;
       info.c= &fbcnt;
       info.inbox_pfix=inbox_pfix;

       if (!homedir)
              homedir=".";

       /*
       ** Sort unsubscribed folders AFTER all subscribed folders.
       ** This is done by grabbing INBOX, then shared subscribed folders
       ** first, memorizing the folder cnt, adding unsubscribed folders,
       ** then sorting the unsubscribed folders separately.
       */

       maildir_list(homedir, list_callback, &info);

       if (strcmp(homedir, ".") == 0)
              maildir_list_shared(".", list_shared_callback, &info);

       sh_cnt=fbcnt;
       if (strcmp(homedir, ".") == 0)
              maildir_list_sharable(".", list_sharable_callback, &info);

       qsort( (*fp), sh_cnt, sizeof(**fp),
              (int (*)(const void *, const void *))shcomparefunc);

       qsort( (*fp)+sh_cnt, fbcnt-sh_cnt, sizeof(**fp),
              (int (*)(const void *, const void *))shcomparefunc);
       addfolder(NULL, fp, &fbsize, &fbcnt);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_loadsearch ( unsigned  nfiles,
MSGINFO ***  retmsginfo,
MATCHEDSTR ***  retmatches,
unsigned long *  last_message_searched 
)

Definition at line 1911 of file maildir.c.

{
       MSGINFO       **msginfo;
       MATCHEDSTR **matches;

       unsigned i;
       const char *filename;
       char *buf;
       FILE *fp;
       char ver;

       if ((msginfo=malloc(sizeof(MSGINFO *)*nfiles)) == 0)
              enomem();

       if ((matches=malloc(sizeof(MATCHEDSTR *)*nfiles)) == 0)
       {
              free(msginfo);
              enomem();
       }

       for (i=0; i<nfiles; i++)
       {
              msginfo[i]=0;
              matches[i]=0;
       }

       filename=cgi(SEARCHRESFILENAME);
       CHECKFILENAME(filename);

       buf=malloc(strlen(filename)+5);

       if (!buf)
       {
              free(msginfo);
              enomem();
       }

       strcat(strcpy(buf, "tmp/"), filename);

       fp=fopen(buf, "r");
       free(buf);

       if (fp)
       {
              load_int(ver, fp);

              if (ver == SEARCHFORMATVER)
              {
                     load_int(*last_message_searched, fp);
                     for (i=0; i<nfiles; ++i)
                     {
                            int ch=getc(fp);

                            if (ch == EOF)
                                   break;
                            ungetc(ch, fp);

                            load_msginfo(&msginfo[i], &matches[i], fp);
                     }
              }
       }
       fclose(fp);

       for (i=0; i<nfiles; ++i)
       {
              MSGINFO *p;

              if (msginfo[i] == 0)
                     continue;

              p=get_msginfo(msginfo[i]->msgnum);

              if (p && p->mi_ino == msginfo[i]->mi_ino) /* Safety first */
              {
                     char *f=strdup(p->filename);
                     if (f)
                     {
                            if (msginfo[i]->filename)
                                   free(msginfo[i]->filename);
                            msginfo[i]->filename=f;
                     }
              }
       }

       *retmsginfo=msginfo;
       *retmatches=matches;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_markread ( const char *  ,
size_t   
)

Definition at line 683 of file maildir.c.

{
       char acl_buf[2];

       strcpy(acl_buf, ACL_SEEN);
       acl_computeRightsOnFolder(folder, acl_buf);
       if (acl_buf[0])
              maildir_markflag(folder, pos, 'S');
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_markreplied ( const char *  ,
const char *   
)

Definition at line 693 of file maildir.c.

{
       char   *filename;
       char   *new_filename;
       char acl_buf[2];

       strcpy(acl_buf, ACL_WRITE);
       acl_computeRightsOnFolder(folder, acl_buf);

       if (acl_buf[0] == 0)
              return;

       filename=maildir_find(folder, message);

       if (filename &&
              (new_filename=maildir_addflagfilename(filename, 'R')) != 0)
       {
              rename(filename, new_filename);
              free(new_filename);
       }
       if (filename) free(filename);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_msgdeletefile ( const char *  ,
const char *  ,
size_t   
)

Definition at line 1074 of file maildir.c.

{
char *filename=maildir_find(folder, file);

       if (filename)
       {
              (void)do_msgmove(folder, filename, INBOX "." TRASH, pos, 0);
              free(filename);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int maildir_msgmove ( const char *  ,
size_t  ,
const char *   
)
int maildir_msgmovefile ( const char *  ,
const char *  ,
const char *  ,
size_t   
)

Definition at line 1085 of file maildir.c.

{
       char *filename=maildir_find(folder, file);
       int    rc;

       if (!filename)       return (0);
       rc=do_msgmove(folder, filename, dest, pos, 1);
       free(filename);
       return (rc);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_msgpurge ( const char *  ,
size_t   
)

Definition at line 768 of file maildir.c.

{
char *filename=maildir_posfind(folder, &pos);

       if (filename)
       {
              unlink(filename);
              free(filename);
       }
}

Here is the call graph for this function:

void maildir_msgpurgefile ( const char *  ,
const char *   
)

Definition at line 779 of file maildir.c.

{
char *filename=maildir_find(folder, msgid);

       if (filename)
       {
              char *d=xlate_shmdir(folder);

              if (d)
              {
                     if (strncmp(folder, SHARED ".", sizeof(SHARED))
                         && maildirquota_countfolder(d) &&
                         maildirquota_countfile(filename))
                     {
                            unsigned long filesize=0;

                            if (maildir_parsequota(filename, &filesize))
                            {
                                   struct stat stat_buf;

                                   if (stat(filename, &stat_buf) == 0)
                                          filesize=stat_buf.st_size;
                            }

                            if (filesize > 0)
                                   maildir_quota_deleted(".",
                                                       -(int64_t)filesize,
                                                       -1);
                     }
                     free(d);
              }
              unlink(filename);
              free(filename);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int maildir_name2pos ( const char *  ,
const char *  ,
size_t *   
)

Definition at line 732 of file maildir.c.

{
       char *p, *q;
       size_t len;

       maildir_reload(folder);
       if (opencache(folder, "R"))
       {
              error("Internal error in maildir_name2pos");
              return (0);
       }

       p=malloc(strlen(filename)+10);
       if (!p)
              enomem();
       strcat(strcpy(p, "FILE"), filename);
       q=strchr(p, ':');
       if (q)
              *q=0;

       q=dbobj_fetch(&folderdat, p, strlen(p), &len, "");
       free(p);

       if (!q)
              return (-1);

       *pos=0;
       for (p=q; len; --len, p++)
       {
              if (isdigit((int)(unsigned char)*p))
                     *pos = *pos * 10 + (*p-'0');
       }
       free(q);
       return (0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_nfreeinfo ( MSGINFO )

Definition at line 2878 of file maildir.c.

{
       if (mi->filename)    free(mi->filename);
       if (mi->date_s)      free(mi->date_s);
       if (mi->from_s)      free(mi->from_s);
       if (mi->subject_s)   free(mi->subject_s);
       if (mi->size_s)      free(mi->size_s);
       free(mi);
}

Here is the caller graph for this function:

MSGINFO* maildir_ngetinfo ( const char *  )

Definition at line 2890 of file maildir.c.

{
FILE   *fp;
MSGINFO       *mi;
struct stat stat_buf;
char   *hdr, *val;
const char *p;
int    is_sent_header=0;
char   *fromheader=0;
int    fd;

       /* Hack - see if we're reading a message from the Sent or Drafts
              folder */

       p=strrchr(filename, '/');
       if ((p && p - filename >=
              sizeof(SENT) + 5 && strncmp(p - (sizeof(SENT) + 5),
                     "/." SENT "/", sizeof(SENT)+2) == 0)
              || strncmp(filename, "." SENT "/", sizeof(SENT)+1) == 0
              || strncmp(filename, "./." SENT ".", sizeof(SENT)+3) == 0
              || strncmp(filename, "." SENT ".", sizeof(SENT)+1) == 0)
              is_sent_header=1;
       if ((p && p - filename >=
              sizeof(DRAFTS) + 5 && strncmp(p-(sizeof(DRAFTS) + 5),
                     "/." DRAFTS "/", sizeof(DRAFTS)+2) == 0)
              || strncmp(filename, "." DRAFTS "/", sizeof(DRAFTS)+1) == 0)
              is_sent_header=1;

       if ((mi=(MSGINFO *)malloc(sizeof(MSGINFO))) == 0)
              enomem();

       memset(mi, '\0', sizeof(*mi));

       fp=0;
       fd=maildir_semisafeopen(filename, O_RDONLY, 0);
       if (fd >= 0)
              if ((fp=fdopen(fd, "r")) == 0)
                     close(fd);

       if (fp == NULL)
       {
              free(mi);
              return (NULL);
       }

       /* mi->filename shall be the base filename, normalized as :2, */

       if ((p=strrchr(filename, '/')) != NULL)
              p++;
       else   p=filename;

       if (!(mi->filename=strdup(p)))
              enomem();

       if (fstat(fileno(fp), &stat_buf) == 0)
       {
              mi->mi_mtime=stat_buf.st_mtime;
              mi->mi_ino=stat_buf.st_ino;
              mi->size_n=stat_buf.st_size;
              mi->size_s=strdup( showsize(stat_buf.st_size));
              mi->date_n=mi->mi_mtime;    /* Default if no Date: */
              if (!mi->size_s)     enomem();
       }
       else
       {
              free(mi->filename);
              fclose(fp);
              free(mi);
              return (0);
       }


       while ((hdr=maildir_readheader(fp, &val, 0)) != 0)
       {
              if (strcmp(hdr, "subject") == 0)
              {
                     char *uibuf=rfc822_display_hdrvalue_tobuf("subject",
                                                          val,
                                                          "utf-8",
                                                          NULL, NULL);

                     if (mi->subject_s)   free(mi->subject_s);

                     mi->subject_s=uibuf;
                     if (!mi->subject_s)  enomem();
              }

              if (strcmp(hdr, "date") == 0 && mi->date_s == 0)
              {
              time_t t=rfc822_parsedt(val);

                     if (t)
                     {
                            mi->date_n=t;
                            mi->date_s=strdup(displaydate(mi->date_n));
                            if (!mi->date_s)     enomem();
                     }
              }

              if ((is_sent_header ?
                     strcmp(hdr, "to") == 0 || strcmp(hdr, "cc") == 0:
                     strcmp(hdr, "from") == 0) && fromheader == 0)
              {
                     struct rfc822t *from_addr;
                     struct rfc822a *from_addra;
                     char   *p;
                     int dotflag=0;
                     int cnt;

                     from_addr=rfc822t_alloc_new(val, NULL, NULL);
                     if (!from_addr)      enomem();
                     from_addra=rfc822a_alloc(from_addr);
                     if (!from_addra)     enomem();

                     p=NULL;

                     for (cnt=0; cnt<from_addra->naddrs; ++cnt)
                     {
                            if (from_addra->addrs[cnt].tokens == NULL)
                                   continue;

                            if (p)
                            {
                                   dotflag=1;
                                   break;
                            }

                            p=rfc822_display_name_tobuf(from_addra, cnt,
                                                     "utf-8");
                     }

                     if (p)
                     {
                            if (fromheader)      free(fromheader);
                            if ((fromheader=malloc(strlen(p)+7)) == 0)
                                   enomem();
                            strcpy(fromheader, p);
                            if (dotflag)
                                   strcat(fromheader, "...");

                            free(p);
                     }

                     rfc822a_free(from_addra);
                     rfc822t_free(from_addr);
              }

              if (mi->date_s && fromheader && mi->subject_s)
                     break;
       }
       fclose(fp);

       mi->from_s=fromheader;
       if (!mi->date_s)
              mi->date_s=strdup(displaydate(mi->date_n));
       if (!mi->date_s)     enomem();
       if (!mi->from_s && !(mi->from_s=strdup("")))     enomem();
       if (!mi->subject_s && !(mi->subject_s=strdup("")))      enomem();
       return (mi);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* maildir_posfind ( const char *  ,
size_t *   
)

Definition at line 716 of file maildir.c.

{
MSGINFO       *p;
char   *filename;

       if (opencache(folder, "R") || (p=get_msginfo( *pos)) == 0)
       {
              error("Internal error in maildir_posfind");
              return (0);
       }

       filename=maildir_find(folder, p->filename);
       return(filename);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1454 of file maildir.c.

{
       DIR    *dirp;
       struct dirent *dire;
       char *p;

       for (dirp=opendir("tmp"); dirp && (dire=readdir(dirp)) != 0; )
       {
              if (strstr(dire->d_name, ":mimegpg:") == 0 &&
                  strstr(dire->d_name, ":calendar:") == 0)     continue;

              p=malloc(sizeof("tmp/")+strlen(dire->d_name));

              if (p)
              {
                     strcat(strcpy(p, "tmp/"), dire->d_name);
                     unlink(p);
                     free(p);
              }
       }

       if (dirp)
              closedir(dirp);
}

Here is the caller graph for this function:

Definition at line 1481 of file maildir.c.

{
       DIR    *dirp;
       struct dirent *dire;
       char *p;

       for (dirp=opendir("tmp"); dirp && (dire=readdir(dirp)) != 0; )
       {
              if (strstr(dire->d_name, ":search:") == 0)       continue;

              p=malloc(sizeof("tmp/")+strlen(dire->d_name));

              if (p)
              {
                     strcat(strcpy(p, "tmp/"), dire->d_name);
                     unlink(p);
                     free(p);
              }
       }

       if (dirp)
              closedir(dirp);
}

Here is the caller graph for this function:

MSGINFO** maildir_read ( const char *  ,
unsigned  ,
size_t *  ,
int *  ,
int *   
)

Definition at line 1664 of file maildir.c.

{
MSGINFO       **msginfo;
size_t i;

       if ((msginfo=malloc(sizeof(MSGINFO *)*nfiles)) == 0)
              enomem();
       for (i=0; i<nfiles; i++)
              msginfo[i]=0;

       if (opencache(dirname, "W"))       return (msginfo);

       if (nfiles > all_cnt)       nfiles=all_cnt;
       if (*starting_pos + nfiles > all_cnt)
              *starting_pos=all_cnt-nfiles;

       *morebefore = *starting_pos > 0;

       for (i=0; i<nfiles; i++)
       {
              if (*starting_pos + i >= all_cnt)  break;
              if ((msginfo[i]= get_msginfo_alloc(*starting_pos + i)) == 0)
                     break;

              msginfo[i]->msgnum=*starting_pos+i;
       }
       *moreafter= *starting_pos + i < all_cnt;
       return (msginfo);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_readfolders ( char ***  )
char* maildir_readheader ( FILE *  ,
char **  ,
int   
)

Definition at line 2860 of file maildir.c.

{
       return (maildir_readheader_mimepart(fp, value, preserve_nl, 0, 0));
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* maildir_readheader_mimepart ( FILE *  ,
char **  ,
int  ,
off_t *  ,
const off_t *   
)

Definition at line 2812 of file maildir.c.

{
       int    c;
       int    eatspaces=0;

       buflen=0;

       if (mimepos && *mimepos >= *endpos)       return (0);

       while (mimepos == 0 || *mimepos < *endpos)
       {
              if ((c=getc(fp)) != '\n' && c >= 0)
              {
                     if (c != ' ' && c != '\t' && c != '\r')
                            eatspaces=0;

                     if (!eatspaces)
                            addbuf(c);
                     if (mimepos)  ++ *mimepos;
                     continue;
              }
              if ( c == '\n' && mimepos)  ++ *mimepos;
              if (buflen == 0)     return (0);
              if (c < 0)    break;
              c=getc(fp);
              if (c >= 0)   ungetc(c, fp);
              if (c < 0 || c == '\n' || !isspace(c))    break;
              addbuf(preserve_nl ? '\n':' ');
              if (!preserve_nl)
                     eatspaces=1;
       }
       addbuf(0);

       for ( *value=buf; **value; (*value)++)
       {
              if (**value == ':')
              {
                     **value='\0';
                     ++*value;
                     break;
              }
              **value=tolower(**value);
       }
       while (**value && isspace((int)(unsigned char)**value)) ++*value;
       return(buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* maildir_readheader_nolc ( FILE *  ,
char **   
)

Definition at line 2777 of file maildir.c.

{
       int c;

       buflen=0;

       while ((c=getc(fp)) != EOF)
       {
              if (c != '\n')
              {
                     addbuf(c);
                     continue;
              }
              c=getc(fp);
              if (c >= 0) ungetc(c, fp);
              if (c < 0 || c == '\n' || !isspace(c)) break;
              addbuf('\n');
       }
       addbuf(0);

       if (c == EOF && buf[0] == 0) return (0);

       for ( *value=buf; **value; (*value)++)
       {
              if (**value == ':')
              {
                     **value='\0';
                     ++*value;
                     break;
              }
       }
       while (**value && isspace((int)(unsigned char)**value)) ++*value;
       return(buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* maildir_readline ( FILE *  )

Definition at line 2764 of file maildir.c.

{
int    c;

       buflen=0;
       while ((c=getc(fp)) != '\n' && c >= 0)
              if (buflen < 8192)
                     addbuf(c);
       if (c < 0 && buflen == 0)   return (NULL);
       addbuf(0);
       return (buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int maildir_recreatemsg ( const char *  ,
const char *  ,
char **   
)

Definition at line 3667 of file maildir.c.

{
char   *dir=xlate_mdir(folder);
char   *base;
char   *p;
int    n;

       base=maildir_basename(name);
       p=alloc_filename(dir, "tmp", base);

       free(dir);
       *baseptr=base;
       n=maildir_safeopen(p, O_CREAT|O_RDWR|O_TRUNC, 0644);
       if (n < 0)    free(base);
       free(p);
       writebufcnt=0;
       writebufleft=0;
       writeerr=0;
       writebufpos=0;
       writebuf8bit=0;
       return (n);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_reload ( const char *  )

Definition at line 3314 of file maildir.c.

{
char   *dir=xlate_shmdir(folder);
char   *curname;
struct stat   stat_buf;

       if (!dir)     return;

       curname=alloc_filename(dir, "cur", ".");
       time(&current_time);

       /* Remove old cache file when: */

       if (opencache(folder, "W") == 0)
       {
              if ( stat(curname, &stat_buf) != 0 ||
                     stat_buf.st_mtime >= cachemtime)
              {
                     closedb();
                     createmdcache(folder, dir);
              }
       }
       free(dir);
       maildir_getfoldermsgs(folder);
       free(curname);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_remcache ( const char *  )

Definition at line 3302 of file maildir.c.

{
       char   *dir=xlate_shmdir(folder);
       char   *cachename=foldercachename(folder);

       unlink(cachename);
       if (folderdatname && strcmp(folderdatname, cachename) == 0)
              closedb();
       free(cachename);
       free(dir);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int maildir_rename_wrapper ( const char *  ,
const char *   
)
void maildir_savefoldermsgs ( const char *  )

Definition at line 3202 of file maildir.c.

{
}

Here is the caller graph for this function:

void maildir_search ( const char *  dirname,
size_t  pos,
const char *  searchtxt,
const char *  charset,
unsigned  nfiles 
)

Definition at line 1850 of file maildir.c.

{
       struct maildir_tmpcreate_info createInfo;

       MSGINFO **p;
       MATCHEDSTR **pcontext;
       char *filename;
       FILE *fp;
       unsigned i;

       unsigned long last_message_searched=0;

       execute_maildir_search(dirname, pos, searchtxt, charset,
                            nfiles, &p, &pcontext, &last_message_searched);

       maildir_purgesearch();

       maildir_tmpcreate_init(&createInfo);

       createInfo.uniq=":search:";
       createInfo.doordie=1;

       if ((fp=maildir_tmpcreate_fp(&createInfo)) == NULL)
       {
              if (p)
                     maildir_free(p, nfiles);
              error("Can't create new file.");
       }

       filename=createInfo.tmpname;
       createInfo.tmpname=NULL;
       maildir_tmpcreate_free(&createInfo);

       chmod(filename, 0600);

       {
              char ver=SEARCHFORMATVER;

              save_int(ver, fp);
              save_int(last_message_searched, fp);
       }

       for (i=0; i<nfiles; i++)
              if (p[i])
                     save_msginfo(p[i], pcontext[i], fp);
       fflush(fp);
       if (ferror(fp) || fclose(fp))
              error("Cannot create temp file");

       cgi_put(SEARCHRESFILENAME, strrchr(filename, '/')+1);

       if (p)
              maildir_free(p, nfiles);
       if (pcontext)
              matches_free(pcontext, nfiles);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_writemsg ( int  ,
const char *  ,
size_t   
)

Definition at line 3730 of file maildir.c.

{
int    c;
size_t i;

       writebufpos += cnt;  /* I'm optimistic */
       for (i=0; i<cnt; i++)
              if (p[i] & 0x80)     writebuf8bit=1;

       while (cnt)
       {
              /* Flush buffer if it's full.  No need to flush if we've
              ** already had an error before. */

              if (writebufleft == 0)      writeflush(n);

              c=writebufleft;
              if (c > cnt)  c=cnt;
              memcpy(writebufptr, p, c);
              writebufptr += c;
              p += c;
              cnt -= c;
              writebufcnt += c;
              writebufleft -= c;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int maildir_writemsg_flush ( int  )

Definition at line 3767 of file maildir.c.

{
       writeflush(n);
       return (writeerr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void maildir_writemsgstr ( int  ,
const char *   
)

Definition at line 3725 of file maildir.c.

{
       maildir_writemsg(n, p, strlen(p));
}

Here is the call graph for this function:

Here is the caller graph for this function:

char maildirfile_type ( const char *  )

Definition at line 1610 of file maildir.c.

{
const char *q=strrchr(p, '/');
int    seen_trash=0, seen_r=0, seen_s=0;

       if (q) p=q;

       if ( !(p=strchr(p, ':')) || *++p != '2' || *++p != ',')
              return (MSGTYPE_NEW);              /* No :2,info */
                            ;
       ++p;
       while (p && isalpha((int)(unsigned char)*p))
              switch (*p++) {
              case 'T':
                     seen_trash=1;
                     break;
              case 'R':
                     seen_r=1;
                     break;
              case 'S':
                     seen_s=1;
                     break;
              }

       if (seen_trash)
              return (MSGTYPE_DELETED);   /* Trashed message */
       if (seen_s)
       {
              if (seen_r)   return (MSGTYPE_REPLIED);
              return (0);
       }

       return (MSGTYPE_NEW);
}

Here is the caller graph for this function:

void matches_free ( MATCHEDSTR **  ,
unsigned   
)

Definition at line 3886 of file maildir.c.

{
       size_t i;

       for (i=0; p && i<n; ++i)
       {
              MATCHEDSTR *q;

              for (q=p[i]; q && q->match; ++q)
              {
                     free(q->prefix);
                     free(q->match);
                     free(q->suffix);
              }
              if (p[i])
                     free(p[i]);
       }
       if (p)
              free(p);
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 3597 of file maildir.c.

off_t writebufpos

Definition at line 3596 of file maildir.c.