This commit is contained in:
rhp%netscape.com 1999-04-27 02:27:27 +00:00
Родитель 24e557b3b8
Коммит ca3422efc7
3 изменённых файлов: 0 добавлений и 583 удалений

Просмотреть файл

@ -1,176 +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.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
msg.h --- internal defs for the msg library
*/
#ifndef _MSG_H_
#define _MSG_H_
#include "xp.h"
#include "msgcom.h"
#include "msgnet.h"
#include "xpgetstr.h"
#ifdef XP_CPLUSPLUS
class MessageDBView;
class MSG_SendPart;
#endif
#define MANGLE_INTERNAL_ENVELOPE_LINES /* We always need to do this, for now */
#undef FIXED_SEPARATORS /* this doesn't work yet */
#define EMIT_CONTENT_LENGTH /* Experimental; and anyway, we only
emit it, we don't parse it, so this
is only the first step. */
/* hack - this string gets appended to the beginning of an attachment field
during a forward quoted operation */
#define MSG_FORWARD_COOKIE "$forward_quoted$"
/* The PRINTF macro is for debugging messages of unusual events (summary */
/* files out of date or invalid or the like. It's so that as I use the mail */
/* to actually read my e-mail, I can look at the shell output whenever */
/* something unusual happens so I can get some clues as to what's going on. */
/* Please don't remove any PRINTF calls you see, and be sparing of adding */
/* any additional ones. Thanks. - Terry */
#ifdef DEBUG
#define PRINTF(msg) PR_LogPrint msg
#else
#define PRINTF(msg)
#endif
/* The Netscape-specific header fields that we use for storing our
various bits of state in mail folders.
*/
#define X_MOZILLA_STATUS "X-Mozilla-Status"
#define X_MOZILLA_STATUS_FORMAT X_MOZILLA_STATUS ": %04.4x"
#define X_MOZILLA_STATUS_LEN /*1234567890123456*/ 16
#define X_MOZILLA_STATUS2 "X-Mozilla-Status2"
#define X_MOZILLA_STATUS2_FORMAT X_MOZILLA_STATUS2 ": %08.8x"
#define X_MOZILLA_STATUS2_LEN /*12345678901234567*/ 17
#define X_MOZILLA_DRAFT_INFO "X-Mozilla-Draft-Info"
#define X_MOZILLA_DRAFT_INFO_LEN /*12345678901234567890*/ 20
#define X_MOZILLA_NEWSHOST "X-Mozilla-News-Host"
#define X_MOZILLA_NEWSHOST_LEN /*1234567890123456789*/ 19
#define X_UIDL "X-UIDL"
#define X_UIDL_LEN /*123456*/ 6
#define CONTENT_LENGTH "Content-Length"
#define CONTENT_LENGTH_LEN /*12345678901234*/ 14
/* Provide a common means of detecting empty lines in a message. i.e. to detect the end of headers among other things...*/
#define EMPTY_MESSAGE_LINE(buf) (buf[0] == CR || buf[0] == LF || buf[0] == '\0')
typedef PRInt32 MsgChangeCookie; /* used to unregister change notification */
/* The three ways the list of newsgroups can be pruned.
*/
typedef enum
{
MSG_ShowAll,
MSG_ShowSubscribed,
MSG_ShowSubscribedWithArticles
} MSG_NEWSGROUP_DISPLAY_STYLE;
/* The three ways to deliver a message.
*/
typedef enum
{
MSG_DeliverNow,
MSG_QueueForLater,
MSG_SaveAs,
MSG_SaveAsDraft,
MSG_SaveAsTemplate
} MSG_Deliver_Mode;
/* A little enum for things we'd like to learn lazily.
* e.g. displaying recipients for this pane? Yes we are,
* no we're not, haven't figured it out yet
*/
typedef enum
{
msg_No,
msg_Yes,
msg_DontKnow
} msg_YesNoDontKnow;
/* The MSG_REPLY_TYPE shares the same space as MSG_CommandType, to avoid
possible weird errors, but is restricted to the `composition' commands
(MSG_ReplyToSender through MSG_ForwardMessage.)
*/
typedef MSG_CommandType MSG_REPLY_TYPE;
/* The list of all message flags to not write to disk. */
#define MSG_FLAG_RUNTIME_ONLY (MSG_FLAG_ELIDED)
/* ===========================================================================
Structures.
===========================================================================
*/
/* Used for the various things that parse RFC822 headers...
*/
typedef struct message_header
{
const char *value; /* The contents of a header (after ": ") */
PRInt32 length; /* The length of the data (it is not NULL-terminated.) */
} message_header;
XP_BEGIN_PROTOS
/* we'll need this for localized folder names */
extern int MK_MSG_INBOX_L10N_NAME;
extern int MK_MSG_OUTBOX_L10N_NAME; /* win16 variations are in allxpstr.h */
extern int MK_MSG_OUTBOX_L10N_NAME_OLD;
extern int MK_MSG_TRASH_L10N_NAME;
extern int MK_MSG_DRAFTS_L10N_NAME;
extern int MK_MSG_SENT_L10N_NAME;
extern int MK_MSG_TEMPLATES_L10N_NAME;
#define INBOX_FOLDER_NAME MSG_GetSpecialFolderName(MK_MSG_INBOX_L10N_NAME)
#define QUEUE_FOLDER_NAME MSG_GetSpecialFolderName(MK_MSG_OUTBOX_L10N_NAME)
#define QUEUE_FOLDER_NAME_OLD MSG_GetSpecialFolderName(MK_MSG_OUTBOX_L10N_NAME_OLD)
#define TRASH_FOLDER_NAME MSG_GetSpecialFolderName(MK_MSG_TRASH_L10N_NAME)
#define DRAFTS_FOLDER_NAME MSG_GetSpecialFolderName(MK_MSG_DRAFTS_L10N_NAME)
#define SENT_FOLDER_NAME MSG_GetSpecialFolderName(MK_MSG_SENT_L10N_NAME)
#define TEMPLATES_FOLDER_NAME MSG_GetSpecialFolderName(MK_MSG_TEMPLATES_L10N_NAME)
#ifdef XP_OS2
#define INBOX_FOLDER_PRETTY_NAME MSG_GetSpecialFolderPrettyName(MK_MSG_INBOX_L10N_NAME)
#define QUEUE_FOLDER_PRETTY_NAME MSG_GetSpecialFolderPrettyName(MK_MSG_OUTBOX_L10N_NAME)
#define QUEUE_FOLDER_PRETTY_NAME_OLD MSG_GetSpecialFolderPrettyName(MK_MSG_OUTBOX_L10N_NAME_OLD)
#define TRASH_FOLDER_PRETTY_NAME MSG_GetSpecialFolderPrettyName(MK_MSG_TRASH_L10N_NAME)
#define DRAFTS_FOLDER_PRETTY_NAME MSG_GetSpecialFolderPrettyName(MK_MSG_DRAFTS_L10N_NAME)
#define SENT_FOLDER_PRETTY_NAME MSG_GetSpecialFolderPrettyName(MK_MSG_SENT_L10N_NAME)
#define TEMPLATES_FOLDER_PRETTY_NAME MSG_GetSpecialFolderPrettyName(MK_MSG_TEMPLATES_L10N_NAME)
#endif
XP_END_PROTOS
#endif /* !_MSG_H_ */

