summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/BasicHistory/res/history.js12
-rw-r--r--plugins/BasicHistory/src/BasicHistory.cpp18
-rw-r--r--plugins/BasicHistory/src/BinaryExport.cpp46
-rw-r--r--plugins/BasicHistory/src/DatExport.cpp24
-rw-r--r--plugins/BasicHistory/src/EventList.cpp148
-rw-r--r--plugins/BasicHistory/src/EventList.h8
-rw-r--r--plugins/BasicHistory/src/ExportManager.cpp62
-rw-r--r--plugins/BasicHistory/src/HistoryWindow.cpp533
-rw-r--r--plugins/BasicHistory/src/HotkeyHelper.cpp8
-rw-r--r--plugins/BasicHistory/src/Options.cpp262
-rw-r--r--plugins/BasicHistory/src/Options.h2
-rw-r--r--plugins/BasicHistory/src/PlainHtmlExport.cpp6
-rw-r--r--plugins/BasicHistory/src/RichHtmlExport.cpp60
-rw-r--r--plugins/BasicHistory/src/Scheduler.cpp340
-rw-r--r--plugins/BasicHistory/src/Searcher.cpp88
-rw-r--r--plugins/BasicHistory/src/Searcher.h12
-rw-r--r--plugins/BasicHistory/src/TxtExport.cpp4
-rw-r--r--plugins/BasicHistory/src/codecvt_CodePage.h4
18 files changed, 791 insertions, 846 deletions
diff --git a/plugins/BasicHistory/res/history.js b/plugins/BasicHistory/res/history.js
index 4d2156ac24..2a74313492 100644
--- a/plugins/BasicHistory/res/history.js
+++ b/plugins/BasicHistory/res/history.js
@@ -38,11 +38,11 @@ var timer;
function ShowMenu(isShow)
{
- if(timer)
+ if (timer)
clearTimeout(timer);
var menu = document.getElementById("L1");
- if(isShow == 1)
+ if (isShow == 1)
menu.style.visibility = "visible";
else
menu.style.visibility = "hidden";
@@ -59,13 +59,13 @@ function OpenAll(isOpen)
while(gr = document.getElementById("group" + idMod))
{
var imageNode = gr.previousSibling;
- if(imageNode.tagName == null)
+ if (imageNode.tagName == null)
imageNode = imageNode.previousSibling;
imageNode = imageNode.getElementsByTagName("span")[0].getElementsByTagName("img")[0];
var l = imageNode.src.length;
- if(gr.style.display == "block")
+ if (gr.style.display == "block")
{
- if(!isOpen)
+ if (!isOpen)
{
if (imageNode != null)
{
@@ -77,7 +77,7 @@ function OpenAll(isOpen)
gr.style.display = "none";
}
}
- else if(isOpen)
+ else if (isOpen)
{
if (imageNode != null)
{
diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp
index c8ee22d2b8..12a75bb37a 100644
--- a/plugins/BasicHistory/src/BasicHistory.cpp
+++ b/plugins/BasicHistory/src/BasicHistory.cpp
@@ -119,9 +119,9 @@ void InitMenuItems()
void InitTaskMenuItems()
{
- if(Options::instance->taskOptions.size() > 0) {
+ if (Options::instance->taskOptions.size() > 0) {
CLISTMENUITEM mi = { sizeof(mi) };
- if(hTaskMainMenu == NULL) {
+ if (hTaskMainMenu == NULL) {
mi.position = 500060005;
mi.flags = CMIF_ROOTPOPUP;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_HISTORY);
@@ -164,7 +164,7 @@ void InitTaskMenuItems()
taskMenus.push_back(menu);
}
}
- else if(hTaskMainMenu != NULL)
+ else if (hTaskMainMenu != NULL)
{
CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIM_FLAGS | CMIF_ROOTPOPUP | CMIF_HIDDEN;
@@ -223,18 +223,18 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
InitMenuItems();
TCHAR ftpExe[MAX_PATH];
- if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, ftpExe)))
+ if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, ftpExe)))
{
_tcscat_s(ftpExe, _T("\\WinSCP\\WinSCP.exe"));
DWORD atr = GetFileAttributes(ftpExe);
- if(atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY)
+ if (atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY)
{
#ifdef _WIN64
- if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILESX86, NULL, SHGFP_TYPE_CURRENT, ftpExe)))
+ if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILESX86, NULL, SHGFP_TYPE_CURRENT, ftpExe)))
{
_tcscat_s(ftpExe, _T("\\WinSCP\\WinSCP.exe"));
atr = GetFileAttributes(ftpExe);
- if(!(atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY))
+ if (!(atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY))
{
Options::instance->ftpExePathDef = ftpExe;
}
@@ -310,14 +310,14 @@ extern "C" int __declspec(dllexport) Unload(void)
EventList::Deinit();
- if(Options::instance != NULL)
+ if (Options::instance != NULL)
{
Options::instance->Unload();
delete Options::instance;
Options::instance = NULL;
}
- if(hEventIcons != NULL)
+ if (hEventIcons != NULL)
{
delete [] hEventIcons;
}
diff --git a/plugins/BasicHistory/src/BinaryExport.cpp b/plugins/BasicHistory/src/BinaryExport.cpp
index f57343cff0..76239cb098 100644
--- a/plugins/BasicHistory/src/BinaryExport.cpp
+++ b/plugins/BasicHistory/src/BinaryExport.cpp
@@ -68,25 +68,25 @@ bool BinaryExport::ReadString(std::wstring &str)
while(1)
{
buf.resize(size);
- if(IMP_FILE.peek() == 0)
+ if (IMP_FILE.peek() == 0)
{
IMP_FILE.get();
break;
}
IMP_FILE.get(((char*)buf.c_str()) + pos, size - pos, 0);
- if(!IMP_FILE.good())
+ if (!IMP_FILE.good())
return false;
int readed = IMP_FILE.gcount();
totalSize += readed;
char end;
IMP_FILE.get(end);
- if(!IMP_FILE.good())
+ if (!IMP_FILE.good())
return false;
- if(end == 0)
+ if (end == 0)
break;
- if(size - pos - 1 != readed)
+ if (size - pos - 1 != readed)
return false;
buf[size - 1] = end;
++totalSize;
@@ -94,7 +94,7 @@ bool BinaryExport::ReadString(std::wstring &str)
pos += 1024;
}
- if(totalSize == 0)
+ if (totalSize == 0)
return true;
int sizeW = MultiByteToWideChar(codepage, 0, (char*)buf.c_str(), totalSize, NULL, 0);
str.resize(sizeW);
@@ -133,7 +133,7 @@ void BinaryExport::WriteGroup(bool isMe, const std::wstring &time, const std::ws
void BinaryExport::WriteMessage(bool isMe, const std::wstring &longDate, const std::wstring &shortDate, const std::wstring &user, const std::wstring &message, const DBEVENTINFO& dbei)
{
- if(dbei.timestamp >= lTime)
+ if (dbei.timestamp >= lTime)
{
BinaryFileMessageHeader header;
header.eventType = dbei.eventType;
@@ -148,11 +148,11 @@ void BinaryExport::WriteMessage(bool isMe, const std::wstring &longDate, const s
bool ReadHeader(BinaryFileHeader& header, std::istream* stream)
{
stream->read((char*)&header, sizeof(BinaryFileHeader));
- if(!stream->good())
+ if (!stream->good())
return false;
- if(memcmp(header.signature, "BHBF", 4) != 0)
+ if (memcmp(header.signature, "BHBF", 4) != 0)
return false;
- if(header.version != 0 || header.codepage == 12000 || header.codepage == 12001)
+ if (header.version != 0 || header.codepage == 12000 || header.codepage == 12001)
return false;
return true;
@@ -161,7 +161,7 @@ bool ReadHeader(BinaryFileHeader& header, std::istream* stream)
int BinaryExport::IsContactInFile(const std::vector<HANDLE>& contacts)
{
BinaryFileHeader header;
- if(!ReadHeader(header, IImport::stream))
+ if (!ReadHeader(header, IImport::stream))
return -2;
codepage = header.codepage;
std::wstring filterName;
@@ -170,21 +170,21 @@ int BinaryExport::IsContactInFile(const std::vector<HANDLE>& contacts)
std::wstring name1;
std::wstring proto1;
std::wstring id1;
- if(!ReadString(filterName))
+ if (!ReadString(filterName))
return -2;
- if(!ReadString(myName))
+ if (!ReadString(myName))
return -2;
- if(!ReadString(myId))
+ if (!ReadString(myId))
return -2;
- if(!ReadString(name1))
+ if (!ReadString(name1))
return -2;
- if(!ReadString(proto1))
+ if (!ReadString(proto1))
return -2;
- if(!ReadString(id1))
+ if (!ReadString(id1))
return -2;
size_t pos = IMP_FILE.tellg();
- if(header.dataStart < pos)
+ if (header.dataStart < pos)
return -2;
IMP_FILE.seekg(0, std::ios_base::beg);
@@ -192,7 +192,7 @@ int BinaryExport::IsContactInFile(const std::vector<HANDLE>& contacts)
{
std::wstring pn = GetProtocolName(contacts[i]);
std::wstring id = GetContactId(contacts[i]);
- if(pn == proto1 && id == id1)
+ if (pn == proto1 && id == id1)
{
return i;
}
@@ -204,7 +204,7 @@ int BinaryExport::IsContactInFile(const std::vector<HANDLE>& contacts)
bool BinaryExport::GetEventList(std::vector<IImport::ExternalMessage>& eventList)
{
BinaryFileHeader header;
- if(!ReadHeader(header, IImport::stream))
+ if (!ReadHeader(header, IImport::stream))
return false;
codepage = header.codepage;
IMP_FILE.seekg(header.dataStart, std::ios_base::beg);
@@ -212,16 +212,16 @@ bool BinaryExport::GetEventList(std::vector<IImport::ExternalMessage>& eventList
while(1)
{
IMP_FILE.read((char*)&messageHeader, sizeof(BinaryFileMessageHeader));
- if(IMP_FILE.eof())
+ if (IMP_FILE.eof())
break;
- if(!IMP_FILE.good())
+ if (!IMP_FILE.good())
return false;
IImport::ExternalMessage exMsg;
exMsg.eventType = messageHeader.eventType;
exMsg.flags = messageHeader.flags;
exMsg.timestamp = messageHeader.timestamp;
- if(!ReadString(exMsg.message))
+ if (!ReadString(exMsg.message))
return false;
eventList.push_back(exMsg);
diff --git a/plugins/BasicHistory/src/DatExport.cpp b/plugins/BasicHistory/src/DatExport.cpp
index 06ec796904..7518567a71 100644
--- a/plugins/BasicHistory/src/DatExport.cpp
+++ b/plugins/BasicHistory/src/DatExport.cpp
@@ -59,7 +59,7 @@ DatExport::~DatExport()
int DatExport::WriteString(const std::wstring &str)
{
int conv = WideCharToMultiByte(CP_UTF8, 0, str.c_str(), (int)str.length() + 1, NULL, 0, NULL, NULL);
- if(conv > (int)memBuf.size())
+ if (conv > (int)memBuf.size())
{
memBuf.resize(conv);
}
@@ -102,7 +102,7 @@ void DatExport::WriteMessage(bool isMe, const std::wstring &longDate, const std:
header.timestamp = dbei.timestamp;
header.szModule = 0;
header.pBlob = 0;
- if(dbei.flags & 0x800)
+ if (dbei.flags & 0x800)
{
//Imported
header.flags |= DBEF_UTF;
@@ -124,9 +124,9 @@ void DatExport::WriteMessage(bool isMe, const std::wstring &longDate, const std:
bool ReadHeader(MCHeader& header, std::istream* stream)
{
stream->read((char*)&header, sizeof(MCHeader));
- if(!stream->good())
+ if (!stream->good())
return false;
- if(memcmp(header.signature, "HB", 2) != 0)
+ if (memcmp(header.signature, "HB", 2) != 0)
return false;
return true;
@@ -135,10 +135,10 @@ bool ReadHeader(MCHeader& header, std::istream* stream)
int DatExport::IsContactInFile(const std::vector<HANDLE>& contacts)
{
MCHeader header;
- if(!ReadHeader(header, IImport::stream))
+ if (!ReadHeader(header, IImport::stream))
return -2;
- if(contacts.size() == 1)
+ if (contacts.size() == 1)
{
hContact = contacts[0];
}
@@ -150,7 +150,7 @@ int DatExport::IsContactInFile(const std::vector<HANDLE>& contacts)
bool DatExport::GetEventList(std::vector<IImport::ExternalMessage>& eventList)
{
MCHeader header;
- if(!ReadHeader(header, IImport::stream))
+ if (!ReadHeader(header, IImport::stream))
return false;
dataSize = header.dataSize;
DBEVENTINFO86 messageHeader;
@@ -163,13 +163,13 @@ bool DatExport::GetEventList(std::vector<IImport::ExternalMessage>& eventList)
{
messageHeader.cbSize = 0;
IMP_FILE.read((char*)&messageHeader, sizeof(DBEVENTINFO86));
- if(!IMP_FILE.good())
+ if (!IMP_FILE.good())
return false;
- if(messageHeader.cbSize < sizeof(DBEVENTINFO86))
+ if (messageHeader.cbSize < sizeof(DBEVENTINFO86))
return false;
- if(messageHeader.cbSize > sizeof(DBEVENTINFO86))
+ if (messageHeader.cbSize > sizeof(DBEVENTINFO86))
{
IMP_FILE.seekg(messageHeader.cbSize - sizeof(DBEVENTINFO86), std::ios_base::cur);
}
@@ -178,13 +178,13 @@ bool DatExport::GetEventList(std::vector<IImport::ExternalMessage>& eventList)
exMsg.eventType = messageHeader.eventType;
exMsg.flags = messageHeader.flags;
exMsg.timestamp = messageHeader.timestamp;
- if(messageHeader.cbBlob > memBuf.size())
+ if (messageHeader.cbBlob > memBuf.size())
{
memBuf.resize(messageHeader.cbBlob);
}
IMP_FILE.read((char*)memBuf.c_str(), messageHeader.cbBlob);
- if(!IMP_FILE.good())
+ if (!IMP_FILE.good())
return false;
info.eventType = messageHeader.eventType;
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp
index 0b6c983a06..b72eeaa144 100644
--- a/plugins/BasicHistory/src/EventList.cpp
+++ b/plugins/BasicHistory/src/EventList.cpp
@@ -63,24 +63,24 @@ EventList::~EventList()
bool EventList::CanShowHistory(DBEVENTINFO* dbei)
{
- if(deltaTime != 0)
+ if (deltaTime != 0)
{
- if(deltaTime > 0)
+ if (deltaTime > 0)
{
- if(now - deltaTime < dbei->timestamp)
+ if (now - deltaTime < dbei->timestamp)
return false;
}
else
{
- if(now + deltaTime > dbei->timestamp)
+ if (now + deltaTime > dbei->timestamp)
return false;
}
}
- if(hContact == NULL || defFilter == 1)
+ if (hContact == NULL || defFilter == 1)
return true;
- else if(defFilter < 1)
+ else if (defFilter < 1)
{
switch( dbei->eventType )
{
@@ -103,13 +103,13 @@ bool EventList::CanShowHistory(DBEVENTINFO* dbei)
}
else
{
- if(filterMap.find(dbei->eventType) != filterMap.end())
+ if (filterMap.find(dbei->eventType) != filterMap.end())
{
- if(onlyInFilter)
+ if (onlyInFilter)
{
return !(dbei->flags & DBEF_SENT);
}
- else if(onlyOutFilter)
+ else if (onlyOutFilter)
{
return (dbei->flags & DBEF_SENT) != 0;
}
@@ -121,24 +121,24 @@ bool EventList::CanShowHistory(DBEVENTINFO* dbei)
bool EventList::CanShowHistory(const IImport::ExternalMessage& message)
{
- if(deltaTime != 0)
+ if (deltaTime != 0)
{
- if(deltaTime > 0)
+ if (deltaTime > 0)
{
- if(now - deltaTime < message.timestamp)
+ if (now - deltaTime < message.timestamp)
return false;
}
else
{
- if(now + deltaTime > message.timestamp)
+ if (now + deltaTime > message.timestamp)
return false;
}
}
- if(hContact == NULL || defFilter == 1)
+ if (hContact == NULL || defFilter == 1)
return true;
- else if(defFilter < 1)
+ else if (defFilter < 1)
{
switch(message.eventType )
{
@@ -152,13 +152,13 @@ bool EventList::CanShowHistory(const IImport::ExternalMessage& message)
}
else
{
- if(filterMap.find(message.eventType) != filterMap.end())
+ if (filterMap.find(message.eventType) != filterMap.end())
{
- if(onlyInFilter)
+ if (onlyInFilter)
{
return !(message.flags & DBEF_SENT);
}
- else if(onlyOutFilter)
+ else if (onlyOutFilter)
{
return (message.flags & DBEF_SENT) != 0;
}
@@ -173,19 +173,19 @@ void EventList::InitFilters()
filterMap.clear();
onlyInFilter = false;
onlyOutFilter = false;
- if(defFilter >= 2)
+ if (defFilter >= 2)
{
defFilter = 0;
for(int i = 0; i < (int)Options::instance->customFilters.size(); ++i)
{
- if(filterName == Options::instance->customFilters[i].name)
+ if (filterName == Options::instance->customFilters[i].name)
{
defFilter = i + 2;
- if(Options::instance->customFilters[i].onlyIncomming && !Options::instance->customFilters[i].onlyOutgoing)
+ if (Options::instance->customFilters[i].onlyIncomming && !Options::instance->customFilters[i].onlyOutgoing)
{
onlyInFilter = true;
}
- else if(Options::instance->customFilters[i].onlyOutgoing && !Options::instance->customFilters[i].onlyIncomming)
+ else if (Options::instance->customFilters[i].onlyOutgoing && !Options::instance->customFilters[i].onlyIncomming)
{
onlyOutFilter = true;
}
@@ -206,11 +206,11 @@ void EventList::InitFilters()
void EventList::SetDefFilter(int filter)
{
defFilter = filter;
- if(filter >= 2 && filter - 2 < (int)Options::instance->customFilters.size())
+ if (filter >= 2 && filter - 2 < (int)Options::instance->customFilters.size())
{
filterName = Options::instance->customFilters[filter - 2].name;
}
- else if(filter == 1)
+ else if (filter == 1)
{
filterName = TranslateT("All events");
}
@@ -244,9 +244,9 @@ void EventList::GetTempList(std::list<EventTempIndex>& tempList, bool noFilter,
if (isWndLocal && !IsWindow( hWnd ))
break;
ei.hEvent = hDbEvent;
- if(GetEventData(ei, data))
+ if (GetEventData(ei, data))
{
- if(noFilter || CanShowHistory(&gdbei))
+ if (noFilter || CanShowHistory(&gdbei))
{
ti.hEvent = hDbEvent;
ti.timestamp = data.timestamp;
@@ -256,17 +256,17 @@ void EventList::GetTempList(std::list<EventTempIndex>& tempList, bool noFilter,
hDbEvent = db_event_next(hDbEvent);
}
- if(!noExt)
+ if (!noExt)
{
std::list<EventTempIndex>::iterator itL = tempList.begin();
ti.isExternal = true;
for(int i = 0; i < (int)importedMessages.size(); ++i)
{
- if(noFilter || CanShowHistory(importedMessages[i]))
+ if (noFilter || CanShowHistory(importedMessages[i]))
{
DWORD ts = importedMessages[i].timestamp;
while(itL != tempList.end() && itL->timestamp < ts)++itL;
- if(itL == tempList.end() || itL->timestamp > ts)
+ if (itL == tempList.end() || itL->timestamp > ts)
{
ti.exIdx = i;
ti.timestamp = ts;
@@ -282,17 +282,17 @@ void EventList::RefreshEventList()
InitNames();
InitFilters();
- if(useImportedMessages)
+ if (useImportedMessages)
{
std::vector<IImport::ExternalMessage> messages;
EnterCriticalSection(&criticalSection);
std::map<HANDLE, EventList::ImportDiscData>::iterator it = contactFileMap.find(hContact);
- if(it != contactFileMap.end())
+ if (it != contactFileMap.end())
{
ExportManager imp(hWnd, hContact, 1);
imp.SetAutoImport(it->second.file);
- if(!imp.Import(it->second.type, messages, NULL))
+ if (!imp.Import(it->second.type, messages, NULL))
{
messages.clear();
}
@@ -308,7 +308,7 @@ void EventList::RefreshEventList()
std::list<EventTempIndex> revTempList;
std::list<EventTempIndex>& nrTempList = tempList;
bool isNewOnTop = Options::instance->groupNewOnTop;
- if(isNewOnTop)
+ if (isNewOnTop)
{
revTempList.insert(revTempList.begin(), tempList.rbegin(), tempList.rend());
nrTempList = revTempList;
@@ -324,12 +324,12 @@ void EventList::RefreshEventList()
for(std::list<EventTempIndex>::iterator itL = nrTempList.begin(); itL != nrTempList.end(); ++itL)
{
DWORD tm = isNewOnTop ? lastTime - itL->timestamp : itL->timestamp - lastTime;
- if(isFlat || tm < groupTime && limitator < maxMess)
+ if (isFlat || tm < groupTime && limitator < maxMess)
{
lastTime = itL->timestamp;
ei.isExternal = itL->isExternal;
ei.hEvent = itL->hEvent;
- if(isNewOnTop)
+ if (isNewOnTop)
eventList.back().push_front(ei);
else
eventList.back().push_back(ei);
@@ -339,7 +339,7 @@ void EventList::RefreshEventList()
{
limitator = 0;
lastTime = itL->timestamp;
- if(!eventList.back().empty())
+ if (!eventList.back().empty())
{
ei = eventList.back().front();
AddGroup(ei);
@@ -351,7 +351,7 @@ void EventList::RefreshEventList()
}
}
- if(!eventList.back().empty())
+ if (!eventList.back().empty())
{
ei = eventList.back().front();
AddGroup(ei);
@@ -362,17 +362,17 @@ bool EventList::SearchInContact(HANDLE hContact, TCHAR *strFind, ComparatorInter
{
InitFilters();
- if(useImportedMessages)
+ if (useImportedMessages)
{
std::vector<IImport::ExternalMessage> messages;
EnterCriticalSection(&criticalSection);
std::map<HANDLE, EventList::ImportDiscData>::iterator it = contactFileMap.find(hContact);
- if(it != contactFileMap.end())
+ if (it != contactFileMap.end())
{
ExportManager imp(hWnd, hContact, 1);
imp.SetAutoImport(it->second.file);
- if(!imp.Import(it->second.type, messages, NULL))
+ if (!imp.Import(it->second.type, messages, NULL))
{
messages.clear();
}
@@ -381,7 +381,7 @@ bool EventList::SearchInContact(HANDLE hContact, TCHAR *strFind, ComparatorInter
LeaveCriticalSection(&criticalSection);
for(int i = 0; i < (int)importedMessages.size(); ++i)
{
- if(compFun->Compare((importedMessages[i].flags & DBEF_SENT) != 0, importedMessages[i].message, strFind))
+ if (compFun->Compare((importedMessages[i].flags & DBEF_SENT) != 0, importedMessages[i].message, strFind))
{
return true;
}
@@ -398,10 +398,10 @@ bool EventList::SearchInContact(HANDLE hContact, TCHAR *strFind, ComparatorInter
{
ei.isExternal = itL->isExternal;
ei.hEvent = itL->hEvent;
- if(GetEventData(ei, ed))
+ if (GetEventData(ei, ed))
{
GetEventMessage(ei, str);
- if(compFun->Compare(ed.isMe, str, strFind))
+ if (compFun->Compare(ed.isMe, str, strFind))
{
return true;
}
@@ -414,7 +414,7 @@ bool EventList::SearchInContact(HANDLE hContact, TCHAR *strFind, ComparatorInter
void EventList::InitNames()
{
TCHAR str[200];
- if(hContact)
+ if (hContact)
{
_tcscpy_s(contactName, 256, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR ));
mir_sntprintf(str,200,TranslateT("History for %s"),contactName);
@@ -425,7 +425,7 @@ void EventList::InitNames()
mir_sntprintf(str,200,TranslateT("History"));
}
- if(isWnd)
+ if (isWnd)
{
SetWindowText(hWnd,str);
}
@@ -443,14 +443,14 @@ void EventList::AddGroup(const EventIndex& ev)
tmi.printTimeStamp(NULL, data.timestamp, _T("d t"), eventText, 64, 0);
std::wstring time = eventText;
std::wstring user;
- if(data.isMe)
+ if (data.isMe)
user = myName;
else
user = contactName;
GetEventMessage(ev, eventText, 256);
for(i = 0; eventText[i] != 0 && eventText[i] != _T('\r') && eventText[i] != _T('\n'); ++i);
eventText[i] = 0;
- if(i > Options::instance->groupMessageLen)
+ if (i > Options::instance->groupMessageLen)
{
eventText[Options::instance->groupMessageLen - 3] = '.';
eventText[Options::instance->groupMessageLen - 2] = '.';
@@ -465,7 +465,7 @@ void EventList::AddGroup(const EventIndex& ev)
std::wstring EventList::GetContactName()
{
- if(hContact)
+ if (hContact)
{
return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, GCDNF_TCHAR );
}
@@ -510,7 +510,7 @@ std::wstring EventList::GetMyName()
ci.hContact = 0;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
GetInfo(ci, myName);
- if(myName.empty())
+ if (myName.empty())
{
return TranslateT("Me");
}
@@ -522,10 +522,10 @@ inline std::wstring GetProtocolName(HANDLE hContact)
{
char* ac = (char *)CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM)hContact, 0);
std::wstring proto1;
- if(ac != NULL)
+ if (ac != NULL)
{
PROTOACCOUNT* acnt = ProtoGetAccount(ac);
- if(acnt != NULL && acnt->szModuleName != NULL)
+ if (acnt != NULL && acnt->szModuleName != NULL)
{
wchar_t* proto = mir_a2u(acnt->szProtoName);
proto1 = proto;
@@ -591,7 +591,7 @@ static void GetAuthRequestDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf
std::wstring allName;
buf[0] = 0;
size_t pos = sizeof(DWORD)*2;
- if(pos >= dbei->cbBlob)
+ if (pos >= dbei->cbBlob)
return;
PDWORD evDwords = (PDWORD)dbei->pBlob;
@@ -600,23 +600,23 @@ static void GetAuthRequestDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf
char* nick, *firstName, *lastName, *jid, *reason;
nick = (char*)&evDwords[2];
pos += strnlen_s(nick, dbei->cbBlob - pos) + 1;
- if(pos >= dbei->cbBlob)
+ if (pos >= dbei->cbBlob)
return;
firstName = ( char* )dbei->pBlob + pos;
pos += strnlen_s(firstName, dbei->cbBlob - pos) + 1;
- if(pos >= dbei->cbBlob)
+ if (pos >= dbei->cbBlob)
return;
lastName = ( char* )dbei->pBlob + pos;
pos += strnlen_s(lastName, dbei->cbBlob - pos) + 1;
- if(pos >= dbei->cbBlob)
+ if (pos >= dbei->cbBlob)
return;
jid = (char*)dbei->pBlob + pos;
pos += strnlen_s(jid, dbei->cbBlob - pos) + 1;
- if(pos >= dbei->cbBlob)
+ if (pos >= dbei->cbBlob)
return;
reason = (char*)dbei->pBlob + pos;
TCHAR *newNick, *newFirstName, *newLastName, *newJid, *newReason;
- if(dbei->flags & DBEF_UTF)
+ if (dbei->flags & DBEF_UTF)
{
newNick = mir_utf8decodeT( nick );
newFirstName = mir_utf8decodeT( firstName );
@@ -633,18 +633,18 @@ static void GetAuthRequestDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf
newReason = mir_a2t( reason );
}
- if(newFirstName[0] != 0)
+ if (newFirstName[0] != 0)
{
allName += newFirstName;
- if(newLastName[0] != 0)
+ if (newLastName[0] != 0)
allName += _T(" ");
}
- if(newLastName[0] != 0)
+ if (newLastName[0] != 0)
allName += newLastName;
- if(!allName.empty())
+ if (!allName.empty())
allName += _T(", ");
- if(newJid[0] != 0)
+ if (newJid[0] != 0)
{
allName += newJid;
allName += _T(", ");
@@ -703,7 +703,7 @@ void EventList::ImportMessages(const std::vector<IImport::ExternalMessage>& mess
importedMessages.clear();
for(int i = 0; i < (int)messages.size(); ++i)
{
- if(messages[i].timestamp >= lastTime)
+ if (messages[i].timestamp >= lastTime)
{
importedMessages.push_back(messages[i]);
lastTime = messages[i].timestamp;
@@ -726,7 +726,7 @@ void EventList::MargeMessages(const std::vector<IImport::ExternalMessage>& messa
CallService(MS_DB_SETSAFETYMODE, (WPARAM)FALSE, 0);
for(std::list<EventTempIndex>::iterator it = tempList.begin(); it != tempList.end(); ++it) {
- if(it->isExternal) {
+ if (it->isExternal) {
IImport::ExternalMessage& msg = importedMessages[it->exIdx];
dbei.flags = msg.flags & (~(DBEF_FIRST));
dbei.flags |= DBEF_READ;
@@ -750,9 +750,9 @@ void EventList::MargeMessages(const std::vector<IImport::ExternalMessage>& messa
bool EventList::GetEventData(const EventIndex& ev, EventData& data)
{
- if(!ev.isExternal) {
- int newBlobSize = db_event_getBlobSize(ev.hEvent);
- if(newBlobSize > goldBlobSize) {
+ if (!ev.isExternal) {
+ DWORD newBlobSize = db_event_getBlobSize(ev.hEvent);
+ if (newBlobSize > goldBlobSize) {
gdbei.pBlob = (PBYTE)mir_realloc(gdbei.pBlob,newBlobSize);
goldBlobSize = newBlobSize;
}
@@ -765,7 +765,7 @@ bool EventList::GetEventData(const EventIndex& ev, EventData& data)
return true;
}
}
- else if(ev.exIdx >= 0 && ev.exIdx < (int)importedMessages.size()) {
+ else if (ev.exIdx >= 0 && ev.exIdx < (int)importedMessages.size()) {
IImport::ExternalMessage& em = importedMessages[ev.exIdx];
data.isMe = (em.flags & DBEF_SENT) != 0;
data.eventType = em.eventType;
@@ -786,12 +786,12 @@ void EventList::GetExtEventDBei(const EventIndex& ev)
HICON EventList::GetEventCoreIcon(const EventIndex& ev)
{
- if(ev.isExternal)
+ if (ev.isExternal)
return NULL;
HICON ico;
ico = (HICON)CallService(MS_DB_EVENT_GETICON, LR_SHARED, (LPARAM)&gdbei);
HICON icoMsg = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
- if(icoMsg == ico)
+ if (icoMsg == ico)
{
return NULL;
}
@@ -805,7 +805,7 @@ void EventList::RebuildGroup(int selected)
for(size_t i = 0; i < eventList[selected].size(); ++i)
{
EventIndex& ev = eventList[selected][i];
- if(!ev.isExternal) {
+ if (!ev.isExternal) {
// If event exist, we add it to new group
if (db_event_getBlobSize(ev.hEvent) >= 0)
newGroup.push_back(eventList[selected][i]);
@@ -856,7 +856,7 @@ int EventList::GetContactMessageNumber(HANDLE hContact)
int count = db_event_count(hContact);
EnterCriticalSection(&criticalSection);
std::map<HANDLE, EventList::ImportDiscData>::iterator it = contactFileMap.find(hContact);
- if(it != contactFileMap.end())
+ if (it != contactFileMap.end())
++count;
LeaveCriticalSection(&criticalSection);
@@ -868,7 +868,7 @@ bool EventList::IsImportedHistory(HANDLE hContact)
bool count = false;
EnterCriticalSection(&criticalSection);
std::map<HANDLE, EventList::ImportDiscData>::iterator it = contactFileMap.find(hContact);
- if(it != contactFileMap.end())
+ if (it != contactFileMap.end())
{
count = true;
}
@@ -881,7 +881,7 @@ void EventList::DeleteImporter(HANDLE hContact)
{
EnterCriticalSection(&criticalSection);
std::map<HANDLE, EventList::ImportDiscData>::iterator it = contactFileMap.find(hContact);
- if(it != contactFileMap.end())
+ if (it != contactFileMap.end())
{
DeleteFile(it->second.file.c_str());
contactFileMap.erase(it);
diff --git a/plugins/BasicHistory/src/EventList.h b/plugins/BasicHistory/src/EventList.h
index cfb76e4779..a32ff92b9c 100644
--- a/plugins/BasicHistory/src/EventList.h
+++ b/plugins/BasicHistory/src/EventList.h
@@ -95,7 +95,7 @@ protected:
bool GetEventIcon(bool isMe, int eventType, int &id);
void DeleteEvent(const EventIndex& ev)
{
- if(!ev.isExternal)
+ if (!ev.isExternal)
db_event_delete(hContact, ev.hEvent);
}
@@ -134,19 +134,19 @@ public:
HICON GetEventCoreIcon(const EventIndex& ev);
void GetEventMessage(const EventIndex& ev, TCHAR* message) // must be allocated with MAXSELECTSTR len
{
- if(!ev.isExternal)
+ if (!ev.isExternal)
GetObjectDescription(&gdbei, message, MAXSELECTSTR);
else
_tcscpy_s(message, MAXSELECTSTR, importedMessages[ev.exIdx].message.c_str());
}
void GetEventMessage(const EventIndex& ev, TCHAR* message, int strLen)
{
- if(!ev.isExternal)
+ if (!ev.isExternal)
GetObjectDescription(&gdbei, message, strLen);
else
{
std::wstring& meg = importedMessages[ev.exIdx].message;
- if((int)meg.size() >= strLen)
+ if ((int)meg.size() >= strLen)
{
memcpy_s(message, strLen * sizeof(TCHAR), meg.c_str(), (strLen - 1) * sizeof(TCHAR));
message[strLen - 1] = 0;
diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp
index c5c01b4ac2..f7cb30b8dd 100644
--- a/plugins/BasicHistory/src/ExportManager.cpp
+++ b/plugins/BasicHistory/src/ExportManager.cpp
@@ -60,10 +60,10 @@ std::wstring GetFile(const TCHAR* ext, HWND hwnd, bool open)
ofn.lpstrTitle = open ? TranslateT("Import") : TranslateT("Export");
ofn.nMaxFile = 1024;
ofn.lpstrDefExt = ext;
- if(open)
+ if (open)
{
ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- if(GetOpenFileName(&ofn))
+ if (GetOpenFileName(&ofn))
{
return stzFilePath;
}
@@ -71,7 +71,7 @@ std::wstring GetFile(const TCHAR* ext, HWND hwnd, bool open)
else
{
ofn.Flags = OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR;
- if(GetSaveFileName(&ofn))
+ if (GetSaveFileName(&ofn))
{
return stzFilePath;
}
@@ -83,7 +83,7 @@ std::wstring GetFile(const TCHAR* ext, HWND hwnd, bool open)
std::wstring ReplaceExt(const std::wstring& file, const TCHAR* ext)
{
size_t pos = file.find(_T("<ext>"));
- if(pos < file.length())
+ if (pos < file.length())
{
std::wstring fileName = file.substr(0, pos);
fileName += ext;
@@ -139,21 +139,21 @@ bool ExportManager::Export(IExport::ExportType type)
}
std::wstring fileName;
- if(file.empty())
+ if (file.empty())
fileName = GetFile(exp->GetExt(), hwnd, false);
else
{
fileName = ReplaceExt(file, exp->GetExt());
}
- if(fileName.empty())
+ if (fileName.empty())
return false;
std::wofstream* stream;
- if(!isBin)
+ if (!isBin)
{
stream = new std::wofstream (fileName.c_str());
- if(!stream->is_open())
+ if (!stream->is_open())
return false;
std::locale filelocale(std::locale(), new codecvt_CodePage<wchar_t>(cp));
@@ -163,7 +163,7 @@ bool ExportManager::Export(IExport::ExportType type)
else
{
std::ofstream* cstream = new std::ofstream (fileName.c_str(), std::ios_base::binary);
- if(!cstream->is_open())
+ if (!cstream->is_open())
return false;
stream = (std::wofstream*)cstream;
@@ -175,7 +175,7 @@ bool ExportManager::Export(IExport::ExportType type)
RefreshEventList();
exp->WriteFooter();
- if(!isBin)
+ if (!isBin)
{
stream->close();
delete stream;
@@ -227,18 +227,18 @@ int ExportManager::Import(IImport::ImportType type, const std::vector<HANDLE>& c
}
std::wstring fileName;
- if(file.empty())
+ if (file.empty())
return -2;
else
{
fileName = ReplaceExt(file, imp->GetExt());
}
- if(fileName.empty())
+ if (fileName.empty())
return -2;
std::ifstream* stream = new std::ifstream (fileName.c_str(), std::ios_base::binary);
- if(!stream->is_open())
+ if (!stream->is_open())
return -2;
imp->SetStream(stream);
@@ -265,7 +265,7 @@ bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::Extern
}
std::wstring fileName;
- if(file.empty())
+ if (file.empty())
file = fileName = GetFile(imp->GetExt(), hwnd, true);
else
{
@@ -273,7 +273,7 @@ bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::Extern
}
std::ifstream* stream = new std::ifstream (fileName.c_str(), std::ios_base::binary);
- if(!stream->is_open())
+ if (!stream->is_open())
return false;
imp->SetStream(stream);
@@ -281,31 +281,31 @@ bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::Extern
v.push_back(hContact);
bool ret = true;
int contInFile = imp->IsContactInFile(v);
- if(contInFile == -1)
+ if (contInFile == -1)
{
ret = false;
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("File do not contain selected contact");
- if(contacts != NULL && differentContact != NULL)
+ if (contacts != NULL && differentContact != NULL)
{
contInFile = imp->IsContactInFile(*contacts);
- if(contInFile >= 0)
+ if (contInFile >= 0)
{
*differentContact = true;
hContact = (*contacts)[contInFile];
}
}
}
- else if(contInFile == 0 || contInFile == -3)
+ else if (contInFile == 0 || contInFile == -3)
{
ret = imp->GetEventList(eventList);
- if(!ret && err != NULL)
+ if (!ret && err != NULL)
*err = TranslateT("File is corrupted");
}
else
{
ret = false;
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("File is corrupted");
}
stream->close();
@@ -316,7 +316,7 @@ bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::Extern
void ExportManager::AddGroup(bool isMe, const std::wstring &time, const std::wstring &user, const std::wstring &eventText, int ico)
{
- if(exp == NULL)
+ if (exp == NULL)
return;
exp->WriteGroup(isMe, time, user, eventText);
TCHAR str[MAXSELECTSTR + 8]; // for safety reason
@@ -327,7 +327,7 @@ void ExportManager::AddGroup(bool isMe, const std::wstring &time, const std::wst
EventData data;
std::deque<EventIndex> revDeq;
std::deque<EventIndex>& deq = eventList.back();
- if(!oldOnTop && Options::instance->messagesNewOnTop)
+ if (!oldOnTop && Options::instance->messagesNewOnTop)
{
revDeq.insert(revDeq.begin(), deq.rbegin(), deq.rend());
deq = revDeq;
@@ -335,15 +335,15 @@ void ExportManager::AddGroup(bool isMe, const std::wstring &time, const std::wst
for(std::deque<EventIndex>::iterator it = deq.begin(); it != deq.end(); ++it)
{
EventIndex hDbEvent = *it;
- if(GetEventData(hDbEvent, data))
+ if (GetEventData(hDbEvent, data))
{
lastMe = data.isMe;
TCHAR* formatDate = Options::instance->messagesShowSec ? _T("d s") : _T("d t");
TCHAR* longFormatDate = Options::instance->messagesShowSec ? _T("d s") : _T("d t");
- if(!Options::instance->messagesShowDate)
+ if (!Options::instance->messagesShowDate)
{
- if(isFirst)
+ if (isFirst)
{
isFirst = false;
formatDate = Options::instance->messagesShowSec ? _T("s") : _T("t");
@@ -355,7 +355,7 @@ void ExportManager::AddGroup(bool isMe, const std::wstring &time, const std::wst
time_t tt = data.timestamp;
tm t;
localtime_s(&t, &tt);
- if(lastTime.tm_yday == t.tm_yday && lastTime.tm_year == t.tm_year)
+ if (lastTime.tm_yday == t.tm_yday && lastTime.tm_year == t.tm_year)
formatDate = Options::instance->messagesShowSec ? _T("s") : _T("t");
}
}
@@ -366,17 +366,17 @@ void ExportManager::AddGroup(bool isMe, const std::wstring &time, const std::wst
std::wstring shortDate = str;
std::wstring user;
- if(lastMe)
+ if (lastMe)
user = myName;
else
user = contactName;
GetEventMessage(hDbEvent, str);
std::wstring strMessage = str;
- if(strMessage.length() + 1 >= MAXSELECTSTR)
+ if (strMessage.length() + 1 >= MAXSELECTSTR)
continue;
- if(hDbEvent.isExternal)
+ if (hDbEvent.isExternal)
{
GetExtEventDBei(hDbEvent);
}
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp
index 60753d828e..ad3a240389 100644
--- a/plugins/BasicHistory/src/HistoryWindow.cpp
+++ b/plugins/BasicHistory/src/HistoryWindow.cpp
@@ -78,37 +78,37 @@ HistoryWindow::HistoryWindow(HANDLE _hContact) :
HistoryWindow::~HistoryWindow()
{
- if(eventIcons != NULL)
+ if (eventIcons != NULL)
{
for(int i = 0; i < iconsNum; ++i)
- if(eventIcons[i] != NULL)
+ if (eventIcons[i] != NULL)
Skin_ReleaseIcon(eventIcons[i]);
delete[] eventIcons;
}
- if(plusIco != NULL)
+ if (plusIco != NULL)
Skin_ReleaseIcon(plusIco);
- if(minusIco != NULL)
+ if (minusIco != NULL)
Skin_ReleaseIcon(minusIco);
- if(findNextIco != NULL)
+ if (findNextIco != NULL)
Skin_ReleaseIcon(findNextIco);
- if(findPrevIco != NULL)
+ if (findPrevIco != NULL)
Skin_ReleaseIcon(findPrevIco);
- if(himlSmall != NULL)
+ if (himlSmall != NULL)
ImageList_Destroy(himlSmall);
- if(himlNone != NULL)
+ if (himlNone != NULL)
ImageList_Destroy(himlNone);
- if(bkBrush != NULL)
+ if (bkBrush != NULL)
DeleteObject(bkBrush);
- if(bkFindBrush != NULL)
+ if (bkFindBrush != NULL)
DeleteObject(bkFindBrush);
}
@@ -121,7 +121,7 @@ void HistoryWindow::Deinit()
std::vector<HANDLE> keys;
for(std::map<HANDLE, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
{
- if(!it->second->isDestroyed)
+ if (!it->second->isDestroyed)
{
keys.push_back(it->first);
}
@@ -129,7 +129,7 @@ void HistoryWindow::Deinit()
for(std::vector<HANDLE>::iterator it = keys.begin(); it != keys.end(); ++it)
{
std::map<HANDLE, HistoryWindow*>::iterator it1 = windows.find(*it);
- if(it1 != windows.end())
+ if (it1 != windows.end())
{
DestroyWindow(it1->second->hWnd);
it1 = windows.find(*it);
@@ -140,7 +140,7 @@ void HistoryWindow::Deinit()
std::vector<HistoryWindow*> keys1;
for(std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
{
- if(!(*it)->isDestroyed)
+ if (!(*it)->isDestroyed)
{
keys1.push_back(*it);
}
@@ -151,14 +151,14 @@ void HistoryWindow::Deinit()
}
for(std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
{
- if(!(*it)->isDestroyed)
+ if (!(*it)->isDestroyed)
{
destroyed = false;
break;
}
}
- if(destroyed)
+ if (destroyed)
{
for(std::map<HANDLE, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
{
@@ -178,7 +178,7 @@ void HistoryWindow::Deinit()
void HistoryWindow::Open(HANDLE hContact)
{
- if(hContact == NULL)
+ if (hContact == NULL)
{
HistoryWindow *hw = new HistoryWindow(hContact);
freeWindows.push_back(hw);
@@ -187,7 +187,7 @@ void HistoryWindow::Open(HANDLE hContact)
else
{
std::map<HANDLE, HistoryWindow*>::iterator it = windows.find(hContact);
- if(it != windows.end())
+ if (it != windows.end())
{
it->second->Focus();
}
@@ -202,9 +202,9 @@ void HistoryWindow::Open(HANDLE hContact)
void HistoryWindow::Close(HANDLE hContact)
{
std::map<HANDLE, HistoryWindow*>::iterator it = windows.find(hContact);
- if(it != windows.end())
+ if (it != windows.end())
{
- if(it->second->isDestroyed)
+ if (it->second->isDestroyed)
{
delete it->second;
windows.erase(it);
@@ -218,13 +218,13 @@ void HistoryWindow::Close(HANDLE hContact)
void HistoryWindow::Close(HistoryWindow* historyWindow)
{
- if(!historyWindow->isDestroyed)
+ if (!historyWindow->isDestroyed)
{
DestroyWindow(historyWindow->hWnd);
return;
}
std::map<HANDLE, HistoryWindow*>::iterator it = windows.find(historyWindow->hContact);
- if(it != windows.end() && it->second == historyWindow)
+ if (it != windows.end() && it->second == historyWindow)
{
delete it->second;
windows.erase(it);
@@ -233,7 +233,7 @@ void HistoryWindow::Close(HistoryWindow* historyWindow)
{
for(std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
{
- if(*it == historyWindow)
+ if (*it == historyWindow)
{
freeWindows.erase(it);
delete historyWindow;
@@ -245,10 +245,10 @@ void HistoryWindow::Close(HistoryWindow* historyWindow)
void HistoryWindow::RebuildEvents(HANDLE hContact)
{
- if(hContact != NULL)
+ if (hContact != NULL)
{
std::map<HANDLE, HistoryWindow*>::iterator it = windows.find(hContact);
- if(it != windows.end() && !it->second->isDestroyed)
+ if (it != windows.end() && !it->second->isDestroyed)
{
SendMessage(it->second->hWnd,DM_HREBUILD,0,0);
}
@@ -256,7 +256,7 @@ void HistoryWindow::RebuildEvents(HANDLE hContact)
for(std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
{
- if((*it)->hContact == hContact && !(*it)->isDestroyed)
+ if ((*it)->hContact == hContact && !(*it)->isDestroyed)
{
SendMessage((*it)->hWnd,DM_HREBUILD,0,0);
}
@@ -266,7 +266,7 @@ void HistoryWindow::RebuildEvents(HANDLE hContact)
void HistoryWindow::ChangeToFreeWindow(HistoryWindow* historyWindow)
{
std::map<HANDLE, HistoryWindow*>::iterator it = windows.find(historyWindow->hContact);
- if(it != windows.end() && it->second == historyWindow)
+ if (it != windows.end() && it->second == historyWindow)
{
windows.erase(it);
freeWindows.push_back(historyWindow);
@@ -280,7 +280,7 @@ void HistoryWindow::Show()
void HistoryWindow::Focus()
{
- if(IsIconic(hWnd))
+ if (IsIconic(hWnd))
{
ShowWindow(hWnd, SW_RESTORE);
}
@@ -296,7 +296,7 @@ int HistoryWindow::FontsChanged(WPARAM wParam, LPARAM lParam)
{
for(std::map<HANDLE, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
{
- if(!it->second->isDestroyed)
+ if (!it->second->isDestroyed)
{
it->second->FontsChanged();
}
@@ -304,7 +304,7 @@ int HistoryWindow::FontsChanged(WPARAM wParam, LPARAM lParam)
for(std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
{
- if(!(*it)->isDestroyed)
+ if (!(*it)->isDestroyed)
{
(*it)->FontsChanged();
}
@@ -315,11 +315,11 @@ int HistoryWindow::FontsChanged(WPARAM wParam, LPARAM lParam)
void HistoryWindow::FontsChanged()
{
- if(bkBrush != NULL)
+ if (bkBrush != NULL)
{
DeleteObject(bkBrush);
}
- if(bkFindBrush != NULL)
+ if (bkFindBrush != NULL)
{
DeleteObject(bkFindBrush);
}
@@ -347,7 +347,7 @@ void HistoryWindow::OptionsGroupChanged()
{
for(std::map<HANDLE, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
{
- if(!it->second->isDestroyed)
+ if (!it->second->isDestroyed)
{
it->second->GroupImagesChanged();
SendMessage(it->second->hWnd,DM_HREBUILD,0,0);
@@ -356,7 +356,7 @@ void HistoryWindow::OptionsGroupChanged()
for(std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
{
- if(!(*it)->isDestroyed)
+ if (!(*it)->isDestroyed)
{
(*it)->GroupImagesChanged();
SendMessage((*it)->hWnd,DM_HREBUILD,0,0);
@@ -373,7 +373,7 @@ void HistoryWindow::OptionsMainChanged()
{
for(std::map<HANDLE, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
{
- if(!it->second->isDestroyed)
+ if (!it->second->isDestroyed)
{
it->second->ReloadMainOptions();
}
@@ -381,7 +381,7 @@ void HistoryWindow::OptionsMainChanged()
for(std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
{
- if(!(*it)->isDestroyed)
+ if (!(*it)->isDestroyed)
{
(*it)->ReloadMainOptions();
}
@@ -408,7 +408,7 @@ void HistoryWindow::OptionsSearchingChanged()
{
for(std::map<HANDLE, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
{
- if(!it->second->isDestroyed)
+ if (!it->second->isDestroyed)
{
it->second->searcher.SetSearchForInLG(Options::instance->searchForInList);
it->second->searcher.SetSearchForInMes(Options::instance->searchForInMess);
@@ -417,7 +417,7 @@ void HistoryWindow::OptionsSearchingChanged()
for(std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
{
- if(!(*it)->isDestroyed)
+ if (!(*it)->isDestroyed)
{
(*it)->searcher.SetSearchForInLG(Options::instance->searchForInList);
(*it)->searcher.SetSearchForInMes(Options::instance->searchForInMess);
@@ -432,20 +432,20 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM wParam, LPARAM lParam)
int start = 0;
int end = 0;
int count = EventList::GetContactMessageNumber(hContact);
- if(!count)
+ if (!count)
return FALSE;
for(std::map<HANDLE, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
{
- if(!it->second->isDestroyed)
+ if (!it->second->isDestroyed)
{
- if(it->second->hContact == hContact)
+ if (it->second->hContact == hContact)
{
- if(hWnd == NULL)
+ if (hWnd == NULL)
{
hWnd = it->second->hWnd;
}
- else if(GetForegroundWindow() == it->second->hWnd)
+ else if (GetForegroundWindow() == it->second->hWnd)
{
hWnd = it->second->hWnd;
}
@@ -455,15 +455,15 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM wParam, LPARAM lParam)
for(std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
{
- if(!(*it)->isDestroyed)
+ if (!(*it)->isDestroyed)
{
- if((*it)->hContact == hContact)
+ if ((*it)->hContact == hContact)
{
- if(hWnd == NULL)
+ if (hWnd == NULL)
{
hWnd = (*it)->hWnd;
}
- else if(GetForegroundWindow() == (*it)->hWnd)
+ else if (GetForegroundWindow() == (*it)->hWnd)
{
hWnd = (*it)->hWnd;
}
@@ -472,7 +472,7 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM wParam, LPARAM lParam)
}
TCHAR *message = TranslateT("This operation will PERMANENTLY REMOVE all history for this contact.\nAre you sure you want to do this?");
- if(MessageBox(hWnd, message, TranslateT("Are You sure?"), MB_OKCANCEL | MB_ICONERROR) != IDOK)
+ if (MessageBox(hWnd, message, TranslateT("Are You sure?"), MB_OKCANCEL | MB_ICONERROR) != IDOK)
return FALSE;
std::deque<HANDLE> toRemove;
@@ -485,9 +485,9 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM wParam, LPARAM lParam)
for(std::deque<HANDLE>::iterator it = toRemove.begin(); it != toRemove.end(); ++it)
db_event_delete(hContact, *it);
- if(EventList::IsImportedHistory(hContact)) {
+ if (EventList::IsImportedHistory(hContact)) {
TCHAR *message = TranslateT("Do you want delete all imported messages for this contact?\nNote that next scheduler task import this messages again.");
- if(MessageBox(hWnd, message, TranslateT("Are You sure?"), MB_YESNO | MB_ICONERROR) == IDYES)
+ if (MessageBox(hWnd, message, TranslateT("Are You sure?"), MB_YESNO | MB_ICONERROR) == IDYES)
EventList::DeleteImporter(hContact);
}
@@ -499,9 +499,9 @@ bool HistoryWindow::IsInList(HWND hWnd)
{
for(std::map<HANDLE, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
{
- if(!it->second->isDestroyed)
+ if (!it->second->isDestroyed)
{
- if(it->second->hWnd == hWnd)
+ if (it->second->hWnd == hWnd)
{
return true;
}
@@ -510,9 +510,9 @@ bool HistoryWindow::IsInList(HWND hWnd)
for(std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
{
- if(!(*it)->isDestroyed)
+ if (!(*it)->isDestroyed)
{
- if((*it)->hWnd == hWnd)
+ if ((*it)->hWnd == hWnd)
{
return true;
}
@@ -525,13 +525,13 @@ bool HistoryWindow::IsInList(HWND hWnd)
void ClickLink(HWND hwnd, ENLINK *penLink)
{
TCHAR buf[1024];
- if(penLink->msg != WM_LBUTTONUP)
+ if (penLink->msg != WM_LBUTTONUP)
return;
- if(penLink->chrg.cpMin >= 0 && penLink->chrg.cpMax > penLink->chrg.cpMin)
+ if (penLink->chrg.cpMin >= 0 && penLink->chrg.cpMax > penLink->chrg.cpMin)
{
// selection
int len = penLink->chrg.cpMax - penLink->chrg.cpMin;
- if(len < 1023)
+ if (len < 1023)
{
TEXTRANGE tr;
CHARRANGE sel;
@@ -601,7 +601,7 @@ public:
void __stdcall ShowMessageWindow(void* arg)
{
ShowMessageData* dt = (ShowMessageData*)arg;
- if(dt->str.empty())
+ if (dt->str.empty())
CallService(MS_MSG_SENDMESSAGE, (WPARAM)dt->hContact, 0);
else
CallService(MS_MSG_SENDMESSAGET, (WPARAM)dt->hContact, (LPARAM)dt->str.c_str());
@@ -659,7 +659,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
}
case IDC_FIND_TEXT:
- if(HIWORD(wParam) == EN_CHANGE)
+ if (HIWORD(wParam) == EN_CHANGE)
{
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
historyWindow->searcher.ClearFind();
@@ -669,10 +669,10 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
case IDC_SHOWHIDE:
{
- if(HIWORD( wParam ) == BN_CLICKED)
+ if (HIWORD( wParam ) == BN_CLICKED)
{
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- if(Button_GetCheck(GetDlgItem(hwndDlg,IDC_SHOWHIDE)) & BST_CHECKED)
+ if (Button_GetCheck(GetDlgItem(hwndDlg,IDC_SHOWHIDE)) & BST_CHECKED)
{
SendDlgItemMessage( hwndDlg, IDC_SHOWHIDE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)historyWindow->minusIco);
SendDlgItemMessage( hwndDlg, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Hide Contacts"), BATF_TCHAR);
@@ -704,23 +704,23 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
switch(pNmhdr->idFrom)
{
case IDC_LIST_CONTACTS:
- if(pNmhdr->code == CLN_LISTREBUILT)
+ if (pNmhdr->code == CLN_LISTREBUILT)
{
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- if(historyWindow != NULL)
+ if (historyWindow != NULL)
{
historyWindow->ReloadContacts();
}
DlgReturn(TRUE);
}
- else if(pNmhdr->code == CLN_MYSELCHANGED)
+ else if (pNmhdr->code == CLN_MYSELCHANGED)
{
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- if(historyWindow->ContactChanged())
+ if (historyWindow->ContactChanged())
{
MSGFILTER* msgFilter = (MSGFILTER *) lParam;
- if(msgFilter->msg == WM_LBUTTONDOWN)
+ if (msgFilter->msg == WM_LBUTTONDOWN)
{
SendMessage(pNmhdr->hwndFrom, WM_LBUTTONUP, msgFilter->wParam, msgFilter->lParam);
}
@@ -728,7 +728,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
DlgReturn(TRUE);
}
- else if(pNmhdr->code == CLN_OPTIONSCHANGED)
+ else if (pNmhdr->code == CLN_OPTIONSCHANGED)
{
ResetCList(hwndDlg);
return FALSE;
@@ -744,18 +744,18 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
ClickLink(GetDlgItem(hwndDlg, IDC_EDIT), (ENLINK *) lParam);
return FALSE;
}
- else if( pNmhdr->code == EN_SELCHANGE)
+ else if ( pNmhdr->code == EN_SELCHANGE)
{
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
historyWindow->searcher.ClearFind();
}
- else if(pNmhdr->code == EN_MSGFILTER)
+ else if (pNmhdr->code == EN_MSGFILTER)
{
MSGFILTER* msgFilter = (MSGFILTER *) lParam;
if (msgFilter->msg == WM_KEYDOWN || msgFilter->msg == WM_SYSKEYDOWN)
{
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- if(historyWindow->DoHotkey(msgFilter->msg, msgFilter->lParam, msgFilter->wParam, pNmhdr->idFrom))
+ if (historyWindow->DoHotkey(msgFilter->msg, msgFilter->lParam, msgFilter->wParam, pNmhdr->idFrom))
DlgReturn(TRUE);
}
else if (msgFilter->msg == WM_RBUTTONDOWN || msgFilter->msg == WM_RBUTTONDBLCLK || msgFilter->msg == WM_NCRBUTTONUP || msgFilter->msg == WM_NCRBUTTONDBLCLK || msgFilter->msg == WM_NCRBUTTONDOWN)
@@ -779,12 +779,12 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
CHARRANGE chrg;
SendMessage(window,EM_EXGETSEL,0,(LPARAM)&chrg);
SendMessage(window,EM_GETSCROLLPOS,0,(LPARAM)&scrool);
- if(selChar < chrg.cpMin || selChar > chrg.cpMax)
+ if (selChar < chrg.cpMin || selChar > chrg.cpMax)
{
chrg.cpMin = chrg.cpMax = selChar;
}
- if(chrg.cpMin == chrg.cpMax)
+ if (chrg.cpMin == chrg.cpMax)
{
CHARRANGE chrgNew;
chrgNew.cpMin = chrg.cpMin;
@@ -796,13 +796,13 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
chf.cbSize = sizeof(CHARFORMAT2);
chf.dwMask = CFM_LINK;
SendMessage(window, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&chf);
- if(chrg.cpMin == chrg.cpMax)
+ if (chrg.cpMin == chrg.cpMax)
SendMessage(window,EM_EXSETSEL,0,(LPARAM)&chrg);
HMENU hPopupMenu = CreatePopupMenu();
- if(hPopupMenu != NULL)
+ if (hPopupMenu != NULL)
{
- if(chf.dwEffects & CFE_LINK)
+ if (chf.dwEffects & CFE_LINK)
{
AppendMenu(hPopupMenu, MF_STRING, IDM_OPENNEW, TranslateT("Open in &new window"));
AppendMenu(hPopupMenu, MF_STRING, IDM_OPENEXISTING, TranslateT("&Open in existing window"));
@@ -824,15 +824,15 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
{
case IDM_COPY:
{
- if(chrg.cpMax == chrg.cpMin && historyWindow->currentGroup.size() > 0)
+ if (chrg.cpMax == chrg.cpMin && historyWindow->currentGroup.size() > 0)
{
size_t start = 0;
while(start < historyWindow->currentGroup.size() && chrg.cpMin >= historyWindow->currentGroup[start].endPos) ++start;
- if(start < historyWindow->currentGroup.size())
+ if (start < historyWindow->currentGroup.size())
{
CHARRANGE chrgNew;
chrgNew.cpMin = 0;
- if(start > 0)
+ if (start > 0)
chrgNew.cpMin = historyWindow->currentGroup[start - 1].endPos;
chrgNew.cpMax = historyWindow->currentGroup[start].endPos;
SendMessage(window,EM_EXSETSEL,0,(LPARAM)&chrgNew);
@@ -852,14 +852,14 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
break;
case IDM_QUOTE:
{
- if(historyWindow->currentGroup.size() > 0)
+ if (historyWindow->currentGroup.size() > 0)
{
std::wstring quote;
- if(chrg.cpMax == chrg.cpMin)
+ if (chrg.cpMax == chrg.cpMin)
{
size_t start = 0;
while(start < historyWindow->currentGroup.size() && chrg.cpMin >= historyWindow->currentGroup[start].endPos) ++start;
- if(start < historyWindow->currentGroup.size())
+ if (start < historyWindow->currentGroup.size())
{
historyWindow->FormatQuote(quote, historyWindow->currentGroup[start], historyWindow->currentGroup[start].description);
}
@@ -870,17 +870,17 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
while(start < historyWindow->currentGroup.size() && chrg.cpMin >= historyWindow->currentGroup[start].endPos) ++start;
size_t end = 0;
while(end < historyWindow->currentGroup.size() && chrg.cpMax > historyWindow->currentGroup[end].endPos) ++end;
- if(end >= historyWindow->currentGroup.size())
+ if (end >= historyWindow->currentGroup.size())
end = historyWindow->currentGroup.size() - 1;
- if(start == end && start < historyWindow->currentGroup.size())
+ if (start == end && start < historyWindow->currentGroup.size())
{
int iStart = historyWindow->currentGroup[start].startPos;
- if(chrg.cpMin > iStart)
+ if (chrg.cpMin > iStart)
iStart = chrg.cpMin;
int iEnd = historyWindow->currentGroup[start].endPos;
- if(chrg.cpMax < iEnd)
+ if (chrg.cpMax < iEnd)
iEnd = chrg.cpMax;
- if(iEnd > iStart)
+ if (iEnd > iStart)
{
TEXTRANGE tr;
tr.chrg.cpMin = iStart;
@@ -901,7 +901,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
}
}
- if(!quote.empty())
+ if (!quote.empty())
{
CallFunctionAsync(ShowMessageWindow, new ShowMessageData(historyWindow->hContact, quote));
}
@@ -931,7 +931,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
chf.cbSize = sizeof(CHARFORMAT2);
chf.dwMask = CFM_LINK;
int sel = SendMessage(window,EM_EXSETSEL,0,(LPARAM)&chrgNew);
- if(sel != chrgNew.cpMax)
+ if (sel != chrgNew.cpMax)
break;
SendMessage(window, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&chf);
--chrgNew.cpMin;
@@ -948,7 +948,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
chf.cbSize = sizeof(CHARFORMAT2);
chf.dwMask = CFM_LINK;
int sel = SendMessage(window,EM_EXSETSEL,0,(LPARAM)&chrgNew);
- if(sel != chrgNew.cpMax)
+ if (sel != chrgNew.cpMax)
break;
SendMessage(window, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&chf);
++chrgNew.cpMin;
@@ -957,7 +957,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
} while(chf.dwEffects & CFE_LINK);
--end;
- if(selected == IDM_COPYLINK)
+ if (selected == IDM_COPYLINK)
{
chrgNew.cpMin = start;
chrgNew.cpMax = end;
@@ -987,24 +987,24 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
}
break;
case IDC_LIST:
- if( pNmhdr->code == LVN_ITEMCHANGED)
+ if ( pNmhdr->code == LVN_ITEMCHANGED)
{
NMLISTVIEW *nmlv = (NMLISTVIEW*)lParam;
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- if((nmlv->uChanged & LVIF_STATE) && (nmlv->uNewState & LVIS_SELECTED) && historyWindow->selected != nmlv->iItem && nmlv->iItem >= 0)
+ if ((nmlv->uChanged & LVIF_STATE) && (nmlv->uNewState & LVIS_SELECTED) && historyWindow->selected != nmlv->iItem && nmlv->iItem >= 0)
{
historyWindow->SelectEventGroup(nmlv->iItem);
DlgReturn(TRUE);
}
}
- else if( pNmhdr->code == LVN_KEYDOWN)
+ else if ( pNmhdr->code == LVN_KEYDOWN)
{
LPNMLVKEYDOWN nmlv = (LPNMLVKEYDOWN)lParam;
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- if(historyWindow->DoHotkey(WM_KEYDOWN, 0, nmlv->wVKey, IDC_LIST))
+ if (historyWindow->DoHotkey(WM_KEYDOWN, 0, nmlv->wVKey, IDC_LIST))
DlgReturn(TRUE);
}
- else if(pNmhdr->code == NM_RCLICK)
+ else if (pNmhdr->code == NM_RCLICK)
{
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
POINT clicked;
@@ -1017,10 +1017,10 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
int newSel = SendMessage(window, LVM_SUBITEMHITTEST, 0, (LPARAM)&info);
int curSel = historyWindow->selected;
- if(newSel >= 0)
+ if (newSel >= 0)
{
HMENU hPopupMenu = CreatePopupMenu();
- if(hPopupMenu != NULL)
+ if (hPopupMenu != NULL)
{
AppendMenu(hPopupMenu, MF_STRING, IDM_COPY, TranslateT("Copy"));
AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEGROUP, TranslateT("Delete Group"));
@@ -1063,30 +1063,30 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
break;
case IDC_TOOLBAR:
- if( pNmhdr->code == TBN_DROPDOWN)
+ if ( pNmhdr->code == TBN_DROPDOWN)
{
LPNMTOOLBAR lpnmTB= (LPNMTOOLBAR)lParam;
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- if(lpnmTB->iItem == IDM_FIND)
+ if (lpnmTB->iItem == IDM_FIND)
{
historyWindow->FindToolbarClicked(lpnmTB);
}
- else if(lpnmTB->iItem == IDM_CONFIG)
+ else if (lpnmTB->iItem == IDM_CONFIG)
{
historyWindow->ConfigToolbarClicked(lpnmTB);
}
- else if(lpnmTB->iItem == IDM_DELETE)
+ else if (lpnmTB->iItem == IDM_DELETE)
{
historyWindow->DeleteToolbarClicked(lpnmTB);
}
DlgReturn(TBDDRET_DEFAULT);
}
- else if( pNmhdr->code == NM_KEYDOWN)
+ else if ( pNmhdr->code == NM_KEYDOWN)
{
LPNMKEY nmlv = (LPNMKEY)lParam;
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- if(historyWindow->DoHotkey(WM_KEYDOWN, 0, nmlv->nVKey, IDC_TOOLBAR))
+ if (historyWindow->DoHotkey(WM_KEYDOWN, 0, nmlv->nVKey, IDC_TOOLBAR))
DlgReturn(TRUE);
}
break;
@@ -1102,7 +1102,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
{
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
HWND curhWnd = (HWND)lParam;
- if(historyWindow->splitterXhWnd == curhWnd || historyWindow->splitterYhWnd == curhWnd)
+ if (historyWindow->splitterXhWnd == curhWnd || historyWindow->splitterYhWnd == curhWnd)
{
DlgReturn((LONG_PTR)historyWindow->bkBrush);
}
@@ -1113,7 +1113,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
{
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
HWND curhWnd = (HWND)lParam;
- if(historyWindow->findWindow == curhWnd)
+ if (historyWindow->findWindow == curhWnd)
{
HDC edithdc = (HDC)wParam;
LOGFONT font;
@@ -1144,7 +1144,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
case DM_HREBUILD:
{
HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwndDlg,GWLP_USERDATA);
- if(!historyWindow->isLoading)
+ if (!historyWindow->isLoading)
{
historyWindow->isLoading = true;
historyWindow->ReloadContacts();
@@ -1199,7 +1199,7 @@ void HistoryWindow::Initialise()
minusIco = LoadIconEx(IDI_HIDE, 1);
SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BUTTONSETASPUSHBTN, TRUE, 0 );
SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BUTTONSETASFLATBTN, TRUE, 0 );
- if(hContact == NULL || Options::instance->showContacts)
+ if (hContact == NULL || Options::instance->showContacts)
{
SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)minusIco);
SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Hide Contacts"), BATF_TCHAR);
@@ -1230,7 +1230,7 @@ void HistoryWindow::Initialise()
himlSmall = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 2, 2);
himlNone = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 2, 2);
ImageList_SetIconSize(himlNone, 0, 16);
- if(himlSmall)
+ if (himlSmall)
{
allIconNumber = iconsNum + 3;
eventIcons = new HICON[allIconNumber];
@@ -1249,7 +1249,7 @@ void HistoryWindow::Initialise()
eventIcons[++id] = LoadSkinnedIcon(SKINICON_OTHER_WINDOWS);
ImageList_AddIcon(himlSmall, eventIcons[id]);
- if((isGroupImages = Options::instance->groupShowEvents) != false)
+ if ((isGroupImages = Options::instance->groupShowEvents) != false)
ListView_SetImageList(listWindow, himlSmall, LVSIL_SMALL);
}
@@ -1273,7 +1273,7 @@ void HistoryWindow::Initialise()
RegisterHotkeyControl(findWindow);
HIMAGELIST himlButtons = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 3, 3);
- if(himlButtons)
+ if (himlButtons)
{
findNextIco = LoadIconEx(IDI_FINDNEXT);
ImageList_AddIcon(himlButtons, findNextIco);
@@ -1333,7 +1333,7 @@ void HistoryWindow::SplitterMoved(HWND splitter, LONG pos, bool screenPos)
POINT pt1;
POINT pt2;
- if(splitter == splitterXhWnd)
+ if (splitter == splitterXhWnd)
{
GetWindowRect(listWindow, &rc1);
GetWindowRect(editWindow, &rc2);
@@ -1343,16 +1343,16 @@ void HistoryWindow::SplitterMoved(HWND splitter, LONG pos, bool screenPos)
pt1.y = rc1.top;
pt2.x = rc2.right;
pt2.y = rc2.bottom;
- if(screenPos)
+ if (screenPos)
ScreenToClient(hWnd, &pt);
ScreenToClient(hWnd, &pt1);
ScreenToClient(hWnd, &pt2);
if ((pt.y >= pt1.y + MIN_PANELHEIGHT) && (pt.y < pt2.y - MIN_PANELHEIGHT))
{
splitterY = pt.y;
- if(!screenPos)
+ if (!screenPos)
SendMessage(hWnd, WM_SIZE, 0, 0);
- //if(M->isAero())
+ //if (M->isAero())
// InvalidateRect(GetParent(hwndDlg), NULL, FALSE);
}
}
@@ -1366,16 +1366,16 @@ void HistoryWindow::SplitterMoved(HWND splitter, LONG pos, bool screenPos)
pt1.y = rc1.top;
pt2.x = rc2.right;
pt2.y = rc2.bottom;
- if(screenPos)
+ if (screenPos)
ScreenToClient(hWnd, &pt);
ScreenToClient(hWnd, &pt1);
ScreenToClient(hWnd, &pt2);
if ((pt.x >= pt1.x + MIN_PANELHEIGHT) && (pt.x < pt2.x - MIN_PANELHEIGHT))
{
splitterX = pt.x;
- if(!screenPos)
+ if (!screenPos)
SendMessage(hWnd, WM_SIZE, 0, 0);
- //if(M->isAero())
+ //if (M->isAero())
// InvalidateRect(GetParent(hwndDlg), NULL, FALSE);
}
}
@@ -1389,7 +1389,7 @@ int HistoryWindow::HistoryDlgResizer(HWND hwnd, LPARAM, UTILRESIZECONTROL *urc)
{
urc->rcItem.bottom += historyWindow->splitterY - historyWindow->splitterOrgY;
urc->rcItem.left += historyWindow->splitterX - historyWindow->splitterOrgX;
- if(!historyWindow->isContactList)
+ if (!historyWindow->isContactList)
urc->rcItem.left = historyWindow->listOryginalPos;
return RD_ANCHORX_WIDTH|RD_ANCHORY_TOP;
}
@@ -1403,7 +1403,7 @@ int HistoryWindow::HistoryDlgResizer(HWND hwnd, LPARAM, UTILRESIZECONTROL *urc)
urc->rcItem.top += historyWindow->splitterY - historyWindow->splitterOrgY;
urc->rcItem.bottom += historyWindow->splitterY - historyWindow->splitterOrgY;
urc->rcItem.left += historyWindow->splitterX - historyWindow->splitterOrgX;
- if(!historyWindow->isContactList)
+ if (!historyWindow->isContactList)
urc->rcItem.left = 0;
return RD_ANCHORX_WIDTH|RD_ANCHORY_TOP;
}
@@ -1417,7 +1417,7 @@ int HistoryWindow::HistoryDlgResizer(HWND hwnd, LPARAM, UTILRESIZECONTROL *urc)
{
urc->rcItem.top += historyWindow->splitterY - historyWindow->splitterOrgY;
urc->rcItem.left += historyWindow->splitterX - historyWindow->splitterOrgX;
- if(!historyWindow->isContactList)
+ if (!historyWindow->isContactList)
urc->rcItem.left = historyWindow->listOryginalPos;
return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT;
}
@@ -1447,10 +1447,10 @@ void HistoryWindow::FillHistoryThread(void* param)
item.iItem = 0;
item.state = LVIS_SELECTED;
item.stateMask = LVIS_SELECTED;
- if(!isNewOnTop)
+ if (!isNewOnTop)
{
item.iItem = ListView_GetItemCount(hwndList) - 1;
- if(item.iItem < 0)
+ if (item.iItem < 0)
item.iItem = 0;
}
@@ -1465,20 +1465,20 @@ void HistoryWindow::AddGroup(bool isMe, const std::wstring &time, const std::wst
{
TCHAR msg[256];
msg[0] = 0;
- if(Options::instance->groupShowTime)
+ if (Options::instance->groupShowTime)
{
_tcscpy_s(msg, time.c_str());
}
- if(Options::instance->groupShowName)
+ if (Options::instance->groupShowName)
{
- if(msg[0] != 0)
+ if (msg[0] != 0)
_tcscat_s(msg, _T(" "));
_tcscat_s(msg, user.c_str());
}
- if(Options::instance->groupShowMessage)
+ if (Options::instance->groupShowMessage)
{
- if(msg[0] != 0)
+ if (msg[0] != 0)
_tcscat_s(msg, _T(" "));
_tcscat_s(msg, eventText.c_str());
}
@@ -1493,7 +1493,7 @@ void HistoryWindow::AddGroup(bool isMe, const std::wstring &time, const std::wst
void HistoryWindow::ReplaceIcons(HWND hwndDlg, int selStart, BOOL isSent)
{
- if(g_SmileyAddAvail)
+ if (g_SmileyAddAvail)
{
CHARRANGE sel;
SMADD_RICHEDIT3 smadd = {0};
@@ -1534,7 +1534,7 @@ void HistoryWindow::SelectEventGroup(int sel)
SendMessage(editWindow, WM_SETTEXT, 0, (LPARAM)_T(""));
currentGroup.clear();
selected = sel;
- if(sel < 0 || sel >= (int)eventList.size())
+ if (sel < 0 || sel >= (int)eventList.size())
return;
TCHAR _str[MAXSELECTSTR + 8]; // for safety reason
@@ -1567,7 +1567,7 @@ void HistoryWindow::SelectEventGroup(int sel)
int caps = GetDeviceCaps(hDC, LOGPIXELSY);
std::deque<EventIndex> revDeq;
std::deque<EventIndex>& deq = eventList[sel];
- if(Options::instance->messagesNewOnTop)
+ if (Options::instance->messagesNewOnTop)
{
revDeq.insert(revDeq.begin(), deq.rbegin(), deq.rend());
deq = revDeq;
@@ -1576,12 +1576,12 @@ void HistoryWindow::SelectEventGroup(int sel)
for(std::deque<EventIndex>::iterator it = deq.begin(); it != deq.end(); ++it)
{
EventIndex hDbEvent = *it;
- if(GetEventData(hDbEvent, data))
+ if (GetEventData(hDbEvent, data))
{
bool isUser = Options::instance->messagesShowName && (isFirst || (!lastMe && data.isMe) || (lastMe && !data.isMe));
lastMe = data.isMe;
backColor = Options::instance->GetColor(lastMe ? Options::OutBackground : Options::InBackground);
- if(Options::instance->messagesShowEvents)
+ if (Options::instance->messagesShowEvents)
{
str[0] = _T('>');
str[1] = 0;
@@ -1593,14 +1593,14 @@ void HistoryWindow::SelectEventGroup(int sel)
TextFont->Release();
int imId;
HICON ico;
- if(GetEventIcon(lastMe, data.eventType, imId))
+ if (GetEventIcon(lastMe, data.eventType, imId))
{
ico = eventIcons[imId];
}
else
{
ico = GetEventCoreIcon(hDbEvent);
- if(ico == NULL)
+ if (ico == NULL)
{
ico = eventIcons[imId];
}
@@ -1610,9 +1610,9 @@ void HistoryWindow::SelectEventGroup(int sel)
}
TCHAR* formatDate = Options::instance->messagesShowSec ? (isUser ? _T("d s ") : _T("d s\n")) : (isUser ? _T("d t ") : _T("d t\n"));
- if(!Options::instance->messagesShowDate)
+ if (!Options::instance->messagesShowDate)
{
- if(isFirst)
+ if (isFirst)
{
isFirst = false;
formatDate = Options::instance->messagesShowSec ? (isUser ? _T("s ") : _T("s\n")) : (isUser ? _T("t ") : _T("t\n"));
@@ -1624,7 +1624,7 @@ void HistoryWindow::SelectEventGroup(int sel)
time_t tt = data.timestamp;
tm t;
localtime_s(&t, &tt);
- if(lastTime.tm_yday == t.tm_yday && lastTime.tm_year == t.tm_year)
+ if (lastTime.tm_yday == t.tm_yday && lastTime.tm_year == t.tm_year)
formatDate = Options::instance->messagesShowSec ? (isUser ? _T("s ") : _T("s\n")) : (isUser ? _T("t ") : _T("t\n"));
}
}
@@ -1638,9 +1638,9 @@ void HistoryWindow::SelectEventGroup(int sel)
TextSelection->SetText(pStr);
TextFont->Release();
- if(isUser)
+ if (isUser)
{
- if(lastMe)
+ if (lastMe)
mir_sntprintf( str, MAXSELECTSTR, _T("%s\n"), myName );
else
mir_sntprintf( str, MAXSELECTSTR, _T("%s\n"), contactName );
@@ -1655,7 +1655,7 @@ void HistoryWindow::SelectEventGroup(int sel)
GetEventMessage(hDbEvent, str);
strStl = str;
size_t i = strStl.length();
- if(i + 1 >= MAXSELECTSTR)
+ if (i + 1 >= MAXSELECTSTR)
continue;
str[i++] = _T('\n');
str[i] = 0;
@@ -1668,7 +1668,7 @@ void HistoryWindow::SelectEventGroup(int sel)
TextSelection->SetText(pStr);
TextFont->Release();
- if(Options::instance->messagesUseSmileys)
+ if (Options::instance->messagesUseSmileys)
ReplaceIcons(editWindow, startAt, lastMe);
TextSelection->SetStart(MAXLONG);
TextSelection->GetStart(&endAt);
@@ -1688,7 +1688,7 @@ void HistoryWindow::SelectEventGroup(int sel)
UpdateWindow(editWindow);
}
- if(isStartSelect && !Options::instance->messagesNewOnTop)
+ if (isStartSelect && !Options::instance->messagesNewOnTop)
{
HWND h = SetFocus(editWindow);
CHARRANGE ch;
@@ -1704,7 +1704,7 @@ LRESULT CALLBACK HistoryWindow::SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM
{
HWND hwndParent = GetParent(hwnd);
HistoryWindow *dat = (HistoryWindow*)GetWindowLongPtr(hwndParent, GWLP_USERDATA);
- if(dat == NULL || dat->isDestroyed)
+ if (dat == NULL || dat->isDestroyed)
return FALSE;
switch (msg) {
@@ -1753,9 +1753,9 @@ void HistoryWindow::EnableWindows(BOOL enable)
void HistoryWindow::ReloadContacts()
{
HWND contactList = GetDlgItem(hWnd,IDC_LIST_CONTACTS);
- if(EventList::GetContactMessageNumber(NULL))
+ if (EventList::GetContactMessageNumber(NULL))
{
- if(hSystem == NULL)
+ if (hSystem == NULL)
{
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
@@ -1766,39 +1766,34 @@ void HistoryWindow::ReloadContacts()
}
else
{
- if(hSystem != NULL)
+ if (hSystem != NULL)
{
SendMessage(contactList, CLM_DELETEITEM, (WPARAM)hSystem, 0);
hSystem = NULL;
}
}
- HANDLE hContact;
- for (hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- if(EventList::GetContactMessageNumber(hContact) && (metaContactProto == NULL || db_get_b(hContact, metaContactProto, "IsSubcontact", 0) == 0))
- {
- HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
- if(hItem == NULL)
- SendMessage(contactList, CLM_ADDCONTACT, (WPARAM)hContact, 0);
+ for (HANDLE _hContact = db_find_first(); _hContact; _hContact = db_find_next(_hContact)) {
+ if (EventList::GetContactMessageNumber(_hContact) && (metaContactProto == NULL || db_get_b(_hContact, metaContactProto, "IsSubcontact", 0) == 0)) {
+ HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
+ if (hItem == NULL)
+ SendMessage(contactList, CLM_ADDCONTACT, (WPARAM)_hContact, 0);
}
else {
- HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
- if(hItem != NULL)
- SendMessage(contactList, CLM_DELETEITEM, (WPARAM)hContact, 0);
+ HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
+ if (hItem != NULL)
+ SendMessage(contactList, CLM_DELETEITEM, (WPARAM)_hContact, 0);
}
}
- if(hContact != NULL)
- {
+ if (hContact != NULL) {
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
- if(hItem != NULL)
- {
+ if (hItem != NULL) {
SendMessage(contactList, CLM_ENSUREVISIBLE, (WPARAM)hItem, 0);
SendMessage(contactList, CLM_SELECTITEM, (WPARAM)hItem, 0);
}
}
- else if(hSystem != NULL)
- {
+ else if (hSystem != NULL) {
SendMessage(contactList, CLM_ENSUREVISIBLE, (WPARAM)hSystem, 0);
SendMessage(contactList, CLM_SELECTITEM, (WPARAM)hSystem, 0);
}
@@ -1903,47 +1898,39 @@ bool HistoryWindow::DoHotkey(UINT msg, LPARAM lParam, WPARAM wParam, int window)
void HistoryWindow::RestorePos()
{
HANDLE contactToLoad = hContact;
- if(hContact == NULL)
- {
+ if (hContact == NULL) {
Utils_RestoreWindowPosition(hWnd,NULL,MODULE,"history_");
contactToLoad = NULL;
}
- else if(Utils_RestoreWindowPosition(hWnd,hContact,MODULE,"history_") != 0)
- {
+ else if (Utils_RestoreWindowPosition(hWnd,hContact,MODULE,"history_") != 0) {
Utils_RestoreWindowPosition(hWnd,NULL,MODULE,"history_");
contactToLoad = NULL;
}
- if(db_get_b(contactToLoad, MODULE, "history_ismax", 0))
- {
+
+ if (db_get_b(contactToLoad, MODULE, "history_ismax", 0))
ShowWindow(hWnd, SW_SHOWMAXIMIZED);
- }
LONG pos = db_get_dw(contactToLoad, MODULE, "history_splitterv", 0);
- if(pos > 0)
- {
+ if (pos > 0)
SplitterMoved(splitterYhWnd, pos, false);
- }
pos = db_get_dw(contactToLoad, MODULE, "history_splitter", 0);
- if(pos > 0)
- {
+ if (pos > 0)
SplitterMoved(splitterXhWnd, pos, false);
- }
}
void HistoryWindow::SavePos(bool all)
{
HANDLE contactToSave = hContact;
- if(all)
- {
- for (hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
- db_unset(hContact, MODULE, "history_x");
- db_unset(hContact, MODULE, "history_y");
- db_unset(hContact, MODULE, "history_width");
- db_unset(hContact, MODULE, "history_height");
- db_unset(hContact, MODULE, "history_ismax");
- db_unset(hContact, MODULE, "history_splitterv");
- db_unset(hContact, MODULE, "history_splitter");
+ if (all) {
+ for (HANDLE _hContact = db_find_first(); _hContact; _hContact = db_find_next(_hContact)) {
+ db_unset(_hContact, MODULE, "history_x");
+ db_unset(_hContact, MODULE, "history_y");
+ db_unset(_hContact, MODULE, "history_width");
+ db_unset(_hContact, MODULE, "history_height");
+ db_unset(_hContact, MODULE, "history_ismax");
+ db_unset(_hContact, MODULE, "history_splitterv");
+ db_unset(_hContact, MODULE, "history_splitter");
}
contactToSave = NULL;
@@ -1965,7 +1952,7 @@ void HistoryWindow::FindToolbarClicked(LPNMTOOLBAR lpnmTB)
SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmTB->iItem, (LPARAM)&rc);
MapWindowPoints(lpnmTB->hdr.hwndFrom, HWND_DESKTOP, (LPPOINT)&rc, 2);
HMENU hPopupMenu = CreatePopupMenu();
- if(hPopupMenu != NULL)
+ if (hPopupMenu != NULL)
{
AppendMenu(hPopupMenu, MF_STRING, IDM_FINDNEXT, TranslateT("Find Next"));
AppendMenu(hPopupMenu, MF_STRING, IDM_FINDPREV, TranslateT("Find Previous"));
@@ -1984,13 +1971,13 @@ void HistoryWindow::FindToolbarClicked(LPNMTOOLBAR lpnmTB)
for(size_t i = 0 ; i < Options::instance->customFilters.size(); ++i)
{
UINT flags = MF_STRING;
- if(filter - 2 == i)
+ if (filter - 2 == i)
flags |= MF_CHECKED;
AppendMenu(hFilterMenu, flags, DEF_FILTERS_START + i, Options::instance->customFilters[i].name.c_str());
}
AppendMenu(hPopupMenu, MF_STRING | MF_POPUP, (UINT_PTR)hFilterMenu, TranslateT("Filters"));
- if(searcher.IsFindBack())
+ if (searcher.IsFindBack())
SetMenuDefaultItem(hPopupMenu, IDM_FINDPREV, FALSE);
else
SetMenuDefaultItem(hPopupMenu, IDM_FINDNEXT, FALSE);
@@ -2031,7 +2018,7 @@ void HistoryWindow::FindToolbarClicked(LPNMTOOLBAR lpnmTB)
SendMessage(hWnd,DM_HREBUILD,0,0);
break;
default:
- if(selected >= DEF_FILTERS_START)
+ if (selected >= DEF_FILTERS_START)
{
SetDefFilter(selected - DEF_FILTERS_START + 2);
SendMessage(hWnd,DM_HREBUILD,0,0);
@@ -2050,7 +2037,7 @@ void HistoryWindow::ConfigToolbarClicked(LPNMTOOLBAR lpnmTB)
SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmTB->iItem, (LPARAM)&rc);
MapWindowPoints(lpnmTB->hdr.hwndFrom, HWND_DESKTOP, (LPPOINT)&rc, 2);
HMENU hPopupMenu = CreatePopupMenu();
- if(hPopupMenu != NULL)
+ if (hPopupMenu != NULL)
{
AppendMenu(hPopupMenu, MF_STRING, IDM_OPTIONS, TranslateT("Options"));
AppendMenu(hPopupMenu, MF_STRING, IDM_FONTS, TranslateT("Fonts & Colors"));
@@ -2169,43 +2156,35 @@ void HistoryWindow::DoImport(IImport::ImportType type)
do
{
bool differentContact = false;
- if(exp.Import(type, messages, &err, &differentContact, &contacts))
- {
+ if (exp.Import(type, messages, &err, &differentContact, &contacts)) {
int act = MessageBox(hWnd, TranslateT("Do you want save imported messages to local profile?"), TranslateT("Import"), MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON2);
- if(act == IDYES)
- {
+ if (act == IDYES) {
MargeMessages(messages);
- if(!changeContact)
- {
+ if (!changeContact)
HistoryWindow::RebuildEvents(hContact);
- }
}
- else if(act == IDNO)
- {
+ else if (act == IDNO) {
EventList::AddImporter(hContact, type, exp.GetFileName());
- if(!changeContact)
- {
+ if (!changeContact)
HistoryWindow::RebuildEvents(hContact);
- }
}
}
- else if(differentContact)
+ else if (differentContact)
{
int act = MessageBox(hWnd, TranslateT("File contain history for different contact. Do you want to change contact and import?"), TranslateT("Error"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2);
- if(act == IDYES)
- {
+ if (act == IDYES) {
changeContact = true;
hContact = exp.hContact;
}
}
- else if(!err.empty())
+ else if (!err.empty())
{
MessageBox(hWnd, err.c_str(), TranslateT("Error"), MB_ICONERROR);
}
}
- while(changeContact && i--);
- if(changeContact)
- {
+ while(changeContact && i--);
+
+ if (changeContact) {
hContact = lastContact;
ReloadContacts();
SelectContact(exp.hContact);
@@ -2219,16 +2198,14 @@ void HistoryWindow::DeleteToolbarClicked(LPNMTOOLBAR lpnmTB)
SendMessage(lpnmTB->hdr.hwndFrom, TB_GETRECT, (WPARAM)lpnmTB->iItem, (LPARAM)&rc);
MapWindowPoints(lpnmTB->hdr.hwndFrom, HWND_DESKTOP, (LPPOINT)&rc, 2);
HMENU hPopupMenu = CreatePopupMenu();
- if(hPopupMenu != NULL)
- {
+ if (hPopupMenu != NULL) {
AppendMenu(hPopupMenu, MF_STRING, IDM_DELETE, TranslateT("Delete"));
AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEGROUP, TranslateT("Delete Group"));
AppendMenu(hPopupMenu, MF_STRING, IDM_DELETEUSER, TranslateT("Delete All User History"));
SetMenuDefaultItem(hPopupMenu, IDM_DELETE, FALSE);
int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, hWnd, 0);
- switch (selected)
- {
+ switch (selected) {
case IDM_DELETE:
Delete(0);
break;
@@ -2249,100 +2226,75 @@ void HistoryWindow::Delete(int what)
int toDelete = 1;
size_t start = 0;
size_t end = 0;
- if(selected < 0 || selected >= (int)eventList.size() || what > 2 || what < 0)
+ if (selected < 0 || selected >= (int)eventList.size() || what > 2 || what < 0)
return;
- if(what == 0)
- {
+ if (what == 0) {
CHARRANGE chrg;
SendMessage(editWindow,EM_EXGETSEL,0,(LPARAM)&chrg);
- if(chrg.cpMin == 0 && chrg.cpMax == -1)
- {
+ if (chrg.cpMin == 0 && chrg.cpMax == -1)
toDelete = (int)currentGroup.size();
- }
- else
- {
+ else {
while(start < currentGroup.size() && chrg.cpMin >= currentGroup[start].endPos) ++start;
end = start;
while(end < currentGroup.size() && chrg.cpMax > currentGroup[end].endPos) ++end;
- if(start >= currentGroup.size())
+ if (start >= currentGroup.size())
return;
- if(end < currentGroup.size())
+ if (end < currentGroup.size())
++end;
toDelete = (int)(end - start);
}
}
- else if(what == 1)
- {
+ else if (what == 1) {
end = currentGroup.size();
toDelete = (int)end;
}
- else
- {
- if(eventList.size() == 0)
+ else {
+ if (eventList.size() == 0)
return;
toDelete = 1;
}
- if(toDelete == 0)
+ if (toDelete == 0)
return;
TCHAR message[256];
- if(what == 2)
+ if (what == 2)
_tcscpy_s(message, TranslateT("This operation will PERMANENTLY REMOVE all history for this contact.\nAre you sure you want to do this?"));
else
mir_sntprintf(message, SIZEOF(message), TranslateT("Number of history items to delete: %d.\nAre you sure you want to do this?"), toDelete);
- if(MessageBox(hWnd, message, TranslateT("Are You sure?"), MB_OKCANCEL | MB_ICONERROR) != IDOK)
+ if (MessageBox(hWnd, message, TranslateT("Are You sure?"), MB_OKCANCEL | MB_ICONERROR) != IDOK)
return;
bool areImpMessages = false;
bool rebuild = false;
- if(what == 2)
- {
+ if (what == 2) {
for(size_t j = 0; j < eventList.size(); ++j)
- {
for(size_t i = 0; i < eventList[j].size(); ++i)
- {
DeleteEvent(eventList[j][i]);
- }
- }
areImpMessages = EventList::IsImportedHistory(hContact);
rebuild = true;
}
- else
- {
- for(size_t i = start; i < end; ++i)
- {
+ else {
+ for(size_t i = start; i < end; ++i) {
EventIndex& ev = eventList[selected][i];
DeleteEvent(ev);
areImpMessages |= ev.isExternal;
}
- if(start == 0 && end == currentGroup.size())
- {
- rebuild = true;
- }
- else
- {
- rebuild = false;
- }
+ rebuild = (start == 0 && end == currentGroup.size());
}
- if(areImpMessages)
- {
+ if (areImpMessages) {
TCHAR *message = TranslateT("Do you want delete all imported messages for this contact?\nNote that next scheduler task import this messages again.");
- if(MessageBox(hWnd, message, TranslateT("Are You sure?"), MB_YESNO | MB_ICONERROR) == IDYES)
- {
+ if (MessageBox(hWnd, message, TranslateT("Are You sure?"), MB_YESNO | MB_ICONERROR) == IDYES) {
EventList::DeleteImporter(hContact);
rebuild = true;
}
}
- if(rebuild)
- {
+ if (rebuild)
RebuildEvents(hContact);
- }
- else
- {
+ else {
RebuildGroup(selected);
SelectEventGroup(selected);
}
@@ -2350,36 +2302,36 @@ void HistoryWindow::Delete(int what)
bool HistoryWindow::ContactChanged(bool sync)
{
- if(!isLoading)
+ if (!isLoading)
{
HANDLE hItem = (HANDLE)SendDlgItemMessage(hWnd, IDC_LIST_CONTACTS, CLM_GETSELECTION, 0, 0);
- if(hItem != NULL)
+ if (hItem != NULL)
{
int typeOf = SendDlgItemMessage(hWnd, IDC_LIST_CONTACTS, CLM_GETITEMTYPE,(WPARAM)hItem,0);
- if(typeOf == CLCIT_CONTACT)
+ if (typeOf == CLCIT_CONTACT)
{
- if(hContact != hItem)
+ if (hContact != hItem)
{
ChangeToFreeWindow(this);
isLoading = true;
hContact = hItem;
ReloadContacts();
- if(sync)
+ if (sync)
FillHistoryThread(this);
else
mir_forkthread(HistoryWindow::FillHistoryThread, this);
return true;
}
}
- else if(typeOf == CLCIT_INFO && hSystem == hItem)
+ else if (typeOf == CLCIT_INFO && hSystem == hItem)
{
- if(hContact != NULL)
+ if (hContact != NULL)
{
ChangeToFreeWindow(this);
isLoading = true;
hContact = NULL;
ReloadContacts();
- if(sync)
+ if (sync)
FillHistoryThread(this);
else
mir_forkthread(HistoryWindow::FillHistoryThread, this);
@@ -2394,23 +2346,18 @@ bool HistoryWindow::ContactChanged(bool sync)
void HistoryWindow::GroupImagesChanged()
{
- if(isGroupImages != Options::instance->groupShowEvents)
- {
+ if (isGroupImages != Options::instance->groupShowEvents) {
isGroupImages = Options::instance->groupShowEvents;
- if(isGroupImages)
- {
+ if (isGroupImages)
ListView_SetImageList(listWindow, himlSmall, LVSIL_SMALL);
- }
else
- {
ListView_SetImageList(listWindow, himlNone, LVSIL_SMALL);
- }
}
}
void HistoryWindow::FormatQuote(std::wstring& quote, const MessageData& md, const std::wstring& msg)
{
- if(md.isMe)
+ if (md.isMe)
quote += myName;
else
quote += contactName;
@@ -2423,9 +2370,9 @@ void HistoryWindow::FormatQuote(std::wstring& quote, const MessageData& md, cons
do
{
int nf = (int)msg.find_first_of(_T("\r\n"), f);
- if(nf >= 0 && nf < (int)msg.length())
+ if (nf >= 0 && nf < (int)msg.length())
{
- if(nf - f >= 0 )
+ if (nf - f >= 0 )
{
quote += _T(">");
quote += msg.substr(f, nf - f);
@@ -2433,10 +2380,10 @@ void HistoryWindow::FormatQuote(std::wstring& quote, const MessageData& md, cons
}
f = nf + 1;
- if(msg[nf] == _T('\r') && f < (int)msg.length() && msg[f] == _T('\n'))
+ if (msg[nf] == _T('\r') && f < (int)msg.length() && msg[f] == _T('\n'))
++f;
}
- else if(msg.length() - f > 0)
+ else if (msg.length() - f > 0)
{
quote += _T(">");
quote += msg.substr(f, msg.length() - f);
@@ -2454,15 +2401,15 @@ HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder)
HWND contactList = GetDlgItem(hWnd,IDC_LIST_CONTACTS);
bool find = false;
HANDLE _hContact;
- if(adder > 0)
+ if (adder > 0)
{
- if(hContact != NULL)
+ if (hContact != NULL)
{
_hContact = db_find_next(hContact);
while(_hContact)
{
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
- if(hItem != NULL)
+ if (hItem != NULL)
{
find = true;
break;
@@ -2471,20 +2418,20 @@ HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder)
_hContact = db_find_next(_hContact);
}
- if(!find && EventList::GetContactMessageNumber(NULL))
+ if (!find && EventList::GetContactMessageNumber(NULL))
{
_hContact = NULL;
find = true;
}
}
- if(!find)
+ if (!find)
{
_hContact = db_find_first();
while(_hContact && _hContact != hContact)
{
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
- if(hItem != NULL)
+ if (hItem != NULL)
{
find = true;
break;
@@ -2501,7 +2448,7 @@ HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder)
while(_hContact && _hContact != hContact)
{
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
- if(hItem != NULL)
+ if (hItem != NULL)
{
lastContact = _hContact;
}
@@ -2509,15 +2456,15 @@ HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder)
_hContact = db_find_next(_hContact);
}
- if(hContact != NULL)
+ if (hContact != NULL)
{
- if(lastContact == NULL && !EventList::GetContactMessageNumber(NULL))
+ if (lastContact == NULL && !EventList::GetContactMessageNumber(NULL))
{
_hContact = db_find_next(hContact);
while(_hContact)
{
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
- if(hItem != NULL)
+ if (hItem != NULL)
{
lastContact = _hContact;
}
@@ -2526,20 +2473,20 @@ HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder)
}
}
- if(lastContact != NULL || EventList::GetContactMessageNumber(NULL))
+ if (lastContact != NULL || EventList::GetContactMessageNumber(NULL))
{
_hContact = lastContact;
find = true;
}
}
- else if(lastContact != NULL)
+ else if (lastContact != NULL)
{
_hContact = lastContact;
find = true;
}
}
- if(find)
+ if (find)
{
return _hContact;
}
@@ -2551,13 +2498,13 @@ HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder)
void HistoryWindow::SelectContact(HANDLE _hContact)
{
- if(hContact != _hContact)
+ if (hContact != _hContact)
{
HWND contactList = GetDlgItem(hWnd,IDC_LIST_CONTACTS);
- if(_hContact != NULL)
+ if (_hContact != NULL)
{
HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
- if(hItem != NULL)
+ if (hItem != NULL)
{
SendMessage(contactList, CLM_ENSUREVISIBLE, (WPARAM)hItem, 0);
SendMessage(contactList, CLM_SELECTITEM, (WPARAM)hItem, 0);
diff --git a/plugins/BasicHistory/src/HotkeyHelper.cpp b/plugins/BasicHistory/src/HotkeyHelper.cpp
index 89db08013e..ba2e2195d2 100644
--- a/plugins/BasicHistory/src/HotkeyHelper.cpp
+++ b/plugins/BasicHistory/src/HotkeyHelper.cpp
@@ -27,7 +27,7 @@ static LRESULT CALLBACK HotkeySubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L
{
switch (msg) {
case WM_NCPAINT:
- if(Options::instance->noFindBorder && GetDlgCtrlID(hwnd) == IDC_FIND_TEXT)
+ if (Options::instance->noFindBorder && GetDlgCtrlID(hwnd) == IDC_FIND_TEXT)
return 0;
break;
case WM_CHAR:
@@ -35,12 +35,12 @@ static LRESULT CALLBACK HotkeySubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L
case WM_UNICHAR:
case WM_DEADCHAR:
case WM_SYSDEADCHAR:
- if(isPresed)
+ if (isPresed)
return 0;
break;
case WM_KEYUP:
case WM_SYSKEYUP:
- if(isPresed)
+ if (isPresed)
{
isPresed = false;
return 0;
@@ -58,7 +58,7 @@ static LRESULT CALLBACK HotkeySubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L
filter.nmhdr.hwndFrom = hwnd;
filter.nmhdr.code = EN_MSGFILTER;
filter.nmhdr.idFrom = GetDlgCtrlID(hwnd);
- if(SendMessage(hwndParent, WM_NOTIFY, NULL, (LPARAM)&filter))
+ if (SendMessage(hwndParent, WM_NOTIFY, NULL, (LPARAM)&filter))
{
isPresed = true;
return 0;
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp
index cacab1deee..d73c6feba9 100644
--- a/plugins/BasicHistory/src/Options.cpp
+++ b/plugins/BasicHistory/src/Options.cpp
@@ -297,11 +297,11 @@ void Options::Load(void)
groupShowName = db_get_b(0, MODULE, "groupShowName", 0) ? true : false;
groupShowMessage = db_get_b(0, MODULE, "groupShowMessage", 1) ? true : false;
groupMessageLen = db_get_dw(0, MODULE, "groupMessageLen", 43);
- if(groupMessageLen < 5) groupMessageLen = 5;
+ if (groupMessageLen < 5) groupMessageLen = 5;
groupTime = db_get_dw(0, MODULE, "groupTime", 5);
- if(groupTime < 1) groupTime = 1;
+ if (groupTime < 1) groupTime = 1;
groupMessagesNumber = db_get_dw(0, MODULE, "groupMessagesNumber", 100);
- if(groupMessagesNumber < 1) groupMessagesNumber = 1;
+ if (groupMessagesNumber < 1) groupMessagesNumber = 1;
messagesNewOnTop = db_get_b(0, MODULE, "messagesNewOnTop", 0) ? true : false;
messagesShowDate = db_get_b(0, MODULE, "messagesShowDate", 0) ? true : false;
messagesShowSec = db_get_b(0, MODULE, "messagesShowSec", 0) ? true : false;
@@ -327,7 +327,7 @@ void Options::Load(void)
FilterOptions fo;
mir_snprintf(buf, SIZEOF(buf), "filterName_%d", i);
DBVARIANT nameV;
- if(!db_get_ws(0, MODULE, buf, &nameV))
+ if (!db_get_ws(0, MODULE, buf, &nameV))
{
fo.name = nameV.pwszVal;
db_free(&nameV);
@@ -335,19 +335,19 @@ void Options::Load(void)
else break;
mir_snprintf(buf, SIZEOF(buf), "filterInOut_%d", i);
int inOut = db_get_b(0, MODULE, buf, 0);
- if(inOut == 1)
+ if (inOut == 1)
fo.onlyIncomming = true;
- else if(inOut == 2)
+ else if (inOut == 2)
fo.onlyOutgoing = true;
mir_snprintf(buf, SIZEOF(buf), "filterEvents_%d", i);
DBVARIANT eventsV;
- if(!db_get_s(0, MODULE, buf, &eventsV))
+ if (!db_get_s(0, MODULE, buf, &eventsV))
{
int k = 0;
char* id = eventsV.pszVal;
while(eventsV.pszVal[k])
{
- if(eventsV.pszVal[k] == ';')
+ if (eventsV.pszVal[k] == ';')
{
eventsV.pszVal[k] = 0;
fo.events.push_back(strtol(id, NULL, 16));
@@ -363,17 +363,17 @@ void Options::Load(void)
customFilters.insert(customFilters.end(), fo);
}
- if(defFilter > 1)
+ if (defFilter > 1)
{
defFilter = 0;
DBVARIANT defFilterStrV;
- if(!db_get_ws(0, MODULE, "defFilterStr", &defFilterStrV))
+ if (!db_get_ws(0, MODULE, "defFilterStr", &defFilterStrV))
{
std::wstring filterName = defFilterStrV.pwszVal;
for(int i = 0; i < (int)customFilters.size(); ++i)
{
- if(filterName == customFilters[i].name)
+ if (filterName == customFilters[i].name)
{
defFilter = i + 2;
break;
@@ -387,7 +387,7 @@ void Options::Load(void)
codepageHtml1 = db_get_dw(0, MODULE, "codepageHtml1", CP_UTF8);
codepageHtml2 = db_get_dw(0, MODULE, "codepageHtml2", CP_UTF8);
DBVARIANT encodingV;
- if(!db_get_ws(0, MODULE, "encodingTxt", &encodingV))
+ if (!db_get_ws(0, MODULE, "encodingTxt", &encodingV))
{
encodingTxt = encodingV.pwszVal;
db_free(&encodingV);
@@ -396,7 +396,7 @@ void Options::Load(void)
{
encodingTxt = _T("UTF-8");
}
- if(!db_get_ws(0, MODULE, "encodingHtml1", &encodingV))
+ if (!db_get_ws(0, MODULE, "encodingHtml1", &encodingV))
{
encodingHtml1 = encodingV.pwszVal;
db_free(&encodingV);
@@ -405,7 +405,7 @@ void Options::Load(void)
{
encodingHtml1 = _T("UTF-8");
}
- if(!db_get_ws(0, MODULE, "encodingHtml2", &encodingV))
+ if (!db_get_ws(0, MODULE, "encodingHtml2", &encodingV))
{
encodingHtml2 = encodingV.pwszVal;
db_free(&encodingV);
@@ -418,7 +418,7 @@ void Options::Load(void)
exportHtml1ShowDate = db_get_b(0, MODULE, "exportHtml1ShowDate", 1) ? true : false;
exportHtml2ShowDate = db_get_b(0, MODULE, "exportHtml2ShowDate", 0) ? true : false;
exportHtml2UseSmileys = db_get_b(0, MODULE, "exportHtml2UseSmileys", 1) ? true : false;
- if(!db_get_ws(0, MODULE, "extCssHtml2", &encodingV))
+ if (!db_get_ws(0, MODULE, "extCssHtml2", &encodingV))
{
extCssHtml2 = encodingV.pwszVal;
db_free(&encodingV);
@@ -428,13 +428,13 @@ void Options::Load(void)
extCssHtml2 = _T("");
}
- if(!db_get_ws(0, MODULE, "ftpLogPath", &encodingV))
+ if (!db_get_ws(0, MODULE, "ftpLogPath", &encodingV))
{
ftpLogPath = encodingV.pwszVal;
db_free(&encodingV);
}
- if(!db_get_ws(0, MODULE, "ftpExePath", &encodingV))
+ if (!db_get_ws(0, MODULE, "ftpExePath", &encodingV))
{
ftpExePath = encodingV.pwszVal;
db_free(&encodingV);
@@ -475,11 +475,11 @@ void Options::Save()
db_set_b(0, MODULE, "groupShowTime", groupShowTime ? 1 : 0);
db_set_b(0, MODULE, "groupShowName", groupShowName ? 1 : 0);
db_set_b(0, MODULE, "groupShowMessage", groupShowMessage ? 1 : 0);
- if(groupMessageLen < 5) groupMessageLen = 5;
+ if (groupMessageLen < 5) groupMessageLen = 5;
db_set_dw(0, MODULE, "groupMessageLen", groupMessageLen);
- if(groupTime < 1) groupTime = 1;
+ if (groupTime < 1) groupTime = 1;
db_set_dw(0, MODULE, "groupTime", groupTime);
- if(groupMessagesNumber < 1) groupMessagesNumber = 1;
+ if (groupMessagesNumber < 1) groupMessagesNumber = 1;
db_set_dw(0, MODULE, "groupMessagesNumber", groupMessagesNumber);
db_set_b(0, MODULE, "messagesNewOnTop", messagesNewOnTop ? 1 : 0);
db_set_b(0, MODULE, "messagesShowDate", messagesShowDate ? 1 : 0);
@@ -497,9 +497,9 @@ void Options::Save()
db_set_b(0, MODULE, "searchAllContacts", searchAllContacts ? 1 : 0);
db_set_b(0, MODULE, "schedulerAlerts", schedulerAlerts ? 1 : 0);
db_set_b(0, MODULE, "schedulerHistoryAlerts", schedulerHistoryAlerts ? 1 : 0);
- if(defFilter < 0 || defFilter - 2 >= (int)customFilters.size()) defFilter = 0;
+ if (defFilter < 0 || defFilter - 2 >= (int)customFilters.size()) defFilter = 0;
db_set_b(0, MODULE, "defFilter", defFilter < 2 ? defFilter : 2);
- if(defFilter >= 2)
+ if (defFilter >= 2)
db_set_ws(0, MODULE, "defFilterStr", customFilters[defFilter - 2].name.c_str());
db_set_dw(0, MODULE, "customFiltersCount", (DWORD)customFilters.size());
for(int i = 0 ; i < (int)customFilters.size(); ++i)
@@ -532,7 +532,7 @@ void Options::Save()
db_set_b(0, MODULE, "exportHtml2UseSmileys", exportHtml2UseSmileys ? 1 : 0);
db_set_ws(0, MODULE, "extCssHtml2", extCssHtml2.c_str());
db_set_ws(0, MODULE, "ftpLogPath", ftpLogPath.c_str());
- if(ftpExePath != ftpExePathDef)
+ if (ftpExePath != ftpExePathDef)
{
db_set_ws(0, MODULE, "ftpExePath", ftpExePath.c_str());
}
@@ -549,8 +549,7 @@ void Options::SaveTasks(std::list<TaskOptions>* tasks)
taskOptions.clear();
int i = 0;
char buf[256];
- for(std::list<TaskOptions>::iterator it = tasks->begin(); it != tasks->end(); ++it)
- {
+ for(std::list<TaskOptions>::iterator it = tasks->begin(); it != tasks->end(); ++it) {
mir_snprintf(buf, SIZEOF(buf), "Task_compress_%d", i);
db_set_b(0, MODULE, buf, it->compress);
mir_snprintf(buf, SIZEOF(buf), "Task_useFtp_%d", i);
@@ -611,8 +610,7 @@ void Options::SaveTasks(std::list<TaskOptions>* tasks)
db_set_dw(0, MODULE, "Task_count", i);
- for(i = (int)tasks->size(); i < oldTaskNr; ++i)
- {
+ for(i = (int)tasks->size(); i < oldTaskNr; ++i) {
mir_snprintf(buf, SIZEOF(buf), "Task_compress_%d", i);
db_unset(NULL, MODULE, buf);
mir_snprintf(buf, SIZEOF(buf), "Task_useFtp_%d", i);
@@ -718,31 +716,31 @@ void Options::LoadTasks()
to.lastExport |= ((unsigned long long int)db_get_dw(0, MODULE, buf, le >> 32)) << 32;
mir_snprintf(buf, SIZEOF(buf), "Task_ftpName_%d", i);
DBVARIANT var;
- if(!db_get_ws(0, MODULE, buf, &var))
+ if (!db_get_ws(0, MODULE, buf, &var))
{
to.ftpName = var.ptszVal;
db_free(&var);
}
mir_snprintf(buf, SIZEOF(buf), "Task_filterName_%d", i);
- if(!db_get_ws(0, MODULE, buf, &var))
+ if (!db_get_ws(0, MODULE, buf, &var))
{
to.filterName = var.ptszVal;
db_free(&var);
}
mir_snprintf(buf, SIZEOF(buf), "Task_filePath_%d", i);
- if(!db_get_ws(0, MODULE, buf, &var))
+ if (!db_get_ws(0, MODULE, buf, &var))
{
to.filePath = var.ptszVal;
db_free(&var);
}
mir_snprintf(buf, SIZEOF(buf), "Task_taskName_%d", i);
- if(!db_get_ws(0, MODULE, buf, &var))
+ if (!db_get_ws(0, MODULE, buf, &var))
{
to.taskName = var.ptszVal;
db_free(&var);
}
mir_snprintf(buf, SIZEOF(buf), "Task_zipPassword_%d", i);
- if(!db_get_s(0, MODULE, buf, &var))
+ if (!db_get_s(0, MODULE, buf, &var))
{
to.zipPassword = var.pszVal;
db_free(&var);
@@ -750,7 +748,7 @@ void Options::LoadTasks()
mir_snprintf(buf, SIZEOF(buf), "IsInTask_%d", i);
for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- if(db_get_b(hContact, MODULE, buf, 0) == 1)
+ if (db_get_b(hContact, MODULE, buf, 0) == 1)
to.contacts.push_back(hContact);
to.orderNr = i;
@@ -771,11 +769,11 @@ void SetEventCB(HWND hwndCB, int eventId)
int selCpIdx = -1;
for(int i = 0; i < cpCount; ++i)
{
- if(EventNames[i].id == eventId)
+ if (EventNames[i].id == eventId)
selCpIdx = i;
}
- if(selCpIdx == -1)
+ if (selCpIdx == -1)
{
TCHAR buf[24];
mir_sntprintf(buf, SIZEOF(buf), _T("%d"), eventId);
@@ -790,13 +788,13 @@ void SetEventCB(HWND hwndCB, int eventId)
int GetEventCB(HWND hwndCB, bool errorReport, int &eventId)
{
int selCpIdx = ComboBox_GetCurSel(hwndCB);
- if(selCpIdx < 0)
+ if (selCpIdx < 0)
{
TCHAR text[24];
ComboBox_GetText(hwndCB, text, 24);
TCHAR * stopOn = NULL;
long cp = _tcstol(text, &stopOn, 10);
- if(errorReport && (stopOn == text || *stopOn != '\0' || cp < 0))
+ if (errorReport && (stopOn == text || *stopOn != '\0' || cp < 0))
{
MessageBox(GetParent(hwndCB), TranslateT("Invalid event number"), TranslateT("Error"), MB_OK | MB_ICONERROR);
SetFocus(hwndCB);
@@ -805,7 +803,7 @@ int GetEventCB(HWND hwndCB, bool errorReport, int &eventId)
eventId = cp;
}
- else if(selCpIdx > 1)
+ else if (selCpIdx > 1)
eventId = EventNames[selCpIdx - 2].id;
else
return selCpIdx + 1;
@@ -823,11 +821,11 @@ void ReloadEventLB(HWND hwndLB, const FilterOptions &sel)
{
while(ListBox_GetCount(hwndLB) > 0)
ListBox_DeleteString(hwndLB, 0);
- if(sel.onlyIncomming && !sel.onlyOutgoing)
+ if (sel.onlyIncomming && !sel.onlyOutgoing)
{
ListBox_AddString(hwndLB, TranslateT("Incoming events"));
}
- else if(sel.onlyOutgoing && !sel.onlyIncomming)
+ else if (sel.onlyOutgoing && !sel.onlyIncomming)
{
ListBox_AddString(hwndLB, TranslateT("Outgoing events"));
}
@@ -838,10 +836,10 @@ void ReloadEventLB(HWND hwndLB, const FilterOptions &sel)
int selCpIdx = -1;
for(int i = 0; i < cpCount; ++i)
{
- if(EventNames[i].id == *it)
+ if (EventNames[i].id == *it)
selCpIdx = i;
}
- if(selCpIdx == -1)
+ if (selCpIdx == -1)
{
TCHAR buf[24];
mir_sntprintf(buf, SIZEOF(buf), _T("%d"), *it);
@@ -859,7 +857,7 @@ bool CheckFile(HWND hwndEdit)
TCHAR buf[MAX_PATH];
Edit_GetText(hwndEdit, buf, MAX_PATH);
DWORD atr = GetFileAttributes(buf);
- if(atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY)
+ if (atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY)
{
MessageBox(GetParent(hwndEdit), TranslateT("File do not exist. Enter correct file path."), TranslateT("Invalid file"), MB_OK | MB_ICONERROR);
SetFocus(hwndEdit);
@@ -888,7 +886,7 @@ bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const TCHAR* defName, const TCHAR*
TCHAR stzFilePath[1024];
Edit_GetText(hwndEdit, stzFilePath, 1023);
- if(stzFilePath[0] == 0)
+ if (stzFilePath[0] == 0)
{
_tcscpy_s(stzFilePath, defName);
len = _tcslen(stzFilePath) + 1;
@@ -909,10 +907,10 @@ bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const TCHAR* defName, const TCHAR*
ofn.lpstrTitle = title;
ofn.nMaxFile = 1024;
ofn.lpstrDefExt = ext;
- if(open)
+ if (open)
{
ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- if(GetOpenFileName(&ofn))
+ if (GetOpenFileName(&ofn))
{
Edit_SetText(hwndEdit, stzFilePath);
return true;
@@ -921,7 +919,7 @@ bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const TCHAR* defName, const TCHAR*
else
{
ofn.Flags = OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
- if(GetSaveFileName(&ofn))
+ if (GetSaveFileName(&ofn))
{
Edit_SetText(hwndEdit, stzFilePath);
return true;
@@ -995,7 +993,7 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam,
{
TCHAR name[24];
Edit_GetText(nameFilter, name, 24);
- if(name[0] == 0)
+ if (name[0] == 0)
{
MessageBox(hwndDlg, TranslateT("Enter filter name"), TranslateT("Error"), MB_ICONERROR);
return TRUE;
@@ -1004,7 +1002,7 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam,
FilterOptions fo(name);
for(std::vector<FilterOptions>::iterator it = instance->customFiltersTemp.begin(); it != instance->customFiltersTemp.end(); ++it)
{
- if(it->name == fo.name)
+ if (it->name == fo.name)
{
MessageBox(hwndDlg, TranslateT("Filter name exists"), TranslateT("Error"), MB_ICONERROR);
return TRUE;
@@ -1027,7 +1025,7 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_DELETE_FILTER:
{
int sel = ListBox_GetCurSel(listFilter);
- if(sel < 0)
+ if (sel < 0)
return TRUE;
for(size_t i = sel; i < instance->customFiltersTemp.size() - 1; ++i)
{
@@ -1037,7 +1035,7 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam,
instance->customFiltersTemp.resize(instance->customFiltersTemp.size() - 1);
ListBox_DeleteString(listFilter, sel);
ComboBox_DeleteString(defFilter, sel + 2);
- if(ComboBox_GetCurSel(defFilter) < 0)
+ if (ComboBox_GetCurSel(defFilter) < 0)
{
ComboBox_SetCurSel(defFilter, 0);
}
@@ -1052,41 +1050,41 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_ADD_EVENT:
{
int sel = ListBox_GetCurSel(listFilter);
- if(sel < 0)
+ if (sel < 0)
return TRUE;
int eventId;
int selCB = GetEventCB(eventCB, true, eventId);
- if(selCB < 0)
+ if (selCB < 0)
return TRUE;
- if(selCB == 1)
+ if (selCB == 1)
{
- if(instance->customFiltersTemp[sel].onlyIncomming)
+ if (instance->customFiltersTemp[sel].onlyIncomming)
{
MessageBox(hwndDlg, TranslateT("Event already exists"), TranslateT("Error"), MB_ICONERROR);
return TRUE;
}
- if(instance->customFiltersTemp[sel].onlyOutgoing)
+ if (instance->customFiltersTemp[sel].onlyOutgoing)
instance->customFiltersTemp[sel].onlyOutgoing = false;
else
instance->customFiltersTemp[sel].onlyIncomming = true;
}
- else if(selCB == 2)
+ else if (selCB == 2)
{
- if(instance->customFiltersTemp[sel].onlyOutgoing)
+ if (instance->customFiltersTemp[sel].onlyOutgoing)
{
MessageBox(hwndDlg, TranslateT("Event already exists"), TranslateT("Error"), MB_ICONERROR);
return TRUE;
}
- if(instance->customFiltersTemp[sel].onlyIncomming)
+ if (instance->customFiltersTemp[sel].onlyIncomming)
instance->customFiltersTemp[sel].onlyIncomming = false;
else
instance->customFiltersTemp[sel].onlyOutgoing = true;
}
else
{
- if(std::find(instance->customFiltersTemp[sel].events.begin(), instance->customFiltersTemp[sel].events.end(), eventId) != instance->customFiltersTemp[sel].events.end())
+ if (std::find(instance->customFiltersTemp[sel].events.begin(), instance->customFiltersTemp[sel].events.end(), eventId) != instance->customFiltersTemp[sel].events.end())
{
MessageBox(hwndDlg, TranslateT("Event already exists"), TranslateT("Error"), MB_ICONERROR);
return TRUE;
@@ -1103,15 +1101,15 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_DELETE_EVENT:
{
int sel = ListBox_GetCurSel(listFilter);
- if(sel < 0)
+ if (sel < 0)
return TRUE;
int eventSel = ListBox_GetCurSel(listEvents);
- if(eventSel < 0)
+ if (eventSel < 0)
return TRUE;
int stId = 0;
- if(instance->customFiltersTemp[sel].onlyIncomming || instance->customFiltersTemp[sel].onlyOutgoing)
+ if (instance->customFiltersTemp[sel].onlyIncomming || instance->customFiltersTemp[sel].onlyOutgoing)
++stId;
- if(eventSel >= stId)
+ if (eventSel >= stId)
{
--eventSel;
for(int i = eventSel; i < (int)instance->customFiltersTemp[sel].events.size() - 1; ++i)
@@ -1132,14 +1130,14 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam,
}
break;
case IDC_WINSCP_BROWSE:
- if(!OpenFileDlg(hwndDlg, GetDlgItem(hwndDlg, IDC_WINSCP), _T("WinSCP.exe"), _T("exe"), TranslateT("Browse WinSCP file"), true))
+ if (!OpenFileDlg(hwndDlg, GetDlgItem(hwndDlg, IDC_WINSCP), _T("WinSCP.exe"), _T("exe"), TranslateT("Browse WinSCP file"), true))
{
return TRUE;
}
break;
case IDC_WINSCPLOG_BROWSE:
- if(!OpenFileDlg(hwndDlg, GetDlgItem(hwndDlg, IDC_WINSCPLOG), _T("ftplog.txt"), _T("txt"), TranslateT("Save WinSCP log file"), false))
+ if (!OpenFileDlg(hwndDlg, GetDlgItem(hwndDlg, IDC_WINSCPLOG), _T("ftplog.txt"), _T("txt"), TranslateT("Save WinSCP log file"), false))
{
return TRUE;
}
@@ -1147,12 +1145,12 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
}
}
- else if(HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_LIST_FILTERS)
+ else if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_LIST_FILTERS)
{
HWND listFilter = GetDlgItem(hwndDlg, IDC_LIST_FILTERS);
HWND listEvents = GetDlgItem(hwndDlg, IDC_LIST_EVENTS);
int sel = ListBox_GetCurSel(listFilter);
- if(sel < 0)
+ if (sel < 0)
ClearLB(listEvents);
else
ReloadEventLB(listEvents, instance->customFiltersTemp[sel]);
@@ -1161,7 +1159,7 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam,
EnableWindow(GetDlgItem(hwndDlg, IDC_ADD_EVENT), sel >= 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE_EVENT), FALSE);
}
- else if(HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_LIST_EVENTS)
+ else if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_LIST_EVENTS)
{
HWND listEvents = GetDlgItem(hwndDlg, IDC_LIST_EVENTS);
int sel = ListBox_GetCurSel(listEvents);
@@ -1174,12 +1172,12 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam,
}
case WM_NOTIFY:
{
- if(((LPNMHDR)lParam)->code == PSN_APPLY)
+ if (((LPNMHDR)lParam)->code == PSN_APPLY)
{
HWND ftp = GetDlgItem(hwndDlg, IDC_WINSCP);
TCHAR buf[MAX_PATH];
Edit_GetText(ftp, buf, MAX_PATH);
- if(buf[0] != 0 && !CheckFile(ftp))
+ if (buf[0] != 0 && !CheckFile(ftp))
{
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
@@ -1246,9 +1244,9 @@ INT_PTR CALLBACK Options::DlgProcOptsGroupList(HWND hwndDlg, UINT msg, WPARAM wP
case WM_COMMAND:
{
OptsData* optsData = (OptsData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_SHOWMESSAGE)
+ if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_SHOWMESSAGE)
{
- if(IsDlgButtonChecked(hwndDlg, IDC_SHOWMESSAGE))
+ if (IsDlgButtonChecked(hwndDlg, IDC_SHOWMESSAGE))
{
EnableWindow(GetDlgItem(hwndDlg, IDC_MESSAGELEN), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_MESSAGELEN_DESC), TRUE);
@@ -1265,7 +1263,7 @@ INT_PTR CALLBACK Options::DlgProcOptsGroupList(HWND hwndDlg, UINT msg, WPARAM wP
}
case WM_NOTIFY:
{
- if(((LPNMHDR)lParam)->code == PSN_APPLY)
+ if (((LPNMHDR)lParam)->code == PSN_APPLY)
{
instance->groupNewOnTop = IsDlgButtonChecked(hwndDlg, IDC_NEWONTOP) ? true : false;
instance->groupShowEvents = IsDlgButtonChecked(hwndDlg, IDC_SHOWEVENTS) ? true : false;
@@ -1301,7 +1299,7 @@ INT_PTR CALLBACK Options::DlgProcOptsMessages(HWND hwndDlg, UINT msg, WPARAM wPa
CheckDlgButton(hwndDlg, IDC_SHOWNAME, instance->messagesShowName ? 1 : 0);
CheckDlgButton(hwndDlg, IDC_SHOWEVENTS, instance->messagesShowEvents ? 1 : 0);
CheckDlgButton(hwndDlg, IDC_SHOWSMILEYS, instance->messagesUseSmileys ? 1 : 0);
- if(!g_SmileyAddAvail)
+ if (!g_SmileyAddAvail)
EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWSMILEYS), FALSE);
return TRUE;
}
@@ -1313,7 +1311,7 @@ INT_PTR CALLBACK Options::DlgProcOptsMessages(HWND hwndDlg, UINT msg, WPARAM wPa
}
case WM_NOTIFY:
{
- if(((LPNMHDR)lParam)->code == PSN_APPLY)
+ if (((LPNMHDR)lParam)->code == PSN_APPLY)
{
instance->messagesNewOnTop = IsDlgButtonChecked(hwndDlg, IDC_NEWONTOP) ? true : false;
instance->messagesShowDate = IsDlgButtonChecked(hwndDlg, IDC_SHOWDATE) ? true : false;
@@ -1352,16 +1350,16 @@ INT_PTR CALLBACK Options::DlgProcOptsSearching(HWND hwndDlg, UINT msg, WPARAM wP
}
case WM_COMMAND:
{
- if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_ONLYIN)
+ if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_ONLYIN)
{
- if(IsDlgButtonChecked(hwndDlg, IDC_ONLYIN) && IsDlgButtonChecked(hwndDlg, IDC_ONLYOUT))
+ if (IsDlgButtonChecked(hwndDlg, IDC_ONLYIN) && IsDlgButtonChecked(hwndDlg, IDC_ONLYOUT))
{
CheckDlgButton(hwndDlg, IDC_ONLYOUT, 0);
}
}
- else if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_ONLYOUT)
+ else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_ONLYOUT)
{
- if(IsDlgButtonChecked(hwndDlg, IDC_ONLYOUT) && IsDlgButtonChecked(hwndDlg, IDC_ONLYIN))
+ if (IsDlgButtonChecked(hwndDlg, IDC_ONLYOUT) && IsDlgButtonChecked(hwndDlg, IDC_ONLYIN))
{
CheckDlgButton(hwndDlg, IDC_ONLYIN, 0);
}
@@ -1373,7 +1371,7 @@ INT_PTR CALLBACK Options::DlgProcOptsSearching(HWND hwndDlg, UINT msg, WPARAM wP
}
case WM_NOTIFY:
{
- if(((LPNMHDR)lParam)->code == PSN_APPLY)
+ if (((LPNMHDR)lParam)->code == PSN_APPLY)
{
instance->searchForInList = IsDlgButtonChecked(hwndDlg, IDC_FORLIST) ? true : false;
instance->searchForInMess = IsDlgButtonChecked(hwndDlg, IDC_FORMES) ? true : false;
@@ -1402,11 +1400,11 @@ void InitCodepageCB(HWND hwndCB, unsigned int codepage, const std::wstring& name
for(int i = 0; i < cpCount; ++i)
{
ComboBox_AddString(hwndCB, TranslateTS(cpTable[i].cpName));
- if(cpTable[i].cpId == codepage && name == cpTable[i].cpName)
+ if (cpTable[i].cpId == codepage && name == cpTable[i].cpName)
selCpIdx = i;
}
- if(selCpIdx == -1)
+ if (selCpIdx == -1)
{
TCHAR buf[300];
mir_sntprintf(buf, 300, _T("%d;%s"), codepage, name.c_str());
@@ -1423,14 +1421,14 @@ void InitCodepageCB(HWND hwndCB, unsigned int codepage, const std::wstring& name
unsigned int GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int defCp, const std::wstring& defName, std::wstring& name)
{
int selCpIdx = ComboBox_GetCurSel(hwndCB);
- if(selCpIdx < 0)
+ if (selCpIdx < 0)
{
TCHAR text[128];
ComboBox_GetText(hwndCB, text, 128);
std::wstring str = text;
name = _T("");
size_t pos = str.find_first_of(_T(';'));
- if(pos < str.length())
+ if (pos < str.length())
{
text[pos] = 0;
name = str.substr(pos + 1);
@@ -1438,9 +1436,9 @@ unsigned int GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int defCp, co
TCHAR * stopOn = NULL;
long cp = _tcstol(text, &stopOn, 10);
- if((pos >= str.length() || name.empty() || stopOn == text || *stopOn != '\0' || cp < 0 || cp > 0xffff))
+ if ((pos >= str.length() || name.empty() || stopOn == text || *stopOn != '\0' || cp < 0 || cp > 0xffff))
{
- if(errorReport)
+ if (errorReport)
{
MessageBox(GetParent(hwndCB), TranslateT("You've entered invalid codepage. Select codepage from combo box or enter correct number."), TranslateT("Invalid codepage"), MB_OK | MB_ICONERROR);
SetFocus(hwndCB);
@@ -1474,7 +1472,7 @@ INT_PTR CALLBACK Options::DlgProcOptsExport(HWND hwndDlg, UINT msg, WPARAM wPara
CheckDlgButton(hwndDlg, IDC_HTML2DATE, instance->exportHtml2ShowDate ? 1 : 0);
CheckDlgButton(hwndDlg, IDC_HTML2SHOWSMILEYS, instance->exportHtml2UseSmileys ? 1 : 0);
Edit_LimitText(GetDlgItem(hwndDlg, IDC_HTML2EXTCSSFILE), MAX_PATH);
- if(instance->extCssHtml2.empty())
+ if (instance->extCssHtml2.empty())
{
EnableWindow(GetDlgItem(hwndDlg, IDC_HTML2EXTCSSFILE), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CSS_BROWSE), FALSE);
@@ -1485,7 +1483,7 @@ INT_PTR CALLBACK Options::DlgProcOptsExport(HWND hwndDlg, UINT msg, WPARAM wPara
Edit_SetText(GetDlgItem(hwndDlg, IDC_HTML2EXTCSSFILE), instance->extCssHtml2.c_str());
}
- if(!g_SmileyAddAvail)
+ if (!g_SmileyAddAvail)
EnableWindow(GetDlgItem(hwndDlg, IDC_HTML2SHOWSMILEYS), FALSE);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)TRUE);
return TRUE;
@@ -1493,15 +1491,15 @@ INT_PTR CALLBACK Options::DlgProcOptsExport(HWND hwndDlg, UINT msg, WPARAM wPara
case WM_COMMAND:
{
BOOL init = (BOOL)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_HTML2EXTCSS)
+ if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_HTML2EXTCSS)
{
BOOL en = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_HTML2EXTCSS);
EnableWindow(GetDlgItem(hwndDlg, IDC_HTML2EXTCSSFILE), en);
EnableWindow(GetDlgItem(hwndDlg, IDC_CSS_BROWSE), en);
}
- else if(HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_CSS_BROWSE)
+ else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_CSS_BROWSE)
{
- if(!OpenFileDlg(hwndDlg, GetDlgItem(hwndDlg, IDC_HTML2EXTCSSFILE), _T(""), _T("css"), TranslateT("Browse CSS file"), true))
+ if (!OpenFileDlg(hwndDlg, GetDlgItem(hwndDlg, IDC_HTML2EXTCSSFILE), _T(""), _T("css"), TranslateT("Browse CSS file"), true))
{
return TRUE;
}
@@ -1513,33 +1511,33 @@ INT_PTR CALLBACK Options::DlgProcOptsExport(HWND hwndDlg, UINT msg, WPARAM wPara
}
case WM_NOTIFY:
{
- if(((LPNMHDR)lParam)->code == PSN_APPLY)
+ if (((LPNMHDR)lParam)->code == PSN_APPLY)
{
std::wstring newName1, newName2, newName3;
unsigned int cp1 = GetCodepageCB(GetDlgItem(hwndDlg, IDC_TXTENC), true, instance->codepageTxt, instance->encodingTxt, newName1);
- if(cp1 == -1)
+ if (cp1 == -1)
{
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
return TRUE;
}
unsigned int cp2 = GetCodepageCB(GetDlgItem(hwndDlg, IDC_HTML1ENC), true, instance->codepageHtml1, instance->encodingHtml1, newName2);
- if(cp2 == -1)
+ if (cp2 == -1)
{
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
return TRUE;
}
unsigned int cp3 = GetCodepageCB(GetDlgItem(hwndDlg, IDC_HTML2ENC), true, instance->codepageHtml2, instance->encodingHtml2, newName3);
- if(cp3 == -1)
+ if (cp3 == -1)
{
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
return TRUE;
}
- if(IsDlgButtonChecked(hwndDlg, IDC_HTML2EXTCSS))
+ if (IsDlgButtonChecked(hwndDlg, IDC_HTML2EXTCSS))
{
- if(!CheckFile(GetDlgItem(hwndDlg, IDC_HTML2EXTCSSFILE)))
+ if (!CheckFile(GetDlgItem(hwndDlg, IDC_HTML2EXTCSSFILE)))
{
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
@@ -1596,7 +1594,7 @@ INT_PTR CALLBACK Options::DlgProcOptsScheduler(HWND hwndDlg, UINT msg, WPARAM wP
ListBox_AddString(listTasks, it->taskName.c_str());
}
- if(!bPopupsEnabled)
+ if (!bPopupsEnabled)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_SCHEDULER_ALERTS), FALSE);
}
@@ -1610,7 +1608,7 @@ INT_PTR CALLBACK Options::DlgProcOptsScheduler(HWND hwndDlg, UINT msg, WPARAM wP
}
case WM_COMMAND:
{
- if(HIWORD(wParam) == BN_CLICKED)
+ if (HIWORD(wParam) == BN_CLICKED)
{
std::list<TaskOptions>* tasks = (std::list<TaskOptions>*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
HWND listTasks = GetDlgItem(hwndDlg, IDC_LIST_TASKS);
@@ -1620,12 +1618,12 @@ INT_PTR CALLBACK Options::DlgProcOptsScheduler(HWND hwndDlg, UINT msg, WPARAM wP
switch(LOWORD(wParam))
{
case IDC_EDIT_TASK:
- if(sel >= 0)
+ if (sel >= 0)
{
std::list<TaskOptions>::iterator it = tasks->begin();
while(sel-- > 0 && it != tasks->end())
++it;
- if(it == tasks->end())
+ if (it == tasks->end())
break;
to = &(*it);
}
@@ -1636,9 +1634,9 @@ INT_PTR CALLBACK Options::DlgProcOptsScheduler(HWND hwndDlg, UINT msg, WPARAM wP
DlgTaskOpt top;
top.tasks = tasks;
top.to = to;
- if(DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_TASK), hwndDlg, DlgProcOptsTask, (LPARAM)&top) == IDOK)
+ if (DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DLG_TASK), hwndDlg, DlgProcOptsTask, (LPARAM)&top) == IDOK)
{
- if(LOWORD(wParam) == IDC_ADD_TASK)
+ if (LOWORD(wParam) == IDC_ADD_TASK)
{
tasks->push_back(*to);
ListBox_AddString(listTasks, to->taskName.c_str());
@@ -1659,13 +1657,13 @@ INT_PTR CALLBACK Options::DlgProcOptsScheduler(HWND hwndDlg, UINT msg, WPARAM wP
break;
case IDC_DELETE_TASK:
- if(sel >= 0)
+ if (sel >= 0)
{
ListBox_DeleteString(listTasks, sel);
std::list<TaskOptions>::iterator it = tasks->begin();
while(sel-- > 0 && it != tasks->end())
++it;
- if(it != tasks->end())
+ if (it != tasks->end())
tasks->erase(it);
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_TASK), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE_TASK), FALSE);
@@ -1677,11 +1675,11 @@ INT_PTR CALLBACK Options::DlgProcOptsScheduler(HWND hwndDlg, UINT msg, WPARAM wP
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
}
- else if(HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_LIST_TASKS)
+ else if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_LIST_TASKS)
{
HWND listTasks = GetDlgItem(hwndDlg, IDC_LIST_TASKS);
int sel = ListBox_GetCurSel(listTasks);
- if(sel < 0)
+ if (sel < 0)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_TASK), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE_TASK), FALSE);
@@ -1696,7 +1694,7 @@ INT_PTR CALLBACK Options::DlgProcOptsScheduler(HWND hwndDlg, UINT msg, WPARAM wP
}
case WM_NOTIFY:
{
- if(((LPNMHDR)lParam)->code == PSN_APPLY)
+ if (((LPNMHDR)lParam)->code == PSN_APPLY)
{
std::list<TaskOptions>* tasks = (std::list<TaskOptions>*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
instance->schedulerAlerts = IsDlgButtonChecked(hwndDlg, IDC_SCHEDULER_ALERTS) ? true : false;
@@ -1733,7 +1731,7 @@ void ResetListOptions(HWND hwnd)
void RebuildList(HWND hwnd, HANDLE hSystem, TaskOptions* to)
{
HANDLE hItem;
- if(to->isSystem && hSystem)
+ if (to->isSystem && hSystem)
{
SendMessage(hwnd, CLM_SETCHECKMARK, (WPARAM) hSystem, 1);
}
@@ -1821,14 +1819,14 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
ComboBox_AddString(filter, TranslateT("Default history events"));
ComboBox_AddString(filter, TranslateT("All events"));
int selFilter = to->filterId;
- if(selFilter > 1)
+ if (selFilter > 1)
selFilter = 0;
int i = 1;
for(std::vector<FilterOptions>::iterator it = instance->customFilters.begin(); it != instance->customFilters.end(); ++it)
{
++i;
ComboBox_AddString(filter, it->name.c_str());
- if(to->filterId > 1 && it->name == to->filterName)
+ if (to->filterId > 1 && it->name == to->filterName)
{
selFilter = i;
}
@@ -1862,7 +1860,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
Edit_LimitText(exportPath, MAX_PATH);
Edit_SetText(exportPath, to->filePath.c_str());
- if(!FTPAvail())
+ if (!FTPAvail())
{
EnableWindow(ftpFile, FALSE);
EnableWindow(ftpFileButton, FALSE);
@@ -1888,10 +1886,10 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
SetDlgItemInt(hwndDlg, IDC_TRIGER_DELTA_TIME, to->deltaTime, FALSE);
TCHAR timeFormat[10];
- if(GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTTIME, timeFormat, 10) == 0)
+ if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTTIME, timeFormat, 10) == 0)
{
TCHAR sep = _T(':');
- if(GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, timeFormat, 10) > 0)
+ if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, timeFormat, 10) > 0)
sep = timeFormat[0];
mir_sntprintf(timeFormat, SIZEOF(timeFormat), _T("HH%cmm"), sep);
}
@@ -1937,11 +1935,11 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
toCp.exportImported = Button_GetCheck(GetDlgItem(hwndDlg, IDC_EXPIMP)) != 0;
toCp.type = (enum TaskOptions::TaskType)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_TASK_TYPE));
toCp.filterId = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_TASK_FILTER));
- if(toCp.filterId > 1)
+ if (toCp.filterId > 1)
toCp.filterName = instance->customFilters[toCp.filterId - 2].name;
BOOL isOK = FALSE;
toCp.eventDeltaTime = GetDlgItemInt(hwndDlg, IDC_EVENT_TIME, &isOK, TRUE);
- if(!isOK)
+ if (!isOK)
{
TCHAR msg[256];
mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), TranslateT("Events older than"));
@@ -1972,9 +1970,9 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
toCp.dayTime = st.wHour * 60 + st.wMinute;
toCp.dayOfWeek = ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_TRIGER_WEEK));
toCp.dayOfMonth = GetDlgItemInt(hwndDlg, IDC_TRIGER_DAY, &isOK, FALSE);
- if(!isOK)
+ if (!isOK)
{
- if(toCp.trigerType == TaskOptions::Monthly)
+ if (toCp.trigerType == TaskOptions::Monthly)
{
TCHAR msg[256];
mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), TranslateT("Day"));
@@ -1985,9 +1983,9 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
toCp.dayOfMonth = to->dayOfMonth;
}
toCp.deltaTime = GetDlgItemInt(hwndDlg, IDC_TRIGER_DELTA_TIME, &isOK, FALSE);
- if(!isOK)
+ if (!isOK)
{
- if(toCp.trigerType == TaskOptions::DeltaMin || toCp.trigerType == TaskOptions::DeltaHour)
+ if (toCp.trigerType == TaskOptions::DeltaMin || toCp.trigerType == TaskOptions::DeltaHour)
{
TCHAR msg[256];
mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), TranslateT("Delta time"));
@@ -2002,13 +2000,13 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
std::wstring errDescr;
std::wstring lastName = to->taskName;
to->taskName = L"";
- if(!IsValidTask(toCp, top->tasks, &err, &errDescr))
+ if (!IsValidTask(toCp, top->tasks, &err, &errDescr))
{
to->taskName = lastName;
TCHAR msg[256];
- if(err.empty())
+ if (err.empty())
_tcscpy_s(msg, TranslateT("Some value is invalid"));
- else if(errDescr.empty())
+ else if (errDescr.empty())
{
mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), err.c_str());
}
@@ -2032,7 +2030,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
}
else if (LOWORD(wParam) == IDC_UPLOAD)
{
- if(Button_GetCheck(GetDlgItem(hwndDlg, IDC_UPLOAD)) == 0)
+ if (Button_GetCheck(GetDlgItem(hwndDlg, IDC_UPLOAD)) == 0)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_FTP), FALSE);
}
@@ -2041,9 +2039,9 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
EnableWindow(GetDlgItem(hwndDlg, IDC_FTP), TRUE);
}
}
- else if(LOWORD(wParam) == IDC_COMPRESS)
+ else if (LOWORD(wParam) == IDC_COMPRESS)
{
- if(Button_GetCheck(GetDlgItem(hwndDlg, IDC_COMPRESS)) == 0)
+ if (Button_GetCheck(GetDlgItem(hwndDlg, IDC_COMPRESS)) == 0)
{
EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD_LABEL), FALSE);
@@ -2057,7 +2055,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
}
else if (HIWORD(wParam) == CBN_SELCHANGE)
{
- if(LOWORD(wParam) == IDC_TASK_TYPE)
+ if (LOWORD(wParam) == IDC_TASK_TYPE)
{
TaskOptions::TaskType sel = (enum TaskOptions::TaskType)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_TASK_TYPE));
int show = sel == TaskOptions::Delete ? SW_HIDE : SW_SHOW;
@@ -2079,7 +2077,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
ShowWindow(GetDlgItem(hwndDlg, IDC_EVENT_TIME), showFilter);
ShowWindow(GetDlgItem(hwndDlg, IDC_EVENT_UNIT), showFilter);
ShowWindow(GetDlgItem(hwndDlg, IDC_EVENT_LABEL), showFilter);
- if(show != showFilter)
+ if (show != showFilter)
{
ShowWindow(GetDlgItem(hwndDlg, IDC_EXPORT_TYPE), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_EXPIMP), SW_HIDE);
@@ -2090,14 +2088,14 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
TCHAR* compressText = TranslateT("Compress output files");
TCHAR* uploadText = TranslateT("Upload to FTP (WinSCP requred)");
TCHAR* typeText = TranslateT("Export to");
- if(showFilter == SW_HIDE)
+ if (showFilter == SW_HIDE)
{
str = TranslateT("** Use <ext> to insert extension, <contact> to insert contact name");
compressText = TranslateT("Input files are compressed");
uploadText = TranslateT("Download from FTP (WinSCP requred)");
typeText = TranslateT("Import from");
}
- else if(show == SW_HIDE)
+ else if (show == SW_HIDE)
{
str = TranslateT("* Use negative values to filter younger events");
}
@@ -2113,7 +2111,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
Button_SetText(GetDlgItem(hwndDlg, IDC_UPLOAD), uploadText);
Static_SetText(GetDlgItem(hwndDlg, IDC_EXPORT_TYPE_LABEL), typeText);
}
- else if(LOWORD(wParam) == IDC_TRIGER_TYPE)
+ else if (LOWORD(wParam) == IDC_TRIGER_TYPE)
{
TaskOptions::TrigerType sel = (enum TaskOptions::TrigerType)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_TRIGER_TYPE));
int showT = (sel == TaskOptions::Daily || sel == TaskOptions::Weekly || sel == TaskOptions::Monthly) ? SW_SHOW : SW_HIDE;
diff --git a/plugins/BasicHistory/src/Options.h b/plugins/BasicHistory/src/Options.h
index 015c8734de..21a0976d9d 100644
--- a/plugins/BasicHistory/src/Options.h
+++ b/plugins/BasicHistory/src/Options.h
@@ -115,7 +115,7 @@ struct TaskOptions
deltaTime = 24;
orderNr = 0;
TCHAR buf[MAX_PATH];
- if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, buf)))
+ if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, buf)))
{
filePath = buf;
filePath += _T("\\");
diff --git a/plugins/BasicHistory/src/PlainHtmlExport.cpp b/plugins/BasicHistory/src/PlainHtmlExport.cpp
index ca0e110822..695b48d78a 100644
--- a/plugins/BasicHistory/src/PlainHtmlExport.cpp
+++ b/plugins/BasicHistory/src/PlainHtmlExport.cpp
@@ -52,7 +52,7 @@ void PlainHtmlExport::WriteHeader(const std::wstring &fileName, const std::wstri
EXP_FILE << _T(".mes#session { background-color: #FFFDD7; }\n");
EXP_FILE << _T("--></style>\n</head><body>\n<h4>") << TranslateT("History Log") << _T("</h4>\n<h3>");
EXP_FILE << MakeTextHtmled(myName);
- if(proto1.length() || myId.length())
+ if (proto1.length() || myId.length())
{
EXP_FILE << _T(" (") << MakeTextHtmled(proto1) << _T(": ") << MakeTextHtmled(myId) << _T(") - ");
}
@@ -62,7 +62,7 @@ void PlainHtmlExport::WriteHeader(const std::wstring &fileName, const std::wstri
}
EXP_FILE << MakeTextHtmled(name1);
- if(proto1.length() || id1.length())
+ if (proto1.length() || id1.length())
{
EXP_FILE << _T(" (") << MakeTextHtmled(proto1) << _T(": ") << MakeTextHtmled(id1) << _T(")</h3>\n");
}
@@ -94,7 +94,7 @@ void PlainHtmlExport::WriteMessage(bool isMe, const std::wstring &longDate, cons
TCHAR* ev = (isMe ? _T("1") : _T("0"));
bool isUrl = false;
std::wstring& mes = UrlHighlightHtml(MakeTextHtmled(message), isUrl);
- if(isUrl)
+ if (isUrl)
ev = _T("2");
EXP_FILE << _T("<div class=mes id=event") << ev << _T(">\n");
EXP_FILE << _T("<div class=nick id=") << id << _T(">") << MakeTextHtmled(user) << _T(":</div>\n");
diff --git a/plugins/BasicHistory/src/RichHtmlExport.cpp b/plugins/BasicHistory/src/RichHtmlExport.cpp
index 3a000f0744..62263145b7 100644
--- a/plugins/BasicHistory/src/RichHtmlExport.cpp
+++ b/plugins/BasicHistory/src/RichHtmlExport.cpp
@@ -59,10 +59,10 @@ std::wstring MakeTextHtmled(const std::wstring& message, std::queue<std::pair<si
}
start = find + 1;
- if(positionMap != NULL)
+ if (positionMap != NULL)
{
size_t len = ret.length() - start - currentAdd;
- if(len != 0)
+ if (len != 0)
{
positionMap->push(std::pair<size_t, size_t>(start + currentAdd, len));
currentAdd += len;
@@ -85,11 +85,11 @@ std::wstring UrlHighlightHtml(const std::wstring& message, bool& isUrl)
{
size_t urlStart = message.find_last_of(htmlStop, find);
size_t urlEnd = message.find_first_of(htmlStop, find + 3);
- if(urlStart >= message.length())
+ if (urlStart >= message.length())
urlStart = -1;
- if(urlEnd >= message.length())
+ if (urlEnd >= message.length())
urlEnd = message.length();
- if(((int)urlEnd -3 - (int)find > 0) && ((int)find - (int)urlStart -1 > 0))
+ if (((int)urlEnd -3 - (int)find > 0) && ((int)find - (int)urlStart -1 > 0))
{
ret += message.substr(start, (urlStart + 1) - start);
std::wstring url = message.substr(urlStart + 1, urlEnd - urlStart - 1);
@@ -112,7 +112,7 @@ std::wstring UrlHighlightHtml(const std::wstring& message, bool& isUrl)
std::wstring RemoveExt(const std::wstring &fileName)
{
size_t find = fileName.find_last_of(L'.');
- if(find < fileName.length())
+ if (find < fileName.length())
{
return fileName.substr(0, find);
}
@@ -123,7 +123,7 @@ std::wstring RemoveExt(const std::wstring &fileName)
std::wstring GetName(const std::wstring &path)
{
size_t find = path.find_last_of(L"\\/");
- if(find < path.length())
+ if (find < path.length())
{
return path.substr(find + 1);
}
@@ -134,17 +134,17 @@ std::wstring GetName(const std::wstring &path)
void ExtractFile(short int res, const std::wstring &fileName)
{
HRSRC rSrc = FindResource(hInst, MAKEINTRESOURCE(res), MAKEINTRESOURCE(CUSTOMRES));
- if(rSrc != NULL)
+ if (rSrc != NULL)
{
HGLOBAL res = LoadResource(hInst, rSrc);
int size = SizeofResource(hInst, rSrc);
- if(res != NULL)
+ if (res != NULL)
{
char* resData = (char*)LockResource(res);
- if(resData != NULL)
+ if (resData != NULL)
{
std::ofstream stream (fileName.c_str(), std::ios_base::binary);
- if(stream.is_open())
+ if (stream.is_open())
{
stream.write(resData, size);
stream.close();
@@ -187,10 +187,10 @@ typedef struct tagMyBITMAPINFO {
void IcoSave(const std::wstring &fileName, HICON hicon)
{
std::ofstream store (fileName.c_str(), std::ios_base::binary);
- if(!store.is_open())
+ if (!store.is_open())
return;
ICONINFO ii;
- if(!GetIconInfo(hicon,&ii))
+ if (!GetIconInfo(hicon,&ii))
{
store.close();
return;
@@ -200,7 +200,7 @@ void IcoSave(const std::wstring &fileName, HICON hicon)
HBITMAP hbmColor = ii.hbmColor;
BITMAP bmiMask;
BITMAP bmiColor;
- if(
+ if (
GetObject(hbmColor,sizeof(bmiColor),&bmiColor) &&
GetObject(hbmMask,sizeof(bmiMask),&bmiMask) &&
(bmiColor.bmWidth==bmiMask.bmWidth) &&
@@ -267,8 +267,8 @@ void IcoSave(const std::wstring &fileName, HICON hicon)
}
store.close();
- if(ii.hbmColor) DeleteObject(ii.hbmColor);
- if(ii.hbmMask ) DeleteObject(ii.hbmMask );
+ if (ii.hbmColor) DeleteObject(ii.hbmColor);
+ if (ii.hbmMask ) DeleteObject(ii.hbmMask );
}
bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true)
@@ -286,7 +286,7 @@ bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true)
fileop.pTo = NULL; // no destination needed
fileop.fFlags = FOF_NOCONFIRMATION|FOF_SILENT; // do not prompt the user
- if(!noRecycleBin)
+ if (!noRecycleBin)
fileop.fFlags |= FOF_ALLOWUNDO;
fileop.fAnyOperationsAborted = FALSE;
@@ -307,12 +307,12 @@ void RichHtmlExport::WriteHeader(const std::wstring &fileName, const std::wstrin
CreateDirectory(folder.c_str(), NULL);
std::wstring css = folder + _T("\\history.css");
BOOL cssCopied = FALSE;
- if(!Options::instance->extCssHtml2.empty())
+ if (!Options::instance->extCssHtml2.empty())
{
cssCopied = CopyFile(Options::instance->extCssHtml2.c_str(), css.c_str(), FALSE);
}
- if(!cssCopied)
+ if (!cssCopied)
ExtractFile(IDR_CSS, css);
ExtractFile(IDR_JS, folder + _T("\\history.js"));
@@ -352,14 +352,14 @@ void RichHtmlExport::WriteHeader(const std::wstring &fileName, const std::wstrin
EXP_FILE << _T("<script language=\"JavaScript\">\n");
EXP_FILE << _T("<!--\n");
EXP_FILE << _T("var menu = document.getElementById(\"menubar\");\n");
- EXP_FILE << _T("if(menu != null)\n");
+ EXP_FILE << _T("if (menu != null)\n");
EXP_FILE << _T(" menu.style.visibility = \"visible\";\n");
EXP_FILE << _T("// -->\n");
EXP_FILE << _T("</script>\n");
EXP_FILE << _T("<h4>") << TranslateT("History Log") << _T("</h4>\n<h3>");
EXP_FILE << MakeTextHtmled(myName);
- if(proto1.length() || myId.length())
+ if (proto1.length() || myId.length())
{
EXP_FILE << _T(" (") << MakeTextHtmled(proto1) << _T(": ") << MakeTextHtmled(myId) << _T(") - ");
}
@@ -369,7 +369,7 @@ void RichHtmlExport::WriteHeader(const std::wstring &fileName, const std::wstrin
}
EXP_FILE << MakeTextHtmled(name1);
- if(proto1.length() || id1.length())
+ if (proto1.length() || id1.length())
{
EXP_FILE << _T(" (") << MakeTextHtmled(proto1) << _T(": ") << MakeTextHtmled(id1) << _T(")</h3>\n");
}
@@ -384,7 +384,7 @@ void RichHtmlExport::WriteHeader(const std::wstring &fileName, const std::wstrin
void RichHtmlExport::WriteFooter()
{
- if(groupId > 0)
+ if (groupId > 0)
{
EXP_FILE << _T("</div>\n");
}
@@ -396,7 +396,7 @@ void RichHtmlExport::WriteGroup(bool isMe, const std::wstring &time, const std::
{
TCHAR *id = isMe ? _T("out") : _T("inc");
TCHAR* ev = (isMe ? _T("1") : _T("0"));
- if(groupId > 0)
+ if (groupId > 0)
{
EXP_FILE << _T("</div>\n");
}
@@ -419,7 +419,7 @@ void RichHtmlExport::WriteMessage(bool isMe, const std::wstring &longDate, const
TCHAR* ev1 = ev;
bool isUrl = false;
std::wstring& mes = ReplaceSmileys(isMe, message, isUrl);
- if(isUrl)
+ if (isUrl)
ev = _T("2");
EXP_FILE << _T("<div class=mes id=event") << ev << _T(">\n");
EXP_FILE << _T("<div class=eventimg id=") << id << _T(">") << _T("<img src=\"") << folderName << _T("\\event") << ev1 << _T(".ico\" class=sessionimage width=\"16\" height=\"16\"/></div>\n");
@@ -433,7 +433,7 @@ void RichHtmlExport::WriteMessage(bool isMe, const std::wstring &longDate, const
std::wstring RichHtmlExport::ReplaceSmileys(bool isMe, const std::wstring &msg, bool &isUrl)
{
- if(Options::instance->exportHtml2UseSmileys && g_SmileyAddAvail)
+ if (Options::instance->exportHtml2UseSmileys && g_SmileyAddAvail)
{
TCHAR* msgbuf = new TCHAR[msg.length() + 1];
memcpy_s(msgbuf, (msg.length() + 1) * sizeof(TCHAR), msg.c_str(), (msg.length() + 1) * sizeof(TCHAR));
@@ -459,7 +459,7 @@ std::wstring RichHtmlExport::ReplaceSmileys(bool isMe, const std::wstring &msg,
size_t last_pos=0;
std::pair<size_t, size_t> pos(0, 0);
size_t currentAdd = 0;
- if(!positionMap.empty())
+ if (!positionMap.empty())
{
pos = positionMap.front();
positionMap.pop();
@@ -472,7 +472,7 @@ std::wstring RichHtmlExport::ReplaceSmileys(bool isMe, const std::wstring &msg,
{
startChar += pos.second;
currentAdd += pos.second;
- if(!positionMap.empty())
+ if (!positionMap.empty())
{
pos = positionMap.front();
positionMap.pop();
@@ -488,7 +488,7 @@ std::wstring RichHtmlExport::ReplaceSmileys(bool isMe, const std::wstring &msg,
{
endChar += pos.second;
currentAdd += pos.second;
- if(!positionMap.empty())
+ if (!positionMap.empty())
{
pos = positionMap.front();
positionMap.pop();
@@ -510,7 +510,7 @@ std::wstring RichHtmlExport::ReplaceSmileys(bool isMe, const std::wstring &msg,
}
std::wstring smileyName = GetName(spr[i].filepath);
- if(smileys.find(smileyName) == smileys.end())
+ if (smileys.find(smileyName) == smileys.end())
{
smileys.insert(smileyName);
CopyFile(spr[i].filepath, (folder + _T("\\") + smileyName).c_str(), FALSE);
diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp
index 686fb2d429..c03709d712 100644
--- a/plugins/BasicHistory/src/Scheduler.cpp
+++ b/plugins/BasicHistory/src/Scheduler.cpp
@@ -91,7 +91,7 @@ int DoLastTask(WPARAM, LPARAM)
{
for(std::vector<TaskOptions>::iterator it = Options::instance->taskOptions.begin(); it != Options::instance->taskOptions.end(); ++it)
{
- if(it->trigerType == TaskOptions::AtEnd && it->active)
+ if (it->trigerType == TaskOptions::AtEnd && it->active)
{
DoTask(*it);
}
@@ -102,140 +102,140 @@ int DoLastTask(WPARAM, LPARAM)
bool IsValidTask(TaskOptions& to, std::list<TaskOptions>* top, std::wstring* err, std::wstring* errDescr)
{
- if(to.taskName.empty())
+ if (to.taskName.empty())
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Name");
return false;
}
- if(top != NULL)
+ if (top != NULL)
{
for(std::list<TaskOptions>::iterator it = top->begin(); it != top->end(); ++it)
{
- if(it->taskName == to.taskName)
+ if (it->taskName == to.taskName)
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Name");
return false;
}
}
}
- if(!to.isSystem && to.contacts.size() == 0)
+ if (!to.isSystem && to.contacts.size() == 0)
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Contacts");
- if(errDescr != NULL)
+ if (errDescr != NULL)
*errDescr = TranslateT("At least one contact should be selected.");
return false;
}
bool isImportTask = to.type == TaskOptions::Import || to.type == TaskOptions::ImportAndMarge;
- if(!isImportTask)
+ if (!isImportTask)
{
- if(to.filterId > 1)
+ if (to.filterId > 1)
{
int filter = 0;
for(int i = 0; i < (int)Options::instance->customFilters.size(); ++i)
{
- if(to.filterName == Options::instance->customFilters[i].name)
+ if (to.filterName == Options::instance->customFilters[i].name)
{
filter = i + 2;
break;
}
}
- if(filter < 2)
+ if (filter < 2)
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Filter");
return false;
}
to.filterId = filter;
}
- else if(to.filterId < 0)
+ else if (to.filterId < 0)
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Filter");
return false;
}
}
- if(to.type == TaskOptions::Delete)
+ if (to.type == TaskOptions::Delete)
{
return true;
}
- if(!Options::FTPAvail() && to.useFtp)
+ if (!Options::FTPAvail() && to.useFtp)
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Upload to FTP");
return false;
}
- if(to.filePath.empty())
+ if (to.filePath.empty())
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Path to output file");
return false;
}
- if(to.useFtp && to.ftpName.empty())
+ if (to.useFtp && to.ftpName.empty())
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Session name");
- if(errDescr != NULL)
+ if (errDescr != NULL)
*errDescr = TranslateT("To create session open WinSCP, click New Session, enter data and save with specific name. Remember if FTP server using password you should save it in WinSCP.");
return false;
}
- if(to.useFtp && (to.filePath.find(_T('\\')) < to.filePath.length() || to.filePath.find(_T(':')) < to.filePath.length() || to.filePath[0] != L'/'))
+ if (to.useFtp && (to.filePath.find(_T('\\')) < to.filePath.length() || to.filePath.find(_T(':')) < to.filePath.length() || to.filePath[0] != L'/'))
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Path to file");
- if(errDescr != NULL)
+ if (errDescr != NULL)
*errDescr = TranslateT("FTP path must contains '/' instead '\\' and starts from '/'.");
return false;
}
- if(isImportTask && to.filePath.find(_T("<date>")) < to.filePath.length())
+ if (isImportTask && to.filePath.find(_T("<date>")) < to.filePath.length())
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Path to file");
- if(errDescr != NULL)
+ if (errDescr != NULL)
*errDescr = TranslateT("FTP path cannot contain <date> in import task.");
return false;
}
- if(!isImportTask && (to.exportType < IExport::RichHtml || to.exportType > IExport::Dat))
+ if (!isImportTask && (to.exportType < IExport::RichHtml || to.exportType > IExport::Dat))
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Export to");
return false;
}
- if(isImportTask && (to.importType < IImport::Binary || to.importType > IImport::Dat))
+ if (isImportTask && (to.importType < IImport::Binary || to.importType > IImport::Dat))
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Import from");
return false;
}
- if((to.trigerType == TaskOptions::Daily || to.trigerType == TaskOptions::Weekly || to.trigerType == TaskOptions::Monthly) && (to.dayTime < 0 || to.dayTime >= 24 * 60))
+ if ((to.trigerType == TaskOptions::Daily || to.trigerType == TaskOptions::Weekly || to.trigerType == TaskOptions::Monthly) && (to.dayTime < 0 || to.dayTime >= 24 * 60))
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Time");
return false;
}
- if(to.trigerType == TaskOptions::Weekly && (to.dayOfWeek < 0 || to.dayOfWeek >= 7))
+ if (to.trigerType == TaskOptions::Weekly && (to.dayOfWeek < 0 || to.dayOfWeek >= 7))
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Day of week");
return false;
}
- if(to.trigerType == TaskOptions::Monthly && (to.dayOfMonth <= 0 || to.dayOfMonth >= 32))
+ if (to.trigerType == TaskOptions::Monthly && (to.dayOfMonth <= 0 || to.dayOfMonth >= 32))
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Day");
return false;
}
- if((to.trigerType == TaskOptions::DeltaMin || to.trigerType == TaskOptions::DeltaHour) && (to.deltaTime < 0 || to.deltaTime >= 10000))
+ if ((to.trigerType == TaskOptions::DeltaMin || to.trigerType == TaskOptions::DeltaHour) && (to.deltaTime < 0 || to.deltaTime >= 10000))
{
- if(err != NULL)
+ if (err != NULL)
*err = TranslateT("Delta time");
return false;
}
@@ -259,12 +259,12 @@ bool DoTask(TaskOptions& to)
{
std::wstring err;
std::wstring errDescr;
- if(!IsValidTask(to, NULL, &err, &errDescr))
+ if (!IsValidTask(to, NULL, &err, &errDescr))
{
TCHAR msg[256];
- if(err.empty())
+ if (err.empty())
_tcscpy_s(msg, TranslateT("Some value is invalid"));
- else if(errDescr.empty())
+ else if (errDescr.empty())
{
mir_sntprintf(msg, SIZEOF(msg), TranslateT("Invalid '%s' value."), err.c_str());
}
@@ -278,11 +278,11 @@ bool DoTask(TaskOptions& to)
DWORD now = time(NULL);
long long int t = to.eventDeltaTime * 60;
- if(to.eventUnit > TaskOptions::Minute)
+ if (to.eventUnit > TaskOptions::Minute)
t *= 60LL;
- if(to.eventUnit > TaskOptions::Hour)
+ if (to.eventUnit > TaskOptions::Hour)
t *= 24LL;
- if(t > 2147483647LL)
+ if (t > 2147483647LL)
{
DoError(to, TranslateT("Unknown error"));
return true;
@@ -291,9 +291,9 @@ bool DoTask(TaskOptions& to)
bool error = false;
std::wstring errorStr;
std::list<ExportManager*> managers;
- if(to.type == TaskOptions::Delete)
+ if (to.type == TaskOptions::Delete)
{
- if(to.isSystem)
+ if (to.isSystem)
{
ExportManager *exp = new ExportManager(NULL, NULL, to.filterId);
exp->SetDeleteWithoutExportEvents(t, now);
@@ -307,7 +307,7 @@ bool DoTask(TaskOptions& to)
managers.push_back(exp);
}
}
- else if(to.type == TaskOptions::Import || to.type == TaskOptions::ImportAndMarge)
+ else if (to.type == TaskOptions::Import || to.type == TaskOptions::ImportAndMarge)
{
std::map<std::wstring, bool> existingContacts1;
ExportManager mExp = ExportManager(NULL, NULL, 1);
@@ -315,7 +315,7 @@ bool DoTask(TaskOptions& to)
std::wstring dir;
std::list<std::wstring> files;
std::vector<HANDLE> contacts;
- if(to.useFtp || to.compress)
+ if (to.useFtp || to.compress)
{
std::map<std::wstring, bool> existingContacts;
TCHAR temp[MAX_PATH];
@@ -326,7 +326,7 @@ bool DoTask(TaskOptions& to)
dir = GetFileName(dir, L"", existingContacts, true);
dir = ReplaceExt(dir, L"");
size_t pos = dir.find_last_of(_T('.'));
- if(pos < dir.length())
+ if (pos < dir.length())
{
dir = dir.substr(0, pos);
}
@@ -336,7 +336,7 @@ bool DoTask(TaskOptions& to)
}
const TCHAR* ext = ExportManager::GetExt(to.importType);
- if(to.isSystem)
+ if (to.isSystem)
{
std::wstring n = GetFileName(filePath, mExp.GetContactName(), existingContacts1, true);
n = ReplaceExt(n, ext);
@@ -353,9 +353,9 @@ bool DoTask(TaskOptions& to)
contacts.push_back(to.contacts[i]);
}
- if(to.useFtp)
+ if (to.useFtp)
{
- if(to.compress)
+ if (to.compress)
{
std::map<std::wstring, bool> existingContacts;
std::wstring n = GetFileName(filePath, L"", existingContacts, true);
@@ -366,9 +366,9 @@ bool DoTask(TaskOptions& to)
}
error = FtpGetFiles(dir, files, to.ftpName);
- if(error)
+ if (error)
{
- if(!errorStr.empty())
+ if (!errorStr.empty())
{
errorStr += L"\n";
}
@@ -377,12 +377,12 @@ bool DoTask(TaskOptions& to)
}
}
- if(!error && to.compress)
+ if (!error && to.compress)
{
error = UnzipFiles(dir, filePath, to.zipPassword);
- if(error)
+ if (error)
{
- if(!errorStr.empty())
+ if (!errorStr.empty())
{
errorStr += L"\n";
}
@@ -390,11 +390,11 @@ bool DoTask(TaskOptions& to)
errorStr += TranslateT("Cannot unzip file(s).");
}
- if(to.useFtp)
+ if (to.useFtp)
DeleteFile(filePath.c_str());
}
- if(!error && (to.useFtp || to.compress))
+ if (!error && (to.useFtp || to.compress))
{
files.clear();
std::list<std::wstring> files1;
@@ -405,16 +405,16 @@ bool DoTask(TaskOptions& to)
}
}
- if(!error)
+ if (!error)
{
std::list<HANDLE> contactList;
for(std::list<std::wstring>::iterator it = files.begin(); it != files.end(); ++it)
{
mExp.SetAutoImport(*it);
int ret = mExp.Import(to.importType, contacts);
- if(ret == -3)
+ if (ret == -3)
{
- if(contacts.size() == 1)
+ if (contacts.size() == 1)
{
ret = 0;
}
@@ -428,19 +428,19 @@ bool DoTask(TaskOptions& to)
std::wstring n = GetFileName(to.filePath, mExp.GetContactName(), existingContacts, true);
n = ReplaceExt(n, ext);
n = GetName(n);
- if(n == name)
+ if (n == name)
break;
}
- if(ret >= (int)contacts.size())
+ if (ret >= (int)contacts.size())
ret = -1;
}
}
- if(ret >= 0)
+ if (ret >= 0)
{
mExp.hContact = contacts[ret];
- if(to.type == TaskOptions::Import)
+ if (to.type == TaskOptions::Import)
{
EventList::AddImporter(mExp.hContact, to.importType, *it);
contactList.push_back(mExp.hContact);
@@ -448,16 +448,16 @@ bool DoTask(TaskOptions& to)
else
{
std::vector<IImport::ExternalMessage> messages;
- if(mExp.Import(to.importType, messages, NULL))
+ if (mExp.Import(to.importType, messages, NULL))
{
mExp.MargeMessages(messages);
contactList.push_back(mExp.hContact);
}
}
}
- else if(ret != -1)
+ else if (ret != -1)
{
- if(!errorStr.empty())
+ if (!errorStr.empty())
{
errorStr += L"\n";
}
@@ -469,7 +469,7 @@ bool DoTask(TaskOptions& to)
}
else
{
- if(!errorStr.empty())
+ if (!errorStr.empty())
{
errorStr += L"\n";
}
@@ -481,7 +481,7 @@ bool DoTask(TaskOptions& to)
}
}
- if(contactList.size() > 0)
+ if (contactList.size() > 0)
{
HANDLE* contacts = new HANDLE[contactList.size() + 1];
contacts[0] = (HANDLE)contactList.size();
@@ -495,7 +495,7 @@ bool DoTask(TaskOptions& to)
}
}
- if(to.useFtp || to.compress)
+ if (to.useFtp || to.compress)
{
DeleteDirectory(dir.c_str());
}
@@ -505,10 +505,10 @@ bool DoTask(TaskOptions& to)
std::map<std::wstring, bool> existingContacts;
std::wstring filePath = to.filePath;
std::wstring dir;
- if(!to.useFtp && !to.compress)
+ if (!to.useFtp && !to.compress)
{
dir = GetDirectoryName(filePath);
- if(!dir.empty())
+ if (!dir.empty())
{
CreateDirectory(dir.c_str(), NULL);
}
@@ -524,7 +524,7 @@ bool DoTask(TaskOptions& to)
dir = GetFileName(dir, L"", existingContacts, true);
dir = ReplaceExt(dir, L"");
size_t pos = dir.find_last_of(_T('.'));
- if(pos < dir.length())
+ if (pos < dir.length())
{
dir = dir.substr(0, pos);
}
@@ -533,15 +533,15 @@ bool DoTask(TaskOptions& to)
CreateDirectory(dir.c_str(), NULL);
filePath = dir + L"\\" + filePath;
}
- if(to.isSystem)
+ if (to.isSystem)
{
ExportManager *exp = new ExportManager(NULL, NULL, to.filterId);
exp->SetAutoExport(GetFileName(filePath, exp->GetContactName(), existingContacts, true), t, now);
exp->useImportedMessages = to.exportImported;
- if(!exp->Export(to.exportType))
+ if (!exp->Export(to.exportType))
{
error = true;
- if(!errorStr.empty())
+ if (!errorStr.empty())
{
errorStr += L"\n";
}
@@ -552,7 +552,7 @@ bool DoTask(TaskOptions& to)
errorStr += msg;
}
- if(to.type == TaskOptions::Export)
+ if (to.type == TaskOptions::Export)
{
delete exp;
}
@@ -562,17 +562,17 @@ bool DoTask(TaskOptions& to)
}
}
- if(!error)
+ if (!error)
{
for(size_t i = 0; i < to.contacts.size(); ++i)
{
ExportManager *exp = new ExportManager(NULL, to.contacts[i], to.filterId);
exp->SetAutoExport(GetFileName(filePath, exp->GetContactName(), existingContacts, true), t, now);
exp->useImportedMessages = to.exportImported;
- if(!exp->Export(to.exportType))
+ if (!exp->Export(to.exportType))
{
error = true;
- if(!errorStr.empty())
+ if (!errorStr.empty())
{
errorStr += L"\n";
}
@@ -584,7 +584,7 @@ bool DoTask(TaskOptions& to)
break;
}
- if(to.type == TaskOptions::Export)
+ if (to.type == TaskOptions::Export)
{
delete exp;
}
@@ -595,21 +595,21 @@ bool DoTask(TaskOptions& to)
}
}
- if(error)
+ if (error)
{
- if(to.compress && !to.useFtp)
+ if (to.compress && !to.useFtp)
{
DeleteDirectory(dir.c_str());
}
}
- else if(to.compress)
+ else if (to.compress)
{
std::wstring zipFilePath = to.filePath;
std::wstring zipDir = dir;
- if(!to.useFtp)
+ if (!to.useFtp)
{
zipDir = GetDirectoryName(zipFilePath);
- if(!zipDir.empty())
+ if (!zipDir.empty())
{
CreateDirectory(zipDir.c_str(), NULL);
}
@@ -629,9 +629,9 @@ bool DoTask(TaskOptions& to)
}
error = ZipFiles(dir + L"\\", zipFilePath, to.zipPassword);
dir = zipDir;
- if(error)
+ if (error)
{
- if(!errorStr.empty())
+ if (!errorStr.empty())
{
errorStr += L"\n";
}
@@ -640,14 +640,14 @@ bool DoTask(TaskOptions& to)
}
}
- if(to.useFtp)
+ if (to.useFtp)
{
- if(!error)
+ if (!error)
{
error = FtpFiles(dir, to.filePath, to.ftpName);
- if(error)
+ if (error)
{
- if(!errorStr.empty())
+ if (!errorStr.empty())
{
errorStr += L"\n";
}
@@ -660,11 +660,11 @@ bool DoTask(TaskOptions& to)
}
}
- if(to.type == TaskOptions::Delete || to.type == TaskOptions::ExportAndDelete)
+ if (to.type == TaskOptions::Delete || to.type == TaskOptions::ExportAndDelete)
{
for(std::list<ExportManager*>::iterator it = managers.begin(); it != managers.end(); ++it)
{
- if(!error)
+ if (!error)
{
(*it)->DeleteExportedEvents();
}
@@ -673,7 +673,7 @@ bool DoTask(TaskOptions& to)
}
}
- if(error)
+ if (error)
{
DoError(to, errorStr.empty() ? TranslateT("Unknown error") : errorStr);
}
@@ -685,11 +685,11 @@ std::wstring GetFileName(const std::wstring &baseName, std::wstring contactName,
{
std::wstring str = baseName;
size_t pos = baseName.find(_T("<contact>"));
- if(replaceContact && pos < baseName.length())
+ if (replaceContact && pos < baseName.length())
{
str = baseName.substr(0, pos);
std::wstring baseName1 = contactName;
- if(!baseName1.empty())
+ if (!baseName1.empty())
{
std::wstring name = baseName1;
int i = 0;
@@ -709,7 +709,7 @@ std::wstring GetFileName(const std::wstring &baseName, std::wstring contactName,
}
pos = str.find(_T("<date>"));
- if(pos < str.length())
+ if (pos < str.length())
{
TCHAR time[256];
SYSTEMTIME st;
@@ -727,7 +727,7 @@ std::wstring GetFileName(const std::wstring &baseName, std::wstring contactName,
std::wstring GetDirectoryName(const std::wstring &path)
{
size_t find = path.find_last_of(L"\\/");
- if(find < path.length())
+ if (find < path.length())
{
return path.substr(0, find);
}
@@ -743,10 +743,10 @@ void ListDirectory(const std::wstring &basePath, const std::wstring &path, std::
return;
do
{
- if(findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ if (findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
std::wstring name = findFileData.cFileName;
- if(name != L"." && name != L"..")
+ if (name != L"." && name != L"..")
ListDirectory(basePath, path + findFileData.cFileName + _T("\\"), files);
}
else
@@ -786,7 +786,7 @@ time_t GetNextExportTime(TaskOptions& to)
t.tm_min = to.dayTime%60;
t.tm_sec = 0;
time_t newTime = mktime(&t);
- if(newTime <= to.lastExport)
+ if (newTime <= to.lastExport)
{
newTime += 60 * 60 * 24;
}
@@ -809,7 +809,7 @@ time_t GetNextExportTime(TaskOptions& to)
newTime = mktime(&t);
}
- if(newTime <= to.lastExport)
+ if (newTime <= to.lastExport)
{
newTime += 7 * 60 * 60 * 24;
}
@@ -832,10 +832,10 @@ time_t GetNextExportTime(TaskOptions& to)
newTime += 60 * 60 * 24;
localtime_s(&t, &newTime);
newTime = mktime(&t);
- if(to.dayOfMonth > 28 && t.tm_mon != lastM && (newTime - 60 * 60 * 24) > to.lastExport)
+ if (to.dayOfMonth > 28 && t.tm_mon != lastM && (newTime - 60 * 60 * 24) > to.lastExport)
{
lastM = t.tm_mon;
- if(to.dayOfMonth > lastD)
+ if (to.dayOfMonth > lastD)
{
newTime -= 60 * 60 * 24;
break;
@@ -856,7 +856,7 @@ time_t GetNextExportTime(TaskOptions& to)
void SchedulerThreadFunc(void*)
{
- if(initTask)
+ if (initTask)
{
WaitForSingleObject(hThreadEvent, 5 * 1000);
initTask = false;
@@ -866,7 +866,7 @@ void SchedulerThreadFunc(void*)
DWORD timeWait;
time_t now = time(NULL);
while(nextExportTime <= now)
- if(!ExecuteCurrentTask(now))
+ if (!ExecuteCurrentTask(now))
return;
time_t dif = nextExportTime - now;
@@ -882,7 +882,7 @@ void StartThread(bool init)
initTask = false;
bool isExport = GetNextExportTime(init, time(NULL));
- if(isExport) {
+ if (isExport) {
finishThread = false;
hThreadEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
hThread = mir_forkthread(SchedulerThreadFunc, NULL);
@@ -891,7 +891,7 @@ void StartThread(bool init)
void StopThread()
{
- if(hThread == NULL)
+ if (hThread == NULL)
return;
finishThread = true;
@@ -908,19 +908,19 @@ bool GetNextExportTime(bool init, time_t now)
bool isExport = false;
for(std::vector<TaskOptions>::iterator it = Options::instance->taskOptions.begin(); it != Options::instance->taskOptions.end(); ++it)
{
- if(it->forceExecute)
+ if (it->forceExecute)
{
nextExportTime = now;
isExport = true;
initTask = init;
break;
}
- else if(it->active && it->trigerType != TaskOptions::AtStart && it->trigerType != TaskOptions::AtEnd)
+ else if (it->active && it->trigerType != TaskOptions::AtStart && it->trigerType != TaskOptions::AtEnd)
{
time_t t = GetNextExportTime(*it);
- if(isExport)
+ if (isExport)
{
- if(t < nextExportTime)
+ if (t < nextExportTime)
nextExportTime = t;
}
else
@@ -930,7 +930,7 @@ bool GetNextExportTime(bool init, time_t now)
initTask = init;
}
}
- else if(it->active && it->trigerType == TaskOptions::AtStart && init)
+ else if (it->active && it->trigerType == TaskOptions::AtStart && init)
{
it->forceExecute = true;
it->showMBAfterExecute = false;
@@ -958,7 +958,7 @@ bool ExecuteCurrentTask(time_t now)
bool isExport = false;
for(std::vector<TaskOptions>::iterator it = Options::instance->taskOptions.begin(); it != Options::instance->taskOptions.end(); ++it)
{
- if(it->forceExecute)
+ if (it->forceExecute)
{
it->lastExport = time(NULL);
Options::instance->SaveTaskTime(*it);
@@ -966,10 +966,10 @@ bool ExecuteCurrentTask(time_t now)
isExport = true;
break;
}
- else if(it->active && it->trigerType != TaskOptions::AtStart && it->trigerType != TaskOptions::AtEnd)
+ else if (it->active && it->trigerType != TaskOptions::AtStart && it->trigerType != TaskOptions::AtEnd)
{
time_t t = GetNextExportTime(*it);
- if(t <= now)
+ if (t <= now)
{
it->lastExport = time(NULL);
Options::instance->SaveTaskTime(*it);
@@ -982,15 +982,15 @@ bool ExecuteCurrentTask(time_t now)
LeaveCriticalSection(&Options::instance->criticalSection);
- if(isExport)
+ if (isExport)
{
bool error = DoTask(to);
- if(to.forceExecute)
+ if (to.forceExecute)
{
EnterCriticalSection(&Options::instance->criticalSection);
for(std::vector<TaskOptions>::iterator it = Options::instance->taskOptions.begin(); it != Options::instance->taskOptions.end(); ++it)
{
- if(it->taskName == to.taskName)
+ if (it->taskName == to.taskName)
{
it->forceExecute = false;
it->showMBAfterExecute = false;
@@ -1000,11 +1000,11 @@ bool ExecuteCurrentTask(time_t now)
LeaveCriticalSection(&Options::instance->criticalSection);
- if(to.showMBAfterExecute)
+ if (to.showMBAfterExecute)
{
size_t size = to.taskName.size() + 1024;
TCHAR* name = new TCHAR[size];
- if(error)
+ if (error)
{
mir_sntprintf(name, size, TranslateT("Task '%s' execution failed"), to.taskName.c_str());
}
@@ -1043,12 +1043,12 @@ bool GetFileCrc(const TCHAR* filenameinzip, unsigned char* buf, unsigned long si
unsigned long calculate_crc = 0;
bool error = true;
HANDLE hFile = CreateFile(filenameinzip, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
- if(hFile != INVALID_HANDLE_VALUE)
+ if (hFile != INVALID_HANDLE_VALUE)
{
DWORD readed;
do
{
- if(!ReadFile(hFile, buf, 1024, &readed, NULL))
+ if (!ReadFile(hFile, buf, 1024, &readed, NULL))
{
error = false;
break;
@@ -1077,7 +1077,7 @@ bool ZipFiles(const std::wstring& dir, std::wstring zipFilePath, const std::stri
std::map<std::wstring, bool> existingContacts;
ListDirectory(dir, L"", files);
bool error = false;
- if(files.size() > 0)
+ if (files.size() > 0)
{
zlib_filefunc_def pzlib_filefunc_def;
fill_win32_filefunc(&pzlib_filefunc_def);
@@ -1094,7 +1094,7 @@ bool ZipFiles(const std::wstring& dir, std::wstring zipFilePath, const std::stri
std::wstring localDir = dir + L"\\" + zipDir;
zip_fileinfo zi = {0};
GetZipFileTime(localDir.c_str(), &zi.dosDate);
- if(zipDir.size() > MAX_PATH + 19)
+ if (zipDir.size() > MAX_PATH + 19)
{
error = true;
break;
@@ -1103,7 +1103,7 @@ bool ZipFiles(const std::wstring& dir, std::wstring zipFilePath, const std::stri
BOOL badChar;
WideCharToMultiByte(CP_OEMCP, WC_NO_BEST_FIT_CHARS, zipDir.c_str(), -1, bufF, MAX_PATH + 20, NULL, &badChar);
int flag = 0;
- if(badChar)
+ if (badChar)
{
flag = 0x800; // UTF
WideCharToMultiByte(CP_UTF8, 0, zipDir.c_str(), -1, bufF, MAX_PATH + 20, NULL, NULL);
@@ -1111,9 +1111,9 @@ bool ZipFiles(const std::wstring& dir, std::wstring zipFilePath, const std::stri
unsigned long calculate_crc = 0;
const char* passwordCh = NULL;
- if(password.size() > 0)
+ if (password.size() > 0)
{
- if(!GetFileCrc(localDir.c_str(), buf, 1024, &calculate_crc))
+ if (!GetFileCrc(localDir.c_str(), buf, 1024, &calculate_crc))
{
error = true;
break;
@@ -1127,13 +1127,13 @@ bool ZipFiles(const std::wstring& dir, std::wstring zipFilePath, const std::stri
if (err == ZIP_OK)
{
HANDLE hFile = CreateFile(localDir.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
- if(hFile != INVALID_HANDLE_VALUE)
+ if (hFile != INVALID_HANDLE_VALUE)
{
DWORD readed;
do
{
err = ZIP_OK;
- if(!ReadFile(hFile, buf, 1024, &readed, NULL))
+ if (!ReadFile(hFile, buf, 1024, &readed, NULL))
{
error = true;
break;
@@ -1148,7 +1148,7 @@ bool ZipFiles(const std::wstring& dir, std::wstring zipFilePath, const std::stri
CloseHandle(hFile);
}
- if(zipCloseFileInZip(zf) != ZIP_OK)
+ if (zipCloseFileInZip(zf) != ZIP_OK)
{
error = true;
break;
@@ -1197,7 +1197,7 @@ bool UnzipFiles(const std::wstring& dir, std::wstring& zipFilePath, const std::s
if (err == UNZ_OK)
{
UINT cp = CP_OEMCP;
- if(file_info.flag & 0x800)// UTF
+ if (file_info.flag & 0x800)// UTF
{
cp = CP_UTF8;
}
@@ -1242,7 +1242,7 @@ bool UnzipFiles(const std::wstring& dir, std::wstring& zipFilePath, const std::s
else
{
const char* passwordCh = NULL;
- if(password.size() > 0)
+ if (password.size() > 0)
{
passwordCh = password.c_str();
}
@@ -1252,7 +1252,7 @@ bool UnzipFiles(const std::wstring& dir, std::wstring& zipFilePath, const std::s
{
CreatePath(GetDirectoryName(fileNameInZip).c_str());
HANDLE hFile = CreateFile(fileNameInZip.c_str(), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL);
- if(hFile != INVALID_HANDLE_VALUE)
+ if (hFile != INVALID_HANDLE_VALUE)
{
DWORD writed;
for (;;)
@@ -1268,7 +1268,7 @@ bool UnzipFiles(const std::wstring& dir, std::wstring& zipFilePath, const std::s
}
CloseHandle(hFile);
- if(err < 0)
+ if (err < 0)
{
error = true;
break;
@@ -1281,7 +1281,7 @@ bool UnzipFiles(const std::wstring& dir, std::wstring& zipFilePath, const std::s
break;
}
- if(unzCloseCurrentFile(zf) != ZIP_OK)
+ if (unzCloseCurrentFile(zf) != ZIP_OK)
{
error = true;
break;
@@ -1317,10 +1317,10 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std::
std::list<std::wstring> files;
std::map<std::wstring, bool> existingContacts;
ListDirectory(dir, L"\\", files);
- if(files.size() > 0)
+ if (files.size() > 0)
{
std::wofstream stream ((dir + _T("\\script.sc")).c_str());
- if(stream.is_open())
+ if (stream.is_open())
{
std::wstring ftpDir = GetDirectoryName(filePath);
ftpDir = GetFileName(ftpDir, L"", existingContacts, false);
@@ -1332,9 +1332,9 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std::
{
std::wstring localDir = *files.begin();
std::wstring currentCD = ftpDir + GetDirectoryName(ReplaceStr(localDir, L'\\', L'/'));
- if(currentCD != lastCD)
+ if (currentCD != lastCD)
{
- if(!currentCD.empty() && currentCD != L"/")
+ if (!currentCD.empty() && currentCD != L"/")
stream << "mkdir \"" << currentCD << "\"\n";
stream << "cd \"" << currentCD << "\"\n";
lastCD = currentCD;
@@ -1356,18 +1356,18 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std::
STARTUPINFO startupInfo = {0};
PROCESS_INFORMATION processInfo;
startupInfo.cb = sizeof(STARTUPINFO);
- if(CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, NULL, dir.c_str(), &startupInfo, &processInfo))
+ if (CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, NULL, dir.c_str(), &startupInfo, &processInfo))
{
WaitForSingleObject(processInfo.hProcess, INFINITE);
CloseHandle(processInfo.hThread);
CloseHandle(processInfo.hProcess);
- if(log.empty())
+ if (log.empty())
{
return false;
}
std::wifstream logStream (log.c_str());
- if(logStream.is_open())
+ if (logStream.is_open())
{
bool isInMDTM = false;
std::list<std::wstring> dates;
@@ -1375,34 +1375,34 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std::
{
std::wstring lineStr;
std::getline(logStream, lineStr);
- if(lineStr.length() > 1)
+ if (lineStr.length() > 1)
{
- if(lineStr[0] == L'>')
+ if (lineStr[0] == L'>')
{
- if(isInMDTM)
+ if (isInMDTM)
{
- if(lineStr.find(L"Script:") < lineStr.length())
+ if (lineStr.find(L"Script:") < lineStr.length())
{
dates.push_back(L"");
isInMDTM = false;
}
}
- if(lineStr.find(L"Script: call MDTM") < lineStr.length())
+ if (lineStr.find(L"Script: call MDTM") < lineStr.length())
{
isInMDTM = true;
}
}
- else if(isInMDTM && lineStr[0] == L'<')
+ else if (isInMDTM && lineStr[0] == L'<')
{
size_t ss = lineStr.find(L"Script: 213 ");
- if(ss < lineStr.length())
+ if (ss < lineStr.length())
{
ss += 12;
- if(ss < lineStr.length())
+ if (ss < lineStr.length())
{
lineStr = lineStr.substr(ss);
- if(lineStr.size() == 14)
+ if (lineStr.size() == 14)
{
dates.push_back(lineStr);
isInMDTM = false;
@@ -1413,12 +1413,12 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std::
}
}
- if(dates.size() > 0 && dates.size() == filSize * 2)
+ if (dates.size() > 0 && dates.size() == filSize * 2)
{
for(std::list<std::wstring>::const_iterator it = dates.begin(); it != dates.end(); ++it)
{
std::wstring date1 = *it++;
- if(it->empty() || date1 == *it)
+ if (it->empty() || date1 == *it)
return true;
}
@@ -1438,7 +1438,7 @@ bool FtpGetFiles(const std::wstring& dir, const std::list<std::wstring>& files,
std::map<std::wstring, bool> existingContacts;
std::wstring script = dir + _T("\\script.sc");
std::wofstream stream (script.c_str());
- if(stream.is_open())
+ if (stream.is_open())
{
stream << "option batch continue\noption confirm off\nopen \""
<< ftpName << "\"\noption transfer binary\n";
@@ -1449,7 +1449,7 @@ bool FtpGetFiles(const std::wstring& dir, const std::list<std::wstring>& files,
std::wstring fileName = GetName(*it);
localFiles.push_back(dir + L"\\" + fileName);
std::wstring currentCD = GetDirectoryName(*it);
- if(currentCD != lastCD)
+ if (currentCD != lastCD)
{
stream << "cd \"" << currentCD << "\"\n";
lastCD = currentCD;
@@ -1467,7 +1467,7 @@ bool FtpGetFiles(const std::wstring& dir, const std::list<std::wstring>& files,
STARTUPINFO startupInfo = {0};
PROCESS_INFORMATION processInfo;
startupInfo.cb = sizeof(STARTUPINFO);
- if(CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, NULL, dir.c_str(), &startupInfo, &processInfo))
+ if (CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, NULL, dir.c_str(), &startupInfo, &processInfo))
{
WaitForSingleObject(processInfo.hProcess, INFINITE);
CloseHandle(processInfo.hThread);
@@ -1478,7 +1478,7 @@ bool FtpGetFiles(const std::wstring& dir, const std::list<std::wstring>& files,
for(std::list<std::wstring>::const_iterator it = localFiles.begin(); it != localFiles.end(); ++it)
{
DWORD atr = GetFileAttributes(it->c_str());
- if(atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY)
+ if (atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY)
{
return true;
}
@@ -1516,7 +1516,7 @@ INT_PTR ExecuteTaskService(WPARAM wParam, LPARAM lParam)
{
EnterCriticalSection(&Options::instance->criticalSection);
int taskNr = (int)wParam;
- if(taskNr < 0 || taskNr >= (int)Options::instance->taskOptions.size())
+ if (taskNr < 0 || taskNr >= (int)Options::instance->taskOptions.size())
{
LeaveCriticalSection(&Options::instance->criticalSection);
return FALSE;
@@ -1533,7 +1533,7 @@ void DoError(const TaskOptions& to, const std::wstring _error)
{
TCHAR msg[256];
mir_sntprintf(msg, SIZEOF(msg), TranslateT("Task '%s' execution failed:"), to.taskName.c_str());
- if(Options::instance->schedulerHistoryAlerts)
+ if (Options::instance->schedulerHistoryAlerts)
{
std::wstring error = msg;
error += L"\n";
@@ -1554,10 +1554,10 @@ void DoError(const TaskOptions& to, const std::wstring _error)
}
- if(Options::instance->schedulerAlerts)
+ if (Options::instance->schedulerAlerts)
{
- if(CallService(MS_SYSTEM_TERMINATED, 0, 0)) return;
- if(ServiceExists(MS_POPUP_ADDPOPUPCLASS))
+ if (CallService(MS_SYSTEM_TERMINATED, 0, 0)) return;
+ if (ServiceExists(MS_POPUP_ADDPOPUPCLASS))
{
ShowClassPopupT(MODULE, msg, (wchar_t*)_error.c_str());
}
diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp
index c93685bcf3..57638e6c6d 100644
--- a/plugins/BasicHistory/src/Searcher.cpp
+++ b/plugins/BasicHistory/src/Searcher.cpp
@@ -33,14 +33,14 @@ Searcher::Searcher()
void Searcher::ChangeFindDirection(bool isBack)
{
- if(isBack != findBack)
+ if (isBack != findBack)
{
findBack = isBack;
ClearFind();
TBBUTTONINFO tbInfo;
tbInfo.cbSize = sizeof(TBBUTTONINFO);
tbInfo.dwMask = TBIF_TEXT | TBIF_IMAGE;
- if(isBack)
+ if (isBack)
{
tbInfo.pszText = TranslateT("Find Previous");
tbInfo.iImage = 1;
@@ -58,7 +58,7 @@ void Searcher::ChangeFindDirection(bool isBack)
void Searcher::ClearFind()
{
- if(lastFindSelection != -1)
+ if (lastFindSelection != -1)
{
SendMessage(context->editWindow,EM_SETOPTIONS,ECOOP_AND,~ECO_NOHIDESEL);
lastFindSelection = -1;
@@ -73,15 +73,15 @@ inline TCHAR mytoupper(TCHAR a, std::locale* loc)
bool Searcher::CompareStr(std::wstring str, TCHAR *strFind)
{
std::locale loc;
- if(!matchCase)
+ if (!matchCase)
std::transform(str.begin(), str.end(), str.begin(), std::bind2nd(std::ptr_fun(mytoupper), &loc));
- if(!matchWholeWords)
+ if (!matchWholeWords)
return str.find(strFind) < str.length();
size_t findid = str.find(strFind);
size_t findLen = _tcslen(strFind);
while(findid < str.length())
{
- if((findid == 0 || std::isspace(str[findid - 1], loc) || std::ispunct(str[findid - 1], loc)) &&
+ if ((findid == 0 || std::isspace(str[findid - 1], loc) || std::ispunct(str[findid - 1], loc)) &&
(findid + findLen >= str.length() || std::isspace(str[findid + findLen], loc) || std::ispunct(str[findid + findLen], loc)))
return true;
findid = str.find(strFind, findid + 1);
@@ -100,7 +100,7 @@ void Searcher::Find()
ft.chrg.cpMin = 0;
ft.chrg.cpMax = -1;
ft.lpstrText = str;
- if(context->currentGroup.size() < 1)
+ if (context->currentGroup.size() < 1)
{
SendMessage(context->editWindow,EM_SETOPTIONS,ECOOP_AND,~ECO_NOHIDESEL);
lastFindSelection = -1;
@@ -108,14 +108,14 @@ void Searcher::Find()
}
GetWindowText(context->findWindow, str, 128);
- if(!str[0])
+ if (!str[0])
{
TCHAR buf[256];
mir_sntprintf(buf, 256, TranslateT("\"%s\" not found"), str);
MessageBox(context->hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
return;
}
- if(!matchCase)
+ if (!matchCase)
{
std::locale loc;
std::transform(str, str + _tcslen(str), str, std::bind2nd(std::ptr_fun(mytoupper), &loc));
@@ -126,16 +126,16 @@ void Searcher::Find()
int adder1 = findBack1 ? -1 : 1;
int adder2 = findBack2 ? -1 : 1;
WPARAM findStyle = (findBack1 ? 0 : FR_DOWN) | (matchCase ? FR_MATCHCASE : 0) | (matchWholeWords ? FR_WHOLEWORD : 0);
- if(lastFindSelection >= 0 && lastFindSelection < (int)context->currentGroup.size())
+ if (lastFindSelection >= 0 && lastFindSelection < (int)context->currentGroup.size())
{
- if(onlyIn && context->currentGroup[lastFindSelection].isMe || onlyOut && !context->currentGroup[lastFindSelection].isMe)
+ if (onlyIn && context->currentGroup[lastFindSelection].isMe || onlyOut && !context->currentGroup[lastFindSelection].isMe)
{
curSel = lastFindSelection + adder1;
}
else
{
SendDlgItemMessage(context->hWnd,IDC_EDIT,EM_EXGETSEL,0,(LPARAM)&ft.chrg);
- if(findBack1)
+ if (findBack1)
{
ft.chrg.cpMin = ft.chrg.cpMin < context->currentGroup[lastFindSelection].endPos ? ft.chrg.cpMin : context->currentGroup[lastFindSelection].endPos;
ft.chrg.cpMax = context->currentGroup[lastFindSelection].startPos;
@@ -146,13 +146,13 @@ void Searcher::Find()
ft.chrg.cpMax = context->currentGroup[lastFindSelection].endPos;
}
SendMessage(context->editWindow,EM_FINDTEXTEX, findStyle,(LPARAM)&ft);
- if(ft.chrgText.cpMin < 0 || ft.chrgText.cpMax < 0)
+ if (ft.chrgText.cpMin < 0 || ft.chrgText.cpMax < 0)
{
curSel = lastFindSelection + adder1;
}
else
{
- if(isFindContactChanged && startFindContact == context->hContact && isFindSelChanged && context->selected == startFindSel && ((!findBack1 && ft.chrg.cpMin >= startFindPos) || (findBack1 && ft.chrg.cpMax <= startFindPos)))
+ if (isFindContactChanged && startFindContact == context->hContact && isFindSelChanged && context->selected == startFindSel && ((!findBack1 && ft.chrg.cpMin >= startFindPos) || (findBack1 && ft.chrg.cpMax <= startFindPos)))
{
finished = true;
}
@@ -174,51 +174,51 @@ void Searcher::Find()
SendMessage(context->editWindow,EM_EXGETSEL,0,(LPARAM)&ft.chrg);
startFindPos = findBack1 ? ft.chrg.cpMin : (ft.chrg.cpMax >= 0 ? ft.chrg.cpMax : ft.chrg.cpMin);
startFindSel = context->selected;
- if(startFindPos < 0)
+ if (startFindPos < 0)
startFindPos = 0;
isFindSelChanged = false;
startFindContact = context->hContact;
isFindContactChanged = !allUsers;
- if(findBack1)
+ if (findBack1)
for(curSel = (int)context->currentGroup.size() - 1; curSel >= 0; --curSel)
{
- if(context->currentGroup[curSel].startPos < startFindPos)
+ if (context->currentGroup[curSel].startPos < startFindPos)
break;
}
else
for(; curSel < (int)context->currentGroup.size(); ++curSel)
{
- if(context->currentGroup[curSel].endPos > startFindPos)
+ if (context->currentGroup[curSel].endPos > startFindPos)
break;
}
}
- if(!finished)
+ if (!finished)
{
for(; curSel < (int)context->currentGroup.size() && curSel >= 0; curSel += adder1)
{
- if(onlyIn && context->currentGroup[curSel].isMe || onlyOut && !context->currentGroup[curSel].isMe)
+ if (onlyIn && context->currentGroup[curSel].isMe || onlyOut && !context->currentGroup[curSel].isMe)
continue;
- if(CompareStr(context->currentGroup[curSel].description, str))
+ if (CompareStr(context->currentGroup[curSel].description, str))
{
- if(findBack1)
+ if (findBack1)
{
ft.chrg.cpMin = context->currentGroup[curSel].endPos;
ft.chrg.cpMax = context->currentGroup[curSel].startPos;
- if(!isFindSelChanged && ft.chrg.cpMin > startFindPos)
+ if (!isFindSelChanged && ft.chrg.cpMin > startFindPos)
ft.chrg.cpMin = startFindPos;
}
else
{
ft.chrg.cpMin = context->currentGroup[curSel].startPos;
ft.chrg.cpMax = context->currentGroup[curSel].endPos;
- if(!isFindSelChanged && ft.chrg.cpMin < startFindPos)
+ if (!isFindSelChanged && ft.chrg.cpMin < startFindPos)
ft.chrg.cpMin = startFindPos;
}
SendMessage(context->editWindow,EM_FINDTEXTEX, findStyle,(LPARAM)&ft);
- if(!(ft.chrgText.cpMin < 0 || ft.chrgText.cpMax < 0))
+ if (!(ft.chrgText.cpMin < 0 || ft.chrgText.cpMax < 0))
{
- if(isFindContactChanged && startFindContact == context->hContact && isFindSelChanged && context->selected == startFindSel && ((!findBack1 && ft.chrg.cpMin >= startFindPos) || (findBack1 && ft.chrg.cpMax <= startFindPos)))
+ if (isFindContactChanged && startFindContact == context->hContact && isFindSelChanged && context->selected == startFindSel && ((!findBack1 && ft.chrg.cpMin >= startFindPos) || (findBack1 && ft.chrg.cpMax <= startFindPos)))
{
finished = true;
break;
@@ -232,17 +232,17 @@ void Searcher::Find()
}
}
- if(isFindContactChanged && startFindContact == context->hContact && isFindSelChanged && context->selected == startFindSel)
+ if (isFindContactChanged && startFindContact == context->hContact && isFindSelChanged && context->selected == startFindSel)
{
finished = true;
}
- if(!finished)
+ if (!finished)
{
isFindSelChanged = true;
- if(onlyGroup)
+ if (onlyGroup)
{
- if(IsInSel(context->selected, str))
+ if (IsInSel(context->selected, str))
{
CHARRANGE ch;
ch.cpMin = ch.cpMax = findBack1 ? MAXLONG : 0;
@@ -256,10 +256,10 @@ void Searcher::Find()
{
for(int sel = context->selected + adder2; ; sel += adder2)
{
- if(sel < 0)
+ if (sel < 0)
{
isFindContactChanged = true;
- if(allUsers)
+ if (allUsers)
{
HANDLE hNext = context->hContact;
do
@@ -272,10 +272,10 @@ void Searcher::Find()
sel = (int)context->eventList.size() - 1;
}
- else if(sel >= (int)context->eventList.size())
+ else if (sel >= (int)context->eventList.size())
{
isFindContactChanged = true;
- if(allUsers)
+ if (allUsers)
{
HANDLE hNext = context->hContact;
do
@@ -288,7 +288,7 @@ void Searcher::Find()
sel = 0;
}
- if(IsInSel(sel, str))
+ if (IsInSel(sel, str))
{
LVITEM item = {0};
item.mask = LVIF_STATE;
@@ -309,18 +309,18 @@ void Searcher::Find()
Find();
return;
}
- if(startFindContact == context->hContact && sel == startFindSel)
+ if (startFindContact == context->hContact && sel == startFindSel)
break;
}
}
}
- if(startFindContact != context->hContact)
+ if (startFindContact != context->hContact)
{
context->SelectContact(startFindContact);
}
- if(startFindSel != context->selected)
+ if (startFindSel != context->selected)
{
LVITEM item = {0};
item.mask = LVIF_STATE;
@@ -340,7 +340,7 @@ void Searcher::Find()
SendMessage(context->editWindow,EM_EXSETSEL,0,(LPARAM)&ft.chrgText);
SendMessage(context->editWindow,EM_SETOPTIONS,ECOOP_AND,~ECO_NOHIDESEL);
lastFindSelection = -1;
- if(isStart)
+ if (isStart)
{
TCHAR buf[256];
GetWindowText(context->findWindow, str, 128);
@@ -355,7 +355,7 @@ void Searcher::Find()
bool Searcher::IsInSel(int sel, TCHAR *strFind)
{
- if(sel < 0 || sel >= (int)context->eventList.size())
+ if (sel < 0 || sel >= (int)context->eventList.size())
return false;
TCHAR str[MAXSELECTSTR + 8]; // for safety reason
@@ -363,13 +363,13 @@ bool Searcher::IsInSel(int sel, TCHAR *strFind)
for(std::deque<EventList::EventIndex>::iterator it = context->eventList[sel].begin(); it != context->eventList[sel].end(); ++it)
{
EventList::EventIndex hDbEvent = *it;
- if(context->GetEventData(hDbEvent, data))
+ if (context->GetEventData(hDbEvent, data))
{
bool isMe = data.isMe;
- if(onlyIn && isMe || onlyOut && !isMe)
+ if (onlyIn && isMe || onlyOut && !isMe)
continue;
context->GetEventMessage(hDbEvent, str);
- if(CompareStr(str, strFind))
+ if (CompareStr(str, strFind))
{
return true;
}
@@ -381,7 +381,7 @@ bool Searcher::IsInSel(int sel, TCHAR *strFind)
bool Searcher::Compare(const bool isMe, const std::wstring& message, TCHAR *strFind)
{
- if(onlyIn && isMe || onlyOut && !isMe)
+ if (onlyIn && isMe || onlyOut && !isMe)
return false;
return CompareStr(message, strFind);
diff --git a/plugins/BasicHistory/src/Searcher.h b/plugins/BasicHistory/src/Searcher.h
index 2f5aff6e8b..274f738082 100644
--- a/plugins/BasicHistory/src/Searcher.h
+++ b/plugins/BasicHistory/src/Searcher.h
@@ -61,13 +61,13 @@ public:
}
void SetOnlyIn(bool val){
onlyIn = val;
- if(val && onlyOut)
+ if (val && onlyOut)
onlyOut = false;
ClearFind();
}
void SetOnlyOut(bool val){
onlyOut = val;
- if(val && onlyIn)
+ if (val && onlyIn)
onlyIn = false;
ClearFind();
}
@@ -79,7 +79,7 @@ public:
}
void SetOnlyGroup(bool val){
onlyGroup = val;
- if(onlyGroup)
+ if (onlyGroup)
allUsers = false;
ClearFind();
}
@@ -88,7 +88,7 @@ public:
}
void SetAllUsers(bool val){
allUsers = val;
- if(allUsers)
+ if (allUsers)
onlyGroup = false;
ClearFind();
}
@@ -96,14 +96,14 @@ public:
return allUsers;
}
void SetSearchForInLG(bool val){
- if(searchForInLG != val)
+ if (searchForInLG != val)
{
searchForInLG = val;
ClearFind();
}
}
void SetSearchForInMes(bool val){
- if(searchForInMes != val)
+ if (searchForInMes != val)
{
searchForInMes = val;
ClearFind();
diff --git a/plugins/BasicHistory/src/TxtExport.cpp b/plugins/BasicHistory/src/TxtExport.cpp
index a5ca8afddf..4009026b14 100644
--- a/plugins/BasicHistory/src/TxtExport.cpp
+++ b/plugins/BasicHistory/src/TxtExport.cpp
@@ -29,7 +29,7 @@ void TxtExport::WriteHeader(const std::wstring &fileName, const std::wstring &fi
TCHAR* start = TranslateT("###");
EXP_FILE << start << "\n" << start << _T(" ") << TranslateT("History Log") << _T("\n");
EXP_FILE << start << _T(" ") << myName;
- if(proto1.length() || myId.length())
+ if (proto1.length() || myId.length())
{
EXP_FILE << _T(" (") << proto1 << _T(": ") << myId << _T(") - ");
}
@@ -39,7 +39,7 @@ void TxtExport::WriteHeader(const std::wstring &fileName, const std::wstring &fi
}
EXP_FILE << name1;
- if(proto1.length() || id1.length())
+ if (proto1.length() || id1.length())
{
EXP_FILE << _T(" (") << proto1 << _T(": ") << id1 << _T(")\n");
}
diff --git a/plugins/BasicHistory/src/codecvt_CodePage.h b/plugins/BasicHistory/src/codecvt_CodePage.h
index 37b6b7d26f..c93a0fdf22 100644
--- a/plugins/BasicHistory/src/codecvt_CodePage.h
+++ b/plugins/BasicHistory/src/codecvt_CodePage.h
@@ -53,9 +53,9 @@ protected:
_Mid2 = _First2;
int conv = WideCharToMultiByte(codePage, 0, _First1, _Last1 - _First1, _First2, _Last2 - _First2, NULL, NULL);
- if(conv == 0)
+ if (conv == 0)
{
- if(GetLastError() == ERROR_INSUFFICIENT_BUFFER)
+ if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
return (_Mybase::partial);
else
return (_Mybase::error);