/*****************************************************************************/ /* options.c Load and administer user options. [accessability-1]** heavy underscore below each message detail on the folder message listing page (1 enables) [charset-default] if not otherwise specified use this e.g. UTF-8 (default), ISO-8859-1, Windows-1252 [check-new-mail] check for new mail every this many minutes [compose-charsets] comma-separated list of character sets provided on the message composition page [compose-edit-cols] per-user overrides for default [compose-edit-rows] and/or soyMAIL configuration [compose-wrap-at] directives [compose-HTML] default to an HTML editor (if available) [draft-items] folder for draft items [folder-buttons] 0 = off, 1 column, 2 columns, etc. [font-family] Arial, Helvetica, sans-serif [font-size] 10 (in points) [language] en, es, de, etc. [massage-read] wrap long lines and collapse extra line breaks [message-attachment-panel]** 0 below (default), 1 above message body [message-order] message listing order; 1 is ascending (more recent at top) -1 is descending (older at top) [message-read-preference] plain text and/or HTML and their order [message-read-history] OBSOLETE as of v1.3.4 [messages-per-page] this many messages listed on a folder page [options-panel-expand]** expand option panels to window width (Wm(B)K special :-) [personal-name] Mark Daniel (or as appropriate :-) [PMDF-IMAP] PMDF_IMAP.MAILBOX read compatibility [preview-after] milliseconds before preview window is opened [preview-size] number of characters in preview [quote-forward] character(s) to use in quoting line in forwards [quote-reply] character(s) to use in quoting line in replies [sent-items] folder name for sent items [sig-file] 0 = default (VMS), 1 = soymail, 999 = none or the name of the user signature [SMTP-from] prefered "From:" email address [theme] the CSS file selected [use-only-MAIL] do not show mail files other than MAIL.MAI [VMS-newmsg]** see configuration directive of same name [you-got-mail] name of 'you've got mail' audio [you-got-mail-at] email address to forward note FOOTNOTES** ----------- These items are not accessable via the user options page (to save clutter with non-general functionality). The directive must be manually edited into the user's SOYMAIL_OPTIONS.TXT. Once entered they will be propagated with each save. To disable they (of course) must be manually deleted. COPYRIGHT --------- Copyright (C) 2005-2022 Mark G.Daniel This program, comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the conditions of the GNU GENERAL PUBLIC LICENSE, version 2. VERSION HISTORY --------------- 27-DEC-2017 MGD [charset-default] 18-APR-2014 MGD remove "Requires JavaScript" advice (it now all does) 16-FEB-2010 MGD [preview-after], [preview-size] 14-FEB-2010 MGD [you-got-mail-at] 13-NOV-2008 MGD [VMS-newmsg] 27-JUL-2008 MGD modify options page layout 20-JUL-2008 MGD [compose-charsets] 07-JUL-2008 MGD [compose-edit-cols] per-user overrides for default [compose-edit-rows] and/or soyMAIL configuration [compose-wrap-at] directives [PMDF-IMAP] enables PMDF IMAP read compatibility 02-JUL-2008 MGD [smtp-from] can be specified as an exclamation mark which allows config *user options override* to disable 14-JUN-2008 MGD [massage-read] becomes numeric (was boolean) 31-MAY-2008 MGD optional beep! for YouGotMail 03-NOV-2007 MGD support multiple signature files 30-SEP-2007 MGD any options specified using [user-options-override] disables the corresponding option in the user setup page remove [message-read-history] 12-APR-2007 MGD OptionsMunge() ensure draft and waste items folder names cannot be set to MAIL or NEWMAIL 03-FEB-2007 MGD [draft-items] and [sent-items] 27-JAN-2007 MGD [message-attachment-panel] 30-DEC-2006 MGD implement message-order in options menu [quote-forward] for quoting forwarded messages rename [quote-char] to [quote-reply] 20-JUL-2006 MGD note monospace font usage 19-JUL-2006 MGD [message-order] to control message listing order [quote-char] character(s) inside quotes to allow spaces 21-JUN-2006 MGD [sig-file] option to control signature file usage 12-JUN-2006 MGD remove [check-new-mail-nonajax] and [check-new-mail-MSIE] user options and associated processing kludges 26-APR-2006 MGD [accessability-1] manually edit to 1 to enable 02-APR-2006 MGD bugfix; OptionsSoyMail() propagation of personal you-got-mail when when changing language option 25-MAR-2006 MGD [wrap-text-at] transmogrified to [massage-read] 08-MAR-2006 MGD bugfix; propagate and reload selected language 25-FEB-2006 MGD OptionsMunge() make default OPTIONS_READ_PLAIN1_HTML2 bugfix; OptionsVmsSave() VMS option copy-send 16-FEB-2006 MGD better handle MAIL$_NOSUCHUSER from CallMailGetUserProfile() 07-FEB-2006 MGD modified [reply-to] option to [smtp-from] and in conjunction with [personal-name] have ComposePageRequest() generate a "From:" header more in line with TCPIP$SMTP_FROM behaviour [folder-buttons] to allow configuration of folder buttons 01-FEB-2005 MGD initial */ /*****************************************************************************/ #ifdef SOYMAIL_VMS_V7 #undef _VMS_V6_SOURCE #define _VMS_V6_SOURCE #undef __VMS_VER #define __VMS_VER 70000000 #undef __CRTL_VER #define __CRTL_VER 70000000 #endif #pragma nomember_alignment /* standard C header files */ #include #include #include #include #include #include #include #include #include #include /* VMS related header files */ #include #include #include /* application header file */ #include "soymail.h" #include "config.h" #include "gmt.h" #include "newmail.h" #include "request.h" #include "other.h" #define FI_LI __FILE__, __LINE__ #define MAIL$_NOSUCHUSER 8290346 /* can't get the include dependencies settled (this'll do in the interim) */ int ComposeWrapAt (int, USER_OPTIONS*); /******************/ /* global storage */ /******************/ char *OptionsFontFamily [] = { "Arial, Helvetica, sans-serif", "Verdana, Arial, Helvetica, sans-serif", "\"Courier New\", Courier, monospace", "\"Times New Roman\", Times, serif", "\"Comic Sans MS\", cursive", NULL, }; /********************/ /* external storage */ /********************/ extern BOOL Debug, WatchEnabled; extern int SoyMailVolumeStruct, VmsVersion; extern char CallMailNoSuchUser[], CurrentVmsTimeString[], SoftwareId[], SoftwareVn[]; extern CONFIG_DATA SoyMailConfig; extern VMS_MAIL_USER VmsMailUser; /*****************************************************************************/ /* */ BOOL OptionsPageRequest (REQUEST_DATA *rdptr) { char *cptr; VMS_MAIL_USER *muptr; USER_OPTIONS *uoptr; /*********/ /* begin */ /*********/ if (Debug) fprintf (stdout, "OptionsPageRequest()\n"); /* a bit of sanity checking */ if (!rdptr->PrivateAccess) ErrorExit (SS$_BUGCHECK, FI_LI); muptr = &VmsMailUser; uoptr = &rdptr->UserOptions; CGIVARNULL (cptr, "FORM_OPTION_BTN"); if (cptr) { if (rdptr->PrevPageIdent != PAGE_OPTIONS) ErrorExit (SS$_BUGCHECK, FI_LI); if (LangSame ("option_soy_save", cptr)) OptionsSoyApplySave (rdptr, TRUE); else if (LangSame ("option_soy_apply", cptr)) OptionsSoyApplySave (rdptr, FALSE); else if (LangSame ("option_soy_restore", cptr)) OptionsLoadSoy (rdptr); else if (LangSame ("option_vms_save", cptr)) OptionsVmsSave (rdptr); else if (LangSame ("option_sigfile_save", cptr)) OptionsSigFileSave (rdptr); else if (LangSame ("listen", cptr)) StatusMessage (FI_LI, 1, "%s", LangFor("listen_not_supported")); else ErrorExit (SS$_BUGCHECK, FI_LI); } OptionsPage (rdptr); return (TRUE); } /*****************************************************************************/ /* */ void OptionsPage (REQUEST_DATA *rdptr) { int status; REQUEST_DATA *sdptr; USER_OPTIONS *uoptr; VMS_MAIL_USER *muptr; /*********/ /* begin */ /*********/ if (Debug) fprintf (stdout, "OptionsPage()\n"); muptr = &VmsMailUser; uoptr = &rdptr->UserOptions; if (uoptr->CharSetDefault[0]) CgiLibResponseSetCharset (uoptr->CharSetDefault); else if (SoyMailConfig.CharSetDefault && SoyMailConfig.CharSetDefault[0]) CgiLibResponseSetCharset (SoyMailConfig.CharSetDefault); else CgiLibResponseSetCharset (CHARSET_DEFAULT); StatusMessage (FI_LI, 0, "%s %s", LangFor("options"), LangFor("page_opened")); OptionsSigFileLoad (rdptr, NULL); MainMenuPageBegin (rdptr, PAGE_OPTIONS); MainMenuBar (rdptr); StatusInfoPanel (rdptr); if (rdptr->UserAgent == SOY_USER_AGENT_MSIE) fprintf (stdout, "\n", rdptr->FormAction); else fprintf (stdout, "\n", rdptr->FormAction); fprintf (stdout, "

