diff options
author | George Hazan <george.hazan@gmail.com> | 2013-01-03 22:11:27 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-01-03 22:11:27 +0000 |
commit | 53e568efe6f2a9e121ac6cf305e5fa9a84137c1a (patch) | |
tree | 60185775025f8fe3a7ed8f1f78b041c5db5770c1 /plugins/YAMN/src | |
parent | b06a96420250b0a6b8de0a3c463e4599ba16e522 (diff) |
- fix for the buffer overrun in YAMN's mime parser
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@2948 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YAMN/src')
-rw-r--r-- | plugins/YAMN/src/browser/mailbrowser.cpp | 43 | ||||
-rw-r--r-- | plugins/YAMN/src/mails/decode.cpp | 8 | ||||
-rw-r--r-- | plugins/YAMN/src/mails/mails.cpp | 4 | ||||
-rw-r--r-- | plugins/YAMN/src/mails/mime.cpp | 55 | ||||
-rw-r--r-- | plugins/YAMN/src/main.cpp | 4 | ||||
-rw-r--r-- | plugins/YAMN/src/proto/netlib.cpp | 2 | ||||
-rw-r--r-- | plugins/YAMN/src/proto/pop3/pop3.cpp | 2 | ||||
-rw-r--r-- | plugins/YAMN/src/proto/pop3/pop3comm.cpp | 13 | ||||
-rw-r--r-- | plugins/YAMN/src/services.cpp | 14 | ||||
-rw-r--r-- | plugins/YAMN/src/yamn.cpp | 6 |
10 files changed, 77 insertions, 74 deletions
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index 4f1f5593d6..be88c467d3 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -847,7 +847,7 @@ LRESULT CALLBACK NewMailPopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam {
HANDLE hContact = 0;
HACCOUNT Account;
- if (PluginParam){
+ if (PluginParam) {
PYAMN_MAILSHOWPARAM MailParam = new YAMN_MAILSHOWPARAM;
memcpy(MailParam,(PINT_PTR)PluginParam,sizeof(YAMN_MAILSHOWPARAM));
hContact = MailParam->account->hContact;
@@ -1084,7 +1084,7 @@ ULONGLONG MimeDateToFileTime(char *datein) //datein = " ManySpaces 1.5 Jan 2060 05::";
//datein = "Xxx, 35 February 20 :29:10 ";
//datein = "01.12.2007 (22:38:17)"; //
- if (datein){
+ if (datein) {
char tmp [64];
while ( datein[0]==' ') datein++; // eat leading spaces
strncpy(tmp,datein,63); tmp [63]=0;
@@ -1092,14 +1092,14 @@ ULONGLONG MimeDateToFileTime(char *datein) day = tmp;
} else {
int i = 0;
- while (tmp[i]==' ')i++; if (day = strchr(&tmp[i],' ')){day[0]=0; day++;}
+ while (tmp[i]==' ')i++; if (day = strchr(&tmp[i],' ')) {day[0]=0; day++;}
}
- if (day) {while ( day[0]==' ') day++;if (month= strchr(day, ' ')){month[0]=0; month++;}}
+ if (day) {while ( day[0]==' ') day++;if (month= strchr(day, ' ')) {month[0]=0; month++;}}
if (month) {while (month[0]==' ')month++;if (year = strchr(month,' ')) { year[0]=0; year++;}}
- if (year) {while ( year[0]==' ') year++;if (time = strchr(year, ' ')) { time[0]=0; time++;}}
- if (time) {while ( time[0]==' ') time++;if (shift= strchr(time, ' ')){shift[0]=0; shift++;shift[5]=0;}}
+ if (year) {while ( year[0]==' ') year++;if (time = strchr(year, ' ')) { time[0]=0; time++;}}
+ if (time) {while ( time[0]==' ') time++;if (shift= strchr(time, ' ')) {shift[0]=0; shift++;shift[5]=0;}}
- if (year){
+ if (year) {
st.wYear = atoi(year);
if (strlen(year)<4) if (st.wYear<70)st.wYear += 2000; else st.wYear += 1900;
};
@@ -1110,14 +1110,14 @@ ULONGLONG MimeDateToFileTime(char *datein) h = time;
if (m = strchr(h,':')) {
m[0]=0; m++;
- if (s = strchr(m,':')){s[0] = 0; s++;}
+ if (s = strchr(m,':')) {s[0] = 0; s++;}
} else s=0;
st.wHour = atoi(h);
st.wMinute = m?atoi(m):0;
st.wSecond = s?atoi(s):0;
} else {st.wHour=st.wMinute=st.wSecond=0;}
- if (shift){
+ if (shift) {
if (strlen(shift)<4) {
//has only hour
wShiftSeconds = (atoi(shift))*3600;
@@ -1141,7 +1141,8 @@ ULONGLONG MimeDateToFileTime(char *datein) return res;
}
-void FileTimeToLocalizedDateTime(LONGLONG filetime, WCHAR *dateout, int lendateout){
+void FileTimeToLocalizedDateTime(LONGLONG filetime, WCHAR *dateout, int lendateout)
+{
int localeID = CallService(MS_LANGPACK_GETLOCALE,0,0);
//int localeID = MAKELCID(LANG_URDU, SORT_DEFAULT);
if (localeID==CALLSERVICE_NOTFOUND) localeID=LOCALE_USER_DEFAULT;
@@ -1154,7 +1155,7 @@ void FileTimeToLocalizedDateTime(LONGLONG filetime, WCHAR *dateout, int lendateo WORD wTodayYear, wTodayMonth, wTodayDay;
FILETIME ft;
BOOL willShowDate = !(optDateTime&SHOWDATENOTODAY);
- if (!willShowDate){
+ if (!willShowDate) {
GetLocalTime(&st);
wTodayYear = st.wYear;
wTodayMonth = st.wMonth;
@@ -1174,7 +1175,7 @@ void FileTimeToLocalizedDateTime(LONGLONG filetime, WCHAR *dateout, int lendateo dateout[lendateout-1]=0;
int templen = 0;
if (!willShowDate) willShowDate = (wTodayYear!=st.wYear)||(wTodayMonth!=st.wMonth)||(wTodayDay!=st.wDay);
- if (willShowDate){
+ if (willShowDate) {
templen = GetDateFormatW(localeID,(optDateTime&SHOWDATELONG)?DATE_LONGDATE:DATE_SHORTDATE,&st,NULL,dateout,lendateout-2);
dateout[templen-1] = ' ';
}
@@ -1396,7 +1397,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM }
//if (!hasBody) if (!strcmp(Header->name,"Body")) hasBody = true;
int count = 0; WCHAR **split=0;
- if (str2){
+ if (str2) {
int ofs = 0;
while (str2[ofs]) {
if ((str2[ofs]==0x266A)||(str2[ofs]==0x25D9)||(str2[ofs]==0x25CB)||
@@ -1440,12 +1441,12 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM if (str1) free(str1);
if (str2) free(str2);
}
- if (body){
+ if (body) {
WCHAR *bodyDecoded = 0;
char *localBody=0;
if (contentType) {
if (!_strnicmp(contentType,"text",4)) {
- if (transEncoding){
+ if (transEncoding) {
if (!_stricmp(transEncoding,"base64")) {
int size = (int)strlen(body)*3/4+5;
localBody = new char[size+1];
@@ -1475,7 +1476,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM MailParam->mail->Flags |= YAMN_MSG_BODYREQUESTED;
CallService(MS_YAMN_ACCOUNTCHECK,(WPARAM)MailParam->account,0);
} else {
- if (MailParam->mail->Flags & YAMN_MSG_UNSEEN){
+ if (MailParam->mail->Flags & YAMN_MSG_UNSEEN) {
MailParam->mail->Flags&=~YAMN_MSG_UNSEEN; //mark the message as seen
HWND hMailBrowser;
if (hMailBrowser=WindowList_Find(YAMNVar.NewMailAccountWnd,MailParam->account)) {
@@ -1580,7 +1581,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM MoveWindow(GetDlgItem(hDlg,IDC_SPLITTER),5,localSplitPos,HeadSizeX-10,2,TRUE);
MoveWindow(hEdit,5,localSplitPos+6,HeadSizeX-10,HeadSizeY-localSplitPos-11,TRUE); //where to put text window while resizing
MoveWindow(hList, 5 ,5 ,HeadSizeX-10 ,(isBodyShown?localSplitPos:HeadSizeY)-10,TRUE); //where to put headers list window while resizing
- //if (changeX){
+ //if (changeX) {
if (GetClientRect(hList,&coord)) {
localSizeX=coord.right-coord.left;
} else localSizeX=HeadSizeX;
@@ -1607,7 +1608,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM AppendMenu(hMenu, MF_STRING, (UINT_PTR)0, TranslateT("Cancel"));
int nReturnCmd = TrackPopupMenu( hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, NULL );
DestroyMenu( hMenu );
- if (nReturnCmd>0){
+ if (nReturnCmd>0) {
int courRow=0;
size_t sizeNeeded = 0;
TCHAR headname[64]={0}, headvalue[256]={0};
@@ -1647,7 +1648,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM return 0;
}
-DWORD WINAPI ShowEmailThread(LPVOID Param){
+DWORD WINAPI ShowEmailThread(LPVOID Param) {
struct MailShowMsgWinParam MyParam;
MyParam=*(struct MailShowMsgWinParam *)Param;
@@ -1656,7 +1657,7 @@ DWORD WINAPI ShowEmailThread(LPVOID Param){ #endif
SCIncFcn(MyParam.account->UsingThreads);
SetEvent(MyParam.ThreadRunningEV);
- if (MyParam.mail->MsgWindow){
+ if (MyParam.mail->MsgWindow) {
//if (!BringWindowToTop(MyParam.mail->MsgWindow)) {
if (!SetForegroundWindow(MyParam.mail->MsgWindow)) {
SendMessage(MyParam.mail->MsgWindow,WM_DESTROY,0,0);
@@ -2401,7 +2402,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM AppendMenu(hMenu, MF_STRING, (UINT_PTR)0, TranslateT("Cancel"));
int nReturnCmd = TrackPopupMenu( hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, NULL );
DestroyMenu( hMenu );
- if (nReturnCmd>0){
+ if (nReturnCmd>0) {
int courRow=0;
size_t sizeNeeded = 0;
TCHAR from[128]={0}, subject[256]={0}, size[16]={0}, date[64]={0};
diff --git a/plugins/YAMN/src/mails/decode.cpp b/plugins/YAMN/src/mails/decode.cpp index 867ed7ff25..3af1edc056 100644 --- a/plugins/YAMN/src/mails/decode.cpp +++ b/plugins/YAMN/src/mails/decode.cpp @@ -303,13 +303,13 @@ int DecodeQuotedPrintable(char *Src,char *Dst,int DstLen, BOOL isQ) for (int Counter=0;((char)*Src!=0) && DstLen && (Counter++<DstLen);Src++,Dst++)
if (*Src=='=')
{
- if (!isQ){
- if (Src[1]==0x0D){
+ if (!isQ) {
+ if (Src[1]==0x0D) {
Src++; Src++;
if (Src[0]==0x0A) Src++;
goto CopyCharQuotedPrintable;
}
- if (Src[1]==0x0A){
+ if (Src[1]==0x0A) {
Src++; Src++;
goto CopyCharQuotedPrintable;
}
@@ -455,7 +455,7 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) size_t tempstoreLength = wcslen(tempstore);
size_t outind = 0;
- while(*start!=0){
+ while(*start!=0) {
if (CODES(start)) {
finder=start+2;finderend=finder;
while(!CODED(finderend) && !EOS(finderend)) finderend++;
diff --git a/plugins/YAMN/src/mails/mails.cpp b/plugins/YAMN/src/mails/mails.cpp index af0f3d2329..785fc5d8d9 100644 --- a/plugins/YAMN/src/mails/mails.cpp +++ b/plugins/YAMN/src/mails/mails.cpp @@ -155,7 +155,7 @@ INT_PTR DeleteAccountMailSvc(WPARAM wParam,LPARAM lParam) HYAMNMAIL OldMail=(HYAMNMAIL)lParam;
struct CMimeItem *TH;
- if (Plugin->MailFcn!=NULL){
+ if (Plugin->MailFcn!=NULL) {
if (Plugin->MailFcn->DeleteMailFcnPtr!=NULL) {
//Let plugin delete its own CMimeMsgQueue derived structure
Plugin->MailFcn->DeleteMailFcnPtr(OldMail);
@@ -435,7 +435,7 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) while (!DOTLINE(finder+1))finder++;
if (ENDLINE(finder))finder--;
prev2 = finder;
- if (prev2>prev1){ // yes, we have body
+ if (prev2>prev1) { // yes, we have body
if (NULL==(Item->Next=new struct CMimeItem)) break; // Cant create new item?!
Item=Item->Next;
Item->Next=NULL;//just in case;
diff --git a/plugins/YAMN/src/mails/mime.cpp b/plugins/YAMN/src/mails/mime.cpp index 2a66b80e2b..7b00979cad 100644 --- a/plugins/YAMN/src/mails/mime.cpp +++ b/plugins/YAMN/src/mails/mime.cpp @@ -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;
}
@@ -531,7 +531,7 @@ void ParseAPart(APartDataType *data) while(ENDLINEWS(finder)) finder++;
//at the start of line
- if (finder>data->Src){
+ if (finder>data->Src) {
if (*(finder-2)=='\r' || *(finder-2)=='\n')
*(finder-2)=0;
if (*(finder-1)=='\r' || *(finder-1)=='\n')
@@ -572,7 +572,7 @@ void ParseAPart(APartDataType *data) finder++;
if (ENDLINE(finder)) {
// end of headers. message body begins
- if (finder>data->Src){
+ if (finder>data->Src) {
if (*(finder-2)=='\r' || *(finder-2)=='\n')
*(finder-2)=0;
if (*(finder-1)=='\r' || *(finder-1)=='\n')
@@ -584,7 +584,7 @@ void ParseAPart(APartDataType *data) while (!EOS(finder+1))finder++;
if (ENDLINE(finder))finder--;
prev2 = finder;
- if (prev2>prev1){ // yes, we have body
+ if (prev2>prev1) { // yes, we have body
data->body = prev1;
}
break; // there is nothing else
@@ -616,7 +616,7 @@ WCHAR *ParseMultipartBody(char *src, char *bond) APartDataType *partData = new APartDataType[numparts];
memset(partData, 0, sizeof(APartDataType)*numparts);
partData[0].Src = courbond = srcback;
- for (i=1;(courbond=strstr(courbond,bond));i++,courbond+=sizebond){
+ for (i=1;(courbond=strstr(courbond,bond));i++,courbond+=sizebond) {
*(courbond-2) = 0;
partData[i].Src = courbond+sizebond;
while (ENDLINE(partData[i].Src)) partData[i].Src++;
@@ -624,12 +624,12 @@ WCHAR *ParseMultipartBody(char *src, char *bond) size_t resultSize=0;
for (i=0;i<numparts;i++) {
ParseAPart(&partData[i]);
- if (partData[i].body){
- if (partData[i].TransEnc){
+ if (partData[i].body) {
+ if (partData[i].TransEnc) {
if (!_stricmp(partData[i].TransEnc,"base64")) partData[i].TransEncType=TE_BASE64;
else if (!_stricmp(partData[i].TransEnc,"quoted-printable"))partData[i].TransEncType=TE_QUOTEDPRINTABLE;
}
- if (partData[i].ContType){
+ if (partData[i].ContType) {
char *CharSetStr;
if (NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"charset=")))
{
@@ -639,7 +639,7 @@ WCHAR *ParseMultipartBody(char *src, char *bond) }
if (partData[i].ContType && !_strnicmp(partData[i].ContType,"text",4)) {
char *localBody=0;
- switch (partData[i].TransEncType){
+ switch (partData[i].TransEncType) {
case TE_BASE64:
{
int size =partData[i].bodyLen*3/4+5;
@@ -674,42 +674,42 @@ FailBackRaw: dest = new WCHAR[resultSize+1];
size_t destpos = 0;
for (i=0;i<numparts;i++) {
- if (i){ // part before first boudary should not have headers
- char infoline[104]; size_t linesize = 0;
+ if (i) { // part before first boudary should not have headers
+ char infoline[1024]; size_t linesize = 0;
_snprintf(infoline,100,"%s %d",Translate("Part"),i);
linesize = strlen(infoline);
- if (partData[i].TransEnc){
- _snprintf(infoline+linesize,100-linesize,"; %s",partData[i].TransEnc);
+ if (partData[i].TransEnc) {
+ _snprintf(infoline+linesize, sizeof(infoline)-linesize,"; %s",partData[i].TransEnc);
linesize = strlen(infoline);
}
- if (partData[i].ContType){
+ if (partData[i].ContType) {
char *CharSetStr=strchr(partData[i].ContType,';');
- if (CharSetStr){
+ if (CharSetStr) {
CharSetStr[0]=0;
- _snprintf(infoline+linesize,100-linesize,"; %s",partData[i].ContType);
+ _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=")))
- {
- _snprintf(infoline+linesize,100-linesize,"; %s",CharSetStr);
+ 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=")))
- {
- _snprintf(infoline+linesize,100-linesize,"; \"%s\"",CharSetStr);
+ if (NULL!=(CharSetStr=ExtractFromContentType(partData[i].ContType,"name="))) {
+ _snprintf(infoline+linesize,sizeof(infoline)-linesize,"; \"%s\"",CharSetStr);
linesize = strlen(infoline);
delete[] CharSetStr;
}
- } else {
- _snprintf(infoline+linesize,100-linesize,"; %s",partData[i].ContType);
+ }
+ else {
+ _snprintf(infoline+linesize,sizeof(infoline)-linesize,"; %s",partData[i].ContType);
linesize = strlen(infoline);
}
}
sprintf(infoline+linesize,".\r\n");
- {WCHAR *temp=0;
+ {
+ WCHAR *temp=0;
dest[destpos] = dest[destpos+1] = dest[destpos+2] = 0x2022; // bullet;
- destpos+=3;
+ destpos += 3;
ConvertStringToUnicode(infoline,CP_ACP,&temp);
size_t wsize = wcslen(temp);
wcscpy(&dest[destpos],temp);
@@ -717,7 +717,8 @@ FailBackRaw: delete[] temp;
}
} // if (i)
- if (partData[i].wBody){
+
+ if (partData[i].wBody) {
size_t wsize = wcslen(partData[i].wBody);
wcscpy(&dest[destpos],partData[i].wBody);
destpos += wsize;
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index c2083ab9f7..242c1e247a 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -358,7 +358,7 @@ extern "C" int __declspec(dllexport) Load(void) EnumSystemCodePages(EnumSystemCodePagesProc, CP_INSTALLED);
CodePageNamesSupp = new _tcptable[CPLENSUPP];
for (i = 0, k = 0; i < CPLENALL; i++) {
- if (CodePageNamesAll[i].isValid){
+ if (CodePageNamesAll[i].isValid) {
CodePageNamesSupp[k] = CodePageNamesAll[i];
k++;
} }
@@ -441,7 +441,7 @@ static void UnloadPlugins() iDllPlugins --;
}
}
- if (hDllPlugins){
+ if (hDllPlugins) {
free((void *)hDllPlugins);
hDllPlugins = NULL;
}
diff --git a/plugins/YAMN/src/proto/netlib.cpp b/plugins/YAMN/src/proto/netlib.cpp index b7c1864ffa..652715d771 100644 --- a/plugins/YAMN/src/proto/netlib.cpp +++ b/plugins/YAMN/src/proto/netlib.cpp @@ -62,7 +62,7 @@ HANDLE RegisterNLClient(const char *name) }
//Move connection to SSL
-void CNLClient::SSLify() throw(DWORD){
+void CNLClient::SSLify() throw(DWORD) {
#ifdef DEBUG_COMM
SSL_DebugLog("Staring SSL...");
#endif
diff --git a/plugins/YAMN/src/proto/pop3/pop3.cpp b/plugins/YAMN/src/proto/pop3/pop3.cpp index 05e85d7156..76c3e9645c 100644 --- a/plugins/YAMN/src/proto/pop3/pop3.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3.cpp @@ -77,7 +77,7 @@ char *CPop3Client::Connect(const char* servername,const int port,BOOL UseSSL, BO NetClient->Send("STLS\r\n"); free(temp); temp=RecvRest(NetClient->Recv(),POP3_SEARCHACK); - if (AckFlag==POP3_FOK){ // Ok, we are going to tls + if (AckFlag==POP3_FOK) { // Ok, we are going to tls try { NetClient->SSLify(); } catch (...) { diff --git a/plugins/YAMN/src/proto/pop3/pop3comm.cpp b/plugins/YAMN/src/proto/pop3/pop3comm.cpp index 98888a1733..2139a93375 100644 --- a/plugins/YAMN/src/proto/pop3/pop3comm.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3comm.cpp @@ -410,7 +410,7 @@ HYAMNMAIL WINAPI CreatePOP3Mail(HACCOUNT Account,DWORD MailDataVersion) return (HYAMNMAIL)NewMail;
}
-static void SetContactStatus(HACCOUNT account, int status){
+static void SetContactStatus(HACCOUNT account, int status) {
if ((account->hContact) && (account->NewMailN.Flags & YAMN_ACC_CONT)) {
DBWriteContactSettingWord(account->hContact, YAMN_DBMODULE, "Status", status);
}
@@ -708,10 +708,10 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write enter\n");
#endif
ActualAccount->LastChecked=now;
- for (MsgQueuePtr=(HYAMNMAIL)ActualAccount->Mails;MsgQueuePtr!=NULL;MsgQueuePtr=MsgQueuePtr->Next){
- if (MsgQueuePtr->Flags&YAMN_MSG_BODYREQUESTED){
+ for (MsgQueuePtr=(HYAMNMAIL)ActualAccount->Mails;MsgQueuePtr!=NULL;MsgQueuePtr=MsgQueuePtr->Next) {
+ if (MsgQueuePtr->Flags&YAMN_MSG_BODYREQUESTED) {
HYAMNMAIL NewMsgsPtr=NULL;
- for (NewMsgsPtr=(HYAMNMAIL)NewMails;NewMsgsPtr!=NULL;NewMsgsPtr=NewMsgsPtr->Next){
+ for (NewMsgsPtr=(HYAMNMAIL)NewMails;NewMsgsPtr!=NULL;NewMsgsPtr=NewMsgsPtr->Next) {
if (!strcmp(MsgQueuePtr->ID,NewMsgsPtr->ID)) {
TCHAR accstatus[512];
wsprintf(accstatus,TranslateT("Reading body %s"),NewMsgsPtr->ID);
@@ -769,12 +769,11 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write done\n");
#endif
MsgsWriteDone(ActualAccount);
- for (MsgQueuePtr=(HYAMNMAIL)ActualAccount->Mails;MsgQueuePtr!=NULL;MsgQueuePtr=MsgQueuePtr->Next){
+ for (MsgQueuePtr=(HYAMNMAIL)ActualAccount->Mails;MsgQueuePtr!=NULL;MsgQueuePtr=MsgQueuePtr->Next) {
if ((MsgQueuePtr->Flags&YAMN_MSG_BODYREQUESTED) && (MsgQueuePtr->Flags&YAMN_MSG_BODYRECEIVED)) {
MsgQueuePtr->Flags&=~YAMN_MSG_BODYREQUESTED;
- if (MsgQueuePtr->MsgWindow){
+ if (MsgQueuePtr->MsgWindow)
SendMessage(MsgQueuePtr->MsgWindow,WM_YAMN_CHANGECONTENT,0,0);
- }
}
}
diff --git a/plugins/YAMN/src/services.cpp b/plugins/YAMN/src/services.cpp index 7254a02428..e4a6faedf9 100644 --- a/plugins/YAMN/src/services.cpp +++ b/plugins/YAMN/src/services.cpp @@ -32,7 +32,7 @@ static INT_PTR Service_GetStatus(WPARAM wParam, LPARAM lParam) static INT_PTR Service_SetStatus(WPARAM wParam, LPARAM lParam)
{
int newstatus = (wParam != ID_STATUS_OFFLINE)?ID_STATUS_ONLINE:ID_STATUS_OFFLINE;
- if (newstatus != YAMN_STATUS){
+ if (newstatus != YAMN_STATUS) {
int oldstatus = YAMN_STATUS;
YAMN_STATUS = newstatus;
ProtoBroadcastAck(YAMN_DBMODULE, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldstatus, newstatus);
@@ -124,7 +124,8 @@ static INT_PTR ContactApplication(WPARAM wParam, LPARAM lParam) }
DWORD WINAPI SWMRGWaitToRead(PSWMRG pSWMRG, DWORD dwTimeout);
-static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam){
+static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam)
+{
//This service will check/sincronize the account pointed by wParam
HACCOUNT ActualAccount = (HACCOUNT)wParam;
HANDLE ThreadRunningEV;
@@ -367,10 +368,11 @@ void HookEvents(void) hookData[i].hookHandle = HookEvent(hookData[i].hookName, hookData[i].mirandaFunction);
}
}
-void UnhookEvents(void){
- for (int i = 0;i<(sizeof(hookData)/sizeof(hookData[0]));i++) {
- if (hookData[i].hookHandle) UnhookEvent(hookData[i].hookHandle);
- }
+void UnhookEvents(void)
+{
+ for (int i = 0;i<(sizeof(hookData)/sizeof(hookData[0]));i++)
+ if (hookData[i].hookHandle)
+ UnhookEvent(hookData[i].hookHandle);
}
typedef struct { HANDLE serviceHandle; const char *serviceName; MIRANDASERVICE serviceFunction;} ServiceDataType;
diff --git a/plugins/YAMN/src/yamn.cpp b/plugins/YAMN/src/yamn.cpp index c93225e609..3bc9d3929b 100644 --- a/plugins/YAMN/src/yamn.cpp +++ b/plugins/YAMN/src/yamn.cpp @@ -205,7 +205,7 @@ void CALLBACK TimerProc(HWND, UINT, UINT, DWORD) {
goto ChangeIsCountingStatusLabel;
}
- if (ActualAccount->TimeLeft){
+ if (ActualAccount->TimeLeft) {
ActualAccount->TimeLeft--;
isAccountCounting = TRUE;
}
@@ -239,10 +239,10 @@ ChangeIsCountingStatusLabel: #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read done\n");
#endif
- if (((ActualAccount->isCounting)!=0)!=isAccountCounting){
+ if (((ActualAccount->isCounting)!=0)!=isAccountCounting) {
ActualAccount->isCounting=isAccountCounting;
WORD cStatus = DBGetContactSettingWord(ActualAccount->hContact, YAMN_DBMODULE, "Status", 0);
- switch (cStatus){
+ switch (cStatus) {
case ID_STATUS_ONLINE:
case ID_STATUS_OFFLINE:
DBWriteContactSettingWord(ActualAccount->hContact, YAMN_DBMODULE, "Status", isAccountCounting?ID_STATUS_ONLINE:ID_STATUS_OFFLINE);
|