home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / include / msgcom.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  120.7 KB  |  3,117 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. /* msgcom.h --- prototypes for the mail/news reader module.
  20.    Created: Jamie Zawinski <jwz@netscape.com>, 10-May-95.
  21.  */
  22.  
  23. #ifndef _MSGCOM_H_
  24. #define _MSGCOM_H_
  25.  
  26. #include "libmime.h"
  27.  
  28. #define SUBSCRIBE_USE_OLD_API
  29.  
  30. /* ===========================================================================
  31.    This file defines all of the types and prototypes for communication
  32.    between the msg library, which implements the mail and news applications,
  33.    and the various front ends.
  34.  
  35.    Functions beginning with MSG_ are defined in the library, and are invoked
  36.    by the front ends in response to user activity.
  37.  
  38.    Functions beginning with FE_ are defined by the front end, and are invoked
  39.    by the message library to get things to happen on the screen.
  40.  
  41.    The main parts of this file are listed below:
  42.  
  43.                            COMMAND NUMBERS
  44.                            CONSTANTS AND ENUMS
  45.                            FLAGS AND MASKS
  46.                            TYPES AND STRUCTS
  47.  
  48.                            INIT/CREATE
  49.                            RANDOM CORE FUNCTIONS (to sort)
  50.                            PREFERENCES
  51.                            LIST CALLBACKS
  52.                            HOSTS
  53.                            SUBSCRIBE WINDOW
  54.                            OFFLINE NEWS
  55.                            OFFLINE IMAP
  56.                            QUERIES
  57.                            BIFF
  58.                            OTHER INTERFACES
  59.                            SECURE MAIL
  60.                            COMPOSE WINDOW
  61.  
  62.    ===========================================================================
  63.  */
  64.  
  65.  
  66. #include "xp_mcom.h"
  67. #include "xp_core.h"
  68. #include "ntypes.h"
  69. #include "msgtypes.h"
  70.  
  71.  
  72.  
  73.  
  74.  
  75. /* ===========================================================================
  76.                            COMMAND NUMBERS
  77.    ===========================================================================
  78.  */
  79.  
  80. /* This enumerates all of the mail/news-specific commands (those which are
  81.    not shared with the web browsers.  The front ends should invoke each of
  82.    these menu items through the MSG_Command() function like so:
  83.  
  84.       MSG_Command (context, MSG_PostReply);
  85.  
  86.    This interface is used for selections of normal menu items, toolbar
  87.    buttons, and keyboard equivalents.  Clicks in the scrolling list windows,
  88.    drag-and-drop, and the "folders" menus are handled differently.
  89.  
  90.    Different items are meaningful in different sets of panes.  The comments
  91.    indicate which:
  92.  
  93.         f:  Usable in folder panes (either mail or news)
  94.         fn: Usable only in news folderpanes
  95.         fm: Usable only in mail folderpanes
  96.         t: Usable in thread panes
  97.         tn: Usable only in news threadpanes
  98.         tm: Usable only in mail threadpanes
  99.         m: Usable in message panes
  100.         mn: Usable only in news messagepanes
  101.         mm: Usable only in mail messagepanes
  102.         c: Usable in composition panes
  103.         sub: Usable in the subscribe pane
  104.  
  105.     In general, an item which works on folders can either be called on
  106.     the folder pane (in which case it effects the specified folders),
  107.     or on a threadpane (in which case it effects the folder being
  108.     displayed in the threadpane).  Similarly, items which work on
  109.     messages can be either called on a threadpane or on a messagepane.
  110.  
  111.     Also, in general, commands useable in news folder pane work in the
  112.     category pane as well.
  113.  */
  114.  
  115. typedef enum
  116. {
  117.   /* FILE MENU
  118.      =========
  119.    */
  120.   MSG_GetNewMail,                /* fm: Gets new mail messages, and appends them
  121.                                    to the appropriate folders.  This is an
  122.                                    asynchronous operation; it will eventually
  123.                                    cause FE_ListChangeStarting and
  124.                                    FE_ListChangeFinished to be called on any
  125.                                    threadpanes displaying a folder which is
  126.                                    modified. */
  127.   MSG_GetNextChunkMessages,        /* f,t Get the next N news messages, based on chunk 
  128.                                    size. */
  129.   MSG_UpdateMessageCount,        /* f,t,m News only - Update the message counts */
  130.  
  131.   MSG_DeliverQueuedMessages,    /* f,t,m: Deliver messages waiting to be 
  132.                                    delivered in the queued folder. */
  133.  
  134.   MSG_OpenFolder,                /* fm: Prompt the user for the full pathname of
  135.                                    a mail file, and creates an entry for it
  136.                                    (i.e., calls MSG_CreateFolder). */
  137.  
  138.   MSG_NewFolder,                /* f,t,m: Prompt the user for a new folder or
  139.                                    subfolder name, and creates it (i.e., calls
  140.                                    MSG_CreateFolder) */
  141.  
  142.   MSG_CompressFolder,            /* fm: Causes the given folders to be
  143.                                    compressed. */
  144.  
  145.   MSG_CompressAllFolders,        /* fm: Causes all the folders to be
  146.                                    compressed. */
  147.  
  148.   MSG_DoRenameFolder,                /* fm: Prompt the user for a new folder or
  149.                                    subfolder name, and renames the selected
  150.                                    folder to have that name (i.e., calls
  151.                                    MSG_RenameFolder()). */
  152.  
  153.   MSG_AddNewsGroup,                /* fn: Prompts the user for a newsgroup name,
  154.                                  and adds it to the list of newsgroups (i.e.,
  155.                                  subscribes the user). */
  156.  
  157.   MSG_EmptyTrash,                /* fm: Causes the trash folder to be emptied,
  158.                                    and all the folders to be compressed. */
  159.  
  160.   MSG_Unsubscribe,                /* f, Unsubscribe to the selected newsgroup(s)
  161.                                     Delete currently does this as well. */
  162.  
  163.   MSG_ManageMailAccount,        /* f: Prompts the user for mail account password
  164.                                    if needed and brings up the GURL web page */
  165.  
  166.   MSG_Print,                /* not a command - used for selectability only */
  167.  
  168.   MSG_NewNewsgroup,             /* ft: Prompts the user for a new newsgroup name */
  169.                                 /*     and brings up the NGURL web page */
  170.  
  171.   MSG_ModerateNewsgroup,        /* ft: brings up the MODURL web page for the */
  172.                                 /*     selected group */
  173.  
  174.   MSG_NewCategory,              /* ft: Prompts the user for a new category name */
  175.                                 /*     and brings up the NGURL web page */
  176.  
  177.   /* VIEW/SORT MENUS
  178.      ===============
  179.    */
  180.   MSG_ReSort,                    /* t: Re-apply the current sort. */
  181.   MSG_SortBackward,                /* t: Reverse the order of the sort. */
  182.   MSG_SortByDate,                /* t: Sort in chronological order. */
  183.   MSG_SortBySubject,            /* t: Sort alphabetized by subject. */
  184.   MSG_SortBySender,                /* t: Sort alphabetized by sender. */
  185.   MSG_SortByMessageNumber,        /* t: Sort in order stored in mail folder, or
  186.                                    in numerical article number if news. */
  187.   MSG_SortByThread,                /* t: Sort in threads. */
  188.   MSG_SortByPriority,            /* t: Sort by priority - highest first. */
  189.   MSG_SortByStatus,                /* t: Sort by message status - new first. */
  190.   MSG_SortBySize,                /* t: Sort by size */
  191.   MSG_SortByFlagged,            /* t: Sort by flag state */
  192.   MSG_SortByUnread,                /* t: Sort by unread state */
  193.  
  194.   MSG_ViewAllThreads,            /* t: (except for killed threads) -default */
  195.   MSG_ViewKilledThreads,            /* t: Show all incl. killed threads */
  196.   MSG_ViewThreadsWithNew,        /* t: Show only threads with new messages */
  197.   MSG_ViewWatchedThreadsWithNew,/* t: Show only watched thrds with new msgs */
  198.   MSG_ViewNewOnly,                /* t: Show only new messages */
  199.  
  200.   MSG_Rot13Message,                /* m: Apply fancy rot13 encryption. */
  201.  
  202.   MSG_AttachmentsInline,        /* m: Display attachments in line. */
  203.   MSG_AttachmentsAsLinks,        /* m: Display attachments as links */
  204.  
  205.   MSG_WrapLongLines,
  206.  
  207.   /* EDIT MENU
  208.      =========
  209.    */
  210.   MSG_Undo,                        /* ftm: Undoes the last operation. */
  211.  
  212.   MSG_Redo,                        /* ftm: Redoes the last undone operation. */
  213.  
  214.   MSG_DeleteMessage,            /* tm, mm: Causes the given messages to be
  215.                                    deleted. */
  216.  
  217.   MSG_DeleteFolder,                /* fm, tm: Causes the given folders to be
  218.                                    deleted. */
  219.  
  220.   MSG_CancelMessage,            /* tn, mn: Causes the given messages to be
  221.                                    cancelled, if possible. */
  222.  
  223.   MSG_DeleteMessageNoTrash,        /* tm, mm: Causes the given messages to be
  224.                                    deleted w/o getting copied to trash. */
  225.  
  226.   /* MESSAGE MENU
  227.      ============
  228.    */
  229.   MSG_EditAddressBook,            /* f,t,m,c: Bring up the address book. */
  230.   MSG_EditAddress,                /* m: Bring up the address book entry for the
  231.                                    sender of this message. */
  232.   MSG_AddSender,                /* t,m: Add the sender of this message. 
  233.                                     to the address book */
  234.   MSG_AddAll,                    /* t,m: Add all recipients of this message. 
  235.                                     to the address book */
  236.   MSG_PostNew,                    /* fn,tn: Post a new message to this
  237.                                    newsgroup. */
  238.   MSG_PostReply,                /* tn,mn: Post a followup message to this
  239.                                    article. */
  240.   MSG_PostAndMailReply,            /* tn,mn: Post a followup message to this
  241.                                    article, mailing a copy to the author. */
  242.   MSG_MailNew,                    /* f,t,m,c: Create a new mail composition. */
  243.   MSG_ReplyToSender,            /* t,m: E-mail a reply to the sender of this
  244.                                    message. */
  245.   MSG_ReplyToAll,                /* t,m: E-mail (& possibly post) a reply to
  246.                                    everyone who saw this message. */
  247.   MSG_ForwardMessage,            /* t,m: Forward these messages to someone. */
  248.   MSG_ForwardMessageQuoted,        /* t,m: Forward this message, quoting it
  249.                                    inline. */
  250.   MSG_MarkMessagesRead,            /* t,m: Mark the message as read. */
  251.   MSG_MarkMessagesUnread,        /* t,m: Mark the message as unread. */
  252.   MSG_ToggleMessageRead,        /* t,m: Toggle whether the message has been
  253.                                    read. */
  254.   MSG_MarkMessages,                /* tn: flag the passed messages,either for 
  255.                                    retrieval or just to mark them */
  256.   MSG_UnmarkMessages,            /* tn: unflag passed messages */                                   
  257.   MSG_ToggleThreadKilled,        /* t: toggle the killed status of the message's
  258.                                     thread */
  259.   MSG_ToggleThreadWatched,        /* t: toggle the watched status of the message's
  260.                                     thread */
  261.   MSG_SaveMessagesAs,            /* t,m: Prompt the user for a filename, and
  262.                                    save the given messages into it.  */
  263.   MSG_SaveMessagesAsAndDelete,    /* t,m: Prompt the user for a filename, and
  264.                                    save the given messages into it, and then
  265.                                    delete the messages.  */
  266.   MSG_RetrieveMarkedMessages,    /* fn, tn Retrieve the messages marked for 
  267.                                     retrieval */
  268.   MSG_RetrieveSelectedMessages,    /* fn, tn Retrieve the selected messages for
  269.                                     offline use. */
  270.   MSG_OpenMessageAsDraft,       /* t,m: Open the selected message as a draft
  271.                                    message. Ready to send or further editing. */
  272.  
  273.   /* GO MENU
  274.      =======
  275.    */
  276.   MSG_MarkThreadRead,            /* t,m: Mark all messages in the same thread
  277.                                    as these as read.*/
  278.   MSG_MarkAllRead,                /* t: Mark all messages in this folder as
  279.                                    read. */
  280.  
  281.  
  282.   /* OPTIONS MENU
  283.      ============
  284.    */
  285.   MSG_ShowAllMessages,            /* t: Change the view to show all messages. */
  286.   MSG_ShowOnlyUnreadMessages,    /* t: Change the view to show only unread
  287.                                    messages. */
  288.   MSG_ShowMicroHeaders,            /* m: Change to show very compact headers. */
  289.   MSG_ShowSomeHeaders,            /* m: Change to show interesting headers. */
  290.   MSG_ShowAllHeaders,            /* m: Change to show all headers. */
  291.  
  292.  
  293.   /* COMPOSITION FILE MENU
  294.      =====================
  295.    */
  296.   MSG_SendMessage,                /* c: Send the composition. */
  297.   MSG_SendMessageLater,            /* c: Queue the composition to be sent
  298.                                    later. */
  299.   MSG_Attach,                    /* c: Bring up the attachment dialogs. */
  300.   MSG_SaveDraft,                /* c: Save draft */
  301.   MSG_SaveDraftThenClose,        /* c: Save draft and then close the compose pane */
  302.   MSG_SaveTemplate,                /* c: Save as template */
  303.  
  304.   /* COMPOSITION VIEW MENU
  305.      =====================
  306.    */
  307.   MSG_ShowFrom,                    /* c: Toggle showing the From header. */
  308.   MSG_ShowReplyTo,                /* c: Toggle showing the ReplyTo header. */
  309.   MSG_ShowTo,                    /* c: Toggle showing the To header. */
  310.   MSG_ShowCC,                    /* c: Toggle showing the Const Char header. */
  311.   MSG_ShowBCC,                    /* c: Toggle showing the BCC header. */
  312.   MSG_ShowFCC,                    /* c: Toggle showing the FCC header. */
  313.   MSG_ShowPostTo,                /* c: Toggle showing the PostTo header. */
  314.   MSG_ShowFollowupTo,            /* c: Toggle showing the FollowupTo header. */
  315.   MSG_ShowSubject,                /* c: Toggle showing the Subject header. */
  316.   MSG_ShowAttachments,            /* c: Toggle showing the Attachments header. */
  317.  
  318.   /* COMPOSITION OPTIONS MENU
  319.      ========================
  320.    */
  321.   MSG_SendFormattedText,        /* c: Toggle HTML mode. */
  322.   MSG_AttachAsText,                /* c: ???   ###tw */
  323.  
  324.   MSG_SendEncrypted,
  325.   MSG_SendSigned,
  326.  
  327.  
  328.   /* SUBSCRIBE PANE
  329.      ==============
  330.    */
  331.   MSG_ToggleSubscribed,            /* sub: Changes the subscribed state of the
  332.                                    given newsgroups.  */
  333.   MSG_SetSubscribed,            /* sub: Sets the subscribed state of given
  334.                                    newsgroups / IMAP folders to Subscribed */
  335.   MSG_ClearSubscribed,            /* sub: Sets the subscribed state of given
  336.                                    newsgroups / IMAP folders to Unsubscribed */
  337.   MSG_FetchGroupList,            /* sub: Causes us to go to the newsserver and
  338.                                    re-fetch the entire list of newsgroups. */
  339.   MSG_ExpandAll,                /* sub: Expands everything under the given
  340.                                    lines. */
  341.   MSG_CollapseAll,                /* sub: Collapses everything under the given
  342.                                    lines. */
  343.   MSG_ClearNew,                    /* sub: Clears the list of new newsgroups. */
  344.   MSG_CheckForNew,                /* sub: Checks the server for new
  345.                                    newsgroups. */
  346.   /* CATEGORY PANE
  347.      =============
  348.   */
  349.   MSG_MarkCategoryRead,            /* cat: Mark the passed categories read */
  350.   MSG_MarkCategoryUnRead,        /* cat: Mark the passed categories unread */
  351.   MSG_KillCategory                /* cat: kill/ignore/unsubscribe the category */
  352.  
  353. } MSG_CommandType;
  354.  
  355.  
  356.  
  357.  
  358. /* ===========================================================================
  359.                            CONSTANTS AND ENUMS
  360.    ===========================================================================
  361.  */
  362.  
  363. /* Several things want to know this (including libnet/mknews.c) */
  364. #define NEWS_PORT 119
  365. #define SECURE_NEWS_PORT 563   
  366.  
  367.  
  368. #define MSG_MAXSUBJECTLENGTH    160
  369. #define MSG_MAXAUTHORLENGTH        60
  370. #define MSG_MAXGROUPNAMELENGTH    128
  371.  
  372. typedef enum
  373. {
  374.     MSG_Pop3 = 0,
  375.     MSG_Imap4 = 1,
  376.     MSG_MoveMail = 2,
  377.     MSG_Inbox = 3
  378. } MSG_SERVER_TYPE;
  379.  
  380. /* The font type which should be used for presentation of cited text.  The
  381.    values are the same numeric values that are stored in the prefs db.
  382.  */
  383. typedef enum
  384. {
  385.   MSG_PlainFont = 0,
  386.   MSG_BoldFont = 1,
  387.   MSG_ItalicFont = 2,
  388.   MSG_BoldItalicFont = 3
  389. } MSG_FONT;
  390.  
  391. /* The font size which should be used for presentation of cited text.
  392.  */
  393. typedef enum
  394. {
  395.   MSG_NormalSize,
  396.   MSG_Bigger,
  397.   MSG_Smaller
  398. } MSG_CITATION_SIZE;
  399.  
  400. typedef enum
  401. {
  402.   MSG_NotUsed,
  403.   MSG_Checked,
  404.   MSG_Unchecked
  405. } MSG_COMMAND_CHECK_STATE;
  406.  
  407. /*    UndoStatus is returned by Undo and Redo to indicate whether the undo/redo
  408.     action is complete (i.e., operation is synchronous and was successful), or 
  409.     in progress (undo action kicked off a url), or it failed.
  410. */
  411. typedef enum
  412. {
  413.     UndoError,            /* Should we remove the undo obj (?) Hmmm ...*/
  414.     UndoComplete,        /* Synchronous undo status*/
  415.     UndoInProgress,        /* Asynchronous undo status*/
  416.     UndoFailed,            /* Should we remove the undo obj (?) Hmmm...*/
  417.     UndoInterrupted      
  418. } UndoStatus;
  419.  
  420. typedef enum
  421. {
  422.     UndoIdle,        /* Normal situation */
  423.     UndoUndoing,        /* We are Undoing ...*/
  424.     UndoRedoing         /* We are Redoing ...*/
  425. } UndoMgrState;
  426.  
  427. /* Message priorities as determined by X-Priority hdr, or Priority header? */
  428. typedef enum
  429. {
  430.   MSG_PriorityNotSet = 0,
  431.   MSG_NoPriority = 1,
  432.   MSG_LowestPriority,
  433.   MSG_LowPriority,
  434.   MSG_NormalPriority,
  435.   MSG_HighPriority,
  436.   MSG_HighestPriority
  437. } MSG_PRIORITY;
  438.  
  439. /* Message Compose Editor Type */
  440. typedef enum
  441. {
  442.   MSG_DEFAULT = 0,
  443.   MSG_PLAINTEXT_EDITOR,
  444.   MSG_HTML_EDITOR
  445. } MSG_EditorType;
  446.  
  447. /* What kind of change was made to a list.  Used in calls to
  448.    FE_ListChangeStarting and FE_ListChangeFinished. */
  449.  
  450. typedef enum
  451. {
  452.   MSG_NotifyNone,                /* No change; this call is just being used
  453.                                    to potentially nest other sets of calls
  454.                                    inside it.  The "where" and "num" parameters
  455.                                    are unused. */
  456.   MSG_NotifyInsertOrDelete,        /* Some lines have been inserted or deleted.
  457.                                    The "where" parameter will indicate
  458.                                    the first line that has been added or
  459.                                    removed; the "num" parameter will indicate
  460.                                    how many lines, and will be positive on
  461.                                    an insertion and negative on a deletion. */
  462.   MSG_NotifyChanged,            /* Some lines have had their contents changed
  463.                                    (e.g., messages have been marked read
  464.                                    or something.)  "where" indicates the
  465.                                    first line with a change; "num" indicates
  466.                                    how many chaged. */
  467.   MSG_NotifyScramble,            /* Everything changed.  Probably means we
  468.                                    resorted the folder.  We are still working
  469.                                    with the same set of items, or at least
  470.                                    have some overlap, but all the indices are
  471.                                    invalid.  The "where" and "num" parameters
  472.                                    are unused. */
  473.   MSG_NotifyAll                /* Everything changed.  We're now not
  474.                                    displaying anything like what we were; we
  475.                                    probably opened a new folder or something.
  476.                                    The FE needs to forget anything it ever knew
  477.                                    about what was being displayed, and start
  478.                                    over.  The "where" and "num" parameters are
  479.                                    unused.  */
  480. } MSG_NOTIFY_CODE;
  481.  
  482. /* How has a pane changed? Used in calls to FE_PaneChanged. If the
  483.     value passed to FE_PaneChanged becomes meaningful, it should
  484.     be documented here.
  485.  */
  486. typedef enum
  487. {
  488.     MSG_PaneDirectoriesChanged,        /* The list of directories has changed.  The 
  489.                                         user has edited them by either reordering
  490.                                         or deleting or changing the name.  The
  491.                                         address book window will need to rebuild
  492.                                         its directory list. */
  493.     MSG_PaneNotifyMessageLoaded,     /* a new message has started to be loaded 
  494.                                         into a message pane. */
  495.     MSG_PaneNotifyFolderInfoChanged, /* the folder info for a thread pane has
  496.                                         changed. */
  497.     MSG_PaneNotifyFolderLoaded,      /* a folder has finished loading into a 
  498.                                         thread pane */
  499.     MSG_PaneNotifyFolderLoadedSync,  /* a folder has finished loading synchronously 
  500.                                         into athread pane */
  501.     MSG_PaneNotifyLastMessageDeleted,/* User has deleted the last message in
  502.                                         a folder. Some FE's may want to close
  503.                                         the message window. */
  504.     MSG_PaneNotifyFolderDeleted,     /* User has deleted a folder. If it is
  505.                                         open in a thread window, the FE
  506.                                         should close the window */
  507.     MSG_PaneNotifyMessageDeleted,    /* User has deleted a message. If it is
  508.                                         open in a standalone msg window, the 
  509.                                         FE should close the window */
  510.     MSG_PanePastPasswordCheck,        /* Get New mail is past password check. Might
  511.                                         be a good time to show progress window. */
  512.     MSG_PaneProgressDone,              /* Send this when you are a libmsg API that
  513.                                          usually runs a url in a progress pane but
  514.                                          you don't start a url. FE's, do something
  515.                                          reasonable (like take down progress pane)*/
  516.     MSG_PaneNotifySelectNewFolder,    /* Sent when a new folder is created, and is
  517.                                         supposed to be selected by the FE */
  518.  
  519.     MSG_PaneNotifyNewFolderFailed,    /* Sent when a new folder creation attempt
  520.                                         fails */
  521.     MSG_PaneNotifyIMAPClosed,         /* Sent to a folder or message pane when
  522.                                         the IMAP connection with which it is
  523.                                         associated is closing. */
  524.     MSG_PaneNotifyCopyFinished,        /* Tell the FE that a message copy operation
  525.                                          has completed. They may have disabled
  526.                                          selection in order to prevent interruption */
  527.     MSG_PaneChanged,                   /* Introduced for the 2 pane Address Book. Contents have changed through
  528.                                           another pane. This pane's data is no longer up to date */
  529.     MSG_PaneClose                       /* Introduced for the 2 pane AB. This pane needs to be closed */
  530. } MSG_PANE_CHANGED_NOTIFY_CODE;
  531.  
  532.  
  533.  
  534.  
  535.  
  536. /* ===========================================================================
  537.                            FLAGS AND MASKS
  538.    ===========================================================================
  539.  */
  540.  
  541. /* Flags about a single message.  These values are used in the MSG_MessageLine
  542.    struct and in a folder's mozilla-status line. The summary file database
  543.    uses a different internal set of flags.
  544. */
  545.  
  546. #define MSG_FLAG_READ     0x0001    /* has been read */
  547. #define MSG_FLAG_REPLIED  0x0002    /* a reply has been successfully sent */
  548. #define MSG_FLAG_MARKED   0x0004    /* the user-provided mark */
  549. #define MSG_FLAG_EXPUNGED 0x0008    /* already gone (when folder not
  550.                                        compacted.)  Since actually
  551.                                        removing a message from a
  552.                                        folder is a semi-expensive
  553.                                        operation, we tend to delay it;
  554.                                        messages with this bit set will
  555.                                        be removed the next time folder
  556.                                        compaction is done.  Once this
  557.                                        bit is set, it never gets
  558.                                        un-set.  */
  559. #define MSG_FLAG_HAS_RE   0x0010    /* whether subject has "Re:" on
  560.                                        the front.  The folder summary
  561.                                        uniquifies all of the strings
  562.                                        in it, and to help this, any
  563.                                        string which begins with "Re:"
  564.                                        has that stripped first.  This
  565.                                        bit is then set, so that when
  566.                                        presenting the message, we know
  567.                                        to put it back (since the "Re:"
  568.                                        is not itself stored in the
  569.                                        file.)  */
  570. #define MSG_FLAG_ELIDED   0x0020    /* Whether the children of this
  571.                                        sub-thread are folded in the
  572.                                        display.  */
  573. #define MSG_FLAG_EXPIRED  0x0040    /* If this flag is set, then this
  574.                                        is not a "real" message, but is
  575.                                        a dummy container representing
  576.                                        an expired parent in a thread.  */
  577. #define MSG_FLAG_OFFLINE  0x0080    /* db has offline news or imap article
  578.                                              */
  579. #define MSG_FLAG_WATCHED  0x0100    /* If set, then this thread is watched (in
  580.                                        3.0, this was MSG_FLAG_UPDATING).*/
  581. #define MSG_FLAG_SENDER_AUTHED    0x0200    /* If set, then this message's sender
  582.                                        has been authenticated when sending this msg. */
  583. #define MSG_FLAG_PARTIAL  0x0400    /* If set, then this message's body is
  584.                                        only the first ten lines or so of the
  585.                                        message, and we need to add a link to
  586.                                        let the user download the rest of it
  587.                                        from the POP server. */
  588. #define MSG_FLAG_QUEUED   0x0800    /* If set, this message is queued for
  589.                                        delivery.  This only ever gets set on
  590.                                        messages in the queue folder, but is
  591.                                        used to protect against the case of
  592.                                        other messages having made their way
  593.                                        in there somehow -- if some other
  594.                                        program put a message in the queue, we
  595.                                        don't want to later deliver it! */
  596. #define MSG_FLAG_FORWARDED  0x1000  /* this message has been forwarded */
  597. #define MSG_FLAG_PRIORITIES 0xE000    /* These are used to remember the message
  598.                                        priority in the mozilla status flags
  599.                                        so we can regenerate a priority after a 
  600.                                        rule (or user) has changed it. They are
  601.                                        not returned in MSG_MessageLine.flags, 
  602.                                        just in mozilla-status, so if you need
  603.                                        more non-persistent flags, you could 
  604.                                        share these bits. But it would be wrong.
  605.                                     .  */
  606.  
  607. #define MSG_FLAG_NEW        0x10000    /* This msg is new since the last time
  608.                                        the folder was closed.
  609.                                        */
  610. #define MSG_FLAG_IGNORED    0x40000 /* the thread is ignored */
  611.  
  612.  
  613. #define MSG_FLAG_IMAP_DELETED    0x200000 /* message is marked deleted on the server */
  614.  
  615. #define MSG_FLAG_MDN_REPORT_NEEDED 0x400000 /* This msg required to send an MDN 
  616.                                              * to the sender of the message
  617.                                              */
  618. #define MSG_FLAG_MDN_REPORT_SENT   0x800000 /* An MDN report message has been
  619.                                              * sent for this message. No more
  620.                                              * MDN report should be sent to the
  621.                                              * sender
  622.                                              */
  623. #define MSG_FLAG_TEMPLATE       0x1000000    /* this message is a template */
  624. #define MSG_FLAG_ATTACHMENT        0x10000000    /* this message has files attached to it */
  625.  
  626. /* Flags about a folder or a newsgroup.  Used in the MSG_FolderLine struct;
  627.    also used internally in libmsg (the `flags' slot in MSG_Folder).  Note that
  628.    these don't have anything to do with the above MSG_FLAG flags; they belong
  629.    to different objects entirely.  */
  630.  
  631.     /* These flags say what kind of folder this is:
  632.        mail or news, directory or leaf.
  633.      */
  634. #define MSG_FOLDER_FLAG_NEWSGROUP   0x0001  /* The type of this folder. */
  635. #define MSG_FOLDER_FLAG_NEWS_HOST   0x0002  /* Exactly one of these three */
  636. #define MSG_FOLDER_FLAG_MAIL        0x0004  /* flags will be set. */
  637.  
  638. #define MSG_FOLDER_FLAG_DIRECTORY   0x0008  /* Whether this is a directory:
  639.                                                NEWS_HOSTs are always
  640.                                                directories; NEWS_GROUPs can be
  641.                                                directories if we are in ``show
  642.                                                all groups'' mode; MAIL folders
  643.                                                will have this bit if they are
  644.                                                really directories, not files.
  645.                                                (Note that directories may have
  646.                                                zero children.) */
  647.  
  648. #define MSG_FOLDER_FLAG_ELIDED      0x0010  /* Whether the children of this
  649.                                                folder are currently hidden in
  650.                                                the listing.  This will only
  651.                                                be present if the DIRECTORY
  652.                                                bit is on. */
  653.  
  654.     /* These flags only occur in folders which have
  655.        the MSG_FOLDER_FLAG_NEWSGROUP bit set, and do
  656.        not have the MSG_FOLDER_FLAG_DIRECTORY or
  657.        MSG_FOLDER_FLAG_ELIDED bits set.
  658.      */
  659.  
  660. #define MSG_FOLDER_FLAG_MODERATED   0x0020  /* Whether this folder represents
  661.                                                a moderated newsgroup. */
  662. #define MSG_FOLDER_FLAG_SUBSCRIBED  0x0040  /* Whether this folder represents
  663.                                                a subscribed newsgroup. */
  664. #define MSG_FOLDER_FLAG_NEW_GROUP   0x0080  /* A newsgroup which has just
  665.                                                been added by the `Check
  666.                                                New Groups' command. */
  667.  
  668.  
  669.     /* These flags only occur in folders which have
  670.        the MSG_FOLDER_FLAG_MAIL bit set, and do
  671.        not have the MSG_FOLDER_FLAG_DIRECTORY or
  672.        MSG_FOLDER_FLAG_ELIDED bits set.
  673.  
  674.        The numeric order of these flags is important;
  675.        folders with these flags on get displayed first,
  676.        in reverse numeric order, before folders that have
  677.        none of these flags on.  (Note that if a folder is,
  678.        say, *both* inbox and sentmail, then its numeric value
  679.        will be even bigger, and so will bubble up to where the
  680.        inbox generally is.  What a hack!)
  681.      */
  682.  
  683. #define MSG_FOLDER_FLAG_TRASH       0x0100  /* Whether this is the trash
  684.                                                folder. */
  685. #define MSG_FOLDER_FLAG_SENTMAIL    0x0200    /* Whether this is a folder that
  686.                                                sent mail gets delivered to.
  687.                                                This particular magic flag is
  688.                                                used only during sorting of
  689.                                                folders; we generally don't care
  690.                                                otherwise. */
  691. #define MSG_FOLDER_FLAG_DRAFTS      0x0400    /* Whether this is the folder in
  692.                                                which unfinised, unsent messages
  693.                                                are saved for later editing. */
  694. #define MSG_FOLDER_FLAG_QUEUE       0x0800  /* Whether this is the folder in
  695.                                                which messages are queued for
  696.                                                later delivery. */
  697. #define MSG_FOLDER_FLAG_INBOX       0x1000  /* Whether this is the primary
  698.                                                inbox folder. */
  699. #define MSG_FOLDER_FLAG_IMAPBOX        0x2000    /* Whether this folder on online
  700.                                                IMAP */
  701.  
  702. #define MSG_FOLDER_FLAG_CAT_CONTAINER 0x4000 /* This group contains categories */
  703.  
  704. #define MSG_FOLDER_FLAG_PROFILE_GROUP 0x8000 /* This is a virtual newsgroup */
  705.  
  706. #define MSG_FOLDER_FLAG_CATEGORY    0x10000  /* this is a category */
  707.  
  708. #define MSG_FOLDER_FLAG_GOT_NEW        0x20000        /* folder got new msgs */
  709.  
  710. #define MSG_FOLDER_FLAG_IMAP_SERVER    0x40000        /* folder is an IMAP server */
  711.  
  712. #define MSG_FOLDER_FLAG_IMAP_PERSONAL    0x80000        /* folder is an IMAP personal folder */
  713.  
  714. #define MSG_FOLDER_FLAG_IMAP_PUBLIC        0x100000        /* folder is an IMAP public folder */
  715.  
  716. #define MSG_FOLDER_FLAG_IMAP_OTHER_USER    0x200000        /* folder is another user's IMAP folder */
  717.                                                         /* Think of it like a folder that someone would share. */
  718. #define MSG_FOLDER_FLAG_TEMPLATES        0x400000    /* Whether this is the template folder */
  719.  
  720. #define MSG_FOLDER_FLAG_PERSONAL_SHARED    0x800000    /* This folder is one of your personal folders that
  721.                                 `                       is shared with other users */
  722.  
  723. /* Flags in the subscribe pane (used inside of MSG_GroupNameLine).  Where
  724.    the flags overlap with the MSG_FOLDER_FLAG_* flags, it has the same value,
  725.    to reduce the chance of someone using the wrong constant. */
  726.  
  727. #define MSG_GROUPNAME_FLAG_ELIDED        0x0010  /* Whether the children of this
  728.                                                    group are currently hidden
  729.                                                    in the listing.  This will
  730.                                                    only be present if it has
  731.                                                    any children. */
  732.  
  733. #define MSG_GROUPNAME_FLAG_MODERATED    0x0020  /* Whether this folder
  734.                                                    represents a moderated
  735.                                                    newsgroup. */
  736. #define MSG_GROUPNAME_FLAG_SUBSCRIBED    0x0040  /* Whether this folder
  737.                                                    represents a subscribed
  738.                                                    newsgroup. */
  739. #define MSG_GROUPNAME_FLAG_NEW_GROUP    0x0080  /* A newsgroup which has just
  740.                                                    been added by the `Check
  741.                                                    New Groups' command. */
  742. #define MSG_GROUPNAME_FLAG_HASCHILDREN    0x40000 /* Whether there are children
  743.                                                   of this group.  Whether those
  744.                                                   chilren are visible in this
  745.                                                   list is determined by the
  746.                                                   above "ELIDED" flag. 
  747.                                                   Setting this to the same value
  748.                                                   as a MSG_FOLDER_FLAG_* IMAP server,
  749.                                                   since an IMAP _server_ will never
  750.                                                   appear in the subscribe pane.  */
  751. #define MSG_GROUPNAME_FLAG_IMAP_PERSONAL    0x80000        /* folder is an IMAP personal folder */
  752.  
  753. #define MSG_GROUPNAME_FLAG_IMAP_PUBLIC        0x100000        /* folder is an IMAP public folder */
  754.  
  755. #define MSG_GROUPNAME_FLAG_IMAP_OTHER_USER    0x200000        /* folder is another user's IMAP folder */
  756.  
  757. #define MSG_GROUPNAME_FLAG_IMAP_NOSELECT    0x400000        /* A \NoSelect IMAP folder */
  758.  
  759. #define MSG_GROUPNAME_FLAG_PERSONAL_SHARED    0x800000    /* whether or not this folder is one of your personal folders that
  760.                                 `                           is shared with other users */
  761.  
  762.  
  763. /* This set enumerates the header fields which may be displayed in the
  764.    message composition window.
  765.  */
  766. typedef uint32 MSG_HEADER_SET;
  767. #define MSG_FROM_HEADER_MASK                0x00000001
  768. #define MSG_REPLY_TO_HEADER_MASK            0x00000002
  769. #define MSG_TO_HEADER_MASK                    0x00000004
  770. #define MSG_CC_HEADER_MASK                    0x00000008
  771. #define MSG_BCC_HEADER_MASK                    0x00000010
  772. #define MSG_FCC_HEADER_MASK                    0x00000020
  773. #define MSG_NEWSGROUPS_HEADER_MASK            0x00000040
  774. #define MSG_FOLLOWUP_TO_HEADER_MASK            0x00000080
  775. #define MSG_SUBJECT_HEADER_MASK                0x00000100
  776. #define MSG_ATTACHMENTS_HEADER_MASK            0x00000200
  777.  
  778. /* These next four are typically not ever displayed in the UI, but are still
  779.    stored and used internally. */
  780. #define MSG_ORGANIZATION_HEADER_MASK        0x00000400
  781. #define MSG_REFERENCES_HEADER_MASK            0x00000800
  782. #define MSG_OTHERRANDOMHEADERS_HEADER_MASK    0x00001000
  783. #define MSG_NEWSPOSTURL_HEADER_MASK            0x00002000
  784.  
  785. #define MSG_PRIORITY_HEADER_MASK            0x00004000
  786. #define MSG_NEWS_FCC_HEADER_MASK            0x00008000
  787. #define MSG_MESSAGE_ENCODING_HEADER_MASK    0x00010000
  788. #define MSG_CHARACTER_SET_HEADER_MASK        0x00020000
  789. #define MSG_MESSAGE_ID_HEADER_MASK            0x00040000
  790. #define MSG_NEWS_BCC_HEADER_MASK            0x00080000
  791.  
  792. /* This is also not exposed to the UI; it's used internally to help remember
  793.    whether the original message had an HTML portion that we can quote. */
  794. #define MSG_HTML_PART_HEADER_MASK            0x00100000
  795.  
  796. /* The "body=" pseudo-header (as in "mailto:me?body=hi+there") */
  797. #define MSG_DEFAULTBODY_HEADER_MASK            0x00200000
  798.  
  799. #define MSG_X_TEMPLATE_HEADER_MASK          0x00400000
  800.  
  801. /* IMAP folders for posting */
  802. #define MSG_IMAP_FOLDER_HEADER_MASK            0x02000000
  803.  
  804. typedef enum {
  805.     MSG_RETURN_RECEIPT_BOOL_HEADER_MASK = 0,
  806.     MSG_ENCRYPTED_BOOL_HEADER_MASK,
  807.     MSG_SIGNED_BOOL_HEADER_MASK,
  808.     MSG_UUENCODE_BINARY_BOOL_HEADER_MASK,
  809.     MSG_ATTACH_VCARD_BOOL_HEADER_MASK,
  810.     MSG_LAST_BOOL_HEADER_MASK            /* last boolean header mask; must be the last one 
  811.                                          * DON'T remove.
  812.                                          */
  813. } MSG_BOOL_HEADER_SET;
  814.  
  815.  
  816.  
  817.  
  818. /* ===========================================================================
  819.                            TYPES AND STRUCTS
  820.    ===========================================================================
  821.  */
  822.  
  823.  
  824. /* 
  825.     These can be passed to MSG_Navigate and MSG_NavigateStatus
  826.  */
  827. typedef enum MSG_MotionType {
  828.   MSG_FirstMessage,
  829.   MSG_NextMessage,
  830.   MSG_PreviousMessage,
  831.   MSG_LastMessage,
  832.   MSG_FirstUnreadMessage,
  833.   MSG_NextUnreadMessage,
  834.   MSG_PreviousUnreadMessage,
  835.   MSG_LastUnreadMessage,
  836.   MSG_NextUnreadThread,
  837.   MSG_NextCategory,
  838.   MSG_NextUnreadCategory,
  839.   MSG_NextUnreadGroup,
  840.   MSG_NextFolder,
  841.   MSG_ReadMore,
  842.   MSG_LaterMessage,
  843.   MSG_Back,                        /* t,m: Go back to theprevious visited message */
  844.   MSG_Forward,                    /* t,m: Go forward to the previous visited message. */
  845.   MSG_FirstFlagged,
  846.   MSG_NextFlagged,
  847.   MSG_PreviousFlagged,
  848.   MSG_FirstNew,
  849.   MSG_EditUndo,
  850.   MSG_EditRedo
  851. } MSG_MotionType;
  852.  
  853.  
  854. /* The different views a subscribepane supports. */
  855. typedef enum MSG_SubscribeMode {
  856.     MSG_SubscribeAll,
  857.     MSG_SubscribeSearch,
  858.     MSG_SubscribeNew
  859. } MSG_SubscribeMode;
  860.  
  861.  
  862. /* Backtrack state */
  863. typedef enum MSG_BacktrackState {
  864.     MSG_BacktrackIdle,
  865.     MSG_BacktrackBackward,
  866.     MSG_BacktrackForward
  867. } MSG_BacktrackState;
  868.  
  869.  
  870. /* INSTANCES of MSG_Prefs are used to communicate to the msglib what the values
  871.    of various preferences are.  It's really a temporary hack; I hope a more
  872.    general XP method of preferences evolves instead. */
  873.  
  874. #ifdef XP_CPLUSPLUS
  875. class MSG_Prefs;
  876. #else
  877. typedef struct MSG_Prefs MSG_Prefs;
  878. #endif
  879.  
  880.  
  881. /* Instances of MSG_Master represent the entire universe of either mail or
  882.    news. */
  883.  
  884. #ifdef XP_CPLUSPLUS
  885. class MSG_Master;
  886. #else
  887. typedef struct MSG_Master MSG_Master;
  888. #endif
  889.  
  890.  
  891.  
  892.  
  893. /* The various types of panes available. */
  894.  
  895. typedef enum {
  896.   MSG_ANYPANE,                    
  897.   MSG_PANE,                        /* vanilla MSG_Pane, probably just a placeholder
  898.                                     for MSG_ProgressPane */
  899.  
  900.   MSG_MAILINGLISTPANE,
  901.   MSG_ADDRPANE,
  902.   MSG_FOLDERPANE,
  903.   MSG_THREADPANE,
  904.   MSG_MESSAGEPANE,
  905.   MSG_COMPOSITIONPANE,
  906.   MSG_SEARCHPANE,
  907.   MSG_SUBSCRIBEPANE,
  908.   AB_CONTAINERPANE,
  909.   AB_ABPANE,
  910.   AB_MAILINGLISTPANE,
  911.   AB_PERSONENTRYPANE
  912. } MSG_PaneType;
  913.  
  914.  
  915.  
  916.  
  917. /* MSG_ViewIndex is an index into the list of messages or folders or groups,
  918.    where zero is the first one to show, one is the second, etc... */
  919. typedef uint32 MSG_ViewIndex;
  920. typedef MSG_ViewIndex MsgViewIndex; 
  921.  
  922. /* MSG_VIEWINDEXNONE is used to indicate an invalid or non-existent index. */
  923. #ifdef XP_CPLUSPLUS
  924. const MSG_ViewIndex MSG_VIEWINDEXNONE = 0xffffffff;
  925. #else
  926. #define MSG_VIEWINDEXNONE 0xffffffff
  927. #endif
  928.  
  929. /* imap message flags */
  930. typedef uint16 imapMessageFlagsType;
  931.  
  932.  
  933. /* MessageKey is a unique ID for a particular message in a folder.  If you want
  934.    a handle to a message that will remain valid even after resorting the folder
  935.    or otherwise changing their indices, you want one of these rather than a
  936.    MSG_ViewIndex. */
  937. typedef uint32 MessageKey;
  938. /* in the process of removing because of confusion with message-id string */
  939. typedef uint32 MessageId;    
  940.  
  941. /* MSG_MESSAGEKEYNONE is used to indicate an invalid or non-existant message. */
  942. #ifdef XP_CPLUSPLUS
  943. const MessageId MSG_MESSAGEIDNONE = 0xffffffff;
  944. const MessageKey MSG_MESSAGEKEYNONE = 0xffffffff;
  945. #else
  946. #define MSG_MESSAGEIDNONE 0xffffffff
  947. #define MSG_MESSAGEKEYNONE 0xffffffff
  948. #endif
  949.  
  950.  
  951. /* Similarly, MSG_FolderInfo* is a unique ID for a particular folder. */
  952.  
  953. #ifdef XP_CPLUSPLUS
  954. class MSG_FolderInfo;
  955. #else
  956. typedef struct MSG_FolderInfo *MSG_FolderInfo;
  957. #endif
  958.  
  959.  
  960. /* And MSG_GroupName is a unique ID for a group name in the subscribe pane. */
  961.  
  962. #ifdef XP_CPLUSPLUS
  963. class MSG_GroupName;
  964. #else
  965. typedef struct MSG_GroupName *MSG_GroupName;
  966. #endif
  967.  
  968.  
  969. /* MSG_NewsHost represents a newsserver that we know about. */
  970.  
  971. #ifdef XP_CPLUSPLUS
  972. class MSG_NewsHost;
  973. #else
  974. typedef struct MSG_NewsHost *MSG_NewsHost;
  975. #endif
  976.  
  977.  
  978. /* MSG_IMAPHost represents an imap server that we know about. */
  979.  
  980. #ifdef XP_CPLUSPLUS
  981. class MSG_IMAPHost;
  982. #else
  983. typedef struct MSG_IMAPHost *MSG_IMAPHost;
  984. #endif
  985.  
  986.  
  987. /* MSG_Host represents a news or imap server that we know about. */
  988.  
  989. /* SUBSCRIBE_USE_OLD_API: REVISIT */
  990. #ifdef XP_CPLUSPLUS
  991. class MSG_Host;
  992. #else
  993. typedef struct MSG_Host *MSG_Host;
  994. #endif /* XP_CPLUSPLUS */
  995.  
  996.  
  997. /* used in MWContext to communicate IMAP stuff between libmsg and libnet */
  998.  
  999. #ifdef XP_CPLUSPLUS
  1000. class MSG_IMAPFolderInfoMail;
  1001. class TImapServerState;
  1002. class TNavigatorImapConnection;
  1003. #else
  1004. typedef struct MSG_IMAPFolderInfoMail *MSG_IMAPFolderInfoMail;
  1005. typedef struct TImapServerState *TImapServerState;
  1006. typedef struct TNavigatorImapConnection TNavigatorImapConnection;
  1007. #endif
  1008.  
  1009. struct MSG_AttachmentData
  1010. {
  1011.   char *url;            /* The URL to attach.
  1012.                            This should be 0 to signify "end of list".
  1013.                          */
  1014.  
  1015.   char *desired_type;    /* The type to which this document should be
  1016.                            converted.  Legal values are NULL, TEXT_PLAIN
  1017.                            and APPLICATION_POSTSCRIPT (which are macros
  1018.                            defined in net.h); other values are ignored.
  1019.                          */
  1020.  
  1021.   char *real_type;        /* The type of the URL if known, otherwise NULL.
  1022.                            For example, if you were attaching a temp file
  1023.                            which was known to contain HTML data, you would
  1024.                            pass in TEXT_HTML as the real_type, to override
  1025.                            whatever type the name of the tmp file might
  1026.                            otherwise indicate.
  1027.                          */
  1028.   char *real_encoding;    /* Goes along with real_type */
  1029.  
  1030.   char *real_name;        /* The original name of this document, which will
  1031.                            eventually show up in the Content-Disposition
  1032.                            header.  For example, if you had copied a
  1033.                            document to a tmp file, this would be the
  1034.                            original, human-readable name of the document.
  1035.                          */
  1036.  
  1037.   char *description;    /* If you put a string here, it will show up as
  1038.                            the Content-Description header.  This can be
  1039.                            any explanatory text; it's not a file name.
  1040.                          */
  1041.  
  1042.   char *x_mac_type, *x_mac_creator;
  1043.                         /* Mac-specific data that should show up as optional parameters
  1044.                            to the content-type header.
  1045.                          */
  1046. };
  1047.  
  1048.  
  1049. /* This structure is the interface between compose.c and composew.c.
  1050.    When we have downloaded a URL to a tmp file for attaching, this
  1051.    represents everything we learned about it (and did to it) in the
  1052.    process. 
  1053.  */
  1054. /* Used by libmime -- mimedrft.c
  1055.  * Front end shouldn't use this structure.
  1056.  */
  1057. typedef struct MSG_AttachedFile
  1058. {
  1059.   char *orig_url;        /* Where it came from on the network (or even elsewhere
  1060.                            on the local disk.)
  1061.                          */
  1062.   char *file_name;        /* The tmp file in which the (possibly converted) data
  1063.                            now resides.
  1064.                         */
  1065.   char *type;            /* The type of the data in file_name (not necessarily
  1066.                            the same as the type of orig_url.)
  1067.                          */
  1068.   char *encoding;        /* Likewise, the encoding of the tmp file.
  1069.                            This will be set only if the original document had
  1070.                            an encoding already; we don't do base64 encoding and
  1071.                            so forth until it's time to assemble a full MIME
  1072.                            message of all parts.
  1073.                          */
  1074.  
  1075.   /* #### I'm not entirely sure where this data is going to come from...
  1076.    */
  1077.   char *description;                    /* For Content-Description header */
  1078.   char *x_mac_type, *x_mac_creator;        /* mac-specific info */
  1079.   char *real_name;                        /* The real name of the file. */
  1080.  
  1081.   /* Some statistics about the data that was written to the file, so that when
  1082.      it comes time to compose a MIME message, we can make an informed decision
  1083.      about what Content-Transfer-Encoding would be best for this attachment.
  1084.      (If it's encoded already, we ignore this information and ship it as-is.)
  1085.    */
  1086.   uint32 size;
  1087.   uint32 unprintable_count;
  1088.   uint32 highbit_count;
  1089.   uint32 ctl_count;
  1090.   uint32 null_count;
  1091.   uint32 max_line_length;
  1092.   
  1093.   XP_Bool decrypted_p;    /* S/MIME -- when attaching a message that was
  1094.                            encrypted, it's necessary to decrypt it first
  1095.                            (since nobody but the original recipient can read
  1096.                            it -- if you forward it to someone in the raw, it
  1097.                            will be useless to them.)  This flag indicates
  1098.                            whether decryption occurred, so that libmsg can
  1099.                            issue appropriate warnings about doing a cleartext
  1100.                            forward of a message that was originally encrypted.
  1101.                          */
  1102. } MSG_AttachedFile;
  1103.  
  1104.  
  1105.  
  1106. /* This structure represents a single line in the folder pane.
  1107.  */
  1108. typedef struct MSG_FolderLine
  1109. {
  1110.   MSG_FolderInfo* id;
  1111.   const char* name;                /* The name of the folder to display. */
  1112.   const char* prettyName;        /* The pretty name to display */
  1113.   uint8 level;                    /* How many parent folders we have. */
  1114.   uint32 flags;
  1115.   uint32 prefFlags;
  1116.  
  1117.   /* The below are used only if the icon type is MSG_NewsgroupIcon or
  1118.      MSG_FolderIcon. */
  1119.   int32 unseen;                    /* Number of unseen articles. (If negative,
  1120.                                    then we don't know yet; display question
  1121.                                    marks or something.*/
  1122.   int32 total;                    /* Total number of articles. */
  1123.   uint16 numChildren;            /* How many immediate children of this folder
  1124.                                    exist. */
  1125.   int32 deepUnseen;             /* Totals for this and child folders */
  1126.   int32 deepTotal; 
  1127.   int32 deletedBytes;            /* mail only - total size of deleted messages */
  1128. } MSG_FolderLine;
  1129.  
  1130.  
  1131. /* This structure represents a single line in the thread pane.
  1132.  */
  1133. typedef struct MSG_MessageLine
  1134. {
  1135.     MessageKey   threadId;         /* (article # of thread - article could be
  1136.                                    expired) */
  1137.     MessageKey    messageKey;     /* news: article num, mail: mbox offset */
  1138.     char        subject[MSG_MAXSUBJECTLENGTH];
  1139.     char        author[MSG_MAXAUTHORLENGTH];
  1140.     time_t         date;                         
  1141.  
  1142.     uint32        messageLines;    /* Number of lines in this message. */
  1143.     uint32        flags;
  1144.     MSG_PRIORITY priority;        /* message priority (mail only?) */
  1145.     uint16        numChildren;    /* for top-level threads */
  1146.     uint16        numNewChildren;    /* for top-level threads */
  1147.     int8        level;            /* indentation level */
  1148. } MSG_MessageLine;
  1149.  
  1150. /* This structure represents a single line in the subscribe pane.
  1151.  */
  1152.  
  1153. typedef struct MSG_GroupNameLine
  1154. {
  1155.     char name[MSG_MAXGROUPNAMELENGTH];
  1156.     int8 level;
  1157.     uint32 flags;
  1158.     int32 total;
  1159. } MSG_GroupNameLine;
  1160.  
  1161. /* This structure is used as an annotation about the font and size information
  1162.    included in a text string passed to us by the front end after the user has
  1163.    edited their message.
  1164.  */
  1165. typedef struct MSG_FontCode
  1166. {
  1167.   uint32 pos;
  1168.   uint32 length;
  1169.   MSG_FONT font;
  1170.   uint8 font_size;
  1171.   XP_Bool fixed_width_p;
  1172. } MSG_FontCode;
  1173.  
  1174.  
  1175.  
  1176. /* MSG_CompositionFields represents the desired initial state of the various
  1177.    fields in a composition.  */
  1178.  
  1179.  
  1180. #ifdef XP_CPLUSPLUS
  1181. class MSG_CompositionFields;
  1182. #else
  1183. typedef struct MSG_CompositionFields MSG_CompositionFields;
  1184. #endif
  1185.  
  1186.  
  1187. /* MSG_HTMLComposeAction lists what action to take with a message composed
  1188.    with HTML. */
  1189.  
  1190. typedef enum {
  1191.     MSG_HTMLAskUser,
  1192.     MSG_HTMLUseMultipartAlternative,
  1193.     MSG_HTMLConvertToPlaintext,
  1194.     MSG_HTMLSendAsHTML
  1195. } MSG_HTMLComposeAction;
  1196.  
  1197. /* MSG_RecipientList specifies a list of recipients to be displayed in the
  1198.    recipients dialog box.  It is terminated by an entry which has name set to
  1199.    NULL and value set to something negative. */
  1200. typedef struct {
  1201.     int32 value;
  1202.     const char* name;
  1203. } MSG_RecipientList;
  1204.  
  1205.  
  1206.  
  1207.  
  1208. /* Secure mail related
  1209.  */
  1210. typedef enum {
  1211.     certNone,
  1212.     certValid,
  1213.     certExpired,
  1214.     certRevoked
  1215. } MSG_CertStatus;
  1216.  
  1217. typedef struct {
  1218.     char *PrettyName;
  1219.     char *EmailAddress;
  1220.     MSG_CertStatus CertStatus;
  1221. } MSG_CertInfo;
  1222.  
  1223. typedef enum
  1224. {
  1225.     msgNoRecipients = 0,
  1226.     msgNoCerts = 1,
  1227.     msgHasCerts = 2,
  1228.     msgSomeCerts = 4
  1229. } MSG_SecurityLevel;
  1230.  
  1231. typedef enum
  1232. {
  1233.     crypto_RC4_40bit,
  1234.     crypto_RC4_128bit
  1235. } MSG_CryptoGrade;
  1236.  
  1237.  
  1238. typedef struct {
  1239.     /* DoFetchGroups() requests the front end do a
  1240.        MSG_Command(MSG_FetchGroupList) on the subscribe pane, also doing
  1241.        whatever side effects the front end usually does on such a request. */
  1242.     void (*DoFetchGroups)(MSG_Pane* pane, void* closure);
  1243.  
  1244.     /* FetchCompleted() tells the FE that a MSG_FetchGroupList or
  1245.        MSG_CheckForNew command has completed. */
  1246.     void (*FetchCompleted)(MSG_Pane* pane, void* closure);
  1247. } MSG_SubscribeCallbacks;
  1248.  
  1249.  
  1250. typedef struct {
  1251.     /* AttachmentCount() tells the FE the number of attachments currently
  1252.        known for the message being displayed in the given messagepane.  
  1253.        finishedloading is TRUE iff we have finished loading the message.
  1254.        If finishedloading is FALSE, then the FE must be prepared to have this
  1255.        callback fire again soon, as more attachments may be found as
  1256.        downloading proceeds. */
  1257.     void (*AttachmentCount)(MSG_Pane* messagepane, void* closure,
  1258.                             int32 numattachments, XP_Bool finishedloading);
  1259.  
  1260.  
  1261.     /* UserWantsToSeeAttachments() gets called when the user clicks on the
  1262.        little "show me attachment info" at the top of a mail message.  */
  1263.     void (*UserWantsToSeeAttachments)(MSG_Pane* messagepane, void* closure);
  1264. } MSG_MessagePaneCallbacks;
  1265.  
  1266.  
  1267. typedef struct {
  1268.     /* CreateAskHTMLDialog() tells the FE to bring up the dialog that lets the
  1269.        user choose the disposition of this HTML composition.  If the user
  1270.        chooses a format for HTML and clicks "Send", then the FE must call
  1271.        MSG_SetHTMLAction() and return 0.  If the FE returns > 0, then
  1272.        the message send is cancelled.  If  the user presses the "Recipients" 
  1273.        button, then the the FE must call MSG_PutUpRecipientsDialog().  If the 
  1274.        FE does not provide this CreateAskHTMLDialog() callback, or if this 
  1275.        routine returns a negative number, then the back end will implement 
  1276.     it using HTML dialogs. */
  1277.     int (*CreateAskHTMLDialog)(MSG_Pane* composepane, void* closure);
  1278.  
  1279.  
  1280.     /* CreateRecipientsDialog() tells the FE to bring up the dialog that lets
  1281.        the user choose whether the recipients of a message can deal with HTML.
  1282.        The FE must notify the back end of the results by calling
  1283.        MSG_ResultsRecipients().  If the FE does not provide this callback, or
  1284.        if this routine returns a negative number, then the back end will
  1285.        implement it using HTML dialogs.
  1286.  
  1287.        The last two arguments specify the initial contents of the two scrolling
  1288.        lists.  The given strings are to be displayed; the given ID's are to be
  1289.        used in the call to MSG_ResultsRecipients().  (These ID's are also to be
  1290.        used as a sort key so that the recipient list is always displayed sorted
  1291.        in the right order.)  These structures are only valid for the length of
  1292.        this call; the FE must copy any data it needs out of them before the
  1293.        call returns. The void* pWnd parameter is used to pass the in parent window
  1294.        of the RecipientsDialog.*/
  1295.     int (*CreateRecipientsDialog)(MSG_Pane* composepane, void* closure,
  1296.                                   MSG_RecipientList* nohtml,
  1297.                                   MSG_RecipientList* htmlok,void* pWnd);
  1298.  
  1299.  
  1300. } MSG_CompositionPaneCallbacks;
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306. /* ===========================================================================
  1307.                                INIT / CREATE
  1308.    ===========================================================================
  1309.  */
  1310.  
  1311.  
  1312. XP_BEGIN_PROTOS
  1313.  
  1314. void MSG_InitMsgLib(void);  /* one-time initialization of libmsg */
  1315. void MSG_ShutdownMsgLib(void);      /* shut down LibMsg part of app. */
  1316.  
  1317. /* launch a url to compress mail folders and purge news dbs. */
  1318. XP_Bool MSG_CleanupNeeded(MSG_Master *master);
  1319. void MSG_CleanupFolders(MSG_Pane *pane); 
  1320.  
  1321. /* currently just to give db time to clean up */
  1322. void MSG_OnIdle(void);
  1323.  
  1324.  
  1325. int32 MSG_SetLibNeoCacheSize(int32 newCacheSize);
  1326.  
  1327. /* Initialize the mail/news universe.  A MSG_Master* object must be created
  1328.    before anything else can be done.  Only one MSG_Master* object can exist at
  1329.    any time.  */
  1330.  
  1331. extern MSG_Master* MSG_InitializeMail(MSG_Prefs* prefs);
  1332.  
  1333. /* Routines to create the various panes.  Those panes that require a true
  1334.    MWContext* take it as a parameter.  Any given thread pane is always
  1335.    associated with a particular folder pane; any given message pane is always
  1336.    associated with a particular thread pane.
  1337.  
  1338.    The entire creation process goes like this:
  1339.  
  1340.    - The FE decides to create a new pane.
  1341.  
  1342.      - The FE creates any necessary contexts and maybe some windows and stuff
  1343.    that it will associate with the pane.  
  1344.  
  1345.    - The FE calls MSG_Create*Pane() to create the pane object itself.  When
  1346.    creating a folderpane, the FE must also provide a pointer to a MSG_Prefs
  1347.    object that contains the preferences to be used for the folderpane.  The FE
  1348.    must be sure not to destroy that MSG_Prefs object as long as the folderpane
  1349.    exists. Any later change made to the MSG_Prefs will automatically be
  1350.    reflected in the folderpane and all related panes.  (Also note that when
  1351.    creating a folderpane, msglib uses the context type to determine whether
  1352.    this is for mail or news.)
  1353.  
  1354.    - The FE puts the resulting pane structure into its datastructures
  1355.    somewhere, and probably calls MSG_SetFEData() to assocatiate that
  1356.    datastructure with the pane.
  1357.  
  1358. */
  1359.  
  1360. extern MSG_Pane* MSG_CreateFolderPane(MWContext* context,
  1361.                                       MSG_Master* master);
  1362.  
  1363.  
  1364. extern MSG_Pane* MSG_CreateThreadPane(MWContext* context,
  1365.                                       MSG_Master* master);
  1366.  
  1367. extern MSG_Pane* MSG_CreateMessagePane(MWContext* context,
  1368.                                        MSG_Master* master);
  1369.  
  1370. extern int MSG_SetMessagePaneCallbacks(MSG_Pane* messagepane,
  1371.                                        MSG_MessagePaneCallbacks* callbacks,
  1372.                                        void* closure);
  1373.  
  1374. extern MSG_MessagePaneCallbacks*
  1375. MSG_GetMessagePaneCallbacks(MSG_Pane* messagepane, void** closure);
  1376.  
  1377.  
  1378. extern MSG_Pane* MSG_CreateCompositionPane(MWContext* context,
  1379.                                            MWContext* old_context,
  1380.                                            MSG_Prefs* prefs,
  1381.                                            MSG_CompositionFields* fields,
  1382.                                            MSG_Master* master);
  1383.  
  1384. extern int
  1385. MSG_SetCompositionPaneCallbacks(MSG_Pane* composepane,
  1386.                                 MSG_CompositionPaneCallbacks* callbacks,
  1387.                                 void* closure);
  1388.  
  1389. /* Typically, progress panes come down when you receive all connections complete,
  1390.     or you get a FE_PaneChanged MSG_PaneProgressDone, which gets sent when a
  1391.     command runs in a progress pane which doesn't launch a url.
  1392. */
  1393. extern MSG_Pane* MSG_CreateProgressPane (MWContext *context,
  1394.                                          MSG_Master *master,
  1395.                                          MSG_Pane *parentPane);
  1396.  
  1397. /* WinFE (at least) has found that creating the composition pane in one swell
  1398.    foop is too much to handle.  They really want to create the pane pointer,
  1399.    but not start its initializing until some later point.  (The reason this is
  1400.    nasty is that composition pane initialization can sometimes happen in the
  1401.    background as we download attachments.)  So, if you don't want to call
  1402.    MSG_CreateCompositionPane(), you can instead call
  1403.    MSG_CreateCompositionPaneNoInit() and then soon call
  1404.    MSG_InitializeCompositionPane().  What fun. */
  1405.  
  1406. extern MSG_Pane* MSG_CreateCompositionPaneNoInit(MWContext* context,
  1407.                                                  MSG_Prefs* prefs,
  1408.                                                  MSG_Master* master);
  1409.  
  1410. extern int MSG_InitializeCompositionPane(MSG_Pane* comppane, 
  1411.                                          MWContext* old_context,
  1412.                                          MSG_CompositionFields* fields);
  1413.  
  1414.  
  1415.  
  1416.  
  1417. extern MSG_Pane* MSG_CreateSearchPane (MWContext *context,
  1418.                                        MSG_Master *master);
  1419.  
  1420. #ifdef SUBSCRIBE_USE_OLD_API
  1421. /* This routine is obsoleted; instead, use MSG_CreateSubscribePaneOnHost(). */
  1422. extern MSG_Pane* MSG_CreateSubscribePane(MWContext* context,
  1423.                                          MSG_Master* master);
  1424.  
  1425. /* Bring up the subscribe UI on the given newshost.  If host is NULL,
  1426.    uses the default newshost. */
  1427. extern MSG_Pane* MSG_CreateSubscribePaneOnHost(MWContext* context,
  1428.                                                MSG_Master* master,
  1429.                                                MSG_NewsHost* host);
  1430. #endif /* SUBSCRIBE_USE_OLD_API */
  1431.  
  1432. /* Bring up the subscribe UI on the given news or imap host.
  1433.    If host is NULL, uses the default newshost. */
  1434. extern MSG_Pane* MSG_CreateSubscribePaneForHost(MWContext* context,
  1435.                                                MSG_Master* master,
  1436.                                                MSG_Host* host);
  1437.  
  1438.  
  1439. /* Tells the FEs to bring up the subscribe UI on the given news
  1440.    or imap host. */
  1441. extern XP_Bool FE_CreateSubscribePaneOnHost(MSG_Master* master,
  1442.                                             MWContext* parentContext,
  1443.                                             MSG_Host* host);
  1444.  
  1445. /* Message compositions sometimes (usually) get kicked off by the backend
  1446.    (like, the user clicks on a "mailto" link).  So, this call requests the FE
  1447.    to create a new context, and call MSG_CreateCompositionPane and bring up a
  1448.    composition window.  The given context and MSG_CompositionFields* are to be
  1449.    passed on to MSG_CreateCompositionPane(), and lets the backend know what the
  1450.    initial values of all the fields are to be.  The FE should then query the
  1451.    pane (using MSG_GetCompHeader() and MSG_GetCompBody()) so that it can find
  1452.    out what to display in the UI.
  1453.  
  1454.    The FE should bring up either the plaintext composition or the html
  1455.    composition window, depending on the user's preference.  One exception,
  1456.    though: the FE must first check MSG_GetForcePlainText().  If TRUE, then
  1457.    we are replying to a plaintext message, and the FE *must* bring up the
  1458.    plaintext composition window.
  1459.  
  1460.  */
  1461.  
  1462.  
  1463. extern MSG_Pane* FE_CreateCompositionPane(MWContext* old_context,
  1464.                                           MSG_CompositionFields* fields,
  1465.                                           const char* initialText,
  1466.                                           MSG_EditorType editorType);
  1467.  
  1468.  
  1469.  
  1470.  
  1471. /* ===========================================================================
  1472.                            RANDOM CORE FUNCTIONS (to sort)
  1473.    ===========================================================================
  1474.  */
  1475.  
  1476.  
  1477. /* Due to addition of Java/JavaScript MailNews API, other things in addition
  1478.    to composition can be kicked off by the backend, so we provide the
  1479.    following FE functions to handle those cases.
  1480. */
  1481.  
  1482. /* Ask the FE for the current master.  FE should create one if it doesn't exist */
  1483. extern MSG_Master* FE_GetMaster();
  1484.  
  1485. /* Routines to associate or get arbitrary FE-specific data from a pane. */
  1486.  
  1487. extern void MSG_SetFEData(MSG_Pane* pane, void* data);
  1488. extern void* MSG_GetFEData(MSG_Pane* pane);
  1489.  
  1490. /* Routines to to special things when Netscape mail is not being used */
  1491.  
  1492. extern XP_Bool FE_IsAltMailUsed(MWContext * context);
  1493.  
  1494. /* Routine to bring up the IMAP Subscription Upgrade dialog box    */
  1495. /* Return value based on selection:  Automatic = 0, Custom = 1 */
  1496.  
  1497. extern int FE_PromptIMAPSubscriptionUpgrade (MWContext * context);
  1498.  
  1499.  
  1500. /*  This function is called by the backend to notify the frontend details about 
  1501.     new mail state so that the FE can notify the stand-alone biff that something
  1502.     has changed.
  1503. */
  1504.  
  1505. #ifdef XP_WIN32        /* only supported on Win32 now */
  1506. typedef enum {
  1507.     MSG_IMAPHighWaterMark,            /* data is the IMAP UID highwater mark for the inbox */
  1508. } MSG_BiffInfoType;
  1509.  
  1510. #define FE_SetBiffInfoDefined        /*  this symbol used in the back-end to 
  1511.                                         know if FE_SetBiffInfo is defined */
  1512. extern uint32 FE_SetBiffInfo(MSG_BiffInfoType type, uint32 data);
  1513. #endif
  1514.  
  1515. /* run the url in the given pane. This will set the msg_pane member
  1516.    in url, interrupt the context, and then call FE_GetURL */
  1517. extern int MSG_GetURL(MSG_Pane *pane, URL_Struct* url);
  1518.  
  1519. /* routines to set and get the text type, setting true indicates that the
  1520.    text is HTML */
  1521.  
  1522. extern XP_Bool MSG_GetHTMLMarkup(MSG_Pane * composepane);
  1523. extern void MSG_SetHTMLMarkup(MSG_Pane * composepane,XP_Bool flag);
  1524.  
  1525. /* Returns the type of the given pane. */
  1526.  
  1527. extern MSG_PaneType MSG_GetPaneType(MSG_Pane* pane);
  1528.  
  1529.  
  1530. /* Finds a pane with the given type.  First, it looks for a pane which has the
  1531.    given context associated with it; failing that, it returns any pane it can
  1532.    find.
  1533.  */
  1534. extern MSG_Pane* MSG_FindPane(MWContext* context, MSG_PaneType type);
  1535.  
  1536. /* really find the pane of passed type with given context, NULL otherwise */
  1537. extern MSG_Pane *MSG_FindPaneOfContext (MWContext *context, MSG_PaneType type);
  1538.  
  1539. extern MSG_Pane *MSG_FindPaneOfType(MSG_Master *master, MSG_FolderInfo *id, MSG_PaneType type);
  1540.  
  1541. extern MSG_Pane *MSG_FindPaneFromUrl (MSG_Pane *pane, const char *url, MSG_PaneType type);
  1542.  
  1543. /* Returns the context associated with a given pane.  If this pane doesn't have
  1544.    a context (i.e., it's a threadpane), then it will return NULL. */
  1545.  
  1546. extern MWContext* MSG_GetContext(MSG_Pane* pane);
  1547.  
  1548.  
  1549. /* Returns the MSG_Prefs* object that is being used to determine the
  1550.    preferences for this pane. */
  1551.  
  1552. extern MSG_Prefs* MSG_GetPrefs(MSG_Pane* pane);
  1553.  
  1554.  
  1555. /* Returns the MSG_Prefs* object that is being used to determine the
  1556.    preferences for this master object. */
  1557.  
  1558. extern MSG_Prefs* MSG_GetPrefsForMaster(MSG_Master* master);
  1559.  
  1560.  
  1561. /* Returns the MSG_Master* object for the given pane. */
  1562.  
  1563. extern MSG_Master* MSG_GetMaster(MSG_Pane* pane);
  1564.  
  1565. extern XP_Bool MSG_DeliveryInProgress(MSG_Pane * composepane);
  1566.  
  1567.  
  1568. /* This is the front end's single interface to executing mail/news menu
  1569.    and toolbar commands.  See the comment above the definition of the
  1570.    MSG_CommandType enum.
  1571.  
  1572.    The indices and numindices arguments indicates which folders or threads are
  1573.    to be affected by this command.  For many commands, they'll be ignored.
  1574.    They should always be NULL if not specifying a folderpane or a threadpane.
  1575.  */
  1576. extern void MSG_Command (MSG_Pane* pane, MSG_CommandType command,
  1577.                          MSG_ViewIndex* indices, int32 numindices);
  1578.  
  1579.  
  1580. /* Before the front end displays any menu (each time), it should call this
  1581.    function for each command on that menu to determine how it should be
  1582.    displayed.
  1583.  
  1584.    selectable_p:    whether the user should be allowed to select this item;
  1585.                     if this is FALSE, the item should be grayed out.
  1586.  
  1587.    selected_p:        if this command is a toggle or multiple-choice menu item,
  1588.                     this will be MSG_Checked if the item should be `checked',
  1589.                     MSG_Unchecked if it should not be, and MSG_NotUsed if the
  1590.                     item is a `normal' menu item that never has a checkmark.
  1591.  
  1592.    display_string:    the string to put in the menu.  l10n handwave handwave.
  1593.  
  1594.    plural_p:        if it happens that you're not using display_string, then
  1595.                     this tells you whether the string you display in the menu
  1596.                     should be singular or plural ("Delete Message" versus
  1597.                     "Delete Selected Messages".)  If you're using
  1598.                     display_string, you don't need to look at this value.
  1599.  
  1600.    Returned value is negative if something went wrong.
  1601.  */
  1602. extern int MSG_CommandStatus (MSG_Pane* pane,
  1603.                               MSG_CommandType command,
  1604.                               MSG_ViewIndex* indices, int32 numindices,
  1605.                               XP_Bool *selectable_p,
  1606.                               MSG_COMMAND_CHECK_STATE *selected_p,
  1607.                               const char **display_string,
  1608.                               XP_Bool *plural_p);
  1609.  
  1610.  
  1611. /* Set the value of a toggle-style command to the given value.  Returns
  1612.    negative if something went wrong (like, you gave it a non-toggling
  1613.    command, or you passed in MSG_NotUsed for the check state.) */
  1614. extern int MSG_SetToggleStatus(MSG_Pane* pane, MSG_CommandType command,
  1615.                                MSG_ViewIndex* indices, int32 numindices,
  1616.                                MSG_COMMAND_CHECK_STATE value);
  1617.  
  1618. /* Queries whether the given toggle-style command is on or off. */
  1619. extern MSG_COMMAND_CHECK_STATE MSG_GetToggleStatus(MSG_Pane* pane,
  1620.                                                    MSG_CommandType command,
  1621.                                                    MSG_ViewIndex* indices,
  1622.                                                    int32 numindices);
  1623.  
  1624.  
  1625. /* Navigation commands */
  1626. extern int MSG_DataNavigate(MSG_Pane* pane, MSG_MotionType motion,
  1627.                         MessageKey startId, MessageKey *resultId, 
  1628.                         MessageKey *resultThreadId);
  1629.  
  1630. /* This routine will automatically expand the destination thread, if needs be. */
  1631. extern int MSG_ViewNavigate(MSG_Pane* pane, MSG_MotionType motion,
  1632.                         MSG_ViewIndex startIndex, 
  1633.                         MessageKey *resultId, MSG_ViewIndex *resultIndex, 
  1634.                         MSG_ViewIndex *pThreadIndex,
  1635.                         MSG_FolderInfo **folderInfo);
  1636.  
  1637. /* Indicates if navigation of the passed motion type is valid. */
  1638. extern int MSG_NavigateStatus (MSG_Pane* pane,
  1639.                               MSG_MotionType command,
  1640.                               MSG_ViewIndex index,
  1641.                               XP_Bool *selectable_p,
  1642.                               const char **display_string);
  1643.  
  1644. extern int MSG_MarkReadByDate (MSG_Pane* pane, time_t startDate, time_t endDate);
  1645.  
  1646. /* notification from Server Admin page via JavaScript that an imap folder has changed */
  1647. extern void MSG_IMAPFolderChangedNotification(const char *folder_url);
  1648.  
  1649. /* record the imap connection in the move state of the current context */
  1650. extern void MSG_StoreNavigatorIMAPConnectionInMoveState(MWContext *context, 
  1651.                                                         TNavigatorImapConnection *connection);
  1652.  
  1653. /* Determines whether we are currently actually showing the recipients
  1654.    in the "Sender" column of the display (because we are in the "sent"
  1655.    folder).  FE's should call this in their FE_UpdateToolbar to change
  1656.    the title of this column.*/
  1657.  
  1658. extern XP_Bool MSG_DisplayingRecipients(MSG_Pane* threadpane);
  1659.  
  1660.  
  1661.  
  1662.  
  1663. /* The msg library calls FE_ListChangeStarting() to tell the front end that the
  1664.    contents of the message or folder list are about to change.  It means that
  1665.    any MSG_ViewIndex values that the FE may be keeping around might become
  1666.    invalid.  The FE should adjust them, throw them out, or convert them into
  1667.    MessageKey or MSG_FolderInfo* values, instead.
  1668.  
  1669.    This call will be quickly followed by a matching call to
  1670.    FE_ListChangeFinished().
  1671.  
  1672.    The "asynchronous" flag will be TRUE if this change happened due to some
  1673.    completely asynchronous event, and FALSE if we are in the middle of a call
  1674.    to MSG_Command() or other calls from the FE that directly manipulate the
  1675.    msglib.  Some FE's (Mac) will choose to ignore these calls if asynchronous
  1676.    is FALSE, while other FE's (XFE) will likely ignore the parameter.
  1677.  
  1678.    The notify parameter describes what changed, along with the where and num
  1679.    parameters.  See the documentation in the declaration of MSG_NOTIFY_CODE,
  1680.    above. */
  1681.  
  1682. extern void FE_ListChangeStarting(MSG_Pane* pane, XP_Bool asynchronous,
  1683.                                   MSG_NOTIFY_CODE notify, MSG_ViewIndex where,
  1684.                                   int32 num);
  1685.  
  1686.  
  1687. /* FE_ListChangeFinished() gets called only after a call to
  1688.    FE_ListChangeStarting().  It means that it is safe for the FE to convert
  1689.    back from MessageKey or MSG_FolderInfo* into MSG_ViewIndex.  It's also a good
  1690.    clue that the FE ought to redisplay the list.  If the folderpane is given,
  1691.    then the FE probably will want to regenerate any list of folders presented
  1692.    in menus. */
  1693.  
  1694. extern void FE_ListChangeFinished(MSG_Pane* pane, XP_Bool asynchronous,
  1695.                                   MSG_NOTIFY_CODE notify, MSG_ViewIndex where,
  1696.                                   int32 num);
  1697.  
  1698. /*    The backend calls this when something changed about the pane other than the
  1699.     list. For example, if we load a different message into a message pane,
  1700.     we call FE_PaneChanged with a notify code of MSG_PaneNotifyMessageLoaded. Or, if
  1701.     the folder info for a folder displayed in a thread pane changes, 
  1702.     we call FE_PaneChanged with a notify code of MSG_PaneNotifyFolderInfoChanged.
  1703. */
  1704. extern void FE_PaneChanged(MSG_Pane *pane, XP_Bool asynchronous, 
  1705.                            MSG_PANE_CHANGED_NOTIFY_CODE, int32 value);
  1706.  
  1707. /* The front end calls this *after* it has handled the FE_PaneChanged notification.
  1708.    This function handles callbacks set up by back-end code to detect changes in the
  1709.    mail system.  Currently, it is used by the netscape.messaging.* classes
  1710.    to allow callbacks in the java classes when stuff in the mail backend changes.
  1711. */
  1712. extern void MSG_HandlePaneChangedNotifications(MSG_Pane *pane, XP_Bool asynchronous, 
  1713.                            MSG_PANE_CHANGED_NOTIFY_CODE, int32 value);
  1714.  
  1715. /* Declaration for backend pane change callback */
  1716. typedef void (*MSG_PANE_CHANGED_CALLBACK)(MSG_Pane *pane, XP_Bool asynchronous, 
  1717.                            MSG_PANE_CHANGED_NOTIFY_CODE, int32 value);
  1718.  
  1719. /* Registration function to register call backs.  Currently allows only one, but should
  1720.    be expanded to allow multiple observers */
  1721. extern void MSG_RegisterPaneChangedCallback(MSG_PANE_CHANGED_CALLBACK cb);
  1722.  
  1723. /* The front end can use this call to determine what the indentation depth is
  1724.    needed to display all the icons in the folder list.  The XFE uses this to
  1725.    dynamically resize the icon column. In true C style, the number returned is
  1726.    actually one bigger than the biggest depth the FE will ever get. */
  1727. extern int MSG_GetFolderMaxDepth(MSG_Pane* folderpane);
  1728.  
  1729.  
  1730. /* The front end uses these calls to determine what to display on particular
  1731.    lines in the outline lists.  They return TRUE on success, FALSE if the given
  1732.    line doesn't exist or if there are less than numlines worth of data to get.
  1733.    The given data pointer must point to an array of at least numlines
  1734.    elements. */
  1735.  
  1736. extern XP_Bool MSG_GetFolderLineByIndex(MSG_Pane* folderpane,
  1737.                                         MSG_ViewIndex firstline,
  1738.                                         int32 numlines,
  1739.                                         MSG_FolderLine* data);
  1740.  
  1741. /* get the flags for a folder w/o the whole MSG_FolderLine */
  1742. extern uint32 MSG_GetFolderFlags(MSG_FolderInfo *folder);
  1743.  
  1744. extern int32 MSG_GetFolderSizeOnDisk (MSG_FolderInfo *folder);
  1745. extern XP_Bool MSG_GetThreadLineByIndex(MSG_Pane* threadpane,
  1746.                                         MSG_ViewIndex firstline,
  1747.                                         int32 numlines,
  1748.                                         MSG_MessageLine* data);
  1749.  
  1750. extern int MSG_GetFolderLevelByIndex( MSG_Pane *folderpane,
  1751.                                       MSG_ViewIndex line );
  1752.  
  1753. extern int MSG_GetThreadLevelByIndex( MSG_Pane *threadpane,
  1754.                                       MSG_ViewIndex line );
  1755.  
  1756. /* If the FE wants to find out info about a particular folder or thread by its
  1757.    id rather than by its index, it can use these calls. */
  1758.  
  1759. extern XP_Bool MSG_GetFolderLineById(MSG_Master* master,
  1760.                                      MSG_FolderInfo* info,
  1761.                                      MSG_FolderLine* data);
  1762. extern XP_Bool MSG_GetThreadLineById(MSG_Pane* pane, /* thread or message */
  1763.                                      MessageKey id,
  1764.                                      MSG_MessageLine* data);
  1765.  
  1766. /* returns the view index of the first message in the thread containing key */
  1767. extern MSG_ViewIndex MSG_ThreadIndexOfMsg(MSG_Pane* pane, MessageKey key);
  1768.  
  1769. /* Takes a time (most likely, the one returned in the MSG_MessageLine
  1770.    structure by MSG_GetThreadLine()) and formats it into a compact textual
  1771.    representation (like "Thursday" or "09:53:17" or "10/3 16:15"), based on
  1772.    how that date relates to the current time.  This is returned in a
  1773.    statically allocated buffer; the caller should copy it somewhere. */
  1774. extern const char* MSG_FormatDate(MSG_Pane* pane, time_t date);
  1775.  
  1776. /* If you don't have a pane and need to format a date ... */
  1777. extern const char* MSG_FormatDateFromContext(MWContext *context, time_t date);
  1778.  
  1779. /* Change the priority on a mail message */
  1780. extern XP_Bool MSG_SetPriority(MSG_Pane *pane, /* thread or message */
  1781.                            MessageKey key, 
  1782.                            MSG_PRIORITY priority);
  1783.  
  1784. /* The msg library calls this to get a temporary filename and type (suitable
  1785.    for passing to XP_FileOpen, etc) to be used for storing a temporary working
  1786.    copy of the given filename and type.  The returned file will usually be
  1787.    renamed back onto the given filename, using XP_FileRename().
  1788.  
  1789.    The returned filename will be freed using XP_FREE().  */
  1790.  
  1791. /* #### this should be replaced with a backup-version-hacking XP_FileOpen */
  1792. extern char* FE_GetTempFileFor(MWContext* context, const char* fname,
  1793.                                XP_FileType ftype, XP_FileType* rettype);
  1794.  
  1795.  
  1796.  
  1797.  
  1798. /* Delete the master object, meaning that we're all done with mail or news.
  1799.    It's not legal to do this unless all associated panes have already been
  1800.    destroyed. */
  1801.  
  1802. extern void MSG_DestroyMaster(MSG_Master* master);
  1803.  
  1804.  
  1805. /* A pane is going away. */
  1806.  
  1807. extern void MSG_DestroyPane(MSG_Pane* pane);
  1808.  
  1809.  
  1810.  
  1811. /* Load the given folder into the given threadpane. */
  1812.  
  1813. extern int MSG_LoadFolder(MSG_Pane* threadpane, MSG_FolderInfo* folder);
  1814.  
  1815. /* Load the given message into the given messagepane.  Also have to specify
  1816.    the folder that the pane is in. */
  1817.  
  1818. extern int MSG_LoadMessage(MSG_Pane* messagepane, MSG_FolderInfo* folder,
  1819.                            MessageKey id);
  1820.  
  1821. /* Open Draft Message into a compose window */
  1822. extern int MSG_OpenDraft (MSG_Pane* threadpane, MSG_FolderInfo* folder,
  1823.                           MessageKey id);
  1824. /* Draft -- backend helper function; FE don't use it */
  1825. extern void MSG_SetLineWidth(MSG_Pane* composepane, int width);
  1826.  
  1827. extern void MSG_AddBacktrackMessage(MSG_Pane* pane, MSG_FolderInfo* folder,
  1828.                                     MessageKey id);
  1829.  
  1830. extern void MSG_SetBacktrackState (MSG_Pane* pane, MSG_BacktrackState state);
  1831.  
  1832. extern MSG_BacktrackState MSG_GetBacktrackState (MSG_Pane* pane);
  1833.  
  1834.  
  1835. /* Set what action to take when the user sends an HTML message.  This
  1836.    is set by a pull-down in the compose window, or as a result of the
  1837.    AskHTMLDialog. */
  1838. extern int MSG_SetHTMLAction(MSG_Pane* composepane,
  1839.                              MSG_HTMLComposeAction action);
  1840.  
  1841. /* Gets the value set above. */
  1842. extern MSG_HTMLComposeAction MSG_GetHTMLAction(MSG_Pane* composepane);
  1843.  
  1844. /* Asks that the recipients dialog appear.  This should only happen as a
  1845.    result of the user pressing the "Recipients" button on the AskHTMLDialog.
  1846.    the void* parameter is used to pass in the parent window for the dialog */
  1847. extern int MSG_PutUpRecipientsDialog(MSG_Pane* composepane,void *pWnd);
  1848.  
  1849. /* For more details on this routine, see comments for
  1850.    MSG_CompositionPaneCallbacks. */
  1851. extern int MSG_ResultsRecipients(MSG_Pane* composepane,
  1852.                                  XP_Bool cancelled,
  1853.                                  int32* nohtml, /* List of IDs, terminated
  1854.                                                   with a negative entry. */
  1855.                                  int32* htmlok /* Another list of IDs. */
  1856.                                  );
  1857.  
  1858. extern void MSG_SetPostDeliveryActionInfo (MSG_Pane* pane, 
  1859.                                            void *actionInfo);
  1860.  
  1861. /* Setting the preloaded attachments to a compose window. Drafts only */
  1862. extern int MSG_SetPreloadedAttachments ( MSG_Pane *composepane,
  1863.                                          MWContext *context,
  1864.                                          void *attachmentData,
  1865.                                          void *attachments,
  1866.                                          int attachments_count );
  1867.  
  1868. #ifdef XP_UNIX
  1869. /* This is how the XFE implements non-POP message delivery.  The given donefunc
  1870.    will be called when the incorporate actually finishes, which may be before
  1871.    or after this function returns. The boolean passed to the donefunc will be
  1872.    TRUE if the incorporate succeeds, and FALSE if it fails for any reason. */
  1873. extern void MSG_IncorporateFromFile(MSG_Pane* pane, XP_File infid,
  1874.                                     void (*donefunc)(void*, XP_Bool),
  1875.                                     void* doneclosure);
  1876. #endif /* XP_UNIX */
  1877.  
  1878. /* ===========================================================================
  1879.                                PREFERENCES
  1880.    ===========================================================================
  1881.  */
  1882.  
  1883.  
  1884. /* Create a new place to store mail/news preferences. */
  1885.  
  1886. extern MSG_Prefs* MSG_CreatePrefs(void);
  1887.  
  1888. /* Destroy a previously created MSG_Prefs* object.  it is illegal to call this
  1889.    unless any MSG_Master* or compositionpane objects associated with this prefs
  1890.    object have already been destroyed.*/
  1891.  
  1892. extern void MSG_DestroyPrefs(MSG_Prefs*);
  1893.  
  1894.  
  1895.  
  1896. /* This is the directory where mail folders are stored. */
  1897.  
  1898. extern void MSG_SetFolderDirectory(MSG_Prefs* prefs, const char* directory);
  1899. extern const char* MSG_GetFolderDirectory(MSG_Prefs* prefs);
  1900.  
  1901.  
  1902. extern void MSG_GetCitationStyle(MSG_Prefs* prefs,
  1903.                                  MSG_FONT* font,
  1904.                                  MSG_CITATION_SIZE* size,
  1905.                                  const char** color);
  1906.  
  1907. /* Gets/Sets the current Queue Folder name, i.e. "Outbox" or "Unsent Messages."
  1908.  Don't free the return result. */
  1909. extern const char * MSG_GetQueueFolderName();
  1910. /* Should be called with a #define'd string, i.e. QUEUE_FOLDER_NAME or QUEUE_FOLDER_NAME_OLD */
  1911. extern const char * MSG_SetQueueFolderName(const char *newName);
  1912. /* Variation on XP_GetString for special folders, except this function 
  1913.     returns safer, longer-duration strings */
  1914. extern const char * MSG_GetSpecialFolderName(int whichOne);
  1915. #ifdef XP_OS2
  1916. extern const char * MSG_GetSpecialFolderPrettyName(int whichOne);
  1917. #endif
  1918.  
  1919. /* Whether to automatically quote original message when replying. */
  1920. extern XP_Bool MSG_GetAutoQuoteReply(MSG_Prefs* prefs);
  1921.  
  1922. /* Whether to show attachments as links instead of inline. */
  1923. extern XP_Bool MSG_GetNoInlineAttachments(MSG_Prefs* prefs);
  1924.  
  1925. /* there are going to be a set of per-folder preferences, including
  1926.     1 pane or 2
  1927.     Configured for off-line use
  1928.     I think these can be represented with bits. If wrong, we'll have
  1929.     to change this. They should be stored in the database, NeoFolderInfo obj,
  1930.     and cached in MSG_FolderInfo.
  1931. */
  1932. #define MSG_FOLDER_PREF_OFFLINE 0x00000001
  1933. #define MSG_FOLDER_PREF_ONEPANE 0x00000002
  1934. #define MSG_FOLDER_PREF_SHOWIGNORED 0x00000004
  1935. #define MSG_FOLDER_PREF_IMAPMARKED 0x00000008     /* server says this folder is 'special' */
  1936. #define MSG_FOLDER_PREF_IMAPUNMARKED 0x00000010 /* different from !marked? RFC says yes */
  1937. #define MSG_FOLDER_PREF_IMAPNOINFERIORS 0x00000020 /* cannot have children folders, pity */
  1938. #define MSG_FOLDER_PREF_IMAPNOSELECT 0x00000040 /* cannot hold messages, only other folders */
  1939. #define MSG_FOLDER_PREF_OFFLINEEVENTS 0x00000080 /* this folder has offline events to play back */
  1940. #define MSG_FOLDER_PREF_LSUB_DISCOVERED 0x00000100 /* this folder was discovered using LSUB */
  1941. #define MSG_FOLDER_PREF_CREATED_OFFLINE 0x00000200 /* this folder created offline, so don't delete it */
  1942. #define MSG_FOLDER_PREF_NAMESPACE_STRIPPED 0x00000400 /* this folder has had its personal namespace stripped off */
  1943. #define MSG_FOLDER_PREF_IMAP_ACL_READ 0x00000800 /* SELECT, CHECK, FETCH, PARTIAL, SEARCH, COPY from folder */
  1944. #define MSG_FOLDER_PREF_IMAP_ACL_STORE_SEEN 0x00001000 /* STORE SEEN flag */
  1945. #define MSG_FOLDER_PREF_IMAP_ACL_WRITE 0x00002000 /* STORE flags other than SEEN and DELETED */
  1946. #define MSG_FOLDER_PREF_IMAP_ACL_INSERT 0x00004000 /* APPEND, COPY into folder */
  1947. #define MSG_FOLDER_PREF_IMAP_ACL_POST 0x00008000 /* Can I send mail to the submission address for folder? */
  1948. #define MSG_FOLDER_PREF_IMAP_ACL_CREATE_SUBFOLDER 0x00010000 /* Can I CREATE a subfolder of this folder? */
  1949. #define MSG_FOLDER_PREF_IMAP_ACL_DELETE 0x00020000 /* STORE DELETED flag, perform EXPUNGE */
  1950. #define MSG_FOLDER_PREF_IMAP_ACL_ADMINISTER 0x00040000 /* perform SETACL */
  1951. #define MSG_FOLDER_PREF_IMAP_ACL_RETRIEVED 0x00080000 /* ACL info for this folder has been initialized */
  1952. #define MSG_FOLDER_PREF_FEVALID    0x40000000  /* prefs have actually been set  */    
  1953. #define MSG_FOLDER_PREF_CACHED  0x80000000  /* we've retrieved prefs from db */
  1954.  
  1955. extern void MSG_SetFolderPrefFlags(MSG_FolderInfo *info, int32 flag);
  1956. extern int32 MSG_GetFolderPrefFlags(MSG_FolderInfo *info);
  1957.  
  1958. /* allow FE's to remember default CSID's on a per-folder basis. It would be nice 
  1959.     if there were a type other than int16 for csid's!
  1960.  */
  1961. extern void MSG_SetFolderCSID(MSG_FolderInfo *info, int16 csid);
  1962. extern int16 MSG_GetFolderCSID(MSG_FolderInfo *info);
  1963.  
  1964. typedef enum MSG_AdminURLType
  1965. {
  1966.     MSG_AdminServer,
  1967.     MSG_AdminServerSideFilters,
  1968.     MSG_AdminFolder,
  1969.     MSG_AdminServerLists
  1970. } MSG_AdminURLType;
  1971.  
  1972. /* use this to run the url */
  1973. extern XP_Bool MSG_GetAdminUrlForFolder(MWContext *context, MSG_FolderInfo *folder, MSG_AdminURLType type);
  1974. /* use this to decide to show buttons and/or menut items */
  1975. extern XP_Bool MSG_HaveAdminUrlForFolder(MSG_FolderInfo *folder, MSG_AdminURLType type);
  1976.  
  1977. /* ===========================================================================
  1978.                                LIST CALLBACKS
  1979.    ===========================================================================
  1980.  */
  1981.  
  1982.  
  1983. /* The FE calls these in response to mouse gestures on the scrolling lists.
  1984.    Note that folderpanes, threadpanes, and subscribepanes all have scrolling
  1985.    lists; most of these calls are valid in any of them. */
  1986.  
  1987.  
  1988. /* Change the flippy state on this thread line, if possible.  The numchanged
  1989.    returns how many lines that were added to the view (if positive), or how
  1990.    many were removed (if negative).  If you don't care, pass in NULL. */
  1991. extern void MSG_ToggleExpansion (MSG_Pane* pane, MSG_ViewIndex line,
  1992.                                  int32* numchanged);
  1993.  
  1994.  
  1995.  
  1996. /* Returns how many lines would get added or removed from the message pane if
  1997.    MSG_ToggleExpansion were to be called.  Returns positive if lines will be
  1998.    added; negative if lines will be removed. */
  1999. extern int32 MSG_ExpansionDelta(MSG_Pane* pane, MSG_ViewIndex line);
  2000.  
  2001.  
  2002.  
  2003. /* These are invoked by the items on the `Copy/Move Message Into' cascading
  2004.    menus, and by drag-and-drop.  The folder name should be the full pathname of
  2005.    the folder in URL (Unix) file name syntax.  This does not have to be an
  2006.    existing folder; it can be any file on the system.  It doesn't even have to
  2007.    exist yet.  (If you do want to use an existing folder, you can get the right
  2008.    string to pass using MSG_GetFolderName().)  */
  2009.  
  2010. typedef enum
  2011. {    MSG_Drag_Not_Allowed    = 0x00000000
  2012. ,    MSG_Require_Copy        = 0x00000001
  2013. ,    MSG_Require_Move        = 0x00000002
  2014. ,    MSG_Default_Drag        = 0xFFFFFFFF
  2015. } MSG_DragEffect;
  2016.  
  2017. /* Status calls.
  2018.    Caller passes in requested action.  If it's a required action, the returned value
  2019.    will be the request value, or MSG_Drag_Not_Allowed.  If it's a default drag request,
  2020.    the returned value will show whether the drag should be interpreted as a move or copy. */
  2021. extern MSG_DragEffect MSG_DragMessagesStatus(MSG_Pane* pane, const MSG_ViewIndex* indices,
  2022.                                 int32 numindices, const char *folder, MSG_DragEffect request);
  2023. extern MSG_DragEffect MSG_DragMessagesIntoFolderStatus(MSG_Pane* pane,
  2024.                                 const MSG_ViewIndex* indices, int32 numindices,
  2025.                                 MSG_FolderInfo *folder, MSG_DragEffect request);
  2026. extern MSG_DragEffect MSG_DragFoldersIntoStatus(MSG_Pane *folderPane,
  2027.                                 const MSG_ViewIndex *indices, int32 numIndices,
  2028.                                 MSG_FolderInfo *destFolder, MSG_DragEffect request);
  2029.  
  2030. extern int MSG_CopyMessagesInto(MSG_Pane* pane, const MSG_ViewIndex* indices,
  2031.                                 int32 numindices, const char *folder);
  2032. extern int MSG_MoveMessagesInto(MSG_Pane* pane, const MSG_ViewIndex* indices,
  2033.                                 int32 numindices, const char *folder);
  2034.  
  2035. extern int MSG_CopyMessagesIntoFolder(MSG_Pane* pane, const MSG_ViewIndex* indices,
  2036.                                 int32 numindices, MSG_FolderInfo *folder);
  2037. extern int MSG_MoveMessagesIntoFolder(MSG_Pane* pane, const MSG_ViewIndex* indices,
  2038.                                 int32 numindices, MSG_FolderInfo *folder);
  2039.  
  2040.  
  2041. extern int MSG_MoveFoldersInto (MSG_Pane *folderPane, const MSG_ViewIndex *indices,
  2042.                                int32 numIndices, MSG_FolderInfo *destFolder);
  2043.  
  2044. /* ===========================================================================
  2045.                                    HOSTS
  2046.    ===========================================================================
  2047.  */
  2048.  
  2049. /* These operations on hosts are mostly used for the subscribe pane. */
  2050.  
  2051. /* Returns the number of known newshosts.  If the result pointer is not NULL,
  2052.    fills it in with the list of newshosts (providing up to resultsize entries.)
  2053.  */
  2054. extern int32 MSG_GetNewsHosts(MSG_Master* master,
  2055.                               MSG_NewsHost** result,
  2056.                               int32 resultsize);
  2057.  
  2058. /* Same as above for imap hosts */
  2059. extern int32 MSG_GetIMAPHosts(MSG_Master* master,
  2060.                               MSG_IMAPHost** result,
  2061.                               int32 resultsize);
  2062.  
  2063. /* Same as above for imap hosts that support subscription */
  2064. extern int32 MSG_GetSubscribingIMAPHosts(MSG_Master* master,
  2065.                               MSG_IMAPHost** result,
  2066.                               int32 resultsize);
  2067.  
  2068. /* Same as above for news hosts + imap hosts that support subscription */
  2069. extern int32 MSG_GetSubscribingHosts(MSG_Master* master,
  2070.                               MSG_Host** result,
  2071.                               int32 resultsize);
  2072.  
  2073. /* Get the host type */
  2074. extern XP_Bool MSG_IsNewsHost(MSG_Host* host);
  2075. extern XP_Bool MSG_IsIMAPHost(MSG_Host* host);
  2076.  
  2077. /* Returns a pointer to the associated MSG_Host object for this MSG_NewsHost */
  2078. extern MSG_Host* MSG_GetMSGHostFromNewsHost(MSG_NewsHost *newsHost);
  2079. /* Returns a pointer to the associated MSG_Host object for this MSG_IMAPHost */
  2080. extern MSG_Host* MSG_GetMSGHostFromIMAPHost(MSG_IMAPHost *imapHost);
  2081. /* Returns a pointer to the associated MSG_NewsHost object for this MSG_Host,
  2082.    if it is a MSG_NewsHost.  Otherwise, returns NULL. */
  2083. extern MSG_NewsHost* MSG_GetNewsHostFromMSGHost(MSG_Host *host);
  2084. /* Returns a pointer to the associated MSG_IMAPHost object for this MSG_Host,
  2085.    if it is a MSG_IMAPHost.  Otherwise, returns NULL. */
  2086. extern MSG_IMAPHost* MSG_GetIMAPHostFromMSGHost(MSG_Host *host);
  2087.  
  2088.  
  2089.  
  2090. /* this should be in msgnet.h, but winfe uses it - this is dangerous in 
  2091.    a multiple host world.
  2092. */
  2093. extern XP_Bool MSG_GetMailServerIsIMAP4(MSG_Prefs* prefs);
  2094.  
  2095. /* Creates a new newshost.  If the given info matches an existing newshost,
  2096.    then returns that newshost. */
  2097.  
  2098. extern MSG_NewsHost* MSG_CreateNewsHost(MSG_Master* master,
  2099.                                         const char* hostname,
  2100.                                         XP_Bool isSecure,
  2101.                                         int32 port    /* If 0, use default */
  2102.                                         );
  2103.  
  2104.  
  2105. /* Gets the default newshost.  Could be NULL, if the user has managed to
  2106.    configure himself that way. */
  2107. extern MSG_NewsHost* MSG_GetDefaultNewsHost(MSG_Master* master);
  2108.  
  2109.  
  2110.  
  2111. /* Deletes a newshost.  This deletes everything known about this hosts -- the
  2112.    newsrc files, the databases, everything.  The user had better have confirmed
  2113.    this operation before making this call. */
  2114.  
  2115. extern int MSG_DeleteNewsHost(MSG_Master* master, MSG_NewsHost* host);
  2116.  
  2117.  
  2118. /* IMAP Hosts API's */
  2119. /* Creates a new imap host.  If the given info matches an existing imap host,
  2120.    then returns that imap host. */
  2121.  
  2122. extern MSG_IMAPHost* MSG_CreateIMAPHost(MSG_Master* master,
  2123.                                         const char* hostname,
  2124.                                         XP_Bool isSecure,
  2125.                                         const char *userName,
  2126.                                         XP_Bool checkNewMail,
  2127.                                         int    biffInterval,
  2128.                                         XP_Bool rememberPassword,
  2129.                                         XP_Bool usingSubscription,
  2130.                                         XP_Bool overrideNamespaces,
  2131.                                         const char *personalOnlineDir,
  2132.                                         const char *publicOnlineDir,
  2133.                                         const char *otherUsersOnlineDir
  2134.                                         );
  2135.  
  2136.  
  2137. /* Gets the default imap host.  Could be NULL, if the user has managed to
  2138.    configure himself that way. */
  2139. extern MSG_IMAPHost* MSG_GetDefaultIMAPHost(MSG_Master* master);
  2140.  
  2141.  
  2142. /* Deletes an imap host.  This deletes everything known about this hosts -- the
  2143.    preferences, the databases, everything.  The user had better have confirmed
  2144.    this operation before making this call. */
  2145.  
  2146. extern int MSG_DeleteIMAPHost(MSG_Master* master, MSG_IMAPHost* host);
  2147.  
  2148. /* Get info about a host. */
  2149.  
  2150. #ifdef SUBSCRIBE_USE_OLD_API    /* these are being obsoleted */
  2151. extern const char* MSG_GetNewsHostUIName(MSG_NewsHost* host);
  2152. extern const char* MSG_GetNewsHostName(MSG_NewsHost* host);
  2153. extern XP_Bool MSG_IsNewsHostSecure(MSG_NewsHost* host);
  2154. extern int32 MSG_GetNewsHostPort(MSG_NewsHost* host);
  2155. #endif /* SUBSCRIBE_USE_OLD_API */
  2156.  
  2157. extern const char* MSG_GetHostUIName(MSG_Host* host);
  2158. extern const char* MSG_GetHostName(MSG_Host* host);
  2159. extern XP_Bool MSG_IsHostSecure(MSG_Host* host);
  2160. extern int32 MSG_GetHostPort(MSG_Host* host);
  2161. extern void MSG_SetNewsHostPostingAllowed (MSG_NewsHost *host, XP_Bool allowed);
  2162. extern XP_Bool MSG_GetNewsHostPushAuth (MSG_NewsHost *host);
  2163. extern void MSG_SetNewsHostPushAuth (MSG_NewsHost *host, XP_Bool pushAuth);
  2164.  
  2165.  
  2166.  
  2167. /* ===========================================================================
  2168.                                SUBSCRIBE WINDOW
  2169.    ===========================================================================
  2170.  */
  2171.  
  2172.  
  2173. /* Set list of callback routines that the subscribe pane can call to the
  2174.    FE. */
  2175. extern int MSG_SubscribeSetCallbacks(MSG_Pane* subscribepane,
  2176.                                      MSG_SubscribeCallbacks* callbacks,
  2177.                                      void* callbackclosure);
  2178.  
  2179.  
  2180. /* The cancel button was hit.  Forget any subscriptions or unsubscriptions that
  2181.    had been requested.  (This call is usually quickly followed by a call to
  2182.    MSG_DestroyPane). */
  2183. extern int MSG_SubscribeCancel(MSG_Pane* subscribepane);
  2184.  
  2185. /* The OK button was hit.  Commit any subscriptions or unsubscriptions to the
  2186.    IMAP server, if there are any changes.  If the changes are on a news server,
  2187.    the commit will happen in the destructor, just like they used to (ack). 
  2188.    This needs to change for IMAP because we do network I/O. */
  2189. extern int MSG_SubscribeCommit(MSG_Pane* subscribepane);
  2190.  
  2191. /* Get which newshost we're currently viewing. */
  2192. #ifdef SUBSCRIBE_USE_OLD_API
  2193. extern MSG_NewsHost* MSG_SubscribeGetNewsHost(MSG_Pane* subscribepane);
  2194. #endif /* SUBSCRIBE_USE_OLD_API */
  2195.  
  2196. /* Get which news or imap host we're currently viewing. */
  2197. extern MSG_Host* MSG_SubscribeGetHost(MSG_Pane* subscribepane);
  2198.  
  2199. /* Set our view to the given newshost. */
  2200. #ifdef SUBSCRIBE_USE_OLD_API
  2201. extern int MSG_SubscribeSetNewsHost(MSG_Pane* subscribepane,
  2202.                                     MSG_NewsHost* host);
  2203. #endif /* SUBSCRIBE_USE_OLD_API */
  2204.  
  2205. /* Set our view to the given news or imap host. */
  2206. extern int MSG_SubscribeSetHost(MSG_Pane* subscribepane,
  2207.                                     MSG_Host* host);
  2208.  
  2209. /* Gets the mode of the pane. */
  2210. extern MSG_SubscribeMode MSG_SubscribeGetMode(MSG_Pane* subscribepane);
  2211.  
  2212. /* Sets the mode of the pane */
  2213. extern int MSG_SubscribeSetMode(MSG_Pane* subscribepane,
  2214.                                 MSG_SubscribeMode mode);
  2215.  
  2216.  
  2217. /* Finds the first newsgroup whose name matches the given string.  Expansions
  2218.    will automatically be done as necessary.  Returns the index that matches;
  2219.    the FE should then scroll to and select that index.   The pane must be
  2220.    in the "MSG_SubscribeAll" mode. */
  2221. extern MSG_ViewIndex MSG_SubscribeFindFirst(MSG_Pane* subscribepane,
  2222.                                             const char* str);
  2223.  
  2224.  
  2225. /* Finds all the newsgroups that have the given string as a substring, and
  2226.    changes the view to show only those groups.  The pane must be in the
  2227.    "MSG_SubscribeSearch" mode. */
  2228. extern int MSG_SubscribeFindAll(MSG_Pane* subscribepane, const char* str);
  2229.  
  2230.  
  2231. /* Get information to display on these lines in the subscription pane
  2232.    outline list.  Returns TRUE on success, FALSE if the given
  2233.    line doesn't exist or if there are less than numlines worth of data to get.
  2234.    The given data pointer must point to an array of at least numlines
  2235.    elements. */
  2236.  
  2237. extern XP_Bool MSG_GetGroupNameLineByIndex(MSG_Pane* subscribepane,
  2238.                                            MSG_ViewIndex firstline,
  2239.                                            int32 numlines,
  2240.                                            MSG_GroupNameLine* data);
  2241.  
  2242.  
  2243.  
  2244. /* ===========================================================================
  2245.                                    OFFLINE NEWS
  2246.    ===========================================================================
  2247.  */
  2248.  
  2249. typedef enum MSG_PurgeByPreferences
  2250. {
  2251.     MSG_PurgeNone,
  2252.     MSG_PurgeByAge,
  2253.     MSG_PurgeByNumHeaders
  2254. } MSG_PurgeByPreferences;
  2255.  
  2256.  
  2257. extern int MSG_SetOfflineRetrievalInfo(
  2258.     MSG_FolderInfo *newsGroup, 
  2259.     XP_Bool        useDefaults,
  2260.     XP_Bool        byReadness,
  2261.     XP_Bool        unreadOnly,
  2262.     XP_Bool        byDate,
  2263.     int32        daysOld);
  2264.  
  2265. extern int MSG_SetArticlePurgingInfo(
  2266.     MSG_FolderInfo *newsGroup, 
  2267.     XP_Bool            useDefaults,
  2268.     MSG_PurgeByPreferences    purgeBy,
  2269.     int32            daysToKeep);
  2270.  
  2271. extern int MSG_SetHeaderPurgingInfo(
  2272.     MSG_FolderInfo *newsGroup, 
  2273.     XP_Bool    useDefaults,
  2274.     MSG_PurgeByPreferences    purgeBy,
  2275.     XP_Bool    unreadOnly,
  2276.     int32 daysToKeep,
  2277.     int32 numHeadersToKeep
  2278. );
  2279.  
  2280. extern void MSG_GetOfflineRetrievalInfo(
  2281.     MSG_FolderInfo *newsGroup,
  2282.     XP_Bool        *pUseDefaults,
  2283.     XP_Bool        *pByReadness,
  2284.     XP_Bool        *pUnreadOnly,
  2285.     XP_Bool        *pByDate,
  2286.     int32        *pDaysOld);
  2287.  
  2288. extern void MSG_GetArticlePurgingInfo(MSG_FolderInfo *newsGroup,
  2289.     XP_Bool            *pUseDefaults,
  2290.     MSG_PurgeByPreferences    *pPurgeBy,
  2291.     int32 *pDaysToKeep);
  2292.  
  2293. extern void MSG_GetHeaderPurgingInfo(MSG_FolderInfo *newsGroup,
  2294.     XP_Bool *pUseDefaults,
  2295.     MSG_PurgeByPreferences    *pPurgeBy,
  2296.     XP_Bool    *pUnreadOnly,
  2297.     int32 *pDaysToKeep,
  2298.     int32 *pNumHeadersToKeep);
  2299.  
  2300.  
  2301.  
  2302. /* run the url to download mail and news articles for offline use
  2303.   for those folders so configured.
  2304. */
  2305. extern int MSG_DownloadForOffline(MSG_Master *master, MSG_Pane *pane);
  2306. extern int MSG_GoOffline(MSG_Master *master, MSG_Pane *pane, XP_Bool downloadDiscussions, XP_Bool getNewMail, XP_Bool sendOutbox);
  2307. extern int MSG_DownloadFolderForOffline(MSG_Master *master, MSG_Pane *pane, MSG_FolderInfo *folder);
  2308.  
  2309.  
  2310. /* ===========================================================================
  2311.                                        QUERIES
  2312.    ===========================================================================
  2313.  */
  2314.  
  2315. /* Get the filename for the folder on the given line.  This string is perfect
  2316.    for passing to calls to MSG_MoveMessagesInto() and friends.  String is 
  2317.    allocated with XP_STRDUP so client needs to free. This should only be used
  2318.    for mail folders, it appears from the code.
  2319. */
  2320. extern const char* MSG_GetFolderName(MSG_Pane* folderpane, MSG_ViewIndex line);
  2321.  
  2322.  
  2323. /* return the full folder name from a folder id. String is not allocated so caller
  2324.    should duplicate it. For mail boxes, this returns the full folder path. This is
  2325.    currently used for filters to remember a full folder path.
  2326.  */
  2327. extern const char *MSG_GetFolderNameFromID(MSG_FolderInfo *);
  2328.  
  2329.  
  2330. /* Get how many lines are in the list for this folderpane or threadpane or
  2331.    subscribepane. */
  2332. extern int32 MSG_GetNumLines(MSG_Pane* pane);
  2333.  
  2334.  
  2335. /* Convert a MSG_FolderInfo* into a MSG_ViewIndex.  Returns MSG_VIEWINDEXNONE if
  2336.    the given MSG_FolderInfo* is not being displayed anywhere. */
  2337.  
  2338. extern MSG_ViewIndex MSG_GetFolderIndex(MSG_Pane* folderpane,
  2339.                                        MSG_FolderInfo* info);
  2340.  
  2341.  
  2342. /* This routine should replace the above routine when people port over to it.
  2343.     If expand is TRUE, we will expand the folderPane enough to
  2344.     expose the passed in folder info. Otherwise, if the folder is collapsed,
  2345.     we return MSG_ViewIndexNone.
  2346. */
  2347. extern MSG_ViewIndex MSG_GetFolderIndexForInfo(MSG_Pane *folderpane, 
  2348.                                                 MSG_FolderInfo *info,
  2349.                                                 XP_Bool expand);
  2350.  
  2351. /* Converts a MSG_ViewIndex into a MSG_FolderInfo*. */
  2352.  
  2353. extern MSG_FolderInfo* MSG_GetFolderInfo(MSG_Pane* folderpane,
  2354.                                          MSG_ViewIndex index);
  2355.  
  2356. extern MSG_FolderInfo* MSG_GetFolderInfoFromURL(MSG_Master* master, const char *url);
  2357.  
  2358. /* returns folder info of host owning this folder*/
  2359. MSG_FolderInfo* GetHostFolderInfo(MSG_FolderInfo* info); 
  2360.  
  2361. extern MSG_FolderInfo* MSG_GetThreadFolder(MSG_Pane *threadpane);
  2362.  
  2363. extern MSG_FolderInfo* MSG_GetCategoryContainerForCategory(MSG_FolderInfo *category);
  2364.  
  2365. #ifdef SUBSCRIBE_USE_OLD_API
  2366. /* Finds the newshost that contains the given folder.  If the given folder is
  2367.    not a newsgroup, returns NULL. */
  2368. extern MSG_NewsHost* MSG_GetNewsHostForFolder(MSG_FolderInfo* folder);
  2369.  
  2370. /* Converts a MSG_ViewIndex into a MSG_NewsHost */
  2371. extern MSG_NewsHost *MSG_GetNewsHostFromIndex (MSG_Pane *folderPane,
  2372.                                                MSG_ViewIndex index);
  2373. #endif    /* SUBSCRIBE_USE_OLD_API */
  2374.  
  2375. /* Finds the host that contains the given folder.  If the given folder is
  2376.    not a newsgroup or IMAP folder, returns NULL. */
  2377. extern MSG_Host *MSG_GetHostForFolder(MSG_FolderInfo* folder);
  2378.  
  2379. /* Converts a MSG_ViewIndex into a MSG_Host */
  2380. extern MSG_Host *MSG_GetHostFromIndex (MSG_Pane *folderPane,
  2381.                                        MSG_ViewIndex index);
  2382.  
  2383. /* Gets the MSG_FolderInfo object associated with a given MSG_Host. */
  2384. extern MSG_FolderInfo *MSG_GetFolderInfoForHost(MSG_Host *host);
  2385.  
  2386. /* given a url containing a message id, fill in the message line info for the msg.
  2387.     For news urls, the news group will need to be open!
  2388.  */
  2389. extern int MSG_GetMessageLineForURL(MSG_Master* master, const char *url, MSG_MessageLine *msgLine);
  2390.  
  2391. /* This routine should replace the MSG_GetMessageIndex when people port over to
  2392.     it. If expand is TRUE, we will expand the folderPane enough to
  2393.     expose the passed in folder info. Otherwise, if the folder is collapsed,
  2394.     we return MSG_ViewIndexNone.
  2395. */
  2396. extern MSG_ViewIndex MSG_GetMessageIndexForKey(MSG_Pane* threadpane, 
  2397.                                                MessageKey key,
  2398.                                                XP_Bool expand);
  2399.  
  2400. /* Look up the MessageKey based on the message ID */
  2401.  
  2402. extern int MSG_GetKeyFromMessageId (MSG_Pane *message_pane, 
  2403.                              const char *message_id,
  2404.                              MessageKey *outKey);
  2405.  
  2406. /* Converts a MSG_ViewIndex into a MessageKey. */
  2407.  
  2408. extern MessageKey MSG_GetMessageKey(MSG_Pane* threadpane, MSG_ViewIndex index);
  2409.  
  2410.  
  2411. /* Getting a message key from the undo manager for dsiplay */
  2412.  
  2413. extern XP_Bool MSG_GetUndoMessageKey (MSG_Pane* pane, 
  2414.                                       MSG_FolderInfo** pFolderInfo,
  2415.                                       MessageKey* pKey);
  2416.  
  2417. /* Get current undo operation status */
  2418. extern UndoStatus MSG_GetUndoStatus (MSG_Pane* pane);
  2419.  
  2420. /* Get Undo Manager State */
  2421. extern UndoMgrState MSG_GetUndoState(MSG_Pane* pane);
  2422.  
  2423. /* Given a MSG_FolderInfo*, returns the number of children folders.  If the
  2424.    result pointer is not NULL, fills it in with the list of children (providing
  2425.    up to resultsize entries.)  If the given MSG_FolderInfo* is NULL, then
  2426.    returns the list of top-level folders. */
  2427.  
  2428. extern int32 MSG_GetFolderChildren(MSG_Master* master,
  2429.                                    MSG_FolderInfo* folder,
  2430.                                    MSG_FolderInfo** result,
  2431.                                    int32 resultsize);
  2432.  
  2433. /* Returns the container of all local (off-line) mail folders. */
  2434.  
  2435. extern MSG_FolderInfo* MSG_GetLocalMailTree(MSG_Master* master); 
  2436.  
  2437. /* Returns the number of mail folders (both local and IMAP).  If this number is
  2438.    greater than zero, an array of pointers to the MSG_FolderInfos is allocated
  2439.    and returned in result.  The caller is responsible for freeing the array.
  2440.    This function is not recursive, it only returns the top level mail folders. */
  2441. extern int32 MSG_ListMailFolders(MSG_Master *master, MSG_FolderInfo ***result);
  2442.  
  2443. /* Given a flag or set of flags, returns the number of folders that have
  2444.    that flag set.  If the result pointer is not NULL, fills it in with the
  2445.    list of folders (providing up to resultsize entries).  */
  2446.  
  2447. extern int32 MSG_GetFoldersWithFlag(MSG_Master* master,
  2448.                                     uint32 flags,
  2449.                                     MSG_FolderInfo** result,
  2450.                                     int32 resultsize);
  2451.  
  2452.  
  2453.  
  2454.  
  2455. /* Returns what folder a threadpane is viewing (NULL if not viewing
  2456.    anything.) */
  2457.  
  2458. extern MSG_FolderInfo* MSG_GetCurFolder(MSG_Pane* threadpane);
  2459.  
  2460. /* Call this from the new Create Folder UI with the dropdown list.
  2461.    The MSG_Command will go away when everyone uses this.
  2462.    This should not be called anymore - keeping it for a smooth transition to
  2463.    MSG_CreateMailFolderWithPane  (below) */
  2464. extern int MSG_CreateMailFolder (MSG_Master *master, MSG_FolderInfo *parent,
  2465.                                  const char *childName);
  2466.  
  2467. /* Call this from the new Create Folder UI with the dropdown list.
  2468.    The MSG_Command will go away when everyone uses this.
  2469.    Call with invokingPane set to the pane with which to run any IMAP
  2470.    Create-Folder URLs.  (probably the pane from which it was invoked,
  2471.    or a progress pane) */
  2472. extern int MSG_CreateMailFolderWithPane (MSG_Pane *invokingPane, MSG_Master *master,
  2473.                                          MSG_FolderInfo *parent, const char *childName);
  2474.  
  2475.  
  2476.  
  2477. /* FEs should call this to determine what folder we should suggest as the parent folder,
  2478.    when creating a new folder.
  2479.    current is the MSG_FolderInfo of the currently selected folder or host. 
  2480.    Returns the MSG_FolderInfo for the suggested parent, given the currently selected folder or host. 
  2481.    Returns NULL if current is NULL. 
  2482. */ 
  2483. extern MSG_FolderInfo *MSG_SuggestNewFolderParent(MSG_FolderInfo *current); 
  2484.  
  2485. /* Call this from the new folder properties UI */
  2486. extern int MSG_RenameMailFolder (MSG_Pane *folderPane, MSG_FolderInfo *folder,
  2487.                                  const char *newName);
  2488.  
  2489. /* Returns what folder and message a messagepane is currently displaying.
  2490.    (Sets the folder to NULL and the key to MSG_MESSAGEKEYNONE if the
  2491.    messagepane is currently displaying nothing.) */
  2492.  
  2493. extern void MSG_GetCurMessage(MSG_Pane* messagepane,
  2494.                               MSG_FolderInfo** folder,
  2495.                               MessageKey* key, MSG_ViewIndex *index);
  2496.  
  2497.  
  2498. /* Returns what attachments are being viewed in the messagepane, and whether
  2499.    we're certain it's the entire list.  (If the data is still being downloaded,
  2500.    then there could still be attachments that we don't know about.)
  2501.  
  2502.    The returned data must be free'd using MSG_FreeAttachmentList(). */
  2503.  
  2504. extern int MSG_GetViewedAttachments(MSG_Pane* messagepane,
  2505.                                     MSG_AttachmentData** data,
  2506.                                     XP_Bool* iscomplete);
  2507.  
  2508.  
  2509. /* Frees the attachemnt data returned by MSG_GetViewedAttachments(). */
  2510.  
  2511. extern void MSG_FreeAttachmentList(MSG_Pane* messagepane,
  2512.                                    MSG_AttachmentData* data);
  2513.  
  2514.  
  2515.  
  2516.  
  2517. /* These return NULL if they fail. Caller must call NET_FreeURLStruct */ 
  2518. extern URL_Struct*  MSG_ConstructUrlForPane(MSG_Pane *pane);
  2519. extern URL_Struct*  MSG_ConstructUrlForMessage(MSG_Pane *pane, MessageKey key);
  2520. extern URL_Struct*    MSG_ConstructUrlForFolder(MSG_Pane *pane, MSG_FolderInfo *folder);
  2521. /* Returns whether the user has asked to rot13 messages displayed in
  2522.    this pane.  (Used by libmime.) */
  2523. extern XP_Bool MSG_ShouldRot13Message(MSG_Pane* messagepane);
  2524.  
  2525.  
  2526. /* ===========================================================================
  2527.                                    BIFF
  2528.    ===========================================================================
  2529.  */
  2530.  
  2531. /* biff is the unixy name for "Check for New Mail".  It comes from the unix
  2532.    command of the same name; the author of that command named it after his dog,
  2533.    who would bark at him whenever he had new mail...  */
  2534.  
  2535. /* The different biff states we can be in:  */
  2536.  
  2537. typedef enum
  2538. {
  2539.   MSG_BIFF_NewMail,                /* User has new mail waiting. */
  2540.   MSG_BIFF_NoMail,                /* No new mail is waiting. */
  2541.   MSG_BIFF_Unknown                /* We dunno whether there is new mail. */
  2542. } MSG_BIFF_STATE;
  2543.  
  2544.  
  2545. /* Register and unregister biff callback functions */
  2546. typedef void (*MSG_BIFF_CALLBACK)(MSG_BIFF_STATE oldState, MSG_BIFF_STATE newState);
  2547.  
  2548. extern void MSG_RegisterBiffCallback( MSG_BIFF_CALLBACK cb );
  2549.  
  2550. extern void MSG_UnregisterBiffCallback();
  2551.  
  2552. /* Get and set the current biff state */
  2553.  
  2554. extern MSG_BIFF_STATE MSG_GetBiffState();
  2555.  
  2556. extern void MSG_SetBiffStateAndUpdateFE(MSG_BIFF_STATE newState);
  2557.  
  2558.  
  2559. /* Set the preference of how often to run biff.  If zero is passed in, then
  2560.    never check. */
  2561.  
  2562. extern void MSG_SetBiffInterval(int32 seconds);
  2563.  
  2564.  
  2565.  
  2566. #ifdef XP_UNIX
  2567. /* Set the file to stat, instead of using pop3.  This is for the Unix movemail
  2568.    nonsense.  If the filename is NULL (the default), then use pop3. */
  2569. extern void MSG_SetBiffStatFile(const char* filename);
  2570. #endif
  2571.  
  2572.  
  2573.  
  2574. /* Initialize the biff context.  Note that biff contexts exist entirely
  2575.    independent of mail contexts; it's up to the FE to decide what order they
  2576.    get created and stuff. */
  2577.  
  2578. extern int MSG_BiffInit(MWContext* context, MSG_Prefs* prefs);
  2579.  
  2580.  
  2581. /* The biff context is about to go away.  The FE must call this first to
  2582.    clean up. */
  2583.  
  2584. extern int MSG_BiffCleanupContext(MWContext* context);
  2585.  
  2586.  
  2587. /* Causes a biff check to occur immediately.  This gets caused
  2588.    automatically by MSG_SetBiffInterval or whenever libmsg gets new mail. */
  2589.  
  2590. extern void MSG_BiffCheckNow(MWContext* context);
  2591.  
  2592.  
  2593. /* Tell the FE to render in all the right places this latest knowledge as to
  2594.    whether we have new mail waiting. */
  2595. extern void FE_UpdateBiff(MSG_BIFF_STATE state);
  2596.  
  2597.  
  2598.  
  2599. /* ===========================================================================
  2600.                            OTHER INTERFACES
  2601.    ===========================================================================
  2602.  */
  2603.  
  2604. /* Certain URLs must always be displayed in certain types of windows:
  2605.    for example, all "mailbox:" URLs must go in the mail window, and
  2606.    all "http:" URLs must go in a browser window.  These predicates
  2607.    look at the address and say which window type is required.
  2608.  */
  2609. extern XP_Bool MSG_RequiresMailWindow (const char *url);
  2610. extern XP_Bool MSG_RequiresNewsWindow (const char *url);
  2611. extern XP_Bool MSG_RequiresBrowserWindow (const char *url);
  2612. extern XP_Bool MSG_RequiresComposeWindow (const char *url);
  2613.  
  2614. /* If this URL requires a particular kind of window, and this is not
  2615.    that kind of window, then we need to find or create one.
  2616.  */
  2617. extern XP_Bool MSG_NewWindowRequired (MWContext *context, const char *url);
  2618.  
  2619. /* If this URL requires a particular kind of window, and this is not
  2620.    that kind of window, then we need to find or create one.
  2621.    This routine takes a URL_Struct, which allows it to be smarter than
  2622.    the above routine.
  2623.  */
  2624. extern XP_Bool MSG_NewWindowRequiredForURL (MWContext *context, URL_Struct *urlStruct);
  2625.  
  2626. /* If we're in a mail window, and clicking on a link which will itself
  2627.    require a mail window, then don't allow this to show up in a different
  2628.    window - since there can be only one mail window.
  2629.  */
  2630. extern XP_Bool MSG_NewWindowProhibited (MWContext *context, const char *url);
  2631.  
  2632.  
  2633. /* When the front end loads a url, it needs to know what kind of pane the url
  2634.     should be loaded into.
  2635. */
  2636. extern MSG_PaneType MSG_PaneTypeForURL(const char *url);
  2637.  
  2638. /* Returns the number of bytes available on the disk where the given directory
  2639.    is - this is so we know whether there is room to incorporate new mail.  */
  2640. extern uint32 FE_DiskSpaceAvailable (MWContext* context, const char* dir);
  2641.  
  2642.  
  2643. /* ===========================================================================
  2644.                                SECURE MAIL
  2645.    ===========================================================================
  2646.  */
  2647.  
  2648. extern MSG_SecurityLevel MSG_GetMessageSecurityLevel(MSG_Pane *pPane);
  2649. extern const XP_List *MSG_GetRecipientsWithNoCerts(MSG_Pane *pPane);
  2650. extern XP_Bool MSG_ShouldEncryptMessage(MSG_Pane *pPane);
  2651. extern XP_Bool MSG_ShouldSignMessage(MSG_Pane *pPane);
  2652.  
  2653.  
  2654. /* FEs call this any time the set of recipients on the compose window
  2655.    changes.  They should make the state (and sensitivity) of the "sign"
  2656.    and "encrypt" checkboxes, and the state of the "security" button,
  2657.    correspond to the returned boolean values.
  2658.  
  2659.    Maybe this function doesn't really belong here, but it's as good a
  2660.    place as any...
  2661.   */
  2662. /* (This is maybe not the most appropriate header file for this proto.) */
  2663. extern void SEC_GetMessageCryptoViability(const char *from,
  2664.                                           const char *reply_to,
  2665.                                           const char *to,
  2666.                                           const char *cc,
  2667.                                           const char *bcc,
  2668.                                           const char *newsgroups,
  2669.                                           const char *followup_to,
  2670.                                           XP_Bool *signing_possible_return,
  2671.                                           XP_Bool *encryption_possible_return);
  2672.  
  2673.  
  2674. /* Returns TRUE if the user has selected the preference that says that new
  2675.    mail messages should be encrypted by default. 
  2676.  */
  2677. extern XP_Bool MSG_GetMailEncryptionPreference(void);
  2678.  
  2679. /* Returns TRUE if the user has selected the preference that says that new
  2680.    mail messages should be cryptographically signed by default. 
  2681.  */
  2682. extern XP_Bool MSG_GetMailSigningPreference(void);
  2683.  
  2684. /* Returns TRUE if the user has selected the preference that says that new
  2685.    news messages should be cryptographically signed by default. 
  2686.  */
  2687. extern XP_Bool MSG_GetNewsSigningPreference(void);
  2688.  
  2689.  
  2690.  
  2691.  
  2692. /* ===========================================================================
  2693.                            COMPOSE WINDOW
  2694.    ===========================================================================
  2695.  */
  2696.  
  2697. /* This is how the `mailto' parser asks the message library to create a
  2698.    message composition window.  That window has its own context.  The
  2699.    `old_context' arg is the context from which the mailto: URL was loaded.
  2700.    It may be NULL.
  2701.  
  2702.    Any of the fields may be 0 or "".  Some of them (From, BCC, Organization,
  2703.    etc) will be given default values if none is provided.
  2704.  
  2705.    This returns the new composition pane.
  2706.  */
  2707. extern MSG_Pane* MSG_ComposeMessage(MWContext *old_context,
  2708.                                     const char *from,
  2709.                                     const char *reply_to,
  2710.                                     const char *to,
  2711.                                     const char *cc,
  2712.                                     const char *bcc,
  2713.                                     const char *fcc,
  2714.                                     const char *newsgroups,
  2715.                                     const char *followup_to,
  2716.                                     const char *organization,
  2717.                                     const char *subject,
  2718.                                     const char *references,
  2719.                                     const char *other_random_headers,
  2720.                                     const char *priority,
  2721.                                     const char *attachment,
  2722.                                     const char *newspost_url,
  2723.                                     const char *body,
  2724.                                     XP_Bool encrypt_p,
  2725.                                     XP_Bool sign_p,
  2726.                                     XP_Bool force_plain_text,
  2727.                                     const char* html_part);
  2728.  
  2729. extern MSG_CompositionFields* MSG_CreateCompositionFields(
  2730.                                     const char *from,
  2731.                                     const char *reply_to,
  2732.                                     const char *to,
  2733.                                     const char *cc,
  2734.                                     const char *bcc,
  2735.                                     const char *fcc,
  2736.                                     const char *newsgroups,
  2737.                                     const char *followup_to,
  2738.                                     const char *organization,
  2739.                                     const char *subject,
  2740.                                     const char *references,
  2741.                                     const char *other_random_headers,
  2742.                                     const char *priority,
  2743.                                     const char *attachment,
  2744.                                     const char *newspost_url,
  2745.                                     XP_Bool encrypt_p,
  2746.                                     XP_Bool sign_p);
  2747.  
  2748. extern void MSG_DestroyCompositionFields(MSG_CompositionFields *fields);
  2749.  
  2750. /* Tell the FE that something has changed in the composition (like, we
  2751.    finished quoting or something) so that it needs to update the status of
  2752.    toolbars and stuff.  This call should go away.  ###tw */
  2753. extern void FE_UpdateCompToolbar(MSG_Pane* comppane);
  2754.  
  2755.  
  2756. /* Tell the FE that we're all done with the given context (which was associated
  2757.    with a composition pane that we're destroying).  Presumably, the FE will
  2758.    then destroy the context. */
  2759. extern void FE_DestroyMailCompositionContext(MWContext* context);
  2760.  
  2761.  
  2762.  
  2763. /* Determines whether this is a mail composition that ought to have a "quote
  2764.    message" operation done at startup.  If so, the FE must call
  2765.    MSG_QuoteMessage and handle it, and when done call MSG_SetInitialState(). */
  2766.  
  2767. extern XP_Bool MSG_ShouldAutoQuote(MSG_Pane* comppane);
  2768.  
  2769.  
  2770. /* Get and set the various things that a user may have typed.  These are all
  2771.    initialized automatically by the constructor from the MSG_CompositionFields*
  2772.    object.  The FE needs to done setting everything before doing sanity checks
  2773.    or sending the message.
  2774.  
  2775.    MSG_SetCompHeader should not be made with the header
  2776.    MSG_ATTACHMENTS_HEADER_MASK; instead, call MSG_SetAttachmentList().
  2777.    However, the FE may call MSG_GetCompHeader() with
  2778.    MSG_ATTACHMENTS_HEADER_MASK to find the summary line to display. */
  2779.  
  2780. extern const char* MSG_GetCompHeader(MSG_Pane* comppane,
  2781.                                      MSG_HEADER_SET header);
  2782. extern int MSG_SetCompHeader(MSG_Pane* comppane,
  2783.                              MSG_HEADER_SET header,
  2784.                              const char* value);
  2785. extern const char* MSG_GetCompFieldsHeader(MSG_CompositionFields *fields,
  2786.                                            MSG_HEADER_SET header);
  2787. extern int MSG_SetCompFieldsHeader(MSG_CompositionFields *fields,
  2788.                                    MSG_HEADER_SET header,
  2789.                                    const char* value);
  2790. extern void MSG_SetCompFieldsReceiptType(MSG_CompositionFields *fields,
  2791.                                         int32 type);
  2792. extern int32 MSG_GetCompFieldsReceiptType(MSG_CompositionFields *fields);
  2793.  
  2794. extern XP_Bool MSG_GetCompBoolHeader(MSG_Pane* comppane,
  2795.                                      MSG_BOOL_HEADER_SET header);
  2796. extern int MSG_SetCompBoolHeader(MSG_Pane* comppane,
  2797.                                  MSG_BOOL_HEADER_SET header,
  2798.                                  XP_Bool value);
  2799. extern XP_Bool MSG_GetCompFieldsBoolHeader(MSG_CompositionFields *fields,
  2800.                                            MSG_BOOL_HEADER_SET header);
  2801. extern int MSG_SetCompFieldsBoolHeader(MSG_CompositionFields *fields,
  2802.                                        MSG_BOOL_HEADER_SET header,
  2803.                                        XP_Bool value);
  2804.  
  2805. /* Get whether we should force plain-text composition by default. */
  2806. extern XP_Bool MSG_GetForcePlainText(MSG_CompositionFields* fields);
  2807.  
  2808.  
  2809. extern const char* MSG_GetCompBody(MSG_Pane* comppane);
  2810. extern int MSG_SetCompBody(MSG_Pane* comppane, const char* body);
  2811.  
  2812. /* These following four functions are provided to make implementing the
  2813.    grid-based compose window a bit easier.  A new type definition
  2814.    (MSG_HeaderEntry) is introduced which is used to store individual 
  2815.    address entries. -- jevering  */
  2816.  
  2817. typedef struct 
  2818. {
  2819.   MSG_HEADER_SET header_type;
  2820.   char * header_value;
  2821. } MSG_HeaderEntry;
  2822.  
  2823. /* MSG_ExplodeHeaderField() parses a single header entry and returns
  2824.    a list of MSG_HeaderEntry structures.  The return value is the
  2825.    number of items in the return list or -1 for an error.  The return 
  2826.    list as well as its contents should be freed by the caller. */
  2827.     
  2828. extern int  MSG_ExplodeHeaderField( MSG_HEADER_SET msg_header, 
  2829.                                     const char * field,
  2830.                                     MSG_HeaderEntry **return_list);
  2831.  
  2832. /* This function retrieve the contents of the current compose window
  2833.    headers and parses them into a MSG_HeaderEntry list with one
  2834.    address per line.  Call this function when constructing the compose
  2835.    window in order to initialize the grid-widget.  This function returns
  2836.    the number of items in the list or -1 indicating an error.  The
  2837.    return list should be freed by the caller. */
  2838.  
  2839. extern int MSG_RetrieveStandardHeaders(MSG_Pane * pane, 
  2840.                                     MSG_HeaderEntry ** return_list);
  2841.  
  2842. /* This function accepts a list of single-entry address items and
  2843.    condenses it down to a list of comma separated addressed.  The 
  2844.    order of occurance is maintained on a MSG_HEADER_SET basis.
  2845.    The return value indicated the size of the list. A return value
  2846.    of -1 indicates that an error has occured.  The returned list
  2847.    as well as its contents should be freed by the caller. */
  2848.  
  2849. extern int MSG_CompressHeaderEntries(MSG_HeaderEntry * in_list, 
  2850.                                     int list_size,
  2851.                                     MSG_HeaderEntry ** return_list);
  2852.  
  2853. /* call this function with the list returned by MSG_CompressHeaderEntries().
  2854.    pane - message pane, count - number of entries in list.
  2855.    The previous headers are cleared and the contents of the new list
  2856.    is used.  The memory is freed as well. */
  2857.  
  2858. extern void MSG_SetHeaderEntries(MSG_Pane * pane,
  2859.                                  MSG_HeaderEntry * in_list,
  2860.                                  int count);
  2861.  
  2862. /* Clears all compose window headers (except the attachment list). */
  2863.  
  2864. extern void MSG_ClearComposeHeaders(MSG_Pane * pane);
  2865.  
  2866. /* Begin a "quote message" operation.  This is complicated, because this is an
  2867.    asynchronous operation.  (Getting the message to quote can be a network
  2868.    operation).  So, the FE must provide a callback routine that inserts the
  2869.    quoted data, piecemeal.  The callback will get called with a NULL string
  2870.    when things are all done (or if things failed or were cancelled.)  The
  2871.    callback routine should return a negative value on error.
  2872.  
  2873.    Actually, if we're an HTML composition, we call the editor functions
  2874.    directly, and ignore the given func().  Pretty rude, huh.
  2875.    */
  2876. #ifdef XP_OS2
  2877. typedef int (*PNSQMFN)(void *, const char *);
  2878.  
  2879. extern void MSG_QuoteMessage(MSG_Pane* comppane,
  2880.                              PNSQMFN func,
  2881.                              void* closure);
  2882. #else
  2883. extern void MSG_QuoteMessage(MSG_Pane* comppane,
  2884.                              int (*func)(void* closure, const char* data),
  2885.                              void* closure);
  2886. #endif
  2887.  
  2888. /* The FE is about to call MSG_SendComposition to cause things to be sent, but
  2889.    first, it wants to make sure that the user isn't trying to send something
  2890.    blatently stupid (like, no subject, or no body, or no "To:", or whatever).
  2891.    So, there's various sanity checks for it to make, and the FE can then take
  2892.    appropriate actions if the check failed.  Each sanity check returns an
  2893.    error code describing the problem.  The FE can pop up the string for that
  2894.    error code in a FE_Confirm() call.  If FE_Confirm() returns TRUE, then the
  2895.    user doesn't care and wants to send the message anyway, so the FE can just
  2896.    call MSG_SanityCheck() again and pass the given errorcode as the skippast
  2897.    parameter.  libmsg will skip that sanity check, and all the previous ones,
  2898.    and confirm that the other things work.
  2899.  
  2900.    It's up to the FE how to handle each error code; the FE_Confirm() method
  2901.    is just the suggested default.  In particular, the FE should prompt the
  2902.    user for the subject if we return MK_MSG_MISSING_SUBJECT.
  2903.  
  2904.    The current sanity checks are:
  2905.  
  2906.    MK_MSG_MISSING_SUBJECT:  There is no subject line.
  2907.    MK_MSG_EMPTY_MESSAGE:    There is no real body, and no attachments.
  2908.    MK_MSG_DOUBLE_INCLUDE:    The original message was both quoted and attached.
  2909.    MK_MSG_MIXED_SECURITY:    Some recipients have certificates; some not.
  2910.  
  2911.    */
  2912.  
  2913. extern int MSG_SanityCheck(MSG_Pane* comppane, int skippast);
  2914.  
  2915. /* Get the URL associated with this context (the "X-Url" field.) */
  2916. extern const char* MSG_GetAssociatedURL(MSG_Pane* comppane);
  2917.  
  2918.  
  2919. /* This is completely foul, but the FE needs to call this from within
  2920.    FE_AllConnectionsComplete() when the context->type is
  2921.    MWContextMessageComposition.
  2922.  */
  2923. extern void MSG_MailCompositionAllConnectionsComplete (MSG_Pane* pane);
  2924.  
  2925.  
  2926. /*  */
  2927.  
  2928.  
  2929. /* Bring up the dialog box that presents the user with the list of domains that
  2930.    have been marked for HTML, and let the user edit them. */
  2931.  
  2932. extern int MSG_DisplayHTMLDomainsDialog(MWContext* context);
  2933.  
  2934.  
  2935. /* Returns whether the given folderinfo represents a newsgroup where
  2936.    HTML postings are OK.  This is to be used in the property dialog
  2937.    for that newsgroup.  This call should only be done on newsgroups. */
  2938.  
  2939. extern XP_Bool MSG_IsHTMLOK(MSG_Master* master, MSG_FolderInfo* group);
  2940.  
  2941. /* Sets whether the given newsgroup can have HTML.  This can potentially
  2942.    pop up a confirmation window, so we ask for a MWContext* to use for that
  2943.    (yick).  The folderinfo provided must represent a newsgroup.  This is to
  2944.    be used in the property dialog for that newsgroup. */
  2945.  
  2946. extern int MSG_SetIsHTMLOK(MSG_Master* master, MSG_FolderInfo* group,
  2947.                            MWContext* context, XP_Bool value);
  2948.  
  2949.  
  2950.  
  2951. /* Utility function that prefixes each line with "> " (for Paste As Quote). */
  2952. extern char *MSG_ConvertToQuotation (const char *string);
  2953.  
  2954. /* Paste the given plaintext into the running HTML editor as a quotation.
  2955.    This can only be used if the given composition pane is in HTML mode. */
  2956. extern int MSG_PastePlaintextQuotation(MSG_Pane* comppane, const char* string);
  2957.  
  2958.  
  2959. /* The user has just finished editing a given header (the field has lost focus
  2960.    or something like that.)  Find out if some magic change needs to be made
  2961.    (e.g., the user typed a nickname from the addressbook and we want to replace
  2962.    it with the specified address.)  If so, a new value to be displayed is
  2963.    returned.  The returned string, if any, must be freed using XP_FREE().  This
  2964.    should be called before calling MSG_SetCompHeader(). */
  2965.  
  2966. extern char* MSG_UpdateHeaderContents(MSG_Pane* comppane,
  2967.                                       MSG_HEADER_SET header,
  2968.                                       const char* value);
  2969.  
  2970.  
  2971. /* If the sanity check return MK_MSG_MIXED_SECURITY, then the user may choose
  2972.    to remove non-secure people from the list.  The FE can do so by calling
  2973.    this routine.  It will then have to call MSG_GetCompHeader a few times
  2974.    to get and redisplay the new values for the To, Cc, and Bcc fields. */
  2975.  
  2976. extern void MSG_RemoveNoCertRecipients(MSG_Pane* comppane);
  2977.  
  2978. /* Inform the backend what is to be attached.  The MSG_AttachmentData structure
  2979.    is defined in mime.h.  The "list" parameter is an array of these fields,
  2980.    terminated by one which has a NULL url field.  In each entry, all that you
  2981.    have to fill in is "url" and probably "desired_type"; NULL is generally fine
  2982.    for all the other fields (but you can fill them in too).  See mime.h for all
  2983.    the spiffy details.
  2984.  
  2985.    Note that this call copies (sigh) all the data into libmsg; it is up to the
  2986.    caller to free any data it had to allocate to create the MSG_AttachmentData
  2987.    structure. */
  2988.  
  2989. extern int MSG_SetAttachmentList(MSG_Pane* comppane,
  2990.                                   struct MSG_AttachmentData* list);
  2991.  
  2992.  
  2993. /* Get what msglib's idea of what the current attachments are.  DO NOT MODIFY
  2994.    THE DATA RETURNED; you can look, but don't touch.  If you want to change
  2995.    the data, you have to copy out the whole structure somewhere, make your
  2996.    changes, call MSG_SetAttachmentList() with your new data, and then free
  2997.    your copy.  If there are no attachments, this routine always returns
  2998.    NULL. */
  2999. extern const struct MSG_AttachmentData*
  3000. MSG_GetAttachmentList(MSG_Pane* comppane);
  3001.  
  3002.  
  3003.  
  3004.  
  3005. /* The FE should call this in response to a `Show Interesting Headers' command,
  3006.    and when first initializing the composition window..  It returns the set of
  3007.    headers that ought to be displayed (and checked in the "view" menu.)
  3008.  */
  3009. extern MSG_HEADER_SET MSG_GetInterestingHeaders(MSG_Pane* comppane);
  3010.  
  3011.  
  3012.  
  3013. /* This function creates a new, blank mail message composition window.  It
  3014.    causes calls to FE_CreateCompositionPane, which should drive the creation
  3015.    of the window.
  3016.  */
  3017.  
  3018. MSG_Pane* MSG_Mail(MWContext *old_context);
  3019.  
  3020. /* Convenience function to start composing a mail message from a web
  3021.    browser window - the currently-loaded document will be the default
  3022.    attachment should the user choose to attach it.  The context may
  3023.    be of any type, or NULL.  Returns the new message composition pane.
  3024.  
  3025.    This is going away, you should call MSG_MailDocumentURL with NULL
  3026.    for the second argument.
  3027. */
  3028. extern MSG_Pane* MSG_MailDocument(MWContext *context);
  3029. /* 
  3030.    Another version of MSG_MailDocument where pAttachmentURL explicitly gives the URL to attach.
  3031.    MSG_MailDocument() is still there for backwards compatability.
  3032.  */
  3033. extern MSG_Pane* MSG_MailDocumentURL(MWContext *context,const char *pAttachmentURL);
  3034.  
  3035. /* These routines were in mime.h, but defined in libmsg...*/
  3036.  
  3037. /* Given a string which contains a list of RFC822 addresses, parses it into
  3038.    their component names and mailboxes.
  3039.  
  3040.    The returned value is the number of addresses, or a negative error code;
  3041.    the names and addresses are returned into the provided pointers as
  3042.    consecutive null-terminated strings.  It is up to the caller to free them.
  3043.    Note that some of the strings may be zero-length.
  3044.  
  3045.    Either of the provided pointers may be NULL if the caller is not interested
  3046.    in those components.
  3047.  */
  3048. extern int MSG_ParseRFC822Addresses (const char *line,
  3049.                                      char **names, char **addresses);
  3050.  
  3051.  
  3052. /* Given a string which contains a list of RFC822 addresses, returns a
  3053.    comma-seperated list of just the `mailbox' portions.
  3054.  */
  3055. extern char *MSG_ExtractRFC822AddressMailboxes (const char *line);
  3056.  
  3057.  
  3058. /* Given a string which contains a list of RFC822 addresses, returns a
  3059.    comma-seperated list of just the `user name' portions.  If any of
  3060.    the addresses doesn't have a name, then the mailbox is used instead.
  3061.  */
  3062. extern char *MSG_ExtractRFC822AddressNames (const char *line);
  3063.  
  3064. /* Like MSG_ExtractRFC822AddressNames(), but only returns the first name
  3065.    in the list, if there is more than one. 
  3066.  */
  3067. extern char *MSG_ExtractRFC822AddressName (const char *line);
  3068.  
  3069. /* Given a string which contains a list of RFC822 addresses, returns a new
  3070.    string with the same data, but inserts missing commas, parses and reformats
  3071.    it, and wraps long lines with newline-tab.
  3072.  */
  3073. extern char * MSG_ReformatRFC822Addresses (const char *line);
  3074.  
  3075. /* Returns a copy of ADDRS which may have had some addresses removed.
  3076.    Addresses are removed if they are already in either ADDRS or OTHER_ADDRS.
  3077.    (If OTHER_ADDRS contain addresses which are not in ADDRS, they are not
  3078.    added.  That argument is for passing in addresses that were already
  3079.    mentioned in other header fields.)
  3080.  
  3081.    Addresses are considered to be the same if they contain the same mailbox
  3082.    part (case-insensitive.)  Real names and other comments are not compared.
  3083.  */
  3084. extern char *MSG_RemoveDuplicateAddresses (const char *addrs,
  3085.                                            const char *other_addrs);
  3086.  
  3087.  
  3088. /* Given an e-mail address and a person's name, cons them together into a
  3089.    single string of the form "name <address>", doing all the necessary quoting.
  3090.    A new string is returned, which you must free when you're done with it.
  3091.  */
  3092. extern char *MSG_MakeFullAddress (const char* name, const char* addr);
  3093.  
  3094. /* MSG_ParseRFC822Addresses returns quoted parsable addresses
  3095.    This function removes the quoting if you want to show the
  3096.    names to users. e.g. summary file, address book
  3097.  */
  3098. extern int MSG_UnquotePhraseOrAddr (char *line, char** lineout);
  3099.  
  3100.  
  3101. /* Returns the address book context, creating it if necessary.  A mail pane is
  3102.    passed in, on the unlikely chance that it might be useful for the FE.  If
  3103.    "viewnow" is TRUE, then present the address book window to the user;
  3104.    otherwise, don't (unless it is already visible).*/
  3105.  
  3106. extern MWContext* FE_GetAddressBookContext(MSG_Pane* pane, XP_Bool viewnow);
  3107.  
  3108. /* Notify the address book panes that the list of directory servers has changed 
  3109.     This is only called from the address book. */
  3110.  
  3111. extern int MSG_NotifyChangeDirectoryServers();
  3112.  
  3113. XP_END_PROTOS
  3114.  
  3115.  
  3116. #endif /* _MSGCOM_H_ */
  3117.