diff --git a/include/MANIFEST b/include/MANIFEST index 3ff7250f4466..c4321c0c48ca 100644 --- a/include/MANIFEST +++ b/include/MANIFEST @@ -5,7 +5,6 @@ client.h csid.h ctxtfunc.h -dirprefs.h edttypes.h fe_proto.h glhist.h @@ -13,14 +12,12 @@ gui.h intl_csi.h libc_r.h libi18n.h -libmime.h lo_ele.h merrors.h mime.h mimeenc.h minicom.h mk_cx_fn.h -msgcom.h msgtypes.h m_cvstrm.h ncompat.h diff --git a/include/Makefile.in b/include/Makefile.in index fcddb3f6aac0..a8f16fe7254d 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -29,7 +29,6 @@ EXPORTS = \ intl_csi.h \ libi18n.h \ merrors.h \ - msgcom.h \ msgtypes.h \ net.h \ npapi.h \ diff --git a/include/dirprefs.h b/include/dirprefs.h deleted file mode 100644 index 1498746f1df3..000000000000 --- a/include/dirprefs.h +++ /dev/null @@ -1,275 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#ifndef _DIRPREFS_H_ -#define _DIRPREFS_H_ - -#define kCurrentListVersion 1 - -/* DIR_Server.dirType */ -typedef enum -{ - LDAPDirectory, - HTMLDirectory, - PABDirectory -} DirectoryType; - -typedef enum -{ - cn, - givenname, - sn, - mail, - telephonenumber, - o, - ou, - l, - street, - auth, - custom1, - custom2, - custom3, - custom4, - custom5 -} DIR_AttributeId; - -typedef enum -{ - capLdapV3, /* LDAP v3.0 protocol */ - capVirtualListView, /* Virtual list view */ - - kNumCaps /* must be last capability */ -} DIR_ServerCaps; - -/* The values in this enum control the kind of LDAP filter expression - * we send to the LDAP server to do name completion - */ -typedef enum -{ - acsGivenAndSurname, /* do auto-complete using givenname and sn attributes */ - acsCnForwards, /* do auto-complete assuming cn in F L order */ - acsCnBackwards /* do auto-complete assuming cn in L, F order */ -} DIR_AutoCompleteStyle; - - -typedef struct _DIR_ReplicationInfo -{ - char *description; /* human readable description of replica */ - char *fileName; /* file name of replication database */ - char *filter; /* LDAP filter string which constrains the repl search */ - int32 lastChangeNumber; /* Last change we saw -- start replicating here */ - char *dataVersion; /* LDAP server's scoping of the lastChangeNumber */ - /* this changes when the server's DB gets reloaded from LDIF */ - char **excludedAttributes; /* list of attributes we shouldn't replicate */ - int excludedAttributesCount; /* duh */ -} DIR_ReplicationInfo; - - -typedef struct DIR_Server -{ - char *description; /* human readable name */ - char *serverName; /* network host name */ - char *searchBase; /* DN suffix to search at */ - char *fileName; /* XP path name of local DB */ - char *prefId; /* name of this server's tree in JS prefs */ - int port; /* network port number */ - int maxHits; /* maximum number of hits to return */ - XP_Bool isSecure; /* use SSL? */ - XP_Bool saveResults; - XP_Bool efficientWildcards; /* server can match substrings */ - char *lastSearchString; /* required if saving results */ - DirectoryType dirType; - uint32 flags; - uint32 refCount; /* Use count for server */ - - /* site-configurable attributes and filters */ - XP_List *customFilters; - XP_List *customAttributes; - char *tokenSeps; - XP_Bool stopFiltersOnHit; - XP_Bool isOffline; - - /* site-configurable list of attributes whose values are DNs */ - char **dnAttributes; - int dnAttributesCount; - - /* site-configurable list of attributes we shouldn't display in HTML */ - char **suppressedAttributes; - int suppressedAttributesCount; - - /* site-configurable list of attributes for the Basic Search dialog */ - DIR_AttributeId *basicSearchAttributes; - int basicSearchAttributesCount; - - /* site-configurable URL to open LDAP results */ - char *customDisplayUrl; - - /* authentication fields */ - XP_Bool enableAuth; /* Use DN and password when binding? */ - XP_Bool savePassword; /* Remember the DN and password we gave? */ - char *authDn; /* DN to give to authenticate as */ - char *password; /* Password for the DN */ - - /* Ldap fields */ - DIR_ReplicationInfo *replInfo; - char *searchPairList; - - /* auto-complete fields */ - DIR_AutoCompleteStyle autoCompleteStyle; - -} DIR_Server; - - -XP_BEGIN_PROTOS - -/* We are developing a new model for managing DIR_Servers. In the 4.0x world, the FEs managed each list. - Calls to FE_GetDirServer caused the FEs to manage and return the DIR_Server list. In our new view of the - world, the back end does most of the list management so we are going to have the back end create and - manage the list. Replace calls to FE_GetDirServers() with DIR_GetDirServers(). */ - -XP_List * DIR_GetDirServers(void); -int DIR_ShutDown(void); /* FEs should call this when the app is shutting down. It frees all DIR_Servers regardless of ref count values! */ - -int DIR_DecrementServerRefCount (DIR_Server *); -int DIR_IncrementServerRefCount (DIR_Server *); - -/* We are trying to phase out use of FE_GetDirServers. The back end is now managing the dir server list. So you should - be calling DIR_GetDirServers instead. */ - -XP_List * FE_GetDirServers(void); - -/* Since the strings in DIR_Server are allocated, we have bottleneck - * routines to help with memory mgmt - */ -int DIR_InitServer (DIR_Server *); -int DIR_ValidateServer (DIR_Server *); -int DIR_CopyServer (DIR_Server *in, DIR_Server **out); -XP_Bool DIR_AreServersSame (DIR_Server *first, DIR_Server *second); - -int DIR_DeleteServer (DIR_Server *); -int DIR_DeleteServerList(XP_List *wholeList); - -int DIR_GetLdapServers (XP_List *wholeList, XP_List *subList); -int DIR_ReorderLdapServers (XP_List *wholeList); - -/* These two routines should be called to initialize and save - * directory preferences from the XP Java Script preferences - */ -int DIR_GetServerPreferences (XP_List **list, const char* pabFile); -int DIR_SaveServerPreferences (XP_List *wholeList); - -/* This routine will clean up files for deleted directories */ -int DIR_CleanUpServerPreferences(XP_List *deletedList); - - -#if 1 - -/* Returns a pointer into the list (not allocated, so don't free) */ -int DIR_GetPersonalAddressBook (XP_List *wholeList, DIR_Server **pab); -int DIR_GetComposeNameCompletionAddressBook (XP_List *wholeList, DIR_Server **cab); - -/* Returns an allocated list of all personal address books, excluding - * LDAP directories, replicated directories, and CABs - */ -int DIR_GetPersonalAddressBooks (XP_List *wholeList, XP_List * subList); - -#else -XP_List *DIR_GetAddressBooksForCompletion (XP_List *wholeList); -#endif - -void DIR_GetServerFileName(char** filename, const char* leafName); -void DIR_SetServerFileName(DIR_Server* pServer, const char* leafName); - -/* APIs for site-configurability of LDAP attribute names and - * search filter behavior. - * - * Strings are NOT allocated, and arrays are NULL-terminated - */ -const char *DIR_GetAttributeName (DIR_Server *server, DIR_AttributeId id); -const char **DIR_GetAttributeStrings (DIR_Server *server, DIR_AttributeId id); -const char *DIR_GetFirstAttributeString (DIR_Server *server, DIR_AttributeId id); -const char *DIR_GetFilterString (DIR_Server *server); -const char *DIR_GetReplicationFilter (DIR_Server *server); -const char *DIR_GetTokenSeparators (DIR_Server *server); -XP_Bool DIR_RepeatFilterForTokens (DIR_Server *server, const char *filter); -XP_Bool DIR_SubstStarsForSpaces (DIR_Server *server, const char *filter); -XP_Bool DIR_UseCustomAttribute (DIR_Server *server, DIR_AttributeId id); - -XP_Bool DIR_IsDnAttribute (DIR_Server *s, const char *attr); -XP_Bool DIR_IsAttributeExcludedFromHtml (DIR_Server *s, const char *attr); - -int DIR_AttributeNameToId (const char *attrName, DIR_AttributeId *id); - -/* APIs for authentication */ -void DIR_SetAuthDN (DIR_Server *s, const char *dn); -void DIR_SetPassword (DIR_Server *s, const char *password); - -/* APIs for unescaping LDAP special chars */ -char *DIR_Unescape (const char *src, XP_Bool makeHtml); -XP_Bool DIR_IsEscapedAttribute (DIR_Server *s, const char *attrib); - -/* API for building a URL */ -char *DIR_BuildUrl (DIR_Server *s, const char *dn, XP_Bool forAddToAB); - -/* Walks the list enforcing the rule that only one LDAP server can be configured for autocomplete */ -void DIR_SetAutoCompleteEnabled (XP_List *list, DIR_Server *server, XP_Bool enabled); - -/* Flags manipulation */ - -#define DIR_AUTO_COMPLETE_ENABLED 0x00000001 /* Directory is configured for autocomplete addressing */ -#define DIR_ENABLE_AUTH 0x00000002 /* Directory is configured for LDAP simple authentication */ -#define DIR_SAVE_PASSWORD 0x00000004 -#define DIR_UTF8_DISABLED 0x00000008 /* not used by the FEs */ -#define DIR_IS_SECURE 0x00000010 -#define DIR_SAVE_RESULTS 0x00000020 /* not used by the FEs */ -#define DIR_EFFICIENT_WILDCARDS 0x00000040 /* not used by the FEs */ -#define DIR_REPLICATION_ENABLED 0x00000080 /* Directory is configured for offline use */ -#define DIR_LDAP_PUBLIC_DIRECTORY 0x00000100 /* not used by the FEs */ -#define DIR_LDAP_VERSION3 0x00000200 /* not used by the FEs */ -#define DIR_LDAP_VIRTUALLISTVIEW 0x00000400 /* not used by the FEs */ -#define DIR_LDAP_ROOTDSE_PARSED 0x00000800 /* not used by the FEs */ - -XP_Bool DIR_TestFlag (DIR_Server *server, uint32 flag); -void DIR_SetFlag (DIR_Server *server, uint32 flag); -void DIR_ClearFlag (DIR_Server *server, uint32 flag); -void DIR_ForceFlag (DIR_Server *server, uint32 flag, XP_Bool forceOnOrOff); - -char *DIR_ConvertToServerCharSet (DIR_Server *s, char *src, int16 srcCsid); -char *DIR_ConvertFromServerCharSet (DIR_Server *s, char *src, int16 dstCsid); - -#ifdef MOZ_LDAP - -/* Does the LDAP client lib work for SSL */ -#include "ldap.h" - -int DIR_SetupSecureConnection (LDAP *l); - -/* APIs for replication */ -int DIR_ValidateRootDSE (DIR_Server *s, char *version, int32 first, int32 last); -int DIR_ParseRootDSE (DIR_Server *s, LDAP *ld, LDAPMessage *message); - -#endif /* MOZ_LDAP */ - -XP_END_PROTOS - - -#endif /* dirprefs.h */ diff --git a/include/libmime.h b/include/libmime.h deleted file mode 100644 index 5bc573b0c5d1..000000000000 --- a/include/libmime.h +++ /dev/null @@ -1,561 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -/* libmime.h --- external interface to libmime.a - Created: Jamie Zawinski , 15-May-96. - */ - - -#ifndef _LIBMIME_H_ -#define _LIBMIME_H_ - -#include "xp.h" - -#ifndef MOZILLA_30 -# define MIME_DRAFTS -#endif - -/* Opaque object describing a block of message headers, and a couple of - routines for extracting data from one. - */ - -typedef struct MimeHeaders -{ - char *all_headers; /* A char* of the entire header section. */ - int32 all_headers_fp; /* The length (it is not NULL-terminated.) */ - uint32 all_headers_size; /* The size of the allocated block. */ - - XP_Bool done_p; /* Whether we've read the end-of-headers marker - (the terminating blank line.) */ - - char **heads; /* An array of length n_headers which points - to the beginning of each distinct header: - just after the newline which terminated - the previous one. This is to speed search. - - This is not initialized until all the - headers have been read. - */ - int32 heads_size; /* The length (and consequently, how many - distinct headers are in here.) */ - - - char *obuffer; /* This buffer is used for output. */ - uint32 obuffer_size; - int32 obuffer_fp; - - char *munged_subject; /* What a hack. This is a place to write down - the subject header, after it's been - charset-ified and stuff. Remembered so that - we can later use it to generate the - tag. */ -} MimeHeaders; - -typedef struct MimeDisplayOptions MimeDisplayOptions; -typedef struct MimeParseStateObject MimeParseStateObject; -/*#ifndef MOZILLA_30*/ -typedef struct MSG_AttachmentData MSG_AttachmentData; -/*#endif*/ - -XP_BEGIN_PROTOS - -/* Given the name of a header, returns the contents of that header as - a newly-allocated string (which the caller must free.) If the header - is not present, or has no contents, NULL is returned. - - If `strip_p' is TRUE, then the data returned will be the first token - of the header; else it will be the full text of the header. (This is - useful for getting just "text/plain" from "text/plain; name=foo".) - - If `all_p' is FALSE, then the first header encountered is used, and - any subsequent headers of the same name are ignored. If TRUE, then - all headers of the same name are appended together (this is useful - for gathering up all CC headers into one, for example.) - */ -extern char *MimeHeaders_get(MimeHeaders *hdrs, - const char *header_name, - XP_Bool strip_p, - XP_Bool all_p); - -/* Given a header of the form of the MIME "Content-" headers, extracts a - named parameter from it, if it exists. For example, - MimeHeaders_get_parameter("text/plain; charset=us-ascii", "charset") - would return "us-ascii". - - Returns NULL if there is no match, or if there is an allocation failure. - - RFC2231 - MIME Parameter Value and Encoded Word Extensions: Character Sets, - Languages, and Continuations - - RFC2231 has added the character sets, languages, and continuations mechanism. - charset, and language information may also be returned to the caller. - For example, - MimeHeaders_get_parameter("text/plain; name*=us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A", "name") - MimeHeaders_get_parameter("text/plain; name*0*=us-ascii'en-us'This%20is%20; CRLFLWSPname*1*=%2A%2A%2Afun%2A%2A%2A", "name") - would return "This is ***fun***" and *charset = "us-ascii", *language = "en-us" - */ -extern char *MimeHeaders_get_parameter (const char *header_value, - const char *parm_name, - char **charset, - char **language); - -extern MimeHeaders *MimeHeaders_copy (MimeHeaders *srcHeaders); - -extern void MimeHeaders_free (MimeHeaders *hdrs); - -/* Some defines for various standard header field names. - */ -#define HEADER_BCC "BCC" -#define HEADER_CC "CC" -#define HEADER_CONTENT_BASE "Content-Base" -#define HEADER_CONTENT_DESCRIPTION "Content-Description" -#define HEADER_CONTENT_DISPOSITION "Content-Disposition" -#define HEADER_CONTENT_ENCODING "Content-Encoding" -#define HEADER_CONTENT_LENGTH "Content-Length" -#define HEADER_CONTENT_NAME "Content-Name" -#define HEADER_CONTENT_TRANSFER_ENCODING "Content-Transfer-Encoding" -#define HEADER_CONTENT_TYPE "Content-Type" -#define HEADER_DATE "Date" -#define HEADER_DISTRIBUTION "Distribution" -#define HEADER_FCC "FCC" -#define HEADER_FOLLOWUP_TO "Followup-To" -#define HEADER_FROM "From" -#define HEADER_LINES "Lines" -#define HEADER_MESSAGE_ID "Message-ID" -#define HEADER_MIME_VERSION "MIME-Version" -#define HEADER_NEWSGROUPS "Newsgroups" -#define HEADER_ORGANIZATION "Organization" -#define HEADER_REFERENCES "References" -#define HEADER_REPLY_TO "Reply-To" -#define HEADER_RESENT_COMMENTS "Resent-Comments" -#define HEADER_RESENT_DATE "Resent-Date" -#define HEADER_RESENT_FROM "Resent-From" -#define HEADER_RESENT_MESSAGE_ID "Resent-Message-ID" -#define HEADER_RESENT_SENDER "Resent-Sender" -#define HEADER_RESENT_TO "Resent-To" -#define HEADER_RESENT_CC "Resent-CC" -#define HEADER_SENDER "Sender" -#define HEADER_SUBJECT "Subject" -#define HEADER_TO "To" -#define HEADER_X_MAILER "X-Mailer" -#define HEADER_X_NEWSREADER "X-Newsreader" -#define HEADER_X_POSTING_SOFTWARE "X-Posting-Software" -#define HEADER_X_MOZILLA_STATUS "X-Mozilla-Status" -#define HEADER_X_MOZILLA_NEWSHOST "X-Mozilla-News-Host" -#define HEADER_X_MOZILLA_DRAFT_INFO "X-Mozilla-Draft-Info" -#define HEADER_X_UIDL "X-UIDL" -#define HEADER_XREF "XREF" -#define HEADER_X_SUN_CHARSET "X-Sun-Charset" -#define HEADER_X_SUN_CONTENT_LENGTH "X-Sun-Content-Length" -#define HEADER_X_SUN_CONTENT_LINES "X-Sun-Content-Lines" -#define HEADER_X_SUN_DATA_DESCRIPTION "X-Sun-Data-Description" -#define HEADER_X_SUN_DATA_NAME "X-Sun-Data-Name" -#define HEADER_X_SUN_DATA_TYPE "X-Sun-Data-Type" -#define HEADER_X_SUN_ENCODING_INFO "X-Sun-Encoding-Info" -#define HEADER_X_PRIORITY "X-Priority" - -#define HEADER_PARM_BOUNDARY "BOUNDARY" -#define HEADER_PARM_FILENAME "FILENAME" -#define HEADER_PARM_NAME "NAME" -#define HEADER_PARM_TYPE "TYPE" - - -typedef enum { - MimeHeadersAll, /* Show all headers */ - MimeHeadersSome, /* Show all "interesting" headers */ - MimeHeadersSomeNoRef, /* Same, but suppress the `References' header - (for when we're printing this message.) */ - MimeHeadersMicro, /* Show a one-line header summary */ - MimeHeadersMicroPlus, /* Same, but show the full recipient list as - well (To, CC, etc.) */ - MimeHeadersCitation /* A one-line summary geared toward use in a - reply citation ("So-and-so wrote:") */ -} MimeHeadersState; - - -/* The signature for various callbacks in the MimeDisplayOptions structure. - */ -typedef char *(*MimeHTMLGeneratorFunction) (const char *data, void *closure, - MimeHeaders *headers); - -struct MimeDisplayOptions -{ - const char *url; /* Base URL for the document. This string should - be freed by the caller, after the parser - completes (possibly at the same time as the - MimeDisplayOptions itself.) */ - -#ifndef MOZILLA_30 - MSG_Pane* pane; /* The libmsg pane object that corresponds to - what we're showing. This is used by very - little... */ -#endif /* !MOZILLA_30 */ - - MimeHeadersState headers; /* How headers should be displayed. */ - XP_Bool fancy_headers_p; /* Whether to do clever formatting of headers - using tables, instead of spaces. */ - -#ifndef MOZILLA_30 - XP_Bool output_vcard_buttons_p; /* Whether to output the buttons */ - /* on vcards. */ -#endif /* !MOZILLA_30 */ - - XP_Bool fancy_links_p; /* Whether to insert fancy links, so you can - do things like click on an email address to - add it to your address book. Something you - don't want to do while printing. */ - - XP_Bool variable_width_plaintext_p; /* Whether text/plain messages should - be in variable width, or fixed. */ - XP_Bool wrap_long_lines_p; /* Whether to wrap long lines in text/plain - messages. */ - - XP_Bool rot13_p; /* Whether text/plain parts should be rotated - Set by "?rot13=true" */ - XP_Bool no_inline_p; /* Whether inline display of attachments should - be suppressed. Set by "?inline=false" */ - char *part_to_load; /* The particular part of the multipart which - we are extracting. Set by "?part=3.2.4" */ - - XP_Bool write_html_p; /* Whether the output should be HTML, or raw. */ - - XP_Bool decrypt_p; /* Whether all traces of encryption should be - eradicated -- this is only meaningful when - write_html_p is FALSE; we set this when - attaching a message for forwarding, since - forwarding someone else a message that wasn't - encrypted for them doesn't work. We have to - decrypt it before sending it. - */ - -#ifndef MOZILLA_30 - XP_Bool nice_html_only_p; /* If TRUE, then we only should write html if - it's pretty HTML (stuff that we're willing - to get shipped out in mail messages). If we - can't generate nice stuff for some part, - then don't say anything at all. */ - - XP_Bool dont_touch_citations_p; /* If TRUE, then we should leave citations - alone in plaintext parts. If FALSE, then - go ahead and tweak the fonts according - to preferences. */ -#endif /* !MOZILLA_30 */ - - char *default_charset; /* If this is non-NULL, then it is the charset to - assume when no other one is specified via a - `charset' parameter. - */ - char *override_charset; /* If this is non-NULL, then we will assume that - all data is in this charset, regardless of what - the `charset' parameter of that part says. - This overrides `default_charset' as well. - (This is to cope with the fact that, in the - real world, many messages are mislabelled with - the wrong charset.) - */ - - /* ======================================================================= - Stream-related callbacks; for these functions, the `closure' argument - is what is found in `options->stream_closure'. (One possible exception - is for output_fn; see "output_closure" below.) - */ - void *stream_closure; - - /* For setting up the display stream, so that the MIME parser can inform - the caller of the type of the data it will be getting. */ - int (*output_init_fn) (const char *type, - const char *charset, - const char *name, - const char *x_mac_type, - const char *x_mac_creator, - void *stream_closure); - - /* How the MIME parser feeds its output (HTML or raw) back to the caller. */ - int (*output_fn) (char *buf, int32 size, void *closure); - - /* Closure to pass to the above output_fn. If NULL, then the - stream_closure is used. */ - void *output_closure; - - /* A callback used to encapsulate an HTML section and to reset the - HTML parser to its default state at the end of a section. - start_p indicates whether this is being called just before the - start or immediately after the end of the encapsulated HTML. - layer_encapsulate_p indicates whether or not to put special - ILAYER container tags around the HTML -- Also, when start_p is - FALSE, this function should close off any tags we've left open, - reset the font size and face, etc. This may be called multiple - times -- in particular, it will be called at the end of each - message part which might contain human-generated (and thus - arbitrarily buggy) markup. The `abort_p' argument specifies - whether it's ok for data to be discarded. - */ - int (*set_html_state_fn) (void *stream_closure, - XP_Bool layer_encapsulate_p, - XP_Bool start_p, - XP_Bool abort_p); - - /* A hook for the caller to perform charset-conversion before HTML is - returned. Each set of characters which originated in a mail message - (body or headers) will be run through this filter before being converted - into HTML. (This should return bytes which may appear in an HTML file, - ie, we must be able to scan through the string to search for "<" and - turn it in to "<", and so on.) - - `input' is a non-NULL-terminated string of a single line from the message. - `input_length' is how long it is. - `input_charset' is a string representing the charset of this string (as - specified by MIME headers.) - `output_charset' is the charset to which conversion is desired. - `output_ret' is where a newly-malloced string is returned. It may be - NULL if no translation is needed. - `output_size_ret' is how long the returned string is (it need not be - NULL-terminated.). - */ - int (*charset_conversion_fn) (const char *input_line, int32 input_length, - const char *input_charset, - const char *output_charset, - char **output_ret, int32 *output_size_ret, - void *stream_closure); - - /* A hook for the caller to perform both charset-conversion and decoding of - MIME-2 header fields (using RFC-1522 encoding.) Arguments and returned - values are as for `charset_conversion_fn'. - */ - int (*rfc1522_conversion_fn) (const char *input_line, int32 input_length, - const char *input_charset, - const char *output_charset, - char **output_ret, int32 *output_size_ret, - void *stream_closure); - - /* A hook for the caller to translate a time string into a prettier or more - compact or localized form. */ - char *(*reformat_date_fn) (const char *old_date, void *stream_closure); - - /* A hook for the caller to turn a file name into a content-type. */ - char *(*file_type_fn) (const char *filename, void *stream_closure); - - /* A hook for the caller to turn a content-type into descriptive text. */ - char *(*type_description_fn) (const char *content_type,void *stream_closure); - - /* A hook for the caller to turn a content-type into an image icon. */ - char *(*type_icon_name_fn) (const char *content_type, void *stream_closure); - - /* A hook by which the user may be prompted for a password by the security - library. (This is really of type `SECKEYGetPasswordKey'; see sec.h.) */ - void *(*passwd_prompt_fn)(void *arg1, void *arg2); - void *passwd_prompt_fn_arg; - - /* ======================================================================= - Various callbacks; for all of these functions, the `closure' argument - is what is found in `html_closure'. - */ - void *html_closure; - - /* For emitting some HTML before the start of the outermost message - (this is called before any HTML is written to layout.) */ - MimeHTMLGeneratorFunction generate_header_html_fn; - - /* For emitting some HTML after the outermost header block, but before - the body of the first message. */ - MimeHTMLGeneratorFunction generate_post_header_html_fn; - - /* For emitting some HTML at the very end (this is called after libmime - has written everything it's going to write.) */ - MimeHTMLGeneratorFunction generate_footer_html_fn; - - /* For turning a message ID into a loadable URL. */ - MimeHTMLGeneratorFunction generate_reference_url_fn; - - /* For turning a mail address into a mailto URL. */ - MimeHTMLGeneratorFunction generate_mailto_url_fn; - - /* For turning a newsgroup name into a news URL. */ - MimeHTMLGeneratorFunction generate_news_url_fn; - - /* ======================================================================= - Callbacks to handle the backend-specific inlined image display - (internal-external-reconnect junk.) For `image_begin', the `closure' - argument is what is found in `stream_closure'; but for all of the - others, the `closure' argument is the data that `image_begin' returned. - */ - - /* Begins processing an embedded image; the URL and content_type are of the - image itself. */ - void *(*image_begin) (const char *image_url, const char *content_type, - void *stream_closure); - - /* Stop processing an image. */ - void (*image_end) (void *image_closure, int status); - - /* Dump some raw image data down the stream. */ - int (*image_write_buffer) (char *buf, int32 size, void *image_closure); - - /* What HTML should be dumped out for this image. */ - char *(*make_image_html) (void *image_closure); - - - /* ======================================================================= - Other random opaque state. - */ - MimeParseStateObject *state; /* Some state used by libmime internals; - initialize this to 0 and leave it alone. - */ - - -#ifdef MIME_DRAFTS - /* ======================================================================= - Mail Draft hooks -- 09-19-1996 - */ - XP_Bool decompose_file_p; /* are we decomposing a mime msg - into separate files */ - XP_Bool done_parsing_outer_headers; /* are we done parsing the outer message - headers; this is really useful when - we have multiple Message/RFC822 - headers */ - XP_Bool is_multipart_msg; /* are we decomposing a multipart - message */ - - int decompose_init_count; /* used for non multipart message only - */ - - XP_Bool signed_p; /* to tell draft this is a signed - message */ - - /* Callback to gather the outer most headers so we could use the - information to initialize the addressing/subject/newsgroups fields - for the composition window. */ - int (*decompose_headers_info_fn) (void *closure, - MimeHeaders *headers); - - /* Callbacks to create temporary files for drafts attachments. */ - int (*decompose_file_init_fn) (void *stream_closure, - MimeHeaders *headers ); - - int (*decompose_file_output_fn) (char *buf, int32 size, - void *stream_closure); - - int (*decompose_file_close_fn) (void *stream_closure); -#endif /* MIME_DRAFTS */ - - int32 attachment_icon_layer_id; /* Hackhackhack. This is zero if we have - not yet emitted the attachment layer - stuff. If we have, then this is the - id number for that layer, which is a - unique random number every time, to keep - evil people from writing javascript code - to hack it. */ - - XP_Bool missing_parts; /* Whether or not this message is going to contain - missing parts (from IMAP Mime Parts On Demand) */ - -}; - - - -/* Mozilla-specific interfaces - */ - -/* Given a URL, this might return a better suggested name to save it as. - - When you have a URL, you can sometimes get a suggested name from - URL_s->content_name, but if you're saving a URL to disk before the - URL_Struct has been filled in by netlib, you don't have that yet. - - So if you're about to prompt for a file name *before* you call FE_GetURL - with a format_out of FO_SAVE_AS, call this function first to see if it - can offer you advice about what the suggested name for that URL should be. - - (This works by looking in a cache of recently-displayed MIME objects, and - seeing if this URL matches. If it does, the remembered content-name will - be used.) - */ -extern char *MimeGuessURLContentName(MWContext *context, const char *url); - -/* Given a URL, return the content type for the mime part, if the passed context - recently parsed a message containing the part specified by the URL. - This is used to figure out if we need to open the url in a browser window, - or if we're just going to do a save as, anyay. -*/ -extern char *MimeGetURLContentType(MWContext *context, const char *url); - - -/* Determines whether the given context is currently showing a text/html - message. (Used by libmsg to determine if replys should bring up the - text/html editor. */ - -extern XP_Bool MimeShowingTextHtml(MWContext* context); - - - -/* Yeech, hack... Determine the URL to use to save just the HTML part of the - currently-displayed message to disk. If the current message doesn't have - a text/html part, returns NULL. Otherwise, the caller must free the - returned string using XP_FREE(). */ - -extern char* MimeGetHtmlPartURL(MWContext* context); - - -/* Return how many attachments are in the currently-displayed message. */ -extern int MimeGetAttachmentCount(MWContext* context); - -/* Returns what attachments are being viewed in the currently-displayed - message. The returned data must be free'd using - MimeFreeAttachmentList(). */ -extern int MimeGetAttachmentList(MWContext* context, - MSG_AttachmentData** data); - -extern void MimeFreeAttachmentList(MSG_AttachmentData* data); - - -/* Call this when destroying a context; this frees up some memory. - */ -extern void MimeDestroyContextData(MWContext *context); - - -/* After a message has been fully displayed (the document has finished - loading) FEs call this with a Mail or News window to determine how - the "security" toolbar button should be rendered. - - The first two values are whether it was an encrypted and/or signed - message; the second two are whether it was *valid*. - */ -extern void MIME_GetMessageCryptoState(MWContext *context, - XP_Bool *signed_return, - XP_Bool *encrypted_return, - XP_Bool *signed_ok_return, - XP_Bool *encrypted_ok_return); - -#ifndef MOZILLA_30 -/* Used only by libnet, this indicates that the user bonked on the "show me - details about attachments" button. */ - -extern int MIME_DisplayAttachmentPane(MWContext* context); -#endif /* MOZILLA_30 */ - -/* Register message/rfc822, message/news, etc. with netlib. */ -extern void MIME_RegisterConverters(void); - - -XP_END_PROTOS - -#endif /* _LIBMIME_H_ */ diff --git a/include/makefile.win b/include/makefile.win index 691115ceb95b..bf6be0cbfefe 100644 --- a/include/makefile.win +++ b/include/makefile.win @@ -54,7 +54,6 @@ EXPORTS = \ libi18n.h \ merrors.h \ minicom.h \ - msgcom.h \ msgtypes.h \ net.h \ npapi.h \ diff --git a/include/msgcom.h b/include/msgcom.h deleted file mode 100644 index c4cf0b9c2751..000000000000 --- a/include/msgcom.h +++ /dev/null @@ -1,2616 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -/* msgcom.h --- prototypes for the mail/news reader module. - Created: Jamie Zawinski <jwz@netscape.com>, 10-May-95. - */ - -#ifndef _MSGCOM_H_ -#define _MSGCOM_H_ - -#if 0 -#include "libmime.h" -#endif - -#define SUBSCRIBE_USE_OLD_API - -/* =========================================================================== - This file defines all of the types and prototypes for communication - between the msg library, which implements the mail and news applications, - and the various front ends. - - Functions beginning with MSG_ are defined in the library, and are invoked - by the front ends in response to user activity. - - Functions beginning with FE_ are defined by the front end, and are invoked - by the message library to get things to happen on the screen. - - The main parts of this file are listed below: - - COMMAND NUMBERS - CONSTANTS AND ENUMS - FLAGS AND MASKS - TYPES AND STRUCTS - - INIT/CREATE - RANDOM CORE FUNCTIONS (to sort) - PREFERENCES - LIST CALLBACKS - HOSTS - SUBSCRIBE WINDOW - OFFLINE NEWS - OFFLINE IMAP - QUERIES - BIFF - OTHER INTERFACES - SECURE MAIL - COMPOSE WINDOW - - =========================================================================== - */ - - -#if 0 -#include "xp_mcom.h" -#include "xp_core.h" -#include "ntypes.h" -#endif -#include "msgtypes.h" - -/* =========================================================================== - COMMAND NUMBERS - =========================================================================== - */ - -/* This enumerates all of the mail/news-specific commands (those which are - not shared with the web browsers. The front ends should invoke each of - these menu items through the MSG_Command() function like so: - - MSG_Command (context, MSG_PostReply); - - This interface is used for selections of normal menu items, toolbar - buttons, and keyboard equivalents. Clicks in the scrolling list windows, - drag-and-drop, and the "folders" menus are handled differently. - - Different items are meaningful in different sets of panes. The comments - indicate which: - - f: Usable in folder panes (either mail or news) - fn: Usable only in news folderpanes - fm: Usable only in mail folderpanes - t: Usable in thread panes - tn: Usable only in news threadpanes - tm: Usable only in mail threadpanes - m: Usable in message panes - mn: Usable only in news messagepanes - mm: Usable only in mail messagepanes - c: Usable in composition panes - sub: Usable in the subscribe pane - - In general, an item which works on folders can either be called on - the folder pane (in which case it effects the specified folders), - or on a threadpane (in which case it effects the folder being - displayed in the threadpane). Similarly, items which work on - messages can be either called on a threadpane or on a messagepane. - - Also, in general, commands useable in news folder pane work in the - category pane as well. - */ - -typedef enum -{ - /* FILE MENU - ========= - */ - MSG_GetNewMail, /* fm: Gets new mail messages, and appends them - to the appropriate folders. This is an - asynchronous operation; it will eventually - cause FE_ListChangeStarting and - FE_ListChangeFinished to be called on any - threadpanes displaying a folder which is - modified. */ - MSG_GetNextChunkMessages, /* f,t Get the next N news messages, based on chunk - size. */ - MSG_UpdateMessageCount, /* f,t,m News only - Update the message counts */ - - MSG_DeliverQueuedMessages, /* f,t,m: Deliver messages waiting to be - delivered in the queued folder. */ - - MSG_OpenFolder, /* fm: Prompt the user for the full pathname of - a mail file, and creates an entry for it - (i.e., calls MSG_CreateFolder). */ - - MSG_NewFolder, /* f,t,m: Prompt the user for a new folder or - subfolder name, and creates it (i.e., calls - MSG_CreateFolder) */ - - MSG_CompressFolder, /* fm: Causes the given folders to be - compressed. */ - - MSG_CompressAllFolders, /* fm: Causes all the folders to be - compressed. */ - - MSG_DoRenameFolder, /* fm: Prompt the user for a new folder or - subfolder name, and renames the selected - folder to have that name (i.e., calls - MSG_RenameFolder()). */ - - MSG_AddNewsGroup, /* fn: Prompts the user for a newsgroup name, - and adds it to the list of newsgroups (i.e., - subscribes the user). */ - - MSG_EmptyTrash, /* fm: Causes the trash folder to be emptied, - and all the folders to be compressed. */ - - MSG_Unsubscribe, /* f, Unsubscribe to the selected newsgroup(s) - Delete currently does this as well. */ - - MSG_ManageMailAccount, /* f: Prompts the user for mail account password - if needed and brings up the GURL web page */ - - MSG_Print, /* not a command - used for selectability only */ - - MSG_NewNewsgroup, /* ft: Prompts the user for a new newsgroup name */ - /* and brings up the NGURL web page */ - - MSG_ModerateNewsgroup, /* ft: brings up the MODURL web page for the */ - /* selected group */ - - MSG_NewCategory, /* ft: Prompts the user for a new category name */ - /* and brings up the NGURL web page */ - - /* VIEW/SORT MENUS - =============== - */ - MSG_ReSort, /* t: Re-apply the current sort. */ - MSG_SortBackward, /* t: Reverse the order of the sort. */ - MSG_SortByDate, /* t: Sort in chronological order. */ - MSG_SortBySubject, /* t: Sort alphabetized by subject. */ - MSG_SortBySender, /* t: Sort alphabetized by sender. */ - MSG_SortByMessageNumber, /* t: Sort in order stored in mail folder, or - in numerical article number if news. */ - MSG_SortByThread, /* t: Sort in threads. */ - MSG_SortByPriority, /* t: Sort by priority - highest first. */ - MSG_SortByStatus, /* t: Sort by message status - new first. */ - MSG_SortBySize, /* t: Sort by size */ - MSG_SortByFlagged, /* t: Sort by flag state */ - MSG_SortByUnread, /* t: Sort by unread state */ - - MSG_ViewAllThreads, /* t: (except for killed threads) -default */ - MSG_ViewKilledThreads, /* t: Show all incl. killed threads */ - MSG_ViewThreadsWithNew, /* t: Show only threads with new messages */ - MSG_ViewWatchedThreadsWithNew,/* t: Show only watched thrds with new msgs */ - MSG_ViewNewOnly, /* t: Show only new messages */ - - MSG_Rot13Message, /* m: Apply fancy rot13 encryption. */ - - MSG_AttachmentsInline, /* m: Display attachments in line. */ - MSG_AttachmentsAsLinks, /* m: Display attachments as links */ - - MSG_WrapLongLines, - - /* EDIT MENU - ========= - */ - MSG_Undo, /* ftm: Undoes the last operation. */ - - MSG_Redo, /* ftm: Redoes the last undone operation. */ - - MSG_Delete, - - MSG_DeleteMessage = MSG_Delete, /* tm, mm: Causes the given messages to be - deleted. */ - - MSG_DeleteFolder /* = MSG_Delete */, /* fm, tm: Causes the given folders to be - deleted. */ - - MSG_CancelMessage, /* tn, mn: Causes the given messages to be - cancelled, if possible. */ - - MSG_DeleteNoTrash, - MSG_DeleteMessageNoTrash = MSG_DeleteNoTrash, /* tm, mm: Causes the given messages to be - deleted w/o getting copied to trash. */ - - /* MESSAGE MENU - ============ - */ - MSG_EditAddressBook, /* f,t,m,c: Bring up the address book. */ - MSG_EditAddress, /* m: Bring up the address book entry for the - sender of this message. */ - MSG_AddSender, /* t,m: Add the sender of this message. - to the address book */ - MSG_AddAll, /* t,m: Add all recipients of this message. - to the address book */ - MSG_PostNew, /* fn,tn: Post a new message to this - newsgroup. */ - MSG_PostReply, /* tn,mn: Post a followup message to this - article. */ - MSG_PostAndMailReply, /* tn,mn: Post a followup message to this - article, mailing a copy to the author. */ - MSG_MailNew, /* f,t,m,c: Create a new mail composition. */ - MSG_ReplyToSender, /* t,m: E-mail a reply to the sender of this - message. */ - MSG_ReplyToAll, /* t,m: E-mail (& possibly post) a reply to - everyone who saw this message. */ - MSG_ForwardMessage, /* t,m: Forward these messages to someone. */ - MSG_ForwardMessageAttachment, /* t,m: Forward these messages as attachment - to someone. */ - MSG_ForwardMessageQuoted, /* t,m: Forward this message, quoting it - inline. */ - MSG_ForwardMessageInline, /* t,m: Forward this message inline including - inline attaachments if possible*/ - - MSG_MarkMessagesRead, /* t,m: Mark the message as read. */ - MSG_MarkMessagesUnread, /* t,m: Mark the message as unread. */ - MSG_ToggleMessageRead, /* t,m: Toggle whether the message has been - read. */ - MSG_MarkMessages, /* tn: flag the passed messages,either for - retrieval or just to mark them */ - MSG_UnmarkMessages, /* tn: unflag passed messages */ - MSG_ToggleThreadKilled, /* t: toggle the killed status of the message's - thread */ - MSG_ToggleThreadWatched, /* t: toggle the watched status of the message's - thread */ - MSG_SaveMessagesAs, /* t,m: Prompt the user for a filename, and - save the given messages into it. */ - MSG_SaveMessagesAsAndDelete, /* t,m: Prompt the user for a filename, and - save the given messages into it, and then - delete the messages. */ - MSG_RetrieveMarkedMessages, /* fn, tn Retrieve the messages marked for - retrieval */ - MSG_RetrieveSelectedMessages, /* fn, tn Retrieve the selected messages for - offline use. */ - MSG_OpenMessageAsDraft, /* t,m: Open the selected message as a draft - message. Ready to send or further editing. */ - - /* GO MENU - ======= - */ - MSG_MarkThreadRead, /* t,m: Mark all messages in the same thread - as these as read.*/ - MSG_MarkAllRead, /* t: Mark all messages in this folder as - read. */ - - - /* OPTIONS MENU - ============ - */ - MSG_ShowAllMessages, /* t: Change the view to show all messages. */ - MSG_ShowOnlyUnreadMessages, /* t: Change the view to show only unread - messages. */ - MSG_ShowMicroHeaders, /* m: Change to show very compact headers. */ - MSG_ShowSomeHeaders, /* m: Change to show interesting headers. */ - MSG_ShowAllHeaders, /* m: Change to show all headers. */ - - - /* COMPOSITION FILE MENU - ===================== - */ - MSG_SendMessage, /* c: Send the composition. */ - MSG_SendMessageLater, /* c: Queue the composition to be sent - later. */ - MSG_Attach, /* c: Bring up the attachment dialogs. */ - MSG_SaveDraft, /* c: Save draft */ - MSG_SaveDraftThenClose, /* c: Save draft and then close the compose pane */ - MSG_SaveTemplate, /* c: Save as template */ - - /* COMPOSITION VIEW MENU - ===================== - */ - MSG_ShowFrom, /* c: Toggle showing the From header. */ - MSG_ShowReplyTo, /* c: Toggle showing the ReplyTo header. */ - MSG_ShowTo, /* c: Toggle showing the To header. */ - MSG_ShowCC, /* c: Toggle showing the Const Char header. */ - MSG_ShowBCC, /* c: Toggle showing the BCC header. */ - MSG_ShowFCC, /* c: Toggle showing the FCC header. */ - MSG_ShowPostTo, /* c: Toggle showing the PostTo header. */ - MSG_ShowFollowupTo, /* c: Toggle showing the FollowupTo header. */ - MSG_ShowSubject, /* c: Toggle showing the Subject header. */ - MSG_ShowAttachments, /* c: Toggle showing the Attachments header. */ - - /* COMPOSITION OPTIONS MENU - ======================== - */ - MSG_SendFormattedText, /* c: Toggle HTML mode. */ - MSG_AttachAsText, /* c: ??? ###tw */ - - MSG_SendEncrypted, - MSG_SendSigned, - - - /* SUBSCRIBE PANE - ============== - */ - MSG_ToggleSubscribed, /* sub: Changes the subscribed state of the - given newsgroups. */ - MSG_SetSubscribed, /* sub: Sets the subscribed state of given - newsgroups / IMAP folders to Subscribed */ - MSG_ClearSubscribed, /* sub: Sets the subscribed state of given - newsgroups / IMAP folders to Unsubscribed */ - MSG_FetchGroupList, /* sub: Causes us to go to the newsserver and - re-fetch the entire list of newsgroups. */ - MSG_ExpandAll, /* sub: Expands everything under the given - lines. */ - MSG_CollapseAll, /* sub: Collapses everything under the given - lines. */ - MSG_ClearNew, /* sub: Clears the list of new newsgroups. */ - MSG_CheckForNew, /* sub: Checks the server for new - newsgroups. */ - /* CATEGORY PANE - ============= - */ - MSG_MarkCategoryRead, /* cat: Mark the passed categories read */ - MSG_MarkCategoryUnRead, /* cat: Mark the passed categories unread */ - MSG_KillCategory /* cat: kill/ignore/unsubscribe the category */ - -} MSG_CommandType; - - - - -/* =========================================================================== - CONSTANTS AND ENUMS - =========================================================================== - */ - -/* Several things want to know this (including libnet/mknews.c) */ -#define NEWS_PORT 119 -#define SECURE_NEWS_PORT 563 - - -#define MSG_MAXSUBJECTLENGTH 160 -#define MSG_MAXAUTHORLENGTH 60 -#define MSG_MAXGROUPNAMELENGTH 128 - -typedef enum -{ - MSG_Pop3 = 0, - MSG_Imap4 = 1, - MSG_MoveMail = 2, - MSG_Inbox = 3 -} MSG_SERVER_TYPE; - -/* The font type which should be used for presentation of cited text. The - values are the same numeric values that are stored in the prefs db. - */ -typedef enum -{ - MSG_PlainFont = 0, - MSG_BoldFont = 1, - MSG_ItalicFont = 2, - MSG_BoldItalicFont = 3 -} MSG_FONT; - -/* The font size which should be used for presentation of cited text. - */ -typedef enum -{ - MSG_NormalSize, - MSG_Bigger, - MSG_Smaller -} MSG_CITATION_SIZE; - -typedef enum -{ - MSG_NotUsed, - MSG_Checked, - MSG_Unchecked -} MSG_COMMAND_CHECK_STATE; - -/* UndoStatus is returned by Undo and Redo to indicate whether the undo/redo - action is complete (i.e., operation is synchronous and was successful), or - in progress (undo action kicked off a url), or it failed. -*/ -typedef enum -{ - UndoError, /* Should we remove the undo obj (?) Hmmm ...*/ - UndoComplete, /* Synchronous undo status*/ - UndoInProgress, /* Asynchronous undo status*/ - UndoFailed, /* Should we remove the undo obj (?) Hmmm...*/ - UndoInterrupted -} UndoStatus; - -typedef enum -{ - UndoIdle, /* Normal situation */ - UndoUndoing, /* We are Undoing ...*/ - UndoRedoing /* We are Redoing ...*/ -} UndoMgrState; - -/* Message priorities as determined by X-Priority hdr, or Priority header? */ -typedef enum -{ - MSG_PriorityNotSet = 0, - MSG_NoPriority = 1, - MSG_LowestPriority, - MSG_LowPriority, - MSG_NormalPriority, - MSG_HighPriority, - MSG_HighestPriority -} MSG_PRIORITY; - -/* Message Compose Editor Type */ -typedef enum -{ - MSG_DEFAULT = 0, - MSG_PLAINTEXT_EDITOR, - MSG_HTML_EDITOR -} MSG_EditorType; - -/* What kind of change was made to a list. Used in calls to - FE_ListChangeStarting and FE_ListChangeFinished. */ - -typedef enum -{ - MSG_NotifyNone, /* No change; this call is just being used - to potentially nest other sets of calls - inside it. The "where" and "num" parameters - are unused. */ - MSG_NotifyInsertOrDelete, /* Some lines have been inserted or deleted. - The "where" parameter will indicate - the first line that has been added or - removed; the "num" parameter will indicate - how many lines, and will be positive on - an insertion and negative on a deletion. */ - MSG_NotifyChanged, /* Some lines have had their contents changed - (e.g., messages have been marked read - or something.) "where" indicates the - first line with a change; "num" indicates - how many chaged. */ - MSG_NotifyScramble, /* Everything changed. Probably means we - resorted the folder. We are still working - with the same set of items, or at least - have some overlap, but all the indices are - invalid. The "where" and "num" parameters - are unused. */ - MSG_NotifyAll, /* Everything changed. We're now not - displaying anything like what we were; we - probably opened a new folder or something. - The FE needs to forget anything it ever knew - about what was being displayed, and start - over. The "where" and "num" parameters are - unused. */ - MSG_NotifyLDAPTotalContentChanged, - /* Introduced for the address book to support - virtual list views. The total number of - entries on the LDAP directory has changed - and the FE must update its scrollbar. The - "num" parameter contains the total number of - entries on the LDAP server. */ - MSG_NotifyNewTopIndex /* Introduced for the address book to support - virtual list views. The virtual list view - cache data has changed and the FE view may - be out of date. The view should be updated - so that the first/top index in the view is - the index in the "where" parameter. The - scrollbar should be updated to match the new - position. */ - -} MSG_NOTIFY_CODE; - -/* How has a pane changed? Used in calls to FE_PaneChanged. If the - value passed to FE_PaneChanged becomes meaningful, it should - be documented here. - */ -typedef enum -{ - MSG_PaneDirectoriesChanged, /* The list of directories has changed. The - user has edited them by either reordering - or deleting or changing the name. The - address book window will need to rebuild - its directory list. */ - MSG_PaneNotifyMessageLoaded, /* a new message has started to be loaded - into a message pane. */ - MSG_PaneNotifyFolderInfoChanged, /* the folder info for a thread pane has - changed. */ - MSG_PaneNotifyFolderLoaded, /* a folder has finished loading into a - thread pane */ - MSG_PaneNotifyFolderLoadedSync, /* a folder has finished loading synchronously - into athread pane */ - MSG_PaneNotifyLastMessageDeleted,/* User has deleted the last message in - a folder. Some FE's may want to close - the message window. */ - MSG_PaneNotifyFolderDeleted, /* User has deleted a folder. If it is - open in a thread window, the FE - should close the window */ - MSG_PaneNotifyMessageDeleted, /* User has deleted a message. If it is - open in a standalone msg window, the - FE should close the window */ - MSG_PanePastPasswordCheck, /* Get New mail is past password check. Might - be a good time to show progress window. */ - MSG_PaneProgressDone, /* Send this when you are a libmsg API that - usually runs a url in a progress pane but - you don't start a url. FE's, do something - reasonable (like take down progress pane)*/ - MSG_PaneNotifySelectNewFolder, /* Sent when a new folder is created, and is - supposed to be selected by the FE */ - - MSG_PaneNotifyNewFolderFailed, /* Sent when a new folder creation attempt - fails */ - MSG_PaneNotifySafeToSelectFolder, /* sent to a folder pane when a folder operation has - finished and it's safe to select another folder */ - MSG_PaneNotifyIMAPClosed, /* Sent to a folder or message pane when - the IMAP connection with which it is - associated is closing. */ - MSG_PaneNotifyCopyFinished, /* Tell the FE that a message copy operation - has completed. They may have disabled - selection in order to prevent interruption */ - MSG_PaneChanged, /* Introduced for the 2 pane Address Book. Contents have changed through - another pane. This pane's data is no longer up to date */ - MSG_PaneClose, /* Introduced for the 2 pane AB. This pane needs to be closed */ - MSG_PaneNotifyTypeDownCompleted, /* Introduced for the 2 pane AB. The type down asynch operation requested on this - pane has been completed. The attached int32 is a MSG_ViewIndex which corresponds to - the type down index result value */ - MSG_PaneNotifyStartSearching, /* Introduced for new address book. FEs should mark the pane as searching, add any appropriate UI - work such as a cylon, etc. */ - MSG_PaneNotifyStopSearching /* Introduced for new address book. FEs should mark the pane as no longer searching and turn off any - search related UI stuff such as a cylon, etc. */ -} MSG_PANE_CHANGED_NOTIFY_CODE; - - - - - -/* =========================================================================== - FLAGS AND MASKS - =========================================================================== - */ - -/* MSG_FLAG_* now in mailnews/base/public/nsMsgMessageFlags.h */ - -/* MSG_FOLDER_FLAG_* now in mailnews/base/public/nsMsgFolderFlags.h */ - -/* MSG_GROUPNAME_FLAG_* now in mailnews/base/public/nsMsgGroupnameFlags.h */ - -typedef uint32 MSG_HEADER_SET; -typedef enum { - MSG_RETURN_RECEIPT_BOOL_HEADER_MASK = 0, - MSG_ENCRYPTED_BOOL_HEADER_MASK, - MSG_SIGNED_BOOL_HEADER_MASK, - MSG_UUENCODE_BINARY_BOOL_HEADER_MASK, - MSG_ATTACH_VCARD_BOOL_HEADER_MASK, - MSG_LAST_BOOL_HEADER_MASK /* last boolean header mask; must be the last one - * DON'T remove. - */ -} MSG_BOOL_HEADER_SET; - - -/* *_HEADER_MASK now in mailnews/base/public/nsMsgHeaderMasks.h */ - - - -/* =========================================================================== - TYPES AND STRUCTS - =========================================================================== - */ - - -/* - These can be passed to MSG_Navigate and MSG_NavigateStatus - */ -typedef enum MSG_MotionType { - MSG_FirstMessage, - MSG_NextMessage, - MSG_PreviousMessage, - MSG_LastMessage, - MSG_FirstUnreadMessage, - MSG_NextUnreadMessage, - MSG_PreviousUnreadMessage, - MSG_LastUnreadMessage, - MSG_NextUnreadThread, - MSG_NextCategory, - MSG_NextUnreadCategory, - MSG_NextUnreadGroup, - MSG_NextFolder, - MSG_ReadMore, - MSG_LaterMessage, - MSG_Back, /* t,m: Go back to theprevious visited message */ - MSG_Forward, /* t,m: Go forward to the previous visited message. */ - MSG_FirstFlagged, - MSG_NextFlagged, - MSG_PreviousFlagged, - MSG_FirstNew, - MSG_EditUndo, - MSG_EditRedo -} MSG_MotionType; - - -/* The different views a subscribepane supports. */ -typedef enum MSG_SubscribeMode { - MSG_SubscribeAll, - MSG_SubscribeSearch, - MSG_SubscribeNew -} MSG_SubscribeMode; - - -/* Backtrack state */ -typedef enum MSG_BacktrackState { - MSG_BacktrackIdle, - MSG_BacktrackBackward, - MSG_BacktrackForward -} MSG_BacktrackState; - - -/* INSTANCES of MSG_Prefs are used to communicate to the msglib what the values - of various preferences are. It's really a temporary hack; I hope a more - general XP method of preferences evolves instead. */ - -#ifdef XP_CPLUSPLUS -class MSG_Prefs; -#else -typedef struct MSG_Prefs MSG_Prefs; -#endif - - -/* Instances of MSG_Master represent the entire universe of either mail or - news. */ - -#ifdef XP_CPLUSPLUS -class MSG_Master; -#else -typedef struct MSG_Master MSG_Master; -#endif - - - - -/* The various types of panes available. */ - -typedef enum { - MSG_ANYPANE, - MSG_PANE, /* vanilla MSG_Pane, probably just a placeholder - for MSG_ProgressPane */ - - MSG_MAILINGLISTPANE, - MSG_ADDRPANE, - MSG_FOLDERPANE, - MSG_THREADPANE, - MSG_MESSAGEPANE, - MSG_COMPOSITIONPANE, - MSG_SEARCHPANE, - MSG_SUBSCRIBEPANE, - AB_CONTAINERPANE, - AB_ABPANE, - AB_MAILINGLISTPANE, - AB_PERSONENTRYPANE, - AB_PICKERPANE -} MSG_PaneType; - - - - -/* MSG_ViewIndex is an index into the list of messages or folders or groups, - where zero is the first one to show, one is the second, etc... */ -typedef uint32 MSG_ViewIndex; -typedef MSG_ViewIndex MsgViewIndex; - -/* MSG_VIEWINDEXNONE is used to indicate an invalid or non-existent index. */ -#ifdef XP_CPLUSPLUS -const MSG_ViewIndex MSG_VIEWINDEXNONE = 0xffffffff; -#else -#define MSG_VIEWINDEXNONE 0xffffffff -#endif - -/* imap message flags */ -typedef uint16 imapMessageFlagsType; - - -/* MessageKey is a unique ID for a particular message in a folder. If you want - a handle to a message that will remain valid even after resorting the folder - or otherwise changing their indices, you want one of these rather than a - MSG_ViewIndex. */ -typedef uint32 MessageKey; -/* in the process of removing because of confusion with message-id string */ -typedef uint32 MessageId; - -/* MSG_MESSAGEKEYNONE is used to indicate an invalid or non-existant message. */ -#ifdef XP_CPLUSPLUS -const MessageId MSG_MESSAGEIDNONE = 0xffffffff; -const MessageKey MSG_MESSAGEKEYNONE = 0xffffffff; -#else -#define MSG_MESSAGEIDNONE 0xffffffff -#define MSG_MESSAGEKEYNONE 0xffffffff -#endif - - -/* Similarly, MSG_FolderInfo* is a unique ID for a particular folder. */ - -#ifdef XP_CPLUSPLUS -class MSG_FolderInfo; -#else -typedef struct MSG_FolderInfo *MSG_FolderInfo; -#endif - - -/* And MSG_GroupName is a unique ID for a group name in the subscribe pane. */ - -#ifdef XP_CPLUSPLUS -class MSG_GroupName; -#else -typedef struct MSG_GroupName *MSG_GroupName; -#endif - - -/* MSG_NewsHost represents a newsserver that we know about. */ - -#ifdef XP_CPLUSPLUS -class MSG_NewsHost; -#else -typedef struct MSG_NewsHost *MSG_NewsHost; -#endif - - -/* MSG_IMAPHost represents an imap server that we know about. */ - -#ifdef XP_CPLUSPLUS -class MSG_IMAPHost; -#else -typedef struct MSG_IMAPHost *MSG_IMAPHost; -#endif - - -/* MSG_Host represents a news or imap server that we know about. */ - -/* SUBSCRIBE_USE_OLD_API: REVISIT */ -#ifdef XP_CPLUSPLUS -class MSG_Host; -#else -typedef struct MSG_Host *MSG_Host; -#endif /* XP_CPLUSPLUS */ - -/* used by Address Book to describe a particular address book */ - -#ifdef XP_CPLUSPLUS -class AB_ContainerInfo; -#else -typedef struct AB_ContainerInfo AB_ContainerInfo; -#endif - -#ifdef XP_CPLUSPLUS -class MSG_IMAPFolderInfoMail; -class TImapServerState; -class TNavigatorImapConnection; -#else -typedef struct MSG_IMAPFolderInfoMail *MSG_IMAPFolderInfoMail; -typedef struct TImapServerState *TImapServerState; -typedef struct TNavigatorImapConnection TNavigatorImapConnection; -#endif - -struct MSG_AttachmentData -{ - char *url; /* The URL to attach. - This should be 0 to signify "end of list". - */ - - char *desired_type; /* The type to which this document should be - converted. Legal values are NULL, TEXT_PLAIN - and APPLICATION_POSTSCRIPT (which are macros - defined in net.h); other values are ignored. - */ - - char *real_type; /* The type of the URL if known, otherwise NULL. - For example, if you were attaching a temp file - which was known to contain HTML data, you would - pass in TEXT_HTML as the real_type, to override - whatever type the name of the tmp file might - otherwise indicate. - */ - char *real_encoding; /* Goes along with real_type */ - - char *real_name; /* The original name of this document, which will - eventually show up in the Content-Disposition - header. For example, if you had copied a - document to a tmp file, this would be the - original, human-readable name of the document. - */ - - char *description; /* If you put a string here, it will show up as - the Content-Description header. This can be - any explanatory text; it's not a file name. - */ - - char *x_mac_type, *x_mac_creator; - /* Mac-specific data that should show up as optional parameters - to the content-type header. - */ -}; - - -/* This structure is the interface between compose.c and composew.c. - When we have downloaded a URL to a tmp file for attaching, this - represents everything we learned about it (and did to it) in the - process. - */ -/* Used by libmime -- mimedrft.c - * Front end shouldn't use this structure. - */ -typedef struct MSG_AttachedFile -{ - char *orig_url; /* Where it came from on the network (or even elsewhere - on the local disk.) - */ - char *file_name; /* The tmp file in which the (possibly converted) data - now resides. - */ - char *type; /* The type of the data in file_name (not necessarily - the same as the type of orig_url.) - */ - char *encoding; /* Likewise, the encoding of the tmp file. - This will be set only if the original document had - an encoding already; we don't do base64 encoding and - so forth until it's time to assemble a full MIME - message of all parts. - */ - - /* #### I'm not entirely sure where this data is going to come from... - */ - char *description; /* For Content-Description header */ - char *x_mac_type, *x_mac_creator; /* mac-specific info */ - char *real_name; /* The real name of the file. */ - - /* Some statistics about the data that was written to the file, so that when - it comes time to compose a MIME message, we can make an informed decision - about what Content-Transfer-Encoding would be best for this attachment. - (If it's encoded already, we ignore this information and ship it as-is.) - */ - uint32 size; - uint32 unprintable_count; - uint32 highbit_count; - uint32 ctl_count; - uint32 null_count; - uint32 max_line_length; - -} MSG_AttachedFile; - - - -/* This structure represents a single line in the folder pane. - */ -typedef struct MSG_FolderLine -{ - MSG_FolderInfo* id; - const char* name; /* The name of the folder to display. */ - const char* prettyName; /* The pretty name to display */ - uint8 level; /* How many parent folders we have. */ - uint32 flags; - uint32 prefFlags; - - /* The below are used only if the icon type is MSG_NewsgroupIcon or - MSG_FolderIcon. */ - int32 unseen; /* Number of unseen articles. (If negative, - then we don't know yet; display question - marks or something.*/ - int32 total; /* Total number of articles. */ - uint16 numChildren; /* How many immediate children of this folder - exist. */ - int32 deepUnseen; /* Totals for this and child folders */ - int32 deepTotal; - int32 deletedBytes; /* mail only - total size of deleted messages */ -} MSG_FolderLine; - - -/* This structure represents a single line in the thread pane. - */ -typedef struct MSG_MessageLine -{ - MessageKey threadId; /* (article # of thread - article could be - expired) */ - MessageKey messageKey; /* news: article num, mail: mbox offset */ - char subject[MSG_MAXSUBJECTLENGTH]; - char author[MSG_MAXAUTHORLENGTH]; - time_t date; - - uint32 messageLines; /* Number of lines in this message. */ - uint32 flags; - MSG_PRIORITY priority; /* message priority (mail only?) */ - uint16 numChildren; /* for top-level threads */ - uint16 numNewChildren; /* for top-level threads */ - int8 level; /* indentation level */ -} MSG_MessageLine; - -/* This structure represents a single line in the subscribe pane. - */ - -typedef struct MSG_GroupNameLine -{ - char name[MSG_MAXGROUPNAMELENGTH]; - int8 level; - uint32 flags; - int32 total; -} MSG_GroupNameLine; - -/* This structure is used as an annotation about the font and size information - included in a text string passed to us by the front end after the user has - edited their message. - */ -typedef struct MSG_FontCode -{ - uint32 pos; - uint32 length; - MSG_FONT font; - uint8 font_size; - XP_Bool fixed_width_p; -} MSG_FontCode; - - - -/* MSG_CompositionFields represents the desired initial state of the various - fields in a composition. */ - - -#ifdef XP_CPLUSPLUS -class MSG_CompositionFields; -#else -typedef struct MSG_CompositionFields MSG_CompositionFields; -#endif - - -/* MSG_HTMLComposeAction lists what action to take with a message composed - with HTML. */ - -typedef enum { - MSG_HTMLAskUser, - MSG_HTMLUseMultipartAlternative, - MSG_HTMLConvertToPlaintext, - MSG_HTMLSendAsHTML -} MSG_HTMLComposeAction; - -/* MSG_RecipientList specifies a list of recipients to be displayed in the - recipients dialog box. It is terminated by an entry which has name set to - NULL and value set to something negative. */ -typedef struct { - int32 value; - const char* name; -} MSG_RecipientList; - - - - -/* Secure mail related - */ -typedef enum { - certNone, - certValid, - certExpired, - certRevoked -} MSG_CertStatus; - -typedef struct { - char *PrettyName; - char *EmailAddress; - MSG_CertStatus CertStatus; -} MSG_CertInfo; - -typedef enum -{ - msgNoRecipients = 0, - msgNoCerts = 1, - msgHasCerts = 2, - msgSomeCerts = 4 -} MSG_SecurityLevel; - -typedef enum -{ - crypto_RC4_40bit, - crypto_RC4_128bit -} MSG_CryptoGrade; - - -typedef struct { - /* DoFetchGroups() requests the front end do a - MSG_Command(MSG_FetchGroupList) on the subscribe pane, also doing - whatever side effects the front end usually does on such a request. */ - void (*DoFetchGroups)(MSG_Pane* pane, void* closure); - - /* FetchCompleted() tells the FE that a MSG_FetchGroupList or - MSG_CheckForNew command has completed. */ - void (*FetchCompleted)(MSG_Pane* pane, void* closure); -} MSG_SubscribeCallbacks; - - -typedef struct { - /* AttachmentCount() tells the FE the number of attachments currently - known for the message being displayed in the given messagepane. - finishedloading is TRUE iff we have finished loading the message. - If finishedloading is FALSE, then the FE must be prepared to have this - callback fire again soon, as more attachments may be found as - downloading proceeds. */ - void (*AttachmentCount)(MSG_Pane* messagepane, void* closure, - int32 numattachments, XP_Bool finishedloading); - - - /* UserWantsToSeeAttachments() gets called when the user clicks on the - little "show me attachment info" at the top of a mail message. */ - void (*UserWantsToSeeAttachments)(MSG_Pane* messagepane, void* closure); -} MSG_MessagePaneCallbacks; - - -typedef struct { - /* CreateAskHTMLDialog() tells the FE to bring up the dialog that lets the - user choose the disposition of this HTML composition. If the user - chooses a format for HTML and clicks "Send", then the FE must call - MSG_SetHTMLAction() and return 0. If the FE returns > 0, then - the message send is cancelled. If the user presses the "Recipients" - button, then the the FE must call MSG_PutUpRecipientsDialog(). If the - FE does not provide this CreateAskHTMLDialog() callback, or if this - routine returns a negative number, then the back end will implement - it using HTML dialogs. */ - int (*CreateAskHTMLDialog)(MSG_Pane* composepane, void* closure); - - - /* CreateRecipientsDialog() tells the FE to bring up the dialog that lets - the user choose whether the recipients of a message can deal with HTML. - The FE must notify the back end of the results by calling - MSG_ResultsRecipients(). If the FE does not provide this callback, or - if this routine returns a negative number, then the back end will - implement it using HTML dialogs. - - The last two arguments specify the initial contents of the two scrolling - lists. The given strings are to be displayed; the given ID's are to be - used in the call to MSG_ResultsRecipients(). (These ID's are also to be - used as a sort key so that the recipient list is always displayed sorted - in the right order.) These structures are only valid for the length of - this call; the FE must copy any data it needs out of them before the - call returns. The void* pWnd parameter is used to pass the in parent window - of the RecipientsDialog.*/ - int (*CreateRecipientsDialog)(MSG_Pane* composepane, void* closure, - MSG_RecipientList* nohtml, - MSG_RecipientList* htmlok,void* pWnd); - - -} MSG_CompositionPaneCallbacks; - - - - - -/* =========================================================================== - INIT / CREATE - =========================================================================== - */ - - -XP_BEGIN_PROTOS - -void MSG_InitMsgLib(void); /* one-time initialization of libmsg */ -void MSG_ShutdownMsgLib(void); /* shut down LibMsg part of app. */ - -/* launch a url to compress mail folders and purge news dbs. */ -XP_Bool MSG_CleanupNeeded(MSG_Master *master); -void MSG_CleanupFolders(MSG_Pane *pane); - -/* currently just to give db time to clean up */ -void MSG_OnIdle(void); - - -int32 MSG_SetDBCacheSize(int32 newCacheSize); - -/* Initialize the mail/news universe. A MSG_Master* object must be created - before anything else can be done. Only one MSG_Master* object can exist at - any time. */ - -extern MSG_Master* MSG_InitializeMail(MSG_Prefs* prefs); - - - -/* This function is called by the backend to notify the frontend details about - new mail state so that the FE can notify the stand-alone biff that something - has changed. -*/ - -#ifdef XP_WIN32 /* only supported on Win32 now */ -typedef enum { - MSG_IMAPHighWaterMark, /* data is the IMAP UID highwater mark for the inbox */ -} MSG_BiffInfoType; - -#define FE_SetBiffInfoDefined /* this symbol used in the back-end to - know if FE_SetBiffInfo is defined */ -extern uint32 FE_SetBiffInfo(MSG_BiffInfoType type, uint32 data); -#endif - -/* The imap delete model */ -typedef enum { - MSG_IMAPDeleteIsIMAPDelete, /* delete with a big red x */ - MSG_IMAPDeleteIsMoveToTrash, /* delete moves message to the trash */ - MSG_IMAPDeleteIsDeleteNoTrash /* delete is shift delete - don't create or use trash */ -} MSG_IMAPDeleteModel; - -/* routines to set and get the text type, setting true indicates that the - text is HTML */ - -extern XP_Bool MSG_GetHTMLMarkup(MSG_Pane * composepane); -extern void MSG_SetHTMLMarkup(MSG_Pane * composepane,XP_Bool flag); - -/* Returns the type of the given pane. */ - -extern MSG_PaneType MSG_GetPaneType(MSG_Pane* pane); - - -extern MSG_Pane *MSG_FindPaneOfType(MSG_Master *master, MSG_FolderInfo *id, MSG_PaneType type); - -extern MSG_Pane *MSG_FindPaneFromUrl (MSG_Pane *pane, const char *url, MSG_PaneType type); - - -/* Returns the MSG_Prefs* object that is being used to determine the - preferences for this pane. */ - -extern MSG_Prefs* MSG_GetPrefs(MSG_Pane* pane); - -/* This function MUST be called by the startup wizard. It writes out the correct "profile age" - value into this user's pref file. This value determines which upgrade steps still need to be - done. */ - -extern void MSG_WriteNewProfileAge(); - -/* Returns the MSG_Prefs* object that is being used to determine the - preferences for this master object. */ - -extern MSG_Prefs* MSG_GetPrefsForMaster(MSG_Master* master); - - -/* Returns the MSG_Master* object for the given pane. */ - -extern MSG_Master* MSG_GetMaster(MSG_Pane* pane); - -extern XP_Bool MSG_DeliveryInProgress(MSG_Pane * composepane); - - -/* This is the front end's single interface to executing mail/news menu - and toolbar commands. See the comment above the definition of the - MSG_CommandType enum. - - The indices and numindices arguments indicates which folders or threads are - to be affected by this command. For many commands, they'll be ignored. - They should always be NULL if not specifying a folderpane or a threadpane. - */ -extern void MSG_Command (MSG_Pane* pane, MSG_CommandType command, - MSG_ViewIndex* indices, int32 numindices); - - -/* Before the front end displays any menu (each time), it should call this - function for each command on that menu to determine how it should be - displayed. - - selectable_p: whether the user should be allowed to select this item; - if this is FALSE, the item should be grayed out. - - selected_p: if this command is a toggle or multiple-choice menu item, - this will be MSG_Checked if the item should be `checked', - MSG_Unchecked if it should not be, and MSG_NotUsed if the - item is a `normal' menu item that never has a checkmark. - - display_string: the string to put in the menu. l10n handwave handwave. - - plural_p: if it happens that you're not using display_string, then - this tells you whether the string you display in the menu - should be singular or plural ("Delete Message" versus - "Delete Selected Messages".) If you're using - display_string, you don't need to look at this value. - - Returned value is negative if something went wrong. - */ -extern int MSG_CommandStatus (MSG_Pane* pane, - MSG_CommandType command, - MSG_ViewIndex* indices, int32 numindices, - XP_Bool *selectable_p, - MSG_COMMAND_CHECK_STATE *selected_p, - const char **display_string, - XP_Bool *plural_p); - - -/* Set the value of a toggle-style command to the given value. Returns - negative if something went wrong (like, you gave it a non-toggling - command, or you passed in MSG_NotUsed for the check state.) */ -extern int MSG_SetToggleStatus(MSG_Pane* pane, MSG_CommandType command, - MSG_ViewIndex* indices, int32 numindices, - MSG_COMMAND_CHECK_STATE value); - -/* Queries whether the given toggle-style command is on or off. */ -extern MSG_COMMAND_CHECK_STATE MSG_GetToggleStatus(MSG_Pane* pane, - MSG_CommandType command, - MSG_ViewIndex* indices, - int32 numindices); - - -/* Navigation commands */ -extern int MSG_DataNavigate(MSG_Pane* pane, MSG_MotionType motion, - MessageKey startId, MessageKey *resultId, - MessageKey *resultThreadId); - -/* This routine will automatically expand the destination thread, if needs be. */ -extern int MSG_ViewNavigate(MSG_Pane* pane, MSG_MotionType motion, - MSG_ViewIndex startIndex, - MessageKey *resultId, MSG_ViewIndex *resultIndex, - MSG_ViewIndex *pThreadIndex, - MSG_FolderInfo **folderInfo); - -/* Indicates if navigation of the passed motion type is valid. */ -extern int MSG_NavigateStatus (MSG_Pane* pane, - MSG_MotionType command, - MSG_ViewIndex index, - XP_Bool *selectable_p, - const char **display_string); - -extern int MSG_MarkReadByDate (MSG_Pane* pane, time_t startDate, time_t endDate); - -/* notification from Server Admin page via JavaScript that an imap folder has changed */ -extern void MSG_IMAPFolderChangedNotification(const char *folder_url); - - -/* Determines whether we are currently actually showing the recipients - in the "Sender" column of the display (because we are in the "sent" - folder). FE's should call this in their FE_UpdateToolbar to change - the title of this column.*/ - -extern XP_Bool MSG_DisplayingRecipients(MSG_Pane* threadpane); - -/* For the new AB stuff, we need to know which address book we are adding the senders to. - Because we are adding this extra argument, we had to pull it out of MSG_Command - and make a new API */ - -extern int MSG_AddToAddressBook(MSG_Pane* pane, - MSG_CommandType command, - MSG_ViewIndex* indices, - int32 numIndices, - AB_ContainerInfo * destAB); - -/* We also provide a status function to support this command */ -extern int MSG_AddToAddressBookStatus(MSG_Pane* pane, - MSG_CommandType command, - MSG_ViewIndex* indices, - int32 numIndices, - XP_Bool *selectable_p, - MSG_COMMAND_CHECK_STATE *selected_p, - const char **display_string, - XP_Bool *plural_p, - AB_ContainerInfo * destAB); - -/* The msg library calls FE_ListChangeStarting() to tell the front end that the - contents of the message or folder list are about to change. It means that - any MSG_ViewIndex values that the FE may be keeping around might become - invalid. The FE should adjust them, throw them out, or convert them into - MessageKey or MSG_FolderInfo* values, instead. - - This call will be quickly followed by a matching call to - FE_ListChangeFinished(). - - The "asynchronous" flag will be TRUE if this change happened due to some - completely asynchronous event, and FALSE if we are in the middle of a call - to MSG_Command() or other calls from the FE that directly manipulate the - msglib. Some FE's (Mac) will choose to ignore these calls if asynchronous - is FALSE, while other FE's (XFE) will likely ignore the parameter. - - The notify parameter describes what changed, along with the where and num - parameters. See the documentation in the declaration of MSG_NOTIFY_CODE, - above. */ - -extern void FE_ListChangeStarting(MSG_Pane* pane, XP_Bool asynchronous, - MSG_NOTIFY_CODE notify, MSG_ViewIndex where, - int32 num); - - -/* FE_ListChangeFinished() gets called only after a call to - FE_ListChangeStarting(). It means that it is safe for the FE to convert - back from MessageKey or MSG_FolderInfo* into MSG_ViewIndex. It's also a good - clue that the FE ought to redisplay the list. If the folderpane is given, - then the FE probably will want to regenerate any list of folders presented - in menus. */ - -extern void FE_ListChangeFinished(MSG_Pane* pane, XP_Bool asynchronous, - MSG_NOTIFY_CODE notify, MSG_ViewIndex where, - int32 num); - -/* The backend calls this when something changed about the pane other than the - list. For example, if we load a different message into a message pane, - we call FE_PaneChanged with a notify code of MSG_PaneNotifyMessageLoaded. Or, if - the folder info for a folder displayed in a thread pane changes, - we call FE_PaneChanged with a notify code of MSG_PaneNotifyFolderInfoChanged. -*/ -extern void FE_PaneChanged(MSG_Pane *pane, XP_Bool asynchronous, - MSG_PANE_CHANGED_NOTIFY_CODE, int32 value); - -/* The front end calls this *after* it has handled the FE_PaneChanged notification. - This function handles callbacks set up by back-end code to detect changes in the - mail system. Currently, it is used by the netscape.messaging.* classes - to allow callbacks in the java classes when stuff in the mail backend changes. -*/ -extern void MSG_HandlePaneChangedNotifications(MSG_Pane *pane, XP_Bool asynchronous, - MSG_PANE_CHANGED_NOTIFY_CODE, int32 value); - -/* Declaration for backend pane change callback */ -typedef void (*MSG_PANE_CHANGED_CALLBACK)(MSG_Pane *pane, XP_Bool asynchronous, - MSG_PANE_CHANGED_NOTIFY_CODE, int32 value); - -/* Registration function to register call backs. Currently allows only one, but should - be expanded to allow multiple observers */ -extern void MSG_RegisterPaneChangedCallback(MSG_PANE_CHANGED_CALLBACK cb); - -/* The front end can use this call to determine what the indentation depth is - needed to display all the icons in the folder list. The XFE uses this to - dynamically resize the icon column. In true C style, the number returned is - actually one bigger than the biggest depth the FE will ever get. */ -extern int MSG_GetFolderMaxDepth(MSG_Pane* folderpane); - - -/* The front end uses these calls to determine what to display on particular - lines in the outline lists. They return TRUE on success, FALSE if the given - line doesn't exist or if there are less than numlines worth of data to get. - The given data pointer must point to an array of at least numlines - elements. */ - -extern XP_Bool MSG_GetFolderLineByIndex(MSG_Pane* folderpane, - MSG_ViewIndex firstline, - int32 numlines, - MSG_FolderLine* data); - -/* get the flags for a folder w/o the whole MSG_FolderLine */ -extern uint32 MSG_GetFolderFlags(MSG_FolderInfo *folder); - -extern int32 MSG_GetFolderSizeOnDisk (MSG_FolderInfo *folder); -extern XP_Bool MSG_GetThreadLineByIndex(MSG_Pane* threadpane, - MSG_ViewIndex firstline, - int32 numlines, - MSG_MessageLine* data); - -extern int MSG_GetFolderLevelByIndex( MSG_Pane *folderpane, - MSG_ViewIndex line ); - -extern int MSG_GetThreadLevelByIndex( MSG_Pane *threadpane, - MSG_ViewIndex line ); - -/* If the FE wants to find out info about a particular folder or thread by its - id rather than by its index, it can use these calls. */ - -extern XP_Bool MSG_GetFolderLineById(MSG_Master* master, - MSG_FolderInfo* info, - MSG_FolderLine* data); -extern XP_Bool MSG_GetThreadLineById(MSG_Pane* pane, /* thread or message */ - MessageKey id, - MSG_MessageLine* data); - -/* returns the view index of the first message in the thread containing key */ -extern MSG_ViewIndex MSG_ThreadIndexOfMsg(MSG_Pane* pane, MessageKey key); - -/* Takes a time (most likely, the one returned in the MSG_MessageLine - structure by MSG_GetThreadLine()) and formats it into a compact textual - representation (like "Thursday" or "09:53:17" or "10/3 16:15"), based on - how that date relates to the current time. This is returned in a - statically allocated buffer; the caller should copy it somewhere. */ -extern const char* MSG_FormatDate(MSG_Pane* pane, time_t date); - -/* Change the priority on a mail message */ -extern XP_Bool MSG_SetPriority(MSG_Pane *pane, /* thread or message */ - MessageKey key, - MSG_PRIORITY priority); - -/* The msg library calls this to get a temporary filename and type (suitable - for passing to XP_FileOpen, etc) to be used for storing a temporary working - copy of the given filename and type. The returned file will usually be - renamed back onto the given filename, using XP_FileRename(). - - The returned filename will be freed using XP_FREE(). */ - - - - -/* Delete the master object, meaning that we're all done with mail or news. - It's not legal to do this unless all associated panes have already been - destroyed. */ - -extern void MSG_DestroyMaster(MSG_Master* master); - - -/* A pane is going away. */ - -extern void MSG_DestroyPane(MSG_Pane* pane); - - - -/* Load the given folder into the given threadpane. */ - -extern int MSG_LoadFolder(MSG_Pane* threadpane, MSG_FolderInfo* folder); - -/* Load the given message into the given messagepane. Also have to specify - the folder that the pane is in. */ - -extern int MSG_LoadMessage(MSG_Pane* messagepane, MSG_FolderInfo* folder, - MessageKey id); - -/* Open Draft Message into a compose window */ -extern int MSG_OpenDraft (MSG_Pane* threadpane, MSG_FolderInfo* folder, - MessageKey id); -/* Draft -- backend helper function; FE don't use it */ -extern void MSG_SetLineWidth(MSG_Pane* composepane, int width); - -extern void MSG_AddBacktrackMessage(MSG_Pane* pane, MSG_FolderInfo* folder, - MessageKey id); - -extern void MSG_SetBacktrackState (MSG_Pane* pane, MSG_BacktrackState state); - -extern MSG_BacktrackState MSG_GetBacktrackState (MSG_Pane* pane); - - -/* Set what action to take when the user sends an HTML message. This - is set by a pull-down in the compose window, or as a result of the - AskHTMLDialog. */ -extern int MSG_SetHTMLAction(MSG_Pane* composepane, - MSG_HTMLComposeAction action); - -/* Gets the value set above. */ -extern MSG_HTMLComposeAction MSG_GetHTMLAction(MSG_Pane* composepane); - -/* Asks that the recipients dialog appear. This should only happen as a - result of the user pressing the "Recipients" button on the AskHTMLDialog. - the void* parameter is used to pass in the parent window for the dialog */ -extern int MSG_PutUpRecipientsDialog(MSG_Pane* composepane,void *pWnd); - -/* For more details on this routine, see comments for - MSG_CompositionPaneCallbacks. */ -extern int MSG_ResultsRecipients(MSG_Pane* composepane, - XP_Bool cancelled, - int32* nohtml, /* List of IDs, terminated - with a negative entry. */ - int32* htmlok /* Another list of IDs. */ - ); - -extern void MSG_SetPostDeliveryActionInfo (MSG_Pane* pane, - void *actionInfo); -extern uint32 MSG_GetActionInfoFlags (void *actionInfo); - -/* =========================================================================== - PREFERENCES - =========================================================================== - */ - - -/* Create a new place to store mail/news preferences. */ - -extern MSG_Prefs* MSG_CreatePrefs(void); - -/* Destroy a previously created MSG_Prefs* object. it is illegal to call this - unless any MSG_Master* or compositionpane objects associated with this prefs - object have already been destroyed.*/ - -extern void MSG_DestroyPrefs(MSG_Prefs*); - - - -/* This is the directory where mail folders are stored. */ - -extern void MSG_SetFolderDirectory(MSG_Prefs* prefs, const char* directory); -extern const char* MSG_GetFolderDirectory(MSG_Prefs* prefs); - - -extern void MSG_GetCitationStyle(MSG_Prefs* prefs, - MSG_FONT* font, - MSG_CITATION_SIZE* size, - const char** color); - -/* Gets/Sets the current Queue Folder name, i.e. "Outbox" or "Unsent Messages." - Don't free the return result. */ -extern const char * MSG_GetQueueFolderName(); -/* Should be called with a #define'd string, i.e. QUEUE_FOLDER_NAME or QUEUE_FOLDER_NAME_OLD */ -extern const char * MSG_SetQueueFolderName(const char *newName); -/* Variation on XP_GetString for special folders, except this function - returns safer, longer-duration strings */ -extern const char * MSG_GetSpecialFolderName(int whichOne); -#ifdef XP_OS2 -extern const char * MSG_GetSpecialFolderPrettyName(int whichOne); -#endif - -/* Whether to automatically quote original message when replying. */ -extern XP_Bool MSG_GetAutoQuoteReply(MSG_Prefs* prefs); - -/* Whether to show attachments as links instead of inline. */ -extern XP_Bool MSG_GetNoInlineAttachments(MSG_Prefs* prefs); - -/* there are going to be a set of per-folder preferences, including - 1 pane or 2 - Configured for off-line use - I think these can be represented with bits. If wrong, we'll have - to change this. They should be stored in the database, DBFolderInfo obj, - and cached in MSG_FolderInfo. -*/ -#define MSG_FOLDER_PREF_OFFLINE 0x00000001 -#define MSG_FOLDER_PREF_ONEPANE 0x00000002 -#define MSG_FOLDER_PREF_SHOWIGNORED 0x00000004 -#define MSG_FOLDER_PREF_IMAPMARKED 0x00000008 /* server says this folder is 'special' */ -#define MSG_FOLDER_PREF_IMAPUNMARKED 0x00000010 /* different from !marked? RFC says yes */ -#define MSG_FOLDER_PREF_IMAPNOINFERIORS 0x00000020 /* cannot have children folders, pity */ -#define MSG_FOLDER_PREF_IMAPNOSELECT 0x00000040 /* cannot hold messages, only other folders */ -#define MSG_FOLDER_PREF_OFFLINEEVENTS 0x00000080 /* this folder has offline events to play back */ -#define MSG_FOLDER_PREF_LSUB_DISCOVERED 0x00000100 /* this folder was discovered using LSUB */ -#define MSG_FOLDER_PREF_CREATED_OFFLINE 0x00000200 /* this folder created offline, so don't delete it */ -#define MSG_FOLDER_PREF_NAMESPACE_STRIPPED 0x00000400 /* this folder has had its personal namespace stripped off */ -#define MSG_FOLDER_PREF_IMAP_ACL_READ 0x00000800 /* SELECT, CHECK, FETCH, PARTIAL, SEARCH, COPY from folder */ -#define MSG_FOLDER_PREF_IMAP_ACL_STORE_SEEN 0x00001000 /* STORE SEEN flag */ -#define MSG_FOLDER_PREF_IMAP_ACL_WRITE 0x00002000 /* STORE flags other than SEEN and DELETED */ -#define MSG_FOLDER_PREF_IMAP_ACL_INSERT 0x00004000 /* APPEND, COPY into folder */ -#define MSG_FOLDER_PREF_IMAP_ACL_POST 0x00008000 /* Can I send mail to the submission address for folder? */ -#define MSG_FOLDER_PREF_IMAP_ACL_CREATE_SUBFOLDER 0x00010000 /* Can I CREATE a subfolder of this folder? */ -#define MSG_FOLDER_PREF_IMAP_ACL_DELETE 0x00020000 /* STORE DELETED flag, perform EXPUNGE */ -#define MSG_FOLDER_PREF_IMAP_ACL_ADMINISTER 0x00040000 /* perform SETACL */ -#define MSG_FOLDER_PREF_IMAP_ACL_RETRIEVED 0x00080000 /* ACL info for this folder has been initialized */ -#define MSG_FOLDER_PREF_FEVALID 0x40000000 /* prefs have actually been set */ -#define MSG_FOLDER_PREF_CACHED 0x80000000 /* we've retrieved prefs from db */ - -extern void MSG_SetFolderPrefFlags(MSG_FolderInfo *info, int32 flag); -extern int32 MSG_GetFolderPrefFlags(MSG_FolderInfo *info); - -/* allow FE's to remember default CSID's on a per-folder basis. It would be nice - if there were a type other than int16 for csid's! - */ -extern void MSG_SetFolderCSID(MSG_FolderInfo *info, int16 csid); -extern int16 MSG_GetFolderCSID(MSG_FolderInfo *info); -extern void MSG_SetLastMessageLoaded(MSG_FolderInfo *info, MessageKey lastMessageLoaded); -extern MessageKey MSG_GetLastMessageLoaded(MSG_FolderInfo *info); - -typedef enum MSG_AdminURLType -{ - MSG_AdminServer, - MSG_AdminServerSideFilters, - MSG_AdminFolder, - MSG_AdminServerLists -} MSG_AdminURLType; - -/* =========================================================================== - LIST CALLBACKS - =========================================================================== - */ - - -/* The FE calls these in response to mouse gestures on the scrolling lists. - Note that folderpanes, threadpanes, and subscribepanes all have scrolling - lists; most of these calls are valid in any of them. */ - - -/* Change the flippy state on this thread line, if possible. The numchanged - returns how many lines that were added to the view (if positive), or how - many were removed (if negative). If you don't care, pass in NULL. */ -extern void MSG_ToggleExpansion (MSG_Pane* pane, MSG_ViewIndex line, - int32* numchanged); - - - -/* Returns how many lines would get added or removed from the message pane if - MSG_ToggleExpansion were to be called. Returns positive if lines will be - added; negative if lines will be removed. */ -extern int32 MSG_ExpansionDelta(MSG_Pane* pane, MSG_ViewIndex line); - - - -/* These are invoked by the items on the `Copy/Move Message Into' cascading - menus, and by drag-and-drop. The folder name should be the full pathname of - the folder in URL (Unix) file name syntax. This does not have to be an - existing folder; it can be any file on the system. It doesn't even have to - exist yet. (If you do want to use an existing folder, you can get the right - string to pass using MSG_GetFolderName().) */ - -typedef enum -{ MSG_Drag_Not_Allowed = 0x00000000 -, MSG_Require_Copy = 0x00000001 -, MSG_Require_Move = 0x00000002 -, MSG_Default_Drag = -1 /* used to be 0xFFFFFFF but this broke HP Unix build...*/ -} MSG_DragEffect; - -/* Status calls. - Caller passes in requested action. If it's a required action, the returned value - will be the request value, or MSG_Drag_Not_Allowed. If it's a default drag request, - the returned value will show whether the drag should be interpreted as a move or copy. - If numIndices is 0, this simply returns the status when trying to drop an arbitrary message - on the given destination folder. */ -extern MSG_DragEffect MSG_DragMessagesStatus(MSG_Pane* pane, const MSG_ViewIndex* indices, - int32 numindices, const char *folder, MSG_DragEffect request); -extern MSG_DragEffect MSG_DragMessagesIntoFolderStatus(MSG_Pane* pane, - const MSG_ViewIndex* indices, int32 numindices, - MSG_FolderInfo *folder, MSG_DragEffect request); -extern MSG_DragEffect MSG_DragFoldersIntoStatus(MSG_Pane *folderPane, - const MSG_ViewIndex *indices, int32 numIndices, - MSG_FolderInfo *destFolder, MSG_DragEffect request); - -extern int MSG_CopyMessagesInto(MSG_Pane* pane, const MSG_ViewIndex* indices, - int32 numindices, const char *folder); -extern int MSG_MoveMessagesInto(MSG_Pane* pane, const MSG_ViewIndex* indices, - int32 numindices, const char *folder); - -extern int MSG_CopyMessagesIntoFolder(MSG_Pane* pane, const MSG_ViewIndex* indices, - int32 numindices, MSG_FolderInfo *folder); -extern int MSG_MoveMessagesIntoFolder(MSG_Pane* pane, const MSG_ViewIndex* indices, - int32 numindices, MSG_FolderInfo *folder); - - -extern int MSG_MoveFoldersInto (MSG_Pane *folderPane, const MSG_ViewIndex *indices, - int32 numIndices, MSG_FolderInfo *destFolder); - -/* =========================================================================== - HOSTS - =========================================================================== - */ - -/* These operations on hosts are mostly used for the subscribe pane. */ - -/* Returns the number of known newshosts. If the result pointer is not NULL, - fills it in with the list of newshosts (providing up to resultsize entries.) - */ -extern int32 MSG_GetNewsHosts(MSG_Master* master, - MSG_NewsHost** result, - int32 resultsize); - -/* Same as above for imap hosts */ -extern int32 MSG_GetIMAPHosts(MSG_Master* master, - MSG_IMAPHost** result, - int32 resultsize); - -/* Same as above for imap hosts that support subscription */ -extern int32 MSG_GetSubscribingIMAPHosts(MSG_Master* master, - MSG_IMAPHost** result, - int32 resultsize); - -/* Same as above for news hosts + imap hosts that support subscription */ -extern int32 MSG_GetSubscribingHosts(MSG_Master* master, - MSG_Host** result, - int32 resultsize); - -/* Get the host type */ -extern XP_Bool MSG_IsNewsHost(MSG_Host* host); -extern XP_Bool MSG_IsIMAPHost(MSG_Host* host); - -/* Returns a pointer to the associated MSG_Host object for this MSG_NewsHost */ -extern MSG_Host* MSG_GetMSGHostFromNewsHost(MSG_NewsHost *newsHost); -/* Returns a pointer to the associated MSG_Host object for this MSG_IMAPHost */ -extern MSG_Host* MSG_GetMSGHostFromIMAPHost(MSG_IMAPHost *imapHost); -/* Returns a pointer to the associated MSG_NewsHost object for this MSG_Host, - if it is a MSG_NewsHost. Otherwise, returns NULL. */ -extern MSG_NewsHost* MSG_GetNewsHostFromMSGHost(MSG_Host *host); -/* Returns a pointer to the associated MSG_IMAPHost object for this MSG_Host, - if it is a MSG_IMAPHost. Otherwise, returns NULL. */ -extern MSG_IMAPHost* MSG_GetIMAPHostFromMSGHost(MSG_Host *host); - -extern MSG_IMAPHost* MSG_GetIMAPHostByName(MSG_Master *master, const char *hostName); -extern void MSG_ReorderIMAPHost(MSG_Master *master, MSG_IMAPHost *host, MSG_IMAPHost *afterHost /* NULL = pos 0 */); - -/* this should be in msgnet.h, but winfe uses it - this is dangerous in - a multiple host world. -*/ -extern XP_Bool MSG_GetMailServerIsIMAP4(MSG_Prefs* prefs); - -/* Creates a new newshost. If the given info matches an existing newshost, - then returns that newshost. */ - -extern MSG_NewsHost* MSG_CreateNewsHost(MSG_Master* master, - const char* hostname, - XP_Bool isSecure, - int32 port /* If 0, use default */ - ); - - -/* Gets the default newshost. Could be NULL, if the user has managed to - configure himself that way. */ -extern MSG_NewsHost* MSG_GetDefaultNewsHost(MSG_Master* master); - - - -/* Deletes a newshost. This deletes everything known about this hosts -- the - newsrc files, the databases, everything. The user had better have confirmed - this operation before making this call. */ - -extern int MSG_DeleteNewsHost(MSG_Master* master, MSG_NewsHost* host); - - -/* IMAP Hosts API's */ -/* Creates a new imap host. If the given info matches an existing imap host, - then returns that imap host. */ - -extern MSG_IMAPHost* MSG_CreateIMAPHost(MSG_Master* master, - const char* hostname, - XP_Bool isSecure, - const char *userName, - XP_Bool checkNewMail, - int biffInterval, - XP_Bool rememberPassword, - XP_Bool usingSubscription, - XP_Bool overrideNamespaces, - const char *personalOnlineDir, - const char *publicOnlineDir, - const char *otherUsersOnlineDir - ); - - -/* Gets the default imap host. Could be NULL, if the user has managed to - configure himself that way. */ -extern MSG_IMAPHost* MSG_GetDefaultIMAPHost(MSG_Master* master); - - -/* Deletes an imap host. This deletes everything known about this hosts -- the - preferences, the databases, everything. The user had better have confirmed - this operation before making this call. */ - -extern int MSG_DeleteIMAPHost(MSG_Master* master, MSG_IMAPHost* host); -extern int MSG_DeleteIMAPHostByName(MSG_Master* master, const char *hostname); - -/* Get info about a host. */ - -#ifdef SUBSCRIBE_USE_OLD_API /* these are being obsoleted */ -extern const char* MSG_GetNewsHostUIName(MSG_NewsHost* host); -extern const char* MSG_GetNewsHostName(MSG_NewsHost* host); -extern XP_Bool MSG_IsNewsHostSecure(MSG_NewsHost* host); -extern int32 MSG_GetNewsHostPort(MSG_NewsHost* host); -#endif /* SUBSCRIBE_USE_OLD_API */ - -extern const char* MSG_GetHostUIName(MSG_Host* host); -extern const char* MSG_GetHostName(MSG_Host* host); -extern XP_Bool MSG_IsHostSecure(MSG_Host* host); -extern int32 MSG_GetHostPort(MSG_Host* host); -extern void MSG_SetNewsHostPostingAllowed (MSG_NewsHost *host, XP_Bool allowed); -extern XP_Bool MSG_GetNewsHostPushAuth (MSG_NewsHost *host); -extern void MSG_SetNewsHostPushAuth (MSG_NewsHost *host, XP_Bool pushAuth); - - - -/* =========================================================================== - SUBSCRIBE WINDOW - =========================================================================== - */ - - -/* Set list of callback routines that the subscribe pane can call to the - FE. */ -extern int MSG_SubscribeSetCallbacks(MSG_Pane* subscribepane, - MSG_SubscribeCallbacks* callbacks, - void* callbackclosure); - - -/* The cancel button was hit. Forget any subscriptions or unsubscriptions that - had been requested. (This call is usually quickly followed by a call to - MSG_DestroyPane). */ -extern int MSG_SubscribeCancel(MSG_Pane* subscribepane); - -/* The OK button was hit. Commit any subscriptions or unsubscriptions to the - IMAP server, if there are any changes. If the changes are on a news server, - the commit will happen in the destructor, just like they used to (ack). - This needs to change for IMAP because we do network I/O. */ -extern int MSG_SubscribeCommit(MSG_Pane* subscribepane); - -/* Get which newshost we're currently viewing. */ -#ifdef SUBSCRIBE_USE_OLD_API -extern MSG_NewsHost* MSG_SubscribeGetNewsHost(MSG_Pane* subscribepane); -#endif /* SUBSCRIBE_USE_OLD_API */ - -/* Get which news or imap host we're currently viewing. */ -extern MSG_Host* MSG_SubscribeGetHost(MSG_Pane* subscribepane); - -/* Set our view to the given newshost. */ -#ifdef SUBSCRIBE_USE_OLD_API -extern int MSG_SubscribeSetNewsHost(MSG_Pane* subscribepane, - MSG_NewsHost* host); -#endif /* SUBSCRIBE_USE_OLD_API */ - -/* Set our view to the given news or imap host. */ -extern int MSG_SubscribeSetHost(MSG_Pane* subscribepane, - MSG_Host* host); - -/* Gets the mode of the pane. */ -extern MSG_SubscribeMode MSG_SubscribeGetMode(MSG_Pane* subscribepane); - -/* Sets the mode of the pane */ -extern int MSG_SubscribeSetMode(MSG_Pane* subscribepane, - MSG_SubscribeMode mode); - - -/* Finds the first newsgroup whose name matches the given string. Expansions - will automatically be done as necessary. Returns the index that matches; - the FE should then scroll to and select that index. The pane must be - in the "MSG_SubscribeAll" mode. */ -extern MSG_ViewIndex MSG_SubscribeFindFirst(MSG_Pane* subscribepane, - const char* str); - - -/* Finds all the newsgroups that have the given string as a substring, and - changes the view to show only those groups. The pane must be in the - "MSG_SubscribeSearch" mode. */ -extern int MSG_SubscribeFindAll(MSG_Pane* subscribepane, const char* str); - - -/* Get information to display on these lines in the subscription pane - outline list. Returns TRUE on success, FALSE if the given - line doesn't exist or if there are less than numlines worth of data to get. - The given data pointer must point to an array of at least numlines - elements. */ - -extern XP_Bool MSG_GetGroupNameLineByIndex(MSG_Pane* subscribepane, - MSG_ViewIndex firstline, - int32 numlines, - MSG_GroupNameLine* data); - - - -/* =========================================================================== - OFFLINE NEWS - =========================================================================== - */ - -typedef enum MSG_PurgeByPreferences -{ - MSG_PurgeNone, - MSG_PurgeByAge, - MSG_PurgeByNumHeaders -} MSG_PurgeByPreferences; - - -extern int MSG_SetOfflineRetrievalInfo( - MSG_FolderInfo *newsGroup, - XP_Bool useDefaults, - XP_Bool byReadness, - XP_Bool unreadOnly, - XP_Bool byDate, - int32 daysOld); - -extern int MSG_SetArticlePurgingInfo( - MSG_FolderInfo *newsGroup, - XP_Bool useDefaults, - MSG_PurgeByPreferences purgeBy, - int32 daysToKeep); - -extern int MSG_SetHeaderPurgingInfo( - MSG_FolderInfo *newsGroup, - XP_Bool useDefaults, - MSG_PurgeByPreferences purgeBy, - XP_Bool unreadOnly, - int32 daysToKeep, - int32 numHeadersToKeep -); - -extern void MSG_GetOfflineRetrievalInfo( - MSG_FolderInfo *newsGroup, - XP_Bool *pUseDefaults, - XP_Bool *pByReadness, - XP_Bool *pUnreadOnly, - XP_Bool *pByDate, - int32 *pDaysOld); - -extern void MSG_GetArticlePurgingInfo(MSG_FolderInfo *newsGroup, - XP_Bool *pUseDefaults, - MSG_PurgeByPreferences *pPurgeBy, - int32 *pDaysToKeep); - -extern void MSG_GetHeaderPurgingInfo(MSG_FolderInfo *newsGroup, - XP_Bool *pUseDefaults, - MSG_PurgeByPreferences *pPurgeBy, - XP_Bool *pUnreadOnly, - int32 *pDaysToKeep, - int32 *pNumHeadersToKeep); - - - -/* run the url to download mail and news articles for offline use - for those folders so configured. -*/ -extern int MSG_DownloadForOffline(MSG_Master *master, MSG_Pane *pane); -extern int MSG_GoOffline(MSG_Master *master, MSG_Pane *pane, XP_Bool downloadDiscussions, XP_Bool getNewMail, XP_Bool sendOutbox, XP_Bool getDirectories); -extern int MSG_DownloadFolderForOffline(MSG_Master *master, MSG_Pane *pane, MSG_FolderInfo *folder); -extern int MSG_SynchronizeOffline(MSG_Master *master, MSG_Pane *pane, XP_Bool downloadDiscussions, XP_Bool getNewMail, XP_Bool sendOutbox, XP_Bool getDirectories, XP_Bool goOffline); - - -/* =========================================================================== - QUERIES - =========================================================================== - */ - -/* Get the filename for the folder on the given line. This string is perfect - for passing to calls to MSG_MoveMessagesInto() and friends. String is - allocated with XP_STRDUP so client needs to free. This should only be used - for mail folders, it appears from the code. -*/ -extern const char* MSG_GetFolderName(MSG_Pane* folderpane, MSG_ViewIndex line); - - -/* return the full folder name from a folder id. String is not allocated so caller - should duplicate it. For mail boxes, this returns the full folder path. This is - currently used for filters to remember a full folder path. - */ -extern const char *MSG_GetFolderNameFromID(MSG_FolderInfo *); - - -/* Get how many lines are in the list for this folderpane or threadpane or - subscribepane. */ -extern int32 MSG_GetNumLines(MSG_Pane* pane); - - -/* Convert a MSG_FolderInfo* into a MSG_ViewIndex. Returns MSG_VIEWINDEXNONE if - the given MSG_FolderInfo* is not being displayed anywhere. */ - -extern MSG_ViewIndex MSG_GetFolderIndex(MSG_Pane* folderpane, - MSG_FolderInfo* info); - - -/* This routine should replace the above routine when people port over to it. - If expand is TRUE, we will expand the folderPane enough to - expose the passed in folder info. Otherwise, if the folder is collapsed, - we return MSG_ViewIndexNone. -*/ -extern MSG_ViewIndex MSG_GetFolderIndexForInfo(MSG_Pane *folderpane, - MSG_FolderInfo *info, - XP_Bool expand); - -/* Converts a MSG_ViewIndex into a MSG_FolderInfo*. */ - -extern MSG_FolderInfo* MSG_GetFolderInfo(MSG_Pane* folderpane, - MSG_ViewIndex index); - - -#if defined(XP_WIN) || defined(XP_MAC) || defined(XP_UNIX) || defined(XP_BEOS) -#define FE_IMPLEMENTS_NEW_GET_FOLDER_INFO -#endif - -#ifdef FE_IMPLEMENTS_NEW_GET_FOLDER_INFO -/* Returns a MSG_FolderInfo* given a URL for that folder. - Pass in TRUE for forGetUrl if this call is being used to get a MSG_FolderInfo* for opening it. - Otherwise (if just getting the MSG_FolderInfo* for information, such as in the preferences), - pass in FALSE. - */ -extern MSG_FolderInfo* MSG_GetFolderInfoFromURL(MSG_Master* master, const char *url, XP_Bool forGetUrl); -#else -extern MSG_FolderInfo* MSG_GetFolderInfoFromURL(MSG_Master* master, const char *url); -#endif - -/* returns folder info of host owning this folder*/ -MSG_FolderInfo* GetHostFolderInfo(MSG_FolderInfo* info); - -extern MSG_FolderInfo* MSG_GetThreadFolder(MSG_Pane *threadpane); - -extern MSG_FolderInfo* MSG_GetCategoryContainerForCategory(MSG_FolderInfo *category); - -#ifdef SUBSCRIBE_USE_OLD_API -/* Finds the newshost that contains the given folder. If the given folder is - not a newsgroup, returns NULL. */ -extern MSG_NewsHost* MSG_GetNewsHostForFolder(MSG_FolderInfo* folder); - -/* Converts a MSG_ViewIndex into a MSG_NewsHost */ -extern MSG_NewsHost *MSG_GetNewsHostFromIndex (MSG_Pane *folderPane, - MSG_ViewIndex index); -#endif /* SUBSCRIBE_USE_OLD_API */ - -/* Finds the host that contains the given folder. If the given folder is - not a newsgroup or IMAP folder, returns NULL. */ -extern MSG_Host *MSG_GetHostForFolder(MSG_FolderInfo* folder); - -/* Converts a MSG_ViewIndex into a MSG_Host */ -extern MSG_Host *MSG_GetHostFromIndex (MSG_Pane *folderPane, - MSG_ViewIndex index); - -/* Gets the MSG_FolderInfo object associated with a given MSG_Host. */ -extern MSG_FolderInfo *MSG_GetFolderInfoForHost(MSG_Host *host); - -/* given a url containing a message id, fill in the message line info for the msg. - For news urls, the news group will need to be open! - */ -extern int MSG_GetMessageLineForURL(MSG_Master* master, const char *url, MSG_MessageLine *msgLine); - -/* This routine should replace the MSG_GetMessageIndex when people port over to - it. If expand is TRUE, we will expand the folderPane enough to - expose the passed in folder info. Otherwise, if the folder is collapsed, - we return MSG_ViewIndexNone. -*/ -extern MSG_ViewIndex MSG_GetMessageIndexForKey(MSG_Pane* threadpane, - MessageKey key, - XP_Bool expand); - -/* Look up the MessageKey based on the message ID */ - -extern int MSG_GetKeyFromMessageId (MSG_Pane *message_pane, - const char *message_id, - MessageKey *outKey); - -/* Converts a MSG_ViewIndex into a MessageKey. */ - -extern MessageKey MSG_GetMessageKey(MSG_Pane* threadpane, MSG_ViewIndex index); - - -/* Getting a message key from the undo manager for dsiplay */ - -extern XP_Bool MSG_GetUndoMessageKey (MSG_Pane* pane, - MSG_FolderInfo** pFolderInfo, - MessageKey* pKey); - -/* Get current undo operation status */ -extern UndoStatus MSG_GetUndoStatus (MSG_Pane* pane); - -/* Get Undo Manager State */ -extern UndoMgrState MSG_GetUndoState(MSG_Pane* pane); - -/* Given a MSG_FolderInfo*, returns the number of children folders. If the - result pointer is not NULL, fills it in with the list of children (providing - up to resultsize entries.) If the given MSG_FolderInfo* is NULL, then - returns the list of top-level folders. */ - -extern int32 MSG_GetFolderChildren(MSG_Master* master, - MSG_FolderInfo* folder, - MSG_FolderInfo** result, - int32 resultsize); - -/* Returns the container of all local (off-line) mail folders. */ - -extern MSG_FolderInfo* MSG_GetLocalMailTree(MSG_Master* master); - -/* Returns the number of mail folders (both local and IMAP). If this number is - greater than zero, an array of pointers to the MSG_FolderInfos is allocated - and returned in result. The caller is responsible for freeing the array. - This function is not recursive, it only returns the top level mail folders. */ -extern int32 MSG_ListMailFolders(MSG_Master *master, MSG_FolderInfo ***result); - -/* Given a flag or set of flags, returns the number of folders that have - that flag set. If the result pointer is not NULL, fills it in with the - list of folders (providing up to resultsize entries). */ - -extern int32 MSG_GetFoldersWithFlag(MSG_Master* master, - uint32 flags, - MSG_FolderInfo** result, - int32 resultsize); - - - - -/* Returns what folder a threadpane is viewing (NULL if not viewing - anything.) */ - -extern MSG_FolderInfo* MSG_GetCurFolder(MSG_Pane* threadpane); - -/* Call this from the new Create Folder UI with the dropdown list. - The MSG_Command will go away when everyone uses this. - This should not be called anymore - keeping it for a smooth transition to - MSG_CreateMailFolderWithPane (below) */ -extern int MSG_CreateMailFolder (MSG_Master *master, MSG_FolderInfo *parent, - const char *childName); - -/* Call this from the new Create Folder UI with the dropdown list. - The MSG_Command will go away when everyone uses this. - Call with invokingPane set to the pane with which to run any IMAP - Create-Folder URLs. (probably the pane from which it was invoked, - or a progress pane) */ -extern int MSG_CreateMailFolderWithPane (MSG_Pane *invokingPane, MSG_Master *master, - MSG_FolderInfo *parent, const char *childName); - - - -/* FEs should call this to determine what folder we should suggest as the parent folder, - when creating a new folder. - current is the MSG_FolderInfo of the currently selected folder or host. - Returns the MSG_FolderInfo for the suggested parent, given the currently selected folder or host. - Returns NULL if current is NULL. -*/ -extern MSG_FolderInfo *MSG_SuggestNewFolderParent(MSG_FolderInfo *current, MSG_Master *master); - - -/* FEs should call this to determine if a given folder (f) can contain subfolders. - This can be called with an arbitrary MSG_FolderInfo, but only (currently) really does anything - interesting if it is a mail folder. */ -extern XP_Bool MSG_GetCanCreateSubfolderOfFolder(MSG_FolderInfo *f); - - -/* Call this from the new folder properties UI */ -extern int MSG_RenameMailFolder (MSG_Pane *folderPane, MSG_FolderInfo *folder, - const char *newName); - -/* Returns what folder and message a messagepane is currently displaying. - (Sets the folder to NULL and the key to MSG_MESSAGEKEYNONE if the - messagepane is currently displaying nothing.) */ - -extern void MSG_GetCurMessage(MSG_Pane* messagepane, - MSG_FolderInfo** folder, - MessageKey* key, MSG_ViewIndex *index); - - -/* Returns what attachments are being viewed in the messagepane, and whether - we're certain it's the entire list. (If the data is still being downloaded, - then there could still be attachments that we don't know about.) - - The returned data must be free'd using MSG_FreeAttachmentList(). */ - -extern int MSG_GetViewedAttachments(MSG_Pane* messagepane, - MSG_AttachmentData** data, - XP_Bool* iscomplete); - - -/* Frees the attachemnt data returned by MSG_GetViewedAttachments(). */ - -extern void MSG_FreeAttachmentList(MSG_Pane* messagepane, - MSG_AttachmentData* data); - - - - -/* Returns whether the user has asked to rot13 messages displayed in - this pane. (Used by libmime.) */ -extern XP_Bool MSG_ShouldRot13Message(MSG_Pane* messagepane); - - -/* =========================================================================== - BIFF - =========================================================================== - */ - -/* biff is the unixy name for "Check for New Mail". It comes from the unix - command of the same name; the author of that command named it after his dog, - who would bark at him whenever he had new mail... */ - -/* The different biff states we can be in: */ - -typedef enum -{ - MSG_BIFF_NewMail, /* User has new mail waiting. */ - MSG_BIFF_NoMail, /* No new mail is waiting. */ - MSG_BIFF_Unknown /* We dunno whether there is new mail. */ -} MSG_BIFF_STATE; - -/* START OBSOLETE Biff functions, NIKI dawg took charge here to do multi-server biffing - These will be removed soon so do not use */ - -/* Register and unregister biff callback functions */ -typedef void (*MSG_BIFF_CALLBACK)(MSG_BIFF_STATE oldState, MSG_BIFF_STATE newState); -extern void MSG_RegisterBiffCallback( MSG_BIFF_CALLBACK cb ); -extern void MSG_UnregisterBiffCallback(); -/* Get and set the current biff state */ -extern MSG_BIFF_STATE MSG_GetBiffState(); -extern void MSG_SetBiffStateAndUpdateFE(MSG_BIFF_STATE newState); -/* Set the preference of how often to run biff. If zero is passed in, then - never check. */ -extern void MSG_SetBiffInterval(int32 seconds); -/* Causes a biff check to occur immediately. This gets caused - automatically by MSG_SetBiffInterval or whenever libmsg gets new mail. */ -extern void FE_UpdateBiff(MSG_BIFF_STATE state); -/* END OBSOLETE functions */ - -/* The following functions are still used to initialize and kill the Biff Master */ - -/* - Initialize the biff master object (MSG_Biff_Master). As folders are created we - add these as NikiBiff objects to the Biff master. Niki is my Old English Sheepdog, but - other than being a dog has nothing else to do with Biff. - The biff master takes care of the objects, their timers and so on. The objects - are used to see if new mail is available at a particular server or folder. -*/ - - -/* =========================================================================== - OTHER INTERFACES - =========================================================================== - */ - -/* Certain URLs must always be displayed in certain types of windows: - for example, all "mailbox:" URLs must go in the mail window, and - all "http:" URLs must go in a browser window. These predicates - look at the address and say which window type is required. - */ -extern XP_Bool MSG_RequiresMailWindow (const char *url); -extern XP_Bool MSG_RequiresNewsWindow (const char *url); -extern XP_Bool MSG_RequiresBrowserWindow (const char *url); -extern XP_Bool MSG_RequiresComposeWindow (const char *url); - - -/* When the front end loads a url, it needs to know what kind of pane the url - should be loaded into. -*/ -extern MSG_PaneType MSG_PaneTypeForURL(const char *url); - -/* Counts bytes for a POP3 message being downloaded and returns TRUE if it is - too early to have a message ended because we found CRLF.CRLF -*/ -extern XP_Bool NET_POP3TooEarlyForEnd(int32 len); - -/* =========================================================================== - SECURE MAIL - =========================================================================== - */ - -extern MSG_SecurityLevel MSG_GetMessageSecurityLevel(MSG_Pane *pPane); -extern const XP_List *MSG_GetRecipientsWithNoCerts(MSG_Pane *pPane); -extern XP_Bool MSG_ShouldEncryptMessage(MSG_Pane *pPane); -extern XP_Bool MSG_ShouldSignMessage(MSG_Pane *pPane); - - -/* FEs call this any time the set of recipients on the compose window - changes. They should make the state (and sensitivity) of the "sign" - and "encrypt" checkboxes, and the state of the "security" button, - correspond to the returned boolean values. - - Maybe this function doesn't really belong here, but it's as good a - place as any... - */ -/* (This is maybe not the most appropriate header file for this proto.) */ -extern void SEC_GetMessageCryptoViability(const char *from, - const char *reply_to, - const char *to, - const char *cc, - const char *bcc, - const char *newsgroups, - const char *followup_to, - XP_Bool *signing_possible_return, - XP_Bool *encryption_possible_return); - - -/* Returns TRUE if the user has selected the preference that says that new - mail messages should be encrypted by default. - */ -extern XP_Bool MSG_GetMailEncryptionPreference(void); - -/* Returns TRUE if the user has selected the preference that says that new - mail messages should be cryptographically signed by default. - */ -extern XP_Bool MSG_GetMailSigningPreference(void); - -/* Returns TRUE if the user has selected the preference that says that new - news messages should be cryptographically signed by default. - */ -extern XP_Bool MSG_GetNewsSigningPreference(void); - - - - -/* =========================================================================== - COMPOSE WINDOW - =========================================================================== - */ - -extern void MSG_DestroyCompositionFields(MSG_CompositionFields *fields); - -/* Tell the FE that something has changed in the composition (like, we - finished quoting or something) so that it needs to update the status of - toolbars and stuff. This call should go away. ###tw */ -extern void FE_UpdateCompToolbar(MSG_Pane* comppane); - - - -/* Determines whether this is a mail composition that ought to have a "quote - message" operation done at startup. If so, the FE must call - MSG_QuoteMessage and handle it, and when done call MSG_SetInitialState(). */ - -extern XP_Bool MSG_ShouldAutoQuote(MSG_Pane* comppane); - - -/* Get and set the various things that a user may have typed. These are all - initialized automatically by the constructor from the MSG_CompositionFields* - object. The FE needs to done setting everything before doing sanity checks - or sending the message. - - MSG_SetCompHeader should not be made with the header - MSG_ATTACHMENTS_HEADER_MASK; instead, call MSG_SetAttachmentList(). - However, the FE may call MSG_GetCompHeader() with - MSG_ATTACHMENTS_HEADER_MASK to find the summary line to display. */ - -extern const char* MSG_GetCompHeader(MSG_Pane* comppane, - MSG_HEADER_SET header); -extern int MSG_SetCompHeader(MSG_Pane* comppane, - MSG_HEADER_SET header, - const char* value); -extern const char* MSG_GetCompFieldsHeader(MSG_CompositionFields *fields, - MSG_HEADER_SET header); -extern int MSG_SetCompFieldsHeader(MSG_CompositionFields *fields, - MSG_HEADER_SET header, - const char* value); -extern void MSG_SetCompFieldsReceiptType(MSG_CompositionFields *fields, - int32 type); -extern int32 MSG_GetCompFieldsReceiptType(MSG_CompositionFields *fields); - -extern XP_Bool MSG_GetCompBoolHeader(MSG_Pane* comppane, - MSG_BOOL_HEADER_SET header); -extern int MSG_SetCompBoolHeader(MSG_Pane* comppane, - MSG_BOOL_HEADER_SET header, - XP_Bool value); -extern XP_Bool MSG_GetCompFieldsBoolHeader(MSG_CompositionFields *fields, - MSG_BOOL_HEADER_SET header); -extern int MSG_SetCompFieldsBoolHeader(MSG_CompositionFields *fields, - MSG_BOOL_HEADER_SET header, - XP_Bool value); - -/* Get whether we should force plain-text composition by default. */ -extern XP_Bool MSG_GetForcePlainText(MSG_CompositionFields* fields); - - -extern const char* MSG_GetCompBody(MSG_Pane* comppane); -extern int MSG_SetCompBody(MSG_Pane* comppane, const char* body); - -/* These following four functions are provided to make implementing the - grid-based compose window a bit easier. A new type definition - (MSG_HeaderEntry) is introduced which is used to store individual - address entries. -- jevering */ - -typedef struct -{ - MSG_HEADER_SET header_type; - char * header_value; -} MSG_HeaderEntry; - -/* MSG_ExplodeHeaderField() parses a single header entry and returns - a list of MSG_HeaderEntry structures. The return value is the - number of items in the return list or -1 for an error. The return - list as well as its contents should be freed by the caller. */ - -extern int MSG_ExplodeHeaderField( MSG_HEADER_SET msg_header, - const char * field, - MSG_HeaderEntry **return_list); - -/* This function retrieve the contents of the current compose window - headers and parses them into a MSG_HeaderEntry list with one - address per line. Call this function when constructing the compose - window in order to initialize the grid-widget. This function returns - the number of items in the list or -1 indicating an error. The - return list should be freed by the caller. */ - -extern int MSG_RetrieveStandardHeaders(MSG_Pane * pane, - MSG_HeaderEntry ** return_list); - -/* This function accepts a list of single-entry address items and - condenses it down to a list of comma separated addressed. The - order of occurance is maintained on a MSG_HEADER_SET basis. - The return value indicated the size of the list. A return value - of -1 indicates that an error has occured. The returned list - as well as its contents should be freed by the caller. */ - -extern int MSG_CompressHeaderEntries(MSG_HeaderEntry * in_list, - int list_size, - MSG_HeaderEntry ** return_list); - -/* call this function with the list returned by MSG_CompressHeaderEntries(). - pane - message pane, count - number of entries in list. - The previous headers are cleared and the contents of the new list - is used. The memory is freed as well. */ - -extern void MSG_SetHeaderEntries(MSG_Pane * pane, - MSG_HeaderEntry * in_list, - int count); - -/* Clears all compose window headers (except the attachment list). */ - -extern void MSG_ClearComposeHeaders(MSG_Pane * pane); - -/* Begin a "quote message" operation. This is complicated, because this is an - asynchronous operation. (Getting the message to quote can be a network - operation). So, the FE must provide a callback routine that inserts the - quoted data, piecemeal. The callback will get called with a NULL string - when things are all done (or if things failed or were cancelled.) The - callback routine should return a negative value on error. - - Actually, if we're an HTML composition, we call the editor functions - directly, and ignore the given func(). Pretty rude, huh. - */ -#ifdef XP_OS2 -typedef int (*PNSQMFN)(void *, const char *); - -extern void MSG_QuoteMessage(MSG_Pane* comppane, - PNSQMFN func, - void* closure); -#else -extern void MSG_QuoteMessage(MSG_Pane* comppane, - int (*func)(void* closure, const char* data), - void* closure); -#endif - -/* The FE is about to call MSG_SendComposition to cause things to be sent, but - first, it wants to make sure that the user isn't trying to send something - blatently stupid (like, no subject, or no body, or no "To:", or whatever). - So, there's various sanity checks for it to make, and the FE can then take - appropriate actions if the check failed. Each sanity check returns an - error code describing the problem. The FE can pop up the string for that - error code in a FE_Confirm() call. If FE_Confirm() returns TRUE, then the - user doesn't care and wants to send the message anyway, so the FE can just - call MSG_SanityCheck() again and pass the given errorcode as the skippast - parameter. libmsg will skip that sanity check, and all the previous ones, - and confirm that the other things work. - - It's up to the FE how to handle each error code; the FE_Confirm() method - is just the suggested default. In particular, the FE should prompt the - user for the subject if we return MK_MSG_MISSING_SUBJECT. - - The current sanity checks are: - - MK_MSG_MISSING_SUBJECT: There is no subject line. - MK_MSG_EMPTY_MESSAGE: There is no real body, and no attachments. - MK_MSG_DOUBLE_INCLUDE: The original message was both quoted and attached. - MK_MSG_MIXED_SECURITY: Some recipients have certificates; some not. - - */ - -extern int MSG_SanityCheck(MSG_Pane* comppane, int skippast); - -/* Get the URL associated with this context (the "X-Url" field.) */ -extern const char* MSG_GetAssociatedURL(MSG_Pane* comppane); - -/* */ - - -/* Returns whether the given folderinfo represents a newsgroup where - HTML postings are OK. This is to be used in the property dialog - for that newsgroup. This call should only be done on newsgroups. */ - -extern XP_Bool MSG_IsHTMLOK(MSG_Master* master, MSG_FolderInfo* group); - - - -/* Utility function that prefixes each line with "> " (for Paste As Quote). */ -extern char *MSG_ConvertToQuotation (const char *string); - -/* Paste the given plaintext into the running HTML editor as a quotation. - This can only be used if the given composition pane is in HTML mode. */ -extern int MSG_PastePlaintextQuotation(MSG_Pane* comppane, const char* string); - - -/* The user has just finished editing a given header (the field has lost focus - or something like that.) Find out if some magic change needs to be made - (e.g., the user typed a nickname from the addressbook and we want to replace - it with the specified address.) If so, a new value to be displayed is - returned. The returned string, if any, must be freed using XP_FREE(). This - should be called before calling MSG_SetCompHeader(). */ - -extern char* MSG_UpdateHeaderContents(MSG_Pane* comppane, - MSG_HEADER_SET header, - const char* value); - - -/* If the sanity check return MK_MSG_MIXED_SECURITY, then the user may choose - to remove non-secure people from the list. The FE can do so by calling - this routine. It will then have to call MSG_GetCompHeader a few times - to get and redisplay the new values for the To, Cc, and Bcc fields. */ - -extern void MSG_RemoveNoCertRecipients(MSG_Pane* comppane); - -/* Inform the backend what is to be attached. The MSG_AttachmentData structure - is defined in mime.h. The "list" parameter is an array of these fields, - terminated by one which has a NULL url field. In each entry, all that you - have to fill in is "url" and probably "desired_type"; NULL is generally fine - for all the other fields (but you can fill them in too). See mime.h for all - the spiffy details. - - Note that this call copies (sigh) all the data into libmsg; it is up to the - caller to free any data it had to allocate to create the MSG_AttachmentData - structure. */ - -extern int MSG_SetAttachmentList(MSG_Pane* comppane, - struct MSG_AttachmentData* list); - - -/* Get what msglib's idea of what the current attachments are. DO NOT MODIFY - THE DATA RETURNED; you can look, but don't touch. If you want to change - the data, you have to copy out the whole structure somewhere, make your - changes, call MSG_SetAttachmentList() with your new data, and then free - your copy. If there are no attachments, this routine always returns - NULL. */ -extern const struct MSG_AttachmentData* -MSG_GetAttachmentList(MSG_Pane* comppane); - - - - -/* The FE should call this in response to a `Show Interesting Headers' command, - and when first initializing the composition window.. It returns the set of - headers that ought to be displayed (and checked in the "view" menu.) - */ -extern MSG_HEADER_SET MSG_GetInterestingHeaders(MSG_Pane* comppane); - -/* These routines were in mime.h, but defined in libmsg...*/ - -/* Given a string which contains a list of RFC822 addresses, parses it into - their component names and mailboxes. - - The returned value is the number of addresses, or a negative error code; - the names and addresses are returned into the provided pointers as - consecutive null-terminated strings. It is up to the caller to free them. - Note that some of the strings may be zero-length. - - Either of the provided pointers may be NULL if the caller is not interested - in those components. - */ -extern int MSG_ParseRFC822Addresses (const char *line, - char **names, char **addresses); - - -/* Given a string which contains a list of RFC822 addresses, returns a - comma-seperated list of just the `mailbox' portions. - */ -extern char *MSG_ExtractRFC822AddressMailboxes (const char *line); - - -/* Given a string which contains a list of RFC822 addresses, returns a - comma-seperated list of just the `user name' portions. If any of - the addresses doesn't have a name, then the mailbox is used instead. - */ -extern char *MSG_ExtractRFC822AddressNames (const char *line); - -/* Like MSG_ExtractRFC822AddressNames(), but only returns the first name - in the list, if there is more than one. - */ -extern char *MSG_ExtractRFC822AddressName (const char *line); - -/* Given a string which contains a list of RFC822 addresses, returns a new - string with the same data, but inserts missing commas, parses and reformats - it, and wraps long lines with newline-tab. - */ -extern char * MSG_ReformatRFC822Addresses (const char *line); - -/* Returns a copy of ADDRS which may have had some addresses removed. - Addresses are removed if they are already in either ADDRS or OTHER_ADDRS. - (If OTHER_ADDRS contain addresses which are not in ADDRS, they are not - added. That argument is for passing in addresses that were already - mentioned in other header fields.) - - Addresses are considered to be the same if they contain the same mailbox - part (case-insensitive.) Real names and other comments are not compared. - - removeAliasesToMe allows the address parser to use the preference which - contains regular expressions which also mean 'me' for the purpose of - stripping the user's email address(es) out of addrs - */ -extern char *MSG_RemoveDuplicateAddresses (const char *addrs, - const char *other_addrs, - XP_Bool removeAliasesToMe); - - -/* Given an e-mail address and a person's name, cons them together into a - single string of the form "name <address>", doing all the necessary quoting. - A new string is returned, which you must free when you're done with it. - */ -extern char *MSG_MakeFullAddress (const char* name, const char* addr); - -/* MSG_ParseRFC822Addresses returns quoted parsable addresses - This function removes the quoting if you want to show the - names to users. e.g. summary file, address book - */ -extern int MSG_UnquotePhraseOrAddr (char *line, char** lineout); - - -/* Notify the address book panes that the list of directory servers has changed - This is only called from the address book. */ - -extern int MSG_NotifyChangeDirectoryServers(); - -/* Given a folder info, returns a newly allocated string containing a description - of the folder rights for a given folder. It is the caller's responsibility - to free this string. - Returns NULL if we could not get ACL rights information for this folder. - */ - -extern char *MSG_GetACLRightsStringForFolder(MSG_FolderInfo *folder); - - -/* Given a folder info, returns a newly allocated string with the folder - type name. For instance, "Personal Folder", "Public Folder", etc. - It is the caller's responsibility to free this string. - Returns NULL if we could not get the a type for this folder. - */ - -extern char *MSG_GetFolderTypeName(MSG_FolderInfo *folder); - -/* Given a folder info, returns a newly allocated string containing a description - of the folder type. For instance, "This is a personal mail folder that you have shared." - It is the caller's responsibility to free this string. - Returns NULL if we could not get the a type for this folder. - */ - -extern char *MSG_GetFolderTypeDescription(MSG_FolderInfo *folder); - -/* Returns TRUE if the given IMAP host supports the sharing of folders. */ - -extern XP_Bool MSG_GetHostSupportsSharing(MSG_IMAPHost *host); - -XP_END_PROTOS - - -#endif /* _MSGCOM_H_ */