Back to index

courier  0.68.2
Classes | Defines | Functions
newmsg.h File Reference
#include "unicode/unicode.h"
#include <stdlib.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wrap_info
struct  show_textarea_info

Defines

#define NEWMSG_SQISPELL   1
#define NEWMSG_PCP   2

Functions

void newmsg_init (const char *, const char *)
void newmsg_do (const char *)
char * newmsg_createdraft_do (const char *, const char *, int)
void wrap_text_init (struct wrap_info *uw, const char *output_chset, void(*output_func)(const char *p, size_t l, void *arg), void *arg)
void wrap_text (struct wrap_info *uw, const char *newmsg, size_t newmsg_size)
void show_textarea_init (struct show_textarea_info *info, int stop_at_sig)
void show_textarea (struct show_textarea_info *info, const char *ptr, size_t cnt)

Define Documentation

#define NEWMSG_PCP   2

Definition at line 25 of file newmsg.h.

#define NEWMSG_SQISPELL   1

Definition at line 24 of file newmsg.h.


Function Documentation

char * newmsg_createdraft_do ( const char *  curdraft,
const char *  newmsg,
int  keepheader 
)

Definition at line 511 of file newmsg_create.c.

{
char   *draftfilename;
FILE   *fp=0;
char   *multipart_boundary;
const char *content_type;
const char *content_transfer_encoding;
const char *charset;
unsigned long prev_size=0;
off_t  transferencodingpos;
off_t  transferencoding2pos;
int is_newevent=strcmp(cgi("form"), "newevent") == 0;
struct rfc2045       *rfcp;
int has_attachments=0;
size_t newmsg_size;
char *sig, *footer;

/*
** Trim extra newlines.
*/
       newmsg_size=strlen(newmsg);

       while (newmsg_size && newmsg[newmsg_size-1] == '\n')
              --newmsg_size;

/* We're on the 'new event' screen */

       if (curdraft) /* Reuse a draft filename */
              newdraftfd=maildir_recreatemsg(INBOX "." DRAFTS, curdraft, &draftfilename);
       else
              newdraftfd=maildir_createmsg(INBOX "." DRAFTS, 0, &draftfilename);
       if (newdraftfd < 0)  enomem();

       pref_wikifmt=0;
       if (strcmp(cgi("textformat"), "wiki") == 0)
              pref_wikifmt=1;
       pref_update();

       fp=NULL;
       if (curdraft)
       {
       int    x=maildir_safeopen(curdraft, O_RDONLY, 0);

              if (x >= 0)
                     if ((fp=fdopen(x, "r")) == 0)
                            close(x);
       }

       if (fp)
       {
       char   *header, *value;
       struct stat   stat_buf;

              if (fstat(fileno(fp), &stat_buf))
              {
                     fclose(fp);
                     enomem();
              }
              prev_size=stat_buf.st_size;

              while ((header=maildir_readheader(fp, &value, 1)) != NULL)
              {
                     if (keepheader == NEWMSG_SQISPELL)
                     {
                            if (strcasecmp(header, "mime-version") == 0 ||
                                strncasecmp(header, "content-", 8) == 0)
                                   continue;
                     }
                     else if (keepheader == NEWMSG_PCP)
                     {
                            if (strcasecmp(header, "mime-version") == 0 ||
                                strncasecmp(header, "content-", 8) == 0 ||
                                strcasecmp(header, "date") == 0 ||
                                strcasecmp(header, "from") == 0 ||
                                strcasecmp(header, "subject") == 0)
                                   continue;
                     }
                     else
                     {
                            if (strcmp(header, "in-reply-to") &&
                                   strcmp(header, "references") &&
                                   strncmp(header, "x-", 2))   continue;
                            /* Do not discard these headers */
                     }

                     if (strcasecmp(header, "x-sqwebmail-wikifmt") == 0)
                            continue;

                     maildir_writemsgstr(newdraftfd, header);
                     maildir_writemsgstr(newdraftfd, ": ");
                     maildir_writemsgstr(newdraftfd, value);
                     maildir_writemsgstr(newdraftfd, "\n");
              }
       }
       else if (is_newevent)
              maildir_writemsgstr(newdraftfd, "X-Event: 1\n");

       if (!keepheader
           || keepheader == NEWMSG_PCP)
       /* Coming back from msg edit, set headers */
       {
       const  char *p=cgi("headerfrom");

              if (!*p)      p=pref_from;
              if (!p || !*p || auth_getoptionenvint("wbnochangingfrom"))
                     p=login_fromhdr();

              create_draftheader("From: ", p, 0, 1);

              if (!pref_from || strcmp(p, pref_from))
                     pref_setfrom(p);

/* sam ????
       create_draftheader("In-Reply-To: ", cgi("headerin-reply-to"));
*/
              if (!is_newevent)
              {
#if 0
                     {
                            FILE *fp;
                            fp=fopen("/tmp/pid", "w");
                            fprintf(fp, "%d", getpid());
                            fclose(fp);
                            sleep(10);
                     }
#endif

                     create_draftheader("To: ", cgi("headerto"),
                                      cgi("addressbook_to"), 1);
                     create_draftheader("Cc: ", cgi("headercc"),
                                      cgi("addressbook_cc"), 1);
                     create_draftheader("Bcc: ", cgi("headerbcc"),
                                      cgi("addressbook_bcc"), 1);
                     create_draftheader("Reply-To: ", cgi("headerreply-to"), 0, 1);
              }
       }

       if (pref_wikifmt)
              create_draftheader("x-sqwebmail-wikifmt: ", "1", 0, 0);

       if (!keepheader || keepheader == NEWMSG_PCP)
       {
       time_t t;

              create_draftheader("Subject: ", cgi("headersubject"), 0, 0);

              time(&t);
              create_draftheader("Date: ", rfc822_mkdate(t), 0, 0);
       }

       /* If the message has attachments, calculate multipart boundary */

       rfcp=NULL;

       if (fp)
       {
              rfcp=rfc2045_fromfp(fp);
              if (!rfcp)
              {
                     close(newdraftfd);
                     fclose(fp);
                     enomem();
              }
       }

       multipart_boundary=newmsg_multipart_boundary(fp, newmsg);

       if (rfcp && rfcp->firstpart &&
           strcmp((rfc2045_mimeinfo(rfcp, &content_type,
                           &content_transfer_encoding, &charset),
                  content_type), "multipart/mixed") == 0)
       {
              has_attachments=1;
              newmsg_create_multipart(newdraftfd,
                     sqwebmail_content_charset, multipart_boundary);

              maildir_writemsgstr(newdraftfd, "--");
              maildir_writemsgstr(newdraftfd, multipart_boundary);
              maildir_writemsgstr(newdraftfd,"\n");
       }
       else
       {
              maildir_writemsgstr(newdraftfd, "Mime-Version: 1.0\n");
       }

       if (pref_wikifmt)
       {
              ++multipart_boundary[strlen(multipart_boundary)-1];

              maildir_writemsgstr(newdraftfd,
                                "Content-Type: multipart/alternative;"
                                " boundary=\"");
              maildir_writemsgstr(newdraftfd, multipart_boundary);
              maildir_writemsgstr(newdraftfd, "\"\n"
                                "\n"
                                "\n"
                                "--");
              maildir_writemsgstr(newdraftfd, multipart_boundary);
              maildir_writemsgstr(newdraftfd, "\n");
       }

       maildir_writemsgstr(newdraftfd,
                         "Content-Type: text/plain; format=flowed; delsp=yes;"
                         " charset=\"");
       maildir_writemsgstr(newdraftfd, sqwebmail_content_charset);
       maildir_writemsgstr(newdraftfd, "\"\n");

       maildir_writemsgstr(newdraftfd, "Content-Transfer-Encoding: ");
       transferencoding2pos=transferencodingpos=writebufpos;
       maildir_writemsgstr(newdraftfd, "7bit\n\n");

       /*     maildir_writemsgstr(newdraftfd, "\n"); */

       sig=pref_getsig();
       footer=pref_getfile(http11_open_langfile(get_templatedir(),
                                           sqwebmail_content_language,
                                           "footer"));

       while (newmsg_size &&
              (newmsg[newmsg_size-1] == '\r' ||
              newmsg[newmsg_size-1] == '\n'))
              --newmsg_size;

       {
              struct wrap_info uw;

              wrap_text_init(&uw, sqwebmail_content_charset,
                            save_textplain, NULL);

              wrap_text(&uw, newmsg, newmsg_size);

              if ((sig && *sig) || (footer && *footer))
              {
                     static const unicode_char sig_line[]={'-', '-', ' '};

                     do_save_u_line(&uw, sig_line, 0, 0);
                     do_save_u_line(&uw, sig_line, 3, 0);
              }

              if (sig && *sig)
                     wrap_text(&uw, sig, strlen(sig));

              if (footer && *footer)
              {
                     do_save_u_line(&uw, NULL, 0, 0);
                     maildir_writemsg(newdraftfd, footer, strlen(footer));
              }

       }

       if (pref_wikifmt)
       {
              struct msg2html_textplain_info *info;

              maildir_writemsgstr(newdraftfd, "\n"
                                "--");
              maildir_writemsgstr(newdraftfd, multipart_boundary);
              maildir_writemsgstr(newdraftfd, "\n"
                                "Content-Type: text/html; charset=\"");
              maildir_writemsgstr(newdraftfd, sqwebmail_content_charset);
              maildir_writemsgstr(newdraftfd, "\"\n"
                                "Content-Transfer-Encoding: ");
              transferencoding2pos=writebufpos;
              maildir_writemsgstr(newdraftfd, "7bit\n\n");

              info=msg2html_textplain_start(sqwebmail_content_charset,
                                         sqwebmail_content_charset,
                                         1,
                                         1,
                                         0,
                                         mkurl, NULL,
                                         NULL,
                                         NULL,
                                         1,
                                         save_textplain,
                                         NULL);

              if (info)
              {
                     struct wrap_info uw;

                     wrap_text_init(&uw, sqwebmail_content_charset,
                                   convert_text2html, info);

                     wrap_text(&uw, newmsg, newmsg_size);
                     msg2html_textplain_end(info);
              }

              if ((sig && *sig) || (footer && *footer))
                     save_textplain("<hr />\n", 7, NULL);

              if (sig && *sig)
              {

                     info=msg2html_textplain_start(sqwebmail_content_charset,
                                                sqwebmail_content_charset,
                                                1,
                                                1,
                                                0,
                                                mkurl, NULL,
                                                NULL,
                                                NULL,
                                                1,
                                                save_textplain,
                                                NULL);

                     if (info)
                     {
                            struct wrap_info uw;

                            wrap_text_init(&uw, sqwebmail_content_charset,
                                          convert_text2html, info);

                            wrap_text(&uw, sig, strlen(sig));
                            msg2html_textplain_end(info);
                     }
              }

              if (footer && *footer)
              {
                     save_textplain("<br />\n", 7, NULL);

                     info=msg2html_textplain_start(sqwebmail_content_charset,
                                                sqwebmail_content_charset,
                                                1,
                                                1,
                                                0,
                                                mkurl, NULL,
                                                NULL,
                                                NULL,
                                                1,
                                                save_textplain,
                                                NULL);

                     if (info)
                     {
                            msg2html_textplain(info, footer,
                                             strlen(footer));
                            msg2html_textplain_end(info);
                     }
              }

              maildir_writemsgstr(newdraftfd, "\n"
                                "--");
              maildir_writemsgstr(newdraftfd, multipart_boundary);
              maildir_writemsgstr(newdraftfd, "--\n");
              --multipart_boundary[strlen(multipart_boundary)-1];

       }

       if (sig)
              free(sig);

       if (footer)
              free(footer);

       if ( multipart_boundary && rfcp && has_attachments)
       {
              newmsg_copy_attachments(rfcp, fp, multipart_boundary);
              maildir_writemsgstr(newdraftfd, "\n--");
              maildir_writemsgstr(newdraftfd, multipart_boundary);
              maildir_writemsgstr(newdraftfd, "--\n");
              free(multipart_boundary);
       }
       if (fp)       fclose(fp);
       if (rfcp)
              rfc2045_free(rfcp);

       if ( maildir_writemsg_flush(newdraftfd) == 0 && writebuf8bit)
       {
              if (lseek(newdraftfd, transferencodingpos, SEEK_SET) < 0 ||
                     write(newdraftfd, "8", 1) != 1 ||
                  lseek(newdraftfd, transferencoding2pos, SEEK_SET) < 0 ||
                     write(newdraftfd, "8", 1) != 1)
              {
                     close(newdraftfd);
                     enomem();
              }
       }

       if ( maildir_closemsg(newdraftfd, INBOX "." DRAFTS, draftfilename, -1, prev_size))
              cgi_put("error", "quota");

       return(draftfilename);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void newmsg_do ( const char *  )

Definition at line 1147 of file newmsg.c.

{
const  char *draftmessage=cgi("draftmessage");

       if (*draftmessage)   /* It's ok if it's blank */
       {
              CHECKFILENAME(draftmessage);
       }

       if (*cgi("savedraft"))
       {
       char   *newdraft=newmsg_createdraft(draftmessage);

              if (!newdraft)       enomem();
              free(newdraft);
              sendmsg_done();
              return;
       }

       if (*cgi("sendmsg") && dosendmsg(draftmessage))
              return;

       if (*cgi("doattachments"))
       {
       char   *newdraft=newmsg_createdraft(draftmessage);
       char   *base;

              if (!newdraft)       enomem();
              if (*cgi("error"))
              {
                     cgi_put("previewmsg", "1");
                     output_form("newmsg.html");
                     return;
              }

              base=maildir_basename(newdraft);
              http_redirect_argss("&form=attachments&pos=%s&draft=%s",
                     cgi("pos"), base);
              free(base);
              free(newdraft);
              return;
       }
#ifdef ISPELL
       if (*cgi("startspellchk"))
       {
       char   *newdraft=newmsg_createdraft(draftmessage);
       char   *base;

              if (!newdraft)       enomem();
              base=maildir_basename(newdraft);
              free(newdraft);
              if (spell_start(base) == 0)
              {
                     cgi_put("draftmessage", base);
                     output_form("spellchk.html");
              }
              else
              {
                     http_redirect_argss("&form=newmsg&pos=%s&draft=%s&previewmsg=SPELLCHK",
                            cgi("pos"), base);
              }
              free(base);
              return;
       }
#endif
       if (*ispreviewmsg())
       {
              output_form("newmsg.html");
              return;
       }
       http_redirect_argsss("&form=newmsg&pos=%s&draftmessage=%s&error=%s",
              cgi("pos"), draftmessage,
              cgi("error"));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void newmsg_init ( const char *  ,
const char *   
)

Definition at line 524 of file newmsg.c.

{
       const char    *tolab=getarg("TOLAB");
       const char    *cclab=getarg("CCLAB");
       const char    *bcclab=getarg("BCCLAB");
       const char    *subjectlab=getarg("SUBJECTLAB");
       const char    *messagelab=getarg("MESSAGELAB");
       const char    *sendlab=getarg("SENDLAB");
       const char    *previewlab=getarg("PREVIEWLAB");
       const char    *forwardsep=getarg("FORWARDLAB");
       const char    *savedraft=getarg("SAVEDRAFT");
       const char    *attachmentslab=getarg("ATTACHMENTS");
       const char      *uploadlab=getarg("UPLOAD");
       const char    *replysalutation=getarg("SALUTATION");
       const char    *checkspellingdone=getarg("SPELLCHECKDONE");
       const char    *checkspelling=getarg("CHECKSPELLING");
       const char    *quotaerr=getarg("QUOTAERR");
       const char    *fromlab=getarg("FROMLAB");
       const char    *replytolab=getarg("REPLYTOLAB");
       const char    *addressbooklab=getarg("ADDRESSBOOK");
       const char    *select1=getarg("SELECT1");
       const char    *select2=getarg("SELECT2");
       const char    *text1=getarg("TEXT1");
       const char    *text2=getarg("TEXT2");
       char   *draftmessage;
       char   *draftmessagefilename;
       const  char *p;
       FILE   *fp;
       int    attachcnt=0;
       char   *cursubj, *curto, *curcc, *curbcc, *curfrom, *curreplyto;
       int wbnochangingfrom;

       /* Picking up an existing draft? */

       p=cgi("draft");
       if (*p)
       {
              CHECKFILENAME(p);
       }

       if (*p)
       {
              draftmessage=strdup(p);
              if (!draftmessage)   enomem();
              p="";
       }
       else
       {
              draftmessage=newmsg_newdraft(folder, pos,
                     forwardsep, replysalutation);

              if (!draftmessage)
              {
                     if (*ispreviewmsg())
                     {
                            p=cgi("draftmessage");
                            if (*p)
                            {
                                   CHECKFILENAME(p);
                            }
                            draftmessage=newmsg_createdraft(p);
                     }
              }
       }

       draftmessagefilename= draftmessage ?
                             maildir_find(INBOX "." DRAFTS, draftmessage):0;

       if (*(p=cgi("previewmsg")))
       {
#ifdef ISPELL
              if (strcmp(p, "SPELLCHK") == 0)
                     printf("%s<br /><br />\n", checkspellingdone);
#endif
              printf("<table width=\"100%%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" class=\"box-small-outer\"><tr><td>\n");
              printf("<table width=\"100%%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" class=\"preview\"><tr><td>\n");

              if (draftmessagefilename)
              {
                     const char *p=strrchr(draftmessagefilename, '/');

                     if (p)
                            ++p;
                     else
                            p=draftmessagefilename;

                     newmsg_preview(p);
              }
              printf("</td></tr></table>\n");
              printf("</td></tr></table>\n");

              printf("<table width=\"100%%\" border=\"0\" cellspacing=\"0\" cellpadding=\"6\"><tr><td><hr width=\"80%%\" /></td></tr></table>\n");
       }

       printf("<input type=\"hidden\" name=\"form\" value=\"donewmsg\" />\n");
       newmsg_hiddenheader("pos", pos);
       newmsg_hiddenheader("focusto",
                         *cgi("newmsg") ? "headers":"text");

       /* Generate unique message token, to detect duplicate SUBMITs */

       tokennew();

       /* Display any error message */

       if (*cgi("foldermsg"))
       {
              printf("<p><span class=\"error\" style=\"color: #ff0000\">");
              output_attrencoded_nltobr(cgi("foldermsg"));
              printf("</span></p>");
       }

       if (strcmp(cgi("error"), "quota") == 0)
              printf("%s", quotaerr);

       /* Read message from the draft file */

       cursubj=0;
       curto=0;
       curfrom=0;
       curreplyto=0;
       curcc=0;
       curbcc=0;
       fp=0;

       if (draftmessagefilename)
       {
       int    x=maildir_safeopen(draftmessagefilename, O_RDONLY, 0);

              if (x >= 0)
                     if ((fp=fdopen(x, "r")) == 0)
                            close(x);
       }

       if (fp != 0)
       {
       char *header, *value;

              while ((header=maildir_readheader(fp, &value, 0)) != 0)
              {
              char   **rfchp=0;

                     if (strcmp(header, "subject") == 0)
                     {
                            if (!cursubj && !(cursubj=strdup(value)))
                                   enomem();
                            continue;
                     }

                     while (*value && isspace(*value))
                            ++value;

                     if (strcmp(header, "from") == 0)
                            rfchp= &curfrom;
                     if (strcmp(header, "reply-to") == 0)
                            rfchp= &curreplyto;
                     if (strcmp(header, "to") == 0)
                            rfchp= &curto;
                     if (strcmp(header, "cc") == 0)
                            rfchp= &curcc;
                     if (strcmp(header, "bcc") == 0)
                            rfchp= &curbcc;
                     if (rfchp)
                     {
                     char   *newh=malloc ( (*rfchp ? strlen(*rfchp)+2:1)
                                   +strlen(value));

                            if (!newh)    enomem();
                            strcpy(newh, value);
                            if (*rfchp)
                                   strcat(strcat(newh, ","), *rfchp);
                            if (*rfchp)   free( *rfchp );
                            *rfchp=newh;
                     }
              }
       }

       printf("<table width=\"100%%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\" class=\"box-small-outer\"><tr><td>\n");
       printf("<table width=\"100%%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" class=\"new-message-box\"><tr><td>\n");

       printf("<table border=\"0\" width=\"100%%\">\n");
       wbnochangingfrom=auth_getoptionenvint("wbnochangingfrom");
       if (wbnochangingfrom < 2)
              newmsg_header_rfc822(fromlab, "headerfrom", curfrom,
                     *cgi("from") ? cgi("from"):
                     pref_from && *pref_from ? pref_from:
                     login_fromhdr(), wbnochangingfrom ? 1:0);

       printf("<tr valign=\"middle\"><th align=\"right\">"
              "<p class=\"new-message-header\">"
              "<span class=\"new-message-header-addressbook\">"
              "%s</span></p></th><td width=\"6\">&nbsp;</td>",
              addressbooklab);

       printf("<td valign=\"middle\">");
       printf("<table border=\"0\" cellpadding=\"0\" cellspacing=\"4\">");
       printf("<tr valign=\"middle\"><td>%s\n", select1);
       ab_listselect();
       printf("%s</td><td width=\"100%%\">", select2);
       printf("<input type=\"submit\" name=\"addressbook_to\" value=\"%s\" />",
                     tolab);
       printf("<input type=\"submit\" name=\"addressbook_cc\" value=\"%s\" />",
                     cclab);
       printf("<input type=\"submit\" name=\"addressbook_bcc\" value=\"%s\" />",
                     bcclab);
       printf("</td></tr></table>");

       printf("</td></tr>\n");

#if 0
                     {
                            FILE *fp;
                            fp=fopen("/tmp/pid", "w");
                            fprintf(fp, "%d", getpid());
                            fclose(fp);
                            sleep(10);
                     }
#endif

       newmsg_header_rfc822(tolab, "headerto", curto, cgi("to"), 0);
       newmsg_header_rfc822(cclab, "headercc", curcc, cgi("cc"), 0);
       newmsg_header_rfc822(bcclab, "headerbcc", curbcc, cgi("bcc"), 0);
       newmsg_header_rfc822(replytolab, "headerreply-to",
                          curreplyto, cgi("replyto"), 0);
       newmsg_header(subjectlab, "headersubject",
                    cursubj, cgi("subject"));

       if (curto)    free(curto);
       if (curfrom)  free(curfrom);
       if (curreplyto)      free(curreplyto);
       if (curcc)    free(curcc);
       if (curbcc)   free(curbcc);
       if (cursubj)  free(cursubj);

       printf("<tr><td colspan=\"3\"><hr width=\"100%%\" /></td></tr>");
       printf("<tr>"

              "<th valign=\"top\" align=\"right\">"
              "<p class=\"new-message-header\">"
              "<span class=\"new-message-header-message\">"
              "%s</span></p></th><td width=\"6\">&nbsp;</td>"
              "<td><select name=\"textformat\">"
              "<option value=\"plain\" %s>%s</option>"
              "<option value=\"wiki\" %s>%s</option></select>"

              "<small>(<a href='%s/wikifmt.html' target='_blank'>%s</a>)</small>"
              "</td></tr>"
              "<tr><th valign=\"top\" align=\"right\">"
              "<p class=\"new-message-header\">"
              "<span class=\"new-message-header-message\">"
              "%s</span></p></th><td width=\"6\">&nbsp;</td>",

              getarg("FMTNAME"),
              pref_wikifmt ? "":"selected='selected'", getarg("FMTTEXTPLAIN"),
              pref_wikifmt ? "selected='selected'":"", getarg("FMTTEXTWIKI"),

              get_imageurl(), getarg("FMTHELP"),
              messagelab);

       printf("<td>%s\n", text1);

       if (fp)
       {
              newmsg_showfp(fp, &attachcnt);
       }
       else
       {
              printf("%s", cgi("body"));
       }
       printf("%s\n", text2);

       if (draftmessage && *draftmessage)
       {
              printf("<input type=\"hidden\" name=\"draftmessage\" value=\"");
              output_attrencoded(draftmessage);

              printf("\" />");
       }
       if (draftmessage)    free(draftmessage);
       printf("</td></tr>\n");

       printf("<tr><th valign=\"top\" align=\"right\">"
              "<p class=\"new-message-header\">"
              "<span class=\"new-message-header-message\">"
              "%s</span></p></th><td>&nbsp;</td>"
              "<td>%d&nbsp;&nbsp;<input type=\"submit\" name=\"doattachments\" value=\"%s\" /></td></tr>",
              attachmentslab, attachcnt, uploadlab);

       printf("<tr><td colspan=\"2\" align=\"right\"><input type=\"checkbox\" "
              "name=\"fcc\" id=\"fcc\"%s /></td><td><label for=\"fcc\">%s</label></td></tr>\n",
              pref_noarchive ? "":" checked=\"checked\"",
              getarg("PRESERVELAB"));

       if (auth_getoptionenvint("wbnodsn") == 0)
              printf("<tr><td colspan=\"2\" align=\"right\"><input type=\"checkbox\" "
                     "name=\"dsn\" id=\"dsn\" /></td><td><label for=\"dsn\">%s</label></td></tr>\n",
                     getarg("DSN"));

       if (libmail_gpg_has_gpg(GPGDIR) == 0)
       {
              char *all_addr;

              printf("<tr><td colspan=\"2\" align=\"right\"><input type=\"checkbox\" "
                     "name=\"sign\" id=\"sign\" /></td><td><label for=\"sign\">%s</label><select name=\"signkey\">",
                     getarg("SIGNLAB"));
              gpgselectkey();
              printf("</select></td></tr>\n");

              all_addr=newmsg_alladdrs(fp);

              printf("<tr valign=\"middle\"><td colspan=\"2\" align=\"right\">"
                     "<input type=\"checkbox\" name=\"encrypt\" id=\"encrypt\" /></td>"
                     "<td><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr valign=\"middle\"><td><label for=\"encrypt\">%s</label></td><td><select size=\"4\" multiple=\"multiple\" name=\"encryptkey\">",
                     getarg("ENCRYPTLAB"));
              gpgencryptkeys(all_addr);
              printf("</select></td></tr>\n");
              printf("</table></td></tr>\n");

              if (ishttps())
                     printf("<tr><td colspan=\"2\" align=\"left\">&nbsp;</td><td>%s<input type=\"password\" name=\"passphrase\" /></td></tr>\n",
                            getarg("PASSPHRASE"));

              if (all_addr)
                     free(all_addr);
       }

       if (fp)
              fclose(fp);
       if (draftmessagefilename)
              free(draftmessagefilename);

       printf("<tr><td colspan=\"2\">&nbsp;</td><td>");
       printf("<input type=\"submit\" name=\"previewmsg\" value=\"%s\" />",
              previewlab);
       printf("<input type=\"submit\" name=\"sendmsg\" value=\"%s\" />",
              sendlab);
       printf("<input type=\"submit\" name=\"savedraft\" value=\"%s\" />",
              savedraft);
#ifdef ISPELL
       printf("<input type=\"submit\" name=\"startspellchk\" value=\"%s\" />",
              checkspelling);
#endif
       printf("</td></tr>\n");
       printf("</table>\n");

       printf("</td></tr></table>\n");
       printf("</td></tr></table>\n");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void show_textarea ( struct show_textarea_info info,
const char *  ptr,
size_t  cnt 
)

Definition at line 213 of file newmsg.c.

{
       while (cnt)
       {
              size_t n= (*info->handler)(info, ptr, cnt);

              cnt -= n;
              ptr += n;
       }
}

Here is the caller graph for this function:

void show_textarea_init ( struct show_textarea_info info,
int  stop_at_sig 
)

Definition at line 206 of file newmsg.c.

{
       info->handler=show_textarea_start_of_line;
       info->stop_at_sig=stop_at_sig;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wrap_text ( struct wrap_info uw,
const char *  newmsg,
size_t  newmsg_size 
)

Definition at line 430 of file newmsg_create.c.

{
       size_t i=0, j;

       while (i < newmsg_size)
       {
              unicode_char *uc;
              size_t ucsize;
              libmail_u_convert_handle_t h;

              j=i;

              while (i<newmsg_size && newmsg[i] != '\n')
                     ++i;

              h=libmail_u_convert_tou_init(sqwebmail_content_charset,
                                        &uc, &ucsize, 0);

              if (h)
              {
                     libmail_u_convert(h, newmsg+j, i-j);

                     if (libmail_u_convert_deinit(h, NULL))
                            uc=NULL;
              }
              else
              {
                     uc=NULL;
              }

              if (uc)
              {
                     size_t i, j;

                     /* Get rid of any CRs that sneak in */

                     for (i=j=0; i<ucsize; ++i)
                     {
                            if (uc[i] == '\r')
                                   continue;

                            uc[j]=uc[i];
                            ++j;
                     }

                     if (j && *uc == '>')
                            do_save_u_line(uw, uc, j, 0);
                     else
                            do_wrap_u_line(uw, uc, j);

                     free(uc);
              }

              if (i < newmsg_size)
                     ++i;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void wrap_text_init ( struct wrap_info uw,
const char *  output_chset,
void(*)(const char *p, size_t l, void *arg)  output_func,
void *  arg 
)

Definition at line 290 of file newmsg_create.c.

{
       memset(uw, 0, sizeof(*uw));
       uw->output_func=output_func;
       uw->output_chset=output_chset;
       uw->arg=arg;
}

Here is the caller graph for this function: