X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fsmtp%2Fsmtp_clienthandlers.h;h=64a405d99b6923e91617e22640a612cf758912ab;hb=a5e759daa03e43dfdd940e96c13cded7ba8de39c;hp=ce7f7b9e627d8f9ce7ea054f1b41e937c5a0af72;hpb=7e7b550e3d5de53fdf4b8c46833af5df9a159729;p=citadel.git diff --git a/citadel/modules/smtp/smtp_clienthandlers.h b/citadel/modules/smtp/smtp_clienthandlers.h index ce7f7b9e6..64a405d99 100644 --- a/citadel/modules/smtp/smtp_clienthandlers.h +++ b/citadel/modules/smtp/smtp_clienthandlers.h @@ -1,5 +1,24 @@ +/* + * + * Copyright (c) 1998-2012 by the citadel.org team + * + * This program is open source 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 3 of the License, 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 program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + typedef enum _eSMTP_C_States { - eConnect, + eConnectMX, eEHLO, eHELO, eSMTPAuth, @@ -19,6 +38,8 @@ typedef struct _stmp_out_msg { long n; AsyncIO IO; long CXFlags; + int IDestructQueItem; + int nRemain; eSMTP_C_States State; @@ -38,11 +59,14 @@ typedef struct _stmp_out_msg { ParsedURL *Relay; ParsedURL *pCurrRelay; StrBuf *msgtext; + StrBuf *QMsgData; const char *envelope_from; + char user[1024]; char node[1024]; char name[1024]; char mailfrom[1024]; + long SendLogin; long Flags; } SmtpOutMsg; @@ -52,7 +76,7 @@ typedef eNextState (*SMTPSendHandler)(SmtpOutMsg *Msg); SMTPReadHandler ReadHandlers[eMaxSMTPC]; SMTPSendHandler SendHandlers[eMaxSMTPC]; -const ConstStr ReadErrors[eMaxSMTPC]; +const ConstStr ReadErrors[eMaxSMTPC+1]; const double SMTP_C_ReadTimeouts[eMaxSMTPC]; const double SMTP_C_SendTimeouts[eMaxSMTPC]; const double SMTP_C_ConnTimeout; @@ -60,8 +84,59 @@ const double SMTP_C_ConnTimeout; #define F_RELAY (1<<0) /* we have a Relay host configuration */ #define F_HAVE_FALLBACK (1<<1) /* we have a fallback host configuration */ #define F_FALLBACK (1<<2) -#define F_HAVE_MX (1<<3) /* we have a list of mx records to go through. */ +#define F_HAVE_MX (1<<3) /* we have a list of mx records to go through.*/ #define F_DIRECT (1<<4) /* no mx record found, trying direct connect. */ +extern int SMTPClientDebugEnabled; int smtp_resolve_recipients(SmtpOutMsg *SendMsg); + +#define QID ((SmtpOutMsg*)IO->Data)->MyQItem->MessageID +#define N ((SmtpOutMsg*)IO->Data)->n +#define DBGLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (SMTPClientDebugEnabled != 0)) + +#define EVS_syslog(LEVEL, FORMAT, ...) \ + DBGLOG(LEVEL) syslog(LEVEL, \ + "SMTPC:IO[%ld]CC[%d]S[%ld][%ld] " FORMAT, \ + IO->ID, CCID, QID, N, __VA_ARGS__) + +#define EVSM_syslog(LEVEL, FORMAT) \ + DBGLOG(LEVEL) syslog(LEVEL, \ + "SMTPC:IO[%ld]CC[%d]S[%ld][%ld] " FORMAT, \ + IO->ID, CCID, QID, N) + +#define EVNCS_syslog(LEVEL, FORMAT, ...) \ + DBGLOG(LEVEL) syslog(LEVEL, "SMTPC:IO[%ld]S[%ld][%ld] " FORMAT, \ + IO->ID, QID, N, __VA_ARGS__) + +#define EVNCSM_syslog(LEVEL, FORMAT) \ + DBGLOG(LEVEL) syslog(LEVEL, "SMTPC:IO[%ld]S[%ld][%ld] " FORMAT, \ + IO->ID, QID, N) + +#define SMTPC_syslog(LEVEL, FORMAT, ...) \ + DBGLOG(LEVEL) syslog(LEVEL, \ + "SMTPCQ: " FORMAT, \ + __VA_ARGS__) + +#define SMTPCM_syslog(LEVEL, FORMAT) \ + DBGLOG(LEVEL) syslog(LEVEL, \ + "SMTPCQ: " FORMAT) + + + +typedef enum __smtpstate { + eSTMPmxlookup, + eSTMPevaluatenext, + eSTMPalookup, + eSTMPaaaalookup, + eSTMPconnecting, + eSTMPsmtp, + eSTMPsmtpdata, + eSTMPsmtpdone, + eSTMPfinished, + eSTMPfailOne, + eSMTPFailTemporary, + eSMTPFailTotal +} smtpstate; + +void SetSMTPState(AsyncIO *IO, smtpstate State);