diff options
author | George Hazan <george.hazan@gmail.com> | 2012-05-26 21:22:43 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-05-26 21:22:43 +0000 |
commit | c5bc8f21d5b87482f737c5ca64a4d46ebe7a2497 (patch) | |
tree | c13b62a3f1224750108aa33919ef6f9a32a2767d /plugins/YAMN/mails | |
parent | 17f839d0a607c05ae390d6306d81ecea19c7ea45 (diff) |
YAMN became partially Unicode
git-svn-id: http://svn.miranda-ng.org/main/trunk@186 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YAMN/mails')
-rw-r--r-- | plugins/YAMN/mails/decode.cpp | 362 | ||||
-rw-r--r-- | plugins/YAMN/mails/mails.cpp | 112 | ||||
-rw-r--r-- | plugins/YAMN/mails/mime.cpp | 180 |
3 files changed, 327 insertions, 327 deletions
diff --git a/plugins/YAMN/mails/decode.cpp b/plugins/YAMN/mails/decode.cpp index 15c23e9f34..704b61c7d3 100644 --- a/plugins/YAMN/mails/decode.cpp +++ b/plugins/YAMN/mails/decode.cpp @@ -10,145 +10,145 @@ struct _tcptable CodePageNamesAll[]=
{
- {_T("ANSI"),_T(""),TRUE,CP_ACP},
- {_T("WINDOWS-1"),_T("250"),0,1250},
- {_T("WINDOWS-1"),_T("251"),0,1251},
- {_T("WINDOWS-1"),_T("252"),0,1252},
- {_T("WINDOWS-1"),_T("253"),0,1253},
- {_T("WINDOWS-1"),_T("254"),0,1254},
- {_T("WINDOWS-1"),_T("255"),0,1255},
- {_T("WINDOWS-1"),_T("256"),0,1256},
- {_T("WINDOWS-1"),_T("257"),0,1257},
- {_T("WINDOWS-1"),_T("258"),0,1258},
- {_T("CP1"),_T("250"),0,1250},
- {_T("CP1"),_T("251"),0,1251},
- {_T("CP1"),_T("252"),0,1252},
- {_T("CP1"),_T("253"),0,1253},
- {_T("CP1"),_T("254"),0,1254},
- {_T("CP1"),_T("255"),0,1255},
- {_T("CP1"),_T("256"),0,1256},
- {_T("CP1"),_T("257"),0,1257},
- {_T("CP1"),_T("258"),0,1258},
- {_T("ANSI-1"),_T("250"),0,1250},
- {_T("ANSI-1"),_T("251"),0,1251},
- {_T("ANSI-1"),_T("252"),0,1252},
- {_T("ANSI-1"),_T("253"),0,1253},
- {_T("ANSI-1"),_T("254"),0,1254},
- {_T("ANSI-1"),_T("255"),0,1255},
- {_T("ANSI-1"),_T("256"),0,1256},
- {_T("ANSI-1"),_T("257"),0,1257},
- {_T("ANSI-1"),_T("258"),0,1258},
- {_T("KOI8"),_T("-R"),0,20866},
- {_T("KOI8"),_T(""),0,20866},
- {_T("KOI8"),_T("-U"),0,21866},
- {_T("KOI8"),_T("-RU"),0,21866},
- {_T("US-"),_T("ASCII"),0,20127},
- {_T("CP"),_T("367"),0,20127},
- {_T("ASCII"),_T(""),0,20127},
- {_T("ASCII"),_T("7"),0,20127},
- {_T("ISO-8859"),_T("-1"),0,28591},
- {_T("ISO-8859"),_T("-2"),0,28592},
- {_T("ISO-8859"),_T("-3"),0,28593},
- {_T("ISO-8859"),_T("-4"),0,28594},
- {_T("ISO-8859"),_T("-5"),0,28595},
- {_T("ISO-8859"),_T("-6"),0,28596},
- {_T("ISO-8859"),_T("-7"),0,28597},
- {_T("ISO-8859"),_T("-8"),0,28598},
- {_T("ISO-8859"),_T("-9"),0,28599},
- {_T("ISO-8859"),_T("-15"),0,28605},
- {_T("ISO_8859"),_T("-1"),0,28591},
- {_T("ISO_8859"),_T("-2"),0,28592},
- {_T("ISO_8859"),_T("-3"),0,28593},
- {_T("ISO_8859"),_T("-4"),0,28594},
- {_T("ISO_8859"),_T("-5"),0,28595},
- {_T("ISO_8859"),_T("-6"),0,28596},
- {_T("ISO_8859"),_T("-7"),0,28597},
- {_T("ISO_8859"),_T("-8"),0,28598},
- {_T("ISO_8859"),_T("-9"),0,28599},
- {_T("ISO_8859"),_T("-15"),0,28605},
- {_T("ISO-"),_T("10646-USC2"),0,1200},
- {_T("ISO-2022"),_T("/2-JP"),0,50220},
- {_T("ISO-2022"),_T("-JP"),0,50221},
- {_T("ISO-2022"),_T("/JIS-JP"),0,50222},
- {_T("ISO-2022"),_T("-KR"),0,50225},
- {_T("ISO-2022"),_T("-CH(SP)"),0,50227},
- {_T("ISO-2022"),_T("-CH(TR)"),0,50229},
- {_T("UTF-"),_T("7"),0,65000},
- {_T("UTF-"),_T("8"),0,65001},
- {_T("ARAB-"),_T("TRANSPARENT"),0,710},
- {_T("ASMO-"),_T("TRANSPARENT"),0,720},
- {_T("ASMO-"),_T("449"),0,709},
- {_T("ASMO-"),_T("708"),0,708},
- {_T("BIG5"),_T(""),0,950},
- {_T("EUC-"),_T("CH(SP)"),0,51936},
- {_T("EUC-"),_T("CH(TR)"),0,51950},
- {_T("EUC-"),_T("JP"),0,51932},
- {_T("EUC-"),_T("KR"),0,51949},
- {_T("GB-"),_T("2312"),0,20936},
- {_T("GB"),_T("2312"),0,20936},
- {_T("HZGB-"),_T("2312"),0,52936},
- {_T("IBM-"),_T("037"),0,37},
- {_T("IBM-"),_T("290"),0,290},
- {_T("IBM-"),_T("437"),0,437},
- {_T("IBM-"),_T("500"),0,500},
- {_T("IBM-"),_T("775"),0,775},
- {_T("IBM-"),_T("850"),0,850},
- {_T("IBM-"),_T("852"),0,852},
- {_T("IBM-"),_T("855"),0,855},
- {_T("IBM-"),_T("857"),0,857},
- {_T("IBM-"),_T("860"),0,860},
- {_T("IBM-"),_T("861"),0,861},
- {_T("IBM-"),_T("862"),0,862},
- {_T("IBM-"),_T("863"),0,863},
- {_T("IBM-"),_T("864"),0,864},
- {_T("IBM-"),_T("865"),0,865},
- {_T("IBM-"),_T("866"),0,866},
- {_T("IBM-"),_T("869"),0,869},
- {_T("IBM-"),_T("870"),0,870},
- {_T("IBM-"),_T("875"),0,875},
- {_T("IBM-"),_T("1026"),0,1026},
- {_T("IBM-"),_T("273"),0,20273},
- {_T("IBM-"),_T("277"),0,20277},
- {_T("IBM-"),_T("278"),0,20278},
- {_T("IBM-"),_T("280"),0,20280},
- {_T("IBM-"),_T("284"),0,20284},
- {_T("IBM-"),_T("285"),0,20285},
- {_T("IBM-"),_T("290"),0,20290},
- {_T("IBM-"),_T("297"),0,20297},
- {_T("IBM-"),_T("420"),0,20420},
- {_T("IBM-"),_T("423"),0,20423},
- {_T("IBM-"),_T("871"),0,20871},
- {_T("IBM-"),_T("880"),0,20880},
- {_T("IBM-"),_T("905"),0,20905},
- {_T("IBM-"),_T("THAI"),0,20838},
- {_T("ISCII-"),_T("DEVANAGARI"),0,57002},
- {_T("ISCII-"),_T("BENGALI"),0,57003},
- {_T("ISCII-"),_T("TAMIL"),0,57004},
- {_T("ISCII-"),_T("TELUGU"),0,57005},
- {_T("ISCII-"),_T("ASSAMESE"),0,57006},
- {_T("ISCII-"),_T("ORIYA"),0,57007},
- {_T("ISCII-"),_T("KANNADA"),0,57008},
- {_T("ISCII-"),_T("MALAYALAM"),0,57009},
- {_T("ISCII-"),_T("GUJARATI"),0,57010},
- {_T("ISCII-"),_T("PUNJABI"),0,57011},
- {_T("KOR-"),_T("JOHAB"),0,1361},
- {_T("KSC-"),_T("5601"),0,1361},
- {_T("MAC-"),_T("ROMAN"),0,10000},
- {_T("MAC-"),_T("JP"),0,10001},
- {_T("MAC-"),_T("CH(SP)(BIG5)"),0,10002},
- {_T("MAC-"),_T("KR"),0,10003},
- {_T("MAC-"),_T("AR"),0,10004},
- {_T("MAC-"),_T("HW"),0,10005},
- {_T("MAC-"),_T("GR"),0,10006},
- {_T("MAC-"),_T("CY"),0,10007},
- {_T("MAC-"),_T("CH(SP)(GB2312)"),0,10008},
- {_T("MAC-"),_T("ROMANIA"),0,10010},
- {_T("MAC-"),_T("UA"),0,10017},
- {_T("MAC-"),_T("TH"),0,10021},
- {_T("MAC-"),_T("LAT2"),0,10029},
- {_T("MAC-"),_T("ICE"),0,10079},
- {_T("MAC-"),_T("TR"),0,10081},
- {_T("MAC-"),_T("CR"),0,10082},
+ { "ANSI", "",TRUE,CP_ACP},
+ { "WINDOWS-1", "250",0,1250},
+ { "WINDOWS-1", "251",0,1251},
+ { "WINDOWS-1", "252",0,1252},
+ { "WINDOWS-1", "253",0,1253},
+ { "WINDOWS-1", "254",0,1254},
+ { "WINDOWS-1", "255",0,1255},
+ { "WINDOWS-1", "256",0,1256},
+ { "WINDOWS-1", "257",0,1257},
+ { "WINDOWS-1", "258",0,1258},
+ { "CP1", "250",0,1250},
+ { "CP1", "251",0,1251},
+ { "CP1", "252",0,1252},
+ { "CP1", "253",0,1253},
+ { "CP1", "254",0,1254},
+ { "CP1", "255",0,1255},
+ { "CP1", "256",0,1256},
+ { "CP1", "257",0,1257},
+ { "CP1", "258",0,1258},
+ { "ANSI-1", "250",0,1250},
+ { "ANSI-1", "251",0,1251},
+ { "ANSI-1", "252",0,1252},
+ { "ANSI-1", "253",0,1253},
+ { "ANSI-1", "254",0,1254},
+ { "ANSI-1", "255",0,1255},
+ { "ANSI-1", "256",0,1256},
+ { "ANSI-1", "257",0,1257},
+ { "ANSI-1", "258",0,1258},
+ { "KOI8", "-R",0,20866},
+ { "KOI8", "",0,20866},
+ { "KOI8", "-U",0,21866},
+ { "KOI8", "-RU",0,21866},
+ { "US-", "ASCII",0,20127},
+ { "CP", "367",0,20127},
+ { "ASCII", "",0,20127},
+ { "ASCII", "7",0,20127},
+ { "ISO-8859", "-1",0,28591},
+ { "ISO-8859", "-2",0,28592},
+ { "ISO-8859", "-3",0,28593},
+ { "ISO-8859", "-4",0,28594},
+ { "ISO-8859", "-5",0,28595},
+ { "ISO-8859", "-6",0,28596},
+ { "ISO-8859", "-7",0,28597},
+ { "ISO-8859", "-8",0,28598},
+ { "ISO-8859", "-9",0,28599},
+ { "ISO-8859", "-15",0,28605},
+ { "ISO_8859", "-1",0,28591},
+ { "ISO_8859", "-2",0,28592},
+ { "ISO_8859", "-3",0,28593},
+ { "ISO_8859", "-4",0,28594},
+ { "ISO_8859", "-5",0,28595},
+ { "ISO_8859", "-6",0,28596},
+ { "ISO_8859", "-7",0,28597},
+ { "ISO_8859", "-8",0,28598},
+ { "ISO_8859", "-9",0,28599},
+ { "ISO_8859", "-15",0,28605},
+ { "ISO-", "10646-USC2",0,1200},
+ { "ISO-2022", "/2-JP",0,50220},
+ { "ISO-2022", "-JP",0,50221},
+ { "ISO-2022", "/JIS-JP",0,50222},
+ { "ISO-2022", "-KR",0,50225},
+ { "ISO-2022", "-CH(SP)",0,50227},
+ { "ISO-2022", "-CH(TR)",0,50229},
+ { "UTF-", "7",0,65000},
+ { "UTF-", "8",0,65001},
+ { "ARAB-", "TRANSPARENT",0,710},
+ { "ASMO-", "TRANSPARENT",0,720},
+ { "ASMO-", "449",0,709},
+ { "ASMO-", "708",0,708},
+ { "BIG5", "",0,950},
+ { "EUC-", "CH(SP)",0,51936},
+ { "EUC-", "CH(TR)",0,51950},
+ { "EUC-", "JP",0,51932},
+ { "EUC-", "KR",0,51949},
+ { "GB-", "2312",0,20936},
+ { "GB", "2312",0,20936},
+ { "HZGB-", "2312",0,52936},
+ { "IBM-", "037",0,37},
+ { "IBM-", "290",0,290},
+ { "IBM-", "437",0,437},
+ { "IBM-", "500",0,500},
+ { "IBM-", "775",0,775},
+ { "IBM-", "850",0,850},
+ { "IBM-", "852",0,852},
+ { "IBM-", "855",0,855},
+ { "IBM-", "857",0,857},
+ { "IBM-", "860",0,860},
+ { "IBM-", "861",0,861},
+ { "IBM-", "862",0,862},
+ { "IBM-", "863",0,863},
+ { "IBM-", "864",0,864},
+ { "IBM-", "865",0,865},
+ { "IBM-", "866",0,866},
+ { "IBM-", "869",0,869},
+ { "IBM-", "870",0,870},
+ { "IBM-", "875",0,875},
+ { "IBM-", "1026",0,1026},
+ { "IBM-", "273",0,20273},
+ { "IBM-", "277",0,20277},
+ { "IBM-", "278",0,20278},
+ { "IBM-", "280",0,20280},
+ { "IBM-", "284",0,20284},
+ { "IBM-", "285",0,20285},
+ { "IBM-", "290",0,20290},
+ { "IBM-", "297",0,20297},
+ { "IBM-", "420",0,20420},
+ { "IBM-", "423",0,20423},
+ { "IBM-", "871",0,20871},
+ { "IBM-", "880",0,20880},
+ { "IBM-", "905",0,20905},
+ { "IBM-", "THAI",0,20838},
+ { "ISCII-", "DEVANAGARI",0,57002},
+ { "ISCII-", "BENGALI",0,57003},
+ { "ISCII-", "TAMIL",0,57004},
+ { "ISCII-", "TELUGU",0,57005},
+ { "ISCII-", "ASSAMESE",0,57006},
+ { "ISCII-", "ORIYA",0,57007},
+ { "ISCII-", "KANNADA",0,57008},
+ { "ISCII-", "MALAYALAM",0,57009},
+ { "ISCII-", "GUJARATI",0,57010},
+ { "ISCII-", "PUNJABI",0,57011},
+ { "KOR-", "JOHAB",0,1361},
+ { "KSC-", "5601",0,1361},
+ { "MAC-", "ROMAN",0,10000},
+ { "MAC-", "JP",0,10001},
+ { "MAC-", "CH(SP)(BIG5)",0,10002},
+ { "MAC-", "KR",0,10003},
+ { "MAC-", "AR",0,10004},
+ { "MAC-", "HW",0,10005},
+ { "MAC-", "GR",0,10006},
+ { "MAC-", "CY",0,10007},
+ { "MAC-", "CH(SP)(GB2312)",0,10008},
+ { "MAC-", "ROMANIA",0,10010},
+ { "MAC-", "UA",0,10017},
+ { "MAC-", "TH",0,10021},
+ { "MAC-", "LAT2",0,10029},
+ { "MAC-", "ICE",0,10079},
+ { "MAC-", "TR",0,10081},
+ { "MAC-", "CR",0,10082}
};
int CPLENALL = (sizeof(CodePageNamesAll)/sizeof(CodePageNamesAll[0]));
@@ -209,13 +209,13 @@ int GetCharsetFromString(char *input,size_t size) char *pin=input;
char *pout,*parser;
- if((size<1) || (parser=pout=new char[size+1])==NULL)
+ if ((size<1) || (parser=pout=new char[size+1])==NULL)
return -1;
while((*pin!=0) && (pin-input< (INT_PTR)size))
{
if ((*pin>='a') && (*pin<='z'))
*parser++=*(pin++)-('a'-'A'); // make it capital
- //else if(*pin=='\"') // this is already done in ExtractFromContentType
+ //else if (*pin=='\"') // this is already done in ExtractFromContentType
// *pin++; //skip the quotes if any
else
*parser++=*pin++;
@@ -228,7 +228,7 @@ int GetCharsetFromString(char *input,size_t size) #endif
for(int i=0;i<CPLENALL;i++){
size_t len = strlen(CodePageNamesAll[i].NameBase);
- if(0==strncmp(pout,CodePageNamesAll[i].NameBase,len)){
+ if (0==strncmp(pout,CodePageNamesAll[i].NameBase,len)){
if (0==strcmp(pout+len,CodePageNamesAll[i].NameSub)){
delete[] pout;
return CodePageNamesAll[i].CP;
@@ -241,17 +241,17 @@ int GetCharsetFromString(char *input,size_t size) int FromHexa(char HexValue,char *DecValue)
{
- if(HexValue>='0' && HexValue<='9')
+ if (HexValue>='0' && HexValue<='9')
{
*DecValue=HexValue-'0';
return 1;
}
- if(HexValue>='A' && HexValue<='F')
+ if (HexValue>='A' && HexValue<='F')
{
*DecValue=HexValue-'A'+10;
return 1;
}
- if(HexValue>='a' && HexValue<='f')
+ if (HexValue>='a' && HexValue<='f')
{
*DecValue=HexValue-'a'+10;
return 1;
@@ -261,32 +261,32 @@ int FromHexa(char HexValue,char *DecValue) int FromBase64(char Base64Value,char *DecValue)
{
- if(Base64Value>='A' && Base64Value<='Z')
+ if (Base64Value>='A' && Base64Value<='Z')
{
*DecValue=Base64Value-'A';
return 1;
}
- if(Base64Value>='a' && Base64Value<='z')
+ if (Base64Value>='a' && Base64Value<='z')
{
*DecValue=Base64Value-'a'+26;
return 1;
}
- if(Base64Value>='0' && Base64Value<='9')
+ if (Base64Value>='0' && Base64Value<='9')
{
*DecValue=Base64Value-'0'+52;
return 1;
}
- if(Base64Value=='+')
+ if (Base64Value=='+')
{
*DecValue=Base64Value-'+'+62;
return 1;
}
- if(Base64Value=='/')
+ if (Base64Value=='/')
{
*DecValue=Base64Value-'/'+63;
return 1;
}
- if(Base64Value=='=')
+ if (Base64Value=='=')
{
*DecValue=0;
return 1;
@@ -301,7 +301,7 @@ int DecodeQuotedPrintable(char *Src,char *Dst,int DstLen, BOOL isQ) DebugLog(DecodeFile,"<Decode Quoted><Input>%s</Input>",Src);
#endif
for(int Counter=0;((char)*Src!=0) && DstLen && (Counter++<DstLen);Src++,Dst++)
- if(*Src=='=')
+ if (*Src=='=')
{
if (!isQ){
if (Src[1]==0x0D){
@@ -315,12 +315,12 @@ int DecodeQuotedPrintable(char *Src,char *Dst,int DstLen, BOOL isQ) }
}
char First,Second;
- if(!FromHexa(*(++Src),&First))
+ if (!FromHexa(*(++Src),&First))
{
*Dst++='=';Src--;
continue;
}
- if(!FromHexa(*(++Src),&Second))
+ if (!FromHexa(*(++Src),&Second))
{
*Dst++='=';Src--;Src--;
continue;
@@ -328,7 +328,7 @@ int DecodeQuotedPrintable(char *Src,char *Dst,int DstLen, BOOL isQ) *Dst=(char)(First)<<4;
*Dst+=Second;
}
- else if(isQ && *Src=='_')
+ else if (isQ && *Src=='_')
*Dst=' ';
else
CopyCharQuotedPrintable: // Yeah. Bad programming stile.
@@ -358,18 +358,18 @@ int DecodeBase64(char *Src,char *Dst,int DstLen) Src++;
continue;
}
- if((!(Result=FromBase64(*Src,MiniResult+Locator)) && (*Src==0)) || Locator++==3) //end_of_str || end_of_4_bytes
+ if ((!(Result=FromBase64(*Src,MiniResult+Locator)) && (*Src==0)) || Locator++==3) //end_of_str || end_of_4_bytes
{
Locator=0; //next write to the first byte
*Dst++=(char)((MiniResult[0]<<2) | (MiniResult[1]>>4));
- if(Dst==End) goto end; //DstLen exceeded?
+ if (Dst==End) goto end; //DstLen exceeded?
*Dst++=(char)((MiniResult[1]<<4) | (MiniResult[2]>>2));
- if(Dst==End) goto end; //someones don't like goto, but not me
+ if (Dst==End) goto end; //someones don't like goto, but not me
*Dst++=(char)((MiniResult[2]<<6) | MiniResult[3]);
- if(!Result && (*Src==0)) goto end; //end of string?
+ if (!Result && (*Src==0)) goto end; //end of string?
MiniResult[0]=MiniResult[1]=MiniResult[2]=MiniResult[3]=0; //zero 4byte buffer for next loop
}
- if(!Result) return 0; //unrecognised character occured
+ if (!Result) return 0; //unrecognised character occured
Src++;
}
end:
@@ -392,30 +392,30 @@ int ConvertStringToUnicode(char *stream,unsigned int cp,WCHAR **out) //codepages, which require to have set 0 in dwFlags parameter when calling MultiByteToWideChar
DWORD CodePagesZeroFlags[]={50220,50221,50222,50225,50227,50229,52936,54936,57002,57003,57004,57005,57006,57007,57008,57009,57010,57011,65000,65001};
- if((cp!=CP_ACP) && (cp!=CP_OEMCP) && (cp!=CP_MACCP) && (cp!=CP_THREAD_ACP) && (cp!=CP_SYMBOL) && (cp!=CP_UTF7) && (cp!=CP_UTF8) && !GetCPInfo(cp,&CPInfo))
+ if ((cp!=CP_ACP) && (cp!=CP_OEMCP) && (cp!=CP_MACCP) && (cp!=CP_THREAD_ACP) && (cp!=CP_SYMBOL) && (cp!=CP_UTF7) && (cp!=CP_UTF8) && !GetCPInfo(cp,&CPInfo))
cp=CP_ACP;
#ifdef DEBUG_DECODECODEPAGE
DebugLog(DecodeFile,"<CodePage #>%d</CodePage #>",cp);
#endif
for(Index=0;Index<sizeof(CodePagesZeroFlags)/sizeof(CodePagesZeroFlags[0]);Index++)
- if(CodePagesZeroFlags[Index]==cp)
+ if (CodePagesZeroFlags[Index]==cp)
{
Index=-1;
break;
}
- if(Index==-1)
+ if (Index==-1)
streamlen=MultiByteToWideChar(cp,0,stream,-1,NULL,0);
else
streamlen=MultiByteToWideChar(cp,MB_USEGLYPHCHARS,stream,-1,NULL,0);
- if(*out!=NULL)
+ if (*out!=NULL)
outlen=wcslen(*out);
else
outlen=0;
temp=new WCHAR[streamlen+outlen+1];
- if(*out!=NULL)
+ if (*out!=NULL)
{
for(dest=temp;*src!=(WCHAR)0;src++,dest++) //copy old string from *out to temp
*dest=*src;
@@ -426,14 +426,14 @@ int ConvertStringToUnicode(char *stream,unsigned int cp,WCHAR **out) dest=temp;
*out=temp;
- if(Index==-1)
+ if (Index==-1)
{
- if(!MultiByteToWideChar(cp,0,stream,-1,dest,streamlen))
+ if (!MultiByteToWideChar(cp,0,stream,-1,dest,streamlen))
return 0;
}
else
{
- if(!MultiByteToWideChar(cp,MB_USEGLYPHCHARS,stream,-1,dest,streamlen))
+ if (!MultiByteToWideChar(cp,MB_USEGLYPHCHARS,stream,-1,dest,streamlen))
return 0;
}
return 1;
@@ -445,22 +445,22 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) char Encoding=0;
char *DecodedResult=NULL;
- if(stream==NULL)
+ if (stream==NULL)
return;
while(WS(start)) start++;
WCHAR *tempstore=0;
- if(!ConvertStringToUnicode(stream,cp,&tempstore))return;
+ if (!ConvertStringToUnicode(stream,cp,&tempstore))return;
size_t tempstoreLength = wcslen(tempstore);
size_t outind = 0;
while(*start!=0){
- if(CODES(start)){
+ if (CODES(start)){
finder=start+2;finderend=finder;
while(!CODED(finderend) && !EOS(finderend)) finderend++;
start = finderend;
- if(CODED(finderend))
+ if (CODED(finderend))
{
Encoding=*(finderend+1);
switch(Encoding)
@@ -473,23 +473,23 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) default:
goto NotEncoded;
}
- if(-1==(cp=(DWORD)GetCharsetFromString(finder,finderend-finder)))
+ if (-1==(cp=(DWORD)GetCharsetFromString(finder,finderend-finder)))
cp=CP_ACP;
- if(Encoding!=0)
+ if (Encoding!=0)
{
int size,codeend;
char *pcodeend;
finder=finderend+2;
- if(CODED(finder))
+ if (CODED(finder))
finder++;
while(WS(finder)) finder++;
finderend=finder;
while(!CODEE(finderend) && !EOS(finderend)) finderend++;
- if(codeend=CODEE(finderend))
+ if (codeend=CODEE(finderend))
pcodeend=finderend;
while(WS(finderend-1)) finderend--;
- if((mode==MIME_MAIL) && (((*finder=='"') && (*(finderend-1)=='"'))))
+ if ((mode==MIME_MAIL) && (((*finder=='"') && (*(finderend-1)=='"'))))
{
finder++;
finderend--;
@@ -509,7 +509,7 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) size=finderend-finder+1+1;
break;
}
- if(DecodedResult!=NULL)
+ if (DecodedResult!=NULL)
delete[] DecodedResult;
DecodedResult=new char[size+1];
switch(Encoding)
@@ -524,9 +524,9 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) break;
}
delete[] oneWordEncoded;
- if(codeend)
+ if (codeend)
finderend=pcodeend+2;
- if(WS(finderend)) //if string continues and there's some whitespace, add space to string that is to be converted
+ if (WS(finderend)) //if string continues and there's some whitespace, add space to string that is to be converted
{
size_t len=strlen(DecodedResult);
DecodedResult[len]=' ';
@@ -534,7 +534,7 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) finderend++;
}
WCHAR *oneWord=0;
- if(ConvertStringToUnicode(DecodedResult,cp,&oneWord)){
+ if (ConvertStringToUnicode(DecodedResult,cp,&oneWord)){
size_t len = wcslen(oneWord);
memcpy(&tempstore[outind],oneWord,len*sizeof(WCHAR));
outind += len;
diff --git a/plugins/YAMN/mails/mails.cpp b/plugins/YAMN/mails/mails.cpp index b99a9fd560..5d3c0e9284 100644 --- a/plugins/YAMN/mails/mails.cpp +++ b/plugins/YAMN/mails/mails.cpp @@ -124,21 +124,21 @@ INT_PTR CreateAccountMailSvc(WPARAM wParam,LPARAM lParam) HYAMNMAIL NewMail;
//test if we are going to initialize members of suitable structure (structures of plugin and YAMN must match)
- if(MailVersion!=YAMN_MAILVERSION)
+ if (MailVersion!=YAMN_MAILVERSION)
return NULL;
- if(Account->Plugin!=NULL)
+ if (Account->Plugin!=NULL)
{
- if(Account->Plugin->MailFcn->NewMailFcnPtr!=NULL)
+ if (Account->Plugin->MailFcn->NewMailFcnPtr!=NULL)
{
//Let plugin create its own structure, which can be derived from CAccount structure
- if(NULL==(NewMail=Account->Plugin->MailFcn->NewMailFcnPtr(Account,YAMN_MAILVERSION)))
+ if (NULL==(NewMail=Account->Plugin->MailFcn->NewMailFcnPtr(Account,YAMN_MAILVERSION)))
return NULL;
}
else
{
//We suggest plugin uses standard CAccount structure, so we create it
- if(NULL==(NewMail=new YAMNMAIL))
+ if (NULL==(NewMail=new YAMNMAIL))
//If not created successfully
return NULL;
NewMail->MailData=NULL;
@@ -155,29 +155,29 @@ INT_PTR DeleteAccountMailSvc(WPARAM wParam,LPARAM lParam) HYAMNMAIL OldMail=(HYAMNMAIL)lParam;
struct CMimeItem *TH;
- if(Plugin->MailFcn!=NULL){
- if(Plugin->MailFcn->DeleteMailFcnPtr!=NULL) {
+ if (Plugin->MailFcn!=NULL){
+ if (Plugin->MailFcn->DeleteMailFcnPtr!=NULL) {
//Let plugin delete its own CMimeMsgQueue derived structure
Plugin->MailFcn->DeleteMailFcnPtr(OldMail);
return 1;
}
}
- if(OldMail->MailData!=NULL) {
- if(OldMail->MailData->Body!=NULL)
+ if (OldMail->MailData!=NULL) {
+ if (OldMail->MailData->Body!=NULL)
delete[] OldMail->MailData->Body;
- if((TH=OldMail->MailData->TranslatedHeader)!=NULL)
+ if ((TH=OldMail->MailData->TranslatedHeader)!=NULL)
for(;OldMail->MailData->TranslatedHeader!=NULL;) {
TH=TH->Next;
- if(OldMail->MailData->TranslatedHeader->name!=NULL)
+ if (OldMail->MailData->TranslatedHeader->name!=NULL)
delete[] OldMail->MailData->TranslatedHeader->name;
- if(OldMail->MailData->TranslatedHeader->value!=NULL)
+ if (OldMail->MailData->TranslatedHeader->value!=NULL)
delete[] OldMail->MailData->TranslatedHeader->value;
delete OldMail->MailData->TranslatedHeader;
OldMail->MailData->TranslatedHeader=TH;
}
delete OldMail->MailData;
}
- if(OldMail->ID!=NULL)
+ if (OldMail->ID!=NULL)
delete[] OldMail->ID;
delete OldMail; //consider mail as standard HYAMNMAIL, not initialized before and use its own destructor
@@ -197,7 +197,7 @@ INT_PTR LoadMailDataSvc(WPARAM wParam,LPARAM lParam) HYAMNMAIL Mail=(HYAMNMAIL)wParam;
DWORD MailVersion=(DWORD)lParam;
- if(MailVersion!=YAMN_MAILDATAVERSION)
+ if (MailVersion!=YAMN_MAILDATAVERSION)
return NULL;
//now we have all data to memory persisting, so no loading is needed
@@ -217,7 +217,7 @@ INT_PTR SaveMailDataSvc(WPARAM wParam,LPARAM lParam) HYAMNMAIL Mail=(HYAMNMAIL)wParam;
DWORD MailVersion=(DWORD)lParam;
- if(MailVersion!=YAMN_MAILDATAVERSION)
+ if (MailVersion!=YAMN_MAILDATAVERSION)
return (INT_PTR)-1;
//now we have all data to memory persisting, so no saving is needed
@@ -234,12 +234,12 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R HYAMNMAIL Parser,ParserPrev;
HYAMNMAIL RemovedOldParser =NULL;
HYAMNMAIL RemovedNewParser =NULL;
- if(RemovedOld!=NULL) *RemovedOld=NULL;
- if(RemovedNew!=NULL) *RemovedNew=NULL;
+ if (RemovedOld!=NULL) *RemovedOld=NULL;
+ if (RemovedNew!=NULL) *RemovedNew=NULL;
for(FinderPrev=NULL,Finder=*OldQueue;Finder!=NULL;)
{
- if(Finder->Flags & YAMN_MSG_DELETED) //if old queue contains deleted mail
+ if (Finder->Flags & YAMN_MSG_DELETED) //if old queue contains deleted mail
{
FinderPrev=Finder;
Finder=Finder->Next; //get next message in old queue for testing
@@ -247,28 +247,28 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R }
for(ParserPrev=NULL,Parser=*NewQueue;Parser!=NULL;ParserPrev=Parser,Parser=Parser->Next)
{
- if(Parser->Flags & YAMN_MSG_DELETED)
+ if (Parser->Flags & YAMN_MSG_DELETED)
continue;
- if(Parser->ID==NULL) //simply ignore the message, that has not filled its ID
+ if (Parser->ID==NULL) //simply ignore the message, that has not filled its ID
continue;
- if(0==strcmp(Parser->ID,Finder->ID)) //search for equal message in new queue
+ if (0==strcmp(Parser->ID,Finder->ID)) //search for equal message in new queue
break;
}
- if(Parser!=NULL) //found equal message in new queue
+ if (Parser!=NULL) //found equal message in new queue
{
- if(Parser==*NewQueue)
+ if (Parser==*NewQueue)
*NewQueue=(*NewQueue)->Next;
else
ParserPrev->Next=Parser->Next;
Finder->Number=Parser->Number; //rewrite the number of current message in old queue
- if(RemovedNew==NULL) //delete from new queue
+ if (RemovedNew==NULL) //delete from new queue
DeleteAccountMailSvc((WPARAM)Account->Plugin,(LPARAM)Parser);
else //or move to RemovedNew
{
- if(RemovedNewParser==NULL) //if it is first mail removed from NewQueue
+ if (RemovedNewParser==NULL) //if it is first mail removed from NewQueue
*RemovedNew=Parser; //set RemovedNew queue to point to first message in removed queue
else
RemovedNewParser->Next=Parser; //else don't forget to show to next message in RemovedNew queue
@@ -280,14 +280,14 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R }
else //a message was already deleted from mailbox
{
- if(Finder==*OldQueue) //if we are at the first item in OldQueue
+ if (Finder==*OldQueue) //if we are at the first item in OldQueue
{
*OldQueue=(*OldQueue)->Next; //set OldQueue to next item
- if(RemovedOld==NULL) //delete from old queue
+ if (RemovedOld==NULL) //delete from old queue
DeleteAccountMailSvc((WPARAM)Account->Plugin,(LPARAM)Finder);
else //or move to RemovedOld
{
- if(RemovedOldParser==NULL) //if it is first mail removed from OldQueue
+ if (RemovedOldParser==NULL) //if it is first mail removed from OldQueue
*RemovedOld=Finder; //set RemovedOld queue to point to first message in removed queue
else
RemovedOldParser->Next=Finder; //else don't forget to show to next message in RemovedNew queue
@@ -299,11 +299,11 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R else
{
FinderPrev->Next=Finder->Next;
- if(RemovedOld==NULL) //delete from old queue
+ if (RemovedOld==NULL) //delete from old queue
DeleteAccountMailSvc((WPARAM)Account->Plugin,(LPARAM)Finder);
else //or move to RemovedOld
{
- if(RemovedOldParser==NULL) //if it is first mail removed from OldQueue
+ if (RemovedOldParser==NULL) //if it is first mail removed from OldQueue
*RemovedOld=Finder; //set RemovedOld queue to point to first message in removed queue
else
RemovedOldParser->Next=Finder; //else don't forget to show to next message in RemovedNew queue
@@ -332,7 +332,7 @@ void WINAPI DeleteMessageFromQueueFcn(HYAMNMAIL *From,HYAMNMAIL Which,int mode=0 DWORD Number=Which->Number;
HYAMNMAIL Parser;
- if(*From==Which)
+ if (*From==Which)
{
Parser=Which->Next;
*From=Parser;
@@ -340,14 +340,14 @@ void WINAPI DeleteMessageFromQueueFcn(HYAMNMAIL *From,HYAMNMAIL Which,int mode=0 else
{
for(Parser=*From;Which!=Parser->Next;Parser=Parser->Next)
- if(mode && (Parser->Number>Number)) Parser->Number--;
- if(mode && (Parser->Number>Number)) Parser->Number--;
+ if (mode && (Parser->Number>Number)) Parser->Number--;
+ if (mode && (Parser->Number>Number)) Parser->Number--;
Parser->Next=Parser->Next->Next;
Parser=Which->Next;
}
- if(mode)
+ if (mode)
for(;Parser!=NULL;Parser=Parser->Next)
- if(Parser->Number>Number) Parser->Number--;
+ if (Parser->Number>Number) Parser->Number--;
}
void DeleteMessagesFromQueue(HYAMNMAIL *From,HYAMNMAIL Which,int mode=0)
@@ -363,7 +363,7 @@ HYAMNMAIL WINAPI FindMessageByIDFcn(HYAMNMAIL From,char *ID) HYAMNMAIL Browser;
for(Browser=From;Browser!=NULL;Browser=Browser->Next)
- if(0==lstrcmp(Browser->ID,ID))
+ if (0==lstrcmpA(Browser->ID,ID))
break;
return Browser;
}
@@ -381,32 +381,32 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) while(ENDLINEWS(finder)) finder++;
//at the start of line
- if(DOTLINE(finder+1)) //at the end of stream
+ if (DOTLINE(finder+1)) //at the end of stream
break;
prev1=finder;
while(*finder!=':' && !EOS(finder)) finder++;
- if(!EOS(finder))
+ if (!EOS(finder))
prev2=finder++;
else
break;
while(WS(finder) && !EOS(finder)) finder++;
- if(!EOS(finder))
+ if (!EOS(finder))
prev3=finder;
else
break;
do
{
- if(ENDLINEWS(finder)) finder+=2; //after endline information continues
+ if (ENDLINEWS(finder)) finder+=2; //after endline information continues
while(!ENDLINE(finder) && !EOS(finder)) finder++;
}while(ENDLINEWS(finder));
- if(Item!=NULL)
+ if (Item!=NULL)
{
- if(NULL==(Item->Next=new struct CMimeItem))
+ if (NULL==(Item->Next=new struct CMimeItem))
break;
Item=Item->Next;
}
@@ -418,30 +418,30 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) Item->Next=NULL;
Item->name=new char [prev2-prev1+1];
- lstrcpyn(Item->name,prev1,prev2-prev1+1);
+ lstrcpynA(Item->name,prev1,prev2-prev1+1);
Item->value=new char [finder-prev3+1];
- lstrcpyn(Item->value,prev3,finder-prev3+1);
+ lstrcpynA(Item->value,prev3,finder-prev3+1);
- if(EOS(finder))
+ if (EOS(finder))
break;
finder++;
- if(ENDLINE(finder)) {
+ if (ENDLINE(finder)) {
finder++;
- if(ENDLINE(finder)) {
+ if (ENDLINE(finder)) {
// end of headers. message body begins
finder++;
- if(ENDLINE(finder))finder++;
+ if (ENDLINE(finder))finder++;
prev1 = finder;
while (!DOTLINE(finder+1))finder++;
if (ENDLINE(finder))finder--;
prev2 = finder;
if (prev2>prev1){ // yes, we have body
- if(NULL==(Item->Next=new struct CMimeItem)) break; // Cant create new item?!
+ if (NULL==(Item->Next=new struct CMimeItem)) break; // Cant create new item?!
Item=Item->Next;
Item->Next=NULL;//just in case;
Item->name=new char[5]; strncpy(Item->name,"Body",5);
Item->value=new char [prev2-prev1];
- lstrcpyn(Item->value,prev1,prev2-prev1-1);
+ lstrcpynA(Item->value,prev1,prev2-prev1-1);
}
break; // there is nothing else
}
@@ -450,7 +450,7 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) }
catch(...)
{
- MessageBox(NULL,"Translate header error","",0);
+ MessageBoxA(NULL,"Translate header error","",0);
}
}
@@ -460,12 +460,12 @@ HYAMNMAIL WINAPI CreateNewDeleteQueueFcn(HYAMNMAIL From) for(FirstMail=NULL;From!=NULL;From=From->Next)
{
- if((From->Flags & (YAMN_MSG_USERDELETE | YAMN_MSG_AUTODELETE)) && !(From->Flags & YAMN_MSG_DELETED))
+ if ((From->Flags & (YAMN_MSG_USERDELETE | YAMN_MSG_AUTODELETE)) && !(From->Flags & YAMN_MSG_DELETED))
{
- if(FirstMail==NULL)
+ if (FirstMail==NULL)
{
FirstMail=Browser=new YAMNMAIL;
- if(FirstMail==NULL)
+ if (FirstMail==NULL)
break;
}
else
@@ -488,9 +488,9 @@ void WINAPI SetRemoveFlagsInQueueFcn(HYAMNMAIL From,DWORD FlagsSet,DWORD FlagsNo for(msgq=(HYAMNMAIL)From;msgq!=NULL;msgq=msgq->Next)
{
- if((FlagsSet==(msgq->Flags & FlagsSet)) && (0==(msgq->Flags & FlagsNotSet)))
+ if ((FlagsSet==(msgq->Flags & FlagsSet)) && (0==(msgq->Flags & FlagsNotSet)))
{
- if(mode)
+ if (mode)
msgq->Flags=msgq->Flags | FlagsToSetRemove;
else
msgq->Flags=msgq->Flags & ~FlagsToSetRemove;
diff --git a/plugins/YAMN/mails/mime.cpp b/plugins/YAMN/mails/mime.cpp index f2364c91c1..294206c7ad 100644 --- a/plugins/YAMN/mails/mime.cpp +++ b/plugins/YAMN/mails/mime.cpp @@ -84,30 +84,30 @@ void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode) {
char *dst;
- if(dest==NULL)
+ if (dest==NULL)
return;
- if(srcstart>=srcend)
+ if (srcstart>=srcend)
return;
- if((mode==MIME_MAIL) && (((*srcstart=='"') && (*(srcend-1)=='"')) || ((*srcstart=='<') && (*(srcend-1)=='>'))))
+ if ((mode==MIME_MAIL) && (((*srcstart=='"') && (*(srcend-1)=='"')) || ((*srcstart=='<') && (*(srcend-1)=='>'))))
{
srcstart++;
srcend--;
}
- if(srcstart>=srcend)
+ if (srcstart>=srcend)
return;
- if(NULL!=*dest)
+ if (NULL!=*dest)
delete[] *dest;
- if(NULL==(*dest=new char[srcend-srcstart+1]))
+ if (NULL==(*dest=new char[srcend-srcstart+1]))
return;
dst=*dest;
for(;srcstart<srcend;dst++,srcstart++)
{
- if(ENDLINE(srcstart))
+ if (ENDLINE(srcstart))
{
while(ENDLINE(srcstart) || WS(srcstart)) srcstart++;
*dst=' ';
@@ -121,31 +121,31 @@ void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode) void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick)
{
- if(finder==NULL)
+ if (finder==NULL)
{
*storeto=*storetonick=NULL;
return;
}
while(WS(finder)) finder++;
- if((*finder)!='<')
+ if ((*finder)!='<')
{
char *finderend=finder+1;
do
{
- if(ENDLINEWS(finderend)) //after endline information continues
+ if (ENDLINEWS(finderend)) //after endline information continues
finderend+=2;
while(!ENDLINE(finderend) && !EOS(finderend)) finderend++; //seek to the end of line or to the end of string
}while(ENDLINEWS(finderend));
finderend--;
while(WS(finderend) || ENDLINE(finderend)) finderend--; //find the end of text, no whitespace
- if(*finderend!='>') //not '>' at the end of line
+ if (*finderend!='>') //not '>' at the end of line
CopyToHeader(finder,finderend+1,storeto,MIME_MAIL);
else //at the end of line, there's '>'
{
char *finder2=finderend;
while((*finder2!='<') && (finder2>finder)) finder2--; //go to matching '<' or to the start
CopyToHeader(finder2,finderend+1,storeto,MIME_MAIL);
- if(*finder2=='<') //if we found '<', the rest copy as from nick
+ if (*finder2=='<') //if we found '<', the rest copy as from nick
{
finder2--;
while(WS(finder2) || ENDLINE(finder2)) finder2--; //parse whitespace
@@ -158,14 +158,14 @@ void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick) char *finderend=finder+1;
do
{
- if(ENDLINEWS(finderend)) //after endline information continues
+ if (ENDLINEWS(finderend)) //after endline information continues
finderend+=2;
while(!ENDLINE(finderend) && (*finderend!='>') && !EOS(finderend)) finderend++; //seek to the matching < or to the end of line or to the end of string
}while(ENDLINEWS(finderend));
CopyToHeader(finder,finderend+1,storeto,MIME_MAIL); //go to first '>' or to the end and copy
finder=finderend+1;
while(WS(finder)) finder++; //parse whitespace
- if(!ENDLINE(finder) && !EOS(finder)) //if there are chars yet, it's nick
+ if (!ENDLINE(finder) && !EOS(finder)) //if there are chars yet, it's nick
{
finderend=finder+1;
while(!ENDLINE(finderend) && !EOS(finderend)) finderend++; //seek to the end of line or to the end of string
@@ -178,7 +178,7 @@ void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick) void ExtractStringFromLine(char *finder,char **storeto)
{
- if(finder==NULL)
+ if (finder==NULL)
{
*storeto=NULL;
return;
@@ -188,7 +188,7 @@ void ExtractStringFromLine(char *finder,char **storeto) do
{
- if(ENDLINEWS(finderend)) finderend++; //after endline information continues
+ if (ENDLINEWS(finderend)) finderend++; //after endline information continues
while(!ENDLINE(finderend) && !EOS(finderend)) finderend++;
}while(ENDLINEWS(finderend));
finderend--;
@@ -201,7 +201,7 @@ char *ExtractFromContentType(char *ContentType,char *value) char *lowered = _strdup(ContentType);
ToLower(lowered);
char *finder=strstr(lowered,value);
- if(finder==NULL){
+ if (finder==NULL){
free (lowered);
return NULL;
}
@@ -213,7 +213,7 @@ char *ExtractFromContentType(char *ContentType,char *value) temp=finder-1;
while((temp>ContentType) && WS(temp)) temp--; //now we have to find, if the word "Charset=" is located after ';' like "; Charset="
- if(*temp!=';' && !ENDLINE(temp) && temp!=ContentType)
+ if (*temp!=';' && !ENDLINE(temp) && temp!=ContentType)
return NULL;
finder=finder+strlen(value); //jump over value string
@@ -226,7 +226,7 @@ char *ExtractFromContentType(char *ContentType,char *value) finder++;
if (*temp=='\"') temp--;
}
- if(NULL==(CopiedString=new char[++temp-finder+1]))
+ if (NULL==(CopiedString=new char[++temp-finder+1]))
return NULL;
for(copier=CopiedString;finder!=temp;*copier++=*finder++); //copy string
*copier=0; //and end it with zero character
@@ -240,9 +240,9 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) {
//at the start of line
//MessageBox(NULL,items->value,items->name,0);
- if(0==_strnicmp(items->name,"From",4))
+ if (0==_strnicmp(items->name,"From",4))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting from>");
@@ -252,9 +252,9 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) DebugLog(DecodeFile,"</Extracting>\n");
#endif
}
- else if(0==_strnicmp(items->name,"Return-Path",11))
+ else if (0==_strnicmp(items->name,"Return-Path",11))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting return-path>");
@@ -264,9 +264,9 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) DebugLog(DecodeFile,"</Extracting>\n");
#endif
}
- else if(0==_strnicmp(items->name,"Subject",7))
+ else if (0==_strnicmp(items->name,"Subject",7))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting subject>");
@@ -276,9 +276,9 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) DebugLog(DecodeFile,"</Extracting>\n");
#endif
}
- else if(0==_strnicmp(items->name,"Body",4))
+ else if (0==_strnicmp(items->name,"Body",4))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting body>");
@@ -288,9 +288,9 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) DebugLog(DecodeFile,"</Extracting>\n");
#endif
}
- else if(0==_strnicmp(items->name,"Date",4))
+ else if (0==_strnicmp(items->name,"Date",4))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting date>");
@@ -300,9 +300,9 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) DebugLog(DecodeFile,"</Extracting>\n");
#endif
}
- else if(0==_strnicmp(items->name,"Content-Type",12))
+ else if (0==_strnicmp(items->name,"Content-Type",12))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
char *ContentType=NULL,*CharSetStr;
@@ -314,41 +314,41 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) DebugLog(DecodeFile,"</Extracting>\n");
#endif
ToLower(ContentType);
- if(NULL!=(CharSetStr=ExtractFromContentType(ContentType,"charset=")))
+ if (NULL!=(CharSetStr=ExtractFromContentType(ContentType,"charset=")))
{
head->CP=GetCharsetFromString(CharSetStr,strlen(CharSetStr));
delete[] CharSetStr;
}
delete[] ContentType;
}
- else if(0==_strnicmp(items->name,"Importance",10))
+ else if (0==_strnicmp(items->name,"Importance",10))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting importance>");
#endif
- if(head->Priority!=-1)
+ if (head->Priority!=-1)
{
- if(0==strncmp(items->value,"low",3))
+ if (0==strncmp(items->value,"low",3))
head->Priority=5;
- else if(0==strncmp(items->value,"normal",6))
+ else if (0==strncmp(items->value,"normal",6))
head->Priority=3;
- else if(0==strncmp(items->value,"high",4))
+ else if (0==strncmp(items->value,"high",4))
head->Priority=1;
}
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"</Extracting>\n");
#endif
}
- else if(0==_strnicmp(items->name,"X-Priority",10))
+ else if (0==_strnicmp(items->name,"X-Priority",10))
{
- if(items->value==NULL)
+ if (items->value==NULL)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<X-Priority>");
#endif
- if((*items->value>='1') && (*items->value<='5'))
+ if ((*items->value>='1') && (*items->value<='5'))
head->Priority=*items->value-'0';
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"</Extracting>\n");
@@ -372,17 +372,17 @@ void ExtractHeader(struct CMimeItem *items,int &CP,struct CHeader *head) head->Priority=ShortHeader.Priority==-1 ? 3 : ShortHeader.Priority;
CP=ShortHeader.CP==-1 ? CP : ShortHeader.CP;
#ifdef DEBUG_DECODE
- if(NULL!=ShortHeader.From)
+ if (NULL!=ShortHeader.From)
DebugLog(DecodeFile,"<Decoded from>%s</Decoded)\n",ShortHeader.From);
- if(NULL!=ShortHeader.FromNick)
+ if (NULL!=ShortHeader.FromNick)
DebugLog(DecodeFile,"<Decoded from-nick>%s</Decoded)\n",ShortHeader.FromNick);
- if(NULL!=ShortHeader.ReturnPath)
+ if (NULL!=ShortHeader.ReturnPath)
DebugLog(DecodeFile,"<Decoded return-path>%s</Decoded)\n",ShortHeader.ReturnPath);
- if(NULL!=ShortHeader.ReturnPathNick)
+ if (NULL!=ShortHeader.ReturnPathNick)
DebugLog(DecodeFile,"<Decoded return-path nick>%s</Decoded)\n",ShortHeader.ReturnPathNick);
- if(NULL!=ShortHeader.Subject)
+ if (NULL!=ShortHeader.Subject)
DebugLog(DecodeFile,"<Decoded subject>%s</Decoded)\n",ShortHeader.Subject);
- if(NULL!=ShortHeader.Date)
+ if (NULL!=ShortHeader.Date)
DebugLog(DecodeFile,"<Decoded date>%s</Decoded)\n",ShortHeader.Date);
DebugLog(DecodeFile,"</Extracting header>\n");
DebugLog(DecodeFile,"<Convert>\n");
@@ -391,38 +391,38 @@ void ExtractHeader(struct CMimeItem *items,int &CP,struct CHeader *head) ConvertCodedStringToUnicode(ShortHeader.From,&head->From,CP,MIME_PLAIN);
#ifdef DEBUG_DECODE
- if(NULL!=head->From)
+ if (NULL!=head->From)
DebugLogW(DecodeFile,L"<Converted from>%s</Converted>\n",head->From);
#endif
ConvertCodedStringToUnicode(ShortHeader.FromNick,&head->FromNick,CP,MIME_MAIL);
#ifdef DEBUG_DECODE
- if(NULL!=head->FromNick)
+ if (NULL!=head->FromNick)
DebugLogW(DecodeFile,L"<Converted from-nick>%s</Converted>\n",head->FromNick);
#endif
ConvertCodedStringToUnicode(ShortHeader.ReturnPath,&head->ReturnPath,CP,MIME_PLAIN);
#ifdef DEBUG_DECODE
- if(NULL!=head->ReturnPath)
+ if (NULL!=head->ReturnPath)
DebugLogW(DecodeFile,L"<Converted return-path>%s</Converted>\n",head->ReturnPath);
#endif
ConvertCodedStringToUnicode(ShortHeader.ReturnPathNick,&head->ReturnPathNick,CP,MIME_MAIL);
#ifdef DEBUG_DECODE
- if(NULL!=head->ReturnPathNick)
+ if (NULL!=head->ReturnPathNick)
DebugLogW(DecodeFile,L"<Converted return-path nick>%s</Converted>\n",head->ReturnPathNick);
#endif
ConvertCodedStringToUnicode(ShortHeader.Subject,&head->Subject,CP,MIME_PLAIN);
#ifdef DEBUG_DECODE
- if(NULL!=head->Subject)
+ if (NULL!=head->Subject)
DebugLogW(DecodeFile,L"<Converted subject>%s</Converted>\n",head->Subject);
#endif
ConvertCodedStringToUnicode(ShortHeader.Date,&head->Date,CP,MIME_PLAIN);
#ifdef DEBUG_DECODE
- if(NULL!=head->Date)
+ if (NULL!=head->Date)
DebugLogW(DecodeFile,L"<Converted date>%s</Converted>\n",head->Date);
#endif
ConvertCodedStringToUnicode(ShortHeader.Body,&head->Body,CP,MIME_PLAIN);
#ifdef DEBUG_DECODE
- if(NULL!=head->Body)
+ if (NULL!=head->Body)
DebugLogW(DecodeFile,L"<Converted Body>%s</Converted>\n",head->Body);
#endif
@@ -439,30 +439,30 @@ void ExtractHeader(struct CMimeItem *items,int &CP,struct CHeader *head) void DeleteShortHeaderContent(struct CShortHeader *head)
{
- if(head->From!=NULL) delete[] head->From;
- if(head->FromNick!=NULL) delete[] head->FromNick;
- if(head->ReturnPath!=NULL) delete[] head->ReturnPath;
- if(head->ReturnPathNick!=NULL) delete[] head->ReturnPathNick;
- if(head->Subject!=NULL) delete[] head->Subject;
- if(head->Date!=NULL) delete[] head->Date;
- if(head->To!=NULL) DeleteShortNames(head->To);
- if(head->Cc!=NULL) DeleteShortNames(head->Cc);
- if(head->Bcc!=NULL) DeleteShortNames(head->Bcc);
- if(head->Body!=NULL) delete[] head->Body;
+ if (head->From!=NULL) delete[] head->From;
+ if (head->FromNick!=NULL) delete[] head->FromNick;
+ if (head->ReturnPath!=NULL) delete[] head->ReturnPath;
+ if (head->ReturnPathNick!=NULL) delete[] head->ReturnPathNick;
+ if (head->Subject!=NULL) delete[] head->Subject;
+ if (head->Date!=NULL) delete[] head->Date;
+ if (head->To!=NULL) DeleteShortNames(head->To);
+ if (head->Cc!=NULL) DeleteShortNames(head->Cc);
+ if (head->Bcc!=NULL) DeleteShortNames(head->Bcc);
+ if (head->Body!=NULL) delete[] head->Body;
}
void DeleteHeaderContent(struct CHeader *head)
{
- if(head->From!=NULL) delete[] head->From;
- if(head->FromNick!=NULL) delete[] head->FromNick;
- if(head->ReturnPath!=NULL) delete[] head->ReturnPath;
- if(head->ReturnPathNick!=NULL) delete[] head->ReturnPathNick;
- if(head->Subject!=NULL) delete[] head->Subject;
- if(head->Date!=NULL) delete[] head->Date;
- if(head->Body!=NULL) delete[] head->Body;
- if(head->To!=NULL) DeleteNames(head->To);
- if(head->Cc!=NULL) DeleteNames(head->Cc);
- if(head->Bcc!=NULL) DeleteNames(head->Bcc);
+ if (head->From!=NULL) delete[] head->From;
+ if (head->FromNick!=NULL) delete[] head->FromNick;
+ if (head->ReturnPath!=NULL) delete[] head->ReturnPath;
+ if (head->ReturnPathNick!=NULL) delete[] head->ReturnPathNick;
+ if (head->Subject!=NULL) delete[] head->Subject;
+ if (head->Date!=NULL) delete[] head->Date;
+ if (head->Body!=NULL) delete[] head->Body;
+ if (head->To!=NULL) DeleteNames(head->To);
+ if (head->Cc!=NULL) DeleteNames(head->Cc);
+ if (head->Bcc!=NULL) DeleteNames(head->Bcc);
}
void DeleteNames(PYAMN_MIMENAMES Names)
@@ -470,9 +470,9 @@ void DeleteNames(PYAMN_MIMENAMES Names) PYAMN_MIMENAMES Parser=Names,Old;
for(;Parser!=NULL;Parser=Parser->Next)
{
- if(Parser->Value!=NULL)
+ if (Parser->Value!=NULL)
delete[] Parser->Value;
- if(Parser->ValueNick!=NULL)
+ if (Parser->ValueNick!=NULL)
delete[] Parser->ValueNick;
Old=Parser;
Parser=Parser->Next;
@@ -485,9 +485,9 @@ void DeleteShortNames(PYAMN_MIMESHORTNAMES Names) PYAMN_MIMESHORTNAMES Parser=Names,Old;
for(;Parser!=NULL;Parser=Parser->Next)
{
- if(Parser->Value!=NULL)
+ if (Parser->Value!=NULL)
delete[] Parser->Value;
- if(Parser->ValueNick!=NULL)
+ if (Parser->ValueNick!=NULL)
delete[] Parser->ValueNick;
Old=Parser;
Parser=Parser->Next;
@@ -499,7 +499,7 @@ void DeleteShortNames(PYAMN_MIMESHORTNAMES Names) void inline ToLower(char *string)
{
for(;*string!=0;string++)
- if(*string>='A' && *string<='Z') *string=*string-'A'+'a';
+ if (*string>='A' && *string<='Z') *string=*string-'A'+'a';
}
#define TE_UNKNOWN
@@ -548,14 +548,14 @@ void ParseAPart(APartDataType *data) prev2=finder++;
while(WS(finder) && !EOS(finder)) finder++;
- if(!EOS(finder))
+ if (!EOS(finder))
prev3=finder;
else
break;
do
{
- if(ENDLINEWS(finder)) finder+=2; //after endline information continues
+ if (ENDLINEWS(finder)) finder+=2; //after endline information continues
while(!ENDLINE(finder) && !EOS(finder)) finder++;
}while(ENDLINEWS(finder));
@@ -565,12 +565,12 @@ void ParseAPart(APartDataType *data) data->TransEnc = prev3;
}
- if(EOS(finder))
+ if (EOS(finder))
break;
finder++;
- if(ENDLINE(finder)) {
+ if (ENDLINE(finder)) {
finder++;
- if(ENDLINE(finder)) {
+ if (ENDLINE(finder)) {
// end of headers. message body begins
if (finder>data->Src){
if (*(finder-2)=='\r' || *(finder-2)=='\n')
@@ -579,7 +579,7 @@ void ParseAPart(APartDataType *data) *(finder-1)=0;
}
finder++;
- if(ENDLINE(finder))finder++;
+ if (ENDLINE(finder))finder++;
prev1 = finder;
while (!EOS(finder+1))finder++;
if (ENDLINE(finder))finder--;
@@ -631,7 +631,7 @@ WCHAR *ParseMultipartBody(char *src, char *bond) }
if (partData[i].ContType){
char *CharSetStr;
- if(NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"charset=")))
+ if (NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"charset=")))
{
partData[i].CodePage=GetCharsetFromString(CharSetStr,strlen(CharSetStr));
delete[] CharSetStr;
@@ -655,10 +655,10 @@ WCHAR *ParseMultipartBody(char *src, char *bond) }
ConvertStringToUnicode(localBody?localBody:partData[i].body,partData[i].CodePage,&partData[i].wBody);
if (localBody) delete[] localBody;
- } else if(partData[i].ContType && !_strnicmp(partData[i].ContType,"multipart/",10)){
+ } else if (partData[i].ContType && !_strnicmp(partData[i].ContType,"multipart/",10)){
//Multipart in mulitipart recursive? should be SPAM. Ah well
char *bondary=NULL;
- if(NULL!=(bondary=ExtractFromContentType(partData[i].ContType,"boundary=")))
+ if (NULL!=(bondary=ExtractFromContentType(partData[i].ContType,"boundary=")))
{
partData[i].wBody = ParseMultipartBody(partData[i].body,bondary);
delete[] bondary;
@@ -689,13 +689,13 @@ FailBackRaw: _snprintf(infoline+linesize,100-linesize,"; %s",partData[i].ContType);
linesize = strlen(infoline);
partData[i].ContType=CharSetStr+1;
- if(NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"charset=")))
+ if (NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"charset=")))
{
_snprintf(infoline+linesize,100-linesize,"; %s",CharSetStr);
linesize = strlen(infoline);
delete[] CharSetStr;
}
- if(NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"name=")))
+ if (NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"name=")))
{
_snprintf(infoline+linesize,100-linesize,"; \"%s\"",CharSetStr);
linesize = strlen(infoline);
|