diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2224c390ce..75cfd873bb 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,34 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-16 23:55 UTC+0100 Francesco Saverio Giudice (info/at/fsgiudice.com) + + harbour/contrib/hbblat + + harbour/contrib/hbblat/blatcls.prg + + harbour/contrib/hbblat/blatwrp.c + + harbour/contrib/hbblat/common.mak + + harbour/contrib/hbblat/hbblat.ch + + harbour/contrib/hbblat/make_b32.bat + + harbour/contrib/hbblat/make_vc.bat + + harbour/contrib/hbblat/Makefile + + harbour/contrib/hbblat/syntax.txt + + harbour/contrib/hbblat/tests + + harbour/contrib/hbblat/tests/blatcmd.prg + + harbour/contrib/hbblat/tests/blattest.prg + + harbour/contrib/hbblat/tests/f_listtext.txt + + harbour/contrib/hbblat/tests/f_ps.txt + + harbour/contrib/hbblat/tests/f_sample.txt + + harbour/contrib/hbblat/tests/f_sample1.txt + + harbour/contrib/hbblat/tests/f_subjectline.txt + + harbour/contrib/hbblat/tests/hbmk.bat + + Added BLAT wrapper class + + * harbour/contrib/make_b32_all.bat + * harbour/contrib/make_vc_all.bat + * added above contrib + + * harbour/source/vm/hvm.c + * added missing ; + 2009-02-16 21:19 UTC+0100 Viktor Szakats (harbour.01 syenar hu) - tests/hbmk_gnu.bat - Removed. diff --git a/harbour/contrib/hbblat/Makefile b/harbour/contrib/hbblat/Makefile new file mode 100644 index 0000000000..479e5c77ae --- /dev/null +++ b/harbour/contrib/hbblat/Makefile @@ -0,0 +1,18 @@ +# +# $Id$ +# + +ROOT = ../../ + +C_SOURCES = \ + blatwrp.c \ + +PRG_SOURCES= \ + blatcls.prg \ + +PRG_HEADERS=\ + blat.ch \ + +LIBNAME=hbblat + +include $(TOP)$(ROOT)config/lib.cf diff --git a/harbour/contrib/hbblat/blatcls.prg b/harbour/contrib/hbblat/blatcls.prg new file mode 100644 index 0000000000..c947ea7cb4 --- /dev/null +++ b/harbour/contrib/hbblat/blatcls.prg @@ -0,0 +1,982 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * BLAT wrapper library interface code. + * + * Copyright 2007-2009 Francesco Saverio Giudice + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "common.ch" +#include "hbblat.ch" +#include "hbclass.ch" + +CLASS HBBlat + + PROTECTED: + VAR nBlatError AS NUMERIC INIT BLAT_SUCCESS // Will contains numerical error returned from BLAT + VAR cBlatError AS STRING INIT "" // Will contains error string returned from BLAT + VAR nError AS NUMERIC INIT BLAT_SUCCESS + VAR cError AS STRING INIT "" + VAR aErrors AS ARRAY INIT {} + VAR cCommand AS STRING INIT "" + VAR cVersion AS STRING INIT "0.1" + VAR cBlatVersion AS STRING INIT "2.6.2" + VAR lChecked AS LOGICAL INIT FALSE + + EXPORTED: + // Installation + VAR lSaveSettings AS LOGICAL INIT FALSE // store common settings to the Windows Registry. Takes the + // same parameters as -install, and is only for SMTP settings. + METHOD SaveSettings( ... ) INLINE ::Install( "SMTP", ... ) + //VAR lInstall AS LOGICAL INIT FALSE + METHOD Install( cService, cServerAddress, cSenderEmailAddress, nTries, nPort, cProfile, cUsername, cPassword ) VIRTUAL // TODO + + // Basics + VAR cOptionFile AS STRING + VAR cTO AS STRING // recipient list (comma separated) + VAR cTOFile AS STRING // recipient list filename + VAR cCC AS STRING // carbon copy recipient list (comma separated) + VAR cCCFile AS STRING // cc recipient list filename + VAR cBCC AS STRING // blind carbon copy recipient list (comma separated) + VAR cBCCFile AS STRING // bcc recipient list filename + VAR nMaxNames AS NUMERIC INIT 0 // send to groups of x number of recipients + VAR lToUndiscloseRecipients AS LOGICAL INIT FALSE // set To: header to Undisclosed Recipients if not using the ::cTo and ::cCC options + VAR cSubject AS STRING // subject line + VAR lSuppressSubject AS LOGICAL INIT FALSE // suppress subject line if it is not defined + VAR cSubjectFile AS STRING // file containing subject line + VAR cBody AS STRING // message body + VAR cBodyFile AS STRING // file containing the message body + VAR cSignatureFile AS STRING // text file containing your email signature + VAR cTagFile AS STRING // text file containing taglines, to be randomly chosen + VAR cPostScriptumFile AS STRING // final message text, possibly for unsubscribe instructions + + // Registry Overrides + VAR cProfile AS STRING // Send using cProfile profile (using server, user, and port) + VAR lShowProfiles AS LOGICAL INIT FALSE // list all profiles in the Registry + VAR cServerSMTP AS STRING // specify SMTP server to be used (optionally, addr:port) + VAR cServerNNTP AS STRING // specify NNTP server to be used (optionally, addr:port) + VAR cServerPOP3 AS STRING // specify POP3 server to be used (optionally, addr:port) when POP3 access is required before sending email + VAR cServerIMAP AS STRING // specify IMAP server to be used (optionally, addr:port) when IMAP access is required before sending email + VAR cMailFrom AS STRING + VAR cFrom AS STRING + VAR cReplyTo AS STRING + VAR cReturnPath AS STRING + VAR cSender AS STRING + VAR nPortSMTP AS NUMERIC // Blat default 25 + VAR nPortNNTP AS NUMERIC // Blat default 119 + VAR nPortPOP3 AS NUMERIC // Blat default 110 + VAR nPortIMAP AS NUMERIC // Blat default 143 + VAR cUserAUTH AS STRING + VAR cPasswordAUTH AS STRING + VAR cUserPOP3 AS STRING + VAR cPasswordPOP3 AS STRING + VAR cUserIMAP AS STRING + VAR cPasswordIMAP AS STRING + + // Miscellaneous RFC header switches + VAR cOrganization AS STRING + VAR cUserAgent AS STRING + VAR cXHeader AS STRING + VAR lNoBlatHomePage AS LOGICAL INIT TRUE + VAR lNoBlatXHeader AS LOGICAL INIT TRUE + VAR lRequestDisposition AS LOGICAL INIT FALSE + VAR lRequestReturnReceipt AS LOGICAL INIT FALSE + VAR cCharSet AS STRING + VAR cUserHeader1 AS STRING + VAR cUserHeader2 AS STRING + VAR cDSN AS STRING // Delivery Status Notifications (RFC 3461): n = never, s = successful, f = failure, d = delayed - can be used together, however N takes precedence + VAR lEHBase64 AS LOGICAL INIT FALSE // use base64 for encoding headers, if necessary + VAR lEHQuoted AS LOGICAL INIT FALSE // use quoted-printable for encoding headers, if necessary + VAR lLowPriority AS LOGICAL INIT FALSE + VAR lHighPriority AS LOGICAL INIT FALSE + VAR nSensitivity AS NUMERIC INIT -1 // set message sensitity 0 for personal, 1 for private, 2 for company-confidential + + // Attachment and encoding options + VAR aAttachBinFiles AS ARRAY + VAR cAttachBinFiles AS STRING + + VAR aAttachTextFiles AS ARRAY + VAR cAttachTextFiles AS STRING + + VAR aAttachInlineFiles AS ARRAY + VAR cAttachInlineFiles AS STRING + + VAR aHtmlEmbeddedFiles AS ARRAY + VAR cHtmlEmbeddedFiles AS STRING // embed file(s) in HTML. Object tag in HTML must specify content-id using cid: tag. eg: + + VAR cAttachListBinFile AS STRING + VAR cAttachListTextFile AS STRING + VAR cAttachListEmbeddedFile AS STRING + + VAR lSendBinaryBase64 AS LOGICAL INIT FALSE + VAR lSendBinaryUUEncoded AS LOGICAL INIT FALSE + VAR lSendEnrichedText AS LOGICAL INIT FALSE + VAR lUnicode AS LOGICAL INIT FALSE + VAR lHtml AS LOGICAL INIT FALSE + VAR cAlternateText AS STRING + VAR cAlternateTextFile AS STRING + VAR lMime AS LOGICAL INIT FALSE // MIME Quoted-Printable Content-Transfer-Encoding + VAR lAskFor8BitMime AS LOGICAL INIT FALSE // ask for 8bit data support when sending MIME + VAR nMultipartSize AS NUMERIC // send multipart messages, breaking attachments on KB boundaries, where is per 1000 bytes + VAR lNoMultipartMessage AS LOGICAL INIT FALSE // do not allow multipart messages + + // NNTP specific options + VAR cGroups AS STRING // list of newsgroups (comma separated) + + // Other options + VAR lXtndXmit AS LOGICAL INIT FALSE // Attempt to use POP3 to transmit when accessing POP3 first + VAR lHelp AS LOGICAL INIT FALSE // displays this help (also -?, /?, -help or /help) + VAR lQuiet AS LOGICAL INIT TRUE // suppresses all output to the screen + VAR lDebug AS LOGICAL INIT FALSE // echoes server communications to a log file or screen (overrides -q if echoes to the screen) + VAR cLogFile AS STRING // log everything but usage to + VAR lLogTimestamp AS LOGICAL INIT FALSE // when -log is used, a timestamp is added to each log line + VAR lLogOverwrite AS LOGICAL INIT FALSE // when -log is used, overwrite the log file + VAR nTimeout AS NUMERIC INIT 60 // set timeout to 'n' seconds. Blat will wait 'n' seconds for server responses + VAR nTry AS NUMERIC INIT 1 // -1 == INFINITE, how many times blat should try to send (1 to 'INFINITE') + VAR lBinary AS LOGICAL INIT FALSE // do not convert ASCII | (pipe, 0x7c) to CrLf in the message body + VAR cHostname AS STRING // select the hostname used to send the message via SMTP this is typically your local machine name + VAR lRaw AS LOGICAL INIT FALSE // do not add CR/LF after headers + VAR nDelay AS NUMERIC INIT 1 // wait x seconds between messages being sent when used with -maxnames or -multipart + VAR cCommentChar AS STRING // use this character to mark the start of commments in options files and recipient list files. The default is ; + VAR lSuperDebug AS LOGICAL INIT FALSE // hex/ascii dump the data between Blat and the server + VAR lSuperDebugText AS LOGICAL INIT FALSE // ascii dump the data between Blat and the server + + // Other + VAR lIgnoreErrors AS LOGICAL INIT FALSE + + + // Methods + METHOD Send() + METHOD Command( cCommand ) VIRTUAL + METHOD Error() + METHOD ErrorString() + METHOD GetErrors() + METHOD Check() + METHOD BlatError() + METHOD BlatErrorString() + METHOD TranslateBlatError( nErr ) + METHOD GetCommand() + METHOD GetVersion() INLINE ::cVersion + METHOD GetBlatVersion() INLINE ::cBlatVersion + +ENDCLASS + +METHOD Send() CLASS HBBlat + ::Check() + + IF ::nError == BLAT_SUCCESS + ::nBlatError := hb_BlatSend( ::cCommand ) + IF ::nBlatError <> 0 + ::nError := ::nBlatError + ::cError := BLAT_TEXT_ERROR + ELSE + ::cError := BLAT_TEXT_SUCCESS + ENDIF + ::cBlatError := ::TranslateBlatError( ::nBlatError ) + ENDIF + +RETURN ::nError + +PROCEDURE Check() CLASS HBBlat + + // Not using registry, so every parameter has to be explicity set + // No control apart from existence + + IF !::lChecked + + ::cCommand := "" + + // The Basics ---------------------------------- + + // to + IF ::cTO == NIL .AND. ::cTOFile == NIL .AND. !::lToUndiscloseRecipients + ::nError := BLAT_ERR_MISSING_TO + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_TO ) + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + IF !( ::cTO == NIL ) + ::cCommand += " -to " + ::cTo + ENDIF + ENDIF + + // tofile - optional + IF !( ::cTOFile == NIL ) + IF !File( ::cTOFile ) + ::nError := BLAT_ERR_MISSING_TOFILE + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_TOFILE ) + ": " + ::cToFile + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += " -tf " + ::cToFile + ENDIF + ENDIF + + // cc - optional + IF !( ::cCC == NIL ) + ::cCommand += " -cc " + ::cCC + ENDIF + + // ccfile - optional + IF !( ::cCCFile == NIL ) + IF !File( ::cCCFile ) + ::nError := BLAT_ERR_MISSING_CCFILE + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_CCFILE ) + ": " + ::cCCFile + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += " -cf " + ::cCCFile + ENDIF + ENDIF + + // bcc - optional + IF !( ::cBCC == NIL ) + ::cCommand += " -bcc " + ::cBCC + ENDIF + + // bccfile - optional + IF !( ::cBCCFile == NIL ) + IF !File( ::cBCCFile ) + ::nError := BLAT_ERR_MISSING_BCCFILE + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_BCCFILE ) + ": " + ::cBCCFile + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += " -bf " + ::cBCCFile + ENDIF + ENDIF + + // nMaxNames + IF !( ::nMaxNames == NIL ) .AND. ::nMaxNames > 0 + ::cCommand += ' -maxNames ' + LTrim( Str( ::nMaxNames ) ) + ENDIF + + // lToUndiscloseRecipients + IF ::lToUndiscloseRecipients + ::cCommand += " -ur" + ENDIF + + // cSubject - optional + IF !( ::cSubject == NIL ) + ::cCommand += ' -subject "' + ::cSubject + '"' + ENDIF + + // lSuppressSubject + IF ::lSuppressSubject + ::cCommand += " -ss" + ENDIF + + // cSubjectFile - optional + IF !( ::cSubjectFile == NIL ) + IF !File( ::cSubjectFile ) + ::nError := BLAT_ERR_MISSING_SUBJECTFILE + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_SUBJECTFILE ) + ": " + ::cSubjectFile + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += ' -sf ' + ::cSubjectFile + ENDIF + ENDIF + + // bodyfile - optional + IF !( ::cBodyFile == NIL ) + IF !File( ::cBodyFile ) + ::nError := BLAT_ERR_MISSING_BODYFILE + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_BODYFILE ) + ": " + ::cBodyFile + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += " -bodyF " + ::cBodyFile + ENDIF + ENDIF + + // body + IF ::cBody == NIL .AND. ::cBodyFile == NIL + ::nError := BLAT_ERR_MISSING_BODY + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_BODY ) + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + IF HB_ISSTRING( ::cBody ) + ::cCommand += ' -body "' + ::cBody + '"' + ELSE + IF !File( ::cBodyFile ) + ::nError := BLAT_ERR_MISSING_BODYFILE + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_BODYFILE ) + ": " + ::cBodyFile + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += " -bodyF " + ::cBodyFile + ENDIF + ENDIF + ENDIF + + // cSignatureFile + IF !( ::cSignatureFile == NIL ) + IF !File( ::cSignatureFile ) + ::nError := BLAT_ERR_MISSING_SIGNATUREFILE + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_SIGNATUREFILE ) + ": " + ::cSignatureFile + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += ' -sig ' + ::cSignatureFile + ENDIF + ENDIF + + // cTagFile + IF !( ::cTagFile == NIL ) + IF !File( ::cTagFile ) + ::nError := BLAT_ERR_MISSING_TAGFILE + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_TAGFILE ) + ": " + ::cTagFile + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += ' -tag ' + ::cTagFile + ENDIF + ENDIF + + // cPostScriptumFile - optional + IF !( ::cPostScriptumFile == NIL ) + IF !File( ::cPostScriptumFile ) + ::nError := BLAT_ERR_MISSING_PSFILE + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_PSFILE ) + ": " + ::cPostScriptumFile + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += ' -ps ' + ::cPostScriptumFile + ENDIF + ENDIF + + // Registry overrides ------------------------------ + + // cProfile + IF !( ::cProfile == NIL ) + ::cCommand += " -p " + ::cProfile + ENDIF + + // lShowProfiles + IF ::lShowProfiles + ::cCommand += " -profile" + ENDIF + + // cServerSMTP + IF ::cServerSMTP == NIL + ::nError := BLAT_ERR_MISSING_SERVERSMTP + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_SERVERSMTP ) + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += " -server " + ::cServerSMTP + ENDIF + + // cServerNNTP + IF !( ::cServerNNTP == NIL ) + ::cCommand += " -serverNNTP " + ::cServerNNTP + ENDIF + + // cServerPOP3 + IF !( ::cServerPOP3 == NIL ) + ::cCommand += " -serverPOP3 " + ::cServerPOP3 + ENDIF + + // cServerIMAP + IF !( ::cServerIMAP == NIL ) + ::cCommand += " -serverIMAP " + ::cServerIMAP + ENDIF + + // cMailFrom + IF !( ::cMailFrom == NIL ) + ::cCommand += " -mailfrom " + ::cMailFrom + ENDIF + + // cFrom + IF ::cFrom == NIL + ::nError := BLAT_ERR_MISSING_FROM + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_FROM ) + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += " -f " + ::cFrom + ENDIF + + // cReplyTo + IF !( ::cReplyTo == NIL ) + ::cCommand += ' -replyto ' + ::cReplyTo + ENDIF + + // cReplyTo + IF !( ::cReplyTo == NIL ) + ::cCommand += ' -replyto ' + ::cReplyTo + ENDIF + + // cReturnPath + IF !( ::cReturnPath == NIL ) + ::cCommand += ' -returnpath ' + ::cReturnPath + ENDIF + + // cSender + IF !( ::cSender == NIL ) + ::cCommand += ' -sender ' + ::cSender + ENDIF + + // nPortSMTP + IF !( ::nPortSMTP == NIL ) .AND. ::nPortSMTP > 0 + ::cCommand += ' -portSMTP ' + LTrim( Str( ::nPortSMTP ) ) + ENDIF + + // nPortNNTP + IF !( ::nPortNNTP == NIL ) .AND. ::nPortNNTP > 0 + ::cCommand += ' -portNNTP ' + LTrim( Str( ::nPortNNTP ) ) + ENDIF + + // nPortPOP3 + IF !( ::nPortPOP3 == NIL ) .AND. ::nPortPOP3 > 0 + ::cCommand += ' -portPOP3 ' + LTrim( Str( ::nPortPOP3 ) ) + ENDIF + + // nPortIMAP + IF !( ::nPortIMAP == NIL ) .AND. ::nPortIMAP > 0 + ::cCommand += ' -portIMAP ' + LTrim( Str( ::nPortIMAP ) ) + ENDIF + + // cUserAUTH + IF !( ::cUserAUTH == NIL ) + ::cCommand += ' -u ' + ::cUserAUTH + ENDIF + + // cPasswordAUTH + IF !( ::cPasswordAUTH == NIL ) + ::cCommand += ' -pw ' + ::cPasswordAUTH + ENDIF + + // cUserPOP3 + IF !( ::cUserPOP3 == NIL ) + ::cCommand += ' -pu ' + ::cUserPOP3 + ENDIF + + // cPasswordPOP3 + IF !( ::cPasswordPOP3 == NIL ) + ::cCommand += ' -ppw ' + ::cPasswordPOP3 + ENDIF + + // cUserIMAP + IF !( ::cUserIMAP == NIL ) + ::cCommand += ' -iu ' + ::cUserIMAP + ENDIF + + // cPasswordIMAP + IF !( ::cPasswordIMAP == NIL ) + ::cCommand += ' -ipw ' + ::cPasswordIMAP + ENDIF + + // Miscellaneous RFC header switches ---------------------- + + // cOrganization + IF !( ::cOrganization == NIL ) + ::cCommand += ' -organization ' + ::cOrganization + ENDIF + + // cUserAgent + IF !( ::cUserAgent == NIL ) + ::cCommand += ' -ua ' + ::cUserAgent + ENDIF + + // cXHeader + IF !( ::cXHeader == NIL ) + ::cCommand += ' -x ' + ::cXHeader + ENDIF + + // NoBlatHeader + IF ::lNoBlatXHeader + ::cCommand += " -noh2" + ENDIF + + // No Blat Home Page + // Add only if ::lNoBlatXHeader is FALSE + IF !::lNoBlatXHeader + IF ::lNoBlatHomePage + ::cCommand += " -noh" + ENDIF + ENDIF + + // lRequestDisposition + IF ::lRequestDisposition + ::cCommand += " -d" + ENDIF + + // lRequestReturnReceipt + IF ::lRequestReturnReceipt + ::cCommand += " -r" + ENDIF + + // cCharSet + IF !( ::cCharSet == NIL ) + ::cCommand += ' -charset ' + ::cCharSet + ENDIF + + // cUserHeader1 + IF !( ::cUserHeader1 == NIL ) + ::cCommand += ' -a1 ' + ::cUserHeader1 + ENDIF + + // cUserHeader2 + IF !( ::cUserHeader2 == NIL ) + ::cCommand += ' -a2 ' + ::cUserHeader2 + ENDIF + + // cDSN + IF HB_ISSTRING( ::cDSN ) + IF ( "n" $ Lower( ::cDSN ) .OR. "s" $ Lower( ::cDSN ) .OR. ; + "f" $ Lower( ::cDSN ) .OR. "d" $ Lower( ::cDSN ) ) + ::cCommand += " -dsn " + ::cDSN + ELSE + ::nError := BLAT_ERR_WRONG_DSN + ::cError := ::TranslateBlatError( BLAT_ERR_WRONG_DSN ) + ": " + ::cDSN + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ENDIF + ENDIF + + // lEHBase64 + IF ::lEHBase64 + ::cCommand += " -hdrencb" + ENDIF + + // lEHQuoted + IF ::lEHQuoted + ::cCommand += " -hdrencq" + ENDIF + + // lHighPriority / lLowPriority - if both == FALSE, priority is standard + IF ::lHighPriority + ::cCommand += " -priority 1" + ELSEIF ::lLowPriority + ::cCommand += " -priority 0" + ENDIF + + // nSensitivity + IF !( ::nSensitivity == NIL ) .AND. aScan( { 0, 1, 2 }, ::nSensitivity ) > 0 + ::cCommand += " -sensitivity " + LTrim( Str( ::nSensitivity ) ) + ENDIF + + // Attachment and encoding options -------- + + // Attach Binary Files + IF !Empty( ::aAttachBinFiles ) + IF ::cAttachBinFiles == NIL + ::cAttachBinFiles := "" + ELSE + ::cAttachBinFiles += "," + ENDIF + ::cAttachBinFiles += ArrayToString( ::aAttachBinFiles ) + ENDIF + IF HB_ISSTRING( ::cAttachBinFiles ) + ::cCommand += " -attach " + ::cAttachBinFiles + ENDIF + + // Attach Text Files + IF !Empty( ::aAttachTextFiles ) + IF ::cAttachTextFiles == NIL + ::cAttachTextFiles := "" + ELSE + ::cAttachTextFiles += "," + ENDIF + ::cAttachTextFiles += ArrayToString( ::aAttachTextFiles ) + ENDIF + IF HB_ISSTRING( ::cAttachTextFiles ) + ::cCommand += " -attacht " + ::cAttachTextFiles + ENDIF + + // Attach INLINE Files + IF !Empty( ::aAttachInlineFiles ) + IF ::cAttachInlineFiles == NIL + ::cAttachInlineFiles := "" + ELSE + ::cAttachInlineFiles += "," + ENDIF + ::cAttachInlineFiles += ArrayToString( ::aAttachInlineFiles ) + ENDIF + IF HB_ISSTRING( ::cAttachInlineFiles ) + ::cCommand += " -attachi " + ::cAttachInlineFiles + ENDIF + + // Attach Html Embedded Files + IF !Empty( ::aHtmlEmbeddedFiles ) + IF ::cHtmlEmbeddedFiles == NIL + ::cHtmlEmbeddedFiles := "" + ELSE + ::cHtmlEmbeddedFiles += "," + ENDIF + ::cHtmlEmbeddedFiles += ArrayToString( ::aHtmlEmbeddedFiles ) + ENDIF + IF HB_ISSTRING( ::cHtmlEmbeddedFiles ) + ::cCommand += " -embed " + ::cHtmlEmbeddedFiles + ENDIF + + // cAttachListBinFile - optional + IF !( ::cAttachListBinFile == NIL ) + IF !File( ::cAttachListBinFile ) + ::nError := BLAT_ERR_MISSING_ATTACHLISTBINFILE + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_ATTACHLISTBINFILE ) + ": " + ::cAttachListBinFile + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += " -af " + ::cAttachListBinFile + ENDIF + ENDIF + + // cAttachListTextFile - optional + IF !( ::cAttachListTextFile == NIL ) + IF !File( ::cAttachListTextFile ) + ::nError := BLAT_ERR_MISSING_ATTACHLISTTEXTFILE + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_ATTACHLISTTEXTFILE ) + ": " + ::cAttachListTextFile + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += " -atf " + ::cAttachListTextFile + ENDIF + ENDIF + + // cAttachListEmbeddedFile - optional + IF !( ::cAttachListEmbeddedFile == NIL ) + IF !File( ::cAttachListEmbeddedFile ) + ::nError := BLAT_ERR_MISSING_ATTACHLISTEMBEDDEDFILE + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_ATTACHLISTEMBEDDEDFILE ) + ": " + ::cAttachListEmbeddedFile + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += " -aef " + ::cAttachListEmbeddedFile + ENDIF + ENDIF + + // lSendBinaryBase64 - optional + IF ::lSendBinaryBase64 + ::cCommand += " -base64" + ENDIF + + // lSendBinaryUUEncoded - optional + IF ::lSendBinaryUUEncoded + ::cCommand += " -uuencode" + ENDIF + + // lSendEnrichedText - optional + IF ::lSendEnrichedText + ::cCommand += " -enriched" + ENDIF + + // lUnicode - optional + IF ::lUnicode + ::cCommand += " -unicode" + ENDIF + + // lHtml - optional + IF ::lHtml + ::cCommand += " -html" + ENDIF + + // cAlternateText - optional + IF !( ::cAlternateText == NIL ) + ::cCommand += ' -alttext ' + ::cAlternateText + ENDIF + + // cAlternateTextFile - optional + IF !( ::cAlternateTextFile == NIL ) + IF !File( ::cAlternateTextFile ) + ::nError := BLAT_ERR_MISSING_ALTERNATETEXTFILE + ::cError := ::TranslateBlatError( BLAT_ERR_MISSING_ALTERNATETEXTFILE ) + ": " + ::cAlternateTextFile + aAdd( ::aErrors, { ::nError, ::cError } ) + IF !::lIgnoreErrors + RETURN + ENDIF + ELSE + ::cCommand += " -alttextf " + ::cAlternateTextFile + ENDIF + ENDIF + + // lMime - optional + IF ::lMime + ::cCommand += " -mime" + ENDIF + + // lAskFor8BitMime - optional + IF ::lAskFor8BitMime + ::cCommand += " -8bitmime" + ENDIF + + // nMultipartSize - optional + IF !( ::nMultipartSize == NIL ) .AND. ::nMultipartSize > 0 + ::cCommand += " -multipart " + LTrim( Str( ::nMultipartSize ) ) + ENDIF + + // lNoMultipartMessage - optional + IF ::lNoMultipartMessage + ::cCommand += " -nomps" + ENDIF + + // NNTP specific options ------------------ + + // cGroups - optional + IF HB_ISSTRING( ::cGroups ) + ::cCommand += " -groups " + ::cGroups + ENDIF + + // Other options -------------------------- + + // lXtndXmit + IF ::lXtndXmit + ::cCommand += " -xtndxmit" + ENDIF + + /* NOT IMPLEMENTED + // lHelp + IF ::lHelp + ::cCommand += " -h" + ENDIF + */ + + // lQuiet + IF ::lQuiet + ::cCommand += " -q" + ENDIF + + // lDebug + IF ::lDebug + ::cCommand += " -debug" + ENDIF + + // cLogFile + IF !( ::cLogFile == NIL ) + ::cCommand += ' -log ' + ::cLogFile + ENDIF + + // lLogTimestamp + IF ::lLogTimestamp + ::cCommand += " -timestamp" + ENDIF + + // lLogOverwrite + IF ::lLogOverwrite + ::cCommand += " -overwritelog" + ENDIF + + // nTimeout + IF !( ::nTimeout == NIL ) .AND. ::nTimeout > 0 + ::cCommand += " -ti " + LTrim( Str( ::nTimeout ) ) + ENDIF + + // nTry + IF !( ::nTry == NIL ) + IF ::nTry == BLAT_TRY_INFINITE_KEY + ::cCommand += " -try " + BLAT_TRY_INFINITE_VALUE + ELSEIF ::nTry >= 0 + ::cCommand += " -try " + LTrim( Str( ::nTry ) ) + ENDIF + ENDIF + + // lBinary + IF ::lBinary + ::cCommand += " -binary" + ENDIF + + // cHostname + IF !( ::cHostname == NIL ) + ::cCommand += ' -hostname ' + ::cHostname + ENDIF + + // lRaw + IF ::lRaw + ::cCommand += " -raw" + ENDIF + + // nDelay + IF !( ::nDelay == NIL ) .AND. ::nDelay > 0 + ::cCommand += " -delay " + LTrim( Str( ::nDelay ) ) + ENDIF + + // cCommentChar + IF !( ::cCommentChar == NIL ) + ::cCommand += ' -comment ' + ::cCommentChar + ENDIF + + // lSuperDebug + IF ::lSuperDebug + ::cCommand += " -superdebug" + ENDIF + + // lSuperDebugT + IF ::lSuperDebugText + ::cCommand += " -superdebugT" + ENDIF + + + //-------------------------------------------------- + + // Check done + ::lChecked := TRUE + + ENDIF + +RETURN + +METHOD GetCommand() CLASS HBBlat + IF !::lChecked + ::Check() + ENDIF +RETURN ::cCommand + +METHOD Error() CLASS HBBlat +RETURN ::nError + +METHOD ErrorString() CLASS HBBlat +RETURN ::cError + +METHOD GetErrors() CLASS HBBlat +RETURN ::aErrors + +METHOD BlatError() CLASS HBBlat +RETURN ::nBlatError + +METHOD BlatErrorString() CLASS HBBlat +RETURN ::cBlatError + +METHOD TranslateBlatError( nErr ) CLASS HBBlat + LOCAL cError, nPos + // TODO: add function that returns language error array + LOCAL aErrors := { ; + { BLAT_ERR_UNKNONW , BLAT_TEXT_ERR_UNKNOWN } ,; + { BLAT_SUCCESS , BLAT_TEXT_SUCCESS } ,; + { BLAT_ERR_MESSAGE_NOT_ACCEPTED , BLAT_TEXT_ERR_MESSAGE_NOT_ACCEPTED } ,; + { BLAT_ERR_MISSING_FROM , BLAT_TEXT_ERR_MISSING_FROM } ,; + { BLAT_ERR_MISSING_TO , BLAT_TEXT_ERR_MISSING_TO } ,; + { BLAT_ERR_MISSING_TOFILE , BLAT_TEXT_ERR_MISSING_TOFILE } ,; + { BLAT_ERR_MISSING_BODY , BLAT_TEXT_ERR_MISSING_BODY } ,; + { BLAT_ERR_MISSING_BODYFILE , BLAT_TEXT_ERR_MISSING_BODYFILE } ,; + { BLAT_ERR_MISSING_SERVERSMTP , BLAT_TEXT_ERR_MISSING_SERVERSMTP } ,; + { BLAT_ERR_MISSING_SUBJECTFILE , BLAT_TEXT_ERR_MISSING_SUBJECTFILE } ,; + { BLAT_ERR_MISSING_CCFILE , BLAT_TEXT_ERR_MISSING_CCFILE } ,; + { BLAT_ERR_MISSING_BCCFILE , BLAT_TEXT_ERR_MISSING_BCCFILE } ,; + { BLAT_ERR_MISSING_PSFILE , BLAT_TEXT_ERR_MISSING_PSFILE } ,; + { BLAT_ERR_MISSING_ATTACHLISTBINFILE , BLAT_TEXT_ERR_MISSING_ATTACHLISTBINFILE } ,; + { BLAT_ERR_MISSING_ATTACHLISTTEXTFILE , BLAT_TEXT_ERR_MISSING_ATTACHLISTTEXTFILE } ,; + { BLAT_ERR_MISSING_ATTACHLISTEMBEDDEDFILE , BLAT_TEXT_ERR_MISSING_ATTACHLISTEMBEDDEDFILE } ,; + { BLAT_ERR_MISSING_ALTERNATETEXTFILE , BLAT_TEXT_ERR_MISSING_ALTERNATETEXTFILE } ,; + { BLAT_ERR_MISSING_SIGNATUREFILE , BLAT_TEXT_ERR_MISSING_SIGNATUREFILE } ,; + { BLAT_ERR_MISSING_TAGFILE , BLAT_TEXT_ERR_MISSING_TAGFILE } ,; + { BLAT_ERR_WRONG_DSN , BLAT_TEXT_ERR_WRONG_DSN } ,; + { BLAT_ERR_LOGICAL_EXPECTED , BLAT_TEXT_ERR_LOGICAL_EXPECTED } ,; + { BLAT_ERR_STRING_EXPECTED , BLAT_TEXT_ERR_STRING_EXPECTED } ; + } + + nPos := aScan( aErrors, {|e| e[1] == nErr }, 2 ) + IF nPos == 0 + cError := aErrors[ 1, 2 ] // BLAT_TEXT_ERR_UNKNOWN has to be first error + ELSE + cError := aErrors[ nPos, 2 ] + ENDIF + + /* + SWITCH nErr + CASE BLAT_SUCCESS + cError := BLAT_TEXT_SUCCESS + EXIT + + CASE BLAT_ERR_MESSAGE_NOT_ACCEPTED + cError := BLAT_TEXT_ERR_MESSAGE_NOT_ACCEPTED + EXIT + + CASE + + OTHERWISE + cError := BLAT_TEXT_ERR_UNKNOWN + END + */ + +RETURN cError + +STATIC FUNCTION ArrayToString( aArray ) + LOCAL cString := "" + LOCAL nLen := Len( aArray ) + LOCAL cElem + + FOR EACH cElem IN aArray + cString += cElem + IIF( cElem:__enumIndex() < nLen, ",", "" ) + NEXT +RETURN cString diff --git a/harbour/contrib/hbblat/blatwrp.c b/harbour/contrib/hbblat/blatwrp.c new file mode 100644 index 0000000000..21b5076aff --- /dev/null +++ b/harbour/contrib/hbblat/blatwrp.c @@ -0,0 +1,95 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * BLAT wrapper library interface code. + * + * Copyright 2007-2009 Francesco Saverio Giudice + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +/* NOTE: we need this to prevent base types redefinition */ +#define _CLIPDEFS_H + +#define HB_OS_WIN_32_USED + +#include "hbapi.h" +#include "hbapiitm.h" +#include "hbstack.h" +#include "hbapierr.h" +#include "hbapifs.h" + +/* ---------------------------------------------------------------------------*/ + +extern int cSend( char *szCmd ); + +/* ---------------------------------------------------------------------------*/ + +HB_FUNC( HB_BLATSEND ) // void BlatSend( char *szCmd ) +{ + if ( hb_pcount() == 1 && + hb_parinfo( 1 ) & HB_IT_STRING + ) + { + char *szCmd; + int iRet; + + /* Retrieve command */ + szCmd = hb_parcx( 1 ); + + /* Send command to blat */ + iRet = cSend( szCmd ); + + /* Return result */ + hb_retni( iRet ); + + } + else + // Parameter error + hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); +} + +/* ---------------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbblat/common.mak b/harbour/contrib/hbblat/common.mak new file mode 100644 index 0000000000..70e9be0dcb --- /dev/null +++ b/harbour/contrib/hbblat/common.mak @@ -0,0 +1,17 @@ +# +# $Id$ +# + +LIBNAME = $(LIBPREF)hbblat + +LIB_PATH = $(LIB_DIR)\$(LIBNAME)$(LIBEXT) + +PRG_HEADERS = \ + blat.ch \ + +LIB_OBJS = \ + $(OBJ_DIR)\blatwrp$(OBJEXT) \ + $(OBJ_DIR)\blatcls$(OBJEXT) \ + +all: \ + $(LIB_PATH) \ diff --git a/harbour/contrib/hbblat/hbblat.ch b/harbour/contrib/hbblat/hbblat.ch new file mode 100644 index 0000000000..a1f961d24f --- /dev/null +++ b/harbour/contrib/hbblat/hbblat.ch @@ -0,0 +1,200 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * BLAT wrapper library interface code. + * + * Copyright 2007-2009 Francesco Saverio Giudice + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +/* +Code Description + +2 The server actively denied our connection. + The mail server doesn't like the sender name. + +1 Unable to open SMTP socket + SMTP get line did not return 220 + command unable to write to socket + Server does not like To: address + Mail server error accepting message data. + +0 OK +1 File name (message text) not given +1 Bad argument given +2 File (message text) does not exist +3 Error reading the file (message text) or attached file +4 File (message text) not of type FILE_TYPE_DISK +5 Error Reading File (message text) + +12 -server or -f options not specified and not found in registry +13 Error opening temporary file in temp directory + +Gensock Error Code Descriptions + + case 4001: printf("Error: Malloc failed (possibly out of memory)."); break; + case 4002: printf("Error: Error sending data."); break; + case 4003: printf("Error: Error initializing gensock.dll."); break; + case 4004: printf("Error: Version not supported."); break; + case 4005: printf("Error: The winsock version specified by gensock is not supported by this winsock.dll."); break; + case 4006: printf("Error: Network not ready."); break; + case 4007: printf("Error: Can't resolve (mailserver) hostname."); break; + case 4008: printf("Error: Can't create a socket (too many simultaneous links?)"); break; + case 4009: printf("Error: Error reading socket."); break; + case 4010: printf("Error: Not a socket."); break; + case 4011: printf("Error: Busy."); break; + case 4012: printf("Error: Error closing socket."); break; + case 4013: printf("Error: Wait a bit (possible timeout)."); break; + case 4014: printf("Error: Can't resolve service."); break; + case 4015: printf("Error: Can't connect to mailserver (timed out if winsock.dll error 10060)"); break; + case 4016: printf("Error: Connection to mailserver was dropped."); break; + case 4017: printf("Error: Mail server refused connection."); break; + default: printf("error %d in function '%s'", retval, function); + + + +*/ + + +#ifndef _HBBLAT_CH +#define _HBBLAT_CH + + +/* + Numeric Errors +*/ + +#define BLAT_ERR_UNKNONW -1 + +#define BLAT_SUCCESS 0 +#define BLAT_ERR_MESSAGE_NOT_ACCEPTED 1 + +#define BLAT_ERR_MISSING_FROM 1000 +#define BLAT_ERR_MISSING_TO 1001 +#define BLAT_ERR_MISSING_TOFILE 1002 +#define BLAT_ERR_MISSING_BODY 1003 +#define BLAT_ERR_MISSING_BODYFILE 1004 +#define BLAT_ERR_MISSING_SERVERSMTP 1005 +#define BLAT_ERR_MISSING_SUBJECTFILE 1006 +#define BLAT_ERR_MISSING_CCFILE 1007 +#define BLAT_ERR_MISSING_BCCFILE 1008 +#define BLAT_ERR_MISSING_PSFILE 1009 +#define BLAT_ERR_MISSING_ATTACHLISTBINFILE 1010 +#define BLAT_ERR_MISSING_ATTACHLISTTEXTFILE 1011 +#define BLAT_ERR_MISSING_ATTACHLISTEMBEDDEDFILE 1012 +#define BLAT_ERR_MISSING_ALTERNATETEXTFILE 1013 +#define BLAT_ERR_MISSING_SIGNATUREFILE 1014 +#define BLAT_ERR_MISSING_TAGFILE 1015 +#define BLAT_ERR_WRONG_DSN 1016 + +#define BLAT_ERR_LOGICAL_EXPECTED 2000 +#define BLAT_ERR_STRING_EXPECTED 2001 + +/* + Text Errors +*/ + +#define BLAT_TEXT_ERROR "Blat Error" + +#define BLAT_TEXT_ERR_UNKNOWN "Unknown error" + +#define BLAT_TEXT_SUCCESS "Ok" +#define BLAT_TEXT_ERR_MESSAGE_NOT_ACCEPTED "Message not accepted by server" + +#define BLAT_TEXT_ERR_MISSING_FROM "Missing From: parameter" +#define BLAT_TEXT_ERR_MISSING_TO "Missing To: parameter" +#define BLAT_TEXT_ERR_MISSING_TOFILE "ToFile file not found" +#define BLAT_TEXT_ERR_MISSING_BODY "Missing message body" +#define BLAT_TEXT_ERR_MISSING_BODYFILE "Message body file not found" +#define BLAT_TEXT_ERR_MISSING_SERVERSMTP "Missing SMTP server" +#define BLAT_TEXT_ERR_MISSING_SUBJECTFILE "Subject file not found" +#define BLAT_TEXT_ERR_MISSING_CCFILE "CC file not found" +#define BLAT_TEXT_ERR_MISSING_BCCFILE "BCC file not found" +#define BLAT_TEXT_ERR_MISSING_PSFILE "PS file not found" +#define BLAT_TEXT_ERR_MISSING_ATTACHLISTBINFILE "Attach List Bin file not found" +#define BLAT_TEXT_ERR_MISSING_ATTACHLISTTEXTFILE "Attach List Text file not found" +#define BLAT_TEXT_ERR_MISSING_ATTACHLISTEMBEDDEDFILE "Attach List Embedded file not found" +#define BLAT_TEXT_ERR_MISSING_ALTERNATETEXTFILE "Alternate Text file not found" +#define BLAT_TEXT_ERR_MISSING_SIGNATUREFILE "Signature file not found" +#define BLAT_TEXT_ERR_MISSING_TAGFILE "Tag file not found" +#define BLAT_TEXT_ERR_WRONG_DSN "Wrong DSN values (admitted: n, s, f, d)" + +#define BLAT_TEXT_ERR_LOGICAL_EXPECTED "Logical var expected" +#define BLAT_TEXT_ERR_STRING_EXPECTED "String var expected" + + +/* + BLAT ERRORS +*/ + +#define BLAT_ERR_CANT_MALLOC 4001 +#define BLAT_ERR_SENDING_DATA 4002 +#define BLAT_ERR_INITIALIZING 4003 +#define BLAT_ERR_VER_NOT_SUPPORTED 4004 +#define BLAT_ERR_EINVAL 4005 +#define BLAT_ERR_SYS_NOT_READY 4006 +#define BLAT_ERR_CANT_RESOLVE_HOSTNAME 4007 +#define BLAT_ERR_CANT_GET_SOCKET 4008 +#define BLAT_ERR_READING_SOCKET 4009 +#define BLAT_ERR_NOT_A_SOCKET 4010 +#define BLAT_ERR_BUSY 4011 +#define BLAT_ERR_CLOSING 4012 +#define BLAT_WAIT_A_BIT 4013 +#define BLAT_ERR_CANT_RESOLVE_SERVICE 4014 +#define BLAT_ERR_CANT_CONNECT 4015 +#define BLAT_ERR_NOT_CONNECTED 4016 +#define BLAT_ERR_CONNECTION_REFUSED 4017 + +#define BLAT_ERR_NO_ERROR_CODE -5000 /* this is returned by misbehaving stacks that + * fail, but don't set an error code + */ + + +#define BLAT_TRY_INFINITE_KEY -1 +#define BLAT_TRY_INFINITE_VALUE 'INFINITE' + + +#endif // _HBBLAT_CH \ No newline at end of file diff --git a/harbour/contrib/hbblat/make_b32.bat b/harbour/contrib/hbblat/make_b32.bat new file mode 100644 index 0000000000..e207907f88 --- /dev/null +++ b/harbour/contrib/hbblat/make_b32.bat @@ -0,0 +1,66 @@ +@echo off +rem +rem $Id$ +rem + +if not "%HB_DIR_BLAT%" == "" goto DIR_OK + +echo --------------------------------------------------------------- +echo IMPORTANT: You'll need blat dll from here: +echo http://blat.sourceforge.net/ (Download section) +echo and this envvar to be set to successfully build this library: +echo set HB_DIR_BLAT=C:\Blat +echo --------------------------------------------------------------- +goto POST_EXIT + +:DIR_OK + +set CFLAGS= +set _HB_DLL_NAME=blat +set _HB_DLL_DIR=%HB_DIR_BLAT%\full + +rem --------------------------------------------------------------- + +call ..\mtpl_b32.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 + +rem --------------------------------------------------------------- + +if "%HB_DIR_BLAT%" == "" goto POST_EXIT + +set _HB_INSTALL_PREFIX=%HB_INSTALL_PREFIX% +if "%_HB_INSTALL_PREFIX%" == "" set _HB_INSTALL_PREFIX=..\.. +set _HB_LIB_INSTALL=%HB_LIB_INSTALL% +if "%_HB_LIB_INSTALL%" == "" set _HB_LIB_INSTALL=%_HB_INSTALL_PREFIX%\lib + +if "%1" == "clean" goto POST_CLEAN +if "%1" == "Clean" goto POST_CLEAN +if "%1" == "CLEAN" goto POST_CLEAN +if "%1" == "install" goto POST_INSTALL +if "%1" == "Install" goto POST_INSTALL +if "%1" == "INSTALL" goto POST_INSTALL + +:POST_BUILD + + implib -a ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib "%_HB_DLL_DIR%\%_HB_DLL_NAME%.dll" >> %_HB_MAKELOG% + goto POST_EXIT + +:POST_CLEAN + + if exist ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib del ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib > nul + if exist ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.exp del ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.exp > nul + if exist %_HB_LIB_INSTALL%\%_HB_DLL_NAME%.lib del %_HB_LIB_INSTALL%\%_HB_DLL_NAME%.lib > nul + goto POST_EXIT + +:POST_INSTALL + + if exist %_HB_LIB_INSTALL%\%_HB_DLL_NAME%.lib del %_HB_LIB_INSTALL%\%_HB_DLL_NAME%.lib + if exist ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib copy ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib %_HB_LIB_INSTALL% + goto POST_EXIT + +:POST_EXIT + +set CFLAGS= +set _HB_DLL_NAME= +set _HB_DLL_DIR= +set _HB_INSTALL_PREFIX= +set _HB_LIB_INSTALL= diff --git a/harbour/contrib/hbblat/make_vc.bat b/harbour/contrib/hbblat/make_vc.bat new file mode 100644 index 0000000000..91e820b14b --- /dev/null +++ b/harbour/contrib/hbblat/make_vc.bat @@ -0,0 +1,65 @@ +@echo off +rem +rem $Id$ +rem + +if not "%HB_DIR_BLAT%" == "" goto DIR_OK + +echo --------------------------------------------------------------- +echo IMPORTANT: You'll need blat dll from here: +echo http://blat.sourceforge.net/ (Download section) +echo and this envvar to be set to successfully build this library: +echo set HB_DIR_BLAT=C:\Blat +echo --------------------------------------------------------------- +goto POST_EXIT + +:DIR_OK + +set CFLAGS= +set _HB_DLL_NAME=blat +set _HB_DLL_DIR=%HB_DIR_BLAT%\full + +rem --------------------------------------------------------------- + +call ..\mtpl_vc.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 + +rem --------------------------------------------------------------- + +set _HB_INSTALL_PREFIX=%HB_INSTALL_PREFIX% +if "%_HB_INSTALL_PREFIX%" == "" set _HB_INSTALL_PREFIX=..\.. +set _HB_LIB_INSTALL=%HB_LIB_INSTALL% +if "%_HB_LIB_INSTALL%" == "" set _HB_LIB_INSTALL=%_HB_INSTALL_PREFIX%\lib + +if "%1" == "clean" goto POST_CLEAN +if "%1" == "Clean" goto POST_CLEAN +if "%1" == "CLEAN" goto POST_CLEAN +if "%1" == "install" goto POST_INSTALL +if "%1" == "Install" goto POST_INSTALL +if "%1" == "INSTALL" goto POST_INSTALL + +:POST_BUILD + + rem Use supplied .lib file. + if not exist ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib copy "%HB_DIR_BLAT%\full\%_HB_DLL_NAME%.lib" ..\..\lib\%_HB_CC_NAME%\%_HB_DLL_NAME%.lib > nul + goto POST_EXIT + +:POST_CLEAN + + if exist ..\..\lib\%_HB_CC_NAME%\%HB_DLL_NAME%.lib del ..\..\lib\%_HB_CC_NAME%\%HB_DLL_NAME%.lib > nul + if exist ..\..\lib\%_HB_CC_NAME%\%HB_DLL_NAME%.exp del ..\..\lib\%_HB_CC_NAME%\%HB_DLL_NAME%.exp > nul + if exist %_HB_LIB_INSTALL%\%HB_DLL_NAME%.lib del %_HB_LIB_INSTALL%\%HB_DLL_NAME%.lib > nul + goto POST_EXIT + +:POST_INSTALL + + if exist %_HB_LIB_INSTALL%\%HB_DLL_NAME%.lib del %_HB_LIB_INSTALL%\%HB_DLL_NAME%.lib + if exist ..\..\lib\%_HB_CC_NAME%\%HB_DLL_NAME%.lib copy ..\..\lib\%_HB_CC_NAME%\%HB_DLL_NAME%.lib %_HB_LIB_INSTALL% + goto POST_EXIT + +:POST_EXIT + +set CFLAGS= +set _HB_DLL_NAME= +set _HB_DLL_DIR= +set _HB_INSTALL_PREFIX= +set _HB_LIB_INSTALL= diff --git a/harbour/contrib/hbblat/syntax.txt b/harbour/contrib/hbblat/syntax.txt new file mode 100644 index 0000000000..88230ccfd9 --- /dev/null +++ b/harbour/contrib/hbblat/syntax.txt @@ -0,0 +1,183 @@ +Blat v2.6.2 w/GSS encryption (build : Feb 25 2007 12:06:19) + + +Win32 console utility to send mail via SMTP or post to usenet via NNTP +by P.Mendes,M.Neal,G.Vollant,T.Charron,T.Musson,H.Pesonen,A.Donchey,C.Hyde + http://www.blat.net +syntax: + Blat -to [optional switches (see below)] + + Blat -SaveSettings -f -server + [-port ] [-try ] [-profile ] + [-u ] [-pwd ] + or + Blat -install [[[]]] [-q] + + Blat -profile [-delete | ""] [profile1] [profileN] [-q] + Blat -h + +-------------------------------- Installation --------------------------------- +-SaveSettings : store common settings to the Windows Registry. Takes the + same parameters as -install, and is only for SMTP settings. +-install[SMTP|NNTP|POP3|IMAP] [ + [ [ [ []]]]] + : set server, sender, number of tries and port for profile + ( and may be replaced by '-') + port defaults are SMTP=25, NNTP=119, POP3=110, IMAP=143 + default profile can be specified with a '-' + username and/or password may be stored to the registry + order of options is specific + use -installNNTP for storing NNTP information + use -installPOP3 for storing POP3 information + (sender and try are ignored, use '-' in place of these) + use -installIMAP for storing IMAP information + (sender and try are ignored, use '-' in place of these) + +--------------------------------- The Basics ---------------------------------- + : file with the message body to be sent + if your message body is on the command line, use a hyphen (-) + as your first argument, and -body followed by your message + if your message will come from the console/keyboard, use the + hyphen as your first argument, but do not use -body option. +-of : text file containing more options (also -optionfile) +-to : recipient list (also -t) (comma separated) +-tf : recipient list filename +-cc : carbon copy recipient list (also -c) (comma separated) +-cf : cc recipient list filename +-bcc : blind carbon copy recipient list (also -b) + (comma separated) +-bf : bcc recipient list filename +-maxNames : send to groups of number of recipients +-ur : set To: header to Undisclosed Recipients if not using the + -to and -cc options +-subject : subject line, surround with quotes to include spaces(also -s) +-ss : suppress subject line if not defined +-sf : file containing subject line +-bodyF : file containing the message body +-body : message body, surround with quotes (") to include spaces +-sig : text file containing your email signature +-tag : text file containing taglines, to be randomly chosen +-ps : final message text, possibly for unsubscribe instructions + +----------------------------- Registry overrides ------------------------------ +-p : send with server, user, and port defined in + : use username and password if defined in +-profile : list all profiles in the Registry +-server : specify SMTP server to be used (optionally, addr:port) +-serverSMTP + : same as -server +-serverNNTP + : specify NNTP server to be used (optionally, addr:port) +-serverPOP3 + : specify POP3 server to be used (optionally, addr:port) + when POP3 access is required before sending email +-serverIMAP + : specify IMAP server to be used (optionally, addr:port) + when IMAP access is required before sending email +-f : override the default sender address (must be known to server) +-i : a 'From:' address, not necessarily known to the server +-port : port to be used on the SMTP server, defaults to SMTP (25) +-portSMTP : same as -port +-portNNTP : port to be used on the NNTP server, defaults to NNTP (119) +-portPOP3 : port to be used on the POP3 server, defaults to POP3 (110) +-portIMAP : port to be used on the IMAP server, defaults to IMAP (110) +-u : username for AUTH LOGIN (use with -pw) +-pw : password for AUTH LOGIN (use with -u) +-pu : username for POP3 LOGIN (use with -ppw) +-ppw : password for POP3 LOGIN (use with -pu) +-iu : username for IMAP LOGIN (use with -ppw) +-ipw : password for IMAP LOGIN (use with -pu) + +---------------------- Miscellaneous RFC header switches ---------------------- +-organization + : Organization field (also -o and -org) +-ua : include User-Agent header line instead of X-Mailer +-x + : custom 'X-' header. eg: -x "X-INFO: Blat is Great!" +-noh : prevent X-Mailer/User-Agent header from showing Blat homepage +-noh2 : prevent X-Mailer header entirely +-d : request disposition notification +-r : request return receipt +-charset : user defined charset. The default is ISO-8859-1 +-a1
: add custom header line at the end of the regular headers +-a2
: same as -a1, for a second custom header line +-dsn : use Delivery Status Notifications (RFC 3461) + n = never, s = successful, f = failure, d = delayed + can be used together, however N takes precedence +-hdrencb : use base64 for encoding headers, if necessary +-hdrencq : use quoted-printable for encoding headers, if necessary +-priority : set message priority 0 for low, 1 for high +-sensitivity : set message sensitity 0 for personal, 1 for private, + 2 for company-confidential + +----------------------- Attachment and encoding options ----------------------- +-attach : attach binary file(s) to message (filenames comma separated) +-attacht : attach text file(s) to message (filenames comma separated) +-attachi : attach text file(s) as INLINE (filenames comma separated) +-embed : embed file(s) in HTML. Object tag in HTML must specify + content-id using cid: tag. eg: +-af : file containing list of binary file(s) to attach (comma + separated) +-atf : file containing list of text file(s) to attach (comma + separated) +-aef : file containing list of embed file(s) to attach (comma + separated) +-base64 : send binary files using base64 (binary MIME) +-uuencode : send binary files UUEncoded +-enriched : send an enriched text message (Content-Type=text/enriched) +-unicode : message body is in 16- or 32-bit Unicode format +-html : send an HTML message (Content-Type=text/html) +-alttext : plain text for use as alternate text +-alttextf : plain text file for use as alternate text +-mime : MIME Quoted-Printable Content-Transfer-Encoding +-8bitmime : ask for 8bit data support when sending MIME +-multipart + : send multipart messages, breaking attachments on + KB boundaries, where is per 1000 bytes +-nomps : do not allow multipart messages + +---------------------------- NNTP specific options ---------------------------- +-groups + : list of newsgroups (comma separated) + +-------------------------------- Other options -------------------------------- +-xtndxmit : Attempt to use POP3 to transmit when accessing POP3 first +-h : displays this help (also -?, /?, -help or /help) +-q : suppresses all output to the screen +-debug : echoes server communications to a log file or screen + (overrides -q if echoes to the screen) +-log : log everything but usage to +-timestamp : when -log is used, a timestamp is added to each log line +-overwritelog : when -log is used, overwrite the log file +-ti : set timeout to 'n' seconds. Blat will wait 'n' seconds for + server responses +-try : how many times blat should try to send (1 to 'INFINITE') +-binary : do not convert ASCII | (pipe, 0x7c) to CrLf in the message + body +-hostname : select the hostname used to send the message via SMTP + this is typically your local machine name +-raw : do not add CR/LF after headers +-delay : wait x seconds between messages being sent when used with + -maxnames or -multipart +-comment : use this character to mark the start of commments in + options files and recipient list files. The default is ; +-superdebug : hex/ascii dump the data between Blat and the server +-superdebugT : ascii dump the data between Blat and the server +------------------------------------------------------------------------------- + +Note that if the '-i' option is used, is included in 'Reply-to:' +and 'Sender:' fields in the header of the message. + +Optionally, the following options can be used instead of the -f and -i +options: + +-mailfrom The RFC 821 MAIL From: statement +-from The RFC 822 From: statement +-replyto The RFC 822 Reply-To: statement +-returnpath The RFC 822 Return-Path: statement +-sender The RFC 822 Sender: statement + +For backward consistency, the -f and -i options have precedence over these +RFC 822 defined options. If both -f and -i options are omitted then the +RFC 821 MAIL FROM statement will be defaulted to use the installation-defined +default sender address. diff --git a/harbour/contrib/hbblat/tests/blatcmd.prg b/harbour/contrib/hbblat/tests/blatcmd.prg new file mode 100644 index 0000000000..ee9e16e8ba --- /dev/null +++ b/harbour/contrib/hbblat/tests/blatcmd.prg @@ -0,0 +1,110 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * HBBLAT sample blat pure command interface + * + * Copyright 2007-2009 Francesco Saverio Giudice + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + + +#include "common.ch" + +PROCEDURE Main() + + LOCAL cCmd := GetParams() + LOCAL nRet + + ? "Simple BLAT Command interface" + ? "Paramenters: ", cCmd + IF Empty( cCmd ) + ? "Try with -? option" + ELSE + ? "Sending parameters to blat" + nRet := hb_BlatSend( cCmd ) + ? nRet + ENDIF + +RETURN + +STATIC FUNCTION GetParams() + LOCAL cCmd := WAPI_GetCommandLine() + LOCAL n + + // Search first space after program name + n := AT( " ", cCmd ) + IF n > 0 + // remove program name + cCmd := SubStr( cCmd, n + 1 ) + ELSE + // empty params list + cCmd := "" + ENDIF + +RETURN cCmd + +//----------------------------------------- + +// TODO: move to hbwin lib +#pragma BEGINDUMP + +#define HB_OS_WIN_32_USED + +#include + +#include "hbapi.h" +#include "hbapiitm.h" +#include "hbstack.h" +#include "hbapierr.h" +#include "hbapifs.h" + +/* GetCommandLine() returns entire command line as a single string */ +HB_FUNC( WAPI_GETCOMMANDLINE ) +{ + hb_retc( GetCommandLine() ); +} + +#pragma ENDDUMP diff --git a/harbour/contrib/hbblat/tests/blattest.prg b/harbour/contrib/hbblat/tests/blattest.prg new file mode 100644 index 0000000000..760a711e35 --- /dev/null +++ b/harbour/contrib/hbblat/tests/blattest.prg @@ -0,0 +1,127 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * HBBLAT sample test file + * + * Copyright 2007-2009 Francesco Saverio Giudice + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + + +#include "common.ch" +#include "hbblat.ch" + +#define ADDRESS_FROM "yourname@domain.com" // put here your address from +#define ADDRESS_TO "hbblat_test@fsgiudice.com" // this mail can be used for tests +//#define ADDRESS_CC "another@domain.com" + +#define SERVER_SMTP "your.stmpserver.com" // put your smtp server here + +PROCEDURE Main() + + //LOCAL cCmd + LOCAL nRet + LOCAL oBlat := HBBlat():New() + + ? + ? "HBBlat test" + + WITH OBJECT oBlat + :cFrom := ADDRESS_FROM + :cTo := ADDRESS_TO + //:cUserAUTH := "myaccount@mydomain.org" + //:cPasswordAUTH := "mypassword" + //:cHostname := "mail.anydomain.com" + //:cCC := ADDRESS_CC + //:cCCFile := "f_cc.txt" + //:cBCC := "info@fsgiudice.com" + //:cBCCFile := "f_bcc.txt" + //:cBodyFile := "c.bat" + :cBody := e"Body part\n\rEnd Body" + :cServerSMTP := SERVER_SMTP + :cSubject := "Test from Blat" + //:lSuppressSubject := TRUE + //:cSubjectFile := "f_subjectline.txt" + //:lToUndiscloseRecipients := TRUE + :cPostScriptumFile := "f_ps.txt" + :lRequestDisposition := TRUE // does not work ??? + :lRequestReturnReceipt := TRUE + + :cAttachTextFiles := "f_subjectline.txt" + :aAttachTextFiles := { "f_ps.txt", "blattest.prg", "blatcmd.prg" } + :cAttachListTextFile := "f_listtext.txt" + + :cLogFile := "log.txt" + :lLogTimestamp := TRUE + :lDebug := TRUE + :lLogOverwrite := TRUE + + //:lSuperDebug := TRUE // This display internal checking + + END + + ? "Checking options ..." + //oBlat:Check() + ? + ? "Command .........: ", oBlat:GetCommand() // Not necessary - this show complete command line sent to blat + + ? "Sending mail ..." + ? "Return Value ....: ", nRet := oBlat:Send() + + ? "Error String ....: ", oBlat:ErrorString() + + // Blat error + ? "Blat Error ......: ", oBlat:BlatError() + ? "Blat Error String: ", oBlat:BlatErrorString() + + ? + ? IIF( nRet == 0, "mail sent correctly!", "mail NOT sent" ) + ? + +RETURN + +//----------------------------------------- + diff --git a/harbour/contrib/hbblat/tests/f_listtext.txt b/harbour/contrib/hbblat/tests/f_listtext.txt new file mode 100644 index 0000000000..184df9f603 --- /dev/null +++ b/harbour/contrib/hbblat/tests/f_listtext.txt @@ -0,0 +1,2 @@ +f_sample.txt +f_sample1.txt diff --git a/harbour/contrib/hbblat/tests/f_ps.txt b/harbour/contrib/hbblat/tests/f_ps.txt new file mode 100644 index 0000000000..6ba9e7df4e --- /dev/null +++ b/harbour/contrib/hbblat/tests/f_ps.txt @@ -0,0 +1,2 @@ +This is postscriptum file. +Have to be added to end of body text. diff --git a/harbour/contrib/hbblat/tests/f_sample.txt b/harbour/contrib/hbblat/tests/f_sample.txt new file mode 100644 index 0000000000..2e85aeda34 --- /dev/null +++ b/harbour/contrib/hbblat/tests/f_sample.txt @@ -0,0 +1 @@ +Sample text diff --git a/harbour/contrib/hbblat/tests/f_sample1.txt b/harbour/contrib/hbblat/tests/f_sample1.txt new file mode 100644 index 0000000000..5b92faa0b3 --- /dev/null +++ b/harbour/contrib/hbblat/tests/f_sample1.txt @@ -0,0 +1 @@ +Sample text 1 \ No newline at end of file diff --git a/harbour/contrib/hbblat/tests/f_subjectline.txt b/harbour/contrib/hbblat/tests/f_subjectline.txt new file mode 100644 index 0000000000..b997b2c235 --- /dev/null +++ b/harbour/contrib/hbblat/tests/f_subjectline.txt @@ -0,0 +1 @@ +Subject from file diff --git a/harbour/contrib/hbblat/tests/hbmk.bat b/harbour/contrib/hbblat/tests/hbmk.bat new file mode 100644 index 0000000000..ff64f3bcbd --- /dev/null +++ b/harbour/contrib/hbblat/tests/hbmk.bat @@ -0,0 +1,7 @@ +@rem +@rem $Id$ +@rem + +@set HB_USER_LIBS=hbblat.lib blat.lib + +@..\..\..\bin\hbmk %* -I.. \ No newline at end of file diff --git a/harbour/contrib/make_b32_all.bat b/harbour/contrib/make_b32_all.bat index 19fabbb901..df9e3182b5 100644 --- a/harbour/contrib/make_b32_all.bat +++ b/harbour/contrib/make_b32_all.bat @@ -55,6 +55,7 @@ for %%n in ( %_HB_DIRS% ) do %COMSPEC% /c %_HB_BATWORKER% %%n %1 %2 %3 %4 %5 %6 set _HB_DIRS=rddado rddsql xhb if not "%HB_INC_ALLEGRO%%HB_DIR_ALLEGRO%" == "" set _HB_DIRS=%_HB_DIRS% gtalleg if not "%HB_INC_APOLLO%%HB_DIR_APOLLO%" == "" set _HB_DIRS=%_HB_DIRS% hbapollo +if not "%HB_DIR_BLAT%" == "" set _HB_DIRS=%_HB_DIRS% hbblat if not "%HB_INC_CURL%%HB_DIR_CURL%" == "" set _HB_DIRS=%_HB_DIRS% hbcurl if not "%HB_INC_FIREBIRD%%HB_DIR_FIREBIRD%" == "" set _HB_DIRS=%_HB_DIRS% hbfbird if not "%HB_INC_FREEIMAGE%%HB_DIR_FREEIMAGE%" == "" set _HB_DIRS=%_HB_DIRS% hbfimage @@ -79,4 +80,4 @@ del %_HB_BATWORKER% > nul set _HB_DIRS= set _HB_BATWORKER= -set HB_SHOW_ERRORS= +set HB_SHOW_ERRORS= \ No newline at end of file diff --git a/harbour/contrib/make_vc_all.bat b/harbour/contrib/make_vc_all.bat index bf74b1f191..746c1a3e8d 100644 --- a/harbour/contrib/make_vc_all.bat +++ b/harbour/contrib/make_vc_all.bat @@ -55,6 +55,7 @@ for %%n in ( %_HB_DIRS% ) do %COMSPEC% /c %_HB_BATWORKER% %%n %1 %2 %3 %4 %5 %6 set _HB_DIRS=rddado rddsql xhb if not "%HB_INC_ALLEGRO%%HB_DIR_ALLEGRO%" == "" set _HB_DIRS=%_HB_DIRS% gtalleg if not "%HB_INC_APOLLO%%HB_DIR_APOLLO%" == "" set _HB_DIRS=%_HB_DIRS% hbapollo +if not "%HB_DIR_BLAT%" == "" set _HB_DIRS=%_HB_DIRS% hbblat if not "%HB_INC_CURL%%HB_DIR_CURL%" == "" set _HB_DIRS=%_HB_DIRS% hbcurl if not "%HB_INC_FIREBIRD%%HB_DIR_FIREBIRD%" == "" set _HB_DIRS=%_HB_DIRS% hbfbird if not "%HB_INC_FREEIMAGE%%HB_DIR_FREEIMAGE%" == "" set _HB_DIRS=%_HB_DIRS% hbfimage @@ -79,4 +80,4 @@ del %_HB_BATWORKER% > nul set _HB_DIRS= set _HB_BATWORKER= -set HB_SHOW_ERRORS= +set HB_SHOW_ERRORS= \ No newline at end of file diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index efb76bbc1a..4c26451f0e 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -6635,7 +6635,7 @@ static void hb_vmPushStatic( USHORT uiStatic ) static void hb_vmPushStaticByRef( USHORT uiStatic ) { HB_STACK_TLS_PRELOAD - PHB_ITEM pTop, pBase + PHB_ITEM pTop, pBase; HB_TRACE(HB_TR_DEBUG, ("hb_vmPushStaticByRef(%hu)", uiStatic));