diff options
Diffstat (limited to 'plugins/YAMN')
-rw-r--r-- | plugins/YAMN/src/account.cpp | 186 | ||||
-rw-r--r-- | plugins/YAMN/src/browser/badconnect.cpp | 34 | ||||
-rw-r--r-- | plugins/YAMN/src/browser/mailbrowser.cpp | 250 | ||||
-rw-r--r-- | plugins/YAMN/src/debug.cpp | 8 | ||||
-rw-r--r-- | plugins/YAMN/src/filterplugin.cpp | 32 | ||||
-rw-r--r-- | plugins/YAMN/src/mails/decode.cpp | 20 | ||||
-rw-r--r-- | plugins/YAMN/src/mails/mails.cpp | 96 | ||||
-rw-r--r-- | plugins/YAMN/src/mails/mime.cpp | 114 | ||||
-rw-r--r-- | plugins/YAMN/src/main.cpp | 48 | ||||
-rw-r--r-- | plugins/YAMN/src/proto/netlib.cpp | 18 | ||||
-rw-r--r-- | plugins/YAMN/src/proto/pop3/pop3.cpp | 16 | ||||
-rw-r--r-- | plugins/YAMN/src/proto/pop3/pop3comm.cpp | 250 | ||||
-rw-r--r-- | plugins/YAMN/src/proto/pop3/pop3opt.cpp | 130 | ||||
-rw-r--r-- | plugins/YAMN/src/protoplugin.cpp | 42 | ||||
-rw-r--r-- | plugins/YAMN/src/services.cpp | 52 | ||||
-rw-r--r-- | plugins/YAMN/src/synchro.cpp | 38 | ||||
-rw-r--r-- | plugins/YAMN/src/yamn.cpp | 34 |
17 files changed, 684 insertions, 684 deletions
diff --git a/plugins/YAMN/src/account.cpp b/plugins/YAMN/src/account.cpp index fa1262c1da..0755276f7b 100644 --- a/plugins/YAMN/src/account.cpp +++ b/plugins/YAMN/src/account.cpp @@ -46,10 +46,10 @@ INT_PTR CreatePluginAccountSvc(WPARAM wParam, LPARAM lParam) if (AccountVersion != YAMN_ACCOUNTVERSION) return NULL; - if (Plugin != NULL) + if (Plugin != nullptr) { HACCOUNT NewAccount; - if (Plugin->Fcn->NewAccountFcnPtr != NULL) + if (Plugin->Fcn->NewAccountFcnPtr != nullptr) //Let plugin create its own structure, which can be derived from CAccount structure NewAccount = Plugin->Fcn->NewAccountFcnPtr(Plugin, YAMN_ACCOUNTVERSION); else @@ -57,7 +57,7 @@ INT_PTR CreatePluginAccountSvc(WPARAM wParam, LPARAM lParam) NewAccount = new struct CAccount; //If not created successfully - if (NewAccount == NULL) + if (NewAccount == nullptr) return NULL; NewAccount->Plugin = Plugin; @@ -73,11 +73,11 @@ INT_PTR DeletePluginAccountSvc(WPARAM wParam, LPARAM) { HACCOUNT OldAccount = (HACCOUNT)wParam; - if (OldAccount->Plugin->Fcn != NULL) + if (OldAccount->Plugin->Fcn != nullptr) { //Deinit every members and allocated fields of structure used by YAMN DeInitAccount(OldAccount); - if (OldAccount->Plugin->Fcn->DeleteAccountFcnPtr != NULL) + if (OldAccount->Plugin->Fcn->DeleteAccountFcnPtr != nullptr) { //Let plugin delete its own CAccount derived structure OldAccount->Plugin->Fcn->DeleteAccountFcnPtr(OldAccount); @@ -99,11 +99,11 @@ int InitAccount(HACCOUNT Which) { //initialize synchronizing objects Which->AccountAccessSO = new SWMRG; - SWMRGInitialize(Which->AccountAccessSO, NULL); + SWMRGInitialize(Which->AccountAccessSO, nullptr); Which->MessagesAccessSO = new SWMRG; - SWMRGInitialize(Which->MessagesAccessSO, NULL); + SWMRGInitialize(Which->MessagesAccessSO, nullptr); Which->UsingThreads = new SCOUNTER; - SWMRGInitialize(Which->MessagesAccessSO, NULL); + SWMRGInitialize(Which->MessagesAccessSO, nullptr); //zero memory, where timestamps are stored memset(&Which->LastChecked, 0, sizeof(Which->LastChecked)); @@ -111,12 +111,12 @@ int InitAccount(HACCOUNT Which) memset(&Which->LastSynchronised, 0, sizeof(Which->LastSynchronised)); memset(&Which->LastMail, 0, sizeof(Which->LastMail)); - Which->Name = NULL; - Which->Mails = NULL; + Which->Name = nullptr; + Which->Mails = nullptr; Which->Interval = 0; Which->Flags = 0; Which->StatusFlags = 0; - Which->Next = NULL; + Which->Next = nullptr; Which->Server = new struct CServer; Which->AbleToWork = TRUE; @@ -127,14 +127,14 @@ int InitAccount(HACCOUNT Which) void DeInitAccount(HACCOUNT Which) { //delete YAMN allocated fields - if (Which->Name != NULL) + if (Which->Name != nullptr) delete[] Which->Name; - if (Which->Server != NULL) { - if (Which->Server->Name != NULL) + if (Which->Server != nullptr) { + if (Which->Server->Name != nullptr) delete[] Which->Server->Name; - if (Which->Server->Login != NULL) + if (Which->Server->Login != nullptr) delete[] Which->Server->Login; - if (Which->Server->Passwd != NULL) + if (Which->Server->Passwd != nullptr) delete[] Which->Server->Passwd; delete[] Which->Server; } @@ -164,7 +164,7 @@ void CodeDecodeString(char *Dest, BOOL Encrypt) { wchar_t Code = STARTCODEPSW; - if (Dest == NULL) + if (Dest == nullptr) return; for (; *Dest != (wchar_t)0; Dest++) @@ -180,20 +180,20 @@ void CodeDecodeString(char *Dest, BOOL Encrypt) static DWORD PostFileToMemory(HANDLE File, char **MemFile, char **End) { DWORD FileSize, ReadBytes; - if (!(FileSize = GetFileSize(File, NULL))) { + if (!(FileSize = GetFileSize(File, nullptr))) { CloseHandle(File); return EACC_FILESIZE; } //allocate space in memory, where we copy the whole file - if (NULL == (*MemFile = new char[FileSize])) + if (nullptr == (*MemFile = new char[FileSize])) { CloseHandle(File); return EACC_ALLOC; } //copy file to memory - if (!ReadFile(File, (LPVOID)*MemFile, FileSize, &ReadBytes, NULL)) + if (!ReadFile(File, (LPVOID)*MemFile, FileSize, &ReadBytes, nullptr)) { CloseHandle(File); delete[] * MemFile; @@ -206,7 +206,7 @@ static DWORD PostFileToMemory(HANDLE File, char **MemFile, char **End) DWORD FileToMemory(wchar_t *FileName, char **MemFile, char **End) { - HANDLE hFile = CreateFile(FileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(FileName, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) return EACC_SYSTEM; @@ -255,14 +255,14 @@ DWORD ReadStringFromMemory(char **Parser, char *End, char **StoreTo) return EACC_FILECOMPATIBILITY; if (Size = Finder - *Parser) { - if (NULL == (Dest = *StoreTo = new char[Size + 1])) + if (nullptr == (Dest = *StoreTo = new char[Size + 1])) return EACC_ALLOC; for (; *Parser <= Finder; (*Parser)++, Dest++) *Dest = **Parser; } else { - *StoreTo = NULL; + *StoreTo = nullptr; (*Parser)++; } return 0; @@ -310,14 +310,14 @@ DWORD ReadStringFromMemoryW(WCHAR **Parser, WCHAR *End, WCHAR **StoreTo) return EACC_FILECOMPATIBILITY; if (Size = Finder - *Parser) { - if (NULL == (Dest = *StoreTo = new WCHAR[Size + 1])) + if (nullptr == (Dest = *StoreTo = new WCHAR[Size + 1])) return EACC_ALLOC; for (; *Parser <= Finder; (*Parser)++, Dest++) *Dest = **Parser; } else { - *StoreTo = NULL; + *StoreTo = nullptr; (*Parser)++; } return 0; @@ -383,7 +383,7 @@ DWORD ReadMessagesFromMemory(HACCOUNT Which, char **Parser, char *End) { char *Finder; DWORD Size, Stat; - HYAMNMAIL ActualMail = NULL; + HYAMNMAIL ActualMail = nullptr; struct CMimeItem *items; char *ReadString; @@ -398,19 +398,19 @@ DWORD ReadMessagesFromMemory(HACCOUNT Which, char **Parser, char *End) return EACC_FILECOMPATIBILITY; if (Size = Finder - *Parser) { - if (Which->Mails == NULL) //First message in queue + if (Which->Mails == nullptr) //First message in queue { - if (NULL == (Which->Mails = ActualMail = CreateAccountMail(Which))) + if (nullptr == (Which->Mails = ActualMail = CreateAccountMail(Which))) return EACC_ALLOC; } else { - if (NULL == (ActualMail->Next = CreateAccountMail(Which))) { + if (nullptr == (ActualMail->Next = CreateAccountMail(Which))) { return EACC_ALLOC; } ActualMail = ActualMail->Next; } - items = NULL; + items = nullptr; #ifdef DEBUG_FILEREADMESSAGES if (Stat=ReadStringFromMemory(Parser,End,&ActualMail->ID,L"ID")) #else @@ -432,7 +432,7 @@ DWORD ReadMessagesFromMemory(HACCOUNT Which, char **Parser, char *End) if (*Parser >= End) return EACC_FILECOMPATIBILITY; - if ((NULL != Which->Plugin->MailFcn) && (NULL != Which->Plugin->MailFcn->ReadMailOptsFcnPtr)) + if ((nullptr != Which->Plugin->MailFcn) && (nullptr != Which->Plugin->MailFcn->ReadMailOptsFcnPtr)) Which->Plugin->MailFcn->ReadMailOptsFcnPtr(ActualMail, Parser, End); //read plugin mail settings from file do @@ -443,21 +443,21 @@ DWORD ReadMessagesFromMemory(HACCOUNT Which, char **Parser, char *End) if (Stat = ReadStringFromMemory(Parser, End, &ReadString)) #endif return Stat; - if (ReadString == NULL) + if (ReadString == nullptr) break; #ifdef DEBUG_DECODE DebugLog(DecodeFile,"<read name>%s</read name>",ReadString); #endif - if (items == NULL) + if (items == nullptr) items = ActualMail->MailData->TranslatedHeader = new struct CMimeItem; else { items->Next = new struct CMimeItem; items = items->Next; } - if (items == NULL) + if (items == nullptr) return EACC_ALLOC; items->name = ReadString; @@ -495,7 +495,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End) if (Stat = ReadStringFromMemory(Parser, End, &Which->Name)) #endif return Stat; - if (Which->Name == NULL) + if (Which->Name == nullptr) return EACC_FILECOMPATIBILITY; //Read server parameters @@ -569,7 +569,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End) return Stat; //Let plugin read its own data stored in file - if (Which->Plugin->Fcn != NULL && Which->Plugin->Fcn->ReadPluginOptsFcnPtr != NULL) + if (Which->Plugin->Fcn != nullptr && Which->Plugin->Fcn->ReadPluginOptsFcnPtr != nullptr) if (Stat = Which->Plugin->Fcn->ReadPluginOptsFcnPtr(Which, Parser, End)) return Stat; //Read mails @@ -655,7 +655,7 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin, char *MemFile, cha #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"AddAccountsFromFile:AccountBrowserSO-write enter\n"); #endif - if (NULL == (ActualAccount = (HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)Plugin, (LPARAM)YAMN_ACCOUNTVERSION))) + if (nullptr == (ActualAccount = (HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)Plugin, (LPARAM)YAMN_ACCOUNTVERSION))) { #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"AddAccountsFromFile:AccountBrowserSO-write done\n"); @@ -684,14 +684,14 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin, char *MemFile, cha if (Stat && (Stat != EACC_ENDOFFILE)) { - for (ActualAccount = FirstAllocatedAccount; ActualAccount != NULL; ActualAccount = Temp) + for (ActualAccount = FirstAllocatedAccount; ActualAccount != nullptr; ActualAccount = Temp) { Temp = ActualAccount->Next; delete ActualAccount; } delete[] MemFile; if (Plugin->FirstAccount == FirstAllocatedAccount) - Plugin->FirstAccount = NULL; + Plugin->FirstAccount = nullptr; #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"AddAccountsFromFile:ActualAccountSO-write done\n"); #endif @@ -704,16 +704,16 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin, char *MemFile, cha #endif WriteDoneFcn(ActualAccount->AccountAccessSO); - if ((Stat != EACC_ENDOFFILE) && (NULL == (ActualAccount = (HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)Plugin, (LPARAM)YAMN_ACCOUNTVERSION)))) + if ((Stat != EACC_ENDOFFILE) && (nullptr == (ActualAccount = (HACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)Plugin, (LPARAM)YAMN_ACCOUNTVERSION)))) { - for (ActualAccount = FirstAllocatedAccount; ActualAccount != NULL; ActualAccount = Temp) + for (ActualAccount = FirstAllocatedAccount; ActualAccount != nullptr; ActualAccount = Temp) { Temp = ActualAccount->Next; delete ActualAccount; } delete[] MemFile; if (Plugin->FirstAccount == FirstAllocatedAccount) - Plugin->FirstAccount = NULL; + Plugin->FirstAccount = nullptr; #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"AddAccountsFromFile:AccountBrowserSO-write done\n"); #endif @@ -747,13 +747,13 @@ DWORD WriteStringToFile(HANDLE File, char *Source) DWORD Length, WrittenBytes; char null = 0; - if ((Source == NULL) || !(Length = (DWORD)mir_strlen(Source))) { - if (!WriteFile(File, &null, 1, &WrittenBytes, NULL)) { + if ((Source == nullptr) || !(Length = (DWORD)mir_strlen(Source))) { + if (!WriteFile(File, &null, 1, &WrittenBytes, nullptr)) { CloseHandle(File); return EACC_SYSTEM; } } - else if (!WriteFile(File, Source, (Length + 1), &WrittenBytes, NULL)) { + else if (!WriteFile(File, Source, (Length + 1), &WrittenBytes, nullptr)) { CloseHandle(File); return EACC_SYSTEM; } @@ -765,15 +765,15 @@ DWORD WriteStringToFileW(HANDLE File, WCHAR *Source) DWORD Length, WrittenBytes; WCHAR null = (WCHAR)0; - if ((Source == NULL) || !(Length = (DWORD)mir_wstrlen(Source))) + if ((Source == nullptr) || !(Length = (DWORD)mir_wstrlen(Source))) { - if (!WriteFile(File, &null, sizeof(WCHAR), &WrittenBytes, NULL)) + if (!WriteFile(File, &null, sizeof(WCHAR), &WrittenBytes, nullptr)) { CloseHandle(File); return EACC_SYSTEM; } } - else if (!WriteFile(File, Source, (Length + 1)*sizeof(WCHAR), &WrittenBytes, NULL)) + else if (!WriteFile(File, Source, (Length + 1)*sizeof(WCHAR), &WrittenBytes, nullptr)) return EACC_SYSTEM; return 0; } @@ -784,17 +784,17 @@ DWORD WriteMessagesToFile(HANDLE File, HACCOUNT Which) HYAMNMAIL ActualMail = (HYAMNMAIL)Which->Mails; struct CMimeItem *items; - while (ActualMail != NULL) + while (ActualMail != nullptr) { if (Stat = WriteStringToFile(File, ActualMail->ID)) return Stat; - if (!WriteFile(File, (char *)&ActualMail->MailData->Size, sizeof(ActualMail->MailData->Size), &WrittenBytes, NULL) || - !WriteFile(File, (char *)&ActualMail->Flags, sizeof(ActualMail->Flags), &WrittenBytes, NULL) || - !WriteFile(File, (char *)&ActualMail->Number, sizeof(ActualMail->Number), &WrittenBytes, NULL)) + if (!WriteFile(File, (char *)&ActualMail->MailData->Size, sizeof(ActualMail->MailData->Size), &WrittenBytes, nullptr) || + !WriteFile(File, (char *)&ActualMail->Flags, sizeof(ActualMail->Flags), &WrittenBytes, nullptr) || + !WriteFile(File, (char *)&ActualMail->Number, sizeof(ActualMail->Number), &WrittenBytes, nullptr)) return EACC_SYSTEM; - if ((NULL != Which->Plugin->MailFcn) && (NULL != Which->Plugin->MailFcn->WriteMailOptsFcnPtr)) + if ((nullptr != Which->Plugin->MailFcn) && (nullptr != Which->Plugin->MailFcn->WriteMailOptsFcnPtr)) Which->Plugin->MailFcn->WriteMailOptsFcnPtr(File, ActualMail); //write plugin mail options to file - for (items = ActualMail->MailData->TranslatedHeader; items != NULL; items = items->Next) + for (items = ActualMail->MailData->TranslatedHeader; items != nullptr; items = items->Next) { if (Stat = WriteStringToFile(File, items->name)) return Stat; @@ -827,7 +827,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) #endif try { - for (ActualAccount = Plugin->FirstAccount; ActualAccount != NULL; ActualAccount = ActualAccount->Next) + for (ActualAccount = Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = ActualAccount->Next) { #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read wait\n"); @@ -846,7 +846,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read enter\n"); #endif - if ((ActualAccount->Name == NULL) || (*ActualAccount->Name == (wchar_t)0)) + if ((ActualAccount->Name == nullptr) || (*ActualAccount->Name == (wchar_t)0)) { #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read done\n"); @@ -855,7 +855,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) continue; } - if (!Writed && !WriteFile(File, &Ver, sizeof(Ver), &WrittenBytes, NULL)) + if (!Writed && !WriteFile(File, &Ver, sizeof(Ver), &WrittenBytes, nullptr)) throw (DWORD)EACC_SYSTEM; Writed = TRUE; @@ -865,7 +865,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) if (Stat = WriteStringToFile(File, ActualAccount->Server->Name)) throw (DWORD)Stat; - if (!WriteFile(File, (char *)&ActualAccount->Server->Port, 2, &WrittenBytes, NULL)) + if (!WriteFile(File, (char *)&ActualAccount->Server->Port, 2, &WrittenBytes, nullptr)) throw (DWORD)EACC_SYSTEM; if ((Stat = WriteStringToFile(File, ActualAccount->Server->Login))) @@ -880,38 +880,38 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) } CodeDecodeString(ActualAccount->Server->Passwd, FALSE); - if ((!WriteFile(File, (char *)&ActualAccount->Flags, sizeof(DWORD), &WrittenBytes, NULL) || - (!WriteFile(File, (char *)&ActualAccount->StatusFlags, sizeof(DWORD), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->PluginFlags, sizeof(DWORD), &WrittenBytes, NULL)))) + if ((!WriteFile(File, (char *)&ActualAccount->Flags, sizeof(DWORD), &WrittenBytes, nullptr) || + (!WriteFile(File, (char *)&ActualAccount->StatusFlags, sizeof(DWORD), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->PluginFlags, sizeof(DWORD), &WrittenBytes, nullptr)))) throw (DWORD)EACC_SYSTEM; - if (!WriteFile(File, (char *)&ActualAccount->Interval, sizeof(WORD), &WrittenBytes, NULL)) + if (!WriteFile(File, (char *)&ActualAccount->Interval, sizeof(WORD), &WrittenBytes, nullptr)) throw (DWORD)EACC_SYSTEM; - if ((!WriteFile(File, (char *)&ActualAccount->NewMailN.Flags, sizeof(DWORD), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->NewMailN.PopupB, sizeof(COLORREF), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->NewMailN.PopupT, sizeof(COLORREF), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->NewMailN.PopupTime, sizeof(DWORD), &WrittenBytes, NULL))) + if ((!WriteFile(File, (char *)&ActualAccount->NewMailN.Flags, sizeof(DWORD), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->NewMailN.PopupB, sizeof(COLORREF), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->NewMailN.PopupT, sizeof(COLORREF), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->NewMailN.PopupTime, sizeof(DWORD), &WrittenBytes, nullptr))) throw (DWORD)EACC_SYSTEM; if ((Stat = WriteStringToFileW(File, ActualAccount->NewMailN.App)) || (Stat = WriteStringToFileW(File, ActualAccount->NewMailN.AppParam))) throw (DWORD)Stat; - if ((!WriteFile(File, (char *)&ActualAccount->NoNewMailN.Flags, sizeof(DWORD), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->NoNewMailN.PopupB, sizeof(COLORREF), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->NoNewMailN.PopupT, sizeof(COLORREF), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->NoNewMailN.PopupTime, sizeof(DWORD), &WrittenBytes, NULL))) + if ((!WriteFile(File, (char *)&ActualAccount->NoNewMailN.Flags, sizeof(DWORD), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->NoNewMailN.PopupB, sizeof(COLORREF), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->NoNewMailN.PopupT, sizeof(COLORREF), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->NoNewMailN.PopupTime, sizeof(DWORD), &WrittenBytes, nullptr))) throw (DWORD)EACC_SYSTEM; if ((Stat = WriteStringToFileW(File, ActualAccount->NoNewMailN.App)) || (Stat = WriteStringToFileW(File, ActualAccount->NoNewMailN.AppParam))) throw (DWORD)Stat; - if ((!WriteFile(File, (char *)&ActualAccount->BadConnectN.Flags, sizeof(DWORD), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->BadConnectN.PopupB, sizeof(COLORREF), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->BadConnectN.PopupT, sizeof(COLORREF), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->BadConnectN.PopupTime, sizeof(DWORD), &WrittenBytes, NULL))) + if ((!WriteFile(File, (char *)&ActualAccount->BadConnectN.Flags, sizeof(DWORD), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->BadConnectN.PopupB, sizeof(COLORREF), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->BadConnectN.PopupT, sizeof(COLORREF), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->BadConnectN.PopupTime, sizeof(DWORD), &WrittenBytes, nullptr))) throw (DWORD)EACC_SYSTEM; if ((Stat = WriteStringToFileW(File, ActualAccount->BadConnectN.App)) || @@ -919,7 +919,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) throw (DWORD)Stat; //Let plugin write its own values into file - if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->WritePluginOptsFcnPtr != NULL) + if (ActualAccount->Plugin->Fcn != nullptr && ActualAccount->Plugin->Fcn->WritePluginOptsFcnPtr != nullptr) if (Stat = ActualAccount->Plugin->Fcn->WritePluginOptsFcnPtr(File, ActualAccount)) throw (DWORD)Stat; #ifdef DEBUG_SYNCHRO @@ -942,10 +942,10 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) #endif ReadDoneFcn(ActualAccount->MessagesAccessSO); - if ((!WriteFile(File, (char *)&ActualAccount->LastChecked, sizeof(SYSTEMTIME), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->LastSChecked, sizeof(SYSTEMTIME), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->LastSynchronised, sizeof(SYSTEMTIME), &WrittenBytes, NULL)) || - (!WriteFile(File, (char *)&ActualAccount->LastMail, sizeof(SYSTEMTIME), &WrittenBytes, NULL))) + if ((!WriteFile(File, (char *)&ActualAccount->LastChecked, sizeof(SYSTEMTIME), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->LastSChecked, sizeof(SYSTEMTIME), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->LastSynchronised, sizeof(SYSTEMTIME), &WrittenBytes, nullptr)) || + (!WriteFile(File, (char *)&ActualAccount->LastMail, sizeof(SYSTEMTIME), &WrittenBytes, nullptr))) throw (DWORD)Stat; #ifdef DEBUG_SYNCHRO @@ -976,7 +976,7 @@ INT_PTR WriteAccountsToFileSvc(WPARAM wParam, LPARAM lParam) HYAMNPROTOPLUGIN Plugin = (HYAMNPROTOPLUGIN)wParam; mir_cslock lck(csFileWritingCS); - HANDLE hFile = CreateFile((wchar_t*)lParam, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile((wchar_t*)lParam, GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) return EACC_SYSTEM; @@ -996,8 +996,8 @@ INT_PTR FindAccountByNameSvc(WPARAM wParam, LPARAM lParam) #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"FindAccountByName:AccountBrowserSO-read enter\n"); #endif - for (Finder = Plugin->FirstAccount; Finder != NULL; Finder = Finder->Next) - if ((Finder->Name != NULL) && (0 == mir_strcmp(SearchedAccount, Finder->Name))) + for (Finder = Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) + if ((Finder->Name != nullptr) && (0 == mir_strcmp(SearchedAccount, Finder->Name))) break; #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"FindAccountByName:AccountBrowserSO-read done\n"); @@ -1011,12 +1011,12 @@ INT_PTR GetNextFreeAccountSvc(WPARAM wParam, LPARAM lParam) HYAMNPROTOPLUGIN Plugin = (HYAMNPROTOPLUGIN)wParam; HACCOUNT Finder; - if (Plugin->FirstAccount == NULL) + if (Plugin->FirstAccount == nullptr) { Plugin->FirstAccount = (HACCOUNT)CallService(MS_YAMN_CREATEPLUGINACCOUNT, wParam, lParam); return (INT_PTR)Plugin->FirstAccount; } - for (Finder = Plugin->FirstAccount; Finder->Next != NULL; Finder = Finder->Next); + for (Finder = Plugin->FirstAccount; Finder->Next != nullptr; Finder = Finder->Next); Finder->Next = (HACCOUNT)CallService(MS_YAMN_CREATEPLUGINACCOUNT, wParam, lParam); return (INT_PTR)Finder->Next; } @@ -1067,7 +1067,7 @@ INT_PTR DeleteAccountSvc(WPARAM wParam, LPARAM lParam) //1. set stop signal StopSignalFcn(Which); WindowList_BroadcastAsync(YAMNVar.MessageWnds, WM_YAMN_STOPACCOUNT, (WPARAM)Which, 0); - if (Plugin->Fcn->StopAccountFcnPtr != NULL) + if (Plugin->Fcn->StopAccountFcnPtr != nullptr) Plugin->Fcn->StopAccountFcnPtr(Which); //2. wait to get write access @@ -1080,7 +1080,7 @@ INT_PTR DeleteAccountSvc(WPARAM wParam, LPARAM lParam) #endif //3. remove from queue (chained list) - if (Plugin->FirstAccount == NULL) + if (Plugin->FirstAccount == nullptr) { #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"DeleteAccount:AccountBrowserSO-write done\n"); @@ -1110,7 +1110,7 @@ INT_PTR DeleteAccountSvc(WPARAM wParam, LPARAM lParam) // No, of course not. We will create new thread, that will wait and additionally remove our thread in background. //5. So, the last point (deleting from memory) is performed in new DeleteAccountInBackground thread - if ((Plugin->Fcn != NULL) && (Plugin->Fcn->WriteAccountsFcnPtr != NULL)) + if ((Plugin->Fcn != nullptr) && (Plugin->Fcn->WriteAccountsFcnPtr != nullptr)) Plugin->Fcn->WriteAccountsFcnPtr(); CloseHandle(mir_forkthread(DeleteAccountInBackground, (void*)Which)); @@ -1138,12 +1138,12 @@ int StopAccounts(HYAMNPROTOPLUGIN Plugin) #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"StopAccounts:AccountBrowserSO-write enter\n"); #endif - for (Finder = Plugin->FirstAccount; Finder != NULL; Finder = Finder->Next) + for (Finder = Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) { //2. set stop signal StopSignalFcn(Finder); WindowList_BroadcastAsync(YAMNVar.MessageWnds, WM_YAMN_STOPACCOUNT, (WPARAM)Finder, 0); - if (Plugin->Fcn->StopAccountFcnPtr != NULL) + if (Plugin->Fcn->StopAccountFcnPtr != nullptr) Plugin->Fcn->StopAccountFcnPtr(Finder); } @@ -1172,7 +1172,7 @@ int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin, BOOL GetAccountBrowserAccess) DebugLog(SynchroFile,"WaitForAllAccounts:AccountBrowserSO-write enter\n"); #endif } - for (Finder = Plugin->FirstAccount; Finder != NULL; Finder = Finder->Next) + for (Finder = Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) { //2. wait for signal that account is not in use #ifdef DEBUG_SYNCHRO @@ -1211,7 +1211,7 @@ int DeleteAccounts(HYAMNPROTOPLUGIN Plugin) WaitForAllAccounts(Plugin, FALSE); - for (Finder = Plugin->FirstAccount; Finder != NULL;) + for (Finder = Plugin->FirstAccount; Finder != nullptr;) { HACCOUNT Next = Finder->Next; DeletePluginAccountSvc((WPARAM)Finder, 0); @@ -1228,7 +1228,7 @@ int DeleteAccounts(HYAMNPROTOPLUGIN Plugin) void WINAPI GetStatusFcn(HACCOUNT Which, wchar_t *Value) { - if (Which == NULL) + if (Which == nullptr) return; mir_cslock lck(csAccountStatusCS); @@ -1237,7 +1237,7 @@ void WINAPI GetStatusFcn(HACCOUNT Which, wchar_t *Value) void WINAPI SetStatusFcn(HACCOUNT Which, wchar_t *Value) { - if (Which != NULL) { + if (Which != nullptr) { mir_cslock lck(csAccountStatusCS); mir_wstrcpy(Which->Status, Value); } diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index 90f5815d4e..d66878578e 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -30,20 +30,20 @@ LRESULT CALLBACK BadConnectPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"PopupProc:LEFTCLICK:ActualAccountSO-read enter\n");
#endif
- if (ActualAccount->BadConnectN.App != NULL) {
+ if (ActualAccount->BadConnectN.App != nullptr) {
WCHAR *Command;
- if (ActualAccount->BadConnectN.AppParam != NULL)
+ if (ActualAccount->BadConnectN.AppParam != nullptr)
Command = new WCHAR[mir_wstrlen(ActualAccount->BadConnectN.App) + mir_wstrlen(ActualAccount->BadConnectN.AppParam) + 6];
else
Command = new WCHAR[mir_wstrlen(ActualAccount->BadConnectN.App) + 6];
- if (Command != NULL) {
+ if (Command != nullptr) {
mir_wstrcpy(Command, L"\"");
mir_wstrcat(Command, ActualAccount->BadConnectN.App);
mir_wstrcat(Command, L"\" ");
- if (ActualAccount->BadConnectN.AppParam != NULL)
+ if (ActualAccount->BadConnectN.AppParam != nullptr)
mir_wstrcat(Command, ActualAccount->BadConnectN.AppParam);
- CreateProcessW(NULL, Command, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
+ CreateProcessW(nullptr, Command, nullptr, nullptr, FALSE, NORMAL_PRIORITY_CLASS, nullptr, nullptr, &si, &pi);
delete[] Command;
}
}
@@ -84,8 +84,8 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP HACCOUNT ActualAccount;
DWORD ErrorCode;
char* TitleStrA;
- char *Message1A = NULL;
- wchar_t *Message1W = NULL;
+ char *Message1A = nullptr;
+ wchar_t *Message1W = nullptr;
POPUPDATAT BadConnectPopup;
ActualAccount = ((struct BadConnectionParam *)lParam)->account;
@@ -122,14 +122,14 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP mir_wstrncpy(BadConnectPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(BadConnectPopup.lptzContactName));
}
- if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr != NULL) {
+ if (ActualAccount->Plugin->Fcn != nullptr && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr != nullptr) {
Message1W = ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode);
SetDlgItemText(hDlg, IDC_STATICMSG, Message1W);
wcsncpy_s(BadConnectPopup.lptzText, Message1W, _TRUNCATE);
if (ShowPopup)
PUAddPopupT(&BadConnectPopup);
}
- else if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->GetErrorStringAFcnPtr != NULL)
+ else if (ActualAccount->Plugin->Fcn != nullptr && ActualAccount->Plugin->Fcn->GetErrorStringAFcnPtr != nullptr)
{
Message1W = ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode);
SetDlgItemText(hDlg, IDC_STATICMSG, Message1W);
@@ -155,11 +155,11 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP SetWindowTextA(hDlg, TitleStrA);
delete[] TitleStrA;
- if (Message1A != NULL)
+ if (Message1A != nullptr)
delete[] Message1A;
- if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr != NULL && Message1A != NULL)
+ if (ActualAccount->Plugin->Fcn != nullptr && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr != nullptr && Message1A != nullptr)
ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr(Message1A);
- if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr != NULL && Message1W != NULL)
+ if (ActualAccount->Plugin->Fcn != nullptr && ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr != nullptr && Message1W != nullptr)
ActualAccount->Plugin->Fcn->DeleteErrorStringFcnPtr(Message1W);
return 0;
}
@@ -229,7 +229,7 @@ void __cdecl BadConnection(void *Param) __try
{
- hBadConnect = CreateDialogParam(YAMNVar.hInst, MAKEINTRESOURCE(IDD_DLGBADCONNECT), NULL, DlgProcYAMNBadConnection, (LPARAM)&MyParam);
+ hBadConnect = CreateDialogParam(YAMNVar.hInst, MAKEINTRESOURCE(IDD_DLGBADCONNECT), nullptr, DlgProcYAMNBadConnection, (LPARAM)&MyParam);
Window_SetIcon_IcoLib(hBadConnect, g_GetIconHandle(3));
#ifdef DEBUG_SYNCHRO
@@ -267,14 +267,14 @@ void __cdecl BadConnection(void *Param) ReadDoneFcn(ActualAccount->AccountAccessSO);
UpdateWindow(hBadConnect);
- while (GetMessage(&msg, NULL, 0, 0))
+ while (GetMessage(&msg, nullptr, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// now, write to file. Why? Because we want to write when was new mail last checked
- if ((ActualAccount->Plugin->Fcn != NULL) && (ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr != NULL) && ActualAccount->AbleToWork)
+ if ((ActualAccount->Plugin->Fcn != nullptr) && (ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr != nullptr) && ActualAccount->AbleToWork)
ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr();
}
__finally
@@ -296,12 +296,12 @@ INT_PTR RunBadConnectionSvc(WPARAM wParam, LPARAM lParam) if ((DWORD)lParam != YAMN_BADCONNECTIONVERSION)
return 0;
- if (NULL != (ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL)))
+ if (nullptr != (ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr)))
{
HANDLE NewThread;
Param->ThreadRunningEV = ThreadRunningEV;
- if (NULL != (NewThread = mir_forkthread(BadConnection, (void*)Param)))
+ if (nullptr != (NewThread = mir_forkthread(BadConnection, (void*)Param)))
{
WaitForSingleObject(ThreadRunningEV, INFINITE);
CloseHandle(NewThread);
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index 9342ecc1aa..58269b94af 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -204,7 +204,7 @@ inline HACCOUNT GetWindowAccount(HWND hDlg) { struct CMailWinUserInfo *mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER); - return (mwui == NULL) ? NULL : mwui->Account; + return (mwui == nullptr) ? nullptr : mwui->Account; } void IncrementMailCounters(HYAMNMAIL msgq, struct CMailNumbers *MN) @@ -354,11 +354,11 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags) memset(&MN, 0, sizeof(MN)); - for (HYAMNMAIL msgq = (HYAMNMAIL)ActualAccount->Mails; msgq != NULL; msgq = msgq->Next) { + for (HYAMNMAIL msgq = (HYAMNMAIL)ActualAccount->Mails; msgq != nullptr; msgq = msgq->Next) { if (!LoadedMailData(msgq)) //check if mail is already in memory { Loaded = false; - if (NULL == LoadMailData(msgq)) //if we could not load mail to memory, consider this mail deleted and do not display it + if (nullptr == LoadMailData(msgq)) //if we could not load mail to memory, consider this mail deleted and do not display it continue; } else @@ -370,12 +370,12 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags) UnloadMailData(msgq); //do not keep data for mail in memory } - if (mwui != NULL) + if (mwui != nullptr) mwui->UpdateMailsMessagesAccess = TRUE; //Now we are going to check if extracting data from mail headers are needed. //If popups will be displayed or mailbrowser window - if ((((mwui != NULL) && !(mwui->RunFirstTime)) && + if ((((mwui != nullptr) && !(mwui->RunFirstTime)) && ( ((nnflags & YAMN_ACC_MSGP) && !(MN.Real.BrowserUC + MN.Virtual.BrowserUC)) || ((nflags & YAMN_ACC_MSGP) && (MN.Real.BrowserUC + MN.Virtual.BrowserUC)) @@ -397,7 +397,7 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags) if (RunMailBrowser) ChangeExistingMailStatus(GetDlgItem(hDlg, IDC_LISTMAILS), ActualAccount); if (RunMailBrowser || RunPopups) - AddNewMailsToListView(hDlg == NULL ? NULL : GetDlgItem(hDlg, IDC_LISTMAILS), ActualAccount, nflags); + AddNewMailsToListView(hDlg == nullptr ? nullptr : GetDlgItem(hDlg, IDC_LISTMAILS), ActualAccount, nflags); if (RunMailBrowser) { size_t len = mir_strlen(ActualAccount->Name) + mir_strlen(Translate(MAILBROWSERTITLE)) + 10; //+10 chars for numbers @@ -425,7 +425,7 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags) if (!RunMailBrowser) SetRemoveFlagsInQueueFcn((HYAMNMAIL)ActualAccount->Mails, YAMN_MSG_UNSEEN, YAMN_MSG_STAYUNSEEN, YAMN_MSG_UNSEEN, YAMN_FLAG_REMOVE); //remove the unseen flag when it was not displayed and it has not "stay unseen" flag set - if (mwui != NULL) { + if (mwui != nullptr) { mwui->UpdateMailsMessagesAccess = FALSE; mwui->RunFirstTime = FALSE; } @@ -438,7 +438,7 @@ int UpdateMails(HWND hDlg, HACCOUNT ActualAccount, DWORD nflags, DWORD nnflags) if (RunMailBrowser) UpdateWindow(GetDlgItem(hDlg, IDC_LISTMAILS)); - else if (hDlg != NULL) + else if (hDlg != nullptr) DestroyWindow(hDlg); return 1; @@ -459,8 +459,8 @@ int ChangeExistingMailStatus(HWND hListView, HACCOUNT ActualAccount) mail = (HYAMNMAIL)item.lParam; else continue; - for (msgq = (HYAMNMAIL)ActualAccount->Mails; (msgq != NULL) && (msgq != mail); msgq = msgq->Next); //found the same mail in account queue - if (msgq == NULL) //if mail was not found + for (msgq = (HYAMNMAIL)ActualAccount->Mails; (msgq != nullptr) && (msgq != mail); msgq = msgq->Next); //found the same mail in account queue + if (msgq == nullptr) //if mail was not found if (TRUE == ListView_DeleteItem(hListView, i)) { in--; i--; continue; @@ -487,7 +487,7 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) memset(&item, 0, sizeof(item)); memset(&UnicodeHeader, 0, sizeof(UnicodeHeader)); - if (hListView != NULL) { + if (hListView != nullptr) { item.mask = LVIF_TEXT | LVIF_PARAM; item.iItem = 0; memset(&fi, 0, sizeof(fi)); @@ -509,14 +509,14 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) NewMailPopup.iSeconds = ActualAccount->NewMailN.PopupTime; NewMailPopup.PluginWindowProc = NewMailPopupProc; - NewMailPopup.PluginData = 0; //it's new mail popup + NewMailPopup.PluginData = nullptr; //it's new mail popup - for (HYAMNMAIL msgq = (HYAMNMAIL)ActualAccount->Mails; msgq != NULL; msgq = msgq->Next, lfoundi++) { + for (HYAMNMAIL msgq = (HYAMNMAIL)ActualAccount->Mails; msgq != nullptr; msgq = msgq->Next, lfoundi++) { // now we hide mail pointer to item's lParam member. We can later use it to retrieve mail datas - Extracted = FALSE; FromStr = NULL; FromStrNew = FALSE; + Extracted = FALSE; FromStr = nullptr; FromStrNew = FALSE; - if (hListView != NULL) { + if (hListView != nullptr) { fi.lParam = (LPARAM)msgq; if (-1 != (foundi = ListView_FindItem(hListView, -1, &fi))) { // if mail is already in window lfoundi = foundi; @@ -529,43 +529,43 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) if (!LoadedMailData(msgq)) { // check if mail is already in memory Loaded = false; - if (NULL == LoadMailData(msgq)) //if we could not load mail to memory, consider this mail deleted and do not display it + if (nullptr == LoadMailData(msgq)) //if we could not load mail to memory, consider this mail deleted and do not display it continue; } else Loaded = true; - if (((hListView != NULL) && (msgq->Flags & YAMN_MSG_DISPLAY)) || + if (((hListView != nullptr) && (msgq->Flags & YAMN_MSG_DISPLAY)) || ((nflags & YAMN_ACC_POP) && (ActualAccount->Flags & YAMN_ACC_POPN) && (msgq->Flags & YAMN_MSG_POPUP) && (msgq->Flags & YAMN_MSG_NEW))) { if (!Extracted) ExtractHeader(msgq->MailData->TranslatedHeader, msgq->MailData->CP, &UnicodeHeader); Extracted = TRUE; - if ((UnicodeHeader.From != NULL) && (UnicodeHeader.FromNick != NULL)) { + if ((UnicodeHeader.From != nullptr) && (UnicodeHeader.FromNick != nullptr)) { size_t size = mir_wstrlen(UnicodeHeader.From) + mir_wstrlen(UnicodeHeader.FromNick) + 4; FromStr = new WCHAR[size]; mir_snwprintf(FromStr, size, L"%s <%s>", UnicodeHeader.FromNick, UnicodeHeader.From); FromStrNew = TRUE; } - else if (UnicodeHeader.From != NULL) + else if (UnicodeHeader.From != nullptr) FromStr = UnicodeHeader.From; - else if (UnicodeHeader.FromNick != NULL) + else if (UnicodeHeader.FromNick != nullptr) FromStr = UnicodeHeader.FromNick; - else if (UnicodeHeader.ReturnPath != NULL) + else if (UnicodeHeader.ReturnPath != nullptr) FromStr = UnicodeHeader.ReturnPath; - if (NULL == FromStr) { + if (nullptr == FromStr) { FromStr = L""; FromStrNew = FALSE; } } - if ((hListView != NULL) && (msgq->Flags & YAMN_MSG_DISPLAY)) { + if ((hListView != nullptr) && (msgq->Flags & YAMN_MSG_DISPLAY)) { item.iSubItem = 0; item.pszText = FromStr; item.iItem = SendMessage(hListView, LVM_INSERTITEM, 0, (LPARAM)&item); item.iSubItem = 1; - item.pszText = (NULL != UnicodeHeader.Subject ? UnicodeHeader.Subject : (WCHAR*)L""); + item.pszText = (nullptr != UnicodeHeader.Subject ? UnicodeHeader.Subject : (WCHAR*)L""); SendMessage(hListView, LVM_SETITEMTEXT, (WPARAM)item.iItem, (LPARAM)&item); item.iSubItem = 2; @@ -576,7 +576,7 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) item.iSubItem = 3; item.pszText = L""; - for (CMimeItem *heads = msgq->MailData->TranslatedHeader; heads != NULL; heads = heads->Next) { + for (CMimeItem *heads = msgq->MailData->TranslatedHeader; heads != nullptr; heads = heads->Next) { if (!_stricmp(heads->name, "Date")) { MimeDateToLocalizedDateTime(heads->value, LocalDateStr, 128); item.pszText = LocalDateStr; @@ -594,7 +594,7 @@ int AddNewMailsToListView(HWND hListView, HACCOUNT ActualAccount, DWORD nflags) if (MailParam) { MailParam->account = ActualAccount; MailParam->mail = msgq; - MailParam->ThreadRunningEV = 0; + MailParam->ThreadRunningEV = nullptr; NewMailPopup.PluginData = MailParam; PUAddPopupT(&NewMailPopup); } @@ -671,7 +671,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D NewMailPopup.iSeconds = ActualAccount->NewMailN.PopupTime; NewMailPopup.PluginWindowProc = NewMailPopupProc; - NewMailPopup.PluginData = (void *)0; //multiple popups + NewMailPopup.PluginData = (void *)nullptr; //multiple popups mir_wstrncpy(NewMailPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(NewMailPopup.lptzContactName)); mir_snwprintf(NewMailPopup.lptzText, TranslateT("%d new mail message(s), %d total"), MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC); @@ -679,14 +679,14 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D } // destroy tray icon if no new mail - if ((MN->Real.SysTrayUC + MN->Virtual.SysTrayUC == 0) && (hDlg != NULL)) + if ((MN->Real.SysTrayUC + MN->Virtual.SysTrayUC == 0) && (hDlg != nullptr)) Shell_NotifyIcon(NIM_DELETE, &nid); // and remove the event if ((nflags & YAMN_ACC_CONT) && (!(nflags & YAMN_ACC_CONTNOEVENT)) && (MN->Real.UnSeen + MN->Virtual.UnSeen == 0)) pcli->pfnRemoveEvent(ActualAccount->hContact, ActualAccount->hContact); - if ((MN->Real.BrowserUC + MN->Virtual.BrowserUC == 0) && (hDlg != NULL)) { + if ((MN->Real.BrowserUC + MN->Virtual.BrowserUC == 0) && (hDlg != nullptr)) { if (!IsWindowVisible(hDlg) && !(nflags & YAMN_ACC_MSG)) PostMessage(hDlg, WM_DESTROY, 0, 0); //destroy window if no new mail and window is not visible if (nnflags & YAMN_ACC_MSG) //if no new mail and msg should be executed @@ -696,7 +696,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D } } else - if (hDlg != NULL) //else insert icon and set window if new mails + if (hDlg != nullptr) //else insert icon and set window if new mails { SendDlgItemMessageW(hDlg, IDC_LISTMAILS, LVM_SCROLL, 0, (LPARAM)0x7ffffff); @@ -706,7 +706,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D nid.uCallbackMessage = WM_YAMN_NOTIFYICON; mir_snwprintf(nid.szTip, L"%S %s", ActualAccount->Name, TranslateT("- new mail message(s)")); Shell_NotifyIcon(NIM_ADD, &nid); - SetTimer(hDlg, TIMER_FLASHING, 500, NULL); + SetTimer(hDlg, TIMER_FLASHING, 500, nullptr); } if (nflags & YAMN_ACC_MSG) //if no new mail and msg should be executed ShowWindow(hDlg, SW_SHOWNORMAL); @@ -719,20 +719,20 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D memset(&si, 0, sizeof(si)); si.cb = sizeof(si); - if (ActualAccount->NewMailN.App != NULL) { + if (ActualAccount->NewMailN.App != nullptr) { WCHAR *Command; - if (ActualAccount->NewMailN.AppParam != NULL) + if (ActualAccount->NewMailN.AppParam != nullptr) Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + mir_wstrlen(ActualAccount->NewMailN.AppParam) + 6]; else Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + 6]; - if (Command != NULL) { + if (Command != nullptr) { mir_wstrcpy(Command, L"\""); mir_wstrcat(Command, ActualAccount->NewMailN.App); mir_wstrcat(Command, L"\" "); - if (ActualAccount->NewMailN.AppParam != NULL) + if (ActualAccount->NewMailN.AppParam != nullptr) mir_wstrcat(Command, ActualAccount->NewMailN.AppParam); - CreateProcessW(NULL, Command, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi); + CreateProcessW(nullptr, Command, nullptr, nullptr, FALSE, NORMAL_PRIORITY_CLASS, nullptr, nullptr, &si, &pi); delete[] Command; } } @@ -759,7 +759,7 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D NoNewMailPopup.iSeconds = ActualAccount->NoNewMailN.PopupTime; NoNewMailPopup.PluginWindowProc = NoNewMailPopupProc; - NoNewMailPopup.PluginData = 0; //it's not new mail popup + NoNewMailPopup.PluginData = nullptr; //it's not new mail popup mir_wstrncpy(NoNewMailPopup.lptzContactName, _A2T(ActualAccount->Name), _countof(NoNewMailPopup.lptzContactName)); if (MN->Real.PopupSL2NC + MN->Virtual.PopupSL2NC) @@ -800,9 +800,9 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa memcpy(MailParam, (PINT_PTR)PluginParam, sizeof(YAMN_MAILSHOWPARAM)); hContact = MailParam->account->hContact; Account = MailParam->account; - if (NULL != (MailParam->ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL))) { + if (nullptr != (MailParam->ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr))) { HANDLE NewThread = mir_forkthread(ShowEmailThread, MailParam); - if (NewThread != NULL) { + if (NewThread != nullptr) { CloseHandle(NewThread); } CloseHandle(MailParam->ThreadRunningEV); @@ -832,7 +832,7 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa switch (msg) { case WM_COMMAND: { - YAMN_MAILBROWSERPARAM Param = { (HANDLE)0, Account, + YAMN_MAILBROWSERPARAM Param = { (HANDLE)nullptr, Account, (Account->NewMailN.Flags & ~YAMN_ACC_POP) | YAMN_ACC_MSGP | YAMN_ACC_MSG, (Account->NoNewMailN.Flags & ~YAMN_ACC_POP) | YAMN_ACC_MSGP | YAMN_ACC_MSG }; @@ -923,7 +923,7 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l switch (msg) { case WM_COMMAND: { - YAMN_MAILBROWSERPARAM Param = { (HANDLE)0, ActualAccount, ActualAccount->NewMailN.Flags, ActualAccount->NoNewMailN.Flags, 0 }; + YAMN_MAILBROWSERPARAM Param = { (HANDLE)nullptr, ActualAccount, ActualAccount->NewMailN.Flags, ActualAccount->NoNewMailN.Flags, nullptr }; Param.nnflags = Param.nnflags | YAMN_ACC_MSG; //show mails in account even no new mail in account Param.nnflags = Param.nnflags & ~YAMN_ACC_POP; @@ -1008,7 +1008,7 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l ULONGLONG MimeDateToFileTime(char *datein) { - char *day = 0, *month = 0, *year = 0, *time = 0, *shift = 0; + char *day = nullptr, *month = nullptr, *year = nullptr, *time = nullptr, *shift = nullptr; SYSTEMTIME st; ULONGLONG res = 0; int wShiftSeconds = TimeZone_ToLocal(0); @@ -1047,7 +1047,7 @@ ULONGLONG MimeDateToFileTime(char *datein) m[0] = 0; m++; if (s = strchr(m, ':')) { s[0] = 0; s++; } } - else s = 0; + else s = nullptr; st.wHour = atoi(h); st.wMinute = m ? atoi(m) : 0; st.wSecond = s ? atoi(s) : 0; @@ -1117,11 +1117,11 @@ void FileTimeToLocalizedDateTime(LONGLONG filetime, WCHAR *dateout, int lendateo int templen = 0; if (!willShowDate) willShowDate = (wTodayYear != st.wYear) || (wTodayMonth != st.wMonth) || (wTodayDay != st.wDay); if (willShowDate) { - templen = GetDateFormatW(localeID, (optDateTime&SHOWDATELONG) ? DATE_LONGDATE : DATE_SHORTDATE, &st, NULL, dateout, lendateout - 2); + templen = GetDateFormatW(localeID, (optDateTime&SHOWDATELONG) ? DATE_LONGDATE : DATE_SHORTDATE, &st, nullptr, dateout, lendateout - 2); dateout[templen - 1] = ' '; } if (templen < (lendateout - 1)) { - GetTimeFormatW(localeID, (optDateTime&SHOWDATENOSECONDS) ? TIME_NOSECONDS : 0, &st, NULL, &dateout[templen], lendateout - templen - 1); + GetTimeFormatW(localeID, (optDateTime&SHOWDATENOSECONDS) ? TIME_NOSECONDS : 0, &st, nullptr, &dateout[templen], lendateout - templen - 1); } } } @@ -1154,11 +1154,11 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo switch ((int)lParamSort) { case 0: //From - if (Header1.FromNick == NULL) + if (Header1.FromNick == nullptr) str1 = Header1.From; else str1 = Header1.FromNick; - if (Header2.FromNick == NULL) + if (Header2.FromNick == nullptr) str2 = Header2.From; else str2 = Header2.FromNick; @@ -1167,11 +1167,11 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo if (bFrom) nResult = -nResult; break; case 1: //Subject - if (Header1.Subject == NULL) + if (Header1.Subject == nullptr) str1 = " "; else str1 = Header1.Subject; - if (Header2.Subject == NULL) + if (Header2.Subject == nullptr) str2 = " "; else str2 = Header2.Subject; @@ -1200,10 +1200,10 @@ int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo break; default: - if (Header1.Subject == NULL) str1 = " "; + if (Header1.Subject == nullptr) str1 = " "; else str1 = Header1.Subject; - if (Header2.Subject == NULL) str2 = " "; + if (Header2.Subject == nullptr) str2 = " "; else str2 = Header2.Subject; nResult = mir_strcmp(str1, str2); @@ -1262,8 +1262,8 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR case WM_INITDIALOG: { PYAMN_MAILSHOWPARAM MailParam = (PYAMN_MAILSHOWPARAM)lParam; - WCHAR *iHeaderW = NULL; - WCHAR *iValueW = NULL; + WCHAR *iHeaderW = nullptr; + WCHAR *iValueW = nullptr; int StrLen; HWND hListView = GetDlgItem(hDlg, IDC_LISTHEADERS); mir_subclassWindow(GetDlgItem(hDlg, IDC_SPLITTER), SplitterSubclassProc); @@ -1273,11 +1273,11 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR ListView_SetUnicodeFormat(hListView, TRUE); ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT); - StrLen = MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, Translate("Header"), -1, NULL, 0); + StrLen = MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, Translate("Header"), -1, nullptr, 0); iHeaderW = new WCHAR[StrLen + 1]; MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, Translate("Header"), -1, iHeaderW, StrLen); - StrLen = MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, Translate("Value"), -1, NULL, 0); + StrLen = MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, Translate("Value"), -1, nullptr, 0); iValueW = new WCHAR[StrLen + 1]; MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, Translate("Value"), -1, iValueW, StrLen); @@ -1285,9 +1285,9 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR LVCOLUMN lvc1 = { LVCF_FMT | LVCF_TEXT | LVCF_WIDTH, LVCFMT_LEFT, 400, iValueW, 0, 0 }; SendMessage(hListView, LVM_INSERTCOLUMN, 0, (LPARAM)&lvc0); SendMessage(hListView, LVM_INSERTCOLUMN, 1, (LPARAM)&lvc1); - if (NULL != iHeaderW) + if (nullptr != iHeaderW) delete[] iHeaderW; - if (NULL != iValueW) + if (nullptr != iValueW) delete[] iValueW; //WindowList_Add(YAMNVar.MessageWnds,hDlg,NULL); @@ -1310,18 +1310,18 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR struct CMimeItem *Header; LVITEMW item; item.mask = LVIF_TEXT | LVIF_PARAM; - WCHAR *From = 0, *Subj = 0; - char *contentType = 0, *transEncoding = 0, *body = 0; //should not be delete[]-ed - for (Header = MailParam->mail->MailData->TranslatedHeader; Header != NULL; Header = Header->Next) { - WCHAR *str1 = 0; - WCHAR *str2 = 0; + WCHAR *From = nullptr, *Subj = nullptr; + char *contentType = nullptr, *transEncoding = nullptr, *body = nullptr; //should not be delete[]-ed + for (Header = MailParam->mail->MailData->TranslatedHeader; Header != nullptr; Header = Header->Next) { + WCHAR *str1 = nullptr; + WCHAR *str2 = nullptr; WCHAR str_nul[2] = { 0 }; if (!body) if (!_stricmp(Header->name, "Body")) { body = Header->value; continue; } if (!contentType) if (!_stricmp(Header->name, "Content-Type")) contentType = Header->value; if (!transEncoding) if (!_stricmp(Header->name, "Content-Transfer-Encoding")) transEncoding = Header->value; //ConvertCodedStringToUnicode(Header->name,&str1,MailParam->mail->MailData->CP,1); { - int streamsize = MultiByteToWideChar(20127, 0, Header->name, -1, NULL, 0); + int streamsize = MultiByteToWideChar(20127, 0, Header->name, -1, nullptr, 0); str1 = (WCHAR *)malloc(sizeof(WCHAR) * (streamsize + 1)); MultiByteToWideChar(20127, 0, Header->name, -1, str1, streamsize);//US-ASCII } @@ -1336,7 +1336,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR mir_wstrcpy(Subj, str2); } //if (!hasBody) if (!mir_strcmp(Header->name,"Body")) hasBody = true; - int count = 0; WCHAR **split = 0; + int count = 0; WCHAR **split = nullptr; int ofs = 0; while (str2[ofs]) { if ((str2[ofs] == 0x266A) || (str2[ofs] == 0x25D9) || (str2[ofs] == 0x25CB) || @@ -1368,11 +1368,11 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR item.pszText = str1; else { item.iItem++; - item.pszText = 0; + item.pszText = nullptr; } item.iItem = SendMessage(hListView, LVM_INSERTITEM, 0, (LPARAM)&item); item.iSubItem = 1; - item.pszText = str2 ? split[i] : 0; + item.pszText = str2 ? split[i] : nullptr; SendMessage(hListView, LVM_SETITEMTEXT, (WPARAM)item.iItem, (LPARAM)&item); } delete[] split; @@ -1383,8 +1383,8 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR free(str2); } if (body) { - WCHAR *bodyDecoded = 0; - char *localBody = 0; + WCHAR *bodyDecoded = nullptr; + char *localBody = nullptr; if (contentType) { if (!_strnicmp(contentType, "text", 4)) { if (transEncoding) { @@ -1401,8 +1401,8 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR } } else if (!_strnicmp(contentType, "multipart/", 10)) { - char *bondary = NULL; - if (NULL != (bondary = ExtractFromContentType(contentType, "boundary="))) { + char *bondary = nullptr; + if (nullptr != (bondary = ExtractFromContentType(contentType, "boundary="))) { bodyDecoded = ParseMultipartBody(body, bondary); delete[] bondary; } @@ -1426,12 +1426,12 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR struct CChangeContent Params = { MailParam->account->NewMailN.Flags | YAMN_ACC_MSGP, MailParam->account->NoNewMailN.Flags | YAMN_ACC_MSGP }; SendMessage(hMailBrowser, WM_YAMN_CHANGECONTENT, (WPARAM)MailParam->account, (LPARAM)&Params); } - else UpdateMails(NULL, MailParam->account, MailParam->account->NewMailN.Flags, MailParam->account->NoNewMailN.Flags); + else UpdateMails(nullptr, MailParam->account, MailParam->account->NewMailN.Flags, MailParam->account->NoNewMailN.Flags); } } ShowWindow(GetDlgItem(hDlg, IDC_SPLITTER), (MailParam->mail->Flags & YAMN_MSG_BODYRECEIVED) ? SW_SHOW : SW_HIDE); ShowWindow(hEdit, (MailParam->mail->Flags & YAMN_MSG_BODYRECEIVED) ? SW_SHOW : SW_HIDE); - WCHAR *title = 0; + WCHAR *title = nullptr; size_t size = (From ? mir_wstrlen(From) : 0) + (Subj ? mir_wstrlen(Subj) : 0) + 4; title = new WCHAR[size]; if (From && Subj) @@ -1456,7 +1456,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR PYAMN_MAILSHOWPARAM MailParam = (PYAMN_MAILSHOWPARAM) (lParam ? lParam : GetWindowLongPtr(hDlg, DWLP_USER)); - if (NULL == MailParam) + if (nullptr == MailParam) break; if ((HACCOUNT)wParam != MailParam->account) break; @@ -1550,9 +1550,9 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR HMENU hMenu = CreatePopupMenu(); AppendMenu(hMenu, MF_STRING, (UINT_PTR)1, TranslateT("Copy Selected")); AppendMenu(hMenu, MF_STRING, (UINT_PTR)2, TranslateT("Copy All")); - AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); + AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr); AppendMenu(hMenu, MF_STRING, (UINT_PTR)0, TranslateT("Cancel")); - int nReturnCmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, NULL); + int nReturnCmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, nullptr); DestroyMenu(hMenu); if (nReturnCmd > 0) { int courRow = 0; @@ -1605,7 +1605,7 @@ void __cdecl ShowEmailThread(void *Param) //if (!BringWindowToTop(MyParam.mail->MsgWindow)) { if (!SetForegroundWindow(MyParam.mail->MsgWindow)) { SendMessage(MyParam.mail->MsgWindow, WM_DESTROY, 0, 0); - MyParam.mail->MsgWindow = 0; + MyParam.mail->MsgWindow = nullptr; goto CREADTEVIEWMESSAGEWINDOW; } else { @@ -1616,17 +1616,17 @@ void __cdecl ShowEmailThread(void *Param) } else { CREADTEVIEWMESSAGEWINDOW: - MyParam.mail->MsgWindow = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGSHOWMESSAGE), NULL, DlgProcYAMNShowMessage, (LPARAM)&MyParam); + MyParam.mail->MsgWindow = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGSHOWMESSAGE), nullptr, DlgProcYAMNShowMessage, (LPARAM)&MyParam); WindowList_Add(YAMNVar.MessageWnds, MyParam.mail->MsgWindow, NULL); MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) { - if (MyParam.mail->MsgWindow == NULL || !IsDialogMessage(MyParam.mail->MsgWindow, &msg)) { /* Wine fix. */ + while (GetMessage(&msg, nullptr, 0, 0)) { + if (MyParam.mail->MsgWindow == nullptr || !IsDialogMessage(MyParam.mail->MsgWindow, &msg)) { /* Wine fix. */ TranslateMessage(&msg); DispatchMessage(&msg); } } WindowList_Remove(YAMNVar.MessageWnds, MyParam.mail->MsgWindow); - MyParam.mail->MsgWindow = NULL; + MyParam.mail->MsgWindow = nullptr; } #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile, "ShowMessage:Decrementing \"using threads\" %x (account %x)\n", MyParam.account->UsingThreads, MyParam.account); @@ -1676,7 +1676,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR SendDlgItemMessage(hDlg, IDC_LISTMAILS, LVM_INSERTCOLUMN, (WPARAM)2, (LPARAM)&lvc2); SendDlgItemMessage(hDlg, IDC_LISTMAILS, LVM_INSERTCOLUMN, (WPARAM)3, (LPARAM)&lvc3); - if ((ActualAccount->NewMailN.App != NULL) && (mir_wstrlen(ActualAccount->NewMailN.App))) + if ((ActualAccount->NewMailN.App != nullptr) && (mir_wstrlen(ActualAccount->NewMailN.App))) EnableWindow(GetDlgItem(hDlg, IDC_BTNAPP), TRUE); else EnableWindow(GetDlgItem(hDlg, IDC_BTNAPP), FALSE); @@ -1691,7 +1691,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR GetStatusFcn(ActualAccount, accstatus); SetDlgItemText(hDlg, IDC_STSTATUS, accstatus); } - SetTimer(hDlg, TIMER_FLASHING, 500, NULL); + SetTimer(hDlg, TIMER_FLASHING, 500, nullptr); if (ActualAccount->hContact != NULL) pcli->pfnRemoveEvent(ActualAccount->hContact, (LPARAM)"yamn new mail message"); @@ -1709,7 +1709,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR Window_FreeIcon_IcoLib(hDlg); struct CMailWinUserInfo *mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER); - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; ColInfo.mask = LVCF_WIDTH; if (ListView_GetColumn(GetDlgItem(hDlg, IDC_LISTMAILS), 0, &ColInfo)) @@ -1756,7 +1756,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR DebugLog(SynchroFile, "MailBrowser:DESTROY:ActualAccountMsgsSO-write enter\n"); #endif //delete mails from queue, which are deleted from server (spam level 3 mails e.g.) - for (Parser = (HYAMNMAIL)ActualAccount->Mails; Parser != NULL; Parser = Parser->Next) { + for (Parser = (HYAMNMAIL)ActualAccount->Mails; Parser != nullptr; Parser = Parser->Next) { if ((Parser->Flags & YAMN_MSG_DELETED) && YAMN_MSG_SPAML(Parser->Flags, YAMN_MSG_SPAML3) && mwui->Seen) //if spaml3 was already deleted and user knows about it { DeleteMessageFromQueueFcn((HYAMNMAIL *)&ActualAccount->Mails, Parser, 1); @@ -1790,13 +1790,13 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR { struct CMailWinUserInfo *mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER); - if (mwui == NULL) + if (mwui == nullptr) return 0; mwui->Seen = TRUE; } case WM_YAMN_CHANGESTATUS: - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; if ((HACCOUNT)wParam != ActualAccount) @@ -1810,9 +1810,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR case WM_YAMN_CHANGECONTENT: { struct CUpdateMails UpdateParams; - BOOL ThisThreadWindow = (GetCurrentThreadId() == GetWindowThreadProcessId(hDlg, NULL)); + BOOL ThisThreadWindow = (GetCurrentThreadId() == GetWindowThreadProcessId(hDlg, nullptr)); - if (NULL == (UpdateParams.Copied = CreateEvent(NULL, FALSE, FALSE, NULL))) { + if (nullptr == (UpdateParams.Copied = CreateEvent(nullptr, FALSE, FALSE, nullptr))) { DestroyWindow(hDlg); return 0; } @@ -1851,7 +1851,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR DebugLog(SynchroFile, "MailBrowser:UPDATEMAILS\n"); #endif - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) return 0; if ((HACCOUNT)wParam != ActualAccount) return 0; @@ -1867,7 +1867,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR } return 1; case WM_YAMN_STOPACCOUNT: - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; if ((HACCOUNT)wParam != ActualAccount) break; @@ -1875,7 +1875,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR return 1; case WM_YAMN_NOTIFYICON: - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; switch (lParam) { @@ -1918,16 +1918,16 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR item.stateMask = 0xFFFFFFFF; ListView_GetItem(GetDlgItem(hDlg, IDC_LISTMAILS), &item); HYAMNMAIL ActualMail = (HYAMNMAIL)item.lParam; - if (NULL != ActualMail) { + if (nullptr != ActualMail) { //ShowEmailThread - HANDLE hThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL); - if (hThreadRunningEV != NULL) { + HANDLE hThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr); + if (hThreadRunningEV != nullptr) { PYAMN_MAILSHOWPARAM MailParam = new YAMN_MAILSHOWPARAM; MailParam->account = GetWindowAccount(hDlg); MailParam->mail = ActualMail; MailParam->ThreadRunningEV = hThreadRunningEV; HANDLE NewThread = mir_forkthread(ShowEmailThread, MailParam); - if (NULL != NewThread) { + if (nullptr != NewThread) { //WaitForSingleObject(MailParam->ThreadRunningEV,INFINITE); CloseHandle(NewThread); } @@ -1940,7 +1940,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR break; case WM_SYSCOMMAND: - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; switch (wParam) { case SC_CLOSE: @@ -1950,7 +1950,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR break; case WM_COMMAND: - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; switch (LOWORD(wParam)) { @@ -1976,20 +1976,20 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR si.cb = sizeof(si); if (WAIT_OBJECT_0 == WaitToReadFcn(ActualAccount->AccountAccessSO)) { - if (ActualAccount->NewMailN.App != NULL) { + if (ActualAccount->NewMailN.App != nullptr) { WCHAR *Command; - if (ActualAccount->NewMailN.AppParam != NULL) + if (ActualAccount->NewMailN.AppParam != nullptr) Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + mir_wstrlen(ActualAccount->NewMailN.AppParam) + 6]; else Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App) + 6]; - if (Command != NULL) { + if (Command != nullptr) { mir_wstrcpy(Command, L"\""); mir_wstrcat(Command, ActualAccount->NewMailN.App); mir_wstrcat(Command, L"\" "); - if (ActualAccount->NewMailN.AppParam != NULL) + if (ActualAccount->NewMailN.AppParam != nullptr) mir_wstrcat(Command, ActualAccount->NewMailN.AppParam); - CreateProcessW(NULL, Command, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi); + CreateProcessW(nullptr, Command, nullptr, nullptr, FALSE, NORMAL_PRIORITY_CLASS, nullptr, nullptr, &si, &pi); delete[] Command; } } @@ -2008,8 +2008,8 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR DWORD Total = 0; // we use event to signal, that running thread has all needed stack parameters copied - HANDLE ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL); - if (ThreadRunningEV == NULL) + HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr); + if (ThreadRunningEV == nullptr) break; Items = ListView_GetItemCount(GetDlgItem(hDlg, IDC_LISTMAILS)); @@ -2025,7 +2025,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR item.stateMask = 0xFFFFFFFF; ListView_GetItem(GetDlgItem(hDlg, IDC_LISTMAILS), &item); ActualMail = (HYAMNMAIL)item.lParam; - if (NULL == ActualMail) + if (nullptr == ActualMail) break; if (item.state & LVIS_SELECTED) { ActualMail->Flags |= YAMN_MSG_USERDELETE; //set to mail we are going to delete it @@ -2041,11 +2041,11 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR mir_snwprintf(DeleteMsg, TranslateT("Do you really want to delete %d selected mails?"), Total); if (IDOK == MessageBox(hDlg, DeleteMsg, TranslateT("Delete confirmation"), MB_OKCANCEL | MB_ICONWARNING)) { - struct DeleteParam ParamToDeleteMails = { YAMN_DELETEVERSION, ThreadRunningEV, ActualAccount, NULL }; + struct DeleteParam ParamToDeleteMails = { YAMN_DELETEVERSION, ThreadRunningEV, ActualAccount, nullptr }; // Find if there's mail marked to delete, which was deleted before if (WAIT_OBJECT_0 == WaitToWriteFcn(ActualAccount->MessagesAccessSO)) { - for (ActualMail = (HYAMNMAIL)ActualAccount->Mails; ActualMail != NULL; ActualMail = ActualMail->Next) { + for (ActualMail = (HYAMNMAIL)ActualAccount->Mails; ActualMail != nullptr; ActualMail = ActualMail->Next) { if ((ActualMail->Flags & YAMN_MSG_DELETED) && ((ActualMail->Flags & YAMN_MSG_USERDELETE))) //if selected mail was already deleted { DeleteMessageFromQueueFcn((HYAMNMAIL *)&ActualAccount->Mails, ActualMail, 1); @@ -2058,7 +2058,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR // Create new thread which deletes marked mails. HANDLE NewThread = mir_forkthread(ActualAccount->Plugin->Fcn->DeleteMailsFcnPtr, &ParamToDeleteMails); - if (NewThread != NULL) { + if (NewThread != nullptr) { WaitForSingleObject(ThreadRunningEV, INFINITE); CloseHandle(NewThread); } @@ -2126,7 +2126,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR break; case LVN_COLUMNCLICK: - if (NULL != (ActualAccount = GetWindowAccount(hDlg))) { + if (nullptr != (ActualAccount = GetWindowAccount(hDlg))) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)lParam; if (WAIT_OBJECT_0 == WaitToReadFcn(ActualAccount->AccountAccessSO)) { #ifdef DEBUG_SYNCHRO @@ -2159,7 +2159,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR LPNMLVCUSTOMDRAW cd = (LPNMLVCUSTOMDRAW)lParam; LONG_PTR PaintCode; - if (NULL == (ActualAccount = GetWindowAccount(hDlg))) + if (nullptr == (ActualAccount = GetWindowAccount(hDlg))) break; switch (cd->nmcd.dwDrawStage) { @@ -2229,9 +2229,9 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR HMENU hMenu = CreatePopupMenu(); AppendMenu(hMenu, MF_STRING, (UINT_PTR)1, TranslateT("Copy Selected")); AppendMenu(hMenu, MF_STRING, (UINT_PTR)2, TranslateT("Copy All")); - AppendMenu(hMenu, MF_SEPARATOR, 0, NULL); + AppendMenu(hMenu, MF_SEPARATOR, 0, nullptr); AppendMenu(hMenu, MF_STRING, (UINT_PTR)0, TranslateT("Cancel")); - int nReturnCmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, NULL); + int nReturnCmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hDlg, nullptr); DestroyMenu(hMenu); if (nReturnCmd > 0) { int courRow = 0; @@ -2280,7 +2280,7 @@ LRESULT CALLBACK ListViewSubclassProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM case WM_GETDLGCODE: { LPMSG lpmsg = (LPMSG)lParam; - if (lpmsg != NULL) { + if (lpmsg != nullptr) { if (lpmsg->message == WM_KEYDOWN && lpmsg->wParam == VK_RETURN) return DLGC_WANTALLKEYS; @@ -2340,32 +2340,32 @@ void __cdecl MailBrowser(void *Param) ReadDoneFcn(ActualAccount->AccountAccessSO); - if (NULL != (hMailBrowser = WindowList_Find(YAMNVar.NewMailAccountWnd, (UINT_PTR)ActualAccount))) + if (nullptr != (hMailBrowser = WindowList_Find(YAMNVar.NewMailAccountWnd, (UINT_PTR)ActualAccount))) WndFound = TRUE; - if ((hMailBrowser == NULL) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG))) { - hMailBrowser = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), NULL, DlgProcYAMNMailBrowser, (LPARAM)&MyParam); + if ((hMailBrowser == nullptr) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG))) { + hMailBrowser = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), nullptr, DlgProcYAMNMailBrowser, (LPARAM)&MyParam); Window_SetIcon_IcoLib(hMailBrowser, g_GetIconHandle(2)); MoveWindow(hMailBrowser, PosX, PosY, SizeX, SizeY, TRUE); } - if (hMailBrowser != NULL) { + if (hMailBrowser != nullptr) { struct CChangeContent Params = { MyParam.nflags, MyParam.nnflags }; //if this thread created window, just post message to update mails SendMessage(hMailBrowser, WM_YAMN_CHANGECONTENT, (WPARAM)ActualAccount, (LPARAM)&Params); //we ensure this will do the thread who created the browser window } else - UpdateMails(NULL, ActualAccount, MyParam.nflags, MyParam.nnflags); //update mails without displaying or refreshing any window + UpdateMails(nullptr, ActualAccount, MyParam.nflags, MyParam.nnflags); //update mails without displaying or refreshing any window - if ((hMailBrowser != NULL) && !WndFound) { //we process message loop only for thread that created window - while (GetMessage(&msg, NULL, 0, 0)) { - if (hMailBrowser == NULL || !IsDialogMessage(hMailBrowser, &msg)) { /* Wine fix. */ + if ((hMailBrowser != nullptr) && !WndFound) { //we process message loop only for thread that created window + while (GetMessage(&msg, nullptr, 0, 0)) { + if (hMailBrowser == nullptr || !IsDialogMessage(hMailBrowser, &msg)) { /* Wine fix. */ TranslateMessage(&msg); DispatchMessage(&msg); } } } - if ((!WndFound) && (ActualAccount->Plugin->Fcn != NULL) && (ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr != NULL) && ActualAccount->AbleToWork) + if ((!WndFound) && (ActualAccount->Plugin->Fcn != nullptr) && (ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr != nullptr) && ActualAccount->AbleToWork) ActualAccount->Plugin->Fcn->WriteAccountsFcnPtr(); } __finally { @@ -2381,11 +2381,11 @@ INT_PTR RunMailBrowserSvc(WPARAM wParam, LPARAM lParam) return 0; //an event for successfull copy parameters to which point a pointer in stack for new thread - HANDLE ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL); - if (ThreadRunningEV != NULL) { + HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr); + if (ThreadRunningEV != nullptr) { Param->ThreadRunningEV = ThreadRunningEV; HANDLE NewThread = mir_forkthread(MailBrowser, Param); - if (NewThread != NULL) { + if (NewThread != nullptr) { WaitForSingleObject(ThreadRunningEV, INFINITE); CloseHandle(NewThread); } diff --git a/plugins/YAMN/src/debug.cpp b/plugins/YAMN/src/debug.cpp index 06644d78ef..0736b3d77d 100644 --- a/plugins/YAMN/src/debug.cpp +++ b/plugins/YAMN/src/debug.cpp @@ -97,8 +97,8 @@ void DebugLog(HANDLE File,const char *fmt,...) str=(char *)realloc(str,strsize+=65536);
va_end(vararg);
EnterCriticalSection(&FileAccessCS);
- WriteFile(File,tids,(DWORD)mir_strlen(tids),&Written,NULL);
- WriteFile(File,str,(DWORD)mir_strlen(str),&Written,NULL);
+ WriteFile(File,tids,(DWORD)mir_strlen(tids),&Written,nullptr);
+ WriteFile(File,str,(DWORD)mir_strlen(str),&Written,nullptr);
LeaveCriticalSection(&FileAccessCS);
free(str);
}
@@ -118,8 +118,8 @@ void DebugLogW(HANDLE File,const WCHAR *fmt,...) str=(WCHAR *)realloc(str,(strsize+=65536)*sizeof(WCHAR));
va_end(vararg);
EnterCriticalSection(&FileAccessCS);
- WriteFile(File,tids,(DWORD)mir_strlen(tids),&Written,NULL);
- WriteFile(File,str,(DWORD)mir_wstrlen(str)*sizeof(WCHAR),&Written,NULL);
+ WriteFile(File,tids,(DWORD)mir_strlen(tids),&Written,nullptr);
+ WriteFile(File,str,(DWORD)mir_wstrlen(str)*sizeof(WCHAR),&Written,nullptr);
LeaveCriticalSection(&FileAccessCS);
free(str);
}
diff --git a/plugins/YAMN/src/filterplugin.cpp b/plugins/YAMN/src/filterplugin.cpp index 884330ed4d..5b0020eb66 100644 --- a/plugins/YAMN/src/filterplugin.cpp +++ b/plugins/YAMN/src/filterplugin.cpp @@ -9,7 +9,7 @@ //--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-PYAMN_FILTERPLUGINQUEUE FirstFilterPlugin=NULL;
+PYAMN_FILTERPLUGINQUEUE FirstFilterPlugin=nullptr;
INT_PTR RegisterFilterPluginSvc(WPARAM,LPARAM);
@@ -52,14 +52,14 @@ INT_PTR RegisterFilterPluginSvc(WPARAM wParam,LPARAM lParam) if (lParam != YAMN_FILTERREGISTRATIONVERSION)
return 0;
- if ((Registration->Name==NULL) || (Registration->Ver==NULL))
+ if ((Registration->Name==nullptr) || (Registration->Ver==nullptr))
return NULL;
- if (NULL==(Plugin=new YAMN_FILTERPLUGIN))
+ if (nullptr==(Plugin=new YAMN_FILTERPLUGIN))
return NULL;
Plugin->PluginInfo=Registration;
- Plugin->FilterFcn=NULL;
+ Plugin->FilterFcn=nullptr;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"::: YAMN- new filter registered: %0x (%s) :::\n",Plugin,Registration->Name);
@@ -78,19 +78,19 @@ INT_PTR UnregisterFilterPlugin(HYAMNFILTERPLUGIN Plugin) }
else
{
- for (Parser=FirstFilterPlugin;(Parser->Next != NULL) && (Plugin != Parser->Next->Plugin);Parser=Parser->Next);
- if (Parser->Next != NULL)
+ for (Parser=FirstFilterPlugin;(Parser->Next != nullptr) && (Plugin != Parser->Next->Plugin);Parser=Parser->Next);
+ if (Parser->Next != nullptr)
{
Found=Parser->Next;
Parser->Next=Parser->Next->Next;
}
else
- Found=NULL;
+ Found=nullptr;
}
- if (Found != NULL)
+ if (Found != nullptr)
{
- if (Plugin->FilterFcn->UnLoadFcn != NULL)
- Plugin->FilterFcn->UnLoadFcn((void *)0);
+ if (Plugin->FilterFcn->UnLoadFcn != nullptr)
+ Plugin->FilterFcn->UnLoadFcn((void *)nullptr);
delete Found->Plugin;
delete Found;
@@ -117,7 +117,7 @@ INT_PTR UnregisterFilterPlugins() mir_cslock lck(PluginRegCS);
// We remove protocols from the protocol list
- while(FirstFilterPlugin != NULL)
+ while(FirstFilterPlugin != nullptr)
UnregisterFilterPlugin(FirstFilterPlugin->Plugin);
return 1;
}
@@ -128,7 +128,7 @@ int WINAPI SetFilterPluginFcnImportFcn(HYAMNFILTERPLUGIN Plugin,DWORD Importance if (YAMNFilterFcnVer != YAMN_FILTERIMPORTFCNVERSION)
return 0;
- if (YAMNFilterFcn==NULL)
+ if (YAMNFilterFcn==nullptr)
return 0;
#ifdef DEBUG_SYNCHRO
@@ -139,8 +139,8 @@ int WINAPI SetFilterPluginFcnImportFcn(HYAMNFILTERPLUGIN Plugin,DWORD Importance mir_cslock lck(PluginRegCS);
// We add protocol to the protocol list
- for (Previous = NULL, Parser = FirstFilterPlugin; Parser != NULL && Parser->Next != NULL && Parser->Plugin->Importance <= Importance; Previous = Parser, Parser = Parser->Next);
- if (Previous==NULL) //insert to the beginnig of queue
+ for (Previous = nullptr, Parser = FirstFilterPlugin; Parser != nullptr && Parser->Next != nullptr && Parser->Plugin->Importance <= Importance; Previous = Parser, Parser = Parser->Next);
+ if (Previous==nullptr) //insert to the beginnig of queue
{
FirstFilterPlugin=new YAMN_FILTERPLUGINQUEUE;
FirstFilterPlugin->Plugin=Plugin;
@@ -170,9 +170,9 @@ INT_PTR FilterMailSvc(WPARAM wParam,LPARAM lParam) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"FilterMail:ActualAccountMsgsSO-write enter\n");
#endif
- for (ActualPlugin=FirstFilterPlugin;ActualPlugin != NULL;ActualPlugin=ActualPlugin->Next)
+ for (ActualPlugin=FirstFilterPlugin;ActualPlugin != nullptr;ActualPlugin=ActualPlugin->Next)
{
- if (ActualPlugin->Plugin->FilterFcn->FilterMailFcnPtr != NULL)
+ if (ActualPlugin->Plugin->FilterFcn->FilterMailFcnPtr != nullptr)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"\tFiltering Mail, running plugin %0x to filter mail\n",ActualPlugin->Plugin);
diff --git a/plugins/YAMN/src/mails/decode.cpp b/plugins/YAMN/src/mails/decode.cpp index d5c49e7ebe..6a767b7a17 100644 --- a/plugins/YAMN/src/mails/decode.cpp +++ b/plugins/YAMN/src/mails/decode.cpp @@ -209,7 +209,7 @@ 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])==nullptr)
return -1;
while((*pin != 0) && (pin-input< (INT_PTR)size))
{
@@ -405,17 +405,17 @@ int ConvertStringToUnicode(char *stream,unsigned int cp,WCHAR **out) break;
}
if (Index==-1)
- streamlen=MultiByteToWideChar(cp,0,stream,-1,NULL,0);
+ streamlen=MultiByteToWideChar(cp,0,stream,-1,nullptr,0);
else
- streamlen=MultiByteToWideChar(cp,MB_USEGLYPHCHARS,stream,-1,NULL,0);
+ streamlen=MultiByteToWideChar(cp,MB_USEGLYPHCHARS,stream,-1,nullptr,0);
- if (*out != NULL)
+ if (*out != nullptr)
outlen=mir_wstrlen(*out);
else
outlen=0;
temp=new WCHAR[streamlen+outlen+1];
- if (*out != NULL)
+ if (*out != nullptr)
{
for (dest=temp;*src != (WCHAR)0;src++,dest++) //copy old string from *out to temp
*dest=*src;
@@ -444,11 +444,11 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) char *start=stream,*finder,*finderend;
char Encoding=0;
- if (stream==NULL)
+ if (stream==nullptr)
return;
while(WS(start)) start++;
- WCHAR *tempstore=0;
+ WCHAR *tempstore=nullptr;
if (!ConvertStringToUnicode(stream,cp,&tempstore))return;
size_t tempstoreLength = mir_wstrlen(tempstore);
@@ -477,7 +477,7 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) if (Encoding != 0)
{
int size = 0,codeend;
- char *pcodeend = 0;
+ char *pcodeend = nullptr;
finder=finderend+2;
if (CODED(finder))
@@ -530,14 +530,14 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) DecodedResult[len+1]=0;
finderend++;
}
- WCHAR *oneWord=0;
+ WCHAR *oneWord=nullptr;
if (ConvertStringToUnicode(DecodedResult,cp,&oneWord)) {
size_t len = mir_wstrlen(oneWord);
memcpy(&tempstore[outind],oneWord,len*sizeof(WCHAR));
outind += len;
}
delete oneWord;
- oneWord = 0;
+ oneWord = nullptr;
delete[] DecodedResult;
start = finderend;
} else if (!EOS(start)) start++;
diff --git a/plugins/YAMN/src/mails/mails.cpp b/plugins/YAMN/src/mails/mails.cpp index 5ae21b95ef..c8baf41422 100644 --- a/plugins/YAMN/src/mails/mails.cpp +++ b/plugins/YAMN/src/mails/mails.cpp @@ -126,21 +126,21 @@ INT_PTR CreateAccountMailSvc(WPARAM wParam,LPARAM lParam) if (MailVersion != YAMN_MAILVERSION)
return NULL;
- if (Account->Plugin != NULL)
+ if (Account->Plugin != nullptr)
{
- if (Account->Plugin->MailFcn->NewMailFcnPtr != NULL)
+ if (Account->Plugin->MailFcn->NewMailFcnPtr != nullptr)
{
//Let plugin create its own structure, which can be derived from CAccount structure
- if (NULL==(NewMail=Account->Plugin->MailFcn->NewMailFcnPtr(Account,YAMN_MAILVERSION)))
+ if (nullptr==(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 (nullptr==(NewMail=new YAMNMAIL))
//If not created successfully
return NULL;
- NewMail->MailData=NULL;
+ NewMail->MailData=nullptr;
}
//Init every members of structure, used by YAMN
return (INT_PTR)NewMail;
@@ -154,29 +154,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 != nullptr) {
+ if (Plugin->MailFcn->DeleteMailFcnPtr != nullptr) {
//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 != nullptr) {
+ if (OldMail->MailData->Body != nullptr)
delete[] OldMail->MailData->Body;
- if ((TH=OldMail->MailData->TranslatedHeader) != NULL)
- for (;OldMail->MailData->TranslatedHeader != NULL;) {
+ if ((TH=OldMail->MailData->TranslatedHeader) != nullptr)
+ for (;OldMail->MailData->TranslatedHeader != nullptr;) {
TH=TH->Next;
- if (OldMail->MailData->TranslatedHeader->name != NULL)
+ if (OldMail->MailData->TranslatedHeader->name != nullptr)
delete[] OldMail->MailData->TranslatedHeader->name;
- if (OldMail->MailData->TranslatedHeader->value != NULL)
+ if (OldMail->MailData->TranslatedHeader->value != nullptr)
delete[] OldMail->MailData->TranslatedHeader->value;
delete OldMail->MailData->TranslatedHeader;
OldMail->MailData->TranslatedHeader=TH;
}
delete OldMail->MailData;
}
- if (OldMail->ID != NULL)
+ if (OldMail->ID != nullptr)
delete[] OldMail->ID;
delete OldMail; //consider mail as standard HYAMNMAIL, not initialized before and use its own destructor
@@ -187,7 +187,7 @@ INT_PTR DeleteAccountMailSvc(WPARAM wParam,LPARAM lParam) void WINAPI AppendQueueFcn(HYAMNMAIL first,HYAMNMAIL second)
{
HYAMNMAIL Finder=first;
- while(Finder->Next != NULL) Finder=Finder->Next;
+ while(Finder->Next != nullptr) Finder=Finder->Next;
Finder->Next=second;
}
@@ -227,12 +227,12 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R {
HYAMNMAIL Finder,FinderPrev;
HYAMNMAIL Parser,ParserPrev;
- HYAMNMAIL RemovedOldParser =NULL;
- HYAMNMAIL RemovedNewParser =NULL;
- if (RemovedOld != NULL) *RemovedOld=NULL;
- if (RemovedNew != NULL) *RemovedNew=NULL;
+ HYAMNMAIL RemovedOldParser =nullptr;
+ HYAMNMAIL RemovedNewParser =nullptr;
+ if (RemovedOld != nullptr) *RemovedOld=nullptr;
+ if (RemovedNew != nullptr) *RemovedNew=nullptr;
- for (FinderPrev=NULL,Finder=*OldQueue;Finder != NULL;)
+ for (FinderPrev=nullptr,Finder=*OldQueue;Finder != nullptr;)
{
if (Finder->Flags & YAMN_MSG_DELETED) //if old queue contains deleted mail
{
@@ -240,18 +240,18 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R Finder=Finder->Next; //get next message in old queue for testing
continue;
}
- for (ParserPrev=NULL,Parser=*NewQueue;Parser != NULL;ParserPrev=Parser,Parser=Parser->Next)
+ for (ParserPrev=nullptr,Parser=*NewQueue;Parser != nullptr;ParserPrev=Parser,Parser=Parser->Next)
{
if (Parser->Flags & YAMN_MSG_DELETED)
continue;
- if (Parser->ID==NULL) //simply ignore the message, that has not filled its ID
+ if (Parser->ID==nullptr) //simply ignore the message, that has not filled its ID
continue;
if (0==mir_strcmp(Parser->ID,Finder->ID)) //search for equal message in new queue
break;
}
- if (Parser != NULL) //found equal message in new queue
+ if (Parser != nullptr) //found equal message in new queue
{
if (Parser==*NewQueue)
*NewQueue=(*NewQueue)->Next;
@@ -259,16 +259,16 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R 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==nullptr) //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==nullptr) //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
RemovedNewParser=Parser; //follow RemovedNew queue
- RemovedNewParser->Next=NULL;
+ RemovedNewParser->Next=nullptr;
}
FinderPrev=Finder;
Finder=Finder->Next; //get next message in old queue for testing
@@ -278,32 +278,32 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R 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==nullptr) //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==nullptr) //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
RemovedOldParser=Finder; //follow RemovedOld queue
- RemovedOldParser->Next=NULL;
+ RemovedOldParser->Next=nullptr;
}
Finder=*OldQueue;
}
else
{
FinderPrev->Next=Finder->Next;
- if (RemovedOld==NULL) //delete from old queue
+ if (RemovedOld==nullptr) //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==nullptr) //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
RemovedOldParser=Finder; //follow RemovedOld queue
- RemovedOldParser->Next=NULL;
+ RemovedOldParser->Next=nullptr;
}
Finder=FinderPrev->Next;
}
@@ -314,7 +314,7 @@ void WINAPI SynchroMessagesFcn(HACCOUNT Account,HYAMNMAIL *OldQueue,HYAMNMAIL *R void WINAPI DeleteMessagesToEndFcn(HACCOUNT Account,HYAMNMAIL From)
{
HYAMNMAIL Temp;
- while(From != NULL)
+ while(From != nullptr)
{
Temp=From;
From=From->Next;
@@ -341,7 +341,7 @@ void WINAPI DeleteMessageFromQueueFcn(HYAMNMAIL *From,HYAMNMAIL Which,int mode=0 Parser=Which->Next;
}
if (mode)
- for (;Parser != NULL;Parser=Parser->Next)
+ for (;Parser != nullptr;Parser=Parser->Next)
if (Parser->Number>Number) Parser->Number--;
}
@@ -349,7 +349,7 @@ void DeleteMessagesFromQueue(HYAMNMAIL *From,HYAMNMAIL Which,int mode=0) {
HYAMNMAIL Parser;
- for (Parser=Which;Parser != NULL;Parser=Parser->Next)
+ for (Parser=Which;Parser != nullptr;Parser=Parser->Next)
DeleteMessageFromQueueFcn(From,Parser,mode);
}
@@ -357,7 +357,7 @@ HYAMNMAIL WINAPI FindMessageByIDFcn(HYAMNMAIL From,char *ID) {
HYAMNMAIL Browser;
- for (Browser=From;Browser != NULL;Browser=Browser->Next)
+ for (Browser=From;Browser != nullptr;Browser=Browser->Next)
if (0==mir_strcmp(Browser->ID,ID))
break;
return Browser;
@@ -369,7 +369,7 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) {
char *finder=stream;
char *prev1,*prev2,*prev3;
- struct CMimeItem *Item=NULL;
+ struct CMimeItem *Item=nullptr;
while(finder<=(stream+len))
{
@@ -399,9 +399,9 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) while(!ENDLINE(finder) && !EOS(finder)) finder++;
}while(ENDLINEWS(finder));
- if (Item != NULL)
+ if (Item != nullptr)
{
- if (NULL==(Item->Next=new struct CMimeItem))
+ if (nullptr==(Item->Next=new struct CMimeItem))
break;
Item=Item->Next;
}
@@ -411,7 +411,7 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) *head = Item;
}
- Item->Next=NULL;
+ Item->Next=nullptr;
Item->name=new char [prev2-prev1+1];
mir_strncpy(Item->name,prev1,prev2-prev1+1);
Item->value=new char [finder-prev3+1];
@@ -431,9 +431,9 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) 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 (nullptr==(Item->Next=new struct CMimeItem)) break; // Cant create new item?!
Item=Item->Next;
- Item->Next=NULL;//just in case;
+ Item->Next=nullptr;//just in case;
Item->name=new char[5]; strncpy(Item->name,"Body",5);
Item->value=new char [prev2-prev1];
mir_strncpy(Item->value,prev1,prev2-prev1-1);
@@ -445,22 +445,22 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) }
catch(...)
{
- MessageBoxA(NULL,"Translate header error","",0);
+ MessageBoxA(nullptr,"Translate header error","",0);
}
}
HYAMNMAIL WINAPI CreateNewDeleteQueueFcn(HYAMNMAIL From)
{
- HYAMNMAIL FirstMail,Browser = 0;
+ HYAMNMAIL FirstMail,Browser = nullptr;
- for (FirstMail=NULL;From != NULL;From=From->Next)
+ for (FirstMail=nullptr;From != nullptr;From=From->Next)
{
if ((From->Flags & (YAMN_MSG_USERDELETE | YAMN_MSG_AUTODELETE)) && !(From->Flags & YAMN_MSG_DELETED))
{
- if (FirstMail==NULL)
+ if (FirstMail==nullptr)
{
FirstMail=Browser=new YAMNMAIL;
- if (FirstMail==NULL)
+ if (FirstMail==nullptr)
break;
}
else
@@ -481,7 +481,7 @@ void WINAPI SetRemoveFlagsInQueueFcn(HYAMNMAIL From,DWORD FlagsSet,DWORD FlagsNo {
HYAMNMAIL msgq;
- for (msgq=(HYAMNMAIL)From;msgq != NULL;msgq=msgq->Next)
+ for (msgq=(HYAMNMAIL)From;msgq != nullptr;msgq=msgq->Next)
{
if ((FlagsSet==(msgq->Flags & FlagsSet)) && (0==(msgq->Flags & FlagsNotSet)))
{
diff --git a/plugins/YAMN/src/mails/mime.cpp b/plugins/YAMN/src/mails/mime.cpp index c768ae141f..076e139c40 100644 --- a/plugins/YAMN/src/mails/mime.cpp +++ b/plugins/YAMN/src/mails/mime.cpp @@ -69,7 +69,7 @@ void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode) {
char *dst;
- if (dest==NULL)
+ if (dest==nullptr)
return;
if (srcstart>=srcend)
return;
@@ -83,9 +83,9 @@ void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode) if (srcstart>=srcend)
return;
- if (NULL != *dest)
+ if (nullptr != *dest)
delete[] *dest;
- if (NULL==(*dest=new char[srcend-srcstart+1]))
+ if (nullptr==(*dest=new char[srcend-srcstart+1]))
return;
dst=*dest;
@@ -106,9 +106,9 @@ void CopyToHeader(char *srcstart,char *srcend,char **dest,int mode) void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick)
{
- if (finder==NULL)
+ if (finder==nullptr)
{
- *storeto=*storetonick=NULL;
+ *storeto=*storetonick=nullptr;
return;
}
while(WS(finder)) finder++;
@@ -163,9 +163,9 @@ void ExtractAddressFromLine(char *finder,char **storeto,char **storetonick) void ExtractStringFromLine(char *finder,char **storeto)
{
- if (finder==NULL)
+ if (finder==nullptr)
{
- *storeto=NULL;
+ *storeto=nullptr;
return;
}
while(WS(finder)) finder++;
@@ -186,9 +186,9 @@ char *ExtractFromContentType(char *ContentType,char *value) char *lowered = _strdup(ContentType);
ToLower(lowered);
char *finder=strstr(lowered,value);
- if (finder==NULL) {
+ if (finder==nullptr) {
free (lowered);
- return NULL;
+ return nullptr;
}
finder = finder-lowered+ContentType;
free (lowered);
@@ -199,7 +199,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)
- return NULL;
+ return nullptr;
finder=finder+mir_strlen(value); //jump over value string
while(WS(finder)) finder++; //jump over whitespaces
@@ -211,8 +211,8 @@ char *ExtractFromContentType(char *ContentType,char *value) finder++;
if (*temp=='\"') temp--;
}
- if (NULL==(CopiedString=new char[++temp-finder+1]))
- return NULL;
+ if (nullptr==(CopiedString=new char[++temp-finder+1]))
+ return nullptr;
for (copier=CopiedString;finder != temp;*copier++=*finder++); //copy string
*copier=0; //and end it with zero character
@@ -221,13 +221,13 @@ char *ExtractFromContentType(char *ContentType,char *value) void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head)
{
- for (;items != NULL;items=items->Next)
+ for (;items != nullptr;items=items->Next)
{
//at the start of line
//MessageBox(NULL,items->value,items->name,0);
if (0==_strnicmp(items->name,"From",4))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting from>");
@@ -239,7 +239,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"Return-Path",11))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting return-path>");
@@ -251,7 +251,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"Subject",7))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting subject>");
@@ -263,7 +263,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"Body",4))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting body>");
@@ -275,7 +275,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"Date",4))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting date>");
@@ -287,10 +287,10 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"Content-Type",12))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
- char *ContentType=NULL,*CharSetStr;
+ char *ContentType=nullptr,*CharSetStr;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting Content-Type>");
#endif
@@ -299,7 +299,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) DebugLog(DecodeFile,"</Extracting>\n");
#endif
ToLower(ContentType);
- if (NULL != (CharSetStr=ExtractFromContentType(ContentType,"charset=")))
+ if (nullptr != (CharSetStr=ExtractFromContentType(ContentType,"charset=")))
{
head->CP=GetCharsetFromString(CharSetStr,mir_strlen(CharSetStr));
delete[] CharSetStr;
@@ -308,7 +308,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"Importance",10))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting importance>");
@@ -328,7 +328,7 @@ void ExtractShortHeader(struct CMimeItem *items,struct CShortHeader *head) }
else if (0==_strnicmp(items->name,"X-Priority",10))
{
- if (items->value==NULL)
+ if (items->value==nullptr)
continue;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<X-Priority>");
@@ -424,40 +424,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 != nullptr) delete[] head->From;
+ if (head->FromNick != nullptr) delete[] head->FromNick;
+ if (head->ReturnPath != nullptr) delete[] head->ReturnPath;
+ if (head->ReturnPathNick != nullptr) delete[] head->ReturnPathNick;
+ if (head->Subject != nullptr) delete[] head->Subject;
+ if (head->Date != nullptr) delete[] head->Date;
+ if (head->To != nullptr) DeleteShortNames(head->To);
+ if (head->Cc != nullptr) DeleteShortNames(head->Cc);
+ if (head->Bcc != nullptr) DeleteShortNames(head->Bcc);
+ if (head->Body != nullptr) 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 != nullptr) delete[] head->From;
+ if (head->FromNick != nullptr) delete[] head->FromNick;
+ if (head->ReturnPath != nullptr) delete[] head->ReturnPath;
+ if (head->ReturnPathNick != nullptr) delete[] head->ReturnPathNick;
+ if (head->Subject != nullptr) delete[] head->Subject;
+ if (head->Date != nullptr) delete[] head->Date;
+ if (head->Body != nullptr) delete[] head->Body;
+ if (head->To != nullptr) DeleteNames(head->To);
+ if (head->Cc != nullptr) DeleteNames(head->Cc);
+ if (head->Bcc != nullptr) DeleteNames(head->Bcc);
}
void DeleteNames(PYAMN_MIMENAMES Names)
{
PYAMN_MIMENAMES Parser=Names,Old;
- for (;Parser != NULL;Parser=Parser->Next)
+ for (;Parser != nullptr;Parser=Parser->Next)
{
- if (Parser->Value != NULL)
+ if (Parser->Value != nullptr)
delete[] Parser->Value;
- if (Parser->ValueNick != NULL)
+ if (Parser->ValueNick != nullptr)
delete[] Parser->ValueNick;
Old=Parser;
Parser=Parser->Next;
@@ -468,11 +468,11 @@ void DeleteNames(PYAMN_MIMENAMES Names) void DeleteShortNames(PYAMN_MIMESHORTNAMES Names)
{
PYAMN_MIMESHORTNAMES Parser=Names,Old;
- for (;Parser != NULL;Parser=Parser->Next)
+ for (;Parser != nullptr;Parser=Parser->Next)
{
- if (Parser->Value != NULL)
+ if (Parser->Value != nullptr)
delete[] Parser->Value;
- if (Parser->ValueNick != NULL)
+ if (Parser->ValueNick != nullptr)
delete[] Parser->ValueNick;
Old=Parser;
Parser=Parser->Next;
@@ -579,7 +579,7 @@ void ParseAPart(APartDataType *data) }
catch(...)
{
- MessageBox(NULL, TranslateT("Translate header error"), L"", 0);
+ MessageBox(nullptr, TranslateT("Translate header error"), L"", 0);
}
if (data->body) data->bodyLen = (int)mir_strlen(data->body);
}
@@ -616,14 +616,14 @@ WCHAR *ParseMultipartBody(char *src, char *bond) }
if (partData[i].ContType) {
char *CharSetStr;
- if (NULL != (CharSetStr=ExtractFromContentType(partData[i].ContType,"charset=")))
+ if (nullptr != (CharSetStr=ExtractFromContentType(partData[i].ContType,"charset=")))
{
partData[i].CodePage=GetCharsetFromString(CharSetStr,mir_strlen(CharSetStr));
delete[] CharSetStr;
}
}
if (partData[i].ContType && !_strnicmp(partData[i].ContType,"text",4)) {
- char *localBody=0;
+ char *localBody=nullptr;
switch (partData[i].TransEncType) {
case TE_BASE64:
{
@@ -642,8 +642,8 @@ WCHAR *ParseMultipartBody(char *src, char *bond) if (localBody) delete[] localBody;
} 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=")))
+ char *bondary=nullptr;
+ if (nullptr != (bondary=ExtractFromContentType(partData[i].ContType,"boundary=")))
{
partData[i].wBody = ParseMultipartBody(partData[i].body,bondary);
delete[] bondary;
@@ -674,12 +674,12 @@ FailBackRaw: mir_snprintf(infoline + linesize, _countof(infoline) - linesize, "; %s", partData[i].ContType);
linesize = mir_strlen(infoline);
partData[i].ContType=CharSetStr+1;
- if (NULL != (CharSetStr=ExtractFromContentType(partData[i].ContType,"charset="))) {
+ if (nullptr != (CharSetStr=ExtractFromContentType(partData[i].ContType,"charset="))) {
mir_snprintf(infoline + linesize, _countof(infoline) - linesize, "; %s", CharSetStr);
linesize = mir_strlen(infoline);
delete[] CharSetStr;
}
- if (NULL != (CharSetStr=ExtractFromContentType(partData[i].ContType,"name="))) {
+ if (nullptr != (CharSetStr=ExtractFromContentType(partData[i].ContType,"name="))) {
mir_snprintf(infoline + linesize, _countof(infoline) - linesize, "; \"%s\"", CharSetStr);
linesize = mir_strlen(infoline);
delete[] CharSetStr;
@@ -692,7 +692,7 @@ FailBackRaw: }
mir_snprintf(infoline + linesize, _countof(infoline) - linesize, ".\r\n");
{
- WCHAR *temp=0;
+ WCHAR *temp=nullptr;
dest[destpos] = dest[destpos+1] = dest[destpos+2] = 0x2022; // bullet;
destpos += 3;
ConvertStringToUnicode(infoline,CP_ACP,&temp);
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index 9264edaf70..0a83969f8e 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -52,9 +52,9 @@ HANDLE hTTButton; UINT SecTimer; -HGENMENU hMenuItemMain = 0; -HGENMENU hMenuItemCont = 0; -HGENMENU hMenuItemContApp = 0; +HGENMENU hMenuItemMain = nullptr; +HGENMENU hMenuItemCont = nullptr; +HGENMENU hMenuItemContApp = nullptr; #define FIXED_TAB_SIZE 100 // default value for fixed width tabs @@ -68,13 +68,13 @@ static void GetProfileDirectory(wchar_t *szPath, int cbPath) VARSW ptszNewPath( L"%miranda_userdata%"); SHFILEOPSTRUCT file_op = { - NULL, + nullptr, FO_MOVE, tszOldPath, ptszNewPath, FOF_NOERRORUI | FOF_NOCONFIRMATION | FOF_SILENT, false, - 0, + nullptr, L"" }; SHFileOperation(&file_op); @@ -188,14 +188,14 @@ void LoadIcons() HANDLE WINAPI g_GetIconHandle( int idx ) { if ( idx >= _countof(iconList)) - return NULL; + return nullptr; return iconList[idx].hIcolib; } HICON WINAPI g_LoadIconEx( int idx, bool big ) { if ( idx >= _countof(iconList)) - return NULL; + return nullptr; return IcoLib_GetIcon(iconList[idx].szName, big); } @@ -209,7 +209,7 @@ static void LoadPlugins() wchar_t szSearchPath[MAX_PATH]; mir_snwprintf(szSearchPath, L"%s\\Plugins\\YAMN\\*.dll", szMirandaDir); - hDllPlugins = NULL; + hDllPlugins = nullptr; WIN32_FIND_DATA fd; HANDLE hFind = FindFirstFile(szSearchPath, &fd); @@ -217,7 +217,7 @@ static void LoadPlugins() do { //rewritten from Miranda sources... Needed because Win32 API has a bug in FindFirstFile, search is done for *.dlllllll... too wchar_t *dot = wcsrchr(fd.cFileName, '.'); - if (dot == NULL ) + if (dot == nullptr ) continue; // we have a dot @@ -231,22 +231,22 @@ static void LoadPlugins() wchar_t szPluginPath[MAX_PATH]; mir_snwprintf(szPluginPath, L"%s\\Plugins\\YAMN\\%s", szMirandaDir, fd.cFileName); HINSTANCE hDll = LoadLibrary(szPluginPath); - if (hDll == NULL) + if (hDll == nullptr) continue; LOADFILTERFCN LoadFilter = (LOADFILTERFCN) GetProcAddress(hDll, "LoadFilter"); - if (NULL == LoadFilter) { + if (nullptr == LoadFilter) { FreeLibrary(hDll); - hDll = NULL; + hDll = nullptr; continue; } if (!LoadFilter(GetFcnPtrSvc)) { FreeLibrary(hDll); - hDll = NULL; + hDll = nullptr; } - if (hDll != NULL) { + if (hDll != nullptr) { hDllPlugins = (HINSTANCE *)realloc(hDllPlugins, (iDllPlugins+1)*sizeof(HINSTANCE)); hDllPlugins[iDllPlugins++] = hDll; } @@ -270,7 +270,7 @@ extern "C" int __declspec(dllexport) Load(void) // retrieve the current profile name Profile_GetNameW(_countof(ProfileName), ProfileName); wchar_t *fc = wcsrchr(ProfileName, '.'); - if ( fc != NULL ) *fc = 0; + if ( fc != nullptr ) *fc = 0; // we get the user path where our yamn-account.book.ini is stored from mirandaboot.ini file GetProfileDirectory(UserDirectory, _countof(UserDirectory)); @@ -290,11 +290,11 @@ extern "C" int __declspec(dllexport) Load(void) pd.type = PROTOTYPE_VIRTUAL; Proto_RegisterModule(&pd); - if (NULL == (NoWriterEV = CreateEvent(NULL, TRUE, TRUE, NULL))) + if (nullptr == (NoWriterEV = CreateEvent(nullptr, TRUE, TRUE, nullptr))) return 1; - if (NULL == (WriteToFileEV = CreateEvent(NULL, FALSE, FALSE, NULL))) + if (nullptr == (WriteToFileEV = CreateEvent(nullptr, FALSE, FALSE, nullptr))) return 1; - if (NULL == (ExitEV = CreateEvent(NULL, TRUE, FALSE, NULL))) + if (nullptr == (ExitEV = CreateEvent(nullptr, TRUE, FALSE, nullptr))) return 1; PosX = db_get_dw(NULL, YAMN_DBMODULE, YAMN_DBPOSX, 0); @@ -315,8 +315,8 @@ extern "C" int __declspec(dllexport) Load(void) YAMNVar.NewMailAccountWnd = WindowList_Create(); YAMNVar.Shutdown = FALSE; - hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); - hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE); + hCurSplitNS = LoadCursor(nullptr, IDC_SIZENS); + hCurSplitWE = LoadCursor(nullptr, IDC_SIZEWE); #ifdef _DEBUG InitDebug(); @@ -341,7 +341,7 @@ extern "C" int __declspec(dllexport) Load(void) Hotkey_Register(&hkd); //Create thread that will be executed every second - if (!(SecTimer = SetTimer(NULL, 0, 1000, TimerProc))) + if (!(SecTimer = SetTimer(nullptr, 0, 1000, TimerProc))) return 1; return 0; @@ -351,16 +351,16 @@ extern "C" int __declspec(dllexport) Load(void) static void UnloadPlugins() { - if (hDllPlugins == NULL) + if (hDllPlugins == nullptr) return; for (int i = iDllPlugins - 1; i >= 0; i --) { if (FreeLibrary(hDllPlugins[i])) { - hDllPlugins[i] = NULL; //for safety + hDllPlugins[i] = nullptr; //for safety iDllPlugins --; } } free((void *)hDllPlugins); - hDllPlugins = NULL; + hDllPlugins = nullptr; } extern "C" int __declspec(dllexport) Unload(void) diff --git a/plugins/YAMN/src/proto/netlib.cpp b/plugins/YAMN/src/proto/netlib.cpp index 24485fe871..7e4227ad91 100644 --- a/plugins/YAMN/src/proto/netlib.cpp +++ b/plugins/YAMN/src/proto/netlib.cpp @@ -10,7 +10,7 @@ //--------------------------------------------------------------------------------------------------
BOOL SSLLoaded = FALSE;
-HNETLIBUSER hNetlibUser = NULL;
+HNETLIBUSER hNetlibUser = nullptr;
void __stdcall SSL_DebugLog(const char *fmt, ...)
{
@@ -67,7 +67,7 @@ void CNLClient::SSLify() throw(DWORD) #ifdef DEBUG_COMM
SSL_DebugLog("Staring netlib core SSL");
#endif
- if (Netlib_StartSsl(hConnection, NULL)) {
+ if (Netlib_StartSsl(hConnection, nullptr)) {
#ifdef DEBUG_COMM
SSL_DebugLog("Netlib core SSL started");
#endif
@@ -97,7 +97,7 @@ void CNLClient::Connect(const char* servername, const int port) throw(DWORD) nloc.szHost = servername;
nloc.wPort = port;
nloc.flags = 0;
- if (NULL == (hConnection = Netlib_OpenConnection(hNetlibUser, &nloc))) {
+ if (nullptr == (hConnection = Netlib_OpenConnection(hNetlibUser, &nloc))) {
SystemError = WSAGetLastError();
throw NetworkError = (DWORD)ENL_CONNECT;
}
@@ -125,9 +125,9 @@ void CNLClient::Send(const char *query) throw(DWORD) {
unsigned int Sent;
- if (NULL == query)
+ if (nullptr == query)
return;
- if (hConnection == NULL)
+ if (hConnection == nullptr)
return;
#ifdef DEBUG_COMM
DebugLog(CommFile, "<send>%s", query);
@@ -174,9 +174,9 @@ char* CNLClient::Recv(char *buf, int buflen) throw(DWORD) DebugLog(CommFile, "<reading>");
#endif
try {
- if (buf == NULL)
+ if (buf == nullptr)
buf = (char *)malloc(sizeof(char)*(buflen + 1));
- if (buf == NULL)
+ if (buf == nullptr)
throw NetworkError = (DWORD)ENL_RECVALLOC;
if (!isTLSed) {
@@ -224,7 +224,7 @@ char* CNLClient::Recv(char *buf, int buflen) throw(DWORD) void CNLClient::Disconnect()
{
Netlib_CloseHandle(hConnection);
- hConnection = NULL;
+ hConnection = nullptr;
}
//Uninitializes netlib library
@@ -235,7 +235,7 @@ void UnregisterNLClient() #endif
Netlib_CloseHandle(hNetlibUser);
- hNetlibUser = NULL;
+ hNetlibUser = nullptr;
#ifdef DEBUG_COMM
DebugLog(CommFile, "</Unregister PROXY support>\n");
#endif
diff --git a/plugins/YAMN/src/proto/pop3/pop3.cpp b/plugins/YAMN/src/proto/pop3/pop3.cpp index 5204ba1259..d47fac4836 100644 --- a/plugins/YAMN/src/proto/pop3/pop3.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3.cpp @@ -34,11 +34,11 @@ //sets AckFlag char *CPop3Client::Connect(const char* servername,const int port,BOOL UseSSL, BOOL NoTLS) { - char *temp = 0; + char *temp = nullptr; if (Stopped) //check if we can work with this POP3 client session throw POP3Error=(DWORD)EPOP3_STOPPED; - if (NetClient != NULL) + if (NetClient != nullptr) delete NetClient; SSL=UseSSL; NetClient=new CNLClient; @@ -56,7 +56,7 @@ char *CPop3Client::Connect(const char* servername,const int port,BOOL UseSSL, BO catch (...) { NetClient->Disconnect(); - return NULL; + return nullptr; } } @@ -73,7 +73,7 @@ char *CPop3Client::Connect(const char* servername,const int port,BOOL UseSSL, BO NetClient->SSLify(); } catch (...) { NetClient->Disconnect(); - return NULL; + return nullptr; } // temp = RecvRest(NetClient->Recv(),POP3_SEARCHACK); } @@ -105,7 +105,7 @@ char* CPop3Client::RecvRest(char* prev,int mode,int size) { //if not found if (NetClient->Stopped) //check if we can work with this POP3 client session { - if (PrevString != NULL) + if (PrevString != nullptr) free(PrevString); throw POP3Error=(DWORD)EPOP3_STOPPED; } @@ -113,9 +113,9 @@ char* CPop3Client::RecvRest(char* prev,int mode,int size) { SizeRead+=size; SizeLeft=size; - LastString=NetClient->Recv(NULL,SizeLeft); + LastString=NetClient->Recv(nullptr,SizeLeft); PrevString=(char *)realloc(PrevString,sizeof(char)*(SizeRead+size)); - if (PrevString==NULL) + if (PrevString==nullptr) throw POP3Error=(DWORD)EPOP3_RESTALLOC; memcpy(PrevString+SizeRead,LastString,size); free(LastString); @@ -239,7 +239,7 @@ char* CPop3Client::APOP(char* name, char* pw, char* timestamp) char *Result; unsigned char digest[16]; - if (timestamp==NULL) + if (timestamp==nullptr) throw POP3Error=(DWORD)EPOP3_APOP; mir_md5_state_s ctx; mir_md5_init(&ctx); diff --git a/plugins/YAMN/src/proto/pop3/pop3comm.cpp b/plugins/YAMN/src/proto/pop3/pop3comm.cpp index 8984a4dfbb..edd7598c26 100644 --- a/plugins/YAMN/src/proto/pop3/pop3comm.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3comm.cpp @@ -16,8 +16,8 @@ //--------------------------------------------------------------------------------------------------
-HANDLE hNetLib = NULL;
-PSCOUNTER CPOP3Account::AccountWriterSO = NULL;
+HANDLE hNetLib = nullptr;
+PSCOUNTER CPOP3Account::AccountWriterSO = nullptr;
//Creates new CPOP3Account structure
HACCOUNT WINAPI CreatePOP3Account(HYAMNPROTOPLUGIN Plugin, DWORD CAccountVersion);
@@ -87,8 +87,8 @@ void ExtractList(char *stream, int len, HYAMNMAIL queue); void ExtractMail(char *stream, int len, HYAMNMAIL queue);
-YAMNExportedFcns *pYAMNFcn = NULL;
-MailExportedFcns *pYAMNMailFcn = NULL;
+YAMNExportedFcns *pYAMNFcn = nullptr;
+MailExportedFcns *pYAMNMailFcn = nullptr;
YAMN_PROTOIMPORTFCN POP3ProtocolFunctions =
{
@@ -102,23 +102,23 @@ YAMN_PROTOIMPORTFCN POP3ProtocolFunctions = SynchroPOP3,
DeleteMailsPOP3,
GetErrorString,
- NULL,
+ nullptr,
DeleteErrorString,
WritePOP3Accounts,
- NULL,
+ nullptr,
UnLoadPOP3,
};
YAMN_MAILIMPORTFCN POP3MailFunctions =
{
CreatePOP3Mail,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
};
-PYAMN_VARIABLES pYAMNVar = NULL;
-HYAMNPROTOPLUGIN POP3Plugin = NULL;
+PYAMN_VARIABLES pYAMNVar = nullptr;
+HYAMNPROTOPLUGIN POP3Plugin = nullptr;
YAMN_PROTOREGISTRATION POP3ProtocolRegistration =
{
@@ -130,7 +130,7 @@ YAMN_PROTOREGISTRATION POP3ProtocolRegistration = __AUTHORWEB,
};
-static wchar_t *FileName = NULL;
+static wchar_t *FileName = nullptr;
HANDLE RegisterNLClient(const char *name);
@@ -142,7 +142,7 @@ CPOP3Account::CPOP3Account() //NOTE! This constructor constructs CAccount structure. If your plugin is not internal,
//you will need these constructors. All you need is in Account.cpp. Just copy to your source code
//constructor and destructor of CAccount.
- UseInternetFree = CreateEvent(NULL, FALSE, TRUE, NULL);
+ UseInternetFree = CreateEvent(nullptr, FALSE, TRUE, nullptr);
InternetQueries = new SCOUNTER;
AbilityFlags = YAMN_ACC_BROWSE | YAMN_ACC_POPUP;
@@ -152,7 +152,7 @@ CPOP3Account::CPOP3Account() CPOP3Account::~CPOP3Account()
{
CloseHandle(UseInternetFree);
- if (InternetQueries != NULL)
+ if (InternetQueries != nullptr)
delete InternetQueries;
}
@@ -176,7 +176,7 @@ void WINAPI DeletePOP3Account(HACCOUNT Which) void WINAPI StopPOP3Account(HACCOUNT Which)
{
((HPOP3ACCOUNT)Which)->Client.Stopped = TRUE;
- if (((HPOP3ACCOUNT)Which)->Client.NetClient != NULL) //we should inform also network client. Usefull only when network client implements this feature
+ if (((HPOP3ACCOUNT)Which)->Client.NetClient != nullptr) //we should inform also network client. Usefull only when network client implements this feature
((HPOP3ACCOUNT)Which)->Client.NetClient->Stopped = TRUE;
}
@@ -185,19 +185,19 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) {
//Get YAMN variables we can use
- if (NULL == (pYAMNVar = (PYAMN_VARIABLES)CallService(MS_YAMN_GETVARIABLES, (WPARAM)YAMN_VARIABLESVERSION, 0)))
+ if (nullptr == (pYAMNVar = (PYAMN_VARIABLES)CallService(MS_YAMN_GETVARIABLES, (WPARAM)YAMN_VARIABLESVERSION, 0)))
return 0;
//We have to get pointers to YAMN exported functions: allocate structure and fill it
- if (NULL == (pYAMNFcn = new struct YAMNExportedFcns))
+ if (nullptr == (pYAMNFcn = new struct YAMNExportedFcns))
{
- UnLoadPOP3(0); return 0;
+ UnLoadPOP3(nullptr); return 0;
}
//Register new pop3 user in netlib
- if (NULL == (hNetLib = RegisterNLClient("YAMN-POP3")))
+ if (nullptr == (hNetLib = RegisterNLClient("YAMN-POP3")))
{
- UnLoadPOP3(0); return 0;
+ UnLoadPOP3(nullptr); return 0;
}
pYAMNFcn->SetProtocolPluginFcnImportFcn = (YAMN_SETPROTOCOLPLUGINFCNIMPORTFCN)CallService(MS_YAMN_GETFCNPTR, (WPARAM)YAMN_SETPROTOCOLPLUGINFCNIMPORTID, 0);
@@ -211,9 +211,9 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) pYAMNFcn->SetStatusFcn = (YAMN_SETSTATUSFCN)CallService(MS_YAMN_GETFCNPTR, (WPARAM)YAMN_SETSTATUSID, 0);
pYAMNFcn->GetStatusFcn = (YAMN_GETSTATUSFCN)CallService(MS_YAMN_GETFCNPTR, (WPARAM)YAMN_GETSTATUSID, 0);
- if (NULL == (pYAMNMailFcn = new struct MailExportedFcns))
+ if (nullptr == (pYAMNMailFcn = new struct MailExportedFcns))
{
- UnLoadPOP3(0); return 0;
+ UnLoadPOP3(nullptr); return 0;
}
pYAMNMailFcn->SynchroMessagesFcn = (YAMN_SYNCHROMIMEMSGSFCN)CallService(MS_YAMN_GETFCNPTR, (WPARAM)YAMN_SYNCHROMIMEMSGSID, 0);
@@ -225,10 +225,10 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) pYAMNMailFcn->CreateNewDeleteQueueFcn = (YAMN_CREATENEWDELETEQUEUEFCN)CallService(MS_YAMN_GETFCNPTR, (WPARAM)YAMN_CREATENEWDELETEQUEUEID, 0);
//set static variable
- if (CPOP3Account::AccountWriterSO == NULL) {
- if (NULL == (CPOP3Account::AccountWriterSO = new SCOUNTER))
+ if (CPOP3Account::AccountWriterSO == nullptr) {
+ if (nullptr == (CPOP3Account::AccountWriterSO = new SCOUNTER))
{
- UnLoadPOP3(0); return 0;
+ UnLoadPOP3(nullptr); return 0;
}
}
@@ -236,7 +236,7 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) //it is quite impossible this function returns zero (failure) as YAMN and internal plugin structre versions are the same
POP3ProtocolRegistration.Name = Translate("POP3 protocol (internal)");
POP3ProtocolRegistration.Description = Translate(__DESCRIPTION);
- if (NULL == (POP3Plugin = (HYAMNPROTOPLUGIN)CallService(MS_YAMN_REGISTERPROTOPLUGIN, (WPARAM)&POP3ProtocolRegistration, (LPARAM)YAMN_PROTOREGISTRATIONVERSION)))
+ if (nullptr == (POP3Plugin = (HYAMNPROTOPLUGIN)CallService(MS_YAMN_REGISTERPROTOPLUGIN, (WPARAM)&POP3ProtocolRegistration, (LPARAM)YAMN_PROTOREGISTRATIONVERSION)))
return 0;
//Next we set our imported functions for YAMN
@@ -251,28 +251,28 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) switch (CallService(MS_YAMN_READACCOUNTS, (WPARAM)POP3Plugin, (LPARAM)FileName)) {
case EACC_FILEVERSION:
- MessageBox(NULL, TranslateT("Found new version of account book, not compatible with this version of YAMN."), TranslateT("YAMN (internal POP3) read error"), MB_OK);
+ MessageBox(nullptr, TranslateT("Found new version of account book, not compatible with this version of YAMN."), TranslateT("YAMN (internal POP3) read error"), MB_OK);
CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0);
- FileName = NULL;
+ FileName = nullptr;
return 0;
case EACC_FILECOMPATIBILITY:
- MessageBox(NULL, TranslateT("Error reading account file. Account file corrupted."), TranslateT("YAMN (internal POP3) read error"), MB_OK);
+ MessageBox(nullptr, TranslateT("Error reading account file. Account file corrupted."), TranslateT("YAMN (internal POP3) read error"), MB_OK);
CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0);
- FileName = NULL;
+ FileName = nullptr;
return 0;
case EACC_ALLOC:
- MessageBox(NULL, TranslateT("Memory allocation error while data reading"), TranslateT("YAMN (internal POP3) read error"), MB_OK);
+ MessageBox(nullptr, TranslateT("Memory allocation error while data reading"), TranslateT("YAMN (internal POP3) read error"), MB_OK);
CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0);
- FileName = NULL;
+ FileName = nullptr;
return 0;
case EACC_SYSTEM:
if (ERROR_FILE_NOT_FOUND != GetLastError())
{
wchar_t temp[1024] = { 0 };
mir_snwprintf(temp, L"%s\n%s", TranslateT("Reading file error. File already in use?"), FileName);
- MessageBox(NULL, temp, TranslateT("YAMN (internal POP3) read error"), MB_OK);
+ MessageBox(nullptr, temp, TranslateT("YAMN (internal POP3) read error"), MB_OK);
CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0);
- FileName = NULL;
+ FileName = nullptr;
return 0;
}
break;
@@ -282,7 +282,7 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) HACCOUNT Finder;
DBVARIANT dbv;
- for (Finder = POP3Plugin->FirstAccount; Finder != NULL; Finder = Finder->Next) {
+ for (Finder = POP3Plugin->FirstAccount; Finder != nullptr; Finder = Finder->Next) {
Finder->hContact = NULL;
for (MCONTACT hContact = db_find_first(YAMN_DBMODULE); hContact; hContact = db_find_next(hContact, YAMN_DBMODULE)) {
if (!db_get_s(hContact, YAMN_DBMODULE, "Id", &dbv)) {
@@ -318,19 +318,19 @@ DWORD WINAPI UnLoadPOP3(void *) {
//pYAMNVar is only a pointr, no need delete or free
if (hNetLib) {
- Netlib_CloseHandle(hNetLib); hNetLib = NULL;
+ Netlib_CloseHandle(hNetLib); hNetLib = nullptr;
}
if (CPOP3Account::AccountWriterSO) {
- delete CPOP3Account::AccountWriterSO; CPOP3Account::AccountWriterSO = NULL;
+ delete CPOP3Account::AccountWriterSO; CPOP3Account::AccountWriterSO = nullptr;
}
if (pYAMNMailFcn) {
- delete pYAMNMailFcn; pYAMNMailFcn = NULL;
+ delete pYAMNMailFcn; pYAMNMailFcn = nullptr;
}
if (pYAMNFcn) {
- delete pYAMNFcn; pYAMNFcn = NULL;
+ delete pYAMNFcn; pYAMNFcn = nullptr;
}
if (FileName) {
- CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0); FileName = NULL;
+ CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0); FileName = nullptr;
}
#ifdef DEBUG_SYNCHRO
@@ -345,7 +345,7 @@ DWORD WINAPI WritePOP3Accounts() if (ReturnValue == EACC_SYSTEM) {
wchar_t temp[1024] = { 0 };
mir_snwprintf(temp, L"%s\n%s", TranslateT("Error while copying data to disk occurred. Is file in use?"), FileName);
- MessageBox(NULL, temp, TranslateT("POP3 plugin - write file error"), MB_OK);
+ MessageBox(nullptr, temp, TranslateT("POP3 plugin - write file error"), MB_OK);
}
return ReturnValue;
@@ -356,8 +356,8 @@ DWORD WINAPI WritePOP3Options(HANDLE File, HACCOUNT Which) DWORD WrittenBytes;
DWORD Ver = POP3_FILEVERSION;
- if ((!WriteFile(File, (char *)&Ver, sizeof(DWORD), &WrittenBytes, NULL)) ||
- (!WriteFile(File, (char *)&((HPOP3ACCOUNT)Which)->CP, sizeof(WORD), &WrittenBytes, NULL)))
+ if ((!WriteFile(File, (char *)&Ver, sizeof(DWORD), &WrittenBytes, nullptr)) ||
+ (!WriteFile(File, (char *)&((HPOP3ACCOUNT)Which)->CP, sizeof(WORD), &WrittenBytes, nullptr)))
return EACC_SYSTEM;
return 0;
}
@@ -396,13 +396,13 @@ HYAMNMAIL WINAPI CreatePOP3Mail(HACCOUNT Account, DWORD) // if (MailDataVersion != YAMN_MAILDATAVERSION) return NULL;
//Now it is needed to construct our POP3 account and return its handle
- if (NULL == (NewMail = new YAMNMAIL))
- return NULL;
+ if (nullptr == (NewMail = new YAMNMAIL))
+ return nullptr;
- if (NULL == (NewMail->MailData = new MAILDATA))
+ if (nullptr == (NewMail->MailData = new MAILDATA))
{
delete NewMail;
- return NULL;
+ return nullptr;
}
NewMail->MailData->CP = ((HPOP3ACCOUNT)Account)->CP;
return (HYAMNMAIL)NewMail;
@@ -424,7 +424,7 @@ static void PostErrorProc(HPOP3ACCOUNT ActualAccount, void *ParamToBadConnection PPOP3_ERRORCODE ErrorCode;
//We store status before we do Quit(), because quit can destroy our errorcode status
- if (NULL != (ErrorCode = new POP3_ERRORCODE))
+ if (nullptr != (ErrorCode = new POP3_ERRORCODE))
{
ErrorCode->SSL = UseSSL;
ErrorCode->AppError = ActualAccount->SystemError;
@@ -438,7 +438,7 @@ static void PostErrorProc(HPOP3ACCOUNT ActualAccount, void *ParamToBadConnection try
{
DataRX = ActualAccount->Client.Quit();
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
}
catch (...)
@@ -456,19 +456,19 @@ static void PostErrorProc(HPOP3ACCOUNT ActualAccount, void *ParamToBadConnection SetAccountStatus(ActualAccount, TranslateT("Disconnected"));
//If we cannot allocate memory, do nothing
- if (ErrorCode == NULL)
+ if (ErrorCode == nullptr)
{
SetEvent(ActualAccount->UseInternetFree);
return;
}
}
else //else it was called from POP3 plugin, probably error when deleting old mail (POP3 synchro calls POP3 delete)
- if (ErrorCode == NULL)
+ if (ErrorCode == nullptr)
return;
if ((ActualAccount->BadConnectN.Flags & YAMN_ACC_MSG) || (ActualAccount->BadConnectN.Flags & YAMN_ACC_ICO) || (ActualAccount->BadConnectN.Flags & YAMN_ACC_POP))
{
- YAMN_BADCONNECTIONPARAM cp = { (HANDLE)0, ActualAccount, (UINT_PTR)ErrorCode, ParamToBadConnection };
+ YAMN_BADCONNECTIONPARAM cp = { (HANDLE)nullptr, ActualAccount, (UINT_PTR)ErrorCode, ParamToBadConnection };
CallService(MS_YAMN_BADCONNECTION, (WPARAM)&cp, (LPARAM)YAMN_BADCONNECTIONVERSION);
}
@@ -481,8 +481,8 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) {
HPOP3ACCOUNT ActualAccount;
CPop3Client *MyClient;
- HYAMNMAIL NewMails = NULL, MsgQueuePtr = NULL;
- char* DataRX = NULL, *Temp;
+ HYAMNMAIL NewMails = nullptr, MsgQueuePtr = nullptr;
+ char* DataRX = nullptr, *Temp;
int mboxsize, msgs, i;
SYSTEMTIME now;
LPVOID YAMNParam;
@@ -589,14 +589,14 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) #endif
// if we are already connected, we have open session (another thread left us open session), so we don't need to login
// note that connected state without logging cannot occur, because if we close session, we always close socket too (we must close socket is the right word :))
- if ((MyClient->NetClient == NULL) || !MyClient->NetClient->Connected())
+ if ((MyClient->NetClient == nullptr) || !MyClient->NetClient->Connected())
{
SetAccountStatus(ActualAccount, TranslateT("Connecting to server"));
DataRX = MyClient->Connect(ActualCopied.ServerName, ActualCopied.ServerPort, ActualCopied.Flags & YAMN_ACC_SSL23, ActualCopied.Flags & YAMN_ACC_NOTLS);
- char *timestamp = NULL;
+ char *timestamp = nullptr;
- if (DataRX != NULL)
+ if (DataRX != nullptr)
{
if (ActualCopied.Flags & YAMN_ACC_APOP)
{
@@ -610,7 +610,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) }
}
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
}
SetAccountStatus(ActualAccount, TranslateT("Entering POP3 account"));
@@ -618,20 +618,20 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) if (ActualCopied.Flags & YAMN_ACC_APOP)
{
DataRX = MyClient->APOP(ActualCopied.ServerLogin, ActualCopied.ServerPasswd, timestamp);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
delete[] timestamp;
}
else {
DataRX = MyClient->User(ActualCopied.ServerLogin);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
DataRX = MyClient->Pass(ActualCopied.ServerPasswd);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
}
}
SetAccountStatus(ActualAccount, TranslateT("Searching for new mail message"));
@@ -648,9 +648,9 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) DebugLog(DecodeFile,"<Msgs>%d</Msgs>\n",msgs);
DebugLog(DecodeFile,"</Extracting stat>\n");
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
for (i = 0; i < msgs; i++)
{
if (!i)
@@ -660,7 +660,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) MsgQueuePtr->Next = (HYAMNMAIL)CallService(MS_YAMN_CREATEACCOUNTMAIL, (WPARAM)ActualAccount, (LPARAM)YAMN_MAILVERSION);
MsgQueuePtr = MsgQueuePtr->Next;
}
- if (MsgQueuePtr == NULL)
+ if (MsgQueuePtr == nullptr)
{
ActualAccount->SystemError = EPOP3_QUEUEALLOC;
throw (DWORD)ActualAccount->SystemError;
@@ -677,9 +677,9 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) #ifdef DEBUG_DECODE
DebugLog(DecodeFile,"</Extracting list>\n");
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
#ifdef DEBUG_DECODE
DebugLog(DecodeFile,"<Extracting UIDL>\n");
@@ -689,9 +689,9 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) #ifdef DEBUG_DECODE
DebugLog(DecodeFile,"</Extracting UIDL>\n");
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
}
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write wait\n");
@@ -707,10 +707,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) {
+ for (MsgQueuePtr = (HYAMNMAIL)ActualAccount->Mails; MsgQueuePtr != nullptr; MsgQueuePtr = MsgQueuePtr->Next) {
if (MsgQueuePtr->Flags&YAMN_MSG_BODYREQUESTED) {
- HYAMNMAIL NewMsgsPtr = NULL;
- for (NewMsgsPtr = (HYAMNMAIL)NewMails; NewMsgsPtr != NULL; NewMsgsPtr = NewMsgsPtr->Next) {
+ HYAMNMAIL NewMsgsPtr = nullptr;
+ for (NewMsgsPtr = (HYAMNMAIL)NewMails; NewMsgsPtr != nullptr; NewMsgsPtr = NewMsgsPtr->Next) {
if (!mir_strcmp(MsgQueuePtr->ID, NewMsgsPtr->ID)) {
wchar_t accstatus[512];
mir_snwprintf(accstatus, TranslateT("Reading body %s"), NewMsgsPtr->ID);
@@ -720,7 +720,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) DebugLog(DecodeFile,"<Reading body>\n");
DebugLog(DecodeFile,"<Header>%s</Header>\n",DataRX);
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
{
Temp = DataRX;
while ((Temp < DataRX + MyClient->NetClient->Rcv) && (WS(Temp) || ENDLINE(Temp))) Temp++;
@@ -733,12 +733,12 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) continue;
//delete all the headers of the old mail MsgQueuePtr->MailData->TranslatedHeader
struct CMimeItem *TH = MsgQueuePtr->MailData->TranslatedHeader;
- if (TH) for (; MsgQueuePtr->MailData->TranslatedHeader != NULL;)
+ if (TH) for (; MsgQueuePtr->MailData->TranslatedHeader != nullptr;)
{
TH = TH->Next;
- if (MsgQueuePtr->MailData->TranslatedHeader->name != NULL)
+ if (MsgQueuePtr->MailData->TranslatedHeader->name != nullptr)
delete[] MsgQueuePtr->MailData->TranslatedHeader->name;
- if (MsgQueuePtr->MailData->TranslatedHeader->value != NULL)
+ if (MsgQueuePtr->MailData->TranslatedHeader->value != nullptr)
delete[] MsgQueuePtr->MailData->TranslatedHeader->value;
delete MsgQueuePtr->MailData->TranslatedHeader;
MsgQueuePtr->MailData->TranslatedHeader = TH;
@@ -752,23 +752,23 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) #endif
MsgQueuePtr->Flags |= YAMN_MSG_BODYRECEIVED;
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
break;
}
}
}
}
- SynchroMessages(ActualAccount, (HYAMNMAIL *)&ActualAccount->Mails, NULL, (HYAMNMAIL *)&NewMails, NULL); //we get only new mails on server!
+ SynchroMessages(ActualAccount, (HYAMNMAIL *)&ActualAccount->Mails, nullptr, (HYAMNMAIL *)&NewMails, nullptr); //we get only new mails on server!
// NewMails=NULL;
#ifdef DEBUG_SYNCHRO
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 != nullptr; MsgQueuePtr = MsgQueuePtr->Next) {
if ((MsgQueuePtr->Flags&YAMN_MSG_BODYREQUESTED) && (MsgQueuePtr->Flags&YAMN_MSG_BODYRECEIVED)) {
MsgQueuePtr->Flags &= ~YAMN_MSG_BODYREQUESTED;
if (MsgQueuePtr->MsgWindow)
@@ -776,13 +776,13 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) }
}
- for (msgs = 0, MsgQueuePtr = NewMails; MsgQueuePtr != NULL; MsgQueuePtr = MsgQueuePtr->Next, msgs++); //get number of new mails
+ for (msgs = 0, MsgQueuePtr = NewMails; MsgQueuePtr != nullptr; MsgQueuePtr = MsgQueuePtr->Next, msgs++); //get number of new mails
try
{
wchar_t accstatus[512];
- for (i = 0, MsgQueuePtr = NewMails; MsgQueuePtr != NULL; i++)
+ for (i = 0, MsgQueuePtr = NewMails; MsgQueuePtr != nullptr; i++)
{
BOOL autoretr = (ActualAccount->Flags & YAMN_ACC_BODY) != 0;
DataRX = MyClient->Top(MsgQueuePtr->Number, autoretr ? 100 : 0);
@@ -793,7 +793,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) DebugLog(DecodeFile,"<New mail>\n");
DebugLog(DecodeFile,"<Header>%s</Header>\n",DataRX);
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
{
Temp = DataRX;
while ((Temp < DataRX + MyClient->NetClient->Rcv) && (WS(Temp) || ENDLINE(Temp))) Temp++;
@@ -820,9 +820,9 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) // CallService(MS_YAMN_FILTERMAIL,(WPARAM)ActualAccount,(LPARAM)MsgQueuePtr);
FilterMailSvc((WPARAM)ActualAccount, (LPARAM)MsgQueuePtr);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
//MsgQueuePtr->MailData->Body=MyClient->Retr(MsgQueuePtr->Number);
@@ -846,7 +846,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"CheckPOP3:ActualAccountMsgsSO-write enter\n");
#endif
- if (ActualAccount->Mails == NULL)
+ if (ActualAccount->Mails == nullptr)
ActualAccount->Mails = NewMails;
else
{
@@ -871,9 +871,9 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) if (0 == SCGetNumber(ActualAccount->InternetQueries))
{
DataRX = MyClient->Quit();
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
MyClient->NetClient->Disconnect();
SetAccountStatus(ActualAccount, TranslateT("Disconnected"));
@@ -894,7 +894,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) }
{
- YAMN_MAILBROWSERPARAM Param = { (HANDLE)0, ActualAccount, ActualCopied.NFlags, ActualCopied.NNFlags, YAMNParam };
+ YAMN_MAILBROWSERPARAM Param = { (HANDLE)nullptr, ActualAccount, ActualCopied.NFlags, ActualCopied.NNFlags, YAMNParam };
if (CheckFlags & YAMN_FORCECHECK)
Param.nnflags |= YAMN_ACC_POP; //if force check, show popup anyway and if mailbrowser was opened, do not close
@@ -935,9 +935,9 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) DeleteMIMEQueue(ActualAccount, NewMails);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
switch (ActualAccount->SystemError)
{
case EACC_QUEUEALLOC:
@@ -976,8 +976,8 @@ void __cdecl DeleteMailsPOP3(void *param) DeleteParam *WhichTemp = (DeleteParam *)param;
CPop3Client *MyClient;
- HYAMNMAIL DeleteMails, NewMails = NULL, MsgQueuePtr = NULL;
- char* DataRX = NULL;
+ HYAMNMAIL DeleteMails, NewMails = nullptr, MsgQueuePtr = nullptr;
+ char* DataRX = nullptr;
int mboxsize = 0, msgs = 0, i;
BOOL UsingInternet = FALSE;
struct {
@@ -1028,11 +1028,11 @@ void __cdecl DeleteMailsPOP3(void *param) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"DeleteMailsPOP3:ActualAccountSO-read enter\n");
#endif
- if (NULL == (DeleteMails = (HYAMNMAIL)CreateNewDeleteQueue((HYAMNMAIL)ActualAccount->Mails))) //if there's no mail for deleting, return
+ if (nullptr == (DeleteMails = (HYAMNMAIL)CreateNewDeleteQueue((HYAMNMAIL)ActualAccount->Mails))) //if there's no mail for deleting, return
{
if (POP3_DELETEFROMCHECK != POP3PluginParam) //We do not wait for free internet when calling from SynchroPOP3. It is because UseInternetFree is blocked
{
- YAMN_MAILBROWSERPARAM Param = { (HANDLE)0, ActualAccount, YAMN_ACC_MSGP, YAMN_ACC_MSGP, YAMNParam }; //Just update the window
+ YAMN_MAILBROWSERPARAM Param = { (HANDLE)nullptr, ActualAccount, YAMN_ACC_MSGP, YAMN_ACC_MSGP, YAMNParam }; //Just update the window
CallService(MS_YAMN_MAILBROWSER, (WPARAM)&Param, (LPARAM)YAMN_MAILBROWSERVERSION);
}
@@ -1083,14 +1083,14 @@ void __cdecl DeleteMailsPOP3(void *param) #ifdef DEBUG_COMM
DebugLog(CommFile,"<--------Communication-------->\n");
#endif
- if ((MyClient->NetClient == NULL) || !MyClient->NetClient->Connected())
+ if ((MyClient->NetClient == nullptr) || !MyClient->NetClient->Connected())
{
SetAccountStatus(ActualAccount, TranslateT("Connecting to server"));
DataRX = MyClient->Connect(ActualCopied.ServerName, ActualCopied.ServerPort, ActualCopied.Flags & YAMN_ACC_SSL23, ActualCopied.Flags & YAMN_ACC_NOTLS);
- char *timestamp = NULL;
- if (DataRX != NULL) {
+ char *timestamp = nullptr;
+ if (DataRX != nullptr) {
if (ActualAccount->Flags & YAMN_ACC_APOP) {
char *lpos = strchr(DataRX, '<');
char *rpos = strchr(DataRX, '>');
@@ -1102,27 +1102,27 @@ void __cdecl DeleteMailsPOP3(void *param) }
}
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
}
SetAccountStatus(ActualAccount, TranslateT("Entering POP3 account"));
if (ActualAccount->Flags & YAMN_ACC_APOP)
{
DataRX = MyClient->APOP(ActualCopied.ServerLogin, ActualCopied.ServerPasswd, timestamp);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
delete[] timestamp;
}
else {
DataRX = MyClient->User(ActualCopied.ServerLogin);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
DataRX = MyClient->Pass(ActualCopied.ServerPasswd);
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
}
}
@@ -1144,9 +1144,9 @@ void __cdecl DeleteMailsPOP3(void *param) DebugLog(DecodeFile,"<Msgs>%d</Msgs>\n",msgs);
DebugLog(DecodeFile,"</Extracting stat>\n");
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
for (i = 0; i < msgs; i++)
{
if (!i)
@@ -1156,7 +1156,7 @@ void __cdecl DeleteMailsPOP3(void *param) MsgQueuePtr->Next = (HYAMNMAIL)CallService(MS_YAMN_CREATEACCOUNTMAIL, (WPARAM)ActualAccount, (LPARAM)YAMN_MAILVERSION);
MsgQueuePtr = MsgQueuePtr->Next;
}
- if (MsgQueuePtr == NULL)
+ if (MsgQueuePtr == nullptr)
{
ActualAccount->SystemError = EPOP3_QUEUEALLOC;
throw (DWORD)ActualAccount->SystemError;
@@ -1173,12 +1173,12 @@ void __cdecl DeleteMailsPOP3(void *param) #ifdef DEBUG_DECODE
DebugLog(DecodeFile,"</Extracting UIDL>\n");
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
// we get "new mails" on server (NewMails will contain all mails on server not found in DeleteMails)
// but also in DeleteMails we get only those, which are still on server with their responsable numbers
- SynchroMessages(ActualAccount, (HYAMNMAIL *)&DeleteMails, NULL, (HYAMNMAIL *)&NewMails, NULL);
+ SynchroMessages(ActualAccount, (HYAMNMAIL *)&DeleteMails, nullptr, (HYAMNMAIL *)&NewMails, nullptr);
}
}
else
@@ -1202,7 +1202,7 @@ void __cdecl DeleteMailsPOP3(void *param) {
HYAMNMAIL Temp;
- for (i = 0, MsgQueuePtr = DeleteMails; MsgQueuePtr != NULL; i++)
+ for (i = 0, MsgQueuePtr = DeleteMails; MsgQueuePtr != nullptr; i++)
{
if (!(MsgQueuePtr->Flags & YAMN_MSG_VIRTUAL)) //of course we can only delete real mails, not virtual
{
@@ -1228,9 +1228,9 @@ void __cdecl DeleteMailsPOP3(void *param) }
MsgQueuePtr = Temp;
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
}
else
MsgQueuePtr = MsgQueuePtr->Next;
@@ -1245,25 +1245,25 @@ void __cdecl DeleteMailsPOP3(void *param) throw; //and go to the main exception handling
}
- if (NewMails != NULL)
+ if (NewMails != nullptr)
// in ActualAccount->Mails we have all mails stored before calling this function
// in NewMails we have all mails not found in DeleteMails (in other words: we performed new ID checking and we
// stored all mails found on server, then we deleted the ones we wanted to delete in this function
// and NewMails queue now contains actual state of mails on server). But we will not use NewMails as actual state, because NewMails does not contain header data (subject, from...)
// We perform deleting from ActualAccount->Mails: we remove from original queue (ActualAccount->Mails) all deleted mails
- SynchroMessages(ActualAccount, (HYAMNMAIL *)&ActualAccount->Mails, NULL, (HYAMNMAIL *)&NewMails, NULL);
+ SynchroMessages(ActualAccount, (HYAMNMAIL *)&ActualAccount->Mails, nullptr, (HYAMNMAIL *)&NewMails, nullptr);
// Now ActualAccount->Mails contains all mails when calling this function except the ones, we wanted to delete (these are in DeleteMails)
// And in NewMails we have new mails (if any)
else if (POP3_DELETEFROMCHECK != POP3PluginParam)
{
DeleteMIMEQueue(ActualAccount, (HYAMNMAIL)ActualAccount->Mails);
- ActualAccount->Mails = NULL;
+ ActualAccount->Mails = nullptr;
}
}
else
{
DeleteMIMEQueue(ActualAccount, (HYAMNMAIL)ActualAccount->Mails);
- ActualAccount->Mails = NULL;
+ ActualAccount->Mails = nullptr;
}
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"DeleteMailsPOP3:ActualAccountMsgsSO-write done\n");
@@ -1281,16 +1281,16 @@ void __cdecl DeleteMailsPOP3(void *param) // if this functin was called from SynchroPOP3, then do not try to disconnect
if (POP3_DELETEFROMCHECK != POP3PluginParam)
{
- YAMN_MAILBROWSERPARAM Param = { (HANDLE)0, ActualAccount, ActualCopied.NFlags, YAMN_ACC_MSGP, YAMNParam };
+ YAMN_MAILBROWSERPARAM Param = { (HANDLE)nullptr, ActualAccount, ActualCopied.NFlags, YAMN_ACC_MSGP, YAMNParam };
CallService(MS_YAMN_MAILBROWSER, (WPARAM)&Param, (LPARAM)YAMN_MAILBROWSERVERSION);
if (0 == SCGetNumber(ActualAccount->InternetQueries))
{
DataRX = MyClient->Quit();
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
- DataRX = NULL;
+ DataRX = nullptr;
MyClient->NetClient->Disconnect();
SetAccountStatus(ActualAccount, TranslateT("Disconnected"));
@@ -1315,7 +1315,7 @@ void __cdecl DeleteMailsPOP3(void *param) #ifdef DEBUG_COMM
DebugLog(CommFile,"ERROR %x\n",ErrorCode);
#endif
- if (DataRX != NULL)
+ if (DataRX != nullptr)
free(DataRX);
switch (ActualAccount->SystemError)
{
@@ -1485,7 +1485,7 @@ void ExtractList(char *stream, int len, HYAMNMAIL queue) DebugLog(DecodeFile,"<Nr>%d</Nr>\n",msgnr);
#endif
- for (i = 1, queueptr = queue; (queueptr->Next != NULL) && (i < msgnr); queueptr = queueptr->Next, i++);
+ for (i = 1, queueptr = queue; (queueptr->Next != nullptr) && (i < msgnr); queueptr = queueptr->Next, i++);
if (i != msgnr)
throw (DWORD)EPOP3_LIST;
while (!WS(finder)) finder++; //jump characters
diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 16fda3be2c..5d239f3e1e 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -92,22 +92,22 @@ INT_PTR CALLBACK DlgProcPluginOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) id = SendMessage(hCombo, CB_GETITEMDATA, (WPARAM)index, 0);
mir_cslock lck(PluginRegCS);
- for (PParser = FirstProtoPlugin; PParser != NULL; PParser = PParser->Next)
+ for (PParser = FirstProtoPlugin; PParser != nullptr; PParser = PParser->Next)
if (id == (INT_PTR)PParser->Plugin) {
SetDlgItemTextA(hDlg, IDC_STVER, PParser->Plugin->PluginInfo->Ver);
- SetDlgItemTextA(hDlg, IDC_STDESC, PParser->Plugin->PluginInfo->Description == NULL ? "" : PParser->Plugin->PluginInfo->Description);
- SetDlgItemTextA(hDlg, IDC_STCOPY, PParser->Plugin->PluginInfo->Copyright == NULL ? "" : PParser->Plugin->PluginInfo->Copyright);
- SetDlgItemTextA(hDlg, IDC_STMAIL, PParser->Plugin->PluginInfo->Email == NULL ? "" : PParser->Plugin->PluginInfo->Email);
- SetDlgItemTextA(hDlg, IDC_STWWW, PParser->Plugin->PluginInfo->WWW == NULL ? "" : PParser->Plugin->PluginInfo->WWW);
+ SetDlgItemTextA(hDlg, IDC_STDESC, PParser->Plugin->PluginInfo->Description == nullptr ? "" : PParser->Plugin->PluginInfo->Description);
+ SetDlgItemTextA(hDlg, IDC_STCOPY, PParser->Plugin->PluginInfo->Copyright == nullptr ? "" : PParser->Plugin->PluginInfo->Copyright);
+ SetDlgItemTextA(hDlg, IDC_STMAIL, PParser->Plugin->PluginInfo->Email == nullptr ? "" : PParser->Plugin->PluginInfo->Email);
+ SetDlgItemTextA(hDlg, IDC_STWWW, PParser->Plugin->PluginInfo->WWW == nullptr ? "" : PParser->Plugin->PluginInfo->WWW);
break;
}
- for (FParser = FirstFilterPlugin; FParser != NULL; FParser = FParser->Next)
+ for (FParser = FirstFilterPlugin; FParser != nullptr; FParser = FParser->Next)
if (id == (INT_PTR)FParser->Plugin) {
SetDlgItemTextA(hDlg, IDC_STVER, FParser->Plugin->PluginInfo->Ver);
- SetDlgItemTextA(hDlg, IDC_STDESC, FParser->Plugin->PluginInfo->Description == NULL ? "" : FParser->Plugin->PluginInfo->Description);
- SetDlgItemTextA(hDlg, IDC_STCOPY, FParser->Plugin->PluginInfo->Copyright == NULL ? "" : FParser->Plugin->PluginInfo->Copyright);
- SetDlgItemTextA(hDlg, IDC_STMAIL, FParser->Plugin->PluginInfo->Email == NULL ? "" : FParser->Plugin->PluginInfo->Email);
- SetDlgItemTextA(hDlg, IDC_STWWW, FParser->Plugin->PluginInfo->WWW == NULL ? "" : FParser->Plugin->PluginInfo->WWW);
+ SetDlgItemTextA(hDlg, IDC_STDESC, FParser->Plugin->PluginInfo->Description == nullptr ? "" : FParser->Plugin->PluginInfo->Description);
+ SetDlgItemTextA(hDlg, IDC_STCOPY, FParser->Plugin->PluginInfo->Copyright == nullptr ? "" : FParser->Plugin->PluginInfo->Copyright);
+ SetDlgItemTextA(hDlg, IDC_STMAIL, FParser->Plugin->PluginInfo->Email == nullptr ? "" : FParser->Plugin->PluginInfo->Email);
+ SetDlgItemTextA(hDlg, IDC_STWWW, FParser->Plugin->PluginInfo->WWW == nullptr ? "" : FParser->Plugin->PluginInfo->WWW);
break;
}
}
@@ -127,11 +127,11 @@ INT_PTR CALLBACK DlgProcPluginOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM) if (TRUE == (BOOL)wParam) {
{
mir_cslock lck(PluginRegCS);
- for (PYAMN_PROTOPLUGINQUEUE PParser = FirstProtoPlugin; PParser != NULL; PParser = PParser->Next) {
+ for (PYAMN_PROTOPLUGINQUEUE PParser = FirstProtoPlugin; PParser != nullptr; PParser = PParser->Next) {
int index = SendDlgItemMessageA(hDlg, IDC_COMBOPLUGINS, CB_ADDSTRING, 0, (LPARAM)PParser->Plugin->PluginInfo->Name);
SendDlgItemMessage(hDlg, IDC_COMBOPLUGINS, CB_SETITEMDATA, (WPARAM)index, (LPARAM)PParser->Plugin);
}
- for (PYAMN_FILTERPLUGINQUEUE FParser = FirstFilterPlugin; FParser != NULL; FParser = FParser->Next) {
+ for (PYAMN_FILTERPLUGINQUEUE FParser = FirstFilterPlugin; FParser != nullptr; FParser = FParser->Next) {
int index = SendDlgItemMessageA(hDlg, IDC_COMBOPLUGINS, CB_ADDSTRING, 0, (LPARAM)FParser->Plugin->PluginInfo->Name);
SendDlgItemMessage(hDlg, IDC_COMBOPLUGINS, CB_SETITEMDATA, (WPARAM)index, (LPARAM)FParser->Plugin);
}
@@ -448,13 +448,13 @@ BOOL DlgShowAccount(HWND hDlg, WPARAM wParam, LPARAM lParam) }
else //default
{
- DlgSetItemText(hDlg, (WPARAM)IDC_EDITSERVER, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_EDITNAME, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_EDITLOGIN, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_EDITPASS, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_EDITAPP, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_EDITAPPPARAM, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ DlgSetItemText(hDlg, (WPARAM)IDC_EDITSERVER, nullptr);
+ DlgSetItemText(hDlg, (WPARAM)IDC_EDITNAME, nullptr);
+ DlgSetItemText(hDlg, (WPARAM)IDC_EDITLOGIN, nullptr);
+ DlgSetItemText(hDlg, (WPARAM)IDC_EDITPASS, nullptr);
+ DlgSetItemText(hDlg, (WPARAM)IDC_EDITAPP, nullptr);
+ DlgSetItemText(hDlg, (WPARAM)IDC_EDITAPPPARAM, nullptr);
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
SetDlgItemInt(hDlg, IDC_EDITPORT, 110, FALSE);
SetDlgItemInt(hDlg, IDC_EDITINTERVAL, 30, FALSE);
SetDlgItemInt(hDlg, IDC_EDITPOPS, 0, FALSE);
@@ -543,7 +543,7 @@ BOOL DlgShowAccountColors(HWND hDlg, WPARAM, LPARAM lParam) BOOL DlgSetItemText(HWND hDlg, WPARAM wParam, const char* str)
{
- if (str == NULL)
+ if (str == nullptr)
SetDlgItemTextA(hDlg, wParam, "");
else
SetDlgItemTextA(hDlg, wParam, str);
@@ -552,7 +552,7 @@ BOOL DlgSetItemText(HWND hDlg, WPARAM wParam, const char* str) BOOL DlgSetItemTextW(HWND hDlg, WPARAM wParam, const WCHAR* str)
{
- if (str == NULL)
+ if (str == nullptr)
SetDlgItemTextW(hDlg, wParam, L"");
else
SetDlgItemTextW(hDlg, wParam, str);
@@ -565,7 +565,7 @@ INT_PTR CALLBACK DlgProcPOP3AccStatusOpt(HWND hDlg, UINT msg, WPARAM wParam, LPA switch (msg) {
case WM_INITDIALOG:
ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput);
- if (ActualAccount != NULL) {
+ if (ActualAccount != nullptr) {
DlgShowAccountStatus(hDlg, (WPARAM)M_SHOWACTUAL, (LPARAM)ActualAccount);
DlgEnableAccountStatus(hDlg, TRUE, TRUE);
}
@@ -639,8 +639,8 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP DebugLog(SynchroFile, "Options:INITDIALOG:AccountBrowserSO-read enter\n");
#endif
- for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != NULL; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
- if (ActualAccount->Name != NULL)
+ for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
+ if (ActualAccount->Name != nullptr)
SendDlgItemMessageA(hDlg, IDC_COMBOACCOUNT, CB_ADDSTRING, 0, (LPARAM)ActualAccount->Name);
#ifdef DEBUG_SYNCHRO
@@ -656,7 +656,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP }
SendDlgItemMessage(hDlg, IDC_COMBOCP, CB_SETCURSEL, (WPARAM)CPDEFINDEX, 0);
- ActualAccount = NULL;
+ ActualAccount = nullptr;
TranslateDialogDefault(hDlg);
SendMessage(GetParent(hDlg), PSM_UNCHANGED, (WPARAM)hDlg, 0);
return TRUE;
@@ -697,8 +697,8 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_COMBOACCOUNT:
switch (HIWORD(wParam)) {
case CBN_EDITCHANGE:
- ActualAccount = NULL;
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ ActualAccount = nullptr;
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
if (GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, DlgInput, _countof(DlgInput)))
DlgEnableAccount(hDlg, TRUE, FALSE);
@@ -708,8 +708,8 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP case CBN_KILLFOCUS:
GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, DlgInput, _countof(DlgInput));
- if (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput))) {
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ if (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput))) {
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
EnableWindow(GetDlgItem(hDlg, IDC_BTNDEL), FALSE);
if (mir_strlen(DlgInput))
DlgEnableAccount(hDlg, TRUE, TRUE);
@@ -727,8 +727,8 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP if (CB_ERR != (Result = SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_GETCURSEL, 0, 0)))
SendDlgItemMessageA(hDlg, IDC_COMBOACCOUNT, CB_GETLBTEXT, (WPARAM)Result, (LPARAM)DlgInput);
- if ((Result == CB_ERR) || (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput)))) {
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ if ((Result == CB_ERR) || (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput)))) {
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
EnableWindow(GetDlgItem(hDlg, IDC_BTNDEL), FALSE);
}
else {
@@ -815,7 +815,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP break;
case IDC_BTNADD:
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
DlgShowAccount(hDlg, (WPARAM)M_SHOWDEFAULT, 0);
DlgEnableAccount(hDlg, TRUE, TRUE);
EnableWindow(GetDlgItem(hDlg, IDC_BTNDEL), FALSE);
@@ -860,7 +860,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, DlgInput, _countof(DlgInput));
EnableWindow(GetDlgItem(hDlg, IDC_BTNDEL), FALSE);
if ((CB_ERR == (Result = SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_GETCURSEL, 0, 0)))
- || (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput))))
+ || (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput))))
return TRUE;
if (IDOK != MessageBox(hDlg, TranslateT("Do you really want to delete this account?"), TranslateT("Delete account confirmation"), MB_OKCANCEL | MB_ICONWARNING))
@@ -876,13 +876,13 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP //We can consider our account as deleted.
SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_DELETESTRING, (WPARAM)Result, 0);
- DlgSetItemText(hDlg, (WPARAM)IDC_COMBOACCOUNT, 0);
+ DlgSetItemText(hDlg, (WPARAM)IDC_COMBOACCOUNT, nullptr);
DlgEnableAccount(hDlg, FALSE, 0);
DlgShowAccount(hDlg, (WPARAM)M_SHOWDEFAULT, 0);
break;
case IDC_BTNRESET:
- if (ActualAccount != NULL)
+ if (ActualAccount != nullptr)
ActualAccount->TimeLeft = ActualAccount->Interval;
return 1;
}
@@ -955,7 +955,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP DlgSetItemTextT(hDlg, IDC_STTIMELEFT, TranslateT("Please wait while no account is in use."));
- if (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)Text))) {
+ if (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)Text))) {
NewAcc = TRUE;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Options:APPLY:AccountBrowserSO-write wait\n");
@@ -964,7 +964,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Options:APPLY:AccountBrowserSO-write enter\n");
#endif
- if (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)POP3Plugin, (LPARAM)YAMN_ACCOUNTVERSION))) {
+ if (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_GETNEXTFREEACCOUNT, (WPARAM)POP3Plugin, (LPARAM)YAMN_ACCOUNTVERSION))) {
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Options:APPLY:AccountBrowserSO-write done\n");
#endif
@@ -1003,37 +1003,37 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP GetDlgItemTextA(hDlg, IDC_EDITNAME, Text, _countof(Text));
if (!(Length = mir_strlen(Text)))
break;
- if (NULL != ActualAccount->Name)
+ if (nullptr != ActualAccount->Name)
delete[] ActualAccount->Name;
ActualAccount->Name = new char[mir_strlen(Text) + 1];
mir_strcpy(ActualAccount->Name, Text);
GetDlgItemTextA(hDlg, IDC_EDITSERVER, Text, _countof(Text));
- if (NULL != ActualAccount->Server->Name)
+ if (nullptr != ActualAccount->Server->Name)
delete[] ActualAccount->Server->Name;
ActualAccount->Server->Name = new char[mir_strlen(Text) + 1];
mir_strcpy(ActualAccount->Server->Name, Text);
GetDlgItemTextA(hDlg, IDC_EDITLOGIN, Text, _countof(Text));
- if (NULL != ActualAccount->Server->Login)
+ if (nullptr != ActualAccount->Server->Login)
delete[] ActualAccount->Server->Login;
ActualAccount->Server->Login = new char[mir_strlen(Text) + 1];
mir_strcpy(ActualAccount->Server->Login, Text);
GetDlgItemTextA(hDlg, IDC_EDITPASS, Text, _countof(Text));
- if (NULL != ActualAccount->Server->Passwd)
+ if (nullptr != ActualAccount->Server->Passwd)
delete[] ActualAccount->Server->Passwd;
ActualAccount->Server->Passwd = new char[mir_strlen(Text) + 1];
mir_strcpy(ActualAccount->Server->Passwd, Text);
GetDlgItemTextW(hDlg, IDC_EDITAPP, TextW, _countof(TextW));
- if (NULL != ActualAccount->NewMailN.App)
+ if (nullptr != ActualAccount->NewMailN.App)
delete[] ActualAccount->NewMailN.App;
ActualAccount->NewMailN.App = new WCHAR[mir_wstrlen(TextW) + 1];
mir_wstrcpy(ActualAccount->NewMailN.App, TextW);
GetDlgItemTextW(hDlg, IDC_EDITAPPPARAM, TextW, _countof(TextW));
- if (NULL != ActualAccount->NewMailN.AppParam)
+ if (nullptr != ActualAccount->NewMailN.AppParam)
delete[] ActualAccount->NewMailN.AppParam;
ActualAccount->NewMailN.AppParam = new WCHAR[mir_wstrlen(TextW) + 1];
mir_wstrcpy(ActualAccount->NewMailN.AppParam, TextW);
@@ -1109,16 +1109,16 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP EnableWindow(GetDlgItem(hDlg, IDC_BTNDEL), TRUE);
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
index = SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_GETCURSEL, 0, 0);
HPOP3ACCOUNT temp = ActualAccount;
SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_RESETCONTENT, 0, 0);
- if (POP3Plugin->FirstAccount != NULL)
- for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != NULL; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
- if (ActualAccount->Name != NULL)
+ if (POP3Plugin->FirstAccount != nullptr)
+ for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
+ if (ActualAccount->Name != nullptr)
SendDlgItemMessageA(hDlg, IDC_COMBOACCOUNT, CB_ADDSTRING, 0, (LPARAM)ActualAccount->Name);
ActualAccount = temp;
@@ -1157,15 +1157,15 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Options:INITDIALOG:AccountBrowserSO-read enter\n");
#endif
- if (POP3Plugin->FirstAccount != NULL)
- for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != NULL; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
- if (ActualAccount->Name != NULL)
+ if (POP3Plugin->FirstAccount != nullptr)
+ for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
+ if (ActualAccount->Name != nullptr)
SendDlgItemMessageA(hDlg, IDC_COMBOACCOUNT, CB_ADDSTRING, 0, (LPARAM)ActualAccount->Name);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Options:INITDIALOG:AccountBrowserSO-read done\n");
#endif
ReadDoneSO(POP3Plugin->AccountBrowserSO);
- ActualAccount = NULL;
+ ActualAccount = nullptr;
TranslateDialogDefault(hDlg);
@@ -1185,14 +1185,14 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM HPOP3ACCOUNT temp = ActualAccount;
SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_RESETCONTENT, 0, 0);
- if (POP3Plugin->FirstAccount != NULL)
- for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != NULL; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
- if (ActualAccount->Name != NULL)
+ if (POP3Plugin->FirstAccount != nullptr)
+ for (ActualAccount = (HPOP3ACCOUNT)POP3Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = (HPOP3ACCOUNT)ActualAccount->Next)
+ if (ActualAccount->Name != nullptr)
SendDlgItemMessageA(hDlg, IDC_COMBOACCOUNT, CB_ADDSTRING, 0, (LPARAM)ActualAccount->Name);
ActualAccount = temp;
- if (ActualAccount != NULL) {
+ if (ActualAccount != nullptr) {
SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_SETCURSEL, (WPARAM)index, (LPARAM)ActualAccount->Name);
DlgShowAccount(hDlg, (WPARAM)M_SHOWACTUAL, (LPARAM)ActualAccount);
DlgShowAccountColors(hDlg, 0, (LPARAM)ActualAccount);
@@ -1216,8 +1216,8 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM case CBN_KILLFOCUS:
GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, DlgInput, _countof(DlgInput));
- if (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput))) {
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ if (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput))) {
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
if (mir_strlen(DlgInput))
DlgEnableAccountPopup(hDlg, TRUE, TRUE);
else
@@ -1232,8 +1232,8 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM case CBN_SELCHANGE:
if (CB_ERR != (Result = SendDlgItemMessage(hDlg, IDC_COMBOACCOUNT, CB_GETCURSEL, 0, 0)))
SendDlgItemMessageA(hDlg, IDC_COMBOACCOUNT, CB_GETLBTEXT, (WPARAM)Result, (LPARAM)DlgInput);
- if ((Result == CB_ERR) || (NULL == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput)))) {
- DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, 0);
+ if ((Result == CB_ERR) || (nullptr == (ActualAccount = (HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)DlgInput)))) {
+ DlgSetItemText(hDlg, (WPARAM)IDC_STTIMELEFT, nullptr);
}
else {
DlgShowAccount(hDlg, (WPARAM)M_SHOWACTUAL, (LPARAM)ActualAccount);
@@ -1319,12 +1319,12 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM TesterN.colorBack = GetSysColor(COLOR_BTNFACE);
TesterN.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
- Tester.PluginWindowProc = NULL;
- TesterF.PluginWindowProc = NULL;
- TesterN.PluginWindowProc = NULL;
- Tester.PluginData = NULL;
- TesterF.PluginData = NULL;
- TesterN.PluginData = NULL;
+ Tester.PluginWindowProc = nullptr;
+ TesterF.PluginWindowProc = nullptr;
+ TesterN.PluginWindowProc = nullptr;
+ Tester.PluginData = nullptr;
+ TesterF.PluginData = nullptr;
+ TesterN.PluginData = nullptr;
if (IsDlgButtonChecked(hDlg, IDC_CHECKPOP) == BST_CHECKED)
PUAddPopupT(&Tester);
diff --git a/plugins/YAMN/src/protoplugin.cpp b/plugins/YAMN/src/protoplugin.cpp index 20fc0f5817..d2ab6d2b79 100644 --- a/plugins/YAMN/src/protoplugin.cpp +++ b/plugins/YAMN/src/protoplugin.cpp @@ -9,7 +9,7 @@ //--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
-PYAMN_PROTOPLUGINQUEUE FirstProtoPlugin=NULL;
+PYAMN_PROTOPLUGINQUEUE FirstProtoPlugin=nullptr;
INT_PTR RegisterProtocolPluginSvc(WPARAM,LPARAM);
@@ -53,20 +53,20 @@ INT_PTR RegisterProtocolPluginSvc(WPARAM wParam,LPARAM lParam) if (lParam != YAMN_PROTOREGISTRATIONVERSION)
return 0;
- if ((Registration->Name==NULL) || (Registration->Ver==NULL))
+ if ((Registration->Name==nullptr) || (Registration->Ver==nullptr))
return (INT_PTR)NULL;
- if (NULL==(Plugin=new YAMN_PROTOPLUGIN))
+ if (nullptr==(Plugin=new YAMN_PROTOPLUGIN))
return (INT_PTR)NULL;
Plugin->PluginInfo=Registration;
- Plugin->FirstAccount=NULL;
+ Plugin->FirstAccount=nullptr;
Plugin->AccountBrowserSO=new SWMRG;
- SWMRGInitialize(Plugin->AccountBrowserSO,NULL);
+ SWMRGInitialize(Plugin->AccountBrowserSO,nullptr);
- Plugin->Fcn=NULL;
- Plugin->MailFcn=NULL;
+ Plugin->Fcn=nullptr;
+ Plugin->MailFcn=nullptr;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile,"::: YAMN- new protocol registered: %0x (%s) :::\n",Plugin,Registration->Name);
@@ -82,9 +82,9 @@ int WINAPI SetProtocolPluginFcnImportFcn(HYAMNPROTOPLUGIN Plugin,PYAMN_PROTOIMPO return 0;
if (YAMNMailFcnVer != YAMN_MAILIMPORTFCNVERSION)
return 0;
- if (YAMNFcn==NULL)
+ if (YAMNFcn==nullptr)
return 0;
- if (YAMNMailFcn==NULL)
+ if (YAMNMailFcn==nullptr)
return 0;
#ifdef DEBUG_SYNCHRO
@@ -95,8 +95,8 @@ int WINAPI SetProtocolPluginFcnImportFcn(HYAMNPROTOPLUGIN Plugin,PYAMN_PROTOIMPO mir_cslock lck(PluginRegCS);
// We add protocol to the protocol list
- for (Parser=FirstProtoPlugin;Parser != NULL && Parser->Next != NULL;Parser=Parser->Next);
- if (Parser==NULL)
+ for (Parser=FirstProtoPlugin;Parser != nullptr && Parser->Next != nullptr;Parser=Parser->Next);
+ if (Parser==nullptr)
{
FirstProtoPlugin=new YAMN_PROTOPLUGINQUEUE;
Parser=FirstProtoPlugin;
@@ -108,7 +108,7 @@ int WINAPI SetProtocolPluginFcnImportFcn(HYAMNPROTOPLUGIN Plugin,PYAMN_PROTOIMPO }
Parser->Plugin=Plugin;
- Parser->Next=NULL;
+ Parser->Next=nullptr;
return 1;
}
@@ -126,21 +126,21 @@ INT_PTR UnregisterProtocolPlugin(HYAMNPROTOPLUGIN Plugin) }
else
{
- for (Parser=FirstProtoPlugin;(Parser->Next != NULL) && (Plugin != Parser->Next->Plugin);Parser=Parser->Next);
- if (Parser->Next != NULL)
+ for (Parser=FirstProtoPlugin;(Parser->Next != nullptr) && (Plugin != Parser->Next->Plugin);Parser=Parser->Next);
+ if (Parser->Next != nullptr)
{
Found=Parser->Next;
Parser->Next=Parser->Next->Next;
}
else
- Found=NULL;
+ Found=nullptr;
}
- if (Found != NULL)
+ if (Found != nullptr)
{
StopAccounts(Plugin);
DeleteAccounts(Plugin);
- if (Plugin->Fcn->UnLoadFcn != NULL)
- Plugin->Fcn->UnLoadFcn((void *)0);
+ if (Plugin->Fcn->UnLoadFcn != nullptr)
+ Plugin->Fcn->UnLoadFcn((void *)nullptr);
delete Found->Plugin->AccountBrowserSO;
delete Found->Plugin;
@@ -168,7 +168,7 @@ INT_PTR UnregisterProtoPlugins() {
mir_cslock lck(PluginRegCS);
// We remove protocols from the protocol list
- while(FirstProtoPlugin != NULL)
+ while(FirstProtoPlugin != nullptr)
UnregisterProtocolPlugin(FirstProtoPlugin->Plugin);
return 1;
}
@@ -176,7 +176,7 @@ INT_PTR UnregisterProtoPlugins() INT_PTR GetFileNameSvc(WPARAM wParam,LPARAM)
{
wchar_t *FileName = new wchar_t[MAX_PATH];
- if (FileName == NULL)
+ if (FileName == nullptr)
return NULL;
mir_snwprintf(FileName, MAX_PATH, L"%s\\yamn-accounts.%s.%s.book", UserDirectory, wParam, ProfileName);
@@ -185,7 +185,7 @@ INT_PTR GetFileNameSvc(WPARAM wParam,LPARAM) INT_PTR DeleteFileNameSvc(WPARAM wParam,LPARAM)
{
- if (( wchar_t* )wParam != NULL)
+ if (( wchar_t* )wParam != nullptr)
delete[] ( wchar_t* ) wParam;
return 0;
diff --git a/plugins/YAMN/src/services.cpp b/plugins/YAMN/src/services.cpp index ba0f805c4e..56c7477213 100644 --- a/plugins/YAMN/src/services.cpp +++ b/plugins/YAMN/src/services.cpp @@ -74,7 +74,7 @@ static INT_PTR ContactApplication(WPARAM wParam, LPARAM) return 0;
HACCOUNT ActualAccount = (HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
- if (ActualAccount != NULL) {
+ if (ActualAccount != nullptr) {
STARTUPINFOW si = { 0 };
si.cb = sizeof(si);
@@ -85,22 +85,22 @@ static INT_PTR ContactApplication(WPARAM wParam, LPARAM) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "ContactApplication:ualAccountSO-read enter\n");
#endif
- if (ActualAccount->NewMailN.App != NULL) {
+ if (ActualAccount->NewMailN.App != nullptr) {
WCHAR *Command;
- if (ActualAccount->NewMailN.AppParam != NULL)
+ if (ActualAccount->NewMailN.AppParam != nullptr)
Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App)+mir_wstrlen(ActualAccount->NewMailN.AppParam)+6];
else
Command = new WCHAR[mir_wstrlen(ActualAccount->NewMailN.App)+6];
- if (Command != NULL) {
+ if (Command != nullptr) {
mir_wstrcpy(Command, L"\"");
mir_wstrcat(Command, ActualAccount->NewMailN.App);
mir_wstrcat(Command, L"\" ");
- if (ActualAccount->NewMailN.AppParam != NULL)
+ if (ActualAccount->NewMailN.AppParam != nullptr)
mir_wstrcat(Command, ActualAccount->NewMailN.AppParam);
PROCESS_INFORMATION pi;
- CreateProcessW(NULL, Command, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
+ CreateProcessW(nullptr, Command, nullptr, nullptr, FALSE, NORMAL_PRIORITY_CLASS, nullptr, nullptr, &si, &pi);
delete[] Command;
}
}
@@ -125,10 +125,10 @@ static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam) //This service will check/sincronize the account pointed by wParam
HACCOUNT ActualAccount = (HACCOUNT)wParam;
// copy/paste make mistakes
- if (ActualAccount != NULL) {
+ if (ActualAccount != nullptr) {
//we use event to signal, that running thread has all needed stack parameters copied
- HANDLE ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (ThreadRunningEV == NULL)
+ HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ if (ThreadRunningEV == nullptr)
return 0;
//if we want to close miranda, we get event and do not run pop3 checking anymore
if (WAIT_OBJECT_0 == WaitForSingleObject(ExitEV, 0))
@@ -148,11 +148,11 @@ static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam) DebugLog(SynchroFile, "ForceCheck:ActualAccountSO-read enter\n");
#endif
if ((ActualAccount->Flags & YAMN_ACC_ENA) && ActualAccount->Plugin->Fcn->SynchroFcnPtr) {
- struct CheckParam ParamToPlugin = {YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, lParam?YAMN_FORCECHECK:YAMN_NORMALCHECK, 0, NULL};
+ struct CheckParam ParamToPlugin = {YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, lParam?YAMN_FORCECHECK:YAMN_NORMALCHECK, nullptr, nullptr};
ActualAccount->TimeLeft = ActualAccount->Interval;
DWORD tid;
- HANDLE NewThread = CreateThread(NULL, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->SynchroFcnPtr, &ParamToPlugin, 0, &tid);
+ HANDLE NewThread = CreateThread(nullptr, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->SynchroFcnPtr, &ParamToPlugin, 0, &tid);
if (NewThread) {
WaitForSingleObject(ThreadRunningEV, INFINITE);
CloseHandle(NewThread);
@@ -176,10 +176,10 @@ static INT_PTR ContactMailCheck(WPARAM hContact, LPARAM) return 0;
HACCOUNT ActualAccount = (HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
- if (ActualAccount != NULL) {
+ if (ActualAccount != nullptr) {
//we use event to signal, that running thread has all needed stack parameters copied
HANDLE ThreadRunningEV;
- if (NULL == (ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL)))
+ if (nullptr == (ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr)))
return 0;
//if we want to close miranda, we get event and do not run pop3 checking anymore
if (WAIT_OBJECT_0 == WaitForSingleObject(ExitEV, 0))
@@ -201,12 +201,12 @@ static INT_PTR ContactMailCheck(WPARAM hContact, LPARAM) #endif
if ((ActualAccount->Flags & YAMN_ACC_ENA) && (ActualAccount->StatusFlags & YAMN_ACC_FORCE)) //account cannot be forced to check
{
- if (ActualAccount->Plugin->Fcn->ForceCheckFcnPtr == NULL)
+ if (ActualAccount->Plugin->Fcn->ForceCheckFcnPtr == nullptr)
ReadDoneFcn(ActualAccount->AccountAccessSO);
DWORD tid;
- struct CheckParam ParamToPlugin = {YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_FORCECHECK, (void *)0, NULL};
- if (NULL == CreateThread(NULL, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr, &ParamToPlugin, 0, &tid))
+ struct CheckParam ParamToPlugin = {YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_FORCECHECK, (void *)nullptr, nullptr};
+ if (nullptr == CreateThread(nullptr, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr, &ParamToPlugin, 0, &tid))
ReadDoneFcn(ActualAccount->AccountAccessSO);
else
WaitForSingleObject(ThreadRunningEV, INFINITE);
@@ -230,7 +230,7 @@ static INT_PTR ContactMailCheck(WPARAM hContact, LPARAM) return;
HACCOUNT ActualAccount = (HACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal);
- if (ActualAccount != NULL) {
+ if (ActualAccount != nullptr) {
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Service_ContactDoubleclicked:ActualAccountSO-read wait\n");
#endif
@@ -238,7 +238,7 @@ static INT_PTR ContactMailCheck(WPARAM hContact, LPARAM) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "Service_ContactDoubleclicked:ActualAccountSO-read enter\n");
#endif
- YAMN_MAILBROWSERPARAM Param = { 0, ActualAccount, ActualAccount->NewMailN.Flags, ActualAccount->NoNewMailN.Flags, 0 };
+ YAMN_MAILBROWSERPARAM Param = { nullptr, ActualAccount, ActualAccount->NewMailN.Flags, ActualAccount->NoNewMailN.Flags, nullptr };
Param.nnflags = Param.nnflags | YAMN_ACC_MSG; //show mails in account even no new mail in account
Param.nnflags = Param.nnflags & ~YAMN_ACC_POP;
@@ -284,12 +284,12 @@ HBITMAP LoadBmpFromIcon(HICON hIcon) rc.right = bih.biWidth;
rc.bottom = bih.biHeight;
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
HBITMAP hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight);
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp);
FillRect(hdcMem, &rc, hBkgBrush);
- DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL);
+ DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, nullptr, DI_NORMAL);
SelectObject(hdcMem, hoBmp);
return hBmp;
}
@@ -297,8 +297,8 @@ HBITMAP LoadBmpFromIcon(HICON hIcon) int AddTopToolbarIcon(WPARAM,LPARAM)
{
if ( db_get_b(NULL, YAMN_DBMODULE, YAMN_TTBFCHECK, 1)) {
- if ( ServiceExists(MS_TTB_REMOVEBUTTON) && hTTButton == NULL) {
- TTBButton btn = { 0 };
+ if ( ServiceExists(MS_TTB_REMOVEBUTTON) && hTTButton == nullptr) {
+ TTBButton btn = {};
btn.pszService = MS_YAMN_FORCECHECK;
btn.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
btn.hIconHandleUp = btn.hIconHandleDn = g_GetIconHandle(0);
@@ -307,9 +307,9 @@ int AddTopToolbarIcon(WPARAM,LPARAM) }
}
else {
- if (hTTButton != NULL) {
+ if (hTTButton != nullptr) {
CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hTTButton, 0);
- hTTButton = NULL;
+ hTTButton = nullptr;
}
}
@@ -328,7 +328,7 @@ int Shutdown(WPARAM, LPARAM) db_set_dw(NULL, YAMN_DBMODULE, YAMN_DBMSGSIZEY, HeadSizeY);
db_set_w(NULL, YAMN_DBMODULE, YAMN_DBMSGPOSSPLIT, HeadSplitPos);
YAMNVar.Shutdown = TRUE;
- KillTimer(NULL, SecTimer);
+ KillTimer(nullptr, SecTimer);
UnregisterProtoPlugins();
UnregisterFilterPlugins();
@@ -435,7 +435,7 @@ void CreateServiceFunctions(void) void RefreshContact(void)
{
HACCOUNT Finder;
- for (Finder = POP3Plugin->FirstAccount;Finder != NULL;Finder = Finder->Next) {
+ for (Finder = POP3Plugin->FirstAccount;Finder != nullptr;Finder = Finder->Next) {
if (Finder->hContact != NULL) {
if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT))
db_unset(Finder->hContact, "CList", "Hidden");
diff --git a/plugins/YAMN/src/synchro.cpp b/plugins/YAMN/src/synchro.cpp index e008fe9db0..8a81f2a345 100644 --- a/plugins/YAMN/src/synchro.cpp +++ b/plugins/YAMN/src/synchro.cpp @@ -88,51 +88,51 @@ void WINAPI SWMRGDelete(PSWMRG pSWMRG) {
// Destroys any synchronization objects that were
// successfully created.
- if (NULL != pSWMRG->hEventNoWriter)
+ if (nullptr != pSWMRG->hEventNoWriter)
CloseHandle(pSWMRG->hEventNoWriter);
- if (NULL != pSWMRG->hEventNoReaders)
+ if (nullptr != pSWMRG->hEventNoReaders)
CloseHandle(pSWMRG->hEventNoReaders);
- if (NULL != pSWMRG->hSemNumReaders)
+ if (nullptr != pSWMRG->hSemNumReaders)
CloseHandle(pSWMRG->hSemNumReaders);
- if (NULL != pSWMRG->hFinishEV)
+ if (nullptr != pSWMRG->hFinishEV)
CloseHandle(pSWMRG->hFinishEV);
}
BOOL WINAPI SWMRGInitialize(PSWMRG pSWMRG,wchar_t *Name)
{
- pSWMRG->hEventNoWriter=NULL;
- pSWMRG->hEventNoReaders=NULL;
- pSWMRG->hSemNumReaders=NULL;
- pSWMRG->hFinishEV=NULL;
+ pSWMRG->hEventNoWriter=nullptr;
+ pSWMRG->hEventNoReaders=nullptr;
+ pSWMRG->hSemNumReaders=nullptr;
+ pSWMRG->hFinishEV=nullptr;
// Creates the automatic-reset event that is signalled when
// no writer threads are writing.
// Initially no reader threads are reading.
- if (Name != NULL)
+ if (Name != nullptr)
Name[0]=(wchar_t)'W';
- pSWMRG->hEventNoWriter=CreateEvent(NULL,FALSE,TRUE,Name);
+ pSWMRG->hEventNoWriter=CreateEvent(nullptr,FALSE,TRUE,Name);
// Creates the manual-reset event that is signalled when
// no reader threads are reading.
// Initially no reader threads are reading.
- if (Name != NULL)
+ if (Name != nullptr)
Name[0]=(wchar_t)'R';
- pSWMRG->hEventNoReaders=CreateEvent(NULL,TRUE,TRUE,Name);
+ pSWMRG->hEventNoReaders=CreateEvent(nullptr,TRUE,TRUE,Name);
// Initializes the variable that indicates the number of
// reader threads that are reading.
// Initially no reader threads are reading.
- if (Name != NULL)
+ if (Name != nullptr)
Name[0]=(wchar_t)'C';
- pSWMRG->hSemNumReaders=CreateSemaphore(NULL,0,0x7FFFFFFF,Name);
+ pSWMRG->hSemNumReaders=CreateSemaphore(nullptr,0,0x7FFFFFFF,Name);
- if (Name != NULL)
+ if (Name != nullptr)
Name[0]=(wchar_t)'F';
- pSWMRG->hFinishEV=CreateEvent(NULL,TRUE,FALSE,Name);
+ pSWMRG->hFinishEV=CreateEvent(nullptr,TRUE,FALSE,Name);
// If a synchronization object could not be created,
// destroys any created objects and return failure.
- if ((NULL==pSWMRG->hEventNoWriter) || (NULL==pSWMRG->hEventNoReaders) || (NULL==pSWMRG->hSemNumReaders) || (NULL==pSWMRG->hFinishEV))
+ if ((nullptr==pSWMRG->hEventNoWriter) || (nullptr==pSWMRG->hEventNoReaders) || (nullptr==pSWMRG->hSemNumReaders) || (nullptr==pSWMRG->hFinishEV))
{
SWMRGDelete(pSWMRG);
return FALSE;
@@ -261,7 +261,7 @@ DWORD WINAPI WaitToWriteFcn(PSWMRG SObject,PSCOUNTER SCounter) DebugLog(SynchroFile,"\tSO WaitToWrite: %x\n",SObject);
#endif
if (WAIT_OBJECT_0==(EnterCode=SWMRGWaitToWrite(SObject,INFINITE)))
- if (SCounter != NULL)
+ if (SCounter != nullptr)
SCIncFcn(SCounter);
return EnterCode;
}
@@ -272,7 +272,7 @@ void WINAPI WriteDoneFcn(PSWMRG SObject,PSCOUNTER SCounter) DebugLog(SynchroFile,"\tSO WriteDone: %x\n",SObject);
#endif
SWMRGDoneWriting(SObject);
- if (SCounter != NULL)
+ if (SCounter != nullptr)
SCDecFcn(SCounter);
}
diff --git a/plugins/YAMN/src/yamn.cpp b/plugins/YAMN/src/yamn.cpp index ee15e5c343..9343f0f53f 100644 --- a/plugins/YAMN/src/yamn.cpp +++ b/plugins/YAMN/src/yamn.cpp @@ -100,8 +100,8 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) DWORD Status, tid;
// we use event to signal, that running thread has all needed stack parameters copied
- HANDLE ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (ThreadRunningEV == NULL)
+ HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ if (ThreadRunningEV == nullptr)
return;
// if we want to close miranda, we get event and do not run checking anymore
if (WAIT_OBJECT_0==WaitForSingleObject(ExitEV, 0))
@@ -110,7 +110,7 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) Status=CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
mir_cslock lck(PluginRegCS);
- for (PYAMN_PROTOPLUGINQUEUE ActualPlugin = FirstProtoPlugin; ActualPlugin != NULL; ActualPlugin = ActualPlugin->Next) {
+ for (PYAMN_PROTOPLUGINQUEUE ActualPlugin = FirstProtoPlugin; ActualPlugin != nullptr; ActualPlugin = ActualPlugin->Next) {
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "TimerProc:AccountBrowserSO-read wait\n");
#endif
@@ -124,9 +124,9 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "TimerProc:AccountBrowserSO-read enter\n");
#endif
- for (ActualAccount=ActualPlugin->Plugin->FirstAccount;ActualAccount != NULL;ActualAccount=ActualAccount->Next)
+ for (ActualAccount=ActualPlugin->Plugin->FirstAccount;ActualAccount != nullptr;ActualAccount=ActualAccount->Next)
{
- if (ActualAccount->Plugin==NULL || ActualAccount->Plugin->Fcn==NULL) //account not inited
+ if (ActualAccount->Plugin==nullptr || ActualAccount->Plugin->Fcn==nullptr) //account not inited
continue;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read wait\n");
@@ -192,7 +192,7 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) ((ActualAccount->StatusFlags & YAMN_ACC_ST9) && (Status==ID_STATUS_OUTTOLUNCH))))
{
- if ((!ActualAccount->Interval && !ActualAccount->TimeLeft) || ActualAccount->Plugin->Fcn->TimeoutFcnPtr==NULL)
+ if ((!ActualAccount->Interval && !ActualAccount->TimeLeft) || ActualAccount->Plugin->Fcn->TimeoutFcnPtr==nullptr)
{
goto ChangeIsCountingStatusLabel;
}
@@ -206,11 +206,11 @@ void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) WindowList_BroadcastAsync(YAMNVar.MessageWnds, WM_YAMN_CHANGETIME, (WPARAM)ActualAccount, (LPARAM)ActualAccount->TimeLeft);
if (!ActualAccount->TimeLeft)
{
- struct CheckParam ParamToPlugin={YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_NORMALCHECK, (void *)0, NULL};
+ struct CheckParam ParamToPlugin={YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_NORMALCHECK, (void *)nullptr, nullptr};
ActualAccount->TimeLeft=ActualAccount->Interval;
- HANDLE NewThread = CreateThread(NULL, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->TimeoutFcnPtr, &ParamToPlugin, 0, &tid);
- if (NewThread == NULL)
+ HANDLE NewThread = CreateThread(nullptr, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->TimeoutFcnPtr, &ParamToPlugin, 0, &tid);
+ if (NewThread == nullptr)
{
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "TimerProc:ActualAccountSO-read done\n");
@@ -256,8 +256,8 @@ INT_PTR ForceCheckSvc(WPARAM, LPARAM) DWORD tid;
//we use event to signal, that running thread has all needed stack parameters copied
- HANDLE ThreadRunningEV = CreateEvent(NULL, FALSE, FALSE, NULL);
- if (ThreadRunningEV == NULL)
+ HANDLE ThreadRunningEV = CreateEvent(nullptr, FALSE, FALSE, nullptr);
+ if (ThreadRunningEV == nullptr)
return 0;
//if we want to close miranda, we get event and do not run pop3 checking anymore
if (WAIT_OBJECT_0 == WaitForSingleObject(ExitEV, 0))
@@ -265,7 +265,7 @@ INT_PTR ForceCheckSvc(WPARAM, LPARAM) {
mir_cslock lck(PluginRegCS);
- for (PYAMN_PROTOPLUGINQUEUE ActualPlugin = FirstProtoPlugin; ActualPlugin != NULL; ActualPlugin = ActualPlugin->Next) {
+ for (PYAMN_PROTOPLUGINQUEUE ActualPlugin = FirstProtoPlugin; ActualPlugin != nullptr; ActualPlugin = ActualPlugin->Next) {
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "ForceCheck:AccountBrowserSO-read wait\n");
#endif
@@ -273,8 +273,8 @@ INT_PTR ForceCheckSvc(WPARAM, LPARAM) #ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "ForceCheck:AccountBrowserSO-read enter\n");
#endif
- for (ActualAccount = ActualPlugin->Plugin->FirstAccount; ActualAccount != NULL; ActualAccount = ActualAccount->Next) {
- if (ActualAccount->Plugin->Fcn == NULL) //account not inited
+ for (ActualAccount = ActualPlugin->Plugin->FirstAccount; ActualAccount != nullptr; ActualAccount = ActualAccount->Next) {
+ if (ActualAccount->Plugin->Fcn == nullptr) //account not inited
continue;
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "ForceCheck:ActualAccountSO-read wait\n");
@@ -290,13 +290,13 @@ INT_PTR ForceCheckSvc(WPARAM, LPARAM) #endif
if ((ActualAccount->Flags & YAMN_ACC_ENA) && (ActualAccount->StatusFlags & YAMN_ACC_FORCE)) //account cannot be forced to check
{
- if (ActualAccount->Plugin->Fcn->ForceCheckFcnPtr == NULL) {
+ if (ActualAccount->Plugin->Fcn->ForceCheckFcnPtr == nullptr) {
ReadDoneFcn(ActualAccount->AccountAccessSO);
continue;
}
- struct CheckParam ParamToPlugin = { YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_FORCECHECK, (void *)0, NULL };
+ struct CheckParam ParamToPlugin = { YAMN_CHECKVERSION, ThreadRunningEV, ActualAccount, YAMN_FORCECHECK, (void *)nullptr, nullptr };
- if (NULL == CreateThread(NULL, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr, &ParamToPlugin, 0, &tid)) {
+ if (nullptr == CreateThread(nullptr, 0, (YAMN_STANDARDFCN)ActualAccount->Plugin->Fcn->ForceCheckFcnPtr, &ParamToPlugin, 0, &tid)) {
ReadDoneFcn(ActualAccount->AccountAccessSO);
continue;
}
|