diff options
author | George Hazan <george.hazan@gmail.com> | 2013-02-12 20:44:55 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-02-12 20:44:55 +0000 |
commit | 82016434fff2eb8ed8288c0c45bc76a67574860d (patch) | |
tree | f0771b2391899c61960c27af13d5e046f0d087d2 /plugins/YAMN/src/mails/mime.cpp | |
parent | c989c00ce9e0a8422e7efb3c21350ca3f5276d86 (diff) |
- fix for chinese in popups;
- own md5 module removed;
- version bump;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@3585 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YAMN/src/mails/mime.cpp')
-rw-r--r-- | plugins/YAMN/src/mails/mime.cpp | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/plugins/YAMN/src/mails/mime.cpp b/plugins/YAMN/src/mails/mime.cpp index 13710a2557..33b7735b82 100644 --- a/plugins/YAMN/src/mails/mime.cpp +++ b/plugins/YAMN/src/mails/mime.cpp @@ -98,7 +98,7 @@ void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode) if (srcstart>=srcend)
return;
- if (NULL!=*dest)
+ if (NULL != *dest)
delete[] *dest;
if (NULL==(*dest=new char[srcend-srcstart+1]))
return;
@@ -127,7 +127,7 @@ void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick) return;
}
while(WS(finder)) finder++;
- if ((*finder)!='<')
+ if ((*finder) != '<')
{
char *finderend=finder+1;
do
@@ -138,12 +138,12 @@ void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick) }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
+ 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
{
@@ -160,7 +160,7 @@ void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick) {
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(!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;
@@ -213,13 +213,13 @@ 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
while(WS(finder)) finder++; //jump over whitespaces
temp=finder;
- while(*temp!=0 && *temp!=';') temp++; //jump to the end of setting (to the next ;)
+ while(*temp != 0 && *temp != ';') temp++; //jump to the end of setting (to the next ;)
temp--;
while(WS(temp)) temp--; //remove whitespaces from the end
if (*finder=='\"') { //remove heading and tailing quotes
@@ -228,7 +228,7 @@ char *ExtractFromContentType(char *ContentType,char *value) }
if (NULL==(CopiedString=new char[++temp-finder+1]))
return NULL;
- for (copier=CopiedString;finder!=temp;*copier++=*finder++); //copy string
+ for (copier=CopiedString;finder != temp;*copier++=*finder++); //copy string
*copier=0; //and end it with zero character
return CopiedString;
@@ -236,7 +236,7 @@ char *ExtractFromContentType(char *ContentType,char *value) void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head)
{
- for (;items!=NULL;items=items->Next)
+ for (;items != NULL;items=items->Next)
{
//at the start of line
//MessageBox(NULL,items->value,items->name,0);
@@ -314,7 +314,7 @@ 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;
@@ -328,7 +328,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) #ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting importance>");
#endif
- if (head->Priority!=-1)
+ if (head->Priority != -1)
{
if (0==strncmp(items->value,"low",3))
head->Priority=5;
@@ -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,40 +439,40 @@ 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)
{
PYAMN_MIMENAMES Parser=Names,Old;
- for (;Parser!=NULL;Parser=Parser->Next)
+ 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;
@@ -483,11 +483,11 @@ void DeleteNames(PYAMN_MIMENAMES Names) void DeleteShortNames(PYAMN_MIMESHORTNAMES Names)
{
PYAMN_MIMESHORTNAMES Parser=Names,Old;
- for (;Parser!=NULL;Parser=Parser->Next)
+ 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;
@@ -498,7 +498,7 @@ void DeleteShortNames(PYAMN_MIMESHORTNAMES Names) void inline ToLower(char *string)
{
- for (;*string!=0;string++)
+ for (;*string != 0;string++)
if (*string>='A' && *string<='Z') *string=*string-'A'+'a';
}
@@ -539,7 +539,7 @@ void ParseAPart(APartDataType *data) }
prev1=finder;
- while(*finder!=':' && !EOS(finder) && !ENDLINE(finder)) finder++;
+ while(*finder != ':' && !EOS(finder) && !ENDLINE(finder)) finder++;
if (ENDLINE(finder)||EOS(finder)) {
// no ":" in the line? here the body begins;
data->body = prev1;
@@ -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;
@@ -658,7 +658,7 @@ WCHAR *ParseMultipartBody(char *src, char *bond) } 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,12 +689,12 @@ FailBackRaw: _snprintf(infoline+linesize,sizeof(infoline)-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,sizeof(infoline)-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,sizeof(infoline)-linesize,"; \"%s\"",CharSetStr);
linesize = strlen(infoline);
delete[] CharSetStr;
|