Adding modular libMIME to the tree.

This commit is contained in:
rhp%netscape.com 1999-01-13 02:26:49 +00:00
Родитель c37a50331a
Коммит e5dcc87ffc
13 изменённых файлов: 1320 добавлений и 0 удалений

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

@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// mailtest.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

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

@ -0,0 +1,26 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__00AF81DB_7405_11D2_B323_0020AF70F393__INCLUDED_)
#define AFX_STDAFX_H__00AF81DB_7405_11D2_B323_0020AF70F393__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC OLE automation classes
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__00AF81DB_7405_11D2_B323_0020AF70F393__INCLUDED_)

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

@ -0,0 +1,80 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Richard H. Pizzarro">
<meta name="GENERATOR" content="Mozilla/4.5 [en] (WinNT; U) [Netscape]">
<title>Untitled</title>
</head>
<body text="#FFFFFF" bgcolor="#000000" link="#FFFF00" vlink="#C0C0C0" alink="#C0FFC0">
<font face="Arial,Helvetica"><b>Program: </b>MailTest.EXE</font>
<br><font face="Arial,Helvetica"><b>Written by: </b><u><a href="mailto:rhp@netscape.com">rhp@netscape.com</a></u></font>
<br><font face="Arial,Helvetica"><b>Last Update: </b>December 3, 1998</font>
<p><b><u><font face="Arial,Helvetica">What is this?</font></u></b>
<br><font face="Arial,Helvetica">Mostly, it's a test harness program for
<b>libmime</b>
development. MailTest uses Raptor as the HTML display engine and the new
"more modular" <b>libmime</b> to parse the RFC822 messages from disk. This
program lets you open one of your mailbox files from disk (in Berkeley
mail folder format), it will parse these into individual files in your
systems TEMP directory and then display subjects in the listbox.</font>
<p><b><u><font face="Arial,Helvetica">How do I run the program?</font></u></b>
<br><font face="Arial,Helvetica">Just do a "File -> Open Mailbox" and select
one of the mailboxes from your mail store. After a short pause, you will
see the messages in this mailbox displayed in the listbox at the top of
the application. After this display is complete, double click any of the
messages and it should render in the embedded Raptor window below. <b><i><font color="#FFFFCC">Note:
I've put a test mailbox file (</font><font color="#FF6666">Mailbox</font><font color="#FFFFCC">)
in the same directory as the test program.</font></i></b></font>
<p><b><u><font face="Arial,Helvetica">What this program is:</font></u></b>
<br><font face="Arial,Helvetica">Mostly, this is the <i><font color="#99FF99">first
step</font><font color="#00CC00"> </font></i>in getting <b>libmime</b>
into a modular form using Raptor for mail message display. Interesting
points for this application are:</font>
<ul>
<li>
<font face="Arial,Helvetica"><b>libmime </b>is isolated into a separate
DLL (<b><font color="#FF6666">MIME.DLL</font></b>) on disk</font></li>
<li>
<font face="Arial,Helvetica">The registration of the stream converter is
being done from the test application, though it is being done via an old
API call (<b><font color="#FF6666">NET_RegisterContentTypeConverter</font></b>).
This interface is being discussed and will have to be implemented.</font></li>
<li>
<font face="Arial,Helvetica">Like mentioned above, mostly a test harness
to fix issues with libmime.</font></li>
</ul>
<b><u><font face="Arial,Helvetica">What it isn't:</font></u></b>
<ul>
<li>
<font face="Arial,Helvetica">A solid version libmime...there are lots of
problems with how various items are displayed (attachments, signed messages,
etc...)</font></li>
<li>
<font face="Arial,Helvetica">There is no custom protocol handler at work
here. I didn't spend my time getting a custom protocol handler working,
rather, I setup a MIME association between .eml files and message/rfc822
messages.</font></li>
</ul>
<b><u><font face="Arial,Helvetica">Why do I need to use this entire distribution
and not just use my compiled Raptor dist:</font></u></b>
<ul>
<li>
<font face="Arial,Helvetica">I needed to export the <b><font color="#FF6666">NET_RegisterContentTypeConverter
</font></b>for now...this will change as an XP-COM interface for stream
converters becomes available. Also the MIME association between .eml files
and message/rfc822 stream converters.</font></li>
</ul>
<u><font face="Arial,Helvetica"><b>Open Issues </b><i>(and there are lots
:-)</i><b>:</b></font></u>
<ul>
<li>
<font face="Arial,Helvetica">Not all of the messages in the sample Mailbox
render properly...I know that.</font></li>
</ul>
</body>
</html>

Двоичные данные
mailnews/mime/tests/mailtest/mailtest.aps Normal file

Двоичный файл не отображается.

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

@ -0,0 +1,91 @@
; CLW file contains information for the MFC ClassWizard
[General Info]
Version=1
LastClass=CFileOpen
LastTemplate=CFileDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "mailtest.h"
ClassCount=7
Class1=CMailtestApp
Class2=CMailtestDlg
Class3=CAboutDlg
ResourceCount=4
Resource1=IDR_MENU
Resource2=IDR_MAINFRAME
Resource3=IDD_ABOUTBOX
Class5=OpenFile
Class6=COpenFile
Class7=CFileOpen
Resource4=IDD_MAILTEST_DIALOG
[CLS:CMailtestApp]
Type=0
HeaderFile=mailtest.h
ImplementationFile=mailtest.cpp
Filter=N
[CLS:CMailtestDlg]
Type=0
HeaderFile=mailtestDlg.h
ImplementationFile=mailtestDlg.cpp
Filter=W
BaseClass=CDialog
VirtualFilter=dWC
[CLS:CAboutDlg]
Type=0
HeaderFile=mailtestDlg.h
ImplementationFile=mailtestDlg.cpp
Filter=D
[DLG:IDD_ABOUTBOX]
Type=1
Class=CAboutDlg
ControlCount=4
Control1=IDC_STATIC,static,1342308480
Control2=IDC_STATIC,static,1342308352
Control3=IDOK,button,1342373889
Control4=IDC_STATIC,static,1342177283
[DLG:IDD_MAILTEST_DIALOG]
Type=1
Class=CMailtestDlg
ControlCount=4
Control1=IDC_BROWSER_MARKER,static,1342177288
Control2=IDC_HEADERS,listbox,1352728835
Control3=IDC_URL,edit,1350631552
Control4=IDC_BUTTON1,button,1342242816
[MNU:IDR_MENU]
Type=1
Class=?
Command1=ID_OPEN_MENU
Command2=ID_EXIT_MENU
Command3=ID_HELP_MENU
Command4=ID_ABOUT_MENU
CommandCount=4
[CLS:OpenFile]
Type=0
HeaderFile=OpenFile.h
ImplementationFile=OpenFile.cpp
BaseClass=CFileDialog
Filter=D
[CLS:COpenFile]
Type=0
HeaderFile=OpenFile.h
ImplementationFile=OpenFile.cpp
BaseClass=CFileDialog
Filter=D
[CLS:CFileOpen]
Type=0
HeaderFile=FileOpen.h
ImplementationFile=FileOpen.cpp
BaseClass=CFileDialog
Filter=D

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

@ -0,0 +1,74 @@
// mailtest.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "mailtest.h"
#include "mailtestDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMailtestApp
BEGIN_MESSAGE_MAP(CMailtestApp, CWinApp)
//{{AFX_MSG_MAP(CMailtestApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMailtestApp construction
CMailtestApp::CMailtestApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CMailtestApp object
CMailtestApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CMailtestApp initialization
BOOL CMailtestApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CMailtestDlg dlg;
m_pMainWnd = &dlg;
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
// dismissed with OK
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
// dismissed with Cancel
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}

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

@ -0,0 +1,153 @@
# Microsoft Developer Studio Project File - Name="mailtest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=mailtest - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "mailtest.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "mailtest.mak" CFG="mailtest - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mailtest - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "mailtest - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "mailtest - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Win32.obj"
# PROP Intermediate_Dir "Win32.obj"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\include" /I "..\..\..\dist\win32_d.obj\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "mailtest - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x86Dbg"
# PROP Intermediate_Dir "x86Dbg"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\..\include" /I "..\..\..\..\dist\win32_d.obj\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 mime.lib netlib.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\dist\win32_d.obj\lib"
!ENDIF
# Begin Target
# Name "mailtest - Win32 Release"
# Name "mailtest - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\mailtest.cpp
# End Source File
# Begin Source File
SOURCE=.\mailtest.rc
!IF "$(CFG)" == "mailtest - Win32 Release"
!ELSEIF "$(CFG)" == "mailtest - Win32 Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\mailtestDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\mailtest.h
# End Source File
# Begin Source File
SOURCE=.\mailtestDlg.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\mailtest.ico
# End Source File
# Begin Source File
SOURCE=.\res\mailtest.rc2
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project

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

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "mailtest"=.\mailtest.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

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

@ -0,0 +1,49 @@
// mailtest.h : main header file for the MAILTEST application
//
#if !defined(AFX_MAILTEST_H__00AF81D7_7405_11D2_B323_0020AF70F393__INCLUDED_)
#define AFX_MAILTEST_H__00AF81D7_7405_11D2_B323_0020AF70F393__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CMailtestApp:
// See mailtest.cpp for the implementation of this class
//
class CMailtestApp : public CWinApp
{
public:
CMailtestApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMailtestApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CMailtestApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAILTEST_H__00AF81D7_7405_11D2_B323_0020AF70F393__INCLUDED_)

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

@ -0,0 +1,231 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif\r\n"
"#include ""res\\mailtest.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\mailtest.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 208, 47
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About Raptor Mail Test"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Raptor Mail Test Program",IDC_STATIC,39,9,119,8,
SS_NOPREFIX
LTEXT "Copyright (C) 1998",IDC_STATIC,38,19,119,8
DEFPUSHBUTTON "OK",IDOK,172,4,32,14,WS_GROUP
ICON IDR_MAINFRAME,IDC_STATIC,10,9,21,20
END
IDD_MAILTEST_DIALOG DIALOGEX 0, 0, 337, 253
STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW
CAPTION "Raptor Mail Test"
MENU IDR_MENU
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "",IDC_BROWSER_MARKER,"Static",SS_GRAYFRAME,4,80,329,169,
WS_EX_TRANSPARENT
LISTBOX IDC_HEADERS,4,4,329,59,LBS_SORT | LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_URL,56,65,218,13,ES_AUTOHSCROLL
PUSHBUTTON "Load URL",IDC_BUTTON1,4,66,49,12
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "mailtest MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "mailtest\0"
VALUE "LegalCopyright", "Copyright (C) 1998\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "mailtest.EXE\0"
VALUE "ProductName", "mailtest Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 4
RIGHTMARGIN, 204
TOPMARGIN, 4
BOTTOMMARGIN, 43
END
IDD_MAILTEST_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 4
RIGHTMARGIN, 333
TOPMARGIN, 4
BOTTOMMARGIN, 249
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MENU MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Open Mailbox...", ID_OPEN_MENU
MENUITEM SEPARATOR
MENUITEM "E&xit", ID_EXIT_MENU
END
POPUP "&Help"
BEGIN
MENUITEM "MailTest.EXE Help", ID_HELP_MENU
MENUITEM SEPARATOR
MENUITEM "&About...", ID_ABOUT_MENU
END
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_ABOUTBOX "&About Mail Test..."
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif
#include "res\mailtest.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

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

@ -0,0 +1,482 @@
// mailtestDlg.cpp : implementation file
//
#include "stdafx.h"
#include "mailtest.h"
#include "mailtestDlg.h"
#include "ExDisp.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//
// External includes necessary for test application
//
#include "net.h"
//
// Necessary variables...
//
const IID IID_IWebBrowser = {0xEAB22AC1,0x30C1,0x11CF,{0xA7,0xEB,0x00,0x00,0xC0,0x5B,0xAE,0x0B}};
static const CLSID clsidMozilla = { 0x1339B54C, 0x3453, 0x11D2, { 0x93, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMailtestDlg dialog
CMailtestDlg::CMailtestDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMailtestDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMailtestDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
// rhp stuff here
m_pWndBrowser = NULL;
}
void CMailtestDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMailtestDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMailtestDlg, CDialog)
//{{AFX_MSG_MAP(CMailtestDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_LBN_DBLCLK(IDC_HEADERS, OnDblclkHeaders)
ON_WM_CLOSE()
ON_WM_SIZE()
ON_COMMAND(ID_ABOUT_MENU, OnAbout)
ON_COMMAND(ID_HELP_MENU, OnHelp)
ON_COMMAND(ID_EXIT_MENU, OnExit)
ON_COMMAND(ID_OPEN_MENU, OnOpen)
ON_BN_CLICKED(IDC_BUTTON1, OnLoadURL)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMailtestDlg message handlers
BOOL CMailtestDlg::OnInitDialog()
{
void FixURL(char *tmpBuf);
extern NET_StreamClass *MIME_VCardConverter(int format_out, void *closure,
URL_Struct *url, MWContext *context);
extern NET_StreamClass *MIME_MessageConverter(int format_out, void *closure,
URL_Struct *url, MWContext *context);
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
// rhp Stuff here
// Create the control for the web browser
// Get the position of the browser marker
CRect rcMarker;
GetDlgItem(IDC_BROWSER_MARKER)->GetWindowRect(&rcMarker);
rcMarker.DeflateRect(2, 2);
ScreenToClient(rcMarker);
//
// Initialization code...
//
m_tempFileCount = 0;
m_pWndBrowser = new CWnd;
m_pWndBrowser->CreateControl(clsidMozilla, _T("Mail"), WS_VISIBLE, rcMarker, this, 1000);
OnHelp();
// Load the sample mailbox...
char dirName[_MAX_PATH] = "";
char url[_MAX_PATH] = "";
GetModuleFileName(GetModuleHandle(NULL), dirName, sizeof(dirName));
char *ptr = strrchr(dirName, '\\');
if (ptr) *ptr = '\0';
if (dirName[0] != '\0')
{
sprintf(url, "%s\\Mailbox", dirName);
ProcessMailbox(url);
}
//
// Network code for stream handler...
//
NET_RegisterContentTypeConverter (MESSAGE_RFC822, FO_NGLAYOUT, NULL, MIME_MessageConverter);
NET_RegisterContentTypeConverter (MESSAGE_RFC822, FO_CACHE_AND_NGLAYOUT, NULL, MIME_MessageConverter);
/* Decoders from mimehtml.c for message/rfc822 */
NET_RegisterContentTypeConverter (MESSAGE_RFC822, FO_PRINT, NULL, MIME_MessageConverter);
NET_RegisterContentTypeConverter (MESSAGE_RFC822, FO_EMBED, NULL, MIME_MessageConverter);
NET_RegisterContentTypeConverter (MESSAGE_RFC822, FO_QUOTE_MESSAGE, NULL, MIME_MessageConverter);
NET_RegisterContentTypeConverter (MESSAGE_RFC822, FO_QUOTE_HTML_MESSAGE, NULL, MIME_MessageConverter);
NET_RegisterContentTypeConverter (MESSAGE_RFC822, FO_SAVE_AS, NULL, MIME_MessageConverter);
NET_RegisterContentTypeConverter (MESSAGE_RFC822, FO_SAVE_AS_TEXT, NULL, MIME_MessageConverter);
NET_RegisterContentTypeConverter (MESSAGE_RFC822, FO_INTERNAL_IMAGE, NULL, MIME_MessageConverter);
NET_RegisterContentTypeConverter (MESSAGE_RFC822, FO_FONT, NULL, MIME_MessageConverter);
return TRUE; // return TRUE unless you set the focus to a control
}
void CMailtestDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CMailtestDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMailtestDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
//
// This is a call to load a URL (one of the temp files)
//
void CMailtestDlg::LoadURL(CString urlString)
{
UpdateData();
// If there's a browser control, use it to navigate to the specified URL
if (m_pWndBrowser)
{
IUnknown *pIUnkBrowser = m_pWndBrowser->GetControlUnknown();
if (pIUnkBrowser)
{
IWebBrowser *pIWebBrowser = NULL;
pIUnkBrowser->QueryInterface(IID_IWebBrowser, (void **) &pIWebBrowser);
if (pIWebBrowser)
{
BSTR bstrURL = urlString.AllocSysString();
pIWebBrowser->Navigate(bstrURL, NULL, NULL, NULL, NULL);
::SysFreeString(bstrURL);
pIWebBrowser->Release();
}
}
}
}
void CMailtestDlg::OnAbout()
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
void CMailtestDlg::OnExit()
{
OnClose();
}
void CMailtestDlg::OnOpen()
{
CFileDialog fileDlgOpen(TRUE, // TRUE for FileOpen, FALSE for FileSaveAs
NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "*.*||", this);
if (fileDlgOpen.DoModal() == IDOK)
{
CString url = fileDlgOpen.GetPathName();
ProcessMailbox(url);
}
delete fileDlgOpen;
}
CString
GetTempDirName(void)
{
static CString tmpDirName;
if (getenv("TEMP"))
tmpDirName = getenv("TEMP");
else if (getenv("TMP"))
tmpDirName = getenv("TMP");
return tmpDirName;
}
void
FixURL(char *tmpBuf)
{
// Translate '\' to '/'
for (uint i = 0; i < strlen(tmpBuf); i++) {
if (tmpBuf[i] == '\\') {
tmpBuf[i] = '/';
}
}
}
void CMailtestDlg::OnDblclkHeaders()
{
//
// TODO: Add your control notification handler code here
//
char msg[512] = "";
char url[512] = "";
int sel = GetDlgItem(IDC_HEADERS)->SendMessage(LB_GETCURSEL);
GetDlgItem(IDC_HEADERS)->SendMessage(LB_GETTEXT, sel, (long) msg);
if (msg[0] == '\0')
return;
CString tmpFileName;
tmpFileName.Format("file://%s/RFC822-%d.eml", GetTempDirName(), sel+1);
FixURL(tmpFileName.GetBuffer(0));
LoadURL(tmpFileName);
}
void CMailtestDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
if (m_pWndBrowser)
{
delete m_pWndBrowser;
m_pWndBrowser = NULL;
}
CleanupMailbox();
PostMessage(WM_CLOSE);
CDialog::OnClose();
}
void CMailtestDlg::CleanupMailbox()
{
int i;
CString tmpDirName = GetTempDirName() + "\\RFC822-";
CString tmpFileName;
for (i=1; i<=m_tempFileCount; i++)
{
tmpFileName.Format("%s%d.eml", tmpDirName, i);
unlink(tmpFileName.GetBuffer(0));
}
}
void CMailtestDlg::ProcessMailbox(CString mBoxName)
{
char nextLine[512];
char *compString = "From - ";
CString tmpDirName;
CString tmpFileName;
CString subjectLine = "Subject";
CStdioFile mboxFile(mBoxName, CFile::modeRead | CFile::typeText );
CStdioFile newMailFile;
// Make sure the file opened...
if (!mboxFile)
return;
// CMailtestApp::DoMessageBox("Unable to locate the systems TEMP directory.", MB_OK | MB_APPLMODAL | MB_ICONEXCLAMATION, NULL);
// Clear out the inbox
GetDlgItem(IDC_HEADERS)->SendMessage(LB_RESETCONTENT, 0, 0);
CleanupMailbox();
m_tempFileCount = 0;
tmpDirName = GetTempDirName() + "\\RFC822-";
while (mboxFile.ReadString( nextLine, sizeof(nextLine) ) != NULL)
{
// If this is true...new message!
if (strncmp(nextLine, compString, strlen(compString)) == 0)
{
if (newMailFile.m_pStream)
newMailFile.Close();
if (m_tempFileCount != 0)
GetDlgItem(IDC_HEADERS)->SendMessage(LB_INSERTSTRING, (m_tempFileCount-1), (long) subjectLine.GetBuffer(0));
++m_tempFileCount;
tmpFileName.Format("%s%d.eml", tmpDirName, m_tempFileCount);
newMailFile.Open(tmpFileName, CFile::modeCreate | CFile::modeWrite | CFile::typeText );
if (!newMailFile.m_pStream)
break;
continue;
}
// If we are here, just check for a subject and output the line
if (strncmp(nextLine, "Subject: ", 9) == 0)
{
subjectLine = nextLine + 9;
subjectLine.TrimRight();
}
newMailFile.WriteString(nextLine);
}
if (newMailFile.m_pStream)
{
GetDlgItem(IDC_HEADERS)->SendMessage(LB_INSERTSTRING, (m_tempFileCount-1), (long) subjectLine.GetBuffer(0));
newMailFile.Close();
}
mboxFile.Close();
}
void CMailtestDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
if (m_pWndBrowser)
{
CRect rcMarker;
m_pWndBrowser->GetWindowRect(&rcMarker);
ScreenToClient(rcMarker);
m_pWndBrowser->MoveWindow( rcMarker.TopLeft().x, rcMarker.TopLeft().y,
cx-16, cy-rcMarker.TopLeft().y - 8, TRUE);
GetDlgItem(IDC_BROWSER_MARKER)->MoveWindow(rcMarker.TopLeft().x,
rcMarker.TopLeft().y, cx-16, cy-rcMarker.TopLeft().y - 8, TRUE );
GetDlgItem(IDC_HEADERS)->GetWindowRect(&rcMarker);
ScreenToClient(rcMarker);
GetDlgItem(IDC_HEADERS)->MoveWindow(rcMarker.TopLeft().x,
rcMarker.TopLeft().y, cx-16, rcMarker.Height());
}
}
void
CMailtestDlg::OnHelp(void)
{
char dirName[_MAX_PATH] = "";
char url[_MAX_PATH] = "";
GetModuleFileName(GetModuleHandle(NULL), dirName, sizeof(dirName));
char *ptr = strrchr(dirName, '\\');
if (ptr) *ptr = '\0';
if (dirName[0] == '\0')
LoadURL("http://messenger.netscape.com/bookmark/4_5/messengerstart.html");
else
{
sprintf(url, "file://%s\\about.html", dirName);
FixURL(url);
LoadURL(url);
}
}
void CMailtestDlg::OnLoadURL()
{
char url[256] = "";
// TODO: Add your control notification handler code here
GetDlgItemText( IDC_URL , url, sizeof(url));
if (url[0] != '\0')
LoadURL(url);
}

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

@ -0,0 +1,70 @@
// mailtestDlg.h : header file
//
#if !defined(AFX_MAILTESTDLG_H__00AF81D9_7405_11D2_B323_0020AF70F393__INCLUDED_)
#define AFX_MAILTESTDLG_H__00AF81D9_7405_11D2_B323_0020AF70F393__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
/////////////////////////////////////////////////////////////////////////////
// CMailtestDlg dialog
class CMailtestDlg : public CDialog
{
// Construction
public:
CWnd *m_pWndBrowser;
int m_tempFileCount;
CString m_tmpDirectory;
CFile m_tmpFilePointer;
// Standard methods
CMailtestDlg(CWnd* pParent = NULL); // standard constructor
// My custom Various methods
void LoadURL(CString urlString);
void CleanupMailbox();
void ProcessMailbox(CString mBoxName);
// Dialog Data
//{{AFX_DATA(CMailtestDlg)
enum { IDD = IDD_MAILTEST_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMailtestDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
afx_msg void OnAbout();
afx_msg void OnHelp();
afx_msg void OnExit();
afx_msg void OnOpen();
// Generated message map functions
//{{AFX_MSG(CMailtestDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnDblclkHeaders();
afx_msg void OnClose();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnLoadURL();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAILTESTDLG_H__00AF81D9_7405_11D2_B323_0020AF70F393__INCLUDED_)

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

@ -0,0 +1,29 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by mailtest.rc
//
#define IDM_ABOUTBOX 0x0010
#define IDD_ABOUTBOX 100
#define IDS_ABOUTBOX 101
#define IDD_MAILTEST_DIALOG 102
#define IDR_MAINFRAME 128
#define IDR_MENU 129
#define IDC_BROWSER_MARKER 1000
#define IDC_HEADERS 1001
#define IDC_URL 1002
#define IDC_BUTTON1 1003
#define ID_ABOUT_MENU 32772
#define ID_EXIT_MENU 32773
#define ID_OPEN_MENU 32774
#define ID_HELP_MENU 32775
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_COMMAND_VALUE 32776
#define _APS_NEXT_CONTROL_VALUE 1004
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif