On Sun, 8 Feb 2009, Bart Mortelmans wrote:
> Hi Davide,
>
> That was quick! :-)
>
>
> I get this response when applying the patch:
> ===
> patching file SMAILUtils.cpp
> patch: **** malformed patch at line 7: }
> ===
OK, lets try as attachment ...
- Davide
diff --git a/SMAILUtils.cpp b/SMAILUtils.cpp
index f7f5dba..6deef5d 100644
--- a/SMAILUtils.cpp
+++ b/SMAILUtils.cpp
@@ -932,12 +932,13 @@ int USmlGetMsgFileSection(SPLF_HANDLE hFSpool, FileSection &FSect)
return 0;
}
-int USmlWriteMailFile(SPLF_HANDLE hFSpool, FILE *pMsgFile)
+int USmlWriteMailFile(SPLF_HANDLE hFSpool, FILE *pMsgFile, bool bMBoxFile)
{
SpoolFileData *pSFD = (SpoolFileData *) hFSpool;
/* Dump message tags */
- if (USmlDumpHeaders(pMsgFile, pSFD->hTagList, SYS_EOL) < 0)
+ if (USmlDumpHeaders(pMsgFile, pSFD->hTagList,
+ bMBoxFile ? SYS_EOL: "\r\n") < 0)
return ErrGetErrorCode();
fputs(SYS_EOL, pMsgFile);
@@ -949,19 +950,26 @@ int USmlWriteMailFile(SPLF_HANDLE hFSpool, FILE *pMsgFile)
ErrSetErrorCode(ERR_FILE_OPEN, pSFD->szMessFilePath);
return ERR_FILE_OPEN;
}
+
+ bool bWantCRLF = !bMBoxFile;
+
#ifdef SYS_CRLF_EOL
- if (MscCopyFile(pMsgFile, pMessFile, pSFD->llMailDataOffset,
- (SYS_OFF_T) -1) < 0) {
- fclose(pMessFile);
- return ErrGetErrorCode();
- }
-#else
- Sys_fseek(pMessFile, pSFD->llMailDataOffset, SEEK_SET);
- if (MscDos2UnixFile(pMsgFile, pMessFile) < 0) {
- fclose(pMessFile);
- return ErrGetErrorCode();
- }
+ if (!bWantCRLF)
+ bWantCRLF = true;
#endif
+ if (bWantCRLF) {
+ if (MscCopyFile(pMsgFile, pMessFile, pSFD->llMailDataOffset,
+ (SYS_OFF_T) -1) < 0) {
+ fclose(pMessFile);
+ return ErrGetErrorCode();
+ }
+ } else {
+ Sys_fseek(pMessFile, pSFD->llMailDataOffset, SEEK_SET);
+ if (MscDos2UnixFile(pMsgFile, pMessFile) < 0) {
+ fclose(pMessFile);
+ return ErrGetErrorCode();
+ }
+ }
fclose(pMessFile);
return 0;
@@ -1120,7 +1128,7 @@ int USmlCreateMBFile(UserInfo *pUI, const char *pszFileName, SPLF_HANDLE hFSpool
SysFree(pszReturnPath);
/* Write mail file */
- if (USmlWriteMailFile(hFSpool, pMBFile) < 0) {
+ if (USmlWriteMailFile(hFSpool, pMBFile, true) < 0) {
ErrorPush();
fclose(pMBFile);
SysRemove(pszFileName);
diff --git a/SMAILUtils.h b/SMAILUtils.h
index 74c0f77..3e1bf73 100644
--- a/SMAILUtils.h
+++ b/SMAILUtils.h
@@ -77,7 +77,7 @@ const char *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);
+int USmlWriteMailFile(SPLF_HANDLE hFSpool, FILE *pMsgFile, bool bMBoxFile = false);
char *USmlGetTag(SPLF_HANDLE hFSpool, const char *pszTagName, TAG_POSITION &TagPosition);
int USmlAddTag(SPLF_HANDLE hFSpool, const char *pszTagName,
const char *pszTagData, int iUpdate = 0);
_______________________________________________
xmail mailing list
[email protected]
http://xmailserver.org/mailman/listinfo/xmail