Просмотреть файл

@ -1,163 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef __nsINetFile_h
#define __nsINetFile_h
#include "nsISupports.h"
#include "nsString.h"
#include "prio.h"
// These defines are for temporary use until we get a real dir manager.
#define USER_DIR_TOK "%USER%"
#define CACHE_DIR_TOK "%CACHE_D%"
#define DEF_DIR_TOK "%DEF_D%"
#define COOKIE_FILE_TOK "%COOKIE_F%"
#ifdef XP_PC
#define COOKIE_FILE "cookies.txt"
#else
#define COOKIE_FILE "cookies"
#endif
#ifdef CookieManagement
#define COOKIE_PERMISSION_FILE_TOK "%COOKIE_PERMISSION_F%"
#ifdef XP_PC
#define COOKIE_PERMISSION_FILE "cookperm.txt"
#else
#define COOKIE_PERMISSION_FILE "cookperm"
#endif
#endif
#ifdef SingleSignon
#define SIGNON_FILE_TOK "%SIGNON_F%"
#ifdef XP_PC
#define SIGNON_FILE "signons.txt"
#else
#define SIGNON_FILE "signons"
#endif
#endif
#define CACHE_DB_F_TOK "%CACHE_DB_F%"
#define CACHE_DB_FILE "fat.db"
// {9E04ADC2-2B1D-11d2-B6EB-00805F8A2676}
#define NS_INETFILE_IID \
{ 0x9e04adc2, 0x2b1d, 0x11d2, \
{0xb6, 0xeb, 0x00, 0x80, 0x5f, 0x8a, 0x26, 0x76} }
// Represents a file for use with nsINetFile routines.
typedef struct _nsFile {
PRFileDesc *fd;
} nsFile;
// Represents a directory for use with nsINetFile routines.
typedef struct _nsDir {
PRDir *dir;
} nsDir;
// Open flags. Used with nsINetFile::OpenFile.
typedef enum {
nsRead = 1,
nsWrite = 2,
nsReadWrite = 3,
nsReadBinary = 5,
nsWriteBinary = 6,
nsReadWriteBinary = 7,
nsOverWrite = 8
} nsFileMode;
class nsINetFile: public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_INETFILE_IID; return iid; }
/*
* File methods
*/
// Convert a generic file names into a platform file path
// Currently generic file location information is prepended to the
// begining of aName. For example, if I wanted to open the cookie file,
// I'd pass in "%USER%\cookies.txt . aName is platform specific.
NS_IMETHOD GetFilePath(const char *aName, char **aRes) = 0;
NS_IMETHOD GetTemporaryFilePath(const char *aName, char **aRes) = 0;
NS_IMETHOD GetUniqueFilePath(const char *aName, char **aRes) = 0;
NS_IMETHOD GetCacheFileName(char *aDirTok, char **aRes) = 0;
// Open a file
NS_IMETHOD OpenFile(const char *aPath, nsFileMode aMode,
nsFile** aRes) = 0;
// Close a file
NS_IMETHOD CloseFile(nsFile* aFile) = 0;
// Read a file
NS_IMETHOD FileRead(nsFile *aFile, char **aBuf,
PRInt32 *aBuflen,
PRInt32 *aBytesRead) = 0;
NS_IMETHOD FileReadLine(nsFile *aFile, char **aBuf,
PRInt32 *aBuflen,
PRInt32 *aBytesRead) = 0;
// Write a file
NS_IMETHOD FileWrite(nsFile *aFile, const char *aBuf,
PRInt32 *aLen,
PRInt32 *aBytesWritten) = 0;
// Sync a file with disk
NS_IMETHOD FileSync(nsFile *aFile) = 0;
// Remove a file
NS_IMETHOD FileRemove(const char *aPath) = 0;
// Rename a file
NS_IMETHOD FileRename(const char *aPathOld, const char *aPathNew) = 0;
/*
* Directory Methods
*/
// Open a directory
NS_IMETHOD OpenDir(const char *aPath, nsDir** aRes) = 0;
// Close a directory
NS_IMETHOD CloseDir(nsDir *aDir) = 0;
// Create a directory
NS_IMETHOD CreateDir(const char *aPath, PRBool aRecurse) = 0;
// Assocaite a token with a directory.
NS_IMETHOD SetDirectory(const char *aToken, const char *aDir) = 0;
// Associate a filename with a token, and optionally a dir token.
NS_IMETHOD SetFileAssoc(const char *aToken, const char *aFile, const char *aDirToken) = 0;
};
/**
* Create an instance of the INetFile
*
*/
extern "C" NS_NET nsresult NS_NewINetFile(nsINetFile** aInstancePtrResult,
nsISupports* aOuter);
extern "C" NS_NET nsresult NS_InitINetFile(void);
extern "C" NS_NET nsresult NS_ShutdownINetFile();
#endif /* __nsINetFile_h */

Просмотреть файл

@ -1,244 +0,0 @@
mimemoz.cpp
===========
references to pane have been removed
//SHERRY - NO REAL PANE HERE!!!
//msd->options->pane = url->msg_pane;
mimei.h
=======
MSG_Pane pane;
MimeDisplayOptions in modlmime.h:
=================================
MSG_Pane* pane; /* The libmsg pane object that corresponds to
what we're showing. This is used by very
little... */
mimehdrs.cpp
============
PR_ASSERT(hdrs);
if (!hdrs) return -1;
downloaded = opt->missing_parts ? (MimeHeaders_get(hdrs, IMAP_EXTERNAL_CONTENT_HEADER, PR_FALSE, PR_FALSE) == NULL) : PR_TRUE;
if (type && *type && opt)
{
if (opt->type_icon_name_fn)
icon = opt->type_icon_name_fn(type, opt->stream_closure);
if (!PL_strcasecmp(type, APPLICATION_OCTET_STREAM))
type_desc = PL_strdup(XP_GetString(MK_MSG_UNSPECIFIED_TYPE));
else if (opt->type_description_fn)
type_desc = opt->type_description_fn(type, opt->stream_closure);
}
/* Kludge to use a prettier name for AppleDouble and AppleSingle objects.
*/
if (type && (!PL_strcasecmp(type, MULTIPART_APPLEDOUBLE) ||
!PL_strcasecmp(type, MULTIPART_HEADER_SET) ||
!PL_strcasecmp(type, APPLICATION_APPLEFILE)))
{
PR_Free(type);
type = PL_strdup(XP_GetString(MK_MSG_MIME_MAC_FILE));
PR_FREEIF(icon);
icon = PL_strdup("internal-gopher-binary");
}
# define PUT_STRING(S) do { \
status = MimeHeaders_grow_obuffer(hdrs, PL_strlen(S)+1); \
if (status < 0) goto FAIL; \
PL_strcpy (hdrs->obuffer, S); \
status = MimeHeaders_write(opt, hdrs->obuffer, \
PL_strlen(hdrs->obuffer)); \
if (status < 0) goto FAIL; } while (0)
PUT_STRING ("<TABLE CELLPADDING=2 CELLSPACING=0 BORDER=1><TR>");
if (MimeHeaders_getShowAttachmentColors())
{
/* For IMAP MIME parts on demand */
partColor = downloaded ? "#00CC00" : "#FFCC00";
PUT_STRING ("<TD NOWRAP WIDTH=\"5\" BGCOLOR=\"");
PUT_STRING (partColor);
PUT_STRING ("\"><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>");
PUT_STRING ("<TR><TD NOWRAP VALIGN=CENTER></TD></TR></TABLE></TD>");
}
PUT_STRING ("<TD NOWRAP>");
if (icon)
{
PUT_STRING("<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>"
"<TR><TD NOWRAP VALIGN=CENTER>");
if (lname_url)
{
PUT_STRING("<A HREF=\"");
PUT_STRING(lname_url);
PUT_STRING("\" PRIVATE>");
}
PUT_STRING("<IMG SRC=\"");
PUT_STRING(icon);
PUT_STRING("\" BORDER=0 ALIGN=MIDDLE ALT=\"\">");
if (lname_url)
PUT_STRING("</A>");
PUT_STRING("</TD><TD VALIGN=CENTER>");
}
if (lname_url)
{
PUT_STRING("<A HREF=\"");
PUT_STRING(lname_url);
PUT_STRING("\" PRIVATE>");
}
if (lname)
PUT_STRING (lname);
if (lname_url)
PUT_STRING("</A>");
if (icon)
PUT_STRING("</TD></TR></TABLE>");
PUT_STRING ("</TD><TD>");
if (opt->headers == MimeHeadersAll)
{
status = MimeHeaders_write_headers_html (hdrs, opt, TRUE);
if (status < 0) return status;
}
else
{
#define MHTML_HEADER_TABLE "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>"
char *name = MimeHeaders_get_name(hdrs);
PUT_STRING (MHTML_HEADER_TABLE);
if (name)
{
const char *name_hdr = MimeHeaders_localize_header_name("Name", opt);
PUT_STRING("<TR><TH VALIGN=BASELINE ALIGN=RIGHT NOWRAP>");
PUT_STRING(name_hdr);
PUT_STRING(": </TH><TD>");
PUT_STRING(name);
PR_FREEIF(name);
PUT_STRING("</TD></TR>");
}
if (type)
{
const char *type_hdr = MimeHeaders_localize_header_name("Type", opt);
PUT_STRING("<TR><TH VALIGN=BASELINE ALIGN=RIGHT NOWRAP>");
PUT_STRING(type_hdr);
PUT_STRING(": </TH><TD>");
if (type_desc)
{
PUT_STRING(type_desc);
PUT_STRING(" (");
}
PUT_STRING(type);
if (type_desc)
PUT_STRING(")");
PR_FREEIF(type);
PR_FREEIF(type_desc);
PUT_STRING("</TD></TR>");
}
enc = (encoding
? PL_strdup(encoding)
: MimeHeaders_get(hdrs, HEADER_CONTENT_TRANSFER_ENCODING,
PR_TRUE, PR_FALSE));
if (enc)
{
const char *enc_hdr = MimeHeaders_localize_header_name("Encoding",
opt);
PUT_STRING("<TR><TH VALIGN=BASELINE ALIGN=RIGHT NOWRAP>");
PUT_STRING(enc_hdr);
PUT_STRING(": </TH><TD>");
PUT_STRING(enc);
PR_FREEIF(enc);
PUT_STRING("</TD></TR>");
}
desc = MimeHeaders_get(hdrs, HEADER_CONTENT_DESCRIPTION, PR_FALSE, PR_FALSE);
if (!desc)
{
desc = MimeHeaders_get(hdrs, HEADER_X_SUN_DATA_DESCRIPTION,
PR_FALSE, PR_FALSE);
/* If there's an X-Sun-Data-Description, but it's the same as the
X-Sun-Data-Type, don't show it.
*/
if (desc)
{
char *loser = MimeHeaders_get(hdrs, HEADER_X_SUN_DATA_TYPE,
PR_FALSE, PR_FALSE);
if (loser && !PL_strcasecmp(loser, desc))
PR_FREEIF(desc);
PR_FREEIF(loser);
}
}
if (desc)
{
const char *desc_hdr= MimeHeaders_localize_header_name("Description",
opt);
PUT_STRING("<TR><TH VALIGN=BASELINE ALIGN=RIGHT NOWRAP>");
PUT_STRING(desc_hdr);
PUT_STRING(": </TH><TD>");
PUT_STRING(desc);
PR_FREEIF(desc);
PUT_STRING("</TD></TR>");
}
if (!downloaded)
{
const char *downloadStatus_hdr = XP_GetString(MK_MIMEHTML_DOWNLOAD_STATUS_HEADER);
const char *downloadStatus = XP_GetString(MK_MIMEHTML_DOWNLOAD_STATUS_NOT_DOWNLOADED);
PUT_STRING("<TR><TH VALIGN=BASELINE ALIGN=RIGHT NOWRAP>");
PUT_STRING(downloadStatus_hdr);
PUT_STRING(": </TH><TD>");
PUT_STRING(downloadStatus);
PUT_STRING("</TD></TR>");
}
PUT_STRING ("</TABLE>");
}
if (body) PUT_STRING(body);
PUT_STRING ("</TD></TR></TABLE></CENTER>");
# undef PUT_STRING
FAIL:
PR_FREEIF(type);
PR_FREEIF(desc);
PR_FREEIF(enc);
PR_FREEIF(icon);
PR_FREEIF(type_desc);
MimeHeaders_compact (hdrs);
return status;
/* Returns PR_TRUE if we should show colored tags on attachments.
Useful for IMAP MIME parts on demand, because it shows a different
color for undownloaded parts. */
static PRBool
MimeHeaders_getShowAttachmentColors()
{
static int32 gotPref = PR_FALSE;
static int32 showColors = PR_FALSE;
if (!gotPref)
{
PREF_GetIntPref("mailnews.color_tag_attachments", &showColors);
gotPref = PR_TRUE;
}
return showColors;
}