\ \n\ \n\
\n\n"); OptionsSoyMail (rdptr); if (!SoyMailConfig.VmsOccluded) OptionsVms (rdptr); fprintf (stdout, "
\n"); MainMenuPageEnd (rdptr); } /*****************************************************************************/ /* */ void OptionsSoyMail (REQUEST_DATA *rdptr) { BOOL GotYouGot, OneSelected; int idx, value, FileCount, YouGotMailFileCount; char *cptr, *sptr, *selptr, *zptr; REQUEST_DATA *sdptr; USER_OPTIONS *uoptr; VMS_MAIL_USER *muptr; /*********/ /* begin */ /*********/ if (Debug) fprintf (stdout, "OptionsSoyMail()\n"); muptr = &VmsMailUser; uoptr = &rdptr->UserOptions; /****************/ /* you got mail */ /****************/ if (FileSpecSearch (FALSE, muptr->VmsMailFullDirectory, SOY_YOUGOTMAIL)) GotYouGot = TRUE; else GotYouGot = FALSE; if (uoptr->OptionsPanelExpand) fprintf (stdout, "\n"); /***********/ /* general */ /***********/ fprintf (stdout, "\n\ \n\ \n\ ", LangFor("option_soy_general_options")); OptionsSoyName ("theme", LangFor("option_soy_theme")); fprintf (stdout, "\n\n", stdout); OptionsSoyName ("language", LangFor("option_soy_lang")); fprintf (stdout, "\n\n", stdout); OptionsSoyName ("check-new-mail",LangFor("option_soy_check_new")); fprintf (stdout, "\n\ \n\ \n", OptionsUserOverride("check-new-mail") ? " disabled" : "", uoptr->CheckNewMailMins == 0 ? " selected" : "", LangFor("(none)"), uoptr->CheckNewMailMins == 1 ? " selected" : "", LangFor("minutes"), uoptr->CheckNewMailMins == 2 ? " selected" : "", LangFor("minutes"), uoptr->CheckNewMailMins == 5 ? " selected" : "", LangFor("minutes"), uoptr->CheckNewMailMins == 10 ? " selected" : "", LangFor("minutes"), uoptr->CheckNewMailMins == 15 ? " selected" : "", LangFor("minutes"), uoptr->CheckNewMailMins == 30 ? " selected" : "", LangFor("minutes"), uoptr->CheckNewMailMins == 60 ? " selected" : "", LangFor("minutes"), uoptr->CheckNewMailAjax); OptionsSoyName ("font-size", LangFor("option_soy_font_size")); fprintf (stdout, "\n\ \n", OptionsUserOverride("font-size") ? " disabled" : "", uoptr->FontSize == 8 ? " selected" : "", uoptr->FontSize == 9 ? " selected" : "", uoptr->FontSize == 10 ? " selected" : "", uoptr->FontSize == 11 ? " selected" : "", uoptr->FontSize == 12 ? " selected" : "", uoptr->FontSize == 14 ? " selected" : "", uoptr->FontSize == 16 ? " selected" : ""); fputs ("", stdout); OptionsSoyName ("you-got-mail", LangFor("option_soy_you_got_mail")); fprintf (stdout, "\n\ \n\ \n", LangFor ("listen")); OptionsSoyName ("font-family", LangFor("option_soy_font_family")); fprintf (stdout, "\n", stdout); fprintf (stdout, "", GotYouGot ? " onclick=\"document.soymail_form.\ option_soy_select_yougotmail.selectedIndex = 1;\"" : "", OptionsUserOverride("you-got-mail") ? " disabled" : "", LangFor("select_file")); fprintf (stdout, "\n\ ", uoptr->FontFamily); OptionsSoyName ("you-got-mail@", LangFor("option_soy_you_got_mail_at")); fprintf (stdout, "\ \n\n", HTML_ESCAPE(uoptr->YouGotMailAt), OptionsUserOverride("you-got-mail-at") ? " disabled" : ""); OptionsSoyName ("charset-default", LangFor("option_soy_charset_default")); fprintf (stdout, "\ \n", HTML_ESCAPE(uoptr->CharSetDefault), OptionsUserOverride("charset-default") ? " disabled" : ""); OptionsSaveApplyRestore (uoptr->OptionsApplied); /**********************/ /* message management */ /**********************/ fprintf (stdout, "
%s
  
  
  
\ \
\ \n\ %s\
\
  \ \
  
\n\n\

\n\ \ \n\ ", LangFor("option_soy_message_management")); if (uoptr->PmdfImap) OptionsSoyName (NULL, LangFor("option_soy_use_only_MAIL")); else OptionsSoyName ("use-only-MAIL", LangFor("option_soy_use_only_MAIL")); fprintf (stdout, "\ \n", (OptionsUserOverride("use-only-MAIL") || uoptr->PmdfImap) ? " disabled" : "", uoptr->AllMailFiles ? "" : " checked"); OptionsSoyName ("message-read-preference", LangFor("option_soy_read_preference")); fprintf (stdout, "\n\ \n\ ", OptionsUserOverride("message-read-preference") ? " disabled" : "", OPTIONS_READ_PLAIN1_HTML0, uoptr->ReadPreference == OPTIONS_READ_PLAIN1_HTML0 ? " selected" : "", LangFor("option_soy_read_plain1_html0"), OPTIONS_READ_PLAIN1_HTML2, uoptr->ReadPreference == OPTIONS_READ_PLAIN1_HTML2 ? " selected" : "", LangFor("option_soy_read_plain1_html2"), OPTIONS_READ_PLAIN2_HTML1, uoptr->ReadPreference == OPTIONS_READ_PLAIN2_HTML1 ? " selected" : "", LangFor("option_soy_read_plain2_html1")); OptionsSoyName ("PMDF-IMAP", "PMDF IMAP"); fprintf (stdout, "\ \n", OptionsUserOverride("PMDF-IMAP") ? " disabled" : "", uoptr->PmdfImap ? " checked" : ""); OptionsSoyName ("massage-read", LangFor("option_soy_massage")); fprintf (stdout, "\n\n", stdout); OptionsSoyName ("message-order", LangFor("option_soy_message_order")); fprintf (stdout, "\n\ \n\n", OptionsUserOverride("message-order") ? " disabled" : "", uoptr->MessageOrder == 1 ? " selected" : "", LangFor("option_soy_message_order_more"), uoptr->MessageOrder == -1 ? " selected" : "", LangFor("option_soy_message_order_less")); OptionsSoyName ("draft-items", LangFor("option_soy_draft_items")); fprintf (stdout, "\ \n\ ", HTML_ESCAPE(uoptr->FolderDraftItems), OptionsUserOverride("draft-items") ? " disabled" : ""); OptionsSoyName ("messages-per-page", LangFor("option_soy_per_page")); fprintf (stdout, "\n\ \n", OptionsUserOverride("messages-per-page") ? " disabled" : "", uoptr->MessagesPerPage == 5 ? " selected" : "", uoptr->MessagesPerPage == 10 ? " selected" : "", uoptr->MessagesPerPage == 15 ? " selected" : "", uoptr->MessagesPerPage == 20 ? " selected" : "", uoptr->MessagesPerPage == 25 ? " selected" : "", uoptr->MessagesPerPage == 30 ? " selected" : "", uoptr->MessagesPerPage == 40 ? " selected" : "", uoptr->MessagesPerPage == 50 ? " selected" : "", uoptr->MessagesPerPage == 75 ? " selected" : "", uoptr->MessagesPerPage == 100 ? " selected" : ""); OptionsSoyName ("sent-items", LangFor("option_soy_sent_items")); fprintf (stdout, "\ \n\ ", HTML_ESCAPE(uoptr->FolderSentItems), OptionsUserOverride("sent-items") ? " disabled" : ""); OptionsSoyName ("folder-buttons", LangFor("option_soy_folder_buttons")); fprintf (stdout, "\n\ \n", OptionsUserOverride("folder-buttons") ? " disabled" : "", !uoptr->FolderButtons ? " selected" : "", LangFor("(none)"), uoptr->FolderButtons == 1 ? " selected" : "", uoptr->FolderButtons == 2 ? " selected" : "", uoptr->FolderButtons == 3 ? " selected" : ""); OptionsSoyName ("waste-items", LangFor("option_soy_waste_items")); fprintf (stdout, "\ \n", HTML_ESCAPE(uoptr->FolderWasteItems), OptionsUserOverride("waste-items") ? " disabled" : ""); OptionsSoyName ("preview-after", LangFor("option_soy_preview_after")); fprintf (stdout, " %s\n\ \n", OptionsUserOverride("preview-after") ? " disabled" : "", !uoptr->PreviewAfter ? " selected" : "", LangFor("(none)"), uoptr->PreviewAfter == 800 ? " selected" : "", uoptr->PreviewAfter == 1000 ? " selected" : "", uoptr->PreviewAfter == 1200 ? " selected" : "", uoptr->PreviewAfter == 1400 ? " selected" : "", uoptr->PreviewAfter == 1600 ? " selected" : "", uoptr->PreviewAfter == 1800 ? " selected" : "", uoptr->PreviewAfter == 2000 ? " selected" : "", uoptr->PreviewAfter == 3000 ? " selected" : "", uoptr->PreviewAfter == 5000 ? " selected" : "", LangFor("seconds")); if (uoptr->VmsNewMsg > 0) { /* merely show that this option is enabled */ OptionsSoyName ("VMS-newmsg", "VMS newmsg"); fprintf (stdout, "\ \n", " disabled" , " checked"); } fputs ("\n", stdout); OptionsSaveApplyRestore (uoptr->OptionsApplied); /***********************/ /* message composition */ /***********************/ fprintf (stdout, "
%s
  
  
  
  
  
  
\n\n\

\n\ \n\ ", LangFor("option_soy_message_composition")); OptionsSoyName ("quote-reply", LangFor("option_soy_quote_reply")); fprintf (stdout, "\ \n", HTML_ESCAPE(uoptr->QuoteReply), OptionsUserOverride("quote-reply") ? " disabled" : ""); OptionsSoyName ("compose-edit-rows", LangFor("option_soy_edit_rows")); fprintf (stdout, "\ \n\n", HTML_ESCAPE(uoptr->ComposeEditRows), OptionsUserOverride("compose-edit-rows") ? " disabled" : ""); OptionsSoyName ("quote-forward", LangFor("option_soy_quote_forward")); fprintf (stdout, "\ \n", HTML_ESCAPE(uoptr->QuoteForward), OptionsUserOverride("quote-forward") ? " disabled" : ""); OptionsSoyName ("compose-edit-cols", LangFor("option_soy_edit_cols")); fprintf (stdout, "\ \n", HTML_ESCAPE(uoptr->ComposeEditCols), OptionsUserOverride("compose-edit-cols") ? " disabled" : ""); if (SoyMailConfig.HtmlEditorLoad) OptionsSoyName ("compose-HTML", LangFor("option_soy_compose_HTML")); else OptionsSoyName (NULL, LangFor("option_soy_compose_HTML")); fprintf (stdout, "\ \n\n", OptionsUserOverride("compose-HTML") || !SoyMailConfig.HtmlEditorLoad ? " disabled" : "", uoptr->ComposeHTML ? " checked" : ""); OptionsSoyName ("compose-wrap-at", LangFor("option_soy_wrap_at")); fprintf (stdout, "\ \n\n", HTML_ESCAPE(uoptr->ComposeWrapAt), OptionsUserOverride("compose-wrap-at") ? " disabled" : ""); OptionsSoyName ("compose-charsets", LangFor("option_soy_compose_charsets")); fprintf (stdout, "\ \n", HTML_ESCAPE(uoptr->ComposeCharSets), OptionsUserOverride("compose-charsets") ? " disabled" : ""); OptionsSaveApplyRestore (uoptr->OptionsApplied); /*******************/ /* mailing persona */ /*******************/ fprintf (stdout, "
%s
  
  
  
\n\n\

\n\ \n\ ", LangFor("option_soy_sender_ident")); OptionsSoyName ("sig-file", LangFor("option_soy_sigfile")); fprintf (stdout, "\n", stdout); OptionsSoyName ("personal-name", LangFor("option_soy_name")); fprintf (stdout, "\ \n", HTML_ESCAPE(uoptr->PersonalName), OptionsUserOverride("personal-name") ? " disabled" : ""); fprintf (stdout, "\n\ \n", OptionsUserOverride("sig-file") ? " disabled" : ""); OptionsSoyName ("SMTP-from", LangFor("option_soy_smtpfrom")); fprintf (stdout, "\n\ \n", HTML_ESCAPE(uoptr->SmtpFrom), OptionsUserOverride("SMTP-from") ? " disabled" : ""); OptionsSaveApplyRestore (uoptr->OptionsApplied); OptionsSigFile (rdptr, muptr->SignaturePtr); fputs ("
%s
  
\   
\n\n\n", stdout); } /*****************************************************************************/ /* For user-override options italicise the option title. */ void OptionsSoyName ( char *OptionName, char *OptionLang ) { /*********/ /* begin */ /*********/ if (Debug) fprintf (stdout, "OptionsSoyName()\n"); fputs ("", stdout); if (!OptionName || OptionsUserOverride(OptionName)) fprintf (stdout, "%s", OptionLang); else fprintf (stdout, "%s", OptionLang); fputs (":\n", stdout); } /*****************************************************************************/ /* */ void OptionsSaveApplyRestore (BOOL ProvideRestore) { /*********/ /* begin */ /*********/ if (Debug) fprintf (stdout, "OptionsSaveApplyRestore()\n"); fprintf (stdout, "\ \  \n\ ", LangFor("option_soy_save"), LangFor("option_soy_apply")); if (ProvideRestore) fprintf (stdout, " \n\ ", LangFor("option_soy_restore")); fputs ("\n", stdout); } /*****************************************************************************/ /* */ void OptionsVms (REQUEST_DATA *rdptr) { REQUEST_DATA *sdptr; VMS_MAIL_USER *muptr; /*********/ /* begin */ /*********/ if (Debug) fprintf (stdout, "OptionsVms()\n"); muptr = &VmsMailUser; fprintf (stdout, "\n\

\n\ \n\ \ \ \ \n\ \n\ \ \n\ \ \ \ \n\ \n\ \ \n\ \ \ \ \n\ \n\ \ \n\ \ \ \ \n\ \n\ \ \n\ \ \ \ \n\ \n\ \ \n\ \ \ \ \ \n\ \ \ \n\ \
%s
%s:\ \   %s:\ \
%s:\ \   %s:\ \
%s:\ \   %s:\ \
%s:\ \   %s:\ \
%s:\ \   %s:\ \
%s:\ \
\ \n\
\n\ \n\n", "VMS Mail", LangFor("option_vms_autopurge"), muptr->VmsMailAutoPurge ? " checked" : "", LangFor("option_vms_editor"), HTML_ESCAPE(muptr->VmsMailEditor), LangFor("option_vms_ccprompt"), muptr->VmsMailCcPrompt ? " checked" : "", LangFor("option_vms_forwarding"), HTML_ESCAPE(muptr->VmsMailForwarding), LangFor("option_vms_copyfwd"), muptr->VmsMailCopyForward ? " checked" : "", LangFor("option_vms_personalname"), HTML_ESCAPE(muptr->VmsMailPersonalName), LangFor("option_vms_copyreply"), muptr->VmsMailCopyReply ? " checked" : "", LangFor("option_vms_signature"), HTML_ESCAPE(muptr->VmsMailSigFile), LangFor("option_vms_copysend"), muptr->VmsMailCopySend ? " checked" : "", LangFor("option_vms_printqueue"), HTML_ESCAPE(muptr->VmsMailQueue), LangFor("option_vms_printform"), HTML_ESCAPE(muptr->VmsMailForm), LangFor("option_vms_save")); } /*****************************************************************************/ /* Edit the signature. */ void OptionsSigFile ( REQUEST_DATA *rdptr, char *SignaturePtr ) { int status; char *cptr; REQUEST_DATA *sdptr; USER_OPTIONS *uoptr; VMS_MAIL_USER *muptr; /*********/ /* begin */ /*********/ if (Debug) fprintf (stdout, "OptionsSigFile()\n"); muptr = &VmsMailUser; if (!muptr->VmsMailFullDirectoryLength) ErrorExit (SS$_BUGCHECK, FI_LI); uoptr = &rdptr->UserOptions; if (uoptr->SigFile == OPTIONS_SOY_SIGFILE_NONE) return; if (uoptr->SigFile == OPTIONS_SOY_SIGFILE_DEFAULT) if (!muptr->VmsMailSigFile[0]) return; if (!SignaturePtr) SignaturePtr = ""; fprintf (stdout, "\ \n\ \ \n\ \ \n\  \n\ \n\ \n", uoptr->SigFileName, HTML_ESCAPE(SignaturePtr), LangFor("option_sigfile_save"), LANG_FOR_CONFIRM("sure?"), LangFor("reset")); } /*****************************************************************************/ /* Save the contents of the signature file text field in the VMS specified signature file name in the VMS Mail directory. */ void OptionsSoyApplySave ( REQUEST_DATA *rdptr, BOOL SaveToFile ) { int retval, status; char *cptr, *fnptr, *sptr, *zptr; char CurrentLanguage [64]; FILE *fp; REQUEST_DATA *sdptr; USER_OPTIONS *uoptr; VMS_MAIL_USER *muptr; /*********/ /* begin */ /*********/ if (Debug) fprintf (stdout, "OptionsSoyApplySave()\n"); muptr = &VmsMailUser; if (!muptr->VmsMailFullDirectoryLength) ErrorExit (SS$_BUGCHECK, FI_LI); uoptr = &rdptr->UserOptions; sdptr = (REQUEST_DATA*)rdptr->StateDataPtr; if (!muptr->VmsMailFullDirectoryLength) ErrorExit (SS$_BUGCHECK, FI_LI); CGIVARNULL (cptr, "FORM_OPTION_SOY_COMPOSE_HTML"); if (cptr) uoptr->ComposeHTML = 1; else uoptr->ComposeHTML = 0; CGIVARNULL (cptr, "FORM_OPTION_SOY_TEXT_FONT_FAMILY"); if (!cptr || !*cptr) CGIVARNULL (cptr, "FORM_OPTION_SOY_SELECT_FONT_FAMILY"); if (cptr) strzcpy (uoptr->FontFamily, cptr, sizeof(uoptr->FontFamily)); CGIVARNULL (cptr, "FORM_OPTION_SOY_SELECT_FONT_SIZE"); if (cptr && isdigit(*cptr)) uoptr->FontSize = atoi(cptr); CGIVARNULL (cptr, "FORM_OPTION_SOY_USE_ONLY_MAIL"); if (cptr) uoptr->AllMailFiles = 0; else uoptr->AllMailFiles = 1; CGIVARNULL (cptr, "FORM_OPTION_SOY_PMDF_IMAP"); if (cptr) { uoptr->PmdfImap = 1; /* PMDF IMAP processing has precedence */ uoptr->AllMailFiles = 0; } else uoptr->PmdfImap = 0; CGIVARNULL (cptr, "FORM_OPTION_SOY_CHECK_NEWMAIL_AJAX"); if (cptr && isdigit(*cptr)) uoptr->CheckNewMailAjax = atoi(cptr); CGIVARNULL (cptr, "FORM_OPTION_SOY_SELECT_CHECK"); if (cptr && isdigit(*cptr)) uoptr->CheckNewMailMins = atoi(cptr); CGIVARNULL (cptr, "FORM_OPTION_SOY_SELECT_YOUGOTMAIL"); if (cptr) strzcpy (uoptr->YouGotMail, cptr, sizeof(uoptr->YouGotMail)); CGIVARNULL (cptr, "FORM_OPTION_SOY_FILE_YOUGOTMAIL"); if (cptr && *cptr) OptionsPersonalYouGotMail (rdptr); CGIVARNULL (cptr, "FORM_OPTION_SOY_FILE_YOUGOTMAIL"); CGIVARNULL (cptr, "FORM_OPTION_SOY_YOUGOTMAILAT"); if (cptr) strzcpy (uoptr->YouGotMailAt, cptr, sizeof(uoptr->YouGotMailAt)); CGIVARNULL (cptr, "FORM_OPTION_SOY_FOLDER_BUTTONS"); if (cptr && isdigit(*cptr)) uoptr->FolderButtons = atoi(cptr); else uoptr->FolderButtons = 0; CGIVARNULL (cptr, "FORM_OPTION_SOY_PREVIEW_AFTER"); if (cptr && isdigit(*cptr)) uoptr->PreviewAfter = atoi(cptr); CGIVARNULL (cptr, "FORM_OPTION_SOY_PER_PAGE"); if (cptr && isdigit(*cptr)) uoptr->MessagesPerPage = atoi(cptr); CGIVARNULL (cptr, "FORM_OPTION_SOY_MASSAGE"); if (cptr) { uoptr->MassageRead = atoi(cptr); if (uoptr->MassageRead && uoptr->MassageRead < atoi(DEFAULT_WRAP_AT)) uoptr->MassageRead = atoi(DEFAULT_WRAP_AT); } else uoptr->MassageRead = 0; CGIVARNULL (cptr, "FORM_OPTION_SOY_MESSAGE_ORDER"); if (cptr) uoptr->MessageOrder = atoi(cptr); CGIVARNULL (cptr, "FORM_OPTION_SOY_NAME"); if (cptr) strzcpy (uoptr->PersonalName, cptr, sizeof(uoptr->PersonalName)); CGIVARNULL (cptr, "FORM_OPTION_SOY_COMPOSE_CHARSETS"); if (cptr) strzcpy (uoptr->ComposeCharSets, cptr, sizeof(uoptr->ComposeCharSets)); CGIVARNULL (cptr, "FORM_OPTION_SOY_COMPOSE_EDIT_COLS"); if (cptr) strzcpy (uoptr->ComposeEditCols, cptr, sizeof(uoptr->ComposeEditCols)); CGIVARNULL (cptr, "FORM_OPTION_SOY_COMPOSE_EDIT_ROWS"); if (cptr) strzcpy (uoptr->ComposeEditRows, cptr, sizeof(uoptr->ComposeEditRows)); CGIVARNULL (cptr, "FORM_OPTION_SOY_COMPOSE_WRAP_AT"); if (cptr) strzcpy (uoptr->ComposeWrapAt, cptr, sizeof(uoptr->ComposeWrapAt)); CGIVARNULL (cptr, "FORM_OPTION_SOY_DRAFT_ITEMS"); if (cptr) strzcpy (uoptr->FolderDraftItems, cptr, sizeof(uoptr->FolderDraftItems)); CGIVARNULL (cptr, "FORM_OPTION_SOY_SENT_ITEMS"); if (cptr) strzcpy (uoptr->FolderSentItems, cptr, sizeof(uoptr->FolderSentItems)); CGIVARNULL (cptr, "FORM_OPTION_SOY_WASTE_ITEMS"); if (cptr) strzcpy (uoptr->FolderWasteItems, cptr, sizeof(uoptr->FolderWasteItems)); CGIVARNULL (cptr, "FORM_OPTION_SOY_QUOTE_REPLY"); if (cptr) strzcpy (uoptr->QuoteReply, cptr, sizeof(uoptr->QuoteReply)); CGIVARNULL (cptr, "FORM_OPTION_SOY_QUOTE_FORWARD"); if (cptr) strzcpy (uoptr->QuoteForward, cptr, sizeof(uoptr->QuoteForward)); CGIVARNULL (cptr, "FORM_OPTION_SOY_READ_PREFERENCE"); if (cptr && isdigit(*cptr)) uoptr->ReadPreference = atoi(cptr); CGIVARNULL (cptr, "FORM_OPTION_SOY_SIGFILE"); if (cptr) strzcpy (uoptr->SigFileName, cptr, sizeof(uoptr->SigFileName)); CGIVARNULL (cptr, "FORM_OPTION_SOY_SIGFILE_NAME"); if (cptr) { while (*cptr && isspace(*cptr)) cptr++; if (*cptr) strzcpy (uoptr->SigFileName, cptr, sizeof(uoptr->SigFileName)); } if (isalnum(uoptr->SigFileName[0]) && SoyMailVolumeStruct != 5) { /* capitalise all leading alphabetics while lower-casing all others */ cptr = uoptr->SigFileName; if (isalpha(*cptr)) *cptr = toupper(*cptr); for (cptr++; *cptr; cptr++) if (!isalnum(*(cptr-1)) && isalpha(*cptr)) *cptr = toupper(*cptr); else *cptr = tolower(*cptr); } strcpy (CurrentLanguage, uoptr->Language); CGIVARNULL (cptr, "FORM_OPTION_SOY_SELECT_LANG"); if (cptr) strzcpy (uoptr->Language, cptr, sizeof(uoptr->Language)); CGIVARNULL (cptr, "FORM_OPTION_SOY_SELECT_THEME"); if (cptr) strzcpy (uoptr->Theme, cptr, sizeof(uoptr->Theme)); CGIVARNULL (cptr, "FORM_OPTION_SOY_SMTPFROM"); if (cptr) strzcpy (uoptr->SmtpFrom, cptr, sizeof(uoptr->SmtpFrom)); /* make sure they are reasonable */ OptionsMunge (uoptr); if (!SaveToFile) { /* gets a bit messy with attachments when just applying the language */ strcpy (uoptr->Language, CurrentLanguage); uoptr->OptionsApplied = TRUE; return; } /* if the language has been changed just reload */ if (strcmp (CurrentLanguage, uoptr->Language)) LangLoad (rdptr->UserOptions.Language); uoptr->OptionsApplied = FALSE; fnptr = CallMailFileIn (muptr, NULL, SOY_OPTIONS); if (WatchEnabled) WatchThis ("OPTIONS !AZ", fnptr); fp = fopen (fnptr, "w"); if (!fp) { status = vaxc$errno; StatusMessage (FI_LI, 1, "%s: %s.", SOY_MAIL, SysGetMsg(status)); return; } status = SS$_NORMAL; fprintf (fp, "# soyMAIL options as at %s\n\n", CurrentVmsTimeString); fprintf (fp, "[version] %s\n", SoftwareVn); if (uoptr->Accessability1) /* manual edit */ fprintf (fp, "[accessability-1] %d\n", uoptr->Accessability1); fprintf (fp, "[charset-default] %s\n", uoptr->CharSetDefault); if (uoptr->CheckNewMailAjax) fprintf (fp, "[check-newmail-ajax] %d\n", uoptr->CheckNewMailAjax); fprintf (fp, "[check-new-mail] %d\n", uoptr->CheckNewMailMins); fprintf (fp, "[compose-charsets] %s\n", uoptr->ComposeCharSets); fprintf (fp, "[compose-edit-rows] %s\n", uoptr->ComposeEditRows); fprintf (fp, "[compose-edit-cols] %s\n", uoptr->ComposeEditCols); fprintf (fp, "[compose-HTML] %d\n", uoptr->ComposeHTML); fprintf (fp, "[compose-wrap-at] %s\n", uoptr->ComposeWrapAt); fprintf (fp, "[draft-items] %s\n", uoptr->FolderDraftItems); fprintf (fp, "[folder-buttons] %d\n", uoptr->FolderButtons); fprintf (fp, "[font-family] %s\n", uoptr->FontFamily); fprintf (fp, "[font-size] %d\n", uoptr->FontSize); fprintf (fp, "[language] %s\n", uoptr->Language); fprintf (fp, "[massage-read] %d\n", uoptr->MassageRead); if (uoptr->MessageAttachmentPanel) /* manual edit */ fprintf (fp, "[message-attachment-panel] %d\n", uoptr->MessageAttachmentPanel); fprintf (fp, "[message-order] %d\n", uoptr->MessageOrder); fprintf (fp, "[message-read-preference] %d\n", uoptr->ReadPreference); fprintf (fp, "[messages-per-page] %d\n", uoptr->MessagesPerPage); if (uoptr->OptionsPanelExpand) /* manual edit */ fprintf (fp, "[options-panel-expand] %d\n", uoptr->OptionsPanelExpand); fprintf (fp, "[personal-name] %s\n", uoptr->PersonalName); fprintf (fp, "[PMDF-IMAP] %d\n", uoptr->PmdfImap); fprintf (fp, "[preview-after] %d\n", uoptr->PreviewAfter); fprintf (fp, "[preview-size] %d\n", uoptr->PreviewSize); fprintf (fp, "[quote-forward] \"%s\"\n", uoptr->QuoteForward); fprintf (fp, "[quote-reply] \"%s\"\n", uoptr->QuoteReply); fprintf (fp, "[sent-items] %s\n", uoptr->FolderSentItems); fprintf (fp, "[sig-file] %s\n", uoptr->SigFileName); fprintf (fp, "[SMTP-from] %s\n", uoptr->SmtpFrom); fprintf (fp, "[theme] %s\n", uoptr->Theme); fprintf (fp, "[use-only-MAIL] %d\n", uoptr->AllMailFiles ? 0 : 1); if (uoptr->VmsNewMsg) /* manual edit */ fprintf (fp, "[VMS-newmsg] %d\n", uoptr->VmsNewMsg); fprintf (fp, "[waste-items] %s\n", uoptr->FolderWasteItems); fprintf (fp, "[you-got-mail] %s\n", uoptr->YouGotMail); fprintf (fp, "[you-got-mail-at] %s\n", uoptr->YouGotMailAt); retval = fprintf (fp, "\n# end\n"); if (retval < 0) status = vaxc$errno; fclose (fp); if (VMSok (status)) { /* purge the versions back */ strcat (fnptr, ";-1"); while (!remove (fnptr)); StatusMessage (FI_LI, 0, LangFor("option_saved")); } else { /* remove just this latest version */ strcat (fnptr, ";0"); remove (fnptr); StatusMessage (FI_LI, 1, "%s: %s.", SOY_MAIL, SysGetMsg(status)); } if (!uoptr->AllMailFiles) { /* ensure we're back in the default mail area */ if (strcmp (rdptr->MailFileName, "MAIL")) { strcpy (rdptr->MailFileName, "MAIL"); rdptr->MailFileNameLength = 4; strcpy (rdptr->FolderName, "NEWMAIL"); rdptr->FolderNameLength = 7; } } } /*****************************************************************************/ /* */ void OptionsVmsSave (REQUEST_DATA *rdptr) { char *cptr; VMS_MAIL_USER *muptr; /*********/ /* begin */ /*********/ if (Debug) fprintf (stdout, "OptionsVmsSave()\n"); muptr = &VmsMailUser; if (!muptr->VmsMailFullDirectoryLength) ErrorExit (SS$_BUGCHECK, FI_LI); if (SoyMailConfig.VmsOccluded) return; CGIVARNULL (cptr, "FORM_OPTION_VMS_AUTOPURGE"); if (cptr) muptr->VmsMailAutoPurge = TRUE; else muptr->VmsMailAutoPurge = FALSE; CGIVARNULL (cptr, "FORM_OPTION_VMS_CCPROMPT"); if (cptr) muptr->VmsMailCcPrompt = TRUE; else muptr->VmsMailCcPrompt = FALSE; CGIVARNULL (cptr, "FORM_OPTION_VMS_COPYFWD"); if (cptr) muptr->VmsMailCopyForward = TRUE; else muptr->VmsMailCopyForward = FALSE; CGIVARNULL (cptr, "FORM_OPTION_VMS_COPYREPLY"); if (cptr) muptr->VmsMailCopyReply = TRUE; else muptr->VmsMailCopyReply = FALSE; CGIVARNULL (cptr, "FORM_OPTION_VMS_COPYSEND"); if (cptr) muptr->VmsMailCopySend = TRUE; else muptr->VmsMailCopySend = FALSE; CGIVARNULL (cptr, "FORM_OPTION_VMS_EDITOR"); if (cptr) muptr->VmsMailEditorLength = strzcpy (muptr->VmsMailEditor, cptr, sizeof(muptr->VmsMailEditor)); else { muptr->VmsMailEditor[0] = '\0'; muptr->VmsMailEditorLength = 0; } CGIVARNULL (cptr, "FORM_OPTION_VMS_FORWARDING"); if (cptr) muptr->VmsMailForwardingLength = strzcpy (muptr->VmsMailForwarding, cptr, sizeof(muptr->VmsMailForwarding)); else { muptr->VmsMailForwarding[0] = '\0'; muptr->VmsMailForwardingLength = 0; } CGIVARNULL (cptr, "FORM_OPTION_VMS_PERSONAL"); if (cptr) muptr->VmsMailPersonalNameLength = strzcpy (muptr->VmsMailPersonalName, cptr, sizeof(muptr->VmsMailPersonalName)); else { muptr->VmsMailPersonalName[0] = '\0'; muptr->VmsMailPersonalNameLength = 0; } CGIVARNULL (cptr, "FORM_OPTION_SIGFILE"); if (cptr) muptr->VmsMailSigFileLength = strzcpy (muptr->VmsMailSigFile, cptr, sizeof(muptr->VmsMailSigFile)); else { muptr->VmsMailSigFile[0] = '\0'; muptr->VmsMailSigFileLength = 0; } CGIVARNULL (cptr, "FORM_OPTION_VMS_QUEUE"); if (cptr) muptr->VmsMailQueueLength = strzcpy (muptr->VmsMailQueue, cptr, sizeof(muptr->VmsMailQueue)); else { muptr->VmsMailQueue[0] = '\0'; muptr->VmsMailQueueLength = 0; } CGIVARNULL (cptr, "FORM_OPTION_VMS_FORM"); if (cptr) muptr->VmsMailFormLength = strzcpy (muptr->VmsMailForm, cptr, sizeof(muptr->VmsMailForm)); else { muptr->VmsMailForm[0] = '\0'; muptr->VmsMailFormLength = 0; } CallMailSetUserProfile (muptr); if (VMSok (muptr->MailVmsStatus)) StatusMessage (FI_LI, 0, LangFor("option_saved")); else StatusMessage (FI_LI, 1, "MAIL: %s.", SysGetMsg(muptr->MailVmsStatus)); } /*****************************************************************************/ /* Load the file contents representing the signature. */ void OptionsSigFileLoad ( REQUEST_DATA *rdptr, char *ThisSigFile ) { int status; char *cptr, *fnptr, *sptr, *zptr; char SigFileName [128]; USER_OPTIONS *uoptr; VMS_MAIL_USER *muptr; /*********/ /* begin */ /*********/ if (Debug) fprintf (stdout, "OptionsSigFileLoad() |%s|\n", ThisSigFile ? ThisSigFile : "(null)"); muptr = &VmsMailUser; if (!muptr->VmsMailFullDirectoryLength) ErrorExit (SS$_BUGCHECK, FI_LI); uoptr = &rdptr->UserOptions; if (ThisSigFile) { /* OPTIONS_SOY_SIGFILE_DEFAULT */ if (!strcmp (ThisSigFile, "(1)")) fnptr = muptr->VmsMailSigFile; else /* OPTIONS_SOY_SIGFILE_SOYMAIL */ if (!strcmp (ThisSigFile, "(2)")) fnptr = SOY_SIGFILE; /* OPTIONS_SOY_SIGFILE_NAME */ else { zptr = (sptr = SigFileName) + sizeof(SigFileName)-1; for (cptr = SOYMAIL_SIGNATURE_NAME; *cptr && sptr < zptr; *sptr++ = *cptr++); for (cptr = ThisSigFile; *cptr && sptr < zptr; *sptr++ = *cptr++); for (cptr = ".TXT"; *cptr && sptr < zptr; *sptr++ = *cptr++); *sptr = '\0'; fnptr = SigFileName; } } else if (uoptr->SigFile == OPTIONS_SOY_SIGFILE_DEFAULT) fnptr = muptr->VmsMailSigFile; else if (uoptr->SigFile == OPTIONS_SOY_SIGFILE_SOYMAIL) fnptr = SOY_SIGFILE; else if (uoptr->SigFile == OPTIONS_SOY_SIGFILE_NAME && isalnum(uoptr->SigFileName[0])) { zptr = (sptr = SigFileName) + sizeof(SigFileName)-1; for (cptr = SOYMAIL_SIGNATURE_NAME; *cptr && sptr < zptr; *sptr++ = *cptr++); for (cptr = uoptr->SigFileName; *cptr && sptr < zptr; *sptr++ = *cptr++); for (cptr = ".TXT"; *cptr && sptr< zptr; *sptr++ = *cptr++); *sptr = '\0'; fnptr = SigFileName; } else return; fnptr = CallMailFileIn (muptr, NULL, fnptr); if (WatchEnabled) WatchThis ("SIGNATURE !AZ", fnptr); status = ReadFileIntoMemory (fnptr, &muptr->SignaturePtr, &muptr->SignatureLength); if (VMSnok (status) && status != RMS$_FNF) StatusMessage (FI_LI, 1, "%s: %s.", LangFor("option_sigfile"), SysGetMsg(status)); if (VMSnok (status)) { muptr->SignaturePtr = NULL; muptr->SignatureLength = 0; } } /*****************************************************************************/ /* Save the contents of the signature file text field in the VMS specified signature file name in the VMS Mail directory. */ void OptionsSigFileSave (REQUEST_DATA *rdptr) { int status; char *cptr, *fnptr, *sptr, *zptr, *SigFileText; char SigFileName [128]; FILE *fp; USER_OPTIONS *uoptr; VMS_MAIL_USER *muptr; /*********/ /* begin */ /*********/ if (Debug) fprintf (stdout, "OptionsSigFileSave()\n"); muptr = &VmsMailUser; if (!muptr->VmsMailFullDirectoryLength) ErrorExit (SS$_BUGCHECK, FI_LI); uoptr = &rdptr->UserOptions; CGIVARNULL (cptr, "FORM_OPTION_SOY_SIGFILE_NAME"); if (cptr) { while (*cptr && isspace(*cptr)) cptr++; if (*cptr) { strzcpy (uoptr->SigFileName, cptr, sizeof(uoptr->SigFileName)); uoptr->SigFile = OPTIONS_SOY_SIGFILE_NAME; } } if (uoptr->SigFile == OPTIONS_SOY_SIGFILE_DEFAULT) fnptr = muptr->VmsMailSigFile; else if (uoptr->SigFile == OPTIONS_SOY_SIGFILE_SOYMAIL) fnptr = SOY_SIGFILE; else if (uoptr->SigFile == OPTIONS_SOY_SIGFILE_NAME && isalnum(uoptr->SigFileName[0])) { zptr = (sptr = SigFileName) + sizeof(SigFileName)-1; for (cptr = SOYMAIL_SIGNATURE_NAME; *cptr && sptr < zptr; *sptr++ = *cptr++); for (cptr = uoptr->SigFileName; *cptr && sptr < zptr; *sptr++ = *cptr++); for (cptr = ".TXT"; *cptr && sptr< zptr; *sptr++ = *cptr++); *sptr = '\0'; fnptr = SigFileName; } else return; fnptr = CallMailFileIn (muptr, NULL, fnptr); status = SS$_NORMAL; CGIVARNULL (SigFileText, "FORM_OPTION_SIGFILE_TEXT"); if (!SigFileText) { StatusMessage (FI_LI, SS$_BUGCHECK, LangFor("option_saved")); return; } /* reduce those pesky Windows to */ cptr = sptr = SigFileText; while (*cptr) { if (*(USHORTPTR)cptr == '\r\n') cptr++; *sptr++ = *cptr++; } *sptr = '\0'; for (cptr = SigFileText; *cptr && isspace(*cptr); cptr++); if (*cptr) { fp = fopen (fnptr, "w"); if (fp) { if (fputs (SigFileText, fp) < 0) status = vaxc$errno; fclose (fp); if (VMSok (status)) { /* purge the versions back */ strcat (fnptr, ";-1"); while (!remove (fnptr)); } else { /* remove this latest one */ strcat (fnptr, ";0"); remove (fnptr); } } else status = vaxc$errno; } else { /* empty content, just delete the file */ if (remove (fnptr)) status = vaxc$errno; } if (VMSok (status)) StatusMessage (FI_LI, 0, LangFor("option_saved")); else StatusMessage (FI_LI, 1, "%s: %s.", LangFor("option_sigfile"), SysGetMsg(status)); } /*****************************************************************************/ /* For all files matching the supplied specification create an appropriate