forked from GerHobbelt/xmail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SMAILUtils.h
127 lines (114 loc) · 6.06 KB
/
SMAILUtils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
* XMail by Davide Libenzi (Intranet and Internet mail server)
* Copyright (C) 1999,..,2010 Davide Libenzi
*
* 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 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
*
* Davide Libenzi <[email protected]>
*
*/
#ifndef _SMAILUTILS_H
#define _SMAILUTILS_H
#define MAX_SPOOL_LINE 1537
#define MAIL_FROM_STR "MAIL FROM:"
#define RCPT_TO_STR "RCPT TO:"
#define SPOOL_FILE_DATA_START "<<MAIL-DATA>>"
#define INVALID_SPLF_HANDLE ((SPLF_HANDLE) 0)
#define TAG_POSITION_INIT ((TAG_POSITION) -1)
#define LMPCF_LOG_ENABLED (1 << 0)
struct SpoolFileHeader {
char szSpoolFile[SYS_MAX_PATH];
char szSMTPDomain[MAX_ADDR_NAME];
char szMessageID[128];
char **ppszInfo;
char **ppszFrom;
char **ppszRcpt;
};
typedef struct SPLF_HANDLE_struct {
} *SPLF_HANDLE;
struct LocalMailProcConfig {
unsigned long ulFlags;
};
typedef void *TAG_POSITION;
int USmlLoadSpoolFileHeader(char const *pszSpoolFile, SpoolFileHeader &SFH);
void USmlCleanupSpoolFileHeader(SpoolFileHeader &SFH);
char *USmlAddrConcat(char const *const *ppszStrings);
char *USmlBuildSendMailFrom(char const *const *ppszFrom, char const *const *ppszRcpt);
char *USmlBuildSendRcptTo(char const *const *ppszFrom, char const *const *ppszRcpt);
SPLF_HANDLE USmlCreateHandle(char const *pszMessFilePath);
void USmlCloseHandle(SPLF_HANDLE hFSpool);
int USmlReloadHandle(SPLF_HANDLE hFSpool);
char const *USmlGetRelayDomain(SPLF_HANDLE hFSpool);
char const *USmlGetSpoolFilePath(SPLF_HANDLE hFSpool);
char const *USmlGetSpoolFile(SPLF_HANDLE hFSpool);
char const *USmlGetSMTPDomain(SPLF_HANDLE hFSpool);
char const *USmlGetSmtpMessageID(SPLF_HANDLE hFSpool);
char const *const *USmlGetInfo(SPLF_HANDLE hFSpool);
char const *const *USmlGetMailFrom(SPLF_HANDLE hFSpool);
char const *USmlMailFrom(SPLF_HANDLE hFSpool);
char const *USmlSendMailFrom(SPLF_HANDLE hFSpool);
char const *const *USmlGetRcptTo(SPLF_HANDLE hFSpool);
char const *USmlRcptTo(SPLF_HANDLE hFSpool);
char const *USmlSendRcptTo(SPLF_HANDLE hFSpool);
SYS_OFF_T USmlMessageSize(SPLF_HANDLE hFSpool);
int USmlSyncChanges(SPLF_HANDLE hFSpool);
int USmlGetMsgFileSection(SPLF_HANDLE hFSpool, FileSection &FSect);
int USmlWriteMailFile(SPLF_HANDLE hFSpool, FILE *pMsgFile, bool bMBoxFile = false);
char *USmlGetTag(SPLF_HANDLE hFSpool, char const *pszTagName, TAG_POSITION &TagPosition);
int USmlAddTag(SPLF_HANDLE hFSpool, char const *pszTagName,
char const *pszTagData, int iUpdate = 0);
int USmlSetTagAddress(SPLF_HANDLE hFSpool, char const *pszTagName, char const *pszAddress);
int USmlMapAddress(char const *pszAddress, char *pszDomain, char *pszName);
int USmlCreateMBFile(UserInfo *pUI, char const *pszFileName, SPLF_HANDLE hFSpool);
int USmlVCreateSpoolFile(SPLF_HANDLE hFSpool, char const *pszFromUser,
char const *pszRcptUser, char const *pszFileName, va_list Headers);
int USmlCreateSpoolFile(SPLF_HANDLE hFSpool, char const *pszFromUser,
char const *pszRcptUser, char const *pszFileName, ...);
int USmlProcessLocalUserMessage(SVRCFG_HANDLE hSvrConfig, UserInfo *pUI, SPLF_HANDLE hFSpool,
QUEUE_HANDLE hQueue, QMSG_HANDLE hMessage,
LocalMailProcConfig &LMPC);
int USmlGetDomainCustomDir(char *pszCustomDir, int iMaxPath, int iFinalSlash);
int USmlGetCmdAliasDir(char *pszAliasDir, int iMaxPath, int iFinalSlash);
int USmlGetCmdAliasFile(char const *pszDomain, char const *pszUser, char *pszAliasFile);
int USmlIsCmdAliasAccount(char const *pszDomain, char const *pszUser, char *pszAliasFile = NULL);
int USmlGetCmdAliasSpoolFile(QUEUE_HANDLE hQueue, QMSG_HANDLE hMessage, char *pszAliasFilePath);
int USmlGetCmdAliasCustomFile(SPLF_HANDLE hFSpool, QUEUE_HANDLE hQueue,
QMSG_HANDLE hMessage, char const *pszDomain, char const *pszUser,
char *pszAliasFilePath);
int USmlDomainCustomFileName(char const *pszDestDomain, char *pszCustFilePath);
int USmlGetDomainCustomFile(char const *pszDestDomain, char *pszCustFilePath);
int USmlCreateCmdAliasDomainDir(char const *pszDomain);
int USmlDeleteCmdAliasDomainDir(char const *pszDomain);
int USmlGetDomainCustomSpoolFile(QUEUE_HANDLE hQueue, QMSG_HANDLE hMessage,
char *pszCustFilePath);
int USmlGetUserCustomSpoolFile(QUEUE_HANDLE hQueue, QMSG_HANDLE hMessage, char *pszCustFilePath);
int USmlGetDomainMsgCustomFile(SPLF_HANDLE hFSpool, QUEUE_HANDLE hQueue,
QMSG_HANDLE hMessage, char const *pszDestDomain,
char *pszCustFilePath);
int USmlGetCustomDomainFile(char const *pszDestDomain, char const *pszCustFilePath);
int USmlSetCustomDomainFile(char const *pszDestDomain, char const *pszCustFilePath);
int USmlCustomizedDomain(char const *pszDestDomain);
int USmlLogMessage(SPLF_HANDLE hFSpool, char const *pszMedium, char const *pszRmtMsgID,
char const *pszParam);
char const *USmlDotAtom(char const *pszStr, char const *pszTop);
int USmlValidAddress(char const *pszAddress, char const *pszTop);
int USmlValidHost(char const *pszHost, char const *pszTop);
int USmlParseAddress(char const *pszAddress, char *pszPreAddr,
int iMaxPreAddress, char *pszEmailAddr, int iMaxAddress);
int USmlDeliverFetchedMsg(char const *pszSyncAddr, char const *pszFetchHdrTags,
char const *pszMailFile);
int USmlMailLoopCheck(SPLF_HANDLE hFSpool, SVRCFG_HANDLE hSvrConfig);
int USmlMessageAuth(SPLF_HANDLE hFSpool, char *pszAuthName, int iSize);
#endif