Back to index

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

Go to the source code of this file.

Defines

#define enomem()   error2(__FILE__,__LINE__)
#define eio(x, y)   error3(__FILE__,__LINE__,x,y,-1)
#define emsg(x, y)   error3(__FILE__,__LINE__,x,y,0)
#define USER_DIR   "Maildir"
#define SQWEBMAIL_PAM   "webmail"
#define SOCKFILENAME   SOCKDIR "/sqwebmail.sock"
#define IPFILE   "sqwebmail-ip"
#define SENTSTAMP   "sqwebmail-sentstamp"
#define TIMESTAMP   "sqwebmail-timestamp"
#define CONFIGFILE   "sqwebmail-config"
#define GPGCONFIGFILE   "sqwebmail-gpgconfig"
#define TOKENFILE   "sqwebmail-token"
#define SIGNATURE   "sqwebmail-sig"
#define CHECKFILENAME(p)   { if (!*p || strchr((p), '/') || *p == '.') enomem(); }
#define SHAREDPATHCACHE   "sqwebmail-sharedpath"
#define MYLINESIZE   76
#define ISCTRL(c)   ((unsigned char)(c) < (unsigned char)' ')
#define GPGDIR   "gpg"
#define MIMEGPGFILENAME   "mimegpgfilename"
#define SEARCHRESFILENAME   "searchres"

Functions

void error (const char *)
void error2 (const char *, int)
void error3 (const char *, int, const char *, const char *, int)
char * strdup (const char *)
int strcasecmp (const char *, const char *)
int strncasecmp (const char *, const char *, size_t)
void cleanup ()
void http_redirect_argu (const char *, unsigned long)
void http_redirect_argss (const char *, const char *, const char *)
void http_redirect_argsss (const char *, const char *, const char *, const char *)
void fake_exit (int)
void addarg (const char *)
void freeargs ()
void insert_include (const char *)
const char * getarg (const char *)
char * get_templatedir ()
char * get_imageurl ()
char * trim_spaces (const char *s)

Define Documentation

#define CHECKFILENAME (   p)    { if (!*p || strchr((p), '/') || *p == '.') enomem(); }

Definition at line 67 of file sqwebmail.h.

#define CONFIGFILE   "sqwebmail-config"

Definition at line 51 of file sqwebmail.h.

#define eio (   x,
 
)    error3(__FILE__,__LINE__,x,y,-1)

Definition at line 22 of file sqwebmail.h.

#define emsg (   x,
 
)    error3(__FILE__,__LINE__,x,y,0)

Definition at line 23 of file sqwebmail.h.

#define enomem ( )    error2(__FILE__,__LINE__)

Definition at line 21 of file sqwebmail.h.

#define GPGCONFIGFILE   "sqwebmail-gpgconfig"

Definition at line 55 of file sqwebmail.h.

#define GPGDIR   "gpg"

Definition at line 108 of file sqwebmail.h.

#define IPFILE   "sqwebmail-ip"

Definition at line 39 of file sqwebmail.h.

#define ISCTRL (   c)    ((unsigned char)(c) < (unsigned char)' ')

Definition at line 97 of file sqwebmail.h.

#define MIMEGPGFILENAME   "mimegpgfilename"

Definition at line 110 of file sqwebmail.h.

#define MYLINESIZE   76

Definition at line 74 of file sqwebmail.h.

#define SEARCHRESFILENAME   "searchres"

Definition at line 111 of file sqwebmail.h.

#define SENTSTAMP   "sqwebmail-sentstamp"

Definition at line 43 of file sqwebmail.h.

#define SHAREDPATHCACHE   "sqwebmail-sharedpath"

Definition at line 71 of file sqwebmail.h.

#define SIGNATURE   "sqwebmail-sig"

Definition at line 65 of file sqwebmail.h.

#define SOCKFILENAME   SOCKDIR "/sqwebmail.sock"

Definition at line 35 of file sqwebmail.h.

#define SQWEBMAIL_PAM   "webmail"

Definition at line 31 of file sqwebmail.h.

#define TIMESTAMP   "sqwebmail-timestamp"

Definition at line 47 of file sqwebmail.h.

#define TOKENFILE   "sqwebmail-token"

Definition at line 61 of file sqwebmail.h.

#define USER_DIR   "Maildir"

Definition at line 27 of file sqwebmail.h.


Function Documentation

void addarg ( const char *  )

Definition at line 34 of file args.c.

{
       char *s=strdup(p);
       struct arglist *a;

       if (!s)
              enomem();

       a=(struct arglist *)malloc(sizeof(struct arglist));

       if (!a)
       {
              free(s);
              enomem();
       }

       a->next=arglist;
       arglist=a;
       a->argbuf=s;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cleanup ( )

Definition at line 1969 of file sqwebmail.c.

{
       sqwebmail_formname = NULL;
       sqwebmail_mailboxid=0;
       sqwebmail_folder=0;
       sqwebmail_sessiontoken=0;
       sqwebmail_content_language=0;
       sqwebmail_content_locale=0;
       sqwebmail_system_charset=0;
       if (sys_locale_charset)
              free(sys_locale_charset);
       sys_locale_charset=0;
       sqwebmail_content_ispelldict=0;
       folder_cleanup();
       maildir_cleanup();
       mailfilter_cleanup();
#ifdef ISPELL
       ispell_cleanup();
#endif

#ifdef GZIP
       if (gzip_save_fd >= 0)      /* Restore original stdout */
       {
              dup2(gzip_save_fd, 1);
              close(gzip_save_fd);
              gzip_save_fd= -1;
       }
#endif

       libmail_gpg_cleanup();
       freeargs();
       sqpcp_close();
}

Here is the call graph for this function:

void error ( const char *  )

Definition at line 23 of file showmsg2html.c.

{
       fprintf(stderr, "%s\n", p);
       exit(1);
}
void error2 ( const char *  ,
int   
)

Definition at line 420 of file sqwebmail.c.

{
       cginocache();
       printf("Content-Type: text/html; charset=us-ascii\n\n"
              "<html><head><title>Internal error</title></head><body>"
              "<h1>Internal error (module %s, line %d) - contact system administrator</h1>"
              "</body></html>\n",
              file, line);
       cleanup();
       fake_exit(1);
}

Here is the call graph for this function:

void error3 ( const char *  ,
int  ,
const char *  ,
const char *  ,
int   
)

Definition at line 432 of file sqwebmail.c.

{
       cginocache();
       if (err == -1) err = errno;
       printf("Content-Type: text/html; charset=us-ascii\n\n"
              "<html><head><title>Internal error</title></head><body>"
              "<h1>Internal error (module %s, line %d) - contact system administrator</h1>"
              "<pre>%s\n%s\n%s</pre>"
              "</body></html>\n",
              file, line, msg1?msg1:"", msg2?msg2:"", err?strerror(err):"");
       cleanup();
       fake_exit(1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void fake_exit ( int  )

Definition at line 29 of file showmsg2html.c.

{
       exit(rc);
}

Here is the call graph for this function:

void freeargs ( )

Definition at line 22 of file args.c.

{
       struct arglist *a;

       while ((a=arglist) != NULL)
       {
              arglist=a->next;
              free(a->argbuf);
              free(a);
       }
}

Here is the caller graph for this function:

char* get_imageurl ( )

Definition at line 457 of file sqwebmail.c.

{
char   *imageurl=getenv("SQWEBMAIL_IMAGEURL");
       
       if (!imageurl || !*imageurl)       imageurl=IMGPATH;

       return imageurl;
}
char* get_templatedir ( )

Definition at line 447 of file sqwebmail.c.

{
char   *templatedir=getenv("SQWEBMAIL_TEMPLATEDIR");
       
       if (!templatedir || !*templatedir) templatedir=HTMLLIBDIR;

       return templatedir;
}

Here is the caller graph for this function:

const char* getarg ( const char *  )

Definition at line 55 of file args.c.

{
       size_t l=strlen(n);
       struct arglist *a;

       for (a=arglist; a; a=a->next)
              if (strncmp(a->argbuf, n, l) == 0 &&
                  a->argbuf[l] == '=')
                     return (a->argbuf+l+1);
       return ("");
}
void http_redirect_argss ( const char *  ,
const char *  ,
const char *   
)

Definition at line 1687 of file sqwebmail.c.

{
       http_redirect_argsss(fmt, arg1, arg2, "");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void http_redirect_argsss ( const char *  ,
const char *  ,
const char *  ,
const char *   
)

Definition at line 1692 of file sqwebmail.c.

{
char *base=scriptptrget();
char *arg1s=cgiurlencode(arg1);
char *arg2s=cgiurlencode(arg2);
char *arg3s=cgiurlencode(arg3);
char *q;

       /* We generate a Location: redirected_url header.  The actual
       ** header is generated in cgiredirect, we just build it here */

       q=malloc(strlen(base)+strlen(fmt)+strlen(arg1s)+strlen(arg2s)+
                     strlen(arg3s)+1);
       if (!q)       enomem();
       strcpy(q, base);
       sprintf(q+strlen(q), fmt, arg1s, arg2s, arg3s);
       cgiredirect(q);
       free(q);
       free(arg1s);
       free(arg2s);
       free(arg3s);
       free(base);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void http_redirect_argu ( const char *  ,
unsigned  long 
)

Definition at line 1679 of file sqwebmail.c.

{
char   buf[MAXLONGSIZE];

       sprintf(buf, "%lu", un);
       http_redirect_argss(fmt, buf, "");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void insert_include ( const char *  )

Definition at line 919 of file sqwebmail.c.

{
       FILE *ff=openinclude(inc_name);
       do_output_form_loop(ff);
       do_close_form();
}

Here is the call graph for this function:

Here is the caller graph for this function:

int strcasecmp ( const char *  ,
const char *   
)

Definition at line 12 of file strcasecmp.c.

{
       while (*a || *b)
       {
       int    ca=toupper(*a);
       int    cb=toupper(*b);

              if (ca < cb)  return (-1);
              if (ca > cb)  return (1);
              ++a;
              ++b;
       }
       return (0);
}

Here is the call graph for this function:

char* strdup ( const char *  )

Definition at line 13 of file strdup.c.

{
char *s;

       if ((s=malloc(strlen(p)+1)) != 0)  strcpy(s, p);
       return (s);
}
int strncasecmp ( const char *  ,
const char *  ,
size_t   
)

Definition at line 13 of file strncasecmp.c.

{
       while (n && (*a || *b))
       {
       int    ca=toupper(*a);
       int    cb=toupper(*b);

              if (ca < cb)  return (-1);
              if (ca > cb)  return (1);
              ++a;
              ++b;
              --n;
       }
       return (0);
}

Here is the call graph for this function:

char* trim_spaces ( const char *  s)

Definition at line 2724 of file sqwebmail.c.

{
       char *p, *q;

       p=strdup(s);
       if (!p)
              enomem();

       if (*p)
       {
              for (q=p+strlen(p)-1; q >= p && isspace(*q); q--)
                     *q=0;

              for (q=p; *q && isspace(*q); q++)
                     ;
              if (p != q)
                     p=q;
       }

       return (p);
}

Here is the call graph for this function:

Here is the caller graph for this function: