This commit is contained in:
prasad%netscape.com 1998-08-24 21:07:59 +00:00
Родитель ee5c5bf0ed
Коммит 0e893f7bd5
61 изменённых файлов: 7056 добавлений и 0 удалений

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

@ -0,0 +1,169 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
/* This example demonstrates use of MIME C-API to create a message w/ external-body
* content-subtype.
*/
#include <stdio.h>
#include <sys/types.h>
#ifdef XP_UNIX
#include <unistd.h>
#endif
#include <string.h>
#include "mime.h"
#include "nsStream.h"
#define outmsg(x) (fprintf(stderr,"%s:%d>%s\n",__FILE__,__LINE__,x))
#ifdef XP_UNIX
#define TMPDIR "/tmp/"
#else
#define TMPDIR "C:\\Temp\\"
#endif
BOOLEAN fStrEqual (char *s1, char *s2)
{
static char achBuffer[64];
int len;
if ( s1 != NULL && s2 != NULL )
{
len = strlen( s2 );
strncpy( achBuffer, s1, len );
achBuffer[len] = 0;
#ifdef XP_UNIX
if (strcasecmp (achBuffer, s2) == 0)
return TRUE;
#else
if ( stricmp( achBuffer, s2 ) == 0 )
return TRUE;
#endif
}
return FALSE;
}
main (int argc, char *argv[])
{
char filename [1024];
mime_message_t *pMsg = NULL, *pInnerMsg = NULL;
mime_messagePart_t *pMsgPart = NULL;
nsmail_outputstream_t *pOS;
nsmail_inputstream_t *pInput_stream;
mime_header_t * pRFC822_hdrs, * pHdr, *pTmpHdr;
int ret;
/*ret = mime_message_create (pTextBuf, NULL, &pMsg); */
/*ret = mime_message_create (NULL, argv[1], &pMsg);*/
/*ret = mime_message_create (pTextBuf, argv[1], enc, &pMsg);*/
/*create a new messagePart */
pMsgPart = (mime_messagePart_t *) mime_malloc (sizeof (mime_messagePart_t));
memset (pMsgPart, 0, sizeof (mime_messagePart_t));
pMsgPart->content_type = MIME_CONTENT_MESSAGEPART;
pMsgPart->content_subtype = (char *) mime_malloc (14);
sprintf (pMsgPart->content_subtype, "%s", "external-body");
pMsgPart->content_type_params = (char *) mime_malloc (80);
sprintf (pMsgPart->content_type_params, "%s", "access-type=local-file;name=\"e:\\share\\jpeg1.jpg\"");
/* set external-body headers */
pTmpHdr = mime_header_new ("Content-Type", "image/jpg");
pMsgPart->extern_headers = pTmpHdr;
/* create an empty (Outer) message */
pMsg = (mime_message_t *) mime_malloc (sizeof (mime_message_t));
memset (pMsg, 0, sizeof (mime_message_t));
/* Add MsgPart above to the message */
ret = mime_message_addMessagePart (pMsg, pMsgPart, FALSE);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_message_addMessagePart() failed! Err= %d\n", ret);
exit (1);
}
outmsg("building RFC822 headers");
pTmpHdr = mime_header_new ("From", "prasad@netscape.com");
pRFC822_hdrs = pTmpHdr;
pHdr = pRFC822_hdrs;
pTmpHdr = mime_header_new ("To", "prasad@netscape.com");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
pTmpHdr = mime_header_new ("Subject", "Hello This is a C Test");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
pTmpHdr = mime_header_new ("X-Msg-SDK-HDR", "X-Test-Value1");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
outmsg("adding RFC822 headers to message");
pMsg->rfc822_headers = pRFC822_hdrs;
sprintf (filename, "%s%s", TMPDIR, "sdkCEnc.out");
outmsg(filename);
ret = file_outputStream_create (filename, &pOS);
if (ret != MIME_OK)
{
fprintf (stderr, "file_outputStream_create() failed! Err= %d\n", ret);
exit (1);
}
outmsg(" Invoking mime_message_putByteStream (pMsg, pOS)");
ret = mime_message_putByteStream (pMsg, pOS);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_message_putByteStream() failed! Err= %d\n", ret);
exit (1);
}
/* close and free up the input and output streams */
pOS->close (pOS->rock);
nsStream_free (pOS);
/* free up the message itself */
mime_message_free_all (pMsg);
pMsg = NULL;
/* NOTE: mime_message_free_all() frees all its constituent parts (recursively as needed) */
pMsgPart = NULL;
return 0;
}

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

@ -0,0 +1,343 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
/* This example demonstrates use of MIME C-API to create message with multi-parts
* and message-parts and nesting of parts.
*
* This program creates a multi-part message that contains a message-part and a text part.
* The message-part itself contains a multi-part message.
*/
#include <stdio.h>
#include <sys/types.h>
#ifdef XP_UNIX
#include <unistd.h>
#endif
#include <string.h>
#include "mime.h"
#include "nsStream.h"
#define outmsg(x) (fprintf(stderr,"%s:%d>%s\n",__FILE__,__LINE__,x))
#ifdef XP_UNIX
#define TMPDIR "/tmp/"
#else
#define TMPDIR "C:\\Temp\\"
#endif
static char * getFileExtn (char * fileName)
{
char * pCh;
int i, len;
if (fileName != NULL)
{
len = strlen (fileName);
if (len <= 2)
return NULL;
pCh = fileName + len;
for (i = len -1; i > (len - 6); i--)
{
if (fileName [i] == '.')
{
return strdup (pCh);
}
pCh--;
}
}
return NULL;
}
BOOLEAN fStrEqual (char *s1, char *s2)
{
static char achBuffer[64];
int len;
if ( s1 != NULL && s2 != NULL )
{
len = strlen( s2 );
strncpy( achBuffer, s1, len );
achBuffer[len] = 0;
#ifdef XP_UNIX
if (strcasecmp (achBuffer, s2) == 0)
return TRUE;
#else
if ( stricmp( achBuffer, s2 ) == 0 )
return TRUE;
#endif
}
return FALSE;
}
main (int argc, char *argv[])
{
char filename [1024];
file_mime_type fmt;
char *pTextBuf, *pEnc, * extn = NULL;
mime_message_t *pMsg = NULL, *pInnerMsg = NULL;
mime_messagePart_t *pMsgPart = NULL;
mime_multiPart_t *pMultiPart = NULL;
mime_basicPart_t *pFilePart = NULL;
nsmail_outputstream_t *pOS;
nsmail_inputstream_t *pInput_stream;
mime_encoding_type enc = 0;
mime_header_t * pRFC822_hdrs, * pHdr, *pTmpHdr;
int ret, part_index;
if (argc < 2)
{
fprintf (stderr, "Usage: %s <filename> [encoding]\n", argv[0]);
exit (1);
}
if (argc > 2)
{
pEnc = argv[2];
if (fStrEqual (pEnc, "B"))
{
enc = MIME_ENCODING_BASE64;
}
else if (fStrEqual (pEnc, "Q"))
{
enc = MIME_ENCODING_QP;
}
}
fprintf (stderr, "FileName = %s\n", argv[1]);
/*ret = mime_message_create (pTextBuf, NULL, &pMsg); */
/*ret = mime_message_create (NULL, argv[1], &pMsg);*/
/*ret = mime_message_create (pTextBuf, argv[1], enc, &pMsg);*/
pTextBuf = (char *) mime_malloc (80);
sprintf (pTextBuf, "Hello this is a simple text");
/* create a new (multi-part) message with the above text and specified file */
ret = mime_message_create (pTextBuf, argv[1], enc, &pInnerMsg);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_message_create() on Inner Msg failed! Err= %d\n", ret);
exit (1);
}
else
{
/* not needed anymore */
mime_memfree (pTextBuf);
pTextBuf = NULL;
}
/* Add headers to the inner message */
pTmpHdr = mime_header_new ("From", "prasad@mcom.com");
pRFC822_hdrs = pTmpHdr;
pHdr = pRFC822_hdrs;
pTmpHdr = mime_header_new ("To", "prasad@mcom.com");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
pTmpHdr = mime_header_new ("Subject", "This is the Inner Message");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
pInnerMsg->rfc822_headers = pRFC822_hdrs;
/* create a messagePart from above message */
ret = mime_messagePart_fromMessage (pInnerMsg, &pMsgPart);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_messagePart_fromMessage() on Inner Msg failed! Err= %d\n", ret);
exit (1);
}
#if (0)
/* alternatively you could also create a messagePart from a message as follows */
/*create a new messagePart */
pMsgPart = (mime_messagePart_t *) mime_malloc (sizeof (mime_messagePart_t));
memset (pMsgPart, 0, sizeof (mime_messagePart_t));
pMsgPart->content_type = MIME_CONTENT_MESSAGEPART;
ret = mime_messagePart_setMessage (pMsgPart, pInnerMsg);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_messagePart_setMessage() on Inner Msg failed! Err= %d\n", ret);
exit (1);
}
#endif
/* create a multi-part */
pMultiPart = (mime_multiPart_t *) mime_malloc (sizeof (mime_multiPart_t));
memset (pMultiPart, 0, sizeof (mime_multiPart_t));
pMsgPart->content_type = MIME_CONTENT_MULTIPART;
pMultiPart->content_subtype = strdup ("mixed");
/* add the messagePart above to the multi-part */
ret = mime_multiPart_addMessagePart (pMultiPart, pMsgPart, FALSE, &part_index);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_multiPart_addMessagePar() failed! Err= %d\n", ret);
exit (1);
}
else
{
fprintf (stderr, "mime_multiPart_addMessagePar() added at index %d\n", part_index);
}
/* create the file part */
pFilePart = (mime_basicPart_t *) mime_malloc (sizeof (mime_basicPart_t));
memset (pFilePart, 0, sizeof (mime_basicPart_t));
extn = getFileExtn (argv[1]);
ret = getFileMIMEType (extn, &fmt);
if (ret != MIME_OK)
{
fprintf (stderr, "getFileMIMEType() failed! Err= %d\n", ret);
exit (1);
}
/* set content-type etc. */
pFilePart->content_type = fmt.content_type;
pFilePart->content_subtype = fmt.content_subtype;
pFilePart->content_type_params = fmt.content_params;
pFilePart->encoding_type = fmt.mime_encoding;
/* create an input stream to the file to be added */
ret = file_inputStream_create (argv[1], &pInput_stream);
if (ret != MIME_OK)
{
fprintf (stderr, "file_inputStream_create() failed! Err= %d\n", ret);
exit (1);
}
/* Set the stream as body-data of the file-part */
ret = mime_basicPart_setDataStream (pFilePart, pInput_stream, TRUE);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_basicPart_setDataStream() failed! Err= %d\n", ret);
exit (1);
}
/* add the basicPart above to the multi-part */
ret = mime_multiPart_addBasicPart (pMultiPart, pFilePart, FALSE, &part_index);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_multiPart_addBasicPart() failed! Err= %d\n", ret);
exit (1);
}
else
{
fprintf (stderr, "mime_multiPart_addBasicPart() added at index %d\n", part_index);
}
/* create an empty (Outer) message */
pMsg = (mime_message_t *) mime_malloc (sizeof (mime_message_t));
memset (pMsg, 0, sizeof (mime_message_t));
/* Add multi-Part above to the message */
ret = mime_message_addMultiPart (pMsg, pMultiPart, FALSE);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_message_addMultiPart() failed! Err= %d\n", ret);
exit (1);
}
outmsg("building RFC822 headers");
pTmpHdr = mime_header_new ("From", "prasad@netscape.com");
pRFC822_hdrs = pTmpHdr;
pHdr = pRFC822_hdrs;
pTmpHdr = mime_header_new ("To", "prasad@netscape.com");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
pTmpHdr = mime_header_new ("Subject", "Hello This is a C Test");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
pTmpHdr = mime_header_new ("X-Msg-SDK-HDR", "X-Test-Value1");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
outmsg("adding RFC822 headers to message");
pMsg->rfc822_headers = pRFC822_hdrs;
sprintf (filename, "%s%s", TMPDIR, "sdkCEnc.out");
outmsg(filename);
file_outputStream_create (filename, &pOS);
outmsg(" Invoking mime_message_putByteStream (pMsg, pOS)");
ret = mime_message_putByteStream (pMsg, pOS);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_message_putByteStream() failed! Err= %d\n", ret);
exit (1);
}
/* close and free up the input and output streams */
pOS->close (pOS->rock);
nsStream_free (pOS);
pInput_stream->close (pInput_stream->rock);
nsStream_free (pInput_stream);
/* free up the message itself */
mime_message_free_all (pMsg);
pMsg = NULL;
/* NOTE: mime_message_free_all() frees all its constituent parts (recursively as needed) */
pMsgPart = NULL;
pMultiPart = NULL;
pInnerMsg = NULL;
return 0;
}

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

@ -0,0 +1,185 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
/* This example demonstrates the use of the MIME C-API.
* Demonstrates building a MIME message from a text
* buffer and a file and MIME encoding the same.
* This covers the most common usage path of user typing
* some text and attaching an attachment.
*
* Since either of the textBuf and the file attachment need
* also not be present this example covers the cases of simple
* text message or an attachment only message also
*/
#include <stdio.h>
#include <sys/types.h>
#ifdef XP_UNIX
#include <unistd.h>
#endif
#include <string.h>
#include "mime.h"
#include "nsStream.h"
#define outmsg(x) (fprintf(stderr,"%s:%d>%s\n",__FILE__,__LINE__,x))
#ifdef XP_UNIX
#define TMPDIR "/tmp/"
#else
#define TMPDIR "C:\\temp\\"
#endif
BOOLEAN fStrEqual (char *s1, char *s2)
{
static char achBuffer[64];
int len;
if ( s1 != NULL && s2 != NULL )
{
len = strlen( s2 );
strncpy( achBuffer, s1, len );
achBuffer[len] = 0;
#ifdef XP_UNIX
if (strcasecmp (achBuffer, s2) == 0)
return TRUE;
#else
if ( stricmp( achBuffer, s2 ) == 0 )
return TRUE;
#endif
}
return FALSE;
}
void main (int argc, char *argv[])
{
int ret;
char *pTextBuf, *pEnc;
char filename [1024];
mime_message_t * pMsg = NULL;
mime_encoding_type enc = 0;
nsmail_outputstream_t *pOS;
mime_header_t * pRFC822_hdrs, * pHdr, *pTmpHdr;
if (argc < 2)
{
fprintf (stderr, "Usage: %s <filename> [encoding]\n", argv[0]);
exit (1);
}
if (argc >= 2)
{
pEnc = argv[2];
if (fStrEqual (pEnc, "B"))
{
enc = MIME_ENCODING_BASE64;
}
else if (fStrEqual (pEnc, "Q"))
{
enc = MIME_ENCODING_QP;
}
}
fprintf (stderr, "FileName = %s\n", argv[1]);
pTextBuf = (char *) mime_malloc (80);
sprintf (pTextBuf, "Hello this is a test Message");
/*ret = mime_message_create (pTextBuf, NULL, &pMsg); */
/*ret = mime_message_create (NULL, argv[1], &pMsg); */
ret = mime_message_create (pTextBuf, argv[1], enc, &pMsg);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_message_create() failed! Err= %d\n", ret);
exit (1);
}
else
{
/* not needed anymore */
mime_memfree (pTextBuf);
pTextBuf = NULL;
}
outmsg("building RFC822 headers");
pTmpHdr = mime_header_new ("From", "prasad@netscape.com");
pRFC822_hdrs = pTmpHdr;
pHdr = pRFC822_hdrs;
pTmpHdr = mime_header_new ("To", "prasad@netscape.com");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
pTmpHdr = mime_header_new ("Subject", "Hello This is a C Test");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
pTmpHdr = mime_header_new ("X-Msg-SDK-HDR", "X-Test-Value1");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
outmsg("adding RFC822 headers to message");
pMsg->rfc822_headers = pRFC822_hdrs;
/* prepare to write out the encoded message */
sprintf (filename, "%s%s", TMPDIR, "sdkCEnc.out");
outmsg(filename);
ret = file_outputStream_create (filename, &pOS);
if (ret != MIME_OK)
{
fprintf (stderr, "file_outputStream_create() failed! Err= %d\n", ret);
exit (1);
}
outmsg(" Invoking mime_message_putByteStream (pMsg, pOS)");
ret = mime_message_putByteStream (pMsg, pOS);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_message_putByteStream() failed! Err= %d\n", ret);
exit (1);
}
/* close and free up the input and output streams */
pOS->close (pOS->rock);
nsStream_free (pOS);
/* free up the message itself */
mime_message_free_all (pMsg);
pMsg = NULL;
/* NOTE: mime_message_free_all() frees all its constituent parts */
}

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

@ -0,0 +1,365 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
/* This example demonstrates the use of the MIME C-API.
* Demonstrates parsing a MIME message from a file and
* walking through various parts of the returned (parsed)
* message.
*/
#include "stdio.h"
#include "nsmail.h"
#include "nsStream.h"
#include "mime.h"
#include "mimeparser.h"
mime_message_t *pMessage;
char infilename [512];
char outfilename [512];
mime_message_t *pTopMessage;
#ifdef XP_UNIX
#define SEP "/"
#define BASICPART_FILE "/tmp/bodypart.out"
#define BASICPART_BYTESTREAM "/tmp/basicpart.bstream"
#else
#define SEP "\\"
#define BASICPART_FILE "C:\\Temp\\bodypart.out"
#define BASICPART_BYTESTREAM "C:\\temp\\basicpart.bstream"
#endif
/* forward declaration */
void walkMessage (mime_message_t * pMessage);
BOOLEAN fStrEqual (char *s1, char *s2)
{
static char achBuffer[64];
int len;
if ( s1 != NULL && s2 != NULL )
{
len = strlen( s2 );
strncpy( achBuffer, s1, len );
achBuffer[len] = 0;
#ifdef XP_UNIX
if (strcasecmp (achBuffer, s2) == 0)
return TRUE;
#else
if ( stricmp( achBuffer, s2 ) == 0 )
return TRUE;
#endif
}
return FALSE;
}
void free_this_body_part (void * pBodyPart, mime_content_type contentType)
{
switch (contentType)
{
case MIME_CONTENT_TEXT:
case MIME_CONTENT_AUDIO:
case MIME_CONTENT_IMAGE:
case MIME_CONTENT_VIDEO:
case MIME_CONTENT_APPLICATION:
mime_basicPart_free_all ((mime_basicPart_t *)pBodyPart);
break;
case MIME_CONTENT_MULTIPART:
mime_multiPart_free_all ((mime_multiPart_t *)pBodyPart);
break;
case MIME_CONTENT_MESSAGEPART:
mime_messagePart_free_all ((mime_messagePart_t *)pBodyPart);
break;
}
}
void walkBodyPart (void * pBody, mime_content_type contentType)
{
BOOLEAN fBasicPart = FALSE, fMultiPart = FALSE, fMsgPart = FALSE;
mime_basicPart_t * pBasicPart;
mime_multiPart_t * pMultiPart;
mime_messagePart_t * pMessagePart;
mime_message_t * pLocalMessage;
unsigned int body_len=0;
nsmail_inputstream_t * pDataStream;
nsmail_outputstream_t * pOutStream;
char * pDataBuf, *cont_subType;
int i, ret = 0, part_count=0;
mime_content_type cType;
void * pBodyPart=NULL;
char basic_byteStream_file[1024];
static int count=0;
switch (contentType)
{
case MIME_CONTENT_TEXT:
case MIME_CONTENT_AUDIO:
case MIME_CONTENT_IMAGE:
case MIME_CONTENT_VIDEO:
case MIME_CONTENT_APPLICATION:
pBasicPart = (mime_basicPart_t *) pBody;
fBasicPart = TRUE;
break;
case MIME_CONTENT_MULTIPART:
pMultiPart = (mime_multiPart_t *) pBody;
fMultiPart = TRUE;
break;
case MIME_CONTENT_MESSAGEPART:
pMessagePart = (mime_messagePart_t *) pBody;
fMsgPart = TRUE;
break;
}
if (fBasicPart == TRUE)
{
count++;
sprintf (basic_byteStream_file, "%s%d", BASICPART_BYTESTREAM, count);
fprintf (stderr, "Creating output-stream on %s\n", basic_byteStream_file);
ret = file_outputStream_create (basic_byteStream_file, &pOutStream);
if (ret != MIME_OK)
{
fprintf (stderr, "file_outputStream_create failed! ret = %d\n", ret);
exit (1);
}
ret = mime_basicPart_putByteStream (pBasicPart, pOutStream);
/* If you want to retireve the bodydata as a stream do */
ret = mime_basicPart_getDataStream (pBasicPart, BASICPART_FILE, &pDataStream);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_basicPart_getDataStream failed! ret = %d\n", ret);
exit (1);
}
else
{
/* Do what ever you want with the bodydata. When done, free up things */
pDataStream->close (pDataStream->rock); /* close the stream */
nsStream_free (pDataStream);
pDataStream = NULL;
}
/* Or If you to retireve the bodydata in a buffer do */
ret = mime_basicPart_getDataBuf (pBasicPart, &body_len, &pDataBuf);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_basicPart_getDataBuf failed! ret = %d\n", ret);
exit (1);
}
else
{
/* Do what ever you want with the bodydata. When done, free up things */
mime_memfree (pDataBuf);
pDataBuf = NULL;
}
/* When done with the basicPart itself, free it also */
mime_basicPart_free_all (pBasicPart);
pBasicPart = NULL;
}
else if (fMultiPart == TRUE)
{
ret = mime_multiPart_getPartCount (pMultiPart, &part_count);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_multiPart_getPartCount failed! ret = %d\n", ret);
exit (1);
}
for (i = 1; i <= part_count; i++)
{
ret = mime_multiPart_getPart (pMultiPart, i, &cType, &pBodyPart);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_multiPart_getPartCount failed! ret = %d\n", ret);
exit (1);
}
walkBodyPart (pBodyPart, cType);
/* Free the part when done */
free_this_body_part (pBodyPart, cType);
pBodyPart = NULL;
}
/* free the multi-part */
mime_multiPart_free_all (pMultiPart);
pMultiPart = NULL;
}
else if (fMsgPart == TRUE)
{
cont_subType = pMessagePart->content_subtype;
if (fStrEqual (cont_subType, "rfc822"))
{
/* get the message that is the body of this message-part */
ret = mime_messagePart_getMessage (pMessagePart, &pLocalMessage);
walkMessage (pLocalMessage);
/* free up the message and messagePart when done */
mime_message_free_all (pLocalMessage);
pLocalMessage = NULL;
}
/* handle other sub-types as needed */
/* free the message-part when done */
mime_messagePart_free_all (pMessagePart);
pMessagePart = NULL;
}
}
void walkMessage (mime_message_t * pMessage)
{
int ret = 0;
void * pBody;
mime_header_t * pRFC822_hdrs;
mime_content_type contentType;
/* walk through the headers as needed */
pRFC822_hdrs = pMessage->rfc822_headers;
/* Now simply walk through the list of headers */
/* walk through the Body of the message */
ret = mime_message_getBody (pMessage, &contentType, &pBody);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_message_getBody failed! ret = %d\n", ret);
exit (1);
}
walkBodyPart (pBody, contentType);
/* free the body-part */
free_this_body_part (pBody, contentType);
pBody = NULL;
}
void parseEntireFile (char *path,
char *filename)
{
int ret;
nsmail_inputstream_t *pInStream;
nsmail_outputstream_t *pOutStream;
sprintf (infilename, "%s%s%s", path, SEP, filename);
fprintf (stderr, "input filename=%s\n", infilename);
ret = file_inputStream_create (infilename, &pInStream);
if (ret != MIME_OK)
{
fprintf (stderr, "file_inputStream_create() failed! rc = %d\n", ret);
exit (1);
}
ret = parseEntireMessageInputstream (pInStream, &pTopMessage);
if (ret != MIME_OK)
{
fprintf (stderr, "parseEntireMessage() failed! rc = %d\n", ret);
exit (1);
}
else
{
fprintf (stderr, "parseEntireMessage() SUCCESSFUL!!\n");
sprintf (outfilename, "%s%s%s%s", path, SEP, filename,".out");
fprintf (stderr, "%s\n", outfilename);
ret = file_outputStream_create (outfilename, &pOutStream);
if (ret != MIME_OK)
{
fprintf (stderr, "file_outputStream_create() failed! rc = %d\n", ret);
exit (1);
}
else
{
/* encoding it back */
ret = mime_message_putByteStream (pTopMessage, pOutStream);
if (ret != MIME_OK)
{
fprintf (stderr, "mime_message_putByteStream() failed! rc = %d\n", ret);
exit (1);
}
else
{
fprintf (stderr, "mime_message_putByteStream() SUCCESSFUL!!\n");
/* close and free the streams */
pOutStream->close (pOutStream->rock);
nsStream_free (pOutStream);
pOutStream = NULL;
pInStream->close (pInStream->rock);
nsStream_free (pInStream);
pInStream = NULL;
}
}
}
}
/*
* This example program parses a MIME message in a file and walks through different
* parts of the parsed message.
*
* Input Parameters: Path-name and file-name of the file with MIME message to be parsed.
*
*/
int main (int argc, char *argv[])
{
int ret = 0;
if (argc < 3)
{
fprintf (stderr, "Usage: %s <path> <filename>\n", argv[0]);
#ifdef XP_UNIX
fprintf (stderr, "example: %s /tmp/TestCases_MIME/Messages mime1.txt\n", argv[0]);
#else
fprintf (stderr, "example: %s e:\\share\\MIME_Test\\Messages mime1.txt\n", argv[0]);
#endif
exit (1);
}
/* parse the message */
parseEntireFile (argv[1], argv[2]);
/* Walk through the parsed message and retrieve the needed parts */
walkMessage (pTopMessage);
/* free up the message and all its constituent parts */
mime_message_free_all (pTopMessage);
pTopMessage = NULL;
}

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

@ -0,0 +1,171 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
#ifndef POP3_H
#define POP3_H
/*
* pop3.h
* @author derekt@netscape.com
* @version 1.0
*/
#include "nsmail.h"
#include <stdio.h>
/* Structure used by a client to communicate to a POP3 server. */
typedef struct pop3Client pop3Client_t;
/* Forward declaration of the POP3 notification sink. */
typedef struct pop3Sink * pop3SinkPtr_t;
/* Definition of the POP3 notification sink. */
typedef struct pop3Sink
{
/* User data. */
void * pOpaqueData;
/* Notification for the response to the connection to the server. */
void (*connect)( pop3SinkPtr_t in_pPOP3Sink, const char * in_responseMessage );
/* Notification for the response to the DELE command. */
void (*dele)( pop3SinkPtr_t in_pPOP3Sink, const char * in_responseMessage );
/* Notification for an error. */
void (*error)( pop3SinkPtr_t in_pPOP3Sink, const char * in_responseMessage );
/* Notification for the start of the LIST command. */
void (*listStart)( pop3SinkPtr_t in_pPOP3Sink );
/* Notification for the response to the LIST command. */
void (*list)( pop3SinkPtr_t in_pPOP3Sink, int in_messageNumber, int in_octetCount );
/* Notification for the completion of the LIST command. */
void (*listComplete)( pop3SinkPtr_t in_pPOP3Sink );
/* Notification for the response to the NOOP command. */
void (*noop)( pop3SinkPtr_t in_pPOP3Sink );
/* Notification for the response to the PASS command. */
void (*pass)(pop3SinkPtr_t in_pPOP3Sink, const char * in_responseMessage );
/* Notification for the response to the QUIT command. */
void (*quit)(pop3SinkPtr_t in_pPOP3Sink, const char * in_responseMessage );
/* Notification for the response to the RSET command. */
void (*reset)(pop3SinkPtr_t in_pPOP3Sink, const char * in_responseMessage );
/* Notification for the start of the RETR command. */
void (*retrieveStart)( pop3SinkPtr_t in_pPOP3Sink, int in_messageNumber, int in_octetCount );
/* Notification for the response to the RETR command. */
void (*retrieve)( pop3SinkPtr_t in_pPOP3Sink, const char * in_messageChunk );
/* Notification for the completion of the RETR command. */
void (*retrieveComplete)( pop3SinkPtr_t in_pPOP3Sink );
/* Notification for the start of an extended command. */
void (*sendCommandStart)( pop3SinkPtr_t in_pPOP3Sink );
/* Notification for the response of an extended command. */
void (*sendCommand)( pop3SinkPtr_t in_pPOP3Sink, const char * in_responseMessage );
/* Notification for the completion of and extended command. */
void (*sendCommandComplete)( pop3SinkPtr_t in_pPOP3Sink );
/* Notification for the response to the STAT command. */
void (*stat)( pop3SinkPtr_t in_pPOP3Sink, int in_messageCount, int in_octetCount );
/* Notification for the start of the TOP command. */
void (*topStart)( pop3SinkPtr_t in_pPOP3Sink, int in_messageNumber );
/* Notification for the response to the TOP command. */
void (*top)( pop3SinkPtr_t in_pPOP3Sink, const char * in_responseLine );
/* Notification for the completion of the TOP command. */
void (*topComplete)( pop3SinkPtr_t in_pPOP3Sink );
/* Notification for the start of the UIDL command. */
void (*uidListStart)( pop3SinkPtr_t in_pPOP3Sink );
/* Notification for the response to the UIDL command. */
void (*uidList)( pop3SinkPtr_t in_pPOP3Sink, int in_messageNumber, const char * in_uid );
/* Notification for the completion of the UIDL command. */
void (*uidListComplete)( pop3SinkPtr_t in_pPOP3Sink );
/* Notification for the response to the USER command. */
void (*user)( pop3SinkPtr_t in_pPOP3Sink, const char * in_responseMessage );
/* Notification for the start of the XAUTHLIST command. */
void (*xAuthListStart)( pop3SinkPtr_t in_pPOP3Sink );
/* Notification for the response to the XAUTHLIST command. */
void (*xAuthList)( pop3SinkPtr_t in_pPOP3Sink, int in_messageNumber, const char * in_responseMessage );
/* Notification for the completion of the XAUTHLIST command. */
void (*xAuthListComplete)( pop3SinkPtr_t in_pPOP3Sink );
/* Notification for the response to the XSENDER command. */
void (*xSender)( pop3SinkPtr_t in_pPOP3Sink, const char * in_emailAddress );
} pop3Sink_t;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Initializes and allocates the pop3Client_t structure and sets the sink. */
int pop3_initialize( pop3Client_t ** out_ppPOP3, pop3SinkPtr_t in_pPOP3Sink );
/* Initializes and allocates the pop3Sink_t structure. */
int pop3Sink_initialize( pop3Sink_t ** out_ppPOP3Sink );
/* Function used to free the pop3Client_t structure and it's data members. */
void pop3_free( pop3Client_t ** in_ppPOP3 );
/* Function used to free the pop3Sink_t structure. */
void pop3Sink_free( pop3Sink_t ** in_ppPOP3Sink );
/* Function used to close the socket connection. */
int pop3_disconnect( pop3Client_t * in_pPOP3 );
/* Protocol commands. */
int pop3_connect( pop3Client_t * in_pPOP3, const char * in_server, unsigned short in_port );
int pop3_delete( pop3Client_t * in_pPOP3, int in_messageNumber );
int pop3_list( pop3Client_t * in_pPOP3 );
int pop3_listA( pop3Client_t * in_pPOP3, int in_messageNumber );
int pop3_noop( pop3Client_t * in_pPOP3 );
int pop3_pass( pop3Client_t * in_pPOP3, const char * in_password );
int pop3_quit( pop3Client_t * in_pPOP3 );
int pop3_reset( pop3Client_t * in_pPOP3 );
int pop3_retrieve( pop3Client_t * in_pPOP3, int in_messageNumber );
int pop3_sendCommand( pop3Client_t * in_pPOP3, const char * in_command, boolean in_multiLine );
int pop3_stat( pop3Client_t * in_pPOP3 );
int pop3_top( pop3Client_t * in_pPOP3, int in_messageNumber, int in_lines );
int pop3_uidList( pop3Client_t * in_pPOP3 );
int pop3_uidListA( pop3Client_t * in_pPOP3, int in_messageNumber );
int pop3_user( pop3Client_t * in_pPOP3, const char * in_user );
int pop3_xAuthList( pop3Client_t * in_pPOP3 );
int pop3_xAuthListA( pop3Client_t * in_pPOP3, int in_messageNumber );
int pop3_xSender( pop3Client_t * in_pPOP3, int in_messageNumber );
/*
* A function used to process the server responses for API commands.
* This function will invoke the callback functions provided by the user
* for all responses that are available at the time of execution.
*/
int pop3_processResponses( pop3Client_t * in_pPOP3 );
/* Sets the size of the message data chunk passed to the user. */
int pop3_setChunkSize( pop3Client_t * in_pPOP3, int in_chunkSize );
/* Sets a new response sink. */
int pop3_setResponseSink( pop3Client_t * in_pPOP3, pop3SinkPtr_t in_pPOP3Sink );
/* Sets the timeout used in pop3_processResponses(). */
int pop3_setTimeout( pop3Client_t * in_pPOP3, double in_timeout );
/* Function used for setting io and threading models. */
int pop3_set_option( pop3Client_t * in_pPOP3, int in_option, void * in_pOptionData );
/* Function used for getting io and threading models. */
int pop3_get_option( pop3Client_t * in_pPOP3, int in_option, void * in_pOptionData );
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* POP3_H */

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

@ -0,0 +1,203 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
#ifndef POP3PRIV_H
#define POP3PRIV_H
/*
* pop3priv.h
* @author derekt@netscape.com
* @version 1.0
*/
#include "nsmail.h"
#include "nsio.h"
#include "linklist.h"
/* Default port number. */
#define DEFAULT_POP3_PORT 110
/* Maximum definitions. */
#define MAX_DOMAIN_LENGTH 64
#define MAX_USERHNAME_LENGTH 64
#define MAX_RCPTBUFFER_LENGTH 100
#define MAX_PATH_LENGTH 256
#define MAX_COMMANDLINE_LENGTH 512
#define MAX_REPLYLINE_LENGTH 512
#define MAX_TEXTLINE_LENGTH 1000
#define MAX_BUFFER_LENGTH 1024
/* Response types for POP3. */
typedef enum pop3_ResponseType
{
CONN,
DELE,
LISTA,
LIST,
NOOP,
PASS,
QUIT,
RSET,
RETR,
SENDCOMMANDA,
SENDCOMMAND,
STAT,
TOP,
UIDLA,
UIDL,
USER,
XAUTHLISTA,
XAUTHLIST,
XSENDER
} pop3_ResponseType_t;
/* Response variables for POP3. */
const static pop3_ResponseType_t POP3Response_CONN = CONN;
const static pop3_ResponseType_t POP3Response_DELE = DELE;
const static pop3_ResponseType_t POP3Response_LISTA = LISTA;
const static pop3_ResponseType_t POP3Response_LIST = LIST;
const static pop3_ResponseType_t POP3Response_NOOP = NOOP;
const static pop3_ResponseType_t POP3Response_PASS = PASS;
const static pop3_ResponseType_t POP3Response_QUIT = QUIT;
const static pop3_ResponseType_t POP3Response_RSET = RSET;
const static pop3_ResponseType_t POP3Response_RETR = RETR;
const static pop3_ResponseType_t POP3Response_SENDCOMMANDA = SENDCOMMANDA;
const static pop3_ResponseType_t POP3Response_SENDCOMMAND = SENDCOMMAND;
const static pop3_ResponseType_t POP3Response_STAT = STAT;
const static pop3_ResponseType_t POP3Response_TOP = TOP;
const static pop3_ResponseType_t POP3Response_UIDLA = UIDLA;
const static pop3_ResponseType_t POP3Response_UIDL = UIDL;
const static pop3_ResponseType_t POP3Response_USER = USER;
const static pop3_ResponseType_t POP3Response_XAUTHLISTA = XAUTHLISTA;
const static pop3_ResponseType_t POP3Response_XAUTHLIST = XAUTHLIST;
const static pop3_ResponseType_t POP3Response_XSENDER = XSENDER;
/* Constants used in building commands. */
const static char dele[] = "DELE ";
const static char list[] = "LIST ";
const static char noop[] = "NOOP";
const static char pass[] = "PASS ";
const static char quit[] = "QUIT";
const static char rset[] = "RSET";
const static char retr[] = "RETR ";
const static char stat[] = "STAT";
const static char top[] = "TOP ";
const static char uidl[] = "UIDL ";
const static char user[] = "USER ";
const static char xauthlist[] = "XAUTHLIST ";
const static char xsender[] = "XSENDER ";
const static char space[] = " ";
const static char ok[] = "+OK";
const static char err[] = "-ERR";
/*
* Structure used by a client to communicate to a POP3 server.
* This structure stores IO_t structure which deals with
* the specifics of communication.
*/
typedef struct pop3Client
{
/* Communication structure. */
IO_t io;
/* List of command types sent to the server. */
LinkedList_t * pCommandList;
/* Flag indicating if a response must be processed. */
boolean mustProcess;
/* Flag indicating we are in the middle of a multiline response. */
boolean multiLineState;
/* Get/Set variables */
int chunkSize;
double timeout;
pop3Sink_t * pop3Sink;
/* Re-used variables */
char commandBuffer[MAX_COMMANDLINE_LENGTH];
char responseLine[MAX_TEXTLINE_LENGTH];
char * messageData;
int messageDataSize;
int messageNumber;
} pop3Client_i_t;
/* Function pointer for responses. */
typedef void (*sinkMethod_t)( pop3SinkPtr_t, const char * );
/* Internal parsing functions. */
static int setStatusInfo( const char * in_responseLine, boolean * out_status );
static int parseSingleLine( pop3Client_t *, sinkMethod_t );
static int parseConnect( pop3Client_t * in_pPOP3 );
static int parseDelete( pop3Client_t * in_pPOP3 );
static int parseListA( pop3Client_t * in_pPOP3 );
static int parseList( pop3Client_t * in_pPOP3 );
static int parseNoop( pop3Client_t * in_pPOP3 );
static int parsePass( pop3Client_t * in_pPOP3 );
static int parseQuit( pop3Client_t * in_pPOP3 );
static int parseRset( pop3Client_t * in_pPOP3 );
static int parseRetr( pop3Client_t * in_pPOP3 );
static int parseSendCommandA( pop3Client_t * in_pPOP3 );
static int parseSendCommand( pop3Client_t * in_pPOP3 );
static int parseStat( pop3Client_t * in_pPOP3 );
static int parseTop( pop3Client_t * in_pPOP3 );
static int parseUidlA( pop3Client_t * in_pPOP3 );
static int parseUidl( pop3Client_t * in_pPOP3 );
static int parseUser( pop3Client_t * in_pPOP3 );
static int parseXAuthListA( pop3Client_t * in_pPOP3 );
static int parseXAuthList( pop3Client_t * in_pPOP3 );
static int parseXSender( pop3Client_t * in_pPOP3 );
/* Internal sink functions used to check for NULL function pointers. */
static void pop3Sink_connect( pop3Sink_t *, const char * );
static void pop3Sink_delete( pop3Sink_t *, const char * );
static void pop3Sink_error( pop3Sink_t *, const char * );
static void pop3Sink_listStart( pop3Sink_t * );
static void pop3Sink_list( pop3Sink_t *, int, int );
static void pop3Sink_listComplete( pop3Sink_t * );
static void pop3Sink_noop( pop3Sink_t * );
static void pop3Sink_pass(pop3Sink_t *, const char * );
static void pop3Sink_quit(pop3Sink_t *, const char * );
static void pop3Sink_reset(pop3Sink_t *, const char * );
static void pop3Sink_retrieveStart( pop3Sink_t *, int, int );
static void pop3Sink_retrieve( pop3Sink_t *, const char * );
static void pop3Sink_retrieveComplete( pop3Sink_t * );
static void pop3Sink_sendCommandStart( pop3Sink_t * );
static void pop3Sink_sendCommand( pop3Sink_t *, const char * );
static void pop3Sink_sendCommandComplete( pop3Sink_t * );
static void pop3Sink_stat( pop3Sink_t *, int, int );
static void pop3Sink_topStart( pop3Sink_t *, int );
static void pop3Sink_top( pop3Sink_t *, const char * );
static void pop3Sink_topComplete( pop3Sink_t * );
static void pop3Sink_uidListStart( pop3Sink_t * );
static void pop3Sink_uidList( pop3Sink_t *, int, const char * );
static void pop3Sink_uidListComplete( pop3Sink_t * );
static void pop3Sink_user( pop3Sink_t *, const char * );
static void pop3Sink_xAuthListStart( pop3Sink_t * );
static void pop3Sink_xAuthList( pop3Sink_t *, int, const char * );
static void pop3Sink_xAuthListComplete( pop3Sink_t * );
static void pop3Sink_xSender( pop3Sink_t *, const char * );
#endif /* POP3_H */

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

@ -0,0 +1,76 @@
# GNU Makefile for pop3
#
MSGSDK_ROOT = ../../../../C
CONFIG_ROOT = ../../../../CONFIG
BUILD_ROOT = ../../../../C
MKDIR = mkdir -p
LIBDIR = $(OBJDIR)/lib
OBJDEST = $(LIBDIR)/libpop3
LIBNAME = libpop3
include $(CONFIG_ROOT)/msgsdk.mk
LOCAL_INCDIR = ../include
GLOBAL_INCDIR = ../../../include
CFLAGS += -I$(LOCAL_INCDIR) -I$(GLOBAL_INCDIR)
#
# Build full target library file and path
#
ifeq ($(ARCH), AIX)
LIBTARGET = $(addsuffix _shr.a, \
$(addprefix $(LIBDIR)/, $(LIBNAME)))
else
LIBTARGET = $(addsuffix .$(DLL_SUFFIX), \
$(addprefix $(LIBDIR)/, $(LIBNAME)))
endif
POP3_OBJS= pop3.o
#COMMON_OBJS= $(LIBDIR)/libcomm/nsio.o \
# $(LIBDIR)/libcomm/nssocket.o \
# $(LIBDIR)/libcomm/linklist.o
OBJS = $(addprefix $(OBJDEST)/, $(POP3_OBJS))
all: $(OBJDEST) $(LIBDIR) $(LIBTARGET)
test:
echo $(OBJDIR)
clean:
rm -rf $(OBJDEST)*
rm -rf $(OBJDEST)/*
$(LIBDIR):
echo creating $(LIBDIR)
$(MKDIR) $(LIBDIR)
$(OBJDEST):
echo creating $(OBJDEST)
$(MKDIR) $(OBJDEST)
ifeq ($(ARCH), WINNT)
$(LIBTARGET): $(OBJS)
$(PURIFY) $(LINK_DLL) /DEFAULTLIB:WSOCK32.LIB /DEFAULTLIB:$(BUILD_ROOT)/built/WINNT-domestic-full-sdk/lib/LIBCOMM.LIB /DEF:pop3.def $(OBJS)
else
ifeq ($(ARCH), AIX)
$(LIBTARGET): $(OBJS)
$(LD) -o $(LIBTARGET) $(OBJS) $(DLL_LDFLAGS) -bE:pop3.exp -L$(LIBDIR) -lcomm_shr -lc_r
else
ifeq ($(ARCH), IRIX)
$(LIBTARGET): $(OBJS)
$(LD) $(DLL_LDFLAGS) -exports_file pop3.exp -soname $(LIBNAME).so -o $(LIBTARGET) $(OBJS)
else
ifeq ($(ARCH), IRIX64)
$(LIBTARGET): $(OBJS)
$(LD) $(DLL_LDFLAGS) -exports_file pop3.exp -soname $(LIBNAME).so -o $(LIBTARGET) $(OBJS)
else
$(LIBTARGET): $(OBJS)
$(LD) $(DLL_LDFLAGS) -o $(LIBTARGET) $(OBJS)
endif
endif
endif
endif

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,32 @@
LIBRARY LIBPOP3
DESCRIPTION "POP3 Client exported functions."
EXPORTS
pop3_initialize @1
pop3_free @2
pop3_connect @4
pop3_disconnect @5
pop3_delete @6
pop3_list @7
pop3_listA @8
pop3_noop @10
pop3_pass @9
pop3_quit @11
pop3_reset @12
pop3_retrieve @13
pop3_sendCommand @15
pop3_stat @16
pop3_top @17
pop3_uidListA @18
pop3_uidList @19
pop3_user @20
pop3_xAuthListA @21
pop3_xAuthList @22
pop3_xSender @23
pop3_processResponses @24
pop3_setChunkSize @25
pop3_setResponseSink @26
pop3_setTimeout @27
pop3_set_option @28
pop3_get_option @29
pop3Sink_initialize @30
pop3Sink_free @31

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

@ -0,0 +1,29 @@
pop3_initialize
pop3_free
pop3_connect
pop3_disconnect
pop3_delete
pop3_list
pop3_listA
pop3_noop
pop3_pass
pop3_quit
pop3_reset
pop3_retrieve
pop3_sendCommand
pop3_stat
pop3_top
pop3_uidList
pop3_uidListA
pop3_user
pop3_xAuthListA
pop3_xAuthList
pop3_xSender
pop3_processResponses
pop3_setChunkSize
pop3_setResponseSink
pop3_setTimeout
pop3_set_option
pop3_get_option
pop3Sink_initialize
pop3Sink_free

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

@ -0,0 +1,358 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
/*
*@author derekt@netscape.com
*@version 1.0
*/
/* USAGE: pop3test.exe server user password */
#include "pop3.h"
#include "testsink.h"
/*Function prototype for settting sink pointers*/
void setSink( pop3Sink_t * pSink );
int main( int argc, char *argv[ ] )
{
int l_nReturn;
pop3Client_t * pClient = NULL;
pop3Sink_t * pSink = NULL;
/*Initialize the response sink.*/
l_nReturn = pop3Sink_initialize( &pSink );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*Set the function pointers on the response sink.*/
setSink( pSink );
/*Initialize the client passing in the response sink.*/
l_nReturn = pop3_initialize( &pClient, pSink );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*Connect to the POP3 server.*/
l_nReturn = pop3_connect( pClient, argv[1], 110 );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*Specify a user name.*/
l_nReturn = pop3_user( pClient, argv[2] );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*Specify a password.*/
l_nReturn = pop3_pass( pClient, argv[3] );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*Delete a message on the server.*/
l_nReturn = pop3_delete( pClient, 1 );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*Undelete any messages marked for deletion.*/
l_nReturn = pop3_reset( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*List all messages.*/
l_nReturn = pop3_list( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*List a specified message.*/
l_nReturn = pop3_listA( pClient, 1 );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*Noop operation.*/
l_nReturn = pop3_noop( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*Perform the stat command.*/
l_nReturn = pop3_stat( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*List all messages and their UIDs.*/
l_nReturn = pop3_uidList( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*List a message and its UID.*/
l_nReturn = pop3_uidListA( pClient, 1 );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*List all messages and authenticated users.*/
l_nReturn = pop3_xAuthList( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*List a message and its authenticated user.*/
l_nReturn = pop3_xAuthListA( pClient, 1 );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*Give the e-mail address.*/
l_nReturn = pop3_xSender( pClient, 1 );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*Perform the top command for header info and a specified number of lines.*/
l_nReturn = pop3_top( pClient, 1, 10 );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*Retrieve a message.*/
l_nReturn = pop3_retrieve( pClient, 2 );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*Quit.*/
l_nReturn = pop3_quit( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
l_nReturn = pop3_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return -1;
}
/*Free the client structure.*/
pop3_free( &pClient );
/*Free the sink structure.*/
pop3Sink_free( &pSink );
return 0;
}
/*Function to set the sink pointers.*/
void setSink( pop3Sink_t * pSink )
{
pSink->connect = POP3Test_connect;
pSink->dele = POP3Test_delete;
pSink->error = POP3Test_error;
pSink->listStart = POP3Test_listStart;
pSink->list = POP3Test_list;
pSink->listComplete = POP3Test_listComplete;
pSink->noop = POP3Test_noop;
pSink->pass = POP3Test_pass;
pSink->quit = POP3Test_quit;
pSink->reset = POP3Test_reset;
pSink->retrieveStart = POP3Test_retrieveStart;
pSink->retrieve = POP3Test_retrieve;
pSink->retrieveComplete = POP3Test_retrieveComplete;
pSink->sendCommandStart = POP3Test_sendCommandStart;
pSink->sendCommand = POP3Test_sendCommand;
pSink->sendCommandComplete = POP3Test_sendCommandComplete;
pSink->stat = POP3Test_stat;
pSink->topStart = POP3Test_topStart;
pSink->top = POP3Test_top;
pSink->topComplete = POP3Test_topComplete;
pSink->uidListStart = POP3Test_uidListStart;
pSink->uidList = POP3Test_uidList;
pSink->uidListComplete = POP3Test_uidListComplete;
pSink->user = POP3Test_user;
pSink->xAuthListStart = POP3Test_xAuthListStart;
pSink->xAuthList = POP3Test_xAuthList;
pSink->xAuthListComplete = POP3Test_xAuthListComplete;
pSink->xSender = POP3Test_xSender;
}

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

@ -0,0 +1,207 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
/*
*@author derekt@netscape.com
*@version 1.0
*/
#include "pop3.h"
#include "testsink.h"
/*Notification for the response to the connection to the server.*/
void POP3Test_connect( pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage )
{
printf( "%s\n", in_responseMessage );
}
/*Notification for the response to the DELE command.*/
void POP3Test_delete( pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage )
{
printf( "%s\n", in_responseMessage );
}
/*Notification for an error response.*/
void POP3Test_error( pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage )
{
printf( "ERROR:%s\n", in_responseMessage );
}
/*Notification for the start of the LIST command.*/
void POP3Test_listStart( pop3Sink_t * in_pPOP3Sink )
{
printf( "LIST Start\n" );
}
/*Notification for the response to the LIST command.*/
void POP3Test_list( pop3Sink_t * in_pPOP3Sink, int in_messageNumber, int in_octetCount )
{
printf( "%d %d\n", in_messageNumber, in_octetCount );
}
/*Notification for the completion of the LIST command.*/
void POP3Test_listComplete( pop3Sink_t * in_pPOP3Sink )
{
printf( "LIST Complete\n" );
}
/*Notification for the response to the NOOP command.*/
void POP3Test_noop( pop3Sink_t * in_pPOP3Sink )
{
printf( "NOOP\n" );
}
/*Notification for the response to the PASS command.*/
void POP3Test_pass(pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage )
{
printf( "%s\n", in_responseMessage );
}
/*Notification for the response to the QUIT command.*/
void POP3Test_quit(pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage )
{
printf( "%s\n", in_responseMessage );
}
/*Notification for the response to the RSET command.*/
void POP3Test_reset(pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage )
{
printf( "%s\n", in_responseMessage );
}
/*Notification for the start of a message from the RETR command.*/
void POP3Test_retrieveStart( pop3Sink_t * in_pPOP3Sink, int in_messageNumber, int in_octetCount )
{
FILE * l_file = fopen( "retrieve.txt", "wb" );
in_pPOP3Sink->pOpaqueData = (void*)l_file;
printf( "RETR Start: %d %d\n", in_messageNumber, in_octetCount );
}
/*Notification for raw message from the RETR command.*/
void POP3Test_retrieve( pop3Sink_t * in_pPOP3Sink, const char * in_messageChunk )
{
FILE * l_file = (FILE*)in_pPOP3Sink->pOpaqueData;
fputs( in_messageChunk, l_file );
printf( "%s", in_messageChunk );
}
/*Notification for the completion of the RETR command.*/
void POP3Test_retrieveComplete( pop3Sink_t * in_pPOP3Sink )
{
FILE * l_file = (FILE*)in_pPOP3Sink->pOpaqueData;
fclose( l_file );
printf( "%RETR Complete\n" );
}
/*Notification for the start of the extended command.*/
void POP3Test_sendCommandStart( pop3Sink_t * in_pPOP3Sink )
{
printf( "SENDCOMMAND Start\n" );
}
/*Notification for the response to sendCommand() method.*/
void POP3Test_sendCommand( pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage )
{
printf( "%s\n", in_responseMessage );
}
/*Notification for the completion of the extended command.*/
void POP3Test_sendCommandComplete( pop3Sink_t * in_pPOP3Sink )
{
printf( "SENDCOMMAND Complete\n" );
}
/*Notification for the response to the STAT command.*/
void POP3Test_stat( pop3Sink_t * in_pPOP3Sink, int in_messageCount, int in_octetCount )
{
printf( "%d %d\n", in_messageCount, in_octetCount );
}
/*Notification for the start of a message from the TOP command.*/
void POP3Test_topStart( pop3Sink_t * in_pPOP3Sink, int in_messageNumber )
{
printf( "TOP Start: %d\n", in_messageNumber );
}
/*Notification for a line of the message from the TOP command.*/
void POP3Test_top( pop3Sink_t * in_pPOP3Sink, const char * in_responseLine )
{
printf( "%s\n", in_responseLine );
}
/*Notification for the completion of the TOP command.*/
void POP3Test_topComplete( pop3Sink_t * in_pPOP3Sink )
{
printf( "%TOP Complete\n" );
}
/*Notification for the start of the UIDL command.*/
void POP3Test_uidListStart( pop3Sink_t * in_pPOP3Sink )
{
printf( "UIDL Start\n" );
}
/*Notification for the response to the UIDL command.*/
void POP3Test_uidList( pop3Sink_t * in_pPOP3Sink, int in_messageNumber, const char * in_uid )
{
printf( "%d %s\n", in_messageNumber, in_uid );
}
/*Notification for the completion of the UIDL command.*/
void POP3Test_uidListComplete( pop3Sink_t * in_pPOP3Sink )
{
printf( "UIDL Complete\n" );
}
/**Notification for the response to the USER command.*/
void POP3Test_user( pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage )
{
printf( "%s\n", in_responseMessage );
}
/*Notification for the start of the XAUTHLIST command.*/
void POP3Test_xAuthListStart( pop3Sink_t * in_pPOP3Sink )
{
printf( "XAUTHLIST Start\n" );
}
/*Notification for the response to the XAUTHLIST command.*/
void POP3Test_xAuthList( pop3Sink_t * in_pPOP3Sink, int in_messageNumber, const char * in_responseMessage )
{
printf( "%d %s\n", in_messageNumber, in_responseMessage );
}
/*Notification for the completion of the XAUTHLIST command.*/
void POP3Test_xAuthListComplete( pop3Sink_t * in_pPOP3Sink )
{
printf( "XAUTHLIST Complete\n" );
}
/*Notification for the response to the XSENDER command.*/
void POP3Test_xSender( pop3Sink_t * in_pPOP3Sink, const char * in_emailAddress )
{
printf( "%s\n", in_emailAddress );
}

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

@ -0,0 +1,65 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
/*
*@author derekt@netscape.com
*@version 1.0
*/
#ifndef TESTSINK_H
#define TESTSINK_H
#include <stdio.h>
void POP3Test_connect( pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage );
void POP3Test_delete( pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage );
void POP3Test_error( pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage );
void POP3Test_listStart( pop3Sink_t * in_pPOP3Sink );
void POP3Test_list( pop3Sink_t * in_pPOP3Sink, int in_messageNumber, int in_octetCount );
void POP3Test_listComplete( pop3Sink_t * in_pPOP3Sink );
void POP3Test_noop( pop3Sink_t * in_pPOP3Sink );
void POP3Test_pass(pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage );
void POP3Test_quit(pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage );
void POP3Test_reset(pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage );
void POP3Test_retrieveStart( pop3Sink_t * in_pPOP3Sink, int in_messageNumber, int in_octetCount );
void POP3Test_retrieve( pop3Sink_t * in_pPOP3Sink, const char * in_messageChunk );
void POP3Test_retrieveComplete( pop3Sink_t * in_pPOP3Sink );
void POP3Test_sendCommandStart( pop3Sink_t * in_pPOP3Sink );
void POP3Test_sendCommand( pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage );
void POP3Test_sendCommandComplete( pop3Sink_t * in_pPOP3Sink );
void POP3Test_stat( pop3Sink_t * in_pPOP3Sink, int in_messageCount, int in_octetCount );
void POP3Test_topStart( pop3Sink_t * in_pPOP3Sink, int in_messageNumber );
void POP3Test_top( pop3Sink_t * in_pPOP3Sink, const char * in_responseLine );
void POP3Test_topComplete( pop3Sink_t * in_pPOP3Sink );
void POP3Test_uidListStart( pop3Sink_t * in_pPOP3Sink );
void POP3Test_uidList( pop3Sink_t * in_pPOP3Sink, int in_messageNumber, const char * in_uid );
void POP3Test_uidListComplete( pop3Sink_t * in_pPOP3Sink );
void POP3Test_user( pop3Sink_t * in_pPOP3Sink, const char * in_responseMessage );
void POP3Test_xAuthListStart( pop3Sink_t * in_pPOP3Sink );
void POP3Test_xAuthList( pop3Sink_t * in_pPOP3Sink, int in_messageNumber, const char * in_responseMessage );
void POP3Test_xAuthListComplete( pop3Sink_t * in_pPOP3Sink );
void POP3Test_xSender( pop3Sink_t * in_pPOP3Sink, const char * in_emailAddress );
#endif /* TESTSINK_H */

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

@ -0,0 +1,176 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
#ifndef SMTP_H
#define SMTP_H
/*
* smtp.h
* @author derekt@netscape.com
* @version 1.0
*/
#include "nsmail.h"
#include <stdio.h>
/* Structure used by a client to communicate to a SMTP server. */
typedef struct smtpClient smtpClient_t;
/* Forward declaration of the SMTP notification sink. */
typedef struct smtpSink * smtpSinkPtr_t;
/* Definition of the SMTP notification sink. */
typedef struct smtpSink
{
/* User data. */
void * pOpaqueData;
/* Notification for the response to the BDAT command. */
void (*bdat)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_responseMessage );
/* Notification for the response to the connection to the server. */
void (*connect)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_responseMessage );
/* Notification for the response to the DATA command. */
void (*data)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_responseMessage );
/* Notification for the response to the EHLO command. */
void (*ehlo)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_serverExtension );
/* Notification for the completion of the EHLO command. */
void (*ehloComplete)(smtpSinkPtr_t in_psmtpSink );
/* Notification for an error. */
void (*error)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_errorMessage );
/* Notification for the response to the EXPN command. */
void (*expand)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_emailAddress );
/* Notification for the completion of the EXPN command. */
void (*expandComplete)(smtpSinkPtr_t in_psmtpSink);
/* Notification for the response to the HELP command. */
void (*help)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_helpMessage );
/* Notification for the completion of the HELP command. */
void (*helpComplete)(smtpSinkPtr_t in_psmtpSink );
/* Notification for the response to the MAIL FROM command. */
void (*mailFrom)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_responseMessage );
/* Notification for the response to the NOOP command. */
void (*noop)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_responseMessage );
/* Notification for the response to the QUIT command. */
void (*quit)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_responseMessage );
/* Notification for the response to the RCPT TO command. */
void (*rcptTo)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_responseMessage );
/* Notification for the response to the RSET command. */
void (*reset)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_responseMessage );
/* Notification for the response to data sent to the server. */
void (*send)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_responseMessage );
/* Notification for the response to sendCommand() method. */
void (*sendCommand)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_responseMessage );
/* Notification for the completion of the extended command. */
void (*sendCommandComplete)(smtpSinkPtr_t in_psmtpSink );
/* Notification for the response to the VRFY command. */
void (*verify)( smtpSinkPtr_t in_psmtpSink, int in_responseCode, const char * in_responseMessage );
} smtpSink_t;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Initializes and allocates the smtpClient_t structure and sets the sink. */
int smtp_initialize( smtpClient_t ** out_ppSMTP, smtpSink_t * in_psmtpSink );
/* Initializes and allocates the smtpSink_t structure. */
int smtpSink_initialize( smtpSink_t ** out_ppsmtpSink );
/* Function used to free the smtpClient_t structure and it's data members. */
void smtp_free( smtpClient_t ** in_ppSMTP );
/* Function used to free the smtpSink_t structure. */
void smtpSink_free( smtpSink_t ** in_ppsmtpSink );
/* Function used to close the socket connection. */
int smtp_disconnect( smtpClient_t * in_pSMTP );
/* Protocol commands */
int smtp_bdat( smtpClient_t * in_pSMTP,
const char * in_data,
unsigned int length,
boolean in_fLast );
int smtp_connect( smtpClient_t * in_pSMTP,
const char * in_server,
unsigned short in_port );
int smtp_data( smtpClient_t * in_pSMTP );
int smtp_ehlo( smtpClient_t * in_pSMTP, const char * in_domain );
int smtp_expand( smtpClient_t * in_pSMTP, const char * in_mailingList );
int smtp_help( smtpClient_t * in_pSMTP, const char * in_helpTopic );
int smtp_mailFrom( smtpClient_t * in_pSMTP,
const char * in_reverseAddress,
const char * in_esmtpParams );
int smtp_noop( smtpClient_t * in_pSMTP );
int smtp_quit( smtpClient_t * in_pSMTP );
int smtp_rcptTo( smtpClient_t * in_pSMTP,
const char * in_forwardAddress,
const char * in_esmtpParams );
int smtp_reset( smtpClient_t * in_pSMTP );
int smtp_send( smtpClient_t * in_pSMTP, const char * in_data );
int smtp_sendStream( smtpClient_t * in_pSMTP, nsmail_inputstream_t * in_inputStream );
int smtp_sendCommand( smtpClient_t * in_pSMTP, const char * in_command );
int smtp_verify( smtpClient_t * in_pSMTP, const char * in_user );
/*
int smtp_sendMessage( const char * in_server,
const char * in_domain,
const char * in_sender,
const char * in_recipients,
const char * in_message,
char * out_serverError );
int smtp_sendMessageStream( const char * in_server,
const char * in_domain,
const char * in_sender,
const char * in_recipients,
nsmail_inputstream_t * in_inputStream,
char * out_serverError );
*/
/*
* A function used to process the server responses for API commands.
* This function will invoke the callback functions provided by the user
* for all responses that are available at the time of execution.
*/
int smtp_processResponses( smtpClient_t * in_pSMTP );
/* Sets the size of the message data chunk sent to the server. */
int smtp_setChunkSize( smtpClient_t * in_pSMTP, int in_chunkSize );
/* Attempts to enable PIPELINING. */
int smtp_setPipelining( smtpClient_t * in_pSMTP, boolean in_enablePipelining );
/* Sets a new response sink. */
int smtp_setResponseSink( smtpClient_t * in_pSMTP, smtpSink_t * in_psmtpSink );
/* Sets the timeout used in smtp_processResponses(). */
int smtp_setTimeout( smtpClient_t * in_pSMTP, double in_timeout );
/* Function used for setting io and threading models. */
int smtp_set_option( smtpClient_t * in_pSMTP, int in_option, void * in_pOptionData );
/* Function used for getting io and threading models. */
int smtp_get_option( smtpClient_t * in_pSMTP, int in_option, void * in_pOptionData );
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SMTP_H */

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

@ -0,0 +1,175 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
#ifndef SMTPPRIV_H
#define SMTPPRIV_H
/*
* smtppriv.h
* @author derekt@netscape.com
* @version 1.0
*/
#include "nsmail.h"
#include "nsio.h"
#include "linklist.h"
/* Default port number. */
#define DEFAULT_SMTP_PORT 25
/* Maximum definitions. */
#define MAX_DOMAIN_LENGTH 64
#define MAX_USERHNAME_LENGTH 64
#define MAX_RCPTBUFFER_LENGTH 100
#define MAX_PATH_LENGTH 256
#define MAX_COMMANDLINE_LENGTH 512
#define MAX_REPLYLINE_LENGTH 512
#define MAX_TEXTLINE_LENGTH 1000
#define MAX_BUFFER_LENGTH 1024
/* Response types for SMTP. */
typedef enum smtp_ResponseType
{
BDAT,
CONN,
DATA,
EHLO,
EXPN,
HELP,
MAIL,
NOOP,
QUIT,
RCPT,
RSET,
SEND,
SENDCOMMAND,
VRFY
} smtp_ResponseType_t;
/* Response variables for SMTP. */
const static smtp_ResponseType_t SMTPResponse_BDAT = BDAT;
const static smtp_ResponseType_t SMTPResponse_CONN = CONN;
const static smtp_ResponseType_t SMTPResponse_DATA = DATA;
const static smtp_ResponseType_t SMTPResponse_EHLO = EHLO;
const static smtp_ResponseType_t SMTPResponse_EXPN = EXPN;
const static smtp_ResponseType_t SMTPResponse_HELP = HELP;
const static smtp_ResponseType_t SMTPResponse_MAIL = MAIL;
const static smtp_ResponseType_t SMTPResponse_NOOP = NOOP;
const static smtp_ResponseType_t SMTPResponse_QUIT = QUIT;
const static smtp_ResponseType_t SMTPResponse_RCPT = RCPT;
const static smtp_ResponseType_t SMTPResponse_RSET = RSET;
const static smtp_ResponseType_t SMTPResponse_SEND = SEND;
const static smtp_ResponseType_t SMTPResponse_SENDCOMMAND = SENDCOMMAND;
const static smtp_ResponseType_t SMTPResponse_VRFY = VRFY;
/* Constants used for sending commands. */
const static char bdat[] = "BDAT ";
const static char data[] = "DATA";
const static char ehlo[] = "EHLO ";
const static char helo[] = "HELO ";
const static char expn[] = "EXPN ";
const static char help[] = "HELP ";
const static char mailFrom[] = "MAIL FROM:<";
const static char noop[] = "NOOP";
const static char quit[] = "QUIT";
const static char rcptTo[] = "RCPT TO:<";
const static char rset[] = "RSET";
const static char vrfy[] = "VRFY ";
const static char rBracket[] = ">";
const static char eomessage[] = "\r\n.";
const static char bdatLast[] = " LAST";
const static char empty[] = "";
const static char pipelining[] = "PIPELINING";
/*
* Structure used by a client to communicate to a SMTP server.
* This structure stores IO_t structure which deals with
* the specifics of communication.
*/
typedef struct smtpClient
{
/* Communication structure. */
IO_t io;
/* List of command types sent to the server. */
LinkedList_t * pCommandList;
/* Flag indicating if a response must be processed. */
boolean mustProcess;
/* State variable indicating if the DATA command was last executed. */
boolean fDATASent;
/* Last character sent to the server used for byte stuffing messages. */
char lastSentChar;
/* Boolean variable indicating if the server supports PIPELINING. */
boolean pipeliningSupported;
/* Get/Set variables */
int chunkSize;
double timeout;
smtpSink_t * smtpSink;
boolean pipelining;
/* Re-used variables */
char * messageData;
char commandBuffer[512];
char responseLine[512];
} smtpClient_i_t;
/* Function pointer for responses. */
typedef void (*sinkMethod_t)( smtpSinkPtr_t, int , const char * );
typedef void (*sinkMethodComplete_t)( smtpSinkPtr_t );
/* Internal parsing functions. */
static int setStatusInfo( const char * in_responseLine, int * out_responseCode );
static int parseSingleLine( smtpClient_t *, sinkMethod_t );
static int parseMultiLine( smtpClient_t *, sinkMethod_t, sinkMethodComplete_t );
static int parseData( smtpClient_t * in_pSMTP );
static int parseEhlo( smtpClient_t * );
static void invokeCallback( smtpSink_t *, sinkMethod_t, int, const char * );
#ifdef SMTP_HIGHLEVEL_API
/*
* A higher level API
* @author derekt@netscape.com
* @version 1.0
*/
typedef struct returnInfo
{
boolean error;
char errorBuffer[512];
} returnInfo_t;
/* Internal high level functions. */
void cleanup( smtpClient_t * in_pClient, smtpSink_t * in_pSink );
void cleanupServerError( smtpClient_t * in_pClient, smtpSink_t * fin_pSink, char * out_serverError );
#endif /*SMTP_HIGHLEVEL_API*/
#endif /* SMTP_H */

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

@ -0,0 +1,76 @@
# GNU Makefile for smtp
#
MSGSDK_ROOT = ../../../../C
CONFIG_ROOT = ../../../../CONFIG
BUILD_ROOT = ../../../../C
MKDIR = mkdir -p
LIBDIR = $(OBJDIR)/lib
OBJDEST = $(LIBDIR)/libsmtp
LIBNAME = libsmtp
include $(CONFIG_ROOT)/msgsdk.mk
LOCAL_INCDIR = ../include
GLOBAL_INCDIR = ../../../include
CFLAGS += -I$(LOCAL_INCDIR) -I$(GLOBAL_INCDIR)
#
# Build full target library file and path
#
ifeq ($(ARCH), AIX)
LIBTARGET = $(addsuffix _shr.a, \
$(addprefix $(LIBDIR)/, $(LIBNAME)))
else
LIBTARGET = $(addsuffix .$(DLL_SUFFIX), \
$(addprefix $(LIBDIR)/, $(LIBNAME)))
endif
SMTP_OBJS= smtp.o
#COMMON_OBJS= $(LIBDIR)/libcomm/nsio.o \
# $(LIBDIR)/libcomm/nssocket.o \
# $(LIBDIR)/libcomm/linklist.o
OBJS = $(addprefix $(OBJDEST)/, $(SMTP_OBJS))
all: $(OBJDEST) $(LIBDIR) $(LIBTARGET)
test:
echo $(OBJDIR)
clean:
rm -rf $(OBJDEST)*
rm -rf $(OBJDEST)/*
$(LIBDIR):
echo creating $(LIBDIR)
$(MKDIR) $(LIBDIR)
$(OBJDEST):
echo creating $(OBJDEST)
$(MKDIR) $(OBJDEST)
ifeq ($(ARCH), WINNT)
$(LIBTARGET): $(OBJS)
$(PURIFY) $(LINK_DLL) /DEFAULTLIB:WSOCK32.LIB /DEFAULTLIB:$(BUILD_ROOT)/built/WINNT-domestic-full-sdk/lib/LIBCOMM.LIB /DEF:smtp.def $(OBJS)
else
ifeq ($(ARCH), AIX)
$(LIBTARGET): $(OBJS)
$(LD) $(DLL_LDFLAGS) -o $(LIBTARGET) $(OBJS) -bE:smtp.exp -L$(LIBDIR) -lcomm_shr -lc_r
else
ifeq ($(ARCH), IRIX)
$(LIBTARGET): $(OBJS)
$(LD) $(DLL_LDFLAGS) -exports_file smtp.exp -soname $(LIBNAME).so -o $(LIBTARGET) $(OBJS)
else
ifeq ($(ARCH), IRIX64)
$(LIBTARGET): $(OBJS)
$(LD) $(DLL_LDFLAGS) -exports_file smtp.exp -soname $(LIBNAME).so -o $(LIBTARGET) $(OBJS)
else
$(LIBTARGET): $(OBJS)
$(LD) $(DLL_LDFLAGS) -o $(LIBTARGET) $(OBJS)
endif
endif
endif
endif

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

@ -0,0 +1,36 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/* USAGE: SMTPTest.exe server domain mailFrom rcptTo message */
#include "smtp.h"
#include "testsink.h"
int main( int argc, char *argv[ ] )
{
int l_return;
char l_errorBuffer[512];
memset( &l_errorBuffer, 0, 512 );
l_return = SMTP_sendMessage( "muxtest", "netscape.com", "derekt", "derekt,alterego", "HAHAHAAHHAHAH", (char*)&l_errorBuffer );
printf( "%s\r\n", l_errorBuffer );
return l_return;
}

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

@ -0,0 +1,315 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/* USAGE: SMTPTest.exe server domain mailFrom rcptTo messageFile */
#include "smtp.h"
#include "nsStream.h"
#include "testsink.h"
#include <time.h>
/*Function prototype for settting sink pointers*/
void setSink( smtpSink_t * pSink );
/*Function for reading data from a file.*/
int Test_read( void *rock, char * buf, unsigned size )
{
if ( fgets( buf, size, (FILE*)rock ) == NULL )
{
return -1;
}
return strlen( buf );
}
int main( int argc, char *argv[ ] )
{
int l_nReturn;
FILE * pFile;
nsmail_inputstream_t l_inputStream;
smtpClient_t * pClient = NULL;
smtpSink_t * pSink = NULL;
/*Initialize the response sink.*/
l_nReturn = smtpSink_initialize( &pSink );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Set the function pointers on the response sink.*/
setSink( pSink );
/*Initialize the client passing in the response sink.*/
l_nReturn = smtp_initialize( &pClient, pSink );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Set the internal buffer chunk size.*/
l_nReturn = smtp_setChunkSize( pClient, 1048576 );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Connect to the SMTP server.*/
l_nReturn = smtp_connect( pClient, argv[1], 25 );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
l_nReturn = smtp_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Send the EHLO command passing in the domain name.*/
l_nReturn = smtp_ehlo( pClient, argv[2] );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
l_nReturn = smtp_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Send the MAIL FROM command.*/
l_nReturn = smtp_mailFrom( pClient, argv[3], NULL );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
l_nReturn = smtp_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Send the RCPT TO command.*/
l_nReturn = smtp_rcptTo( pClient, argv[4], NULL );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
l_nReturn = smtp_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Send the DATA command.*/
l_nReturn = smtp_data( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
l_nReturn = smtp_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Open the file for reading.*/
pFile = fopen( argv[5], "rb" );
if ( pFile == NULL )
{
return -1;
}
/* Setup the input stream.*/
l_inputStream.read = Test_read;
l_inputStream.rock = pFile;
/* Send the message.*/
l_nReturn = smtp_sendStream( pClient, &l_inputStream );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Close the file.*/
fclose( pFile );
l_nReturn = smtp_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Send the EXPN command.*/
l_nReturn = smtp_expand( pClient, argv[3] );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
l_nReturn = smtp_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Send the HELP command.*/
l_nReturn = smtp_help( pClient, argv[3] );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
l_nReturn = smtp_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Send the NOOP command.*/
l_nReturn = smtp_noop( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
l_nReturn = smtp_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Send the RSET command.*/
l_nReturn = smtp_reset( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
l_nReturn = smtp_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Send the VRFY command.*/
l_nReturn = smtp_verify( pClient, argv[3] );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
l_nReturn = smtp_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Send a generic command to the server.*/
l_nReturn = smtp_sendCommand( pClient, "HELP help" );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
l_nReturn = smtp_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
l_nReturn = smtp_quit( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
l_nReturn = smtp_processResponses( pClient );
if ( l_nReturn != NSMAIL_OK )
{
return l_nReturn;
}
/*Free the client structure.*/
smtp_free( &pClient );
/*Free the sink structure.*/
smtpSink_free( &pSink );
return 0;
}
/*Function to set the sink pointers.*/
void setSink( smtpSink_t * pSink )
{
pSink->bdat = SMTPTest_bdat;
pSink->connect = SMTPTest_connect;
pSink->data = SMTPTest_data;
pSink->ehlo = SMTPTest_ehlo;
pSink->ehloComplete = SMTPTest_ehloComplete;
pSink->expand = SMTPTest_expand;
pSink->expandComplete = SMTPTest_expandComplete;
pSink->help = SMTPTest_help;
pSink->helpComplete = SMTPTest_helpComplete;
pSink->mailFrom = SMTPTest_mailFrom;
pSink->noop = SMTPTest_noop;
pSink->quit = SMTPTest_quit;
pSink->rcptTo = SMTPTest_rcptTo;
pSink->reset = SMTPTest_reset;
pSink->send = SMTPTest_send;
pSink->sendCommand = SMTPTest_sendCommand;
pSink->sendCommandComplete = SMTPTest_sendCommandComplete;
pSink->verify = SMTPTest_verify;
}

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

@ -0,0 +1,142 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
#include "smtp.h"
#include "testsink.h"
/**
*Notification sink for SMTP commands.
*@author derekt@netscape.com
*@version 1.0
*/
/*Notification for the response to the BDAT command.*/
void SMTPTest_bdat( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the response to the connection to the server.*/
void SMTPTest_connect( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the response to the DATA command.*/
void SMTPTest_data( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the response to the EHLO command.*/
void SMTPTest_ehlo( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the completion of the EHLO command.*/
void SMTPTest_ehloComplete(smtpSink_t * in_pSink)
{
printf( "EHLO complete\n" );
}
/*Notification for the response to a server error.*/
void SMTPTest_error(smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the response to the EXPN command.*/
void SMTPTest_expand( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the completion of the EXPN command.*/
void SMTPTest_expandComplete(smtpSink_t * in_pSink)
{
printf( "EXPAND complete\n" );
}
/*Notification for the response to the HELP command.*/
void SMTPTest_help( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the completion of the HELP command.*/
void SMTPTest_helpComplete(smtpSink_t * in_pSink)
{
printf( "HELP complete\n" );
}
/*Notification for the response to the MAIL FROM command.*/
void SMTPTest_mailFrom( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the response to the NOOP command.*/
void SMTPTest_noop( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the response to the QUIT command.*/
void SMTPTest_quit( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the response to the RCPT TO command.*/
void SMTPTest_rcptTo( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the response to the RSET command.*/
void SMTPTest_reset( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the response to sending the message.*/
void SMTPTest_send( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the response to sending a generic command.*/
void SMTPTest_sendCommand( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}
/*Notification for the completion of send a generic command.*/
void SMTPTest_sendCommandComplete(smtpSink_t * in_pSink)
{
printf( "SENDCOMMAND complete\n" );
}
/*Notification for the response to the VRFY command.*/
void SMTPTest_verify( smtpSink_t * in_pSink, int in_responseCode, const char * in_responseMessage )
{
printf( "%d %s\n", in_responseCode, in_responseMessage );
}

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

@ -0,0 +1,45 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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 TESTSINK_H
#define TESTSINK_H
#include <stdio.h>
void SMTPTest_bdat( smtpSink_t *, int, const char * );
void SMTPTest_connect( smtpSink_t *, int, const char * );
void SMTPTest_data( smtpSink_t *, int, const char * );
void SMTPTest_ehlo( smtpSink_t *, int, const char * );
void SMTPTest_ehloComplete(smtpSink_t *);
void SMTPTest_expand( smtpSink_t *, int, const char * );
void SMTPTest_expandComplete(smtpSink_t *);
void SMTPTest_help( smtpSink_t *, int, const char * );
void SMTPTest_helpComplete(smtpSink_t *);
void SMTPTest_mailFrom( smtpSink_t *, int, const char * );
void SMTPTest_noop( smtpSink_t *, int, const char * );
void SMTPTest_quit( smtpSink_t *, int, const char * );
void SMTPTest_rcptTo( smtpSink_t *, int, const char * );
void SMTPTest_reset( smtpSink_t *, int, const char * );
void SMTPTest_send( smtpSink_t *, int, const char * );
void SMTPTest_sendCommand( smtpSink_t *, int, const char * );
void SMTPTest_sendCommandComplete(smtpSink_t *);
void SMTPTest_verify( smtpSink_t *, int, const char * );
#endif /* TESTSINK_H */

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

@ -0,0 +1,50 @@
This directory contains example program that demonstrates the use of
the MIME Encoder API.
The msgEncode.c file contains the program that demonstrates the use of the
MIME encoder API.
mime.h and nsStream.h files are also suplied in this directory for convenience.
These two header files are also installed at
<install-root>/include/nsStream.h and
<install-root>/include/protocol/mime.h
Where <install-root> is where you installed the Netscape Messaging-sdk.
How to compile and run:
-----------------------
When compiling for UNIX platforms specify -DXP_UNIX.
For Windows do not specify -DXP_UNIX.
You would need to link with libmime.so library and libcomm.so.
libmime library implements the MIME functionality and
libcomm library contains the implementation of Stream I/O
functions that are defined in nsStream.h
NOTE: The .so extension for libraries is used on Solaris and
other such platforms. The extension is different on other
platforms. On NT it is .lib and .dll for example.
An example compile statement for Solaris is shown below:
cc -DXP_UNIX -I./ testMessage.c libmime.so libcomm.so
The above assumes the libraries are in this directory.
To Run:
------
Be sure to set the LD_LIBRARY_PATH or the equivalents and
run the program.
Usage: a.out <file-name> [encoding]
Where encoding can be B (Base64), Q (QP). If the encoding parameter
is not supplied the program assumes a default based on filename extension.
For example: a.out IMAGE.JPG B
a.out xxx.txt Q
a.out xxx.txt

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

@ -0,0 +1,453 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
#ifndef MIME_H
#define MIME_H
#include "nsmail.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MIME_OK 0
#define MIME_ERR_UNINITIALIZED -1 /* don't modify */
#define MIME_ERR_INVALIDPARAM -2
#define MIME_ERR_OUTOFMEMORY -3
#define MIME_ERR_UNEXPECTED -4
#define MIME_ERR_IO -5
#define MIME_ERR_IO_READ -6
#define MIME_ERR_IO_WRITE -7
#define MIME_ERR_IO_SOCKET -8
#define MIME_ERR_IO_SELECT -9
#define MIME_ERR_IO_CONNECT -10
#define MIME_ERR_IO_CLOSE -11
#define MIME_ERR_PARSE -12
#define MIME_ERR_TIMEOUT -13
#define MIME_ERR_INVALID_INDEX -14
#define MIME_ERR_CANTOPENFILE -15
#define MIME_ERR_CANT_SET -16
#define MIME_ERR_ALREADY_SET -17
#define MIME_ERR_CANT_DELETE -18
#define MIME_ERR_CANT_ADD -19
/* reserved by nsmail.h codes -20 through -30 */
#define MIME_ERR_EOF -82
#define MIME_ERR_EMPTY_DATASINK -83
#define MIME_ERR_ENCODE -84
#define MIME_ERR_NO_SUCH_HEADER -85
#define MIME_ERR_NO_HEADERS -86
#define MIME_ERR_NOT_SET -87
#define MIME_ERR_NO_BODY -88
#define MIME_ERR_NOT_FOUND -89
#define MIME_ERR_NO_CONTENT_SUBTYPE -90
#define MIME_ERR_INVALID_ENCODING -91
#define MIME_ERR_INVALID_BASICPART -92
#define MIME_ERR_INVALID_MULTIPART -93
#define MIME_ERR_INVALID_MESSAGEPART -94
#define MIME_ERR_INVALID_MESSAGE -95
#define MIME_ERR_INVALID_CONTENTTYPE -96
#define MIME_ERR_INVALID_CONTENTID -97
#define MIME_ERR_NO_DATA -98
#define MIME_ERR_NOTIMPL -99
#define MIME_ERR_EMPTY_BODY -100
#define MIME_ERR_EMPTY_BODY -100
#define MIME_ERR_UNSUPPORTED_PARTIAL_SUBTYPE -101
#define MIME_ERR_MAX_NESTED_PARTS_REACHED -102
#define MIME_BUFSIZE 1024
struct mimeDataSink;
/* ----------------------------- */
typedef enum mime_encoding_type
{
MIME_ENCODING_UNINITIALIZED = -1, /* don't modify */
MIME_ENCODING_BASE64,
MIME_ENCODING_QP,
MIME_ENCODING_7BIT, /* 7 bit data with NO transfer encoding */
MIME_ENCODING_8BIT, /* 8 bit data with NO transfer encoding */
MIME_ENCODING_BINARY /* Binary data with NO transfer encoding */
} mime_encoding_type;
typedef enum mime_disp_type
{
MIME_DISPOSITION_UNINITIALIZED = -1, /* don't modify */
MIME_DISPOSITION_INLINE = 1,
MIME_DISPOSITION_ATTACHMENT
} mime_disp_type;
typedef enum mime_content_type
{
MIME_CONTENT_UNINITIALIZED = -1, /* don't modify */
MIME_CONTENT_TEXT,
MIME_CONTENT_AUDIO,
MIME_CONTENT_IMAGE,
MIME_CONTENT_VIDEO,
MIME_CONTENT_APPLICATION,
MIME_CONTENT_MULTIPART,
MIME_CONTENT_MESSAGEPART
} mime_content_type;
typedef struct mime_header
{
char *name;
char *value;
struct mime_header *next;
} mime_header_t;
/* Common structure for leaf parts: Text, Audio, Video, Image and Application */
typedef struct mime_basicPart
{
char * content_description;
mime_disp_type content_disposition;
char * content_disp_params; /* content disposition parameters */
mime_content_type content_type;
char * content_subtype;
char * content_type_params;
char * contentID;
mime_header_t * extra_headers; /* additional X- and Content- headers */
char * contentMD5; /* MD5 CRC code */
mime_encoding_type encoding_type;
void *pInternal; /* Stuff that client can not directly manipulate */
} mime_basicPart_t;
typedef struct mime_messagePart
{
char * content_description;
mime_disp_type content_disposition;
char * content_disp_params; /* content disposition parameters */
mime_content_type content_type;
char * content_subtype;
char * content_type_params;
char * contentID;
mime_header_t * extra_headers; /* additional X- and Content- headers */
mime_encoding_type encoding_type;
mime_header_t * extern_headers; /* for extern-body */
void *pInternal; /* Stuff that client can not directly manipulate */
} mime_messagePart_t;
typedef struct mime_multiPart
{
char * content_description;
mime_disp_type content_disposition;
char * content_disp_params; /* content disposition parameters */
mime_content_type content_type;
char * content_subtype;
char * content_type_params;
char * contentID;
mime_header_t * extra_headers; /* additional X- and Content- headers */
void *pInternal; /* Stuff that client can not directly manipulate */
} mime_multiPart_t;
typedef struct mime_message
{
mime_header_t * rfc822_headers; /* message headers */
void *pInternal; /* Stuff that client can not directly manipulate */
} mime_message_t;
typedef struct file_mime_type
{
mime_content_type content_type;
char * content_subtype;
char * content_params;
mime_encoding_type mime_encoding;
/* char * file_extn; */
/* char * file_shortname; */
} file_mime_type;
/*************************************************************************/
/** BASIC (LEAF) BODY PART TYPES **/
/*************************************************************************/
/* Set the body-data for this part from an input stream.
* This can only be done on a (new) mime_basicPart with empty bodydata.
*/
int mime_basicPart_setDataStream (mime_basicPart_t * in_pBasicPart,
nsmail_inputstream_t *in_pTheDataStream,
BOOLEAN in_fCopyData);
/* Set the body-data for this part from a buffer.
* This can only be done on a (new) mime_basicPart with empty bodydata.
*/
int mime_basicPart_setDataBuf (mime_basicPart_t * in_pBasicPart,
unsigned int in_size,
const char * in_pDataBuf,
BOOLEAN in_fCopyData);
/* Deletes the bodyData for this part. */
int mime_basicPart_deleteData (mime_basicPart_t * in_pBasicPart);
/* gives the size of the body-data in bytes */
int mime_basicPart_getSize (mime_basicPart_t * in_pBasicPart,
unsigned int * out_pSize);
/* returns the body-data after any decoding in an input stream */
/* If in_pFileName is NULL returns a memory based input-stream */
/* If in_pFileName is not NULL, returns the specified file based */
/* input-stream to the data */
int mime_basicPart_getDataStream (mime_basicPart_t *in_ppBasicPart,
char * in_pFileName,
nsmail_inputstream_t **out_ppDataStream);
/* returns the body-data after any decoding in a buffer */
int mime_basicPart_getDataBuf (mime_basicPart_t * in_pBasicPart,
unsigned int * out_pSize,
char **out_ppDataBuf );
/* Writes out byte stream for this part with MIME headers and encoded body-data */
int mime_basicPart_putByteStream (mime_basicPart_t * in_pBasicPart,
nsmail_outputstream_t *in_pOutput_stream);
int mime_basicPart_free_all (mime_basicPart_t * in_pBasicPart);
/*************************************************************************/
/** COMPOSITE BODY PART TYPES **/
/*************************************************************************/
/*=========================== MULTI PART =================================*/
/* Adds a file as basic part to the multi-part. */
/* If in_pref_file_encoding > 0 attempts to use the encoding */
/* for the file-attachment. If encoding is not valid for the */
/* file-type overrides with the correct value. */
int mime_multiPart_addFile (mime_multiPart_t * in_pMultiPart,
char * in_pFileFullName,
mime_encoding_type in_pref_file_encoding,
int * out_pIndex_assigned);
/* Adds a basic part to the multi-part. */
int mime_multiPart_addBasicPart (mime_multiPart_t * in_pMultiPart,
mime_basicPart_t * in_pBasicPart,
BOOLEAN in_fClone,
int * out_pIndex_assigned);
/* Adds a message part to the multi-part. */
int mime_multiPart_addMessagePart (mime_multiPart_t * in_pMultiPart,
mime_messagePart_t * in_pMessagePart,
BOOLEAN in_fClone,
int * out_pIndex_assigned);
/* Adds a message part to the multi-part. */
int mime_multiPart_addMultiPart (mime_multiPart_t * in_pMultiPart,
mime_multiPart_t * in_pMultiPartToAdd,
BOOLEAN in_fClone,
int * out_pIndex_assigned);
/* Deletes the bodyPart at the requested index from this multi-part */
int mime_multiPart_deletePart (mime_multiPart_t * in_pMultiPart,
int in_index);
/* returns the count of the body parts in this multi-part */
int mime_multiPart_getPartCount (mime_multiPart_t * in_pMultiPart,
int * out_count);
/* returns the body part at the specified index */
int mime_multiPart_getPart (mime_multiPart_t * in_pMultiPart,
int in_index,
mime_content_type * out_pContentType,
void **out_ppTheBodyPart /* Client can cast based on pContentType */
);
/* Writes out byte stream for this part with MIME headers and encoded body-data */
int mime_multiPart_putByteStream (mime_multiPart_t * in_pMultiPart,
nsmail_outputstream_t *in_pOutput_stream);
int mime_multiPart_free_all (mime_multiPart_t * in_pMultiPart);
/*=========================== MESSAGE PART =================================*/
/* creates a message part from a message structure */
int mime_messagePart_fromMessage (mime_message_t * in_pMessage,
mime_messagePart_t ** out_ppMessagePart);
/* retrieves the message from the message part */
int mime_messagePart_getMessage (mime_messagePart_t * in_pMessagePart,
mime_message_t ** out_ppMessage);
/* deletes the mime message that is the body of this part */
int mime_messagePart_deleteMessage (mime_messagePart_t * in_pMessagePart);
/* Sets the passed message as body of this message-part. It is error to set message
when it is already set. */
int mime_messagePart_setMessage (mime_messagePart_t * in_pMessagePart,
mime_message_t * in_pMessage);
/* Writes out byte stream for this part to the output stream */
int mime_messagePart_putByteStream (mime_messagePart_t * in_pMessagePart,
nsmail_outputstream_t *in_pOutput_stream);
int mime_messagePart_free_all (mime_messagePart_t * in_pMessagePart);
/*============================== MESSAGE ===================================*/
/* Creates a message given text-data and a file to attach. */
/* The file-name supplied must be fully-qualified file-name. */
/* If either in_pText or in_pFileFullName are NULL creates a */
/* MIME message with the non-NULL one. It is an error to pass */
/* NULL for both text and file-name parameters. */
/* If in_pref_file_encoding > 0 attempts to use the encoding */
/* for the file-attachment. If encoding is not valid for the */
/* file-type overrides with the correct value. */
/* Returns MIME_OK on success and an error code otherwise. */
int mime_message_create (char * in_pText,
char * in_pFileFullName,
mime_encoding_type in_pref_file_encoding,
mime_message_t ** out_ppMessage);
/* Adds a basic part as the body of the message. */
/* Error if Body is already present. */
/* Sets content-type accordingly. */
int mime_message_addBasicPart (mime_message_t * in_pMessage,
mime_basicPart_t * in_pBasicPart,
BOOLEAN in_fClone);
/* Adds the message part as the body of the message. */
/* Error if Body is already present. */
/* Sets content-type accordingly. */
int mime_message_addMessagePart (mime_message_t * in_pMessage,
mime_messagePart_t * in_pMessagePart,
BOOLEAN in_fClone);
/* Adds the multipart as the body of the message */
/* Error if Body is already present. */
/* Sets content-type accordingly. */
int mime_message_addMultiPart (mime_message_t * in_pMessage,
mime_multiPart_t * in_pMultiPart,
BOOLEAN in_fClone);
/* Deletes the bodyPart that constitutes the body of this message */
int mime_message_deleteBody (mime_message_t * pMessage);
/* returns the content_type of this message */
int mime_message_getContentType (mime_message_t * in_pMessage,
mime_content_type * out_content_type);
/* returns the content_subtype of this message */
int mime_message_getContentSubType (mime_message_t * in_pMessage,
char ** out_ppSubType);
/* returns the content_type params of this message */
int mime_message_getContentTypeParams (mime_message_t * in_pMessage,
char ** out_ppParams);
/* returns the content_type params of this message */
int mime_message_getHeader (mime_message_t * in_pMessage,
char * in_pName,
char ** out_ppValue);
/* returns the body part at the specified index */
int mime_message_getBody (mime_message_t * pMessage,
mime_content_type * out_pContentType,
void ** out_ppTheBodyPart /* Client to cast this based on pContentType */
);
/* Writes out byte stream for this part to the output stream */
int mime_message_putByteStream (mime_message_t * in_pMessage,
nsmail_outputstream_t *in_pOutput_stream);
/* Frees up all internal structures. Client still responsible for freeing all
visible parts and the structure itself */
int mime_message_free_all (mime_message_t * in_pMessage);
/*************************************************************************/
/** UTILITY ROUTINES */
/*************************************************************************/
/* Builds and returns a mime_header given name and value */
/* Returns NULL if either name or value is a NULL */
mime_header_t * mime_header_new (char * in_pName, char * in_pValue);
/* Frees a mime_header_t structure */
int mime_header_free (mime_header_t * in_pHdr);
/* Encode a header string per RFC 2047. The encoded string can be used as the
value of unstructured headers or in the comments section of structured headers.
Below, encoding must be one of 'Q' or 'B' */
int mime_encodeHeaderString (char * in_pString,
char * in_charset, /* charset the input string is in */
char in_encoding,
char ** out_ppString);
/* If the input string is not encoded (per RFC 2047), returns the same.
Otherwise, decodes and returns the decoded string */
int mime_decodeHeaderString (char * in_pString,
char ** out_ppString);
/* Base64 encodes the data from input_stream and writes to output_stream */
int mime_encodeBase64 (nsmail_inputstream_t * in_pInput_stream,
nsmail_outputstream_t * in_pOutput_stream);
/* QuotedPrintable encodes the data from input_stream and writes to output_stream */
int mime_encodeQP (nsmail_inputstream_t * in_pInput_stream,
nsmail_outputstream_t * in_pOutput_stream);
/* Base64 decodes the data from input_stream and writes to output_stream */
int mime_decodeBase64 (nsmail_inputstream_t * in_pInput_stream,
nsmail_outputstream_t * in_pOutput_stream);
/* QuotedPrintable decodes the data from input_stream and writes to output_stream */
int mime_decodeQP (nsmail_inputstream_t * in_pInput_stream,
nsmail_outputstream_t * in_pOutput_stream);
/* Returns file's MIME type info based on file's extension. */
/* By default returns application/octet-stream. */
/* If filename_ext is null returns application/octet-stream.*/
int getFileMIMEType (char * in_pFilename_ext, file_mime_type * in_pFileMIMEType);
#ifdef __cplusplus
}
#endif
#endif /* MIME_H */

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

@ -0,0 +1,192 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
#include <stdio.h>
#include <sys/types.h>
#ifdef XP_UNIX
#include <unistd.h>
#endif
#include <string.h>
#include "mime.h"
#include "nsStream.h"
#define outmsg(x) (fprintf(stderr,"%s:%d>%s\n",__FILE__,__LINE__,x))
mime_header_t *mime_header_new (char *szName, char *szValue);
#ifdef XP_UNIX
#define TMPDIR "/tmp/"
#else
#define TMPDIR "C:\\temp\\"
#endif
/*
* This program demonstrates how to build and encode a MIME message, given
*
* (1) Simple text
* (2) A file
* (3) Set of RFC822 headers.
*
* The API permits building a message with just a text or a file or both.
* Additional files can also be added to the message later on if needed.
*
* NOTE: For the file the API automatically detects MIME content-types, MIME-Encoding etc.
* However one can also override the MIME encoding.
*
* NOTE: This program works on Windows and on all tested UNIX platforms
* (Solaris, HPUX, AIX, IRIX etc.)
*/
void main (int argc, char *argv[])
{
char textBuf[1024], *pBuf, *pEnc;
char filename [1024];
mime_message_t * pMsg = NULL;
mime_encoding_type enc = 0;
nsmail_outputstream_t *pOS;
int ret;
mime_header_t * pRFC822_hdrs, * pHdr, *pTmpHdr;
if (argc < 2)
{
fprintf (stderr, "Usage: %s <filename> [encoding]\n", argv[0]);
exit (1);
}
if (argc > 2)
{
pEnc = argv[2];
if (fStrEqual (pEnc, "B"))
enc = MIME_ENCODING_BASE64;
else if (fStrEqual (pEnc, "Q"))
enc = MIME_ENCODING_QP;
}
fprintf (stderr, "FileName = %s\n", argv[1]);
pBuf = textBuf;
sprintf (pBuf, "Hello this is a test Message");
/* Build a MIME Message with the "text" and the file (argv[1]) */
ret = mime_message_create (pBuf, argv[1], enc, &pMsg);
/* If building a message with just text and NO file do as follows */
/* ret = mime_message_create (pBuf, NULL, 0, &pMsg); */
/* If building a message with just a file and NO text do as follows */
/* ret = mime_message_create (NULL, argv[1], 0, &pMsg); */
if (ret != MIME_OK)
{
fprintf (stderr, "mime_message_create() failed! Err= %d\n", ret);
exit (1);
}
/* Add all needed RFC822 headers to the message */
outmsg("building RFC822 headers");
pTmpHdr = mime_header_new ("From", "prasad@netscape.com");
pRFC822_hdrs = pTmpHdr;
pHdr = pRFC822_hdrs;
pTmpHdr = mime_header_new ("To", "prasad@netscape.com");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
pTmpHdr = mime_header_new ("Subject", "Hello This is a C Test");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
pTmpHdr = mime_header_new ("X-Msg-SDK-HDR", "X-Test-Value1");
pHdr->next = pTmpHdr;
pHdr = pHdr->next;
outmsg("adding RFC822 headers to message");
pMsg->rfc822_headers = pRFC822_hdrs;
/* Write the MIME encoded message to where you want. Here it is a file */
sprintf (filename, "%s%s", TMPDIR, "sdkCEnc.out");
file_outputStream_create (filename, &pOS);
outmsg(" Invoking mime_message_putByteStream (pMsg, pOS)");
mime_message_putByteStream (pMsg, pOS);
file_outputStream_close (pOS->rock);
}
BOOLEAN fStrEqual (char *s1, char *s2)
{
static char achBuffer[64];
int len;
if ( s1 != NULL && s2 != NULL )
{
len = strlen( s2 );
strncpy( achBuffer, s1, len );
achBuffer[len] = 0;
#ifdef XP_UNIX
if (strcasecmp (achBuffer, s2) == 0)
return TRUE;
#else
if ( stricmp( achBuffer, s2 ) == 0 )
return TRUE;
#endif
}
return FALSE;
}
mime_header_t *mime_header_new (char *szName, char *szValue)
{
mime_header_t *p;
if ( szName == NULL || szValue == NULL )
{
return NULL;
}
p = (mime_header_t *) malloc( sizeof( mime_header_t ) );
if ( p == NULL )
{
return NULL;
}
p->name = strdup (szName);
p->value = strdup (szValue);
p->next = NULL;
return p;
}

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

@ -0,0 +1,141 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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): ______________________________________.
*/
/*
* Copyright (c) 1997 and 1998 Netscape Communications Corporation
* (http://home.netscape.com/misc/trademarks.html)
*/
/* input output stream utilities
* nsStream.h
* @author prasad@netscape.com
* @version 1.0
*/
#ifndef NSIOSTREAM_H
#define NSIOSTREAM_H
#include "nsmail.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Creates an input-stream from a file that can be passed to all messaging
* SDK API calls that require a parameter of type nsmail_inputstream_t.
* Implements the stream and the associated internal functions for read(),
* rewind() and close().
*
* Params:
* =======
*
* in_fileName: Full path name of the file to create the input-stream on.
* The file must exist.
* out_ppRetInputStream: The created input-stream is returned here.
* RETURN Value: 0 on success < 0 on failure. See nsmail.h for possible err codes.
*
* USAGE:
* ======
* nsmail_inputstream_t * pInputStream;
*
* ret_value = file_inputStream_create (<file-name>, &pInputStream);
*
* ret_value = mime_basicPart_setDataStream (<other-params>, pInputStream);
*
* When done close and free the stream.
* ----------------------------------
* pInputStream->close (pInputStream->rock);
* free (pInputStream); pInputStream = NULL;
*
*/
int file_inputStream_create (char * in_fileName,
nsmail_inputstream_t ** out_ppRetInputStream);
/*
* Creates an input-stream from a buffer that can be passed to all messaging
* SDK API calls that require a parameter of type nsmail_inputstream_t.
* Implements the stream and the associated internal functions for read(),
* rewind() and close().
*
* Params:
* =======
*
* in_pDataBuf: Data buf to base the input-stream on. Should not be NULL.
* A reference to the buffer is stored in the stream. Hence
* The buffer should not be freed until the stream is closed.
* in_data_size Size of data in in_pDataBuf.
* out_ppRetInputStream: The created input-stream is returned here.
* RETURN Value: 0 on success < 0 on failure. See nsmail.h for possible err codes.
*
*
* USAGE:
* ======
*
* Same as file_inputStream above.
*
*/
int buf_inputStream_create (char * in_pDataBuf,
long in_data_size,
nsmail_inputstream_t ** out_ppRetInputStream);
/*
* Creates an output-stream from a file that can be passed to all messaging
* SDK API calls that require a parameter of type nsmail_outputstream_t.
*
* Params:
* =======
*
* in_fileName: Full path name of the file to create the output-stream on.
* Creates the file if needed. Blows away any previous data in the file.
* out_ppRetInputStream: The created output-stream is returned here.
* RETURN Value: 0 on success < 0 on failure. See nsmail.h for possible err codes.
*
* USAGE:
* ======
* nsmail_outputstream_t * pOutputStream;
*
* ret_value = file_outputStream_create (<file-name>, &pOutputStream);
*
* ret_value = mime_message_putByteStream (<other-params>, pOutputStream);
*
* When done close and free the stream.
* ----------------------------------
* pOutputStream->close (pOutputStream->rock);
* free (pOutputStream); pOutputStream = NULL;
*
* NOTE: The file under the stream needs to be removed separately.
*/
int file_outputStream_create (char * in_fileName,
nsmail_outputstream_t ** out_ppRetOutputStream);
#ifdef __cplusplus
}
#endif
#endif /* NSIOSTREAM_H */

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

@ -0,0 +1,147 @@
/*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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 the Netscape Messaging Access SDK Version 3.5 code,
* released on or about June 15, 1998.
*
* 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 NSMAIL_H
#define NSMAIL_H
#ifdef XP_UNIX
#include <sys/time.h>
#endif /* XP_UNIX */
#ifdef AIX
#include <sys/select.h>
#endif /* AIX */
#ifdef WIN32
#include <winsock.h>
#endif /* WIN32 */
#define FALSE 0
#define TRUE 1
typedef unsigned char boolean;
#ifdef XP_UNIX
#define BOOLEAN int
#endif
/*
Definitions for various options that might want to be set.
*/
typedef enum NSMAIL_Options
{
NSMAIL_OPT_IO_FN_PTRS
} NSMAIL_Options_t;
/*
Error codes.
*/
#define NSMAIL_OK 0
#define NSMAIL_ERR_UNINITIALIZED -1
#define NSMAIL_ERR_INVALIDPARAM -2
#define NSMAIL_ERR_OUTOFMEMORY -3
#define NSMAIL_ERR_UNEXPECTED -4
#define NSMAIL_ERR_IO -5
#define NSMAIL_ERR_IO_READ -6
#define NSMAIL_ERR_IO_WRITE -7
#define NSMAIL_ERR_IO_SOCKET -8
#define NSMAIL_ERR_IO_SELECT -9
#define NSMAIL_ERR_IO_CONNECT -10
#define NSMAIL_ERR_IO_CLOSE -11
#define NSMAIL_ERR_PARSE -12
#define NSMAIL_ERR_TIMEOUT -13
#define NSMAIL_ERR_INVALID_INDEX -14
#define NSMAIL_ERR_CANTOPENFILE -15
#define NSMAIL_ERR_CANT_SET -16
#define NSMAIL_ERR_ALREADY_SET -17
#define NSMAIL_ERR_CANT_DELETE -18
#define NSMAIL_ERR_CANT_ADD -19
#define NSMAIL_ERR_SENDDATA -20
#define NSMAIL_ERR_MUSTPROCESSRESPONSES -21
#define NSMAIL_ERR_PIPELININGNOTSUPPORTED -22
#define NSMAIL_ERR_ALREADYCONNECTED -23
#define NSMAIL_ERR_NOTCONNECTED -24
#define NSMAIL_ERR_EOF -1
#define NSMAIL_ERR_NOTIMPL -99
#define ERRORLOG /* turn on error log */
struct sockaddr;
/*
Definition for a structure to plug in specific io functionality.
*/
typedef struct nsmail_io_fns
{
int (*liof_read)( int, char *, int );
int (*liof_write)( int, char *, int );
int (*liof_socket)( int, int, int );
int (*liof_select)( int, fd_set *, fd_set *, fd_set *, struct timeval * );
int (*liof_connect)( int, const struct sockaddr *, int );
int (*liof_close)( int );
} nsmail_io_fns_t;
typedef struct nsmail_inputstream
{
void *rock; /* opaque client data */
/* Returns the number of bytes actually read and -1 on eof on the stream and
* may return an NSMAIL_ERR* (int value < 0) in case of any other error.
* Can be invoked multiple times. Each read returns the next sequence of bytes
* in the stream, starting past the last byte returned by previous read.
* The buf space allocated and freed by the caller. The size parameter
* specifies the maximum number of bytes to be returned by read. If the number
* of bytes actually returned by read is less than size, an eof on the stream
* is assumed.
*/
int (*read) (void *rock, char *buf, int size);
/* Reset the stream to the beginning. A subsequent read returns data from the
start of the stream.
*/
void (*rewind) (void *rock);
/* Closes the stream, freeing any internal buffers and rock etc.
Once a stream is closed it is illegal to attempt read() or rewind()
or close() on the stream. After close(), the nsmail_inputstream structure
corresponding to the stream needs to be freed by the user of the stream.
*/
void (*close) (void *rock);
} nsmail_inputstream_t;
typedef struct nsmail_outputstream
{
void *rock; /* opaque client data */
/* write (CRLF-separated) output in 'buf', of size 'size'. May be called multiple times */
void (*write) (void *rock, const char *buf, int size);
void (*close) (void *rock);
/* Closes the stream, freeing any internal buffers and rock etc.
Once a stream is closed it is illegal to attempt write() or close()
on the stream. After close(), the nsmail_outputstream structure
corresponding to the stream needs to be freed by the user of the stream.
*/
} nsmail_outputstream_t;
#endif /* NSMAIL_H */

48
msgsdk/CONFIG/getarch Executable file
Просмотреть файл

@ -0,0 +1,48 @@
#!/bin/sh
UNAME=`uname -s`
# OS tweaks
if [ "$UNAME" = "SunOS" ]; then
UNAME=`uname -sr | sed -e 's/ /-/g'`
if [ "$UNAME" = "SunOS-4.1.3_U1" ]; then
UNAME=SUNOS4
else
PROCESSOR=`uname -p`
if [ "$PROCESSOR" = "i386" ]; then
UNAME=SOLARISx86
else
UNAME=SOLARIS
fi
fi
elif [ "$UNAME" = "HP-UX" ]; then
UNAME=HPUX
elif [ "$UNAME" = "BSD/386" ]; then
UNAME=BSDI
elif [ "$UNAME" = "SCO_SV" ]; then
UNAME=SCO
elif [ "$UNAME" = "UNIX_SV" ]; then
UNAME=UNIXWARE
elif [ "$UNAME" = "NEWS-OS" ]; then
UNAME=SONY
elif [ "$UNAME" = "3430-001" ]; then
UNAME=NCRSVR4
elif [ "$UNAME" = "UNIX_System_V" ]; then
UNAME=NECSVR4
fi
case "$UNAME" in
SINIX*|ReliantUNIX*)
UNAME="ReliantUNIX" ;;
esac
echo $UNAME

250
msgsdk/CONFIG/msgsdk.mk Normal file
Просмотреть файл

@ -0,0 +1,250 @@
# Following taken from nsdefs.mk PY.
# nsarch renamed to getarch PY.
TMP_ARCH := $(shell uname -s)
ifeq ($(TMP_ARCH), WINNT)
BUILD_ARCH := $(shell uname -s)
else
BUILD_ARCH := $(shell $(CONFIG_ROOT)/getarch)
endif
BUILD_DEBUG=full
BUILD_SECURITY=export
ARCH=$(BUILD_ARCH)
SECURITY=$(BUILD_SECURITY)
DEBUG=$(BUILD_DEBUG)
PRODUCT="Netscape Messaging SDK"
DIR=sdk
COMMON_OBJDIR=$(MSGSDK_ROOT)/built/$(ARCH)-$(SECURITY)-$(DEBUG)-$(DIR)
OBJDIR=$(COMMON_OBJDIR)
NS_BUILD_FLAVOR=$(ARCH)-$(SECURITY)-$(DEBUG)-$(DIR)
NS_RELEASE=$(MSGSDK_ROOT)/built/release/$(ARCH)-$(SECURITY)-$(DEBUG)-$(DIR)
DO_SEARCH=yes
# Following taken from nsconfig.mk
#MAKE=gmake $(BUILDOPT) NO_MOCHA=1
all:
MAKE=gmake
NSOS_ARCH := $(subst /,_,$(shell uname -s))
ifeq ($(NSOS_ARCH), IRIX64)
NSOS_ARCH := IRIX
endif
ifeq ($(NSOS_ARCH), AIX)
NSOS_TEST := $(shell uname -v)
ifeq ($(NSOS_TEST),3)
NSOS_RELEASE := $(shell uname -r)
else
NSOS_RELEASE := $(shell uname -v)_$(shell uname -r)
endif
else
NSOS_RELEASE := $(shell uname -r)
endif
ifeq ($(ARCH), SOLARIS)
OSVERSION := $(shell uname -r | sed "y/./0/")
endif
NSOS_TEST1 := $(shell uname -m)
ifeq ($(NSOS_TEST1),i86pc)
NSCONFIG = $(NSOS_ARCH)$(NSOS_RELEASE)_$(NSOS_TEST1)
else
NSCONFIG = $(NSOS_ARCH)$(NSOS_RELEASE)
endif
# ---------------------- OS-specific compile flags -----------------------
ifeq ($(ARCH), AIX)
ifeq ($(NSCONFIG), AIX4_2)
CC=cc -DAIXV3 -DAIXV4 -D_AIX32_CURSES
CPPCMD=/usr/ccs/lib/cpp -P
ARCH_DEBUG=-g
ARCH_OPT=-g -O2
RANLIB=ranlib
NONSHARED_FLAG=-bnso -bI:/lib/syscalls.exp
#
DLL_LDFLAGS=-G -bM:SRE
EXTRA_LIBS=-brtl -ldl -lm -lc -bI:/usr/lib/lowsys.exp
endif
endif
ifeq ($(ARCH), HPUX)
CC=cc
ARCH_DEBUG=-g
ARCH_OPT=-O
# Compile everything pos-independent
ARCH_CFLAGS=-D_HPUX_SOURCE -Aa +DA1.0 +z
RANLIB=true
NONSHARED_FLAG=-Wl,-a,archive
#
EXTRA_LIBS=-Wl,-E -ldld -lm
DLL_CFLAGS=+z
DLL_LDFLAGS=-b
NSAPI_CAPABLE=true
VERITY_LIB=_hp800
endif
ifeq ($(NSOS_ARCH), IRIX)
CC=cc -DSVR4
CXX=CC -DSVR4
CCC=$(CXX)
ARCH_DEBUG=-g
ARCH_OPT=-O
ARCH_CFLAGS=-fullwarn -use_readonly_const -MDupdate .depends
RANLIB=true
DLL_LDFLAGS=-shared -all
NONSHARED_FLAG=-non_shared
NLIST=-lmld
NSAPI_CAPABLE=true
VERITY_LIB=_mipsabi
endif
ifeq ($(ARCH), OSF1)
ifndef CC
CC=cc
endif
CC += -taso
ARCH_DEBUG=-g
ARCH_OPT=-O2
ARCH_CFLAGS=-DIS_64 -ieee_with_inexact
RANLIB=ranlib
DLL_LDFLAGS=-shared -all -expect_unresolved "*" -taso
NONSHARED_FLAG=-non_shared
NSAPI_CAPABLE=true
VERITY_LIB=_asof32
endif
ifeq ($(ARCH), SOLARIS)
CC=cc
CXX=CC
CCC=$(CXX)
ARCH_OPT=-xO2
ARCH_CFLAGS=-DSVR4 -D__svr4 -D__svr4__ -D_SVID_GETTOD -DOSVERSION=$(OSVERSION)
ARCH_DEBUG=-g
ARCH_OPT=-xO2
RANLIB=true
EXTRA_LIBS += -lsocket -lnsl -ldl -lresolv
DLL_LDFLAGS=-G
NONSHARED_FLAG=-static
NSAPI_CAPABLE=true
NLIST=-lelf
VERITY_LIB=_solaris
endif
ifeq ($(ARCH), WINNT)
PROCESSOR := $(shell uname -p)
ifeq ($(PROCESSOR), I386)
CPU_ARCH = x386
CC=cl -nologo -MD -W3 -GX -D_X86_ -Dx386 -DWIN32 -D_WINDOWS
CCP=cl -nologo -MD -W3 -GX -D_X86_ -Dx386 -DWIN32 -D_WINDOWS -D_MBCS -D_AFXDLL
else
CPU_ARCH = processor_is_undefined
endif
RC=rc $(MCC_SERVER)
MC=mc
ARCH_DEBUG=-D_DEBUG -Od -Z7
ARCH_OPT=-DNDEBUG -O2
ARCH_CFLAGS=
ARCH_LINK_DEBUG=-DEBUG
ARCH_LINK_OPT=
RANLIB=echo
EXTRA_LIBS=wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib \
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
rpcrt4.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib
DLL_LDFLAGS=
NONSHARED_FLAG=
NSAPI_CAPABLE=true
VERITY_LIB=_nti152
endif
ifeq ($(ARCH), SUNOS4)
MATHLIB=/usr/local/sun4/lib/libmgnuPIC.a
else
MATHLIB=-lm
endif
# ------------------------ The actual build rules ------------------------
RM=rm
DEPEND=makedepend
STRIP=strip
ifeq ($(ARCH), WINNT)
XP_FLAG=-DXP_WIN32 -DXP_WIN -D_WINDOWS -DXP_PC -DXP_WINNT
else
XP_FLAG=-DXP_UNIX
endif
CFLAGS_NO_ARCH=$(XP_FLAG) -D$(ARCH)
CFLAGS=$(ARCH_CFLAGS) $(CFLAGS_NO_ARCH) $(ARCH_OPT)
ifndef NOSTDCOMPILE
$(OBJDEST)/%.o: %.c
ifeq ($(ARCH), WINNT)
ifeq ($(BOUNDS_CHECKER), yes)
bcompile -c -Zop $(NSROOT)/bchecker.ini -nologo -MD -W3 -GX -DWIN32 \
-D_WINDOWS $(CFLAGS) $(MCC_INCLUDE) $< -Fo$(OBJDEST)/$*.o
else
$(CC) -c $(CFLAGS) $(MCC_INCLUDE) $< -Fo$(OBJDEST)/$*.o $(CBSCFLAGS)
endif
else
$(CC) -c $(CFLAGS) $(MCC_INCLUDE) $< -o $(OBJDEST)/$*.o
endif
endif
ifeq ($(ARCH), WINNT)
LIB_SUFFIX=lib
DLL_SUFFIX=dll
AR=lib /nologo /out:"$@"
LINK_DLL = link /nologo /MAP /DLL /PDB:NONE $(ML_DEBUG) /SUBSYSTEM:WINDOWS $(LLFLAGS) $(DLL_LDFLAGS) /out:"$@"
LINK_EXE = link -OUT:"$@" /MAP $(ARCH_LINK_DEBUG) $(LCFLAGS) /NOLOGO /PDB:NONE /INCREMENTAL:NO \
/SUBSYSTEM:windows $(OBJS) $(DEPLIBS) $(EXTRA_LIBS)
BSCMAKE = bscmake.exe /nologo /o $@
$(OBJDEST)/%.res: %.rc
$(RC) -Fo$@ $*.rc
else
ifeq ($(ARCH), HPUX)
DLL_SUFFIX=sl
LIB_SUFFIX=a
AR=ar rcv $@
LINK_DLL=ld $(DLL_LDFLAGS) -o $@
else
LIB_SUFFIX=a
DLL_SUFFIX=so
AR=ar rcv $@
LINK_DLL=ld $(DLL_LDFLAGS) -o $@
endif
endif
ifndef NOSTDCLEAN
clean:
$(RM) -f .depends $(LIBS) $(OBJDEST)/*.o *_pure_* $(BINS) $(PUREFILES)
endif
ifndef NOSTDDEPEND
ifeq ($(ARCH), WINNT)
INCLUDE_DEPENDS = $(NULL)
depend:
echo making depends
else
INCLUDE_DEPENDS = .depends
.depends:
touch .depends
depend:
$(DEPEND) -f.depends -- $(MCC_INCLUDE) $(CFLAGS) *.c *.cpp
endif
endif
ifndef NOSTDSTRIP
strip:
$(STRIP) $(BINS)
endif

340
msgsdk/Makefile Normal file
Просмотреть файл

@ -0,0 +1,340 @@
##### PACKAGING MAKEFILE for MESSAGING SDK############
MSGSDK_ROOT=./C
BUILD_MODULE=MSGSDK
CONFIG_ROOT=./CONFIG
include CONFIG/msgsdk.mk
ifndef MMDD
MMDD = $(shell date +%m.%d)
endif
JAVA_EXE=mjdk35_1
C_EXE=msdk35_1
JAVABUILDDIR=./release/$(MMDD)/java/$(ARCH)
## COMMON ####
DOCSDIR=./docs
### C #####
CBUILDDIR=./release/$(MMDD)/C/$(ARCH)
CINCLUDES=./C/include
CPROPOP3=./C/protocol/POP3/include
CPROSMTP=./C/protocol/SMTP/include
CPROIMAP4=./C/protocol/IMAP4/include
CPROMIME=./C/protocol/MIME/include
CABSINCLUDES=./C/abstract/include
CHIINCLUDES=./C/highlevel/include
### JAVA #######
JAVADIR=./java/built/$(ARCH)
IMAGEDIR=./images
JAVAMIMESRC=./java/protocol/MIME/src
JAVASMTPSRC=./java/protocol/SMTP/src
JAVAPOP3SRC=./java/protocol/POP3/src
JAVAIMAP4SRC=./java/protocol/IMAP4/src
JAVAHISRC=./java/highlevel/src
JAVAMIMEFILES=Header.java MIMEBasicPart.java MIMEBodyPart.java MIMEDataSink.java \
MIMEDynamicParser.java MIMEException.java MIMEHelper.java \
MIMEMessage.java MIMEMessagePart.java MIMEMultiPart.java \
MIMEParser.java fileMIMEType.java
JAVAHIFILES=IMException.java IMTransport.java IMAttachment.java
ifeq ($(ARCH), WINNT)
MKDIR=mkdir
TYPE=.zip
ZIP = jar -cvf
COMPTYPE=.exe
else
MKDIR=mkdir -p
TYPE=.tar
ZIP = zip -r
COMPTYPE=.tar.gz
endif
LIBTYPE=.a
DLLTYPE=.so
ifeq ($(ARCH), WINNT)
LIBTYPE=.lib
DLLTYPE=.dll
endif
ifeq ($(ARCH), AIX)
LIBTYPE=.a
DLLTYPE=.a
endif
ifeq ($(ARCH), HPUX)
DLLTYPE=.sl
endif
all:
@echo ""
@echo "Usage: gmake releaseJava "
@echo "Usage: gmake buildJava "
@echo ""
@echo "You can specify date for the package"
@echo "by setting MMDD=<some date> on the gmake line"
@echo "although it is not necessary"
buildC:
cd C/src; $(MAKE) $(MFLAGS)
cd C/protocol/POP3/src; $(MAKE) $(MFLAGS)
cd C/protocol/SMTP/src; $(MAKE) $(MFLAGS)
cd C/protocol/IMAP4/src; $(MAKE) $(MFLAGS)
cd C/protocol/MIME/src; $(MAKE) $(MFLAGS)
#cd C/highlevel/src; $(MAKE) $(MFLAGS)
packageC: FRESH DIRS_LIB DIRS_INCLUDE \
DIRS_EXAMPLES \
PROTOCOL_INCLUDE \
ROOT_INCLUDE \
CDOCS
cp $(COMMON_OBJDIR)/lib/*$(DLLTYPE) $(NS_RELEASE)/lib
ifeq ($(ARCH), AIX)
cp $(COMMON_OBJDIR)/lib/*$(LIBTYPE) $(NS_RELEASE)/lib
endif
ifeq ($(ARCH), WINNT)
cp $(COMMON_OBJDIR)/lib/*$(LIBTYPE) $(NS_RELEASE)/lib
endif
ifeq ($(ARCH), WINNT)
cd $(NS_RELEASE); winzip32 -a -r -p $(C_EXE)
mv $(NS_RELEASE)/$(C_EXE).zip $(CBUILDDIR)
ifdef BUILD_SHIP
cp $(NS_RELEASE)/$(C_EXE)$(COMPTYPE) $(BUILD_SHIP)
chmod g+w $(BUILD_SHIP)
endif
else
cd $(NS_RELEASE); tar cvf ../$(NS_BUILD_FLAVOR)$(TYPE) .
gzip -f $(NS_RELEASE)/../$(NS_BUILD_FLAVOR)$(TYPE) ;
mv $(NS_RELEASE)/../$(NS_BUILD_FLAVOR)$(COMPTYPE) $(CBUILDDIR)
ifdef BUILD_SHIP
cp $(CBUILDDIR)/$(NS_BUILD_FLAVOR)$(COMPTYPE) $(BUILD_SHIP)
endif
endif
buildJava:
cd java/protocol; $(MAKE) $(MFLAGS)
cd java/highlevel/src; $(MAKE) $(MFLAGS)
packageJava: FRESH_JAVA \
JAVA_DOCS \
JAVA_EXAMPLES
cd $(JAVADIR)/protocol; $(ZIP) ../proapi.jar *
cd $(JAVADIR)/highlevel; $(ZIP) ../coapi.jar *
cp $(JAVADIR)/proapi.jar $(JAVABUILDDIR)/packages
cp $(JAVADIR)/coapi.jar $(JAVABUILDDIR)/packages
ifeq ($(ARCH), WINNT)
cd $(JAVABUILDDIR); winzip32 -a -r -p ../../../../$(JAVA_EXE)
mv $(JAVA_EXE).zip $(JAVABUILDDIR)
# Taken out. Add back if you want winzipse
# cmd /c 'echo $(JAVA_EXE).zip -d C:\Netscape\MessagingJavaSDK -y -win32 > import'
# winzipse @import
# rm -f $(JAVA_EXE).zip
# rm -f import
# mv $(JAVA_EXE)$(COMPTYPE) $(JAVABUILDDIR)
else
cd $(JAVABUILDDIR); tar cvf ../$(JAVA_EXE)$(TYPE) .
cd $(JAVABUILDDIR); mv ../$(JAVA_EXE)$(TYPE) .
cd $(JAVABUILDDIR); gzip -f ./$(JAVA_EXE)$(TYPE)
endif
ifdef BUILD_SHIP
mv $(JAVABUILDDIR)/../$(JAVA_EXE)$(COMPTYPE) $(BUILD_SHIP)
endif
test:
cmd /c 'echo $(C_EXE) -d C:\\Netscape\MessagingSDK -y -win32 > import'
echo $(NS_RELEASE)
echo $(INSTALL)
echo $(MKDIR) $(RM)
ls $(JAVADIR)
ls $(JAVABUILDDIR)
### ACTUAL BUILD / PACKAGE RULES FOR JAVA SDK ####
FRESH_JAVA:
rm -rf $(JAVABUILDDIR)
mkdir -p $(JAVABUILDDIR)/packages
mkdir -p $(JAVABUILDDIR)/examples
mkdir -p $(JAVABUILDDIR)/examples/example1
mkdir -p $(JAVABUILDDIR)/examples/MIME/example2
mkdir -p $(JAVABUILDDIR)/examples/MIME/example3
mkdir -p $(JAVABUILDDIR)/examples/MIME/example4
mkdir -p $(JAVABUILDDIR)/examples/MIME/example5
mkdir -p $(JAVABUILDDIR)/examples/MIME/example6
mkdir -p $(JAVABUILDDIR)/examples/SMTP
mkdir -p $(JAVABUILDDIR)/examples/SMTP/advanced
mkdir -p $(JAVABUILDDIR)/examples/POP3
mkdir -p $(JAVABUILDDIR)/examples/IMAP4
mkdir -p $(JAVABUILDDIR)/examples/IMAP4/advanced
mkdir -p $(JAVABUILDDIR)/examples/ConvenienceAPI
mkdir -p $(JAVABUILDDIR)/doc
mkdir -p $(JAVABUILDDIR)/doc/JavaDocs
mkdir -p $(JAVABUILDDIR)/doc/JavaDocs/MIME/images
mkdir -p $(JAVABUILDDIR)/doc/JavaDocs/SMTP/images
mkdir -p $(JAVABUILDDIR)/doc/JavaDocs/POP3/images
mkdir -p $(JAVABUILDDIR)/doc/JavaDocs/IMAP4/images
mkdir -p $(JAVABUILDDIR)/doc/JavaDocs/ConvenienceAPI/images
#mkdir -p $(JAVABUILDDIR)/classes
#mkdir -p $(JAVABUILDDIR)/doc/DevGuide
JAVA_DOCS: \
GEN_JAVADOCS \
$(JAVABUILDDIR)/ReadMeJ.htm \
$(JAVABUILDDIR)/readme.gif
# $(JAVABUILDDIR)/readme.txt \
# $(JAVABUILDDIR)/license.txt \
# $(JAVABUILDDIR)/relnotes.htm
GEN_JAVADOCS:
cd $(JAVAMIMESRC); javadoc -public -d ../../../../$(JAVABUILDDIR)/doc/JavaDocs/MIME $(JAVAMIMEFILES)
cp $(IMAGEDIR)/*.gif $(JAVABUILDDIR)/doc/JavaDocs/MIME/images/
cd $(JAVASMTPSRC); javadoc -public -d ../../../../$(JAVABUILDDIR)/doc/JavaDocs/SMTP *.java
cp $(IMAGEDIR)/*.gif $(JAVABUILDDIR)/doc/JavaDocs/SMTP/images/
cd $(JAVAPOP3SRC); javadoc -public -d ../../../../$(JAVABUILDDIR)/doc/JavaDocs/POP3 *.java
cp $(IMAGEDIR)/*.gif $(JAVABUILDDIR)/doc/JavaDocs/POP3/images/
cd $(JAVAIMAP4SRC); javadoc -public -d ../../../../$(JAVABUILDDIR)/doc/JavaDocs/IMAP4 *.java
cp $(IMAGEDIR)/*.gif $(JAVABUILDDIR)/doc/JavaDocs/IMAP4/images/
### cd $(JAVAHISRC); javadoc -public -d ../../../$(JAVABUILDDIR)/doc/JavaDocs/ConvenienceAPI $(JAVAHIFILES)
cd $(JAVAHISRC); $(MAKE) GEN_JAVADOCS
cp $(IMAGEDIR)/*.gif $(JAVABUILDDIR)/doc/JavaDocs/ConvenienceAPI/images/
$(JAVABUILDDIR)/ReadMeJ.htm: $(DOCSDIR)/ReadMeJ.htm
cp $< $@
$(JAVABUILDDIR)/readme.gif: $(DOCSDIR)/readme.gif
cp $< $@
$(JAVABUILDDIR)/readme.txt: $(DOCSDIR)/javareadme.txt
cp $< $@
$(JAVABUILDDIR)/license.txt: $(DOCSDIR)/license.txt
cp $< $@
$(JAVABUILDDIR)/relnotes.htm: $(DOCSDIR)/javarelnotes.htm
cp $< $@
### ACTUAL BUILD / PACKAGE RULES FOR C SDK ####
FRESH:
rm -rf $(NS_RELEASE)
$(MKDIR) $(CBUILDDIR)
CDOCS: \
$(NS_RELEASE)/ReadMeC.htm \
$(NS_RELEASE)/readme.gif
# $(NS_RELEASE)/readme.txt \
# $(NS_RELEASE)/license.txt \
# $(NS_RELEASE)/relnotes.htm
DIRS_LIB:
$(MKDIR) $(NS_RELEASE)/lib
DIRS_INCLUDE:
$(MKDIR) $(NS_RELEASE)/include
$(MKDIR) $(NS_RELEASE)/include/protocol
# $(MKDIR) $(NS_RELEASE)/include/highlevel
#$(MKDIR) $(NS_RELEASE)/include/abstract
#DIRS_DOCS:
# $(MKDIR) $(NS_RELEASE)/docs
# $(MKDIR) $(NS_RELEASE)/docs/devGuide
DIRS_EXAMPLES:
$(MKDIR) $(NS_RELEASE)/examples
$(MKDIR) $(NS_RELEASE)/examples/MIME
$(MKDIR) $(NS_RELEASE)/examples/POP3
$(MKDIR) $(NS_RELEASE)/examples/SMTP
$(MKDIR) $(NS_RELEASE)/examples/SMTP/advanced
$(MKDIR) $(NS_RELEASE)/examples/IMAP4
$(MKDIR) $(NS_RELEASE)/examples/IMAP4/advanced
ifeq ($(ARCH), WINNT)
cp ./C/protocol/MIME/test/testMessage.c $(NS_RELEASE)/examples/MIME/
cp ./C/protocol/MIME/test/multiPartmsgPart.c $(NS_RELEASE)/examples/MIME/
cp ./C/protocol/MIME/test/testPasrePlus.c $(NS_RELEASE)/examples/MIME/
cp ./C/protocol/MIME/test/ReadMe.txt $(NS_RELEASE)/examples/MIME/
cp ./C/protocol/MIME/test/dynamic/* $(NS_RELEASE)/examples/MIME/
endif
ifneq ($(ARCH), WINNT)
cp ./C/protocol/MIME/test/*.c $(NS_RELEASE)/examples/MIME/
cp ./C/protocol/MIME/test/ReadMe.txt $(NS_RELEASE)/examples/MIME/
cp ./C/protocol/MIME/test/dynamic/*.[ch] $(NS_RELEASE)/examples/MIME/
endif
cp ./C/protocol/SMTP/test/smtptest.c $(NS_RELEASE)/examples/SMTP/
cp ./C/protocol/SMTP/test/testsink.c $(NS_RELEASE)/examples/SMTP/
cp ./C/protocol/SMTP/test/testsink.h $(NS_RELEASE)/examples/SMTP/
cp ./C/advancedExamples/SMTPAdvanced_1/include/testsink.h $(NS_RELEASE)/examples/SMTP/advanced
cp ./C/advancedExamples/SMTPAdvanced_1/src/testsink.c $(NS_RELEASE)/examples/SMTP/advanced
cp ./C/advancedExamples/SMTPAdvanced_1/src/smtptest.c $(NS_RELEASE)/examples/SMTP/advanced
cp ./C/protocol/POP3/test/pop3test.c $(NS_RELEASE)/examples/POP3/
cp ./C/protocol/POP3/test/testsink.c $(NS_RELEASE)/examples/POP3/
cp ./C/protocol/POP3/test/testsink.h $(NS_RELEASE)/examples/POP3/
cp ./C/protocol/IMAP4/test/*.c $(NS_RELEASE)/examples/IMAP4/
cp ./C/protocol/IMAP4/test/*.h $(NS_RELEASE)/examples/IMAP4/
cp ./C/protocol/IMAP4/test/*.out $(NS_RELEASE)/examples/IMAP4/
cp ./C/advancedExamples/IMAP4Advanced_1/include/testsink.h $(NS_RELEASE)/examples/IMAP4/advanced
cp ./C/advancedExamples/IMAP4Advanced_1/src/testsink.c $(NS_RELEASE)/examples/IMAP4/advanced
cp ./C/advancedExamples/IMAP4Advanced_1/src/imaptest.c $(NS_RELEASE)/examples/IMAP4/advanced
JAVA_EXAMPLES:
cp java/protocol/examples/example1/*.java $(JAVABUILDDIR)/examples/example1
cp java/protocol/examples/example1/ReadMe.txt $(JAVABUILDDIR)/examples/example1
cp java/protocol/examples/example2/*.java $(JAVABUILDDIR)/examples/MIME/example2
cp java/protocol/examples/example2/ReadMe.txt $(JAVABUILDDIR)/examples/MIME/example2
cp java/protocol/MIME/testapp/Prasad/*.java $(JAVABUILDDIR)/examples/MIME/example3
cp java/protocol/MIME/testapp/Prasad/ReadMe.txt $(JAVABUILDDIR)/examples/MIME/example3
cp java/protocol/MIME/examples/msg_extern_body/*.java $(JAVABUILDDIR)/examples/MIME/example4
cp java/protocol/MIME/examples/msg_extern_body/ReadMe.txt $(JAVABUILDDIR)/examples/MIME/example4
cp java/protocol/MIME/examples/multi_part/*.java $(JAVABUILDDIR)/examples/MIME/example5
cp java/protocol/MIME/examples/multi_part/ReadMe.txt $(JAVABUILDDIR)/examples/MIME/example5
cp java/protocol/MIME/examples/message_part/*.java $(JAVABUILDDIR)/examples/MIME/example6
cp java/protocol/MIME/examples/message_part/ReadMe.txt $(JAVABUILDDIR)/examples/MIME/example6
cp java/protocol/SMTP/test/*.java $(JAVABUILDDIR)/examples/SMTP/
cp java/advancedExamples/SMTPAdvanced_1/src/*.java $(JAVABUILDDIR)/examples/SMTP/advanced
cp java/protocol/POP3/test/*.java $(JAVABUILDDIR)/examples/POP3/
cp java/protocol/IMAP4/test/*.java $(JAVABUILDDIR)/examples/IMAP4/
cp java/protocol/IMAP4/test/*.out $(JAVABUILDDIR)/examples/IMAP4/
cp java/advancedExamples/IMAP4Advanced_1/src/*.java $(JAVABUILDDIR)/examples/IMAP4/advanced
cp java/highlevel/examples/*.java $(JAVABUILDDIR)/examples/ConvenienceAPI
cp java/highlevel/examples/ReadMe.txt $(JAVABUILDDIR)/examples/ConvenienceAPI
PROTOCOL_INCLUDE: \
$(NS_RELEASE)/include/protocol/mime.h \
$(NS_RELEASE)/include/protocol/mimeparser.h \
$(NS_RELEASE)/include/protocol/imap4.h \
$(NS_RELEASE)/include/protocol/pop3.h \
$(NS_RELEASE)/include/protocol/smtp.h
ABSTRACT_INCLUDE:
cp $(CABSINCLUDES)/*.h $(NS_RELEASE)/include/abstract
HI_INCLUDE:
cp $(CHIINCLUDES)/*.h $(NS_RELEASE)/include/highlevel
ROOT_INCLUDE: \
$(NS_RELEASE)/include/nsmail.h \
$(NS_RELEASE)/include/nsStream.h
$(NS_RELEASE)/include/protocol/mime.h: $(CPROMIME)/mime.h
cp $< $@
$(NS_RELEASE)/include/protocol/mimeparser.h: $(CPROMIME)/mimeparser.h
cp $< $@
$(NS_RELEASE)/include/protocol/imap4.h: $(CPROIMAP4)/imap4.h
cp $< $@
$(NS_RELEASE)/include/protocol/pop3.h: $(CPROPOP3)/pop3.h
cp $< $@
$(NS_RELEASE)/include/protocol/smtp.h: $(CPROSMTP)/smtp.h
cp $< $@
$(NS_RELEASE)/include/nsmail.h: $(CINCLUDES)/nsmail.h
cp $< $@
$(NS_RELEASE)/include/nsStream.h: $(CINCLUDES)/nsStream.h
cp $< $@
$(NS_RELEASE)/ReadMeC.htm: $(DOCSDIR)/ReadMeC.htm
cp $< $@
$(NS_RELEASE)/readme.gif: $(DOCSDIR)/readme.gif
cp $< $@
$(NS_RELEASE)/readme.txt: $(DOCSDIR)/creadme.txt
cp $< $@
$(NS_RELEASE)/license.txt: $(DOCSDIR)/license.txt
cp $< $@
$(NS_RELEASE)/relnotes.htm: $(DOCSDIR)/crelnotes.htm
cp $< $@

51
msgsdk/docs/ReadMeC.htm Executable file
Просмотреть файл

@ -0,0 +1,51 @@
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Author" CONTENT="Sharon Williams">
<META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en]C-NSCP (Win95; I) [Netscape]">
<META NAME="Description" CONTENT="SDK ReadMe - SDK version">
<TITLE>Messaging Access SDK ReadMe</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
<CENTER>
<DD>
<IMG SRC="readme.gif" HEIGHT=32 WIDTH=468></DD></CENTER>
<A NAME="top"></A>
<CENTER>
<H1>
Netscape Messaging Access SDK 3.5</H1></CENTER>
<CENTER><FONT FACE="Albertus Medium">C Version</FONT></CENTER>
<CENTER><FONT FACE="Albertus Medium"><FONT SIZE=-2>This file was last updated&nbsp;<SCRIPT>document.write(document.lastModified)</SCRIPT>
.</FONT></FONT></CENTER>
<P>
<HR NOSHADE SIZE=1>
<P>Thank you for choosing the Netscape Messaging Access SDK. For the latest
documentation, see the <I><A HREF="http://developer.netscape.com/docs/manuals/messaging/msgc/index.htm">Messaging
Access SDK Guide</A></I>, which is available on Netscape DevEdge Online.
<P>For information about installing the SDK, see the <A HREF="http://home.netscape.com/eng/Messaging/sdk/readme35c.htm">ReadMe
file</A> that is available on the Netscape web site.
<P>For a list of SDK features and for a description of the known problems
relating to this release, please see the <A HREF="http://home.netscape.com/eng/Messaging/sdk/relnotes35c.htm">Release
Notes</A> available on the Netscape web site.
<P>For current Messaging Access SDK licensing information, see the <A HREF="http://developer.netscape.com/software/sdks/sdk_license.html">Netscape
One SDK End User License Agreement</A>.
<DIV ALIGN=right>&nbsp;<SCRIPT>document.write("<FONT SIZE=-2><I>Last Updated: " + document.lastModified + "</I></FONT>")</SCRIPT>
&nbsp;
<HR SIZE=4></DIV>
<CENTER><FONT FACE="Albertus Medium"><FONT SIZE=-1>Copyright &copy; 1997
and 1998 <A HREF="http://home.netscape.com/misc/trademarks.html" TARGET="_top">Netscape
Communications Corporation</A> All Rights Reserved.</FONT></FONT></CENTER>
</BODY>
</HTML>

Двоичные данные
msgsdk/images/Attribute.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичные данные
msgsdk/images/Branch.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.5 KiB

Двоичные данные
msgsdk/images/Filter.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичные данные
msgsdk/images/Leaf.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Двоичные данные
msgsdk/images/NameComponent.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.3 KiB

Двоичные данные
msgsdk/images/SearchAttribute.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичные данные
msgsdk/images/StreamAttribute.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичные данные
msgsdk/images/TreeFactory.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.5 KiB

Двоичные данные
msgsdk/images/blue-ball-small.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 255 B

Двоичные данные
msgsdk/images/blue-ball.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 925 B

Двоичные данные
msgsdk/images/class-index.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.5 KiB

Двоичные данные
msgsdk/images/constructor-index.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичные данные
msgsdk/images/constructors.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.5 KiB

Двоичные данные
msgsdk/images/cyan-ball-small.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 255 B

Двоичные данные
msgsdk/images/cyan-ball.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 925 B

Двоичные данные
msgsdk/images/error-index.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичные данные
msgsdk/images/exception-index.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичные данные
msgsdk/images/green-ball-small.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 102 B

Двоичные данные
msgsdk/images/green-ball.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 886 B

Двоичные данные
msgsdk/images/interface-index.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичные данные
msgsdk/images/magenta-ball-small.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 104 B

Двоичные данные
msgsdk/images/magenta-ball.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 896 B

Двоичные данные
msgsdk/images/method-index.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичные данные
msgsdk/images/methods.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичные данные
msgsdk/images/package-index.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.6 KiB

Двоичные данные
msgsdk/images/red-ball-small.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 255 B

Двоичные данные
msgsdk/images/red-ball.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 527 B

Двоичные данные
msgsdk/images/transparent.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 54 B

Двоичные данные
msgsdk/images/variable-index.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.5 KiB

Двоичные данные
msgsdk/images/variables.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 1.3 KiB

Двоичные данные
msgsdk/images/yellow-ball-small.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 255 B

Двоичные данные
msgsdk/images/yellow-ball.gif Normal file

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

После

Ширина:  |  Высота:  |  Размер: 925 B