summaryrefslogtreecommitdiff
path: root/plugins/BasicHistory
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-08-12 21:05:10 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-08-12 21:05:10 +0000
commitfff85d59848d265184c80bd6276923b503df95f8 (patch)
treecd9efd8cfd38dc8ff731624d218a3c2fbc53cffc /plugins/BasicHistory
parentd4c37690295db5515f19a8b1cd221b4222f16eeb (diff)
naming conflics resolved
git-svn-id: http://svn.miranda-ng.org/main/trunk@14933 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BasicHistory')
-rw-r--r--plugins/BasicHistory/src/EventList.cpp323
-rw-r--r--plugins/BasicHistory/src/EventList.h52
-rw-r--r--plugins/BasicHistory/src/ExportManager.cpp107
-rw-r--r--plugins/BasicHistory/src/ExportManager.h29
-rw-r--r--plugins/BasicHistory/src/HistoryWindow.cpp851
-rw-r--r--plugins/BasicHistory/src/Options.cpp28
-rw-r--r--plugins/BasicHistory/src/PlainHtmlExport.cpp2
-rw-r--r--plugins/BasicHistory/src/RichHtmlExport.cpp10
-rw-r--r--plugins/BasicHistory/src/Scheduler.cpp141
-rw-r--r--plugins/BasicHistory/src/Searcher.cpp32
10 files changed, 723 insertions, 852 deletions
diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp
index b6b5ec7a02..8dd5516bcc 100644
--- a/plugins/BasicHistory/src/EventList.cpp
+++ b/plugins/BasicHistory/src/EventList.cpp
@@ -29,56 +29,56 @@ static mir_cs csEventList;
bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true);
std::wstring GetName(const std::wstring &path);
-HistoryEventList::HistoryEventList()
- :hWnd(NULL),
- isWnd(false),
- hContact(NULL),
- deltaTime(0),
- isFlat(false),
- useImportedMessages(true)
-{
- memset(&gdbei, 0, sizeof(DBEVENTINFO));
- gdbei.cbSize = sizeof(DBEVENTINFO);
- goldBlobSize = 0;
-}
-
-HistoryEventList::HistoryEventList(MCONTACT _hContact, int filter)
- :hWnd(NULL),
- isWnd(false),
- hContact(_hContact),
- deltaTime(0),
- isFlat(false),
- useImportedMessages(true)
-{
- memset(&gdbei, 0, sizeof(DBEVENTINFO));
- gdbei.cbSize = sizeof(DBEVENTINFO);
- goldBlobSize = 0;
+HistoryEventList::HistoryEventList() :
+ m_hWnd(NULL),
+ m_isWnd(false),
+ m_hContact(NULL),
+ m_deltaTime(0),
+ m_isFlat(false),
+ m_useImportedMessages(true)
+{
+ memset(&m_dbei, 0, sizeof(DBEVENTINFO));
+ m_dbei.cbSize = sizeof(DBEVENTINFO);
+ m_oldBlobSize = 0;
+}
+
+HistoryEventList::HistoryEventList(MCONTACT _hContact, int filter) :
+ m_hWnd(NULL),
+ m_isWnd(false),
+ m_hContact(_hContact),
+ m_deltaTime(0),
+ m_isFlat(false),
+ m_useImportedMessages(true)
+{
+ memset(&m_dbei, 0, sizeof(DBEVENTINFO));
+ m_dbei.cbSize = sizeof(DBEVENTINFO);
+ m_oldBlobSize = 0;
SetDefFilter(filter);
}
HistoryEventList::~HistoryEventList()
{
- mir_free(gdbei.pBlob);
- eventList.clear();
+ mir_free(m_dbei.pBlob);
+ m_eventList.clear();
}
bool HistoryEventList::CanShowHistory(DBEVENTINFO* dbei)
{
- if (deltaTime != 0) {
- if (deltaTime > 0) {
- if (now - deltaTime < dbei->timestamp)
+ if (m_deltaTime != 0) {
+ if (m_deltaTime > 0) {
+ if (m_now - m_deltaTime < dbei->timestamp)
return false;
}
else {
- if (now + deltaTime > dbei->timestamp)
+ if (m_now + m_deltaTime > dbei->timestamp)
return false;
}
}
- if (hContact == NULL || defFilter == 1)
+ if (m_hContact == NULL || m_defFilter == 1)
return true;
- if (defFilter < 1) {
+ if (m_defFilter < 1) {
switch(dbei->eventType) {
case EVENTTYPE_MESSAGE:
case EVENTTYPE_URL:
@@ -94,11 +94,11 @@ bool HistoryEventList::CanShowHistory(DBEVENTINFO* dbei)
return false;
}
- if (filterMap.find(dbei->eventType) != filterMap.end()) {
- if (onlyInFilter)
+ if (m_filterMap.find(dbei->eventType) != m_filterMap.end()) {
+ if (m_onlyInFilter)
return !(dbei->flags & DBEF_SENT);
- if (onlyOutFilter)
+ if (m_onlyOutFilter)
return (dbei->flags & DBEF_SENT) != 0;
return true;
@@ -106,23 +106,23 @@ bool HistoryEventList::CanShowHistory(DBEVENTINFO* dbei)
return false;
}
-bool HistoryEventList::CanShowHistory(const IImport::ExternalMessage& message)
+bool HistoryEventList::CanShowHistory(const IImport::ExternalMessage &message)
{
- if (deltaTime != 0) {
- if (deltaTime > 0) {
- if (now - deltaTime < message.timestamp)
+ if (m_deltaTime != 0) {
+ if (m_deltaTime > 0) {
+ if (m_now - m_deltaTime < message.timestamp)
return false;
}
else {
- if (now + deltaTime > message.timestamp)
+ if (m_now + m_deltaTime > message.timestamp)
return false;
}
}
- if (hContact == NULL || defFilter == 1)
+ if (m_hContact == NULL || m_defFilter == 1)
return true;
- if (defFilter < 1) {
+ if (m_defFilter < 1) {
switch(message.eventType ) {
case EVENTTYPE_MESSAGE:
case EVENTTYPE_URL:
@@ -133,11 +133,11 @@ bool HistoryEventList::CanShowHistory(const IImport::ExternalMessage& message)
return false;
}
- if (filterMap.find(message.eventType) != filterMap.end()) {
- if (onlyInFilter)
+ if (m_filterMap.find(message.eventType) != m_filterMap.end()) {
+ if (m_onlyInFilter)
return !(message.flags & DBEF_SENT);
- if (onlyOutFilter)
+ if (m_onlyOutFilter)
return (message.flags & DBEF_SENT) != 0;
return true;
@@ -147,79 +147,79 @@ bool HistoryEventList::CanShowHistory(const IImport::ExternalMessage& message)
void HistoryEventList::InitFilters()
{
- filterMap.clear();
- onlyInFilter = false;
- onlyOutFilter = false;
- if (defFilter >= 2) {
- defFilter = 0;
+ m_filterMap.clear();
+ m_onlyInFilter = false;
+ m_onlyOutFilter = false;
+ if (m_defFilter >= 2) {
+ m_defFilter = 0;
for (int i = 0; i < (int)Options::instance->customFilters.size(); ++i) {
- if (filterName == Options::instance->customFilters[i].name) {
- defFilter = i + 2;
+ if (m_filterName == Options::instance->customFilters[i].name) {
+ m_defFilter = i + 2;
if (Options::instance->customFilters[i].onlyIncomming && !Options::instance->customFilters[i].onlyOutgoing)
- onlyInFilter = true;
+ m_onlyInFilter = true;
else if (Options::instance->customFilters[i].onlyOutgoing && !Options::instance->customFilters[i].onlyIncomming)
- onlyOutFilter = true;
+ m_onlyOutFilter = true;
for (std::vector<int>::iterator it = Options::instance->customFilters[i].events.begin(); it != Options::instance->customFilters[i].events.end(); ++it)
- filterMap[*it] = true;
+ m_filterMap[*it] = true;
break;
}
}
}
- else filterName = L"";
+ else m_filterName = L"";
}
void HistoryEventList::SetDefFilter(int filter)
{
- defFilter = filter;
+ m_defFilter = filter;
if (filter >= 2 && filter - 2 < (int)Options::instance->customFilters.size())
- filterName = Options::instance->customFilters[filter - 2].name;
+ m_filterName = Options::instance->customFilters[filter - 2].name;
else if (filter == 1)
- filterName = TranslateT("All events");
+ m_filterName = TranslateT("All events");
else
- filterName = TranslateT("Default history events");
+ m_filterName = TranslateT("Default history events");
}
int HistoryEventList::GetFilterNr()
{
- return defFilter;
+ return m_defFilter;
}
std::wstring HistoryEventList::GetFilterName()
{
- return filterName;
+ return m_filterName;
}
-void HistoryEventList::GetTempList(std::list<EventTempIndex>& tempList, bool noFilter, bool noExt, MCONTACT _hContact)
+void HistoryEventList::GetTempList(std::list<EventTempIndex>& tempList, bool noFilter, bool noExt, MCONTACT hContact)
{
- bool isWndLocal = isWnd;
+ bool isWndLocal = m_isWnd;
EventTempIndex ti;
EventData data;
EventIndex ei;
ti.isExternal = false;
ei.isExternal = false;
- MEVENT hDbEvent = db_event_first(_hContact);
+ MEVENT hDbEvent = db_event_first(hContact);
while (hDbEvent != NULL) {
- if (isWndLocal && !IsWindow(hWnd))
+ if (isWndLocal && !IsWindow(m_hWnd))
break;
ei.hEvent = hDbEvent;
if (GetEventData(ei, data)) {
- if (noFilter || CanShowHistory(&gdbei)) {
+ if (noFilter || CanShowHistory(&m_dbei)) {
ti.hEvent = hDbEvent;
ti.timestamp = data.timestamp;
tempList.push_back(ti);
}
}
- hDbEvent = db_event_next(_hContact, hDbEvent);
+ hDbEvent = db_event_next(hContact, hDbEvent);
}
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])) {
- DWORD ts = importedMessages[i].timestamp;
+ for (int i = 0; i < (int)m_importedMessages.size(); ++i) {
+ if (noFilter || CanShowHistory(m_importedMessages[i])) {
+ DWORD ts = m_importedMessages[i].timestamp;
while(itL != tempList.end() && itL->timestamp < ts)++itL;
if (itL == tempList.end() || itL->timestamp > ts) {
ti.exIdx = i;
@@ -236,13 +236,13 @@ void HistoryEventList::RefreshEventList()
InitNames();
InitFilters();
- if (useImportedMessages) {
+ if (m_useImportedMessages) {
std::vector<IImport::ExternalMessage> messages;
{
mir_cslock lck(csEventList);
- std::map<MCONTACT, HistoryEventList::ImportDiscData>::iterator it = contactFileMap.find(hContact);
- if (it != contactFileMap.end()) {
- ExportManager imp(hWnd, hContact, 1);
+ std::map<MCONTACT, HistoryEventList::ImportDiscData>::iterator it = m_contactFileMap.find(m_hContact);
+ if (it != m_contactFileMap.end()) {
+ ExportManager imp(m_hWnd, m_hContact, 1);
imp.SetAutoImport(it->second.file);
if (!imp.Import(it->second.type, messages, NULL))
messages.clear();
@@ -252,7 +252,7 @@ void HistoryEventList::RefreshEventList()
}
std::list<EventTempIndex> tempList;
- GetTempList(tempList, false, false, hContact);
+ GetTempList(tempList, false, false, m_hContact);
std::list<EventTempIndex> revTempList;
std::list<EventTempIndex>& nrTempList = tempList;
bool isNewOnTop = Options::instance->groupNewOnTop;
@@ -261,8 +261,8 @@ void HistoryEventList::RefreshEventList()
nrTempList = revTempList;
}
- eventList.clear();
- eventList.push_back(std::deque<EventIndex>());
+ m_eventList.clear();
+ m_eventList.push_back(std::deque<EventIndex>());
DWORD lastTime = MAXDWORD;
DWORD groupTime = Options::instance->groupTime * 60 * 60;
int maxMess = Options::instance->groupMessagesNumber;
@@ -270,32 +270,32 @@ void HistoryEventList::RefreshEventList()
EventIndex ei;
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 (m_isFlat || tm < groupTime && limitator < maxMess) {
lastTime = itL->timestamp;
ei.isExternal = itL->isExternal;
ei.hEvent = itL->hEvent;
if (isNewOnTop)
- eventList.back().push_front(ei);
+ m_eventList.back().push_front(ei);
else
- eventList.back().push_back(ei);
+ m_eventList.back().push_back(ei);
++limitator;
}
else {
limitator = 0;
lastTime = itL->timestamp;
- if (!eventList.back().empty()) {
- ei = eventList.back().front();
+ if (!m_eventList.back().empty()) {
+ ei = m_eventList.back().front();
AddGroup(ei);
- eventList.push_back(std::deque<EventIndex>());
+ m_eventList.push_back(std::deque<EventIndex>());
}
ei.isExternal = itL->isExternal;
ei.hEvent = itL->hEvent;
- eventList.back().push_front(ei);
+ m_eventList.back().push_front(ei);
}
}
- if (!eventList.back().empty()) {
- ei = eventList.back().front();
+ if (!m_eventList.back().empty()) {
+ ei = m_eventList.back().front();
AddGroup(ei);
}
}
@@ -304,21 +304,21 @@ bool HistoryEventList::SearchInContact(MCONTACT hContact, TCHAR *strFind, Compar
{
InitFilters();
- if (useImportedMessages) {
+ if (m_useImportedMessages) {
std::vector<IImport::ExternalMessage> messages;
{
mir_cslock lck(csEventList);
- std::map<MCONTACT, HistoryEventList::ImportDiscData>::iterator it = contactFileMap.find(hContact);
- if (it != contactFileMap.end()) {
- ExportManager imp(hWnd, hContact, 1);
+ std::map<MCONTACT, HistoryEventList::ImportDiscData>::iterator it = m_contactFileMap.find(hContact);
+ if (it != m_contactFileMap.end()) {
+ ExportManager imp(m_hWnd, hContact, 1);
imp.SetAutoImport(it->second.file);
if (!imp.Import(it->second.type, messages, NULL))
messages.clear();
}
}
- for (int i = 0; i < (int)importedMessages.size(); ++i)
- if (compFun->Compare((importedMessages[i].flags & DBEF_SENT) != 0, importedMessages[i].message, strFind))
+ for (int i = 0; i < (int)m_importedMessages.size(); ++i)
+ if (compFun->Compare((m_importedMessages[i].flags & DBEF_SENT) != 0, m_importedMessages[i].message, strFind))
return true;
}
@@ -344,19 +344,19 @@ bool HistoryEventList::SearchInContact(MCONTACT hContact, TCHAR *strFind, Compar
void HistoryEventList::InitNames()
{
TCHAR str[200];
- if (hContact) {
- _tcscpy_s(contactName, 256, pcli->pfnGetContactDisplayName(hContact, 0));
- mir_sntprintf(str, _countof(str), TranslateT("History for %s"),contactName);
+ if (m_hContact) {
+ _tcscpy_s(m_contactName, pcli->pfnGetContactDisplayName(m_hContact, 0));
+ mir_sntprintf(str, _countof(str), TranslateT("History for %s"), m_contactName);
}
else {
- _tcscpy_s(contactName, 256, TranslateT("System"));
+ _tcscpy_s(m_contactName, TranslateT("System"));
mir_sntprintf(str, _countof(str), TranslateT("History"));
}
- if (isWnd)
- SetWindowText(hWnd,str);
+ if (m_isWnd)
+ SetWindowText(m_hWnd, str);
- _tcscpy_s(myName, GetMyName().c_str());
+ _tcscpy_s(m_myName, GetMyName().c_str());
}
void HistoryEventList::AddGroup(const EventIndex& ev)
@@ -370,9 +370,9 @@ void HistoryEventList::AddGroup(const EventIndex& ev)
std::wstring time = eventText;
std::wstring user;
if (data.isMe)
- user = myName;
+ user = m_myName;
else
- user = contactName;
+ user = m_contactName;
GetEventMessage(ev, eventText, 256);
for (i = 0; eventText[i] != 0 && eventText[i] != _T('\r') && eventText[i] != _T('\n'); ++i);
eventText[i] = 0;
@@ -390,8 +390,8 @@ void HistoryEventList::AddGroup(const EventIndex& ev)
std::wstring HistoryEventList::GetContactName()
{
- if (hContact)
- return pcli->pfnGetContactDisplayName(hContact, 0);
+ if (m_hContact)
+ return pcli->pfnGetContactDisplayName(m_hContact, 0);
return TranslateT("System");
}
@@ -400,17 +400,17 @@ void GetInfo(CONTACTINFO& ci, std::wstring& str)
{
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
if (ci.type == CNFT_ASCIIZ) {
- str = ci.pszVal;
+ str = ci.pszVal;
mir_free(ci.pszVal);
}
else if (ci.type == CNFT_DWORD) {
TCHAR buf[20];
- _ltot_s(ci.dVal, buf, 10 );
+ _ltot_s(ci.dVal, buf, 10);
str = buf;
}
else if (ci.type == CNFT_WORD) {
TCHAR buf[20];
- _ltot_s(ci.wVal, buf, 10 );
+ _ltot_s(ci.wVal, buf, 10);
str = buf;
}
}
@@ -422,7 +422,7 @@ std::wstring HistoryEventList::GetMyName()
CONTACTINFO ci;
memset(&ci, 0, sizeof(ci));
ci.cbSize = sizeof(ci);
- ci.szProto = GetContactProto(hContact);
+ ci.szProto = GetContactProto(m_hContact);
ci.hContact = 0;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
GetInfo(ci, myName);
@@ -450,12 +450,12 @@ inline std::wstring GetProtocolName(MCONTACT hContact)
std::wstring HistoryEventList::GetProtocolName()
{
- return ::GetProtocolName(hContact);
+ return ::GetProtocolName(m_hContact);
}
std::string HistoryEventList::GetBaseProtocol()
{
- char* proto = GetContactProto(hContact);
+ char* proto = GetContactProto(m_hContact);
return proto == NULL ? "" : proto;
}
@@ -465,7 +465,7 @@ std::wstring HistoryEventList::GetMyId()
CONTACTINFO ci;
memset(&ci, 0, sizeof(ci));
ci.cbSize = sizeof(ci);
- ci.szProto = GetContactProto(hContact);
+ ci.szProto = GetContactProto(m_hContact);
ci.hContact = 0;
ci.dwFlag = CNF_DISPLAYUID | CNF_TCHAR;
GetInfo(ci, myId);
@@ -487,10 +487,10 @@ inline std::wstring GetContactId(MCONTACT hContact)
std::wstring HistoryEventList::GetContactId()
{
- return ::GetContactId(hContact);
+ return ::GetContactId(m_hContact);
}
-static void GetMessageDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf )
+static void GetMessageDescription(DBEVENTINFO *dbei, TCHAR* buf, int cbBuf)
{
TCHAR *msg = DbGetEventTextT(dbei, CP_ACP);
_tcsncpy_s(buf, cbBuf, msg ? msg : TranslateT("Invalid Message"), _TRUNCATE);
@@ -498,14 +498,14 @@ static void GetMessageDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf )
mir_free(msg);
}
-void HistoryEventList::GetObjectDescription( DBEVENTINFO *dbei, TCHAR* str, int cbStr )
+void HistoryEventList::GetObjectDescription(DBEVENTINFO *dbei, TCHAR* str, int cbStr)
{
- GetMessageDescription( dbei, str, cbStr );
+ GetMessageDescription(dbei, str, cbStr);
}
bool HistoryEventList::GetEventIcon(bool isMe, int eventType, int &id)
{
- switch(eventType) {
+ switch (eventType) {
case EVENTTYPE_MESSAGE:
id = isMe ? 1 : 0;
return true;
@@ -527,14 +527,13 @@ bool HistoryEventList::GetEventIcon(bool isMe, int eventType, int &id)
void HistoryEventList::ImportMessages(const std::vector<IImport::ExternalMessage>& messages)
{
DWORD lastTime = 0;
- importedMessages.clear();
+ m_importedMessages.clear();
for (int i = 0; i < (int)messages.size(); ++i) {
if (messages[i].timestamp >= lastTime) {
- importedMessages.push_back(messages[i]);
+ m_importedMessages.push_back(messages[i]);
lastTime = messages[i].timestamp;
}
- else
- {
+ else {
assert(FALSE);
}
}
@@ -544,15 +543,15 @@ void HistoryEventList::MargeMessages(const std::vector<IImport::ExternalMessage>
{
ImportMessages(messages);
std::list<EventTempIndex> tempList;
- GetTempList(tempList, true, false, hContact);
+ GetTempList(tempList, true, false, m_hContact);
DBEVENTINFO dbei = { sizeof(dbei) };
- dbei.szModule = GetContactProto(hContact);
+ dbei.szModule = GetContactProto(m_hContact);
CallService(MS_DB_SETSAFETYMODE, FALSE, 0);
for (std::list<EventTempIndex>::iterator it = tempList.begin(); it != tempList.end(); ++it) {
if (it->isExternal) {
- IImport::ExternalMessage& msg = importedMessages[it->exIdx];
+ IImport::ExternalMessage& msg = m_importedMessages[it->exIdx];
dbei.flags |= DBEF_READ;
dbei.timestamp = msg.timestamp;
// For now I do not convert event data from string to blob, and event type must be message to handle it properly
@@ -562,8 +561,8 @@ void HistoryEventList::MargeMessages(const std::vector<IImport::ExternalMessage>
char* buf = new char[dbei.cbBlob];
dbei.cbBlob = WideCharToMultiByte(cp, 0, msg.message.c_str(), (int)msg.message.length() + 1, buf, dbei.cbBlob, NULL, NULL);
dbei.pBlob = (PBYTE)buf;
- db_event_add(hContact, &dbei);
- delete [] buf;
+ db_event_add(m_hContact, &dbei);
+ delete[] buf;
}
}
@@ -576,21 +575,21 @@ bool HistoryEventList::GetEventData(const EventIndex& ev, EventData& data)
{
if (!ev.isExternal) {
DWORD newBlobSize = db_event_getBlobSize(ev.hEvent);
- if (newBlobSize > goldBlobSize) {
- gdbei.pBlob = (PBYTE)mir_realloc(gdbei.pBlob,newBlobSize);
- goldBlobSize = newBlobSize;
+ if (newBlobSize > m_oldBlobSize) {
+ m_dbei.pBlob = (PBYTE)mir_realloc(m_dbei.pBlob, newBlobSize);
+ m_oldBlobSize = newBlobSize;
}
- gdbei.cbBlob = goldBlobSize;
- if (db_event_get(ev.hEvent, &gdbei) == 0) {
- data.isMe = (gdbei.flags & DBEF_SENT) != 0;
- data.eventType = gdbei.eventType;
- data.timestamp = gdbei.timestamp;
+ m_dbei.cbBlob = m_oldBlobSize;
+ if (db_event_get(ev.hEvent, &m_dbei) == 0) {
+ data.isMe = (m_dbei.flags & DBEF_SENT) != 0;
+ data.eventType = m_dbei.eventType;
+ data.timestamp = m_dbei.timestamp;
return true;
}
}
- else if (ev.exIdx >= 0 && ev.exIdx < (int)importedMessages.size()) {
- IImport::ExternalMessage& em = importedMessages[ev.exIdx];
+ else if (ev.exIdx >= 0 && ev.exIdx < (int)m_importedMessages.size()) {
+ IImport::ExternalMessage& em = m_importedMessages[ev.exIdx];
data.isMe = (em.flags & DBEF_SENT) != 0;
data.eventType = em.eventType;
data.timestamp = em.timestamp;
@@ -602,18 +601,18 @@ bool HistoryEventList::GetEventData(const EventIndex& ev, EventData& data)
void HistoryEventList::GetExtEventDBei(const EventIndex& ev)
{
- IImport::ExternalMessage& em = importedMessages[ev.exIdx];
- gdbei.flags = em.flags | 0x800;
- gdbei.eventType = em.eventType;
- gdbei.timestamp = em.timestamp;
+ IImport::ExternalMessage& em = m_importedMessages[ev.exIdx];
+ m_dbei.flags = em.flags | 0x800;
+ m_dbei.eventType = em.eventType;
+ m_dbei.timestamp = em.timestamp;
}
HICON HistoryEventList::GetEventCoreIcon(const EventIndex& ev)
{
if (ev.isExternal)
return NULL;
-
- HICON ico = (HICON)CallService(MS_DB_EVENT_GETICON, LR_SHARED, (LPARAM)&gdbei);
+
+ HICON ico = (HICON)CallService(MS_DB_EVENT_GETICON, LR_SHARED, (LPARAM)&m_dbei);
HICON icoMsg = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
if (icoMsg == ico)
return NULL;
@@ -624,21 +623,21 @@ HICON HistoryEventList::GetEventCoreIcon(const EventIndex& ev)
void HistoryEventList::RebuildGroup(int selected)
{
std::deque<EventIndex> newGroup;
- for (size_t i = 0; i < eventList[selected].size(); ++i) {
- EventIndex& ev = eventList[selected][i];
+ for (size_t i = 0; i < m_eventList[selected].size(); ++i) {
+ EventIndex& ev = m_eventList[selected][i];
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]);
+ newGroup.push_back(m_eventList[selected][i]);
}
- else newGroup.push_back(eventList[selected][i]);
+ else newGroup.push_back(m_eventList[selected][i]);
}
- eventList[selected].clear();
- eventList[selected].insert(eventList[selected].begin(), newGroup.begin(), newGroup.end());
+ m_eventList[selected].clear();
+ m_eventList[selected].insert(m_eventList[selected].begin(), newGroup.begin(), newGroup.end());
}
-std::map<MCONTACT, HistoryEventList::ImportDiscData> HistoryEventList::contactFileMap;
-std::wstring HistoryEventList::contactFileDir;
+std::map<MCONTACT, HistoryEventList::ImportDiscData> HistoryEventList::m_contactFileMap;
+std::wstring HistoryEventList::m_contactFileDir;
void HistoryEventList::AddImporter(MCONTACT hContact, IImport::ImportType type, const std::wstring& file)
{
@@ -647,10 +646,10 @@ void HistoryEventList::AddImporter(MCONTACT hContact, IImport::ImportType type,
TCHAR buf[32];
mir_sntprintf(buf, _T("%016llx"), (unsigned long long int)hContact);
ImportDiscData data;
- data.file = contactFileDir + buf;
+ data.file = m_contactFileDir + buf;
data.type = type;
CopyFile(file.c_str(), data.file.c_str(), FALSE);
- contactFileMap[hContact] = data;
+ m_contactFileMap[hContact] = data;
}
void HistoryEventList::Init()
@@ -658,10 +657,10 @@ void HistoryEventList::Init()
TCHAR temp[MAX_PATH];
temp[0] = 0;
GetTempPath(MAX_PATH, temp);
- contactFileDir = temp;
- contactFileDir += L"BasicHistoryImportDir\\";
- DeleteDirectory(contactFileDir.c_str());
- CreateDirectory(contactFileDir.c_str(), NULL);
+ m_contactFileDir = temp;
+ m_contactFileDir += L"BasicHistoryImportDir\\";
+ DeleteDirectory(m_contactFileDir.c_str());
+ CreateDirectory(m_contactFileDir.c_str(), NULL);
}
int HistoryEventList::GetContactMessageNumber(MCONTACT hContact)
@@ -669,8 +668,8 @@ int HistoryEventList::GetContactMessageNumber(MCONTACT hContact)
int count = db_event_count(hContact);
mir_cslock lck(csEventList);
- std::map<MCONTACT, HistoryEventList::ImportDiscData>::iterator it = contactFileMap.find(hContact);
- if (it != contactFileMap.end())
+ std::map<MCONTACT, HistoryEventList::ImportDiscData>::iterator it = m_contactFileMap.find(hContact);
+ if (it != m_contactFileMap.end())
++count;
return count;
}
@@ -680,8 +679,8 @@ bool HistoryEventList::IsImportedHistory(MCONTACT hContact)
bool count = false;
mir_cslock lck(csEventList);
- std::map<MCONTACT, HistoryEventList::ImportDiscData>::iterator it = contactFileMap.find(hContact);
- if (it != contactFileMap.end())
+ std::map<MCONTACT, HistoryEventList::ImportDiscData>::iterator it = m_contactFileMap.find(hContact);
+ if (it != m_contactFileMap.end())
count = true;
return count;
}
@@ -690,9 +689,9 @@ void HistoryEventList::DeleteImporter(MCONTACT hContact)
{
mir_cslock lck(csEventList);
- std::map<MCONTACT, HistoryEventList::ImportDiscData>::iterator it = contactFileMap.find(hContact);
- if (it != contactFileMap.end()) {
+ std::map<MCONTACT, HistoryEventList::ImportDiscData>::iterator it = m_contactFileMap.find(hContact);
+ if (it != m_contactFileMap.end()) {
DeleteFile(it->second.file.c_str());
- contactFileMap.erase(it);
+ m_contactFileMap.erase(it);
}
}
diff --git a/plugins/BasicHistory/src/EventList.h b/plugins/BasicHistory/src/EventList.h
index e0586f30ce..8f4f65089a 100644
--- a/plugins/BasicHistory/src/EventList.h
+++ b/plugins/BasicHistory/src/EventList.h
@@ -47,13 +47,13 @@ public:
};
private:
- std::map<int, bool> filterMap;
- bool onlyInFilter;
- bool onlyOutFilter;
- int defFilter;
- std::wstring filterName;
- std::vector<IImport::ExternalMessage> importedMessages;
- DWORD goldBlobSize;
+ std::map<int, bool> m_filterMap;
+ bool m_onlyInFilter;
+ bool m_onlyOutFilter;
+ int m_defFilter;
+ std::wstring m_filterName;
+ std::vector<IImport::ExternalMessage> m_importedMessages;
+ DWORD m_oldBlobSize;
struct EventTempIndex
{
@@ -72,8 +72,8 @@ private:
std::wstring file;
};
- static std::map<MCONTACT, ImportDiscData> contactFileMap;
- static std::wstring contactFileDir;
+ static std::map<MCONTACT, ImportDiscData> m_contactFileMap;
+ static std::wstring m_contactFileDir;
bool CanShowHistory(DBEVENTINFO* dbei);
bool CanShowHistory(const IImport::ExternalMessage& message);
@@ -82,33 +82,35 @@ private:
void AddGroup(const EventIndex& ev);
void GetTempList(std::list<EventTempIndex>& tempList, bool noFilter, bool noExt, MCONTACT _hContact);
void ImportMessages(const std::vector<IImport::ExternalMessage>& messages);
+
protected:
- TCHAR contactName[256];
- TCHAR myName[256];
- bool isWnd;
- int deltaTime;
- DWORD now;
- bool isFlat;
- DBEVENTINFO gdbei;
+ TCHAR m_contactName[256];
+ TCHAR m_myName[256];
+ bool m_isWnd;
+ bool m_isFlat;
+ int m_deltaTime;
+ DWORD m_now;
+ DBEVENTINFO m_dbei;
virtual void AddGroup(bool isMe, const std::wstring &time, const std::wstring &user, const std::wstring &eventText, int ico) = 0;
bool GetEventIcon(bool isMe, int eventType, int &id);
void DeleteEvent(const EventIndex& ev)
{
if (!ev.isExternal)
- db_event_delete(hContact, ev.hEvent);
+ db_event_delete(m_hContact, ev.hEvent);
}
void RebuildGroup(int selected);
+
public:
HistoryEventList();
HistoryEventList(MCONTACT _hContact, int filter);
~HistoryEventList();
- HWND hWnd;
- MCONTACT hContact;
- std::vector<std::deque<EventIndex> > eventList;
- bool useImportedMessages;
+ HWND m_hWnd;
+ MCONTACT m_hContact;
+ std::vector<std::deque<EventIndex> > m_eventList;
+ bool m_useImportedMessages;
static void Init();
void SetDefFilter(int filter);
@@ -134,17 +136,17 @@ public:
void GetEventMessage(const EventIndex& ev, TCHAR* message) // must be allocated with MAXSELECTSTR len
{
if (!ev.isExternal)
- GetObjectDescription(&gdbei, message, MAXSELECTSTR);
+ GetObjectDescription(&m_dbei, message, MAXSELECTSTR);
else
- _tcscpy_s(message, MAXSELECTSTR, importedMessages[ev.exIdx].message.c_str());
+ _tcscpy_s(message, MAXSELECTSTR, m_importedMessages[ev.exIdx].message.c_str());
}
void GetEventMessage(const EventIndex& ev, TCHAR* message, int strLen)
{
if (!ev.isExternal)
- GetObjectDescription(&gdbei, message, strLen);
+ GetObjectDescription(&m_dbei, message, strLen);
else
{
- std::wstring& meg = importedMessages[ev.exIdx].message;
+ std::wstring& meg = m_importedMessages[ev.exIdx].message;
if ((int)meg.size() >= strLen)
{
memcpy_s(message, strLen * sizeof(TCHAR), meg.c_str(), (strLen - 1) * sizeof(TCHAR));
diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp
index 430de416a9..8c05d7bc67 100644
--- a/plugins/BasicHistory/src/ExportManager.cpp
+++ b/plugins/BasicHistory/src/ExportManager.cpp
@@ -26,10 +26,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Options.h"
#include "codecvt_CodePage.h"
-ExportManager::ExportManager(HWND _hwnd, MCONTACT _hContact, int filter) :
- HistoryEventList(_hContact, filter),
- hwnd(_hwnd),
- oldOnTop(false)
+ExportManager::ExportManager(HWND hwnd, MCONTACT hContact, int filter) :
+ HistoryEventList(hContact, filter),
+ m_hwnd(hwnd),
+ m_oldOnTop(false)
{
}
@@ -90,41 +90,41 @@ std::wstring ReplaceExt(const std::wstring& file, const TCHAR* ext)
bool ExportManager::Export(IExport::ExportType type)
{
- exp = NULL;
+ m_exp = NULL;
UINT cp;
std::wstring encoding;
bool isBin = false;
switch(type) {
case IExport::Txt:
- exp = new TxtExport();
+ m_exp = new TxtExport();
cp = Options::instance->codepageTxt;
encoding = Options::instance->encodingTxt;
- isFlat = true;
+ m_isFlat = true;
break;
case IExport::PlainHtml:
- exp = new PlainHtmlExport();
+ m_exp = new PlainHtmlExport();
cp = Options::instance->codepageHtml1;
encoding = Options::instance->encodingHtml1;
break;
case IExport::RichHtml:
- exp = new RichHtmlExport();
+ m_exp = new RichHtmlExport();
cp = Options::instance->codepageHtml2;
encoding = Options::instance->encodingHtml2;
break;
case IExport::Binary:
- exp = new BinaryExport();
+ m_exp = new BinaryExport();
cp = CP_UTF8;
encoding = L"UTF8";
- isFlat = true;
- oldOnTop = true;
+ m_isFlat = true;
+ m_oldOnTop = true;
isBin = true;
break;
case IExport::Dat:
- exp = new DatExport();
+ m_exp = new DatExport();
cp = CP_UTF8;
encoding = L"UTF8";
- isFlat = true;
- oldOnTop = true;
+ m_isFlat = true;
+ m_oldOnTop = true;
isBin = true;
break;
default:
@@ -132,10 +132,10 @@ bool ExportManager::Export(IExport::ExportType type)
}
std::wstring fileName;
- if (file.empty())
- fileName = GetFile(exp->GetExt(), hwnd, false);
+ if (m_file.empty())
+ fileName = GetFile(m_exp->GetExt(), m_hwnd, false);
else
- fileName = ReplaceExt(file, exp->GetExt());
+ fileName = ReplaceExt(m_file, m_exp->GetExt());
if (fileName.empty())
return false;
@@ -148,7 +148,7 @@ bool ExportManager::Export(IExport::ExportType type)
std::locale filelocale(std::locale(), new codecvt_CodePage<wchar_t>(cp));
stream->imbue(filelocale);
- exp->SetStream(stream);
+ m_exp->SetStream(stream);
}
else {
std::ofstream* cstream = new std::ofstream (fileName.c_str(), std::ios_base::binary);
@@ -156,14 +156,14 @@ bool ExportManager::Export(IExport::ExportType type)
return false;
stream = (std::wofstream*)cstream;
- exp->SetStream(stream);
+ m_exp->SetStream(stream);
}
- exp->WriteHeader(fileName, GetFilterName(), GetMyName(), GetMyId(), GetContactName(), GetProtocolName(), GetContactId(), GetBaseProtocol(), encoding);
+ m_exp->WriteHeader(fileName, GetFilterName(), GetMyName(), GetMyId(), GetContactName(), GetProtocolName(), GetContactId(), GetBaseProtocol(), encoding);
RefreshEventList();
- exp->WriteFooter();
+ m_exp->WriteFooter();
if (!isBin) {
stream->close();
delete stream;
@@ -174,13 +174,13 @@ bool ExportManager::Export(IExport::ExportType type)
delete cstream;
}
- delete exp;
+ delete m_exp;
return true;
}
const TCHAR* ExportManager::GetExt(IImport::ImportType type)
{
- IImport* imp = NULL;
+ IImport *imp = NULL;
switch(type) {
case IImport::Binary:
imp = new BinaryExport();
@@ -192,14 +192,14 @@ const TCHAR* ExportManager::GetExt(IImport::ImportType type)
return L"";
}
- const TCHAR* ext = imp->GetExt();
+ const TCHAR *ext = imp->GetExt();
delete imp;
return ext;
}
int ExportManager::Import(IImport::ImportType type, const std::vector<MCONTACT>& contacts)
{
- IImport* imp = NULL;
+ IImport *imp = NULL;
switch(type) {
case IImport::Binary:
imp = new BinaryExport();
@@ -211,14 +211,10 @@ int ExportManager::Import(IImport::ImportType type, const std::vector<MCONTACT>&
return -2;
}
- std::wstring fileName;
- if (file.empty())
+ if (m_file.empty())
return -2;
- else
- {
- fileName = ReplaceExt(file, imp->GetExt());
- }
+ std::wstring fileName = ReplaceExt(m_file, imp->GetExt());
if (fileName.empty())
return -2;
@@ -236,7 +232,7 @@ int ExportManager::Import(IImport::ImportType type, const std::vector<MCONTACT>&
bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::ExternalMessage>& eventList, std::wstring* err, bool* differentContact, std::vector<MCONTACT>* contacts)
{
- IImport* imp = NULL;
+ IImport *imp = NULL;
switch(type) {
case IImport::Binary:
imp = new BinaryExport();
@@ -249,18 +245,18 @@ bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::Extern
}
std::wstring fileName;
- if (file.empty())
- file = fileName = GetFile(imp->GetExt(), hwnd, true);
+ if (m_file.empty())
+ m_file = fileName = GetFile(imp->GetExt(), m_hwnd, true);
else
- fileName = ReplaceExt(file, imp->GetExt());
+ fileName = ReplaceExt(m_file, imp->GetExt());
- std::ifstream* stream = new std::ifstream (fileName.c_str(), std::ios_base::binary);
+ std::ifstream *stream = new std::ifstream (fileName.c_str(), std::ios_base::binary);
if (!stream->is_open())
return false;
imp->SetStream(stream);
std::vector<MCONTACT> v;
- v.push_back(hContact);
+ v.push_back(m_hContact);
bool ret = true;
int contInFile = imp->IsContactInFile(v);
if (contInFile == -1) {
@@ -272,7 +268,7 @@ bool ExportManager::Import(IImport::ImportType type, std::vector<IImport::Extern
contInFile = imp->IsContactInFile(*contacts);
if (contInFile >= 0) {
*differentContact = true;
- hContact = (*contacts)[contInFile];
+ m_hContact = (*contacts)[contInFile];
}
}
}
@@ -294,22 +290,23 @@ 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)
{
- if (exp == NULL)
+ if (m_exp == NULL)
return;
- exp->WriteGroup(isMe, time, user, eventText);
+ m_exp->WriteGroup(isMe, time, user, eventText);
TCHAR str[MAXSELECTSTR + 8]; // for safety reason
str[0] = 0;
- tm lastTime;
bool isFirst = true;
bool lastMe = false;
EventData data;
std::deque<EventIndex> revDeq;
- std::deque<EventIndex>& deq = eventList.back();
- if (!oldOnTop && Options::instance->messagesNewOnTop) {
+ std::deque<EventIndex> &deq = m_eventList.back();
+ if (!m_oldOnTop && Options::instance->messagesNewOnTop) {
revDeq.insert(revDeq.begin(), deq.rbegin(), deq.rend());
deq = revDeq;
}
+
+ struct tm lastTime = { 0 };
for (std::deque<EventIndex>::iterator it = deq.begin(); it != deq.end(); ++it) {
EventIndex hDbEvent = *it;
if (GetEventData(hDbEvent, data)) {
@@ -338,11 +335,11 @@ void ExportManager::AddGroup(bool isMe, const std::wstring &time, const std::wst
TimeZone_PrintTimeStamp(NULL, data.timestamp, formatDate, str , MAXSELECTSTR, 0);
std::wstring shortDate = str;
- std::wstring user;
+ std::wstring wszUser;
if (lastMe)
- user = myName;
+ wszUser = m_myName;
else
- user = contactName;
+ wszUser = m_contactName;
GetEventMessage(hDbEvent, str);
std::wstring strMessage = str;
@@ -352,22 +349,22 @@ void ExportManager::AddGroup(bool isMe, const std::wstring &time, const std::wst
if (hDbEvent.isExternal)
GetExtEventDBei(hDbEvent);
- exp->WriteMessage(lastMe, longDate, shortDate, user, strMessage, gdbei);
+ m_exp->WriteMessage(lastMe, longDate, shortDate, wszUser, strMessage, m_dbei);
}
}
}
void ExportManager::DeleteExportedEvents()
{
- for (size_t j = 0; j < eventList.size(); ++j)
- for (size_t i = 0; i < eventList[j].size(); ++i)
- DeleteEvent(eventList[j][i]);
+ for (size_t j = 0; j < m_eventList.size(); ++j)
+ for (size_t i = 0; i < m_eventList[j].size(); ++i)
+ DeleteEvent(m_eventList[j][i]);
}
-void ExportManager::SetDeleteWithoutExportEvents(int _deltaTime, DWORD _now)
+void ExportManager::SetDeleteWithoutExportEvents(int deltaTime, DWORD now)
{
- exp = NULL;
- deltaTime = _deltaTime;
- now = _now;
+ m_exp = NULL;
+ m_deltaTime = deltaTime;
+ m_now = now;
RefreshEventList();
}
diff --git a/plugins/BasicHistory/src/ExportManager.h b/plugins/BasicHistory/src/ExportManager.h
index ea3aa208b3..1cefb47463 100644
--- a/plugins/BasicHistory/src/ExportManager.h
+++ b/plugins/BasicHistory/src/ExportManager.h
@@ -22,38 +22,39 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "IImport.h"
class ExportManager : public HistoryEventList
{
-private:
- IExport* exp;
- std::wstring file;
- HWND hwnd;
- bool oldOnTop;
+ IExport* m_exp;
+ std::wstring m_file;
+ HWND m_hwnd;
+ bool m_oldOnTop;
+
protected:
virtual void AddGroup(bool isMe, const std::wstring &time, const std::wstring &user, const std::wstring &eventText, int ico);
+
public:
ExportManager(HWND _hwnd, MCONTACT _hContact, int filter);
- void SetAutoExport(const std::wstring _file, int _deltaTime, DWORD _now)
+ void SetAutoExport(const std::wstring _file, int deltaTime, DWORD now)
{
- file = _file;
- deltaTime = _deltaTime;
- now = _now;
+ m_file = _file;
+ m_deltaTime = deltaTime;
+ m_now = now;
}
void SetAutoImport(const std::wstring _file)
{
- file = _file;
+ m_file = _file;
}
std::wstring GetFileName()
{
- return file;
+ return m_file;
}
bool Export(IExport::ExportType type);
- void SetDeleteWithoutExportEvents(int _deltaTime, DWORD _now);
+ void SetDeleteWithoutExportEvents(int deltaTime, DWORD now);
void DeleteExportedEvents();
- int Import(IImport::ImportType type, const std::vector<MCONTACT>& contacts);
- bool Import(IImport::ImportType type, std::vector<IImport::ExternalMessage>& eventList, std::wstring* err = NULL, bool* differentContact = NULL, std::vector<MCONTACT>* contacts = NULL);
+ int Import(IImport::ImportType type, const std::vector<MCONTACT> &contacts);
+ bool Import(IImport::ImportType type, std::vector<IImport::ExternalMessage> &eventList, std::wstring *err = NULL, bool *differentContact = NULL, std::vector<MCONTACT> *contacts = NULL);
static const TCHAR* GetExt(IImport::ImportType type);
};
diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp
index 055a1c6e40..247f7cdd5b 100644
--- a/plugins/BasicHistory/src/HistoryWindow.cpp
+++ b/plugins/BasicHistory/src/HistoryWindow.cpp
@@ -38,7 +38,7 @@ extern IconItem iconList[];
void ResetCList(HWND hWnd);
-HistoryWindow::HistoryWindow(MCONTACT _hContact) :
+HistoryWindow::HistoryWindow(MCONTACT hContact) :
isDestroyed(true),
splitterY(0),
splitterOrgY(0),
@@ -53,7 +53,7 @@ HistoryWindow::HistoryWindow(MCONTACT _hContact) :
isContactList(false),
isLoading(false),
isGroupImages(false),
- allIconNumber(0),
+ allIconNumber(0),
eventIcons(NULL),
bkBrush(NULL),
bkFindBrush(NULL),
@@ -63,7 +63,7 @@ HistoryWindow::HistoryWindow(MCONTACT _hContact) :
isStartSelect(true)
{
searcher.SetContect(this);
- hContact = _hContact;
+ m_hContact = hContact;
selected = -1;
searcher.SetMatchCase(Options::instance->searchMatchCase);
searcher.SetMatchWholeWords(Options::instance->searchMatchWhole);
@@ -78,8 +78,7 @@ HistoryWindow::HistoryWindow(MCONTACT _hContact) :
HistoryWindow::~HistoryWindow()
{
- if (eventIcons != NULL)
- {
+ if (eventIcons != NULL) {
for (int i = 0; i < iconsNum; ++i)
if (eventIcons[i] != NULL)
IcoLib_ReleaseIcon(eventIcons[i]);
@@ -119,58 +118,42 @@ void HistoryWindow::Deinit()
{
bool destroyed = true;
std::vector<MCONTACT> keys;
- for (std::map<MCONTACT, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
- {
+ for (auto it = windows.begin(); it != windows.end(); ++it)
if (!it->second->isDestroyed)
- {
keys.push_back(it->first);
- }
- }
- for (std::vector<MCONTACT>::iterator it = keys.begin(); it != keys.end(); ++it)
- {
- std::map<MCONTACT, HistoryWindow*>::iterator it1 = windows.find(*it);
- if (it1 != windows.end())
- {
- DestroyWindow(it1->second->hWnd);
+
+ for (auto it = keys.begin(); it != keys.end(); ++it) {
+ auto it1 = windows.find(*it);
+ if (it1 != windows.end()) {
+ DestroyWindow(it1->second->m_hWnd);
it1 = windows.find(*it);
destroyed &= it1 == windows.end();
}
}
-
+
std::vector<HistoryWindow*> keys1;
- for (std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
- {
+ for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it)
if (!(*it)->isDestroyed)
- {
keys1.push_back(*it);
- }
- }
- for (std::vector<HistoryWindow*>::iterator it = keys1.begin(); it != keys1.end(); ++it)
- {
- DestroyWindow((*it)->hWnd);
- }
- for (std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
- {
- if (!(*it)->isDestroyed)
- {
+
+ for (auto it = keys1.begin(); it != keys1.end(); ++it)
+ DestroyWindow((*it)->m_hWnd);
+
+ for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it) {
+ if (!(*it)->isDestroyed) {
destroyed = false;
break;
}
}
- if (destroyed)
- {
- for (std::map<MCONTACT, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
- {
+ if (destroyed) {
+ for (auto it = windows.begin(); it != windows.end(); ++it)
delete it->second;
- }
windows.clear();
- for (std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
- {
+ for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it)
delete *it;
- }
freeWindows.clear();
}
@@ -178,21 +161,16 @@ void HistoryWindow::Deinit()
void HistoryWindow::Open(MCONTACT hContact)
{
- if (hContact == NULL)
- {
+ if (hContact == NULL) {
HistoryWindow *hw = new HistoryWindow(hContact);
freeWindows.push_back(hw);
hw->Show();
}
- else
- {
- std::map<MCONTACT, HistoryWindow*>::iterator it = windows.find(hContact);
+ else {
+ auto it = windows.find(hContact);
if (it != windows.end())
- {
it->second->Focus();
- }
- else
- {
+ else {
windows[hContact] = new HistoryWindow(hContact);
windows[hContact]->Show();
}
@@ -201,41 +179,31 @@ void HistoryWindow::Open(MCONTACT hContact)
void HistoryWindow::Close(MCONTACT hContact)
{
- std::map<MCONTACT, HistoryWindow*>::iterator it = windows.find(hContact);
- if (it != windows.end())
- {
- if (it->second->isDestroyed)
- {
+ auto it = windows.find(hContact);
+ if (it != windows.end()) {
+ if (it->second->isDestroyed) {
delete it->second;
windows.erase(it);
}
- else
- {
- DestroyWindow(it->second->hWnd);
- }
+ else DestroyWindow(it->second->m_hWnd);
}
}
void HistoryWindow::Close(HistoryWindow* historyWindow)
{
- if (!historyWindow->isDestroyed)
- {
- DestroyWindow(historyWindow->hWnd);
+ if (!historyWindow->isDestroyed) {
+ DestroyWindow(historyWindow->m_hWnd);
return;
}
- std::map<MCONTACT, HistoryWindow*>::iterator it = windows.find(historyWindow->hContact);
- if (it != windows.end() && it->second == historyWindow)
- {
+ auto it = windows.find(historyWindow->m_hContact);
+ if (it != windows.end() && it->second == historyWindow) {
delete it->second;
windows.erase(it);
}
- else
- {
- for (std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
- {
- if (*it == historyWindow)
- {
- freeWindows.erase(it);
+ else {
+ for (auto iw = freeWindows.begin(); iw != freeWindows.end(); ++iw) {
+ if (*iw == historyWindow) {
+ freeWindows.erase(iw);
delete historyWindow;
return;
}
@@ -245,29 +213,21 @@ void HistoryWindow::Close(HistoryWindow* historyWindow)
void HistoryWindow::RebuildEvents(MCONTACT hContact)
{
- if (hContact != NULL)
- {
- std::map<MCONTACT, HistoryWindow*>::iterator it = windows.find(hContact);
+ if (hContact != NULL) {
+ auto it = windows.find(hContact);
if (it != windows.end() && !it->second->isDestroyed)
- {
- SendMessage(it->second->hWnd,DM_HREBUILD,0,0);
- }
- }
-
- for (std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
- {
- if ((*it)->hContact == hContact && !(*it)->isDestroyed)
- {
- SendMessage((*it)->hWnd,DM_HREBUILD,0,0);
- }
+ SendMessage(it->second->m_hWnd, DM_HREBUILD, 0, 0);
}
+
+ for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it)
+ if ((*it)->m_hContact == hContact && !(*it)->isDestroyed)
+ SendMessage((*it)->m_hWnd, DM_HREBUILD, 0, 0);
}
void HistoryWindow::ChangeToFreeWindow(HistoryWindow* historyWindow)
{
- std::map<MCONTACT, HistoryWindow*>::iterator it = windows.find(historyWindow->hContact);
- if (it != windows.end() && it->second == historyWindow)
- {
+ auto it = windows.find(historyWindow->m_hContact);
+ if (it != windows.end() && it->second == historyWindow) {
windows.erase(it);
freeWindows.push_back(historyWindow);
}
@@ -275,40 +235,29 @@ void HistoryWindow::ChangeToFreeWindow(HistoryWindow* historyWindow)
void HistoryWindow::Show()
{
- CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_HISTORY),NULL,HistoryWindow::DlgProcHistory,(LPARAM)this);
+ CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_HISTORY), NULL, HistoryWindow::DlgProcHistory, (LPARAM)this);
}
void HistoryWindow::Focus()
{
- if (IsIconic(hWnd))
- {
- ShowWindow(hWnd, SW_RESTORE);
- }
- else
- {
- SetForegroundWindow(hWnd);
- SetFocus(hWnd);
+ if (IsIconic(m_hWnd))
+ ShowWindow(m_hWnd, SW_RESTORE);
+ else {
+ SetForegroundWindow(m_hWnd);
+ SetFocus(m_hWnd);
}
- SendMessage(hWnd,DM_HREBUILD,0,0);
+ SendMessage(m_hWnd, DM_HREBUILD, 0, 0);
}
int HistoryWindow::FontsChanged(WPARAM, LPARAM)
{
- for (std::map<MCONTACT, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
- {
+ for (auto it = windows.begin(); it != windows.end(); ++it)
if (!it->second->isDestroyed)
- {
it->second->FontsChanged();
- }
- }
- for (std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
- {
+ for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it)
if (!(*it)->isDestroyed)
- {
(*it)->FontsChanged();
- }
- }
return 0;
}
@@ -316,25 +265,24 @@ int HistoryWindow::FontsChanged(WPARAM, LPARAM)
void HistoryWindow::FontsChanged()
{
if (bkBrush != NULL)
- {
DeleteObject(bkBrush);
- }
+
if (bkFindBrush != NULL)
- {
DeleteObject(bkFindBrush);
- }
bkBrush = CreateSolidBrush(Options::instance->GetColor(Options::WindowBackground));
bkFindBrush = CreateSolidBrush(Options::instance->GetColor(Options::FindBackground));
-
- ResetCList(hWnd);
+
+ ResetCList(m_hWnd);
+
COLORREF bkColor = Options::instance->GetColor(Options::GroupListBackground);
ListView_SetBkColor(listWindow, bkColor);
ListView_SetTextBkColor(listWindow, bkColor);
+
LOGFONT font;
ListView_SetTextColor(listWindow, Options::instance->GetFont(Options::GroupList, &font));
InvalidateRect(listWindow, NULL, TRUE);
- InvalidateRect(hWnd, NULL, TRUE);
+ InvalidateRect(m_hWnd, NULL, TRUE);
SelectEventGroup(selected);
}
@@ -345,21 +293,17 @@ void OptionsGroupChanged()
void HistoryWindow::OptionsGroupChanged()
{
- for (std::map<MCONTACT, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
- {
- if (!it->second->isDestroyed)
- {
+ for (auto it = windows.begin(); it != windows.end(); ++it) {
+ if (!it->second->isDestroyed) {
it->second->GroupImagesChanged();
- SendMessage(it->second->hWnd,DM_HREBUILD,0,0);
+ SendMessage(it->second->m_hWnd, DM_HREBUILD, 0, 0);
}
}
- for (std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
- {
- if (!(*it)->isDestroyed)
- {
+ for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it) {
+ if (!(*it)->isDestroyed) {
(*it)->GroupImagesChanged();
- SendMessage((*it)->hWnd,DM_HREBUILD,0,0);
+ SendMessage((*it)->m_hWnd, DM_HREBUILD, 0, 0);
}
}
}
@@ -371,27 +315,19 @@ void OptionsMainChanged()
void HistoryWindow::OptionsMainChanged()
{
- for (std::map<MCONTACT, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
- {
+ for (auto it = windows.begin(); it != windows.end(); ++it)
if (!it->second->isDestroyed)
- {
it->second->ReloadMainOptions();
- }
- }
- for (std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
- {
+ for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it)
if (!(*it)->isDestroyed)
- {
(*it)->ReloadMainOptions();
- }
- }
}
void HistoryWindow::ReloadMainOptions()
{
- SendDlgItemMessage(hWnd, IDC_LIST_CONTACTS, CLM_SETUSEGROUPS, Options::instance->showContactGroups, 0);
- SendMessage(hWnd,DM_HREBUILD,0,0);
+ SendDlgItemMessage(m_hWnd, IDC_LIST_CONTACTS, CLM_SETUSEGROUPS, Options::instance->showContactGroups, 0);
+ SendMessage(m_hWnd, DM_HREBUILD, 0, 0);
}
void OptionsMessageChanged()
@@ -406,19 +342,15 @@ void OptionsSearchingChanged()
void HistoryWindow::OptionsSearchingChanged()
{
- for (std::map<MCONTACT, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
- {
- if (!it->second->isDestroyed)
- {
+ for (auto it = windows.begin(); it != windows.end(); ++it) {
+ if (!it->second->isDestroyed) {
it->second->searcher.SetSearchForInLG(Options::instance->searchForInList);
it->second->searcher.SetSearchForInMes(Options::instance->searchForInMess);
}
}
- for (std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
- {
- if (!(*it)->isDestroyed)
- {
+ for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it) {
+ if (!(*it)->isDestroyed) {
(*it)->searcher.SetSearchForInLG(Options::instance->searchForInList);
(*it)->searcher.SetSearchForInMes(Options::instance->searchForInMess);
}
@@ -431,39 +363,27 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM)
int count = HistoryEventList::GetContactMessageNumber(hContact);
if (!count)
return FALSE;
-
- for (std::map<MCONTACT, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
- {
- if (!it->second->isDestroyed)
- {
- if (it->second->hContact == hContact)
- {
- if (hWnd == NULL)
- {
- hWnd = it->second->hWnd;
+
+ for (auto it = windows.begin(); it != windows.end(); ++it) {
+ if (!it->second->isDestroyed) {
+ if (it->second->m_hContact == hContact) {
+ if (hWnd == NULL) {
+ hWnd = it->second->m_hWnd;
}
- else if (GetForegroundWindow() == it->second->hWnd)
- {
- hWnd = it->second->hWnd;
+ else if (GetForegroundWindow() == it->second->m_hWnd) {
+ hWnd = it->second->m_hWnd;
}
}
}
}
- for (std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
- {
- if (!(*it)->isDestroyed)
- {
- if ((*it)->hContact == hContact)
- {
+ for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it) {
+ if (!(*it)->isDestroyed) {
+ if ((*it)->m_hContact == hContact) {
if (hWnd == NULL)
- {
- hWnd = (*it)->hWnd;
- }
- else if (GetForegroundWindow() == (*it)->hWnd)
- {
- hWnd = (*it)->hWnd;
- }
+ hWnd = (*it)->m_hWnd;
+ else if (GetForegroundWindow() == (*it)->m_hWnd)
+ hWnd = (*it)->m_hWnd;
}
}
}
@@ -476,32 +396,32 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM)
MEVENT hDbEvent = db_event_last(hContact);
while (hDbEvent != NULL) {
MEVENT hPrevEvent = db_event_prev(hContact, hDbEvent);
- hDbEvent = ( db_event_delete(hContact, hDbEvent) == 0) ? hPrevEvent : NULL;
+ hDbEvent = (db_event_delete(hContact, hDbEvent) == 0) ? hPrevEvent : NULL;
}
CallService(MS_DB_SETSAFETYMODE, TRUE, 0);
if (HistoryEventList::IsImportedHistory(hContact)) {
- TCHAR *message = TranslateT("Do you want to delete all imported messages for this contact?\nNote that next scheduler task import this messages again.");
+ message = TranslateT("Do you want to 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)
HistoryEventList::DeleteImporter(hContact);
}
-
+
RebuildEvents(hContact);
return TRUE;
}
bool HistoryWindow::IsInList(HWND hWnd)
{
- for (std::map<MCONTACT, HistoryWindow*>::iterator it = windows.begin(); it != windows.end(); ++it)
+ for (auto it = windows.begin(); it != windows.end(); ++it)
if (!it->second->isDestroyed)
- if (it->second->hWnd == hWnd)
+ if (it->second->m_hWnd == hWnd)
return true;
- for (std::vector<HistoryWindow*>::iterator it = freeWindows.begin(); it != freeWindows.end(); ++it)
+ for (auto it = freeWindows.begin(); it != freeWindows.end(); ++it)
if (!(*it)->isDestroyed)
- if ((*it)->hWnd == hWnd)
+ if ((*it)->m_hWnd == hWnd)
return true;
-
+
return false;
}
@@ -518,12 +438,12 @@ void ClickLink(HWND hwnd, ENLINK *penLink)
TEXTRANGE tr;
CHARRANGE sel;
- SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM) & sel);
+ SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)& sel);
if (sel.cpMin != sel.cpMax)
return;
tr.chrg = penLink->chrg;
tr.lpstrText = buf;
- SendMessage(hwnd, EM_GETTEXTRANGE, 0, (LPARAM) & tr);
+ SendMessage(hwnd, EM_GETTEXTRANGE, 0, (LPARAM)& tr);
Utils_OpenUrlT(tr.lpstrText, penLink->nmhdr.code == IDM_OPENNEW);
}
}
@@ -562,45 +482,44 @@ void OpenOptions(char* group, char* page, char* tab = NULL)
return (ret);\
}
-class ShowMessageData
+struct ShowMessageData
{
-public:
- ShowMessageData(MCONTACT _hContact)
- :hContact(_hContact)
+ ShowMessageData(MCONTACT hContact)
+ : m_hContact(hContact)
{
}
- ShowMessageData(MCONTACT _hContact, const std::wstring &_str)
- :hContact(_hContact),
- str(_str)
+ ShowMessageData(MCONTACT hContact, const std::wstring &str)
+ : m_hContact(hContact),
+ m_str(str)
{
}
- MCONTACT hContact;
- std::wstring str;
+ MCONTACT m_hContact;
+ std::wstring m_str;
};
void __stdcall ShowMessageWindow(void* arg)
{
ShowMessageData* dt = (ShowMessageData*)arg;
- if (dt->str.empty())
- CallService(MS_MSG_SENDMESSAGE, (WPARAM)dt->hContact, 0);
+ if (dt->m_str.empty())
+ CallService(MS_MSG_SENDMESSAGE, dt->m_hContact, 0);
else
- CallService(MS_MSG_SENDMESSAGET, (WPARAM)dt->hContact, (LPARAM)dt->str.c_str());
+ CallService(MS_MSG_SENDMESSAGET, dt->m_hContact, (LPARAM)dt->m_str.c_str());
delete dt;
}
INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- HistoryWindow* historyWindow = (HistoryWindow*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ HistoryWindow *historyWindow = (HistoryWindow*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
LPNMHDR pNmhdr;
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
historyWindow = (HistoryWindow*)lParam;
- historyWindow->hWnd = hwndDlg;
- historyWindow->isWnd = true;
+ historyWindow->m_hWnd = hwndDlg;
+ historyWindow->m_isWnd = true;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
historyWindow->Initialise();
DlgReturn(TRUE);
@@ -611,11 +530,11 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
case WM_SIZE:
Utils_ResizeDialog(hwndDlg, hInst, MAKEINTRESOURCEA(IDD_HISTORY), HistoryWindow::HistoryDlgResizer);
- ListView_SetColumnWidth(GetDlgItem(hwndDlg,IDC_LIST), 0, LVSCW_AUTOSIZE_USEHEADER);
+ ListView_SetColumnWidth(GetDlgItem(hwndDlg, IDC_LIST), 0, LVSCW_AUTOSIZE_USEHEADER);
DlgReturn(TRUE);
case WM_COMMAND:
- switch ( LOWORD( wParam )) {
+ switch (LOWORD(wParam)) {
case IDOK:
case IDCANCEL:
DestroyWindow(hwndDlg);
@@ -627,7 +546,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
case IDM_CONFIG:
{
- OPENOPTIONSDIALOG opd = {0};
+ OPENOPTIONSDIALOG opd = { 0 };
opd.cbSize = sizeof(opd);
opd.pszPage = LPGEN("History");
Options_Open(&opd);
@@ -644,19 +563,19 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
DlgReturn(TRUE);
case IDC_SHOWHIDE:
- if (HIWORD( wParam ) == BN_CLICKED) {
- 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);
+ if (HIWORD(wParam) == BN_CLICKED) {
+ 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);
historyWindow->isContactList = true;
- ShowWindow(GetDlgItem(hwndDlg,IDC_LIST_CONTACTS), SW_SHOW);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_LIST_CONTACTS), SW_SHOW);
ShowWindow(historyWindow->splitterYhWnd, SW_SHOW);
}
else {
- SendDlgItemMessage( hwndDlg, IDC_SHOWHIDE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)historyWindow->plusIco);
- SendDlgItemMessage( hwndDlg, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Show Contacts"), BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDC_SHOWHIDE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)historyWindow->plusIco);
+ SendDlgItemMessage(hwndDlg, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Show Contacts"), BATF_TCHAR);
historyWindow->isContactList = false;
- ShowWindow(GetDlgItem(hwndDlg,IDC_LIST_CONTACTS), SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_LIST_CONTACTS), SW_HIDE);
ShowWindow(historyWindow->splitterYhWnd, SW_HIDE);
}
@@ -669,7 +588,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
case WM_NOTIFY:
pNmhdr = (LPNMHDR)lParam;
- switch(pNmhdr->idFrom) {
+ switch (pNmhdr->idFrom) {
case IDC_LIST_CONTACTS:
if (pNmhdr->code == CLN_LISTREBUILT) {
if (historyWindow != NULL)
@@ -679,7 +598,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
}
else if (pNmhdr->code == CLN_MYSELCHANGED) {
if (historyWindow->ContactChanged()) {
- MSGFILTER* msgFilter = (MSGFILTER *) lParam;
+ MSGFILTER* msgFilter = (MSGFILTER *)lParam;
if (msgFilter->msg == WM_LBUTTONDOWN)
SendMessage(pNmhdr->hwndFrom, WM_LBUTTONUP, msgFilter->wParam, msgFilter->lParam);
}
@@ -696,19 +615,18 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
case IDC_FIND_TEXT:
case IDC_EDIT:
if (pNmhdr->code == EN_LINK) {
- ClickLink(GetDlgItem(hwndDlg, IDC_EDIT), (ENLINK *) lParam);
+ ClickLink(GetDlgItem(hwndDlg, IDC_EDIT), (ENLINK *)lParam);
return FALSE;
}
if (pNmhdr->code == EN_SELCHANGE)
historyWindow->searcher.ClearFind();
else if (pNmhdr->code == EN_MSGFILTER) {
- MSGFILTER* msgFilter = (MSGFILTER *) lParam;
- if (msgFilter->msg == WM_KEYDOWN || msgFilter->msg == WM_SYSKEYDOWN)
- {
- if (historyWindow->DoHotkey(msgFilter->msg, msgFilter->lParam, msgFilter->wParam, pNmhdr->idFrom))
+ MSGFILTER* msgFilter = (MSGFILTER *)lParam;
+ if (msgFilter->msg == WM_KEYDOWN || msgFilter->msg == WM_SYSKEYDOWN) {
+ 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)
+ else if (msgFilter->msg == WM_RBUTTONDOWN || msgFilter->msg == WM_RBUTTONDBLCLK || msgFilter->msg == WM_NCRBUTTONUP || msgFilter->msg == WM_NCRBUTTONDBLCLK || msgFilter->msg == WM_NCRBUTTONDOWN)
DlgReturn(TRUE);
if (msgFilter->msg == WM_RBUTTONUP) {
@@ -716,15 +634,15 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
HWND window = historyWindow->editWindow;
POINTL p;
POINT scrool;
- LVHITTESTINFO info = {0};
+ LVHITTESTINFO info = { 0 };
p.x = clicked.x = info.pt.x = GET_X_LPARAM(msgFilter->lParam);
p.y = clicked.y = info.pt.y = GET_Y_LPARAM(msgFilter->lParam);
ClientToScreen(window, &clicked);
SetFocus(window);
int selChar = SendMessage(window, EM_CHARFROMPOS, 0, (LPARAM)&p);
CHARRANGE chrg;
- SendMessage(window,EM_EXGETSEL,0,(LPARAM)&chrg);
- SendMessage(window,EM_GETSCROLLPOS,0,(LPARAM)&scrool);
+ SendMessage(window, EM_EXGETSEL, 0, (LPARAM)&chrg);
+ SendMessage(window, EM_GETSCROLLPOS, 0, (LPARAM)&scrool);
if (selChar < chrg.cpMin || selChar > chrg.cpMax)
chrg.cpMin = chrg.cpMax = selChar;
@@ -732,7 +650,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
CHARRANGE chrgNew;
chrgNew.cpMin = chrg.cpMin;
chrgNew.cpMax = chrg.cpMax + 1;
- SendMessage(window,EM_EXSETSEL,0,(LPARAM)&chrgNew);
+ SendMessage(window, EM_EXSETSEL, 0, (LPARAM)&chrgNew);
}
CHARFORMAT2 chf;
memset(&chf, 0, sizeof(CHARFORMAT2));
@@ -740,7 +658,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
chf.dwMask = CFM_LINK;
SendMessage(window, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&chf);
if (chrg.cpMin == chrg.cpMax)
- SendMessage(window,EM_EXSETSEL,0,(LPARAM)&chrg);
+ SendMessage(window, EM_EXSETSEL, 0, (LPARAM)&chrg);
HMENU hPopupMenu = CreatePopupMenu();
if (hPopupMenu != NULL) {
@@ -764,23 +682,23 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
case IDM_COPY:
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;
+ while (start < historyWindow->currentGroup.size() && chrg.cpMin >= historyWindow->currentGroup[start].endPos) ++start;
if (start < historyWindow->currentGroup.size()) {
CHARRANGE chrgNew;
chrgNew.cpMin = 0;
if (start > 0)
chrgNew.cpMin = historyWindow->currentGroup[start - 1].endPos;
chrgNew.cpMax = historyWindow->currentGroup[start].endPos;
- SendMessage(window,EM_EXSETSEL,0,(LPARAM)&chrgNew);
- SendMessage(window,WM_COPY,0,0);
- SendMessage(window,EM_EXSETSEL,0,(LPARAM)&chrg);
+ SendMessage(window, EM_EXSETSEL, 0, (LPARAM)&chrgNew);
+ SendMessage(window, WM_COPY, 0, 0);
+ SendMessage(window, EM_EXSETSEL, 0, (LPARAM)&chrg);
}
}
- else SendMessage(window,WM_COPY,0,0);
+ else SendMessage(window, WM_COPY, 0, 0);
break;
case IDM_MESSAGE:
- CallFunctionAsync(ShowMessageWindow, new ShowMessageData(historyWindow->hContact));
+ CallFunctionAsync(ShowMessageWindow, new ShowMessageData(historyWindow->m_hContact));
break;
case IDM_QUOTE:
@@ -788,15 +706,15 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
std::wstring quote;
if (chrg.cpMax == chrg.cpMin) {
size_t start = 0;
- while(start < historyWindow->currentGroup.size() && chrg.cpMin >= historyWindow->currentGroup[start].endPos) ++start;
+ while (start < historyWindow->currentGroup.size() && chrg.cpMin >= historyWindow->currentGroup[start].endPos) ++start;
if (start < historyWindow->currentGroup.size())
historyWindow->FormatQuote(quote, historyWindow->currentGroup[start], historyWindow->currentGroup[start].description);
}
else {
size_t start = 0;
- while(start < historyWindow->currentGroup.size() && chrg.cpMin >= historyWindow->currentGroup[start].endPos) ++start;
+ 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;
+ while (end < historyWindow->currentGroup.size() && chrg.cpMax > historyWindow->currentGroup[end].endPos) ++end;
if (end >= historyWindow->currentGroup.size())
end = historyWindow->currentGroup.size() - 1;
if (start == end && start < historyWindow->currentGroup.size()) {
@@ -811,13 +729,13 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
tr.chrg.cpMin = iStart;
tr.chrg.cpMax = iEnd;
tr.lpstrText = new TCHAR[iEnd - iStart + 1];
- SendMessage(historyWindow->editWindow, EM_GETTEXTRANGE, 0, (LPARAM) & tr);
+ SendMessage(historyWindow->editWindow, EM_GETTEXTRANGE, 0, (LPARAM)& tr);
historyWindow->FormatQuote(quote, historyWindow->currentGroup[start], tr.lpstrText);
- delete [] tr.lpstrText;
+ delete[] tr.lpstrText;
}
}
else {
- while(start <= end) {
+ while (start <= end) {
historyWindow->FormatQuote(quote, historyWindow->currentGroup[start], historyWindow->currentGroup[start].description);
++start;
}
@@ -825,7 +743,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
}
if (!quote.empty())
- CallFunctionAsync(ShowMessageWindow, new ShowMessageData(historyWindow->hContact, quote));
+ CallFunctionAsync(ShowMessageWindow, new ShowMessageData(historyWindow->m_hContact, quote));
}
break;
case IDM_DELETE:
@@ -843,46 +761,44 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
{
int start = chrg.cpMin, end = chrg.cpMin;
CHARRANGE chrgNew;
- chrgNew.cpMin = start-1;
+ chrgNew.cpMin = start - 1;
chrgNew.cpMax = start;
- do
- {
+ do {
memset(&chf, 0, sizeof(CHARFORMAT2));
chf.cbSize = sizeof(CHARFORMAT2);
chf.dwMask = CFM_LINK;
- int sel = SendMessage(window,EM_EXSETSEL,0,(LPARAM)&chrgNew);
+ int sel = SendMessage(window, EM_EXSETSEL, 0, (LPARAM)&chrgNew);
if (sel != chrgNew.cpMax)
break;
SendMessage(window, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&chf);
--chrgNew.cpMin;
--chrgNew.cpMax;
--start;
- } while(start >= 0 && chf.dwEffects & CFE_LINK);
+ } while (start >= 0 && chf.dwEffects & CFE_LINK);
++start;
chrgNew.cpMin = end;
chrgNew.cpMax = end + 1;
- do
- {
+ do {
memset(&chf, 0, sizeof(CHARFORMAT2));
chf.cbSize = sizeof(CHARFORMAT2);
chf.dwMask = CFM_LINK;
- int sel = SendMessage(window,EM_EXSETSEL,0,(LPARAM)&chrgNew);
+ int sel = SendMessage(window, EM_EXSETSEL, 0, (LPARAM)&chrgNew);
if (sel != chrgNew.cpMax)
break;
SendMessage(window, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&chf);
++chrgNew.cpMin;
++chrgNew.cpMax;
++end;
- } while(chf.dwEffects & CFE_LINK);
+ } while (chf.dwEffects & CFE_LINK);
--end;
if (selected == IDM_COPYLINK) {
chrgNew.cpMin = start;
chrgNew.cpMax = end;
- SendMessage(window,EM_EXSETSEL,0,(LPARAM)&chrgNew);
- SendMessage(window,WM_COPY,0,0);
- SendMessage(window,EM_EXSETSEL,0,(LPARAM)&chrg);
+ SendMessage(window, EM_EXSETSEL, 0, (LPARAM)&chrgNew);
+ SendMessage(window, WM_COPY, 0, 0);
+ SendMessage(window, EM_EXSETSEL, 0, (LPARAM)&chrg);
}
else {
ENLINK link;
@@ -890,7 +806,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
link.chrg.cpMax = end;
link.msg = WM_LBUTTONUP;
link.nmhdr.code = selected;
- SendMessage(window,EM_EXSETSEL,0,(LPARAM)&chrg);
+ SendMessage(window, EM_EXSETSEL, 0, (LPARAM)&chrg);
ClickLink(window, &link);
}
}
@@ -899,7 +815,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
DestroyMenu(hPopupMenu);
}
- SendMessage(window,EM_SETSCROLLPOS,0,(LPARAM)&scrool);
+ SendMessage(window, EM_SETSCROLLPOS, 0, (LPARAM)&scrool);
DlgReturn(TRUE);
}
}
@@ -918,17 +834,17 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
if (historyWindow->DoHotkey(WM_KEYDOWN, 0, nmlv->wVKey, IDC_LIST))
DlgReturn(TRUE);
}
- else if (pNmhdr->code == NM_RCLICK) {
+ else if (pNmhdr->code == NM_RCLICK) {
POINT clicked;
LPNMITEMACTIVATE nmlv = (LPNMITEMACTIVATE)lParam;
HWND window = historyWindow->listWindow;
- LVHITTESTINFO info = {0};
+ LVHITTESTINFO info = { 0 };
clicked.x = info.pt.x = nmlv->ptAction.x;
clicked.y = info.pt.y = nmlv->ptAction.y;
ClientToScreen(window, &clicked);
int newSel = SendMessage(window, LVM_SUBITEMHITTEST, 0, (LPARAM)&info);
- if (newSel >= 0) {
+ if (newSel >= 0) {
HMENU hPopupMenu = CreatePopupMenu();
if (hPopupMenu != NULL) {
AppendMenu(hPopupMenu, MF_STRING, IDM_COPY, TranslateT("Copy"));
@@ -942,17 +858,17 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
case IDM_COPY:
{
CHARRANGE chrg;
- SendMessage(historyWindow->editWindow,EM_EXGETSEL,0,(LPARAM)&chrg);
+ SendMessage(historyWindow->editWindow, EM_EXGETSEL, 0, (LPARAM)&chrg);
CHARRANGE chrgNew;
chrgNew.cpMin = 0;
chrgNew.cpMax = -1;
- SendMessage(historyWindow->editWindow,EM_EXSETSEL,0,(LPARAM)&chrgNew);
- SendMessage(historyWindow->editWindow,WM_COPY,0,0);
- SendMessage(historyWindow->editWindow,EM_EXSETSEL,0,(LPARAM)&chrg);
+ SendMessage(historyWindow->editWindow, EM_EXSETSEL, 0, (LPARAM)&chrgNew);
+ SendMessage(historyWindow->editWindow, WM_COPY, 0, 0);
+ SendMessage(historyWindow->editWindow, EM_EXSETSEL, 0, (LPARAM)&chrg);
}
break;
case IDM_MESSAGE:
- CallService(MS_MSG_SENDMESSAGE, (WPARAM)historyWindow->hContact, 0);
+ CallService(MS_MSG_SENDMESSAGE, historyWindow->m_hContact, 0);
break;
case IDM_DELETEGROUP:
historyWindow->Delete(1);
@@ -970,9 +886,9 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
}
break;
- case IDC_TOOLBAR:
- if (pNmhdr->code == TBN_DROPDOWN) {
- LPNMTOOLBAR lpnmTB= (LPNMTOOLBAR)lParam;
+ case IDC_TOOLBAR:
+ if (pNmhdr->code == TBN_DROPDOWN) {
+ LPNMTOOLBAR lpnmTB = (LPNMTOOLBAR)lParam;
if (lpnmTB->iItem == IDM_FIND)
historyWindow->FindToolbarClicked(lpnmTB);
else if (lpnmTB->iItem == IDM_CONFIG)
@@ -1011,10 +927,10 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
SetBkColor(edithdc, Options::instance->GetColor(Options::FindBackground));
DlgReturn((LONG_PTR)historyWindow->bkFindBrush);
}
- }
+ }
break;
- case DM_SPLITTERMOVED:
+ case DM_SPLITTERMOVED:
historyWindow->SplitterMoved((HWND)lParam, wParam, true);
break;
@@ -1036,77 +952,74 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP
void HistoryWindow::Initialise()
{
- splitterXhWnd = GetDlgItem(hWnd, IDC_SPLITTER);
- splitterYhWnd = GetDlgItem(hWnd, IDC_SPLITTERV);
+ splitterXhWnd = GetDlgItem(m_hWnd, IDC_SPLITTER);
+ splitterYhWnd = GetDlgItem(m_hWnd, IDC_SPLITTERV);
mir_subclassWindow(splitterXhWnd, SplitterSubclassProc);
mir_subclassWindow(splitterYhWnd, SplitterSubclassProc);
- editWindow = GetDlgItem(hWnd, IDC_EDIT);
- findWindow = GetDlgItem(hWnd, IDC_FIND_TEXT);
- toolbarWindow = GetDlgItem(hWnd, IDC_TOOLBAR);
- listWindow = GetDlgItem(hWnd, IDC_LIST);
+ editWindow = GetDlgItem(m_hWnd, IDC_EDIT);
+ findWindow = GetDlgItem(m_hWnd, IDC_FIND_TEXT);
+ toolbarWindow = GetDlgItem(m_hWnd, IDC_TOOLBAR);
+ listWindow = GetDlgItem(m_hWnd, IDC_LIST);
RECT rc;
POINT pt;
GetWindowRect(splitterXhWnd, &rc);
pt.y = (rc.top + rc.bottom) / 2;
pt.x = 0;
- ScreenToClient(hWnd, &pt);
+ ScreenToClient(m_hWnd, &pt);
splitterOrgY = pt.y;
splitterY = pt.y;
GetWindowRect(splitterYhWnd, &rc);
pt.y = 0;
pt.x = (rc.left + rc.right) / 2;
- ScreenToClient(hWnd, &pt);
+ ScreenToClient(m_hWnd, &pt);
splitterOrgX = pt.x;
splitterX = pt.x;
- GetWindowRect(GetDlgItem(hWnd, IDC_LIST_CONTACTS), &rc);
+ GetWindowRect(GetDlgItem(m_hWnd, IDC_LIST_CONTACTS), &rc);
pt.y = rc.top;
pt.x = rc.left;
- ScreenToClient(hWnd, &pt);
+ ScreenToClient(m_hWnd, &pt);
listOryginalPos = pt.x;
plusIco = LoadIconEx(IDI_SHOW, 1);
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)
- {
- SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)minusIco);
- SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Hide Contacts"), BATF_TCHAR);
- Button_SetCheck(GetDlgItem(hWnd,IDC_SHOWHIDE), BST_CHECKED);
+ SendDlgItemMessage(m_hWnd, IDC_SHOWHIDE, BUTTONSETASPUSHBTN, TRUE, 0);
+ SendDlgItemMessage(m_hWnd, IDC_SHOWHIDE, BUTTONSETASFLATBTN, TRUE, 0);
+ if (m_hContact == NULL || Options::instance->showContacts) {
+ SendDlgItemMessage(m_hWnd, IDC_SHOWHIDE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)minusIco);
+ SendDlgItemMessage(m_hWnd, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Hide Contacts"), BATF_TCHAR);
+ Button_SetCheck(GetDlgItem(m_hWnd, IDC_SHOWHIDE), BST_CHECKED);
isContactList = true;
}
- else
- {
- SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)plusIco);
- SendDlgItemMessage( hWnd, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Show Contacts"), BATF_TCHAR);
- Button_SetCheck(GetDlgItem(hWnd,IDC_SHOWHIDE), BST_UNCHECKED);
- ShowWindow(GetDlgItem(hWnd,IDC_LIST_CONTACTS), SW_HIDE);
+ else {
+ SendDlgItemMessage(m_hWnd, IDC_SHOWHIDE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)plusIco);
+ SendDlgItemMessage(m_hWnd, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Show Contacts"), BATF_TCHAR);
+ Button_SetCheck(GetDlgItem(m_hWnd, IDC_SHOWHIDE), BST_UNCHECKED);
+ ShowWindow(GetDlgItem(m_hWnd, IDC_LIST_CONTACTS), SW_HIDE);
ShowWindow(splitterYhWnd, SW_HIDE);
isContactList = false;
}
- RegisterHotkeyControl(GetDlgItem(hWnd, IDC_SHOWHIDE));
- RegisterHotkeyControl(GetDlgItem(hWnd, IDC_LIST_CONTACTS));
+ RegisterHotkeyControl(GetDlgItem(m_hWnd, IDC_SHOWHIDE));
+ RegisterHotkeyControl(GetDlgItem(m_hWnd, IDC_LIST_CONTACTS));
+
+ ResetCList(m_hWnd);
- ResetCList(hWnd);
-
RestorePos();
- SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_HISTORY, true));
- SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_HISTORY));
- SendMessage(editWindow,EM_AUTOURLDETECT,TRUE,0);
- SendMessage(editWindow,EM_SETEVENTMASK,0,ENM_LINK | ENM_SELCHANGE | ENM_KEYEVENTS | ENM_MOUSEEVENTS);
- SendMessage(editWindow,EM_SETEDITSTYLE,SES_EXTENDBACKCOLOR,SES_EXTENDBACKCOLOR);
-
+ SendMessage(m_hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_HISTORY, true));
+ SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, (LPARAM)Skin_LoadIcon(SKINICON_OTHER_HISTORY));
+ SendMessage(editWindow, EM_AUTOURLDETECT, TRUE, 0);
+ SendMessage(editWindow, EM_SETEVENTMASK, 0, ENM_LINK | ENM_SELCHANGE | ENM_KEYEVENTS | ENM_MOUSEEVENTS);
+ SendMessage(editWindow, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR);
+
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];
for (int i = 0; i < iconsNum; ++i) {
- eventIcons[i] = IcoLib_GetIconByHandle( iconList[i].hIcolib );
+ eventIcons[i] = IcoLib_GetIconByHandle(iconList[i].hIcolib);
ImageList_AddIcon(himlSmall, eventIcons[i]);
}
@@ -1123,11 +1036,11 @@ void HistoryWindow::Initialise()
if ((isGroupImages = Options::instance->groupShowEvents) != false)
ListView_SetImageList(listWindow, himlSmall, LVSIL_SMALL);
}
-
+
bkBrush = CreateSolidBrush(Options::instance->GetColor(Options::WindowBackground));
- bkFindBrush = CreateSolidBrush(Options::instance->GetColor(Options::FindBackground));
+ bkFindBrush = CreateSolidBrush(Options::instance->GetColor(Options::FindBackground));
- LVCOLUMN col = {0};
+ LVCOLUMN col = { 0 };
col.mask = LVCF_WIDTH | LVCF_TEXT;
col.cx = 470;
col.pszText = _T("");
@@ -1142,10 +1055,9 @@ void HistoryWindow::Initialise()
Edit_LimitText(findWindow, 100);
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);
findPrevIco = LoadIconEx(IDI_FINDPREV);
@@ -1154,42 +1066,42 @@ void HistoryWindow::Initialise()
ImageList_AddIcon(himlButtons, configIco);
deleteIco = Skin_LoadIcon(SKINICON_OTHER_DELETE);
ImageList_AddIcon(himlButtons, deleteIco);
-
+
// Set the image list.
SendMessage(toolbarWindow, TB_SETIMAGELIST, 0, (LPARAM)himlButtons);
// Load the button images.
- SendMessage(toolbarWindow, TB_LOADIMAGES, (WPARAM)IDB_STD_SMALL_COLOR, (LPARAM)HINST_COMMCTRL);
+ SendMessage(toolbarWindow, TB_LOADIMAGES, IDB_STD_SMALL_COLOR, (LPARAM)HINST_COMMCTRL);
}
- TBBUTTON tbButtons[] =
+ TBBUTTON tbButtons[] =
{
{ 0, IDM_FIND, TBSTATE_ENABLED, BTNS_DROPDOWN, {0}, 0, (INT_PTR)TranslateT("Find Next") },
{ 3, IDM_DELETE, TBSTATE_ENABLED, BTNS_DROPDOWN, {0}, 0, (INT_PTR)TranslateT("Delete")},
{ 2, IDM_CONFIG, TBSTATE_ENABLED, BTNS_DROPDOWN, {0}, 0, (INT_PTR)TranslateT("Options")},
- };
- SendMessage(toolbarWindow, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
- SendMessage(toolbarWindow, TB_ADDBUTTONS, (WPARAM)_countof(tbButtons), (LPARAM)&tbButtons);
+ };
+ SendMessage(toolbarWindow, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
+ SendMessage(toolbarWindow, TB_ADDBUTTONS, _countof(tbButtons), (LPARAM)&tbButtons);
SendMessage(toolbarWindow, TB_SETBUTTONSIZE, 0, MAKELPARAM(16, 16));
SendMessage(toolbarWindow, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS);
SendMessage(toolbarWindow, TB_SETMAXTEXTROWS, 0, 0);
SetDefFilter(Options::instance->defFilter);
-
+
InvalidateRect(listWindow, NULL, TRUE);
- InvalidateRect(hWnd, NULL, TRUE);
- SendMessage(hWnd, DM_SETDEFID, IDM_FIND, 0);
- SendMessage(hWnd, WM_SIZE, 0, 0);
- SendMessage(hWnd,DM_HREBUILD,0,0);
+ InvalidateRect(m_hWnd, NULL, TRUE);
+ SendMessage(m_hWnd, DM_SETDEFID, IDM_FIND, 0);
+ SendMessage(m_hWnd, WM_SIZE, 0, 0);
+ SendMessage(m_hWnd, DM_HREBUILD, 0, 0);
isDestroyed = false;
}
void HistoryWindow::Destroy()
{
- HICON hIcon = (HICON)SendMessage(hWnd, WM_SETICON, ICON_BIG, 0);
+ HICON hIcon = (HICON)SendMessage(m_hWnd, WM_SETICON, ICON_BIG, 0);
IcoLib_ReleaseIcon(hIcon);
-
- hIcon = (HICON)SendMessage(hWnd, WM_SETICON, ICON_SMALL, 0);
+
+ hIcon = (HICON)SendMessage(m_hWnd, WM_SETICON, ICON_SMALL, 0);
IcoLib_ReleaseIcon(hIcon);
isDestroyed = true;
@@ -1203,9 +1115,8 @@ void HistoryWindow::SplitterMoved(HWND splitter, LONG pos, bool screenPos)
RECT rc2;
POINT pt1;
POINT pt2;
-
- if (splitter == splitterXhWnd)
- {
+
+ if (splitter == splitterXhWnd) {
GetWindowRect(listWindow, &rc1);
GetWindowRect(editWindow, &rc2);
pt.x = 0;
@@ -1215,21 +1126,17 @@ void HistoryWindow::SplitterMoved(HWND splitter, LONG pos, bool screenPos)
pt2.x = rc2.right;
pt2.y = rc2.bottom;
if (screenPos)
- ScreenToClient(hWnd, &pt);
- ScreenToClient(hWnd, &pt1);
- ScreenToClient(hWnd, &pt2);
- if ((pt.y >= pt1.y + MIN_PANELHEIGHT) && (pt.y < pt2.y - MIN_PANELHEIGHT))
- {
+ ScreenToClient(m_hWnd, &pt);
+ ScreenToClient(m_hWnd, &pt1);
+ ScreenToClient(m_hWnd, &pt2);
+ if ((pt.y >= pt1.y + MIN_PANELHEIGHT) && (pt.y < pt2.y - MIN_PANELHEIGHT)) {
splitterY = pt.y;
if (!screenPos)
- SendMessage(hWnd, WM_SIZE, 0, 0);
- //if (M->isAero())
- // InvalidateRect(GetParent(hwndDlg), NULL, FALSE);
+ SendMessage(m_hWnd, WM_SIZE, 0, 0);
}
}
- else
- {
- GetWindowRect(GetDlgItem(hWnd, IDC_LIST_CONTACTS), &rc1);
+ else {
+ GetWindowRect(GetDlgItem(m_hWnd, IDC_LIST_CONTACTS), &rc1);
GetWindowRect(listWindow, &rc2);
pt.x = pos;
pt.y = 0;
@@ -1238,24 +1145,21 @@ void HistoryWindow::SplitterMoved(HWND splitter, LONG pos, bool screenPos)
pt2.x = rc2.right;
pt2.y = rc2.bottom;
if (screenPos)
- ScreenToClient(hWnd, &pt);
- ScreenToClient(hWnd, &pt1);
- ScreenToClient(hWnd, &pt2);
- if ((pt.x >= pt1.x + MIN_PANELHEIGHT) && (pt.x < pt2.x - MIN_PANELHEIGHT))
- {
+ ScreenToClient(m_hWnd, &pt);
+ ScreenToClient(m_hWnd, &pt1);
+ ScreenToClient(m_hWnd, &pt2);
+ if ((pt.x >= pt1.x + MIN_PANELHEIGHT) && (pt.x < pt2.x - MIN_PANELHEIGHT)) {
splitterX = pt.x;
if (!screenPos)
- SendMessage(hWnd, WM_SIZE, 0, 0);
- //if (M->isAero())
- // InvalidateRect(GetParent(hwndDlg), NULL, FALSE);
+ SendMessage(m_hWnd, WM_SIZE, 0, 0);
}
}
}
int HistoryWindow::HistoryDlgResizer(HWND hwnd, LPARAM, UTILRESIZECONTROL *urc)
{
- HistoryWindow* historyWindow =(HistoryWindow*)GetWindowLongPtr(hwnd,GWLP_USERDATA);
- switch(urc->wId) {
+ HistoryWindow* historyWindow = (HistoryWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ switch (urc->wId) {
case IDC_LIST:
urc->rcItem.bottom += historyWindow->splitterY - historyWindow->splitterOrgY;
urc->rcItem.left += historyWindow->splitterX - historyWindow->splitterOrgX;
@@ -1265,7 +1169,7 @@ int HistoryWindow::HistoryDlgResizer(HWND hwnd, LPARAM, UTILRESIZECONTROL *urc)
case IDC_LIST_CONTACTS:
urc->rcItem.right += historyWindow->splitterX - historyWindow->splitterOrgX;
- return RD_ANCHORX_LEFT|RD_ANCHORY_HEIGHT;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_HEIGHT;
case IDC_SPLITTER:
urc->rcItem.top += historyWindow->splitterY - historyWindow->splitterOrgY;
@@ -1273,31 +1177,31 @@ int HistoryWindow::HistoryDlgResizer(HWND hwnd, LPARAM, UTILRESIZECONTROL *urc)
urc->rcItem.left += historyWindow->splitterX - historyWindow->splitterOrgX;
if (!historyWindow->isContactList)
urc->rcItem.left = 0;
- return RD_ANCHORX_WIDTH|RD_ANCHORY_TOP;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP;
case IDC_SPLITTERV:
urc->rcItem.left += historyWindow->splitterX - historyWindow->splitterOrgX;
urc->rcItem.right += historyWindow->splitterX - historyWindow->splitterOrgX;
- return RD_ANCHORX_LEFT|RD_ANCHORY_HEIGHT;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_HEIGHT;
case IDC_EDIT:
urc->rcItem.top += historyWindow->splitterY - historyWindow->splitterOrgY;
urc->rcItem.left += historyWindow->splitterX - historyWindow->splitterOrgX;
if (!historyWindow->isContactList)
urc->rcItem.left = historyWindow->listOryginalPos;
- return RD_ANCHORX_WIDTH|RD_ANCHORY_HEIGHT;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
case IDC_FIND_TEXT:
- return RD_ANCHORX_WIDTH|RD_ANCHORY_TOP;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP;
case IDC_TOOLBAR:
- return RD_ANCHORX_RIGHT|RD_ANCHORY_TOP;
+ return RD_ANCHORX_RIGHT | RD_ANCHORY_TOP;
}
- return RD_ANCHORX_LEFT|RD_ANCHORY_TOP;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
}
void HistoryWindow::FillHistoryThread(void* param)
{
- HistoryWindow *hInfo = ( HistoryWindow* )param;
+ HistoryWindow *hInfo = (HistoryWindow*)param;
HWND hwndList = hInfo->listWindow;
ListView_DeleteAllItems(hwndList);
hInfo->SelectEventGroup(-1);
@@ -1306,7 +1210,7 @@ void HistoryWindow::FillHistoryThread(void* param)
hInfo->RefreshEventList();
- LVITEM item = {0};
+ LVITEM item = { 0 };
item.mask = LVIF_STATE;
item.iItem = 0;
item.state = LVIS_SELECTED;
@@ -1363,8 +1267,8 @@ void HistoryWindow::ReplaceIcons(HWND hwndDlg, int selStart, BOOL isSent)
SMADD_RICHEDIT3 smadd = { 0 };
smadd.cbSize = sizeof(smadd);
smadd.hwndRichEditControl = hwndDlg;
- smadd.Protocolname = GetContactProto(hContact);
- smadd.hContact = hContact;
+ smadd.Protocolname = GetContactProto(m_hContact);
+ smadd.hContact = m_hContact;
smadd.flags = isSent ? SAFLRE_OUTGOING : 0;
if (selStart > 0)
smadd.rangeToReplace = &sel;
@@ -1373,9 +1277,8 @@ void HistoryWindow::ReplaceIcons(HWND hwndDlg, int selStart, BOOL isSent)
void SetFontFromOptions(ITextFont *TextFont, int caps, Options::Fonts fontId)
{
- COLORREF fontColor;
LOGFONT font;
- fontColor = Options::instance->GetFont(fontId, &font);
+ COLORREF fontColor = Options::instance->GetFont(fontId, &font);
BSTR bstrFont = SysAllocString(font.lfFaceName);
TextFont->SetName(bstrFont);
SysFreeString(bstrFont);
@@ -1393,15 +1296,14 @@ void HistoryWindow::SelectEventGroup(int sel)
SetWindowText(editWindow, _T(""));
currentGroup.clear();
selected = sel;
- if (sel < 0 || sel >= (int)eventList.size())
+ if (sel < 0 || sel >= (int)m_eventList.size())
return;
TCHAR _str[MAXSELECTSTR + 8]; // for safety reason
- TCHAR *str = _str + sizeof(int)/sizeof(TCHAR);
+ TCHAR *str = _str + sizeof(int) / sizeof(TCHAR);
BSTR pStr = str;
unsigned int *strLen = (unsigned int*)_str;
str[0] = 0;
- tm lastTime;
bool isFirst = true;
bool lastMe = false;
long startAt, endAt;
@@ -1411,25 +1313,28 @@ void HistoryWindow::SelectEventGroup(int sel)
EventData data;
if (SendMessage(editWindow, EM_GETOLEINTERFACE, 0, (LPARAM)&RichEditOle) == 0)
return;
+
ITextDocument* TextDocument;
if (RichEditOle->QueryInterface(IID_ITextDocument, (void**)&TextDocument) != S_OK) {
RichEditOle->Release();
return;
}
+
ITextSelection* TextSelection;
ITextFont *TextFont;
SendMessage(editWindow, EM_SETREADONLY, FALSE, 0);
TextDocument->Freeze(&cnt);
TextDocument->GetSelection(&TextSelection);
- HDC hDC = GetDC(NULL);
+ HDC hDC = GetDC(NULL);
int caps = GetDeviceCaps(hDC, LOGPIXELSY);
std::deque<EventIndex> revDeq;
- std::deque<EventIndex>& deq = eventList[sel];
+ std::deque<EventIndex> &deq = m_eventList[sel];
if (Options::instance->messagesNewOnTop) {
revDeq.insert(revDeq.begin(), deq.rbegin(), deq.rend());
deq = revDeq;
}
+ struct tm lastTime = { 0 };
COLORREF backColor = GetSysColor(COLOR_WINDOW);
for (std::deque<EventIndex>::iterator it = deq.begin(); it != deq.end(); ++it) {
EventIndex hDbEvent = *it;
@@ -1486,10 +1391,7 @@ void HistoryWindow::SelectEventGroup(int sel)
TextFont->Release();
if (isUser) {
- if (lastMe)
- mir_sntprintf(str, MAXSELECTSTR, _T("%s\n"), myName);
- else
- mir_sntprintf(str, MAXSELECTSTR, _T("%s\n"), contactName);
+ mir_sntprintf(str, MAXSELECTSTR, _T("%s\n"), (lastMe) ? m_myName : m_contactName);
*strLen = (unsigned int)mir_tstrlen(str) * sizeof(TCHAR);
TextSelection->SetStart(MAXLONG);
TextSelection->GetFont(&TextFont);
@@ -1588,7 +1490,7 @@ LRESULT CALLBACK HistoryWindow::SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM
void HistoryWindow::EnableWindows(BOOL enable)
{
- EnableWindow(GetDlgItem(hWnd,IDC_LIST_CONTACTS), enable);
+ EnableWindow(GetDlgItem(m_hWnd, IDC_LIST_CONTACTS), enable);
EnableWindow(listWindow, enable);
EnableWindow(findWindow, enable);
EnableWindow(toolbarWindow, enable);
@@ -1597,13 +1499,13 @@ void HistoryWindow::EnableWindows(BOOL enable)
void HistoryWindow::ReloadContacts()
{
- HWND contactList = GetDlgItem(hWnd,IDC_LIST_CONTACTS);
+ HWND contactList = GetDlgItem(m_hWnd, IDC_LIST_CONTACTS);
if (HistoryEventList::GetContactMessageNumber(NULL)) {
if (hSystem == NULL) {
CLCINFOITEM cii = { sizeof(cii) };
cii.flags = CLCIIF_GROUPFONT | CLCIIF_BELOWCONTACTS;
cii.pszText = TranslateT("System");
- hSystem = (MCONTACT)SendMessage(contactList, CLM_ADDINFOITEM, 0, (LPARAM) & cii);
+ hSystem = (MCONTACT)SendMessage(contactList, CLM_ADDINFOITEM, 0, (LPARAM)& cii);
}
}
else {
@@ -1626,8 +1528,8 @@ void HistoryWindow::ReloadContacts()
}
}
- if (hContact != NULL) {
- HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, hContact, 0);
+ if (m_hContact != NULL) {
+ HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, m_hContact, 0);
if (hItem != NULL) {
SendMessage(contactList, CLM_ENSUREVISIBLE, (WPARAM)hItem, 0);
SendMessage(contactList, CLM_SELECTITEM, (WPARAM)hItem, 0);
@@ -1641,8 +1543,8 @@ void HistoryWindow::ReloadContacts()
bool HistoryWindow::DoHotkey(UINT msg, LPARAM lParam, WPARAM wParam, int window)
{
- MSG message;
- message.hwnd = hWnd;
+ MSG message;
+ message.hwnd = m_hWnd;
message.message = msg;
message.lParam = lParam;
message.wParam = wParam;
@@ -1665,8 +1567,8 @@ bool HistoryWindow::DoHotkey(UINT msg, LPARAM lParam, WPARAM wParam, int window)
searcher.SetMatchWholeWords(!searcher.IsMatchWholeWords());
break;
case HISTORY_HK_SHOWCONTACTS:
- Button_SetCheck(GetDlgItem(hWnd, IDC_SHOWHIDE), Button_GetCheck(GetDlgItem(hWnd, IDC_SHOWHIDE)) & BST_CHECKED ? BST_UNCHECKED : BST_CHECKED);
- SendMessage(hWnd, WM_COMMAND, MAKELONG(IDC_SHOWHIDE, BN_CLICKED), NULL);
+ Button_SetCheck(GetDlgItem(m_hWnd, IDC_SHOWHIDE), Button_GetCheck(GetDlgItem(m_hWnd, IDC_SHOWHIDE)) & BST_CHECKED ? BST_UNCHECKED : BST_CHECKED);
+ SendMessage(m_hWnd, WM_COMMAND, MAKELONG(IDC_SHOWHIDE, BN_CLICKED), NULL);
break;
case HISTORY_HK_ONLYIN:
searcher.SetOnlyIn(!searcher.IsOnlyIn());
@@ -1681,19 +1583,19 @@ bool HistoryWindow::DoHotkey(UINT msg, LPARAM lParam, WPARAM wParam, int window)
searcher.SetAllUsers(!searcher.IsAllUsers());
break;
case HISTORY_HK_EXRHTML:
- ExportManager(hWnd, hContact, GetFilterNr()).Export(IExport::RichHtml);
+ ExportManager(m_hWnd, m_hContact, GetFilterNr()).Export(IExport::RichHtml);
break;
case HISTORY_HK_EXPHTML:
- ExportManager(hWnd, hContact, GetFilterNr()).Export(IExport::PlainHtml);
+ ExportManager(m_hWnd, m_hContact, GetFilterNr()).Export(IExport::PlainHtml);
break;
case HISTORY_HK_EXTXT:
- ExportManager(hWnd, hContact, GetFilterNr()).Export(IExport::Txt);
+ ExportManager(m_hWnd, m_hContact, GetFilterNr()).Export(IExport::Txt);
break;
case HISTORY_HK_EXBIN:
- ExportManager(hWnd, hContact, GetFilterNr()).Export(IExport::Binary);
+ ExportManager(m_hWnd, m_hContact, GetFilterNr()).Export(IExport::Binary);
break;
case HISTORY_HK_EXDAT:
- ExportManager(hWnd, hContact, GetFilterNr()).Export(IExport::Dat);
+ ExportManager(m_hWnd, m_hContact, GetFilterNr()).Export(IExport::Dat);
break;
case HISTORY_HK_IMPBIN:
DoImport(IImport::Binary);
@@ -1718,18 +1620,18 @@ bool HistoryWindow::DoHotkey(UINT msg, LPARAM lParam, WPARAM wParam, int window)
void HistoryWindow::RestorePos()
{
- MCONTACT contactToLoad = hContact;
- if (hContact == NULL) {
- Utils_RestoreWindowPosition(hWnd,NULL,MODULE,"history_");
+ MCONTACT contactToLoad = m_hContact;
+ if (m_hContact == NULL) {
+ Utils_RestoreWindowPosition(m_hWnd, NULL, MODULE, "history_");
contactToLoad = NULL;
}
- else if (Utils_RestoreWindowPosition(hWnd,hContact,MODULE,"history_") != 0) {
- Utils_RestoreWindowPosition(hWnd,NULL,MODULE,"history_");
+ else if (Utils_RestoreWindowPosition(m_hWnd, m_hContact, MODULE, "history_") != 0) {
+ Utils_RestoreWindowPosition(m_hWnd, NULL, MODULE, "history_");
contactToLoad = NULL;
}
if (db_get_b(contactToLoad, MODULE, "history_ismax", 0))
- ShowWindow(hWnd, SW_SHOWMAXIMIZED);
+ ShowWindow(m_hWnd, SW_SHOWMAXIMIZED);
LONG pos = db_get_dw(contactToLoad, MODULE, "history_splitterv", 0);
if (pos > 0)
@@ -1742,7 +1644,7 @@ void HistoryWindow::RestorePos()
void HistoryWindow::SavePos(bool all)
{
- MCONTACT contactToSave = hContact;
+ MCONTACT contactToSave = m_hContact;
if (all) {
for (MCONTACT _hContact = db_find_first(); _hContact; _hContact = db_find_next(_hContact)) {
db_unset(_hContact, MODULE, "history_x");
@@ -1757,10 +1659,10 @@ void HistoryWindow::SavePos(bool all)
contactToSave = NULL;
}
- Utils_SaveWindowPosition(hWnd, contactToSave, MODULE, "history_");
+ Utils_SaveWindowPosition(m_hWnd, contactToSave, MODULE, "history_");
WINDOWPLACEMENT wp;
wp.length = sizeof(wp);
- GetWindowPlacement(hWnd, &wp);
+ GetWindowPlacement(m_hWnd, &wp);
db_set_b(contactToSave, MODULE, "history_ismax", wp.showCmd == SW_MAXIMIZE ? 1 : 0);
db_set_dw(contactToSave, MODULE, "history_splitterv", splitterX);
db_set_dw(contactToSave, MODULE, "history_splitter", splitterY);
@@ -1801,8 +1703,8 @@ void HistoryWindow::FindToolbarClicked(LPNMTOOLBAR lpnmTB)
else
SetMenuDefaultItem(hPopupMenu, IDM_FINDNEXT, FALSE);
- int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, hWnd, 0);
- switch (selected) {
+ int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, 0);
+ switch (iResult) {
case IDM_FINDNEXT:
searcher.ChangeFindDirection(false);
break;
@@ -1829,16 +1731,16 @@ void HistoryWindow::FindToolbarClicked(LPNMTOOLBAR lpnmTB)
break;
case IDM_FILTERDEF:
SetDefFilter(0);
- SendMessage(hWnd, DM_HREBUILD, 0, 0);
+ SendMessage(m_hWnd, DM_HREBUILD, 0, 0);
break;
case IDM_FILTERALL:
SetDefFilter(1);
- SendMessage(hWnd, DM_HREBUILD, 0, 0);
+ SendMessage(m_hWnd, DM_HREBUILD, 0, 0);
break;
default:
- if (selected >= DEF_FILTERS_START) {
- SetDefFilter(selected - DEF_FILTERS_START + 2);
- SendMessage(hWnd, DM_HREBUILD, 0, 0);
+ if (iResult >= DEF_FILTERS_START) {
+ SetDefFilter(iResult - DEF_FILTERS_START + 2);
+ SendMessage(m_hWnd, DM_HREBUILD, 0, 0);
}
break;
}
@@ -1880,10 +1782,10 @@ void HistoryWindow::ConfigToolbarClicked(LPNMTOOLBAR lpnmTB)
AppendMenu(hPopupMenu, MF_STRING, IDM_SAVEPOSALL, TranslateT("Save window position for all contacts"));
SetMenuDefaultItem(hPopupMenu, IDM_OPTIONS, FALSE);
- int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, hWnd, 0);
- switch (selected) {
+ int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, 0);
+ switch (iResult) {
case IDM_OPTIONS:
- SendMessage(hWnd, WM_COMMAND, IDM_CONFIG, 0);
+ SendMessage(m_hWnd, WM_COMMAND, IDM_CONFIG, 0);
break;
case IDM_FONTS:
OpenOptions("Customize", "Fonts and colors");
@@ -1901,23 +1803,23 @@ void HistoryWindow::ConfigToolbarClicked(LPNMTOOLBAR lpnmTB)
SavePos(true);
break;
case IDM_EXPORTRHTML:
- ExportManager(hWnd, hContact, GetFilterNr()).Export(IExport::RichHtml);
+ ExportManager(m_hWnd, m_hContact, GetFilterNr()).Export(IExport::RichHtml);
break;
case IDM_EXPORTPHTML:
- ExportManager(hWnd, hContact, GetFilterNr()).Export(IExport::PlainHtml);
+ ExportManager(m_hWnd, m_hContact, GetFilterNr()).Export(IExport::PlainHtml);
break;
case IDM_EXPORTTXT:
- ExportManager(hWnd, hContact, GetFilterNr()).Export(IExport::Txt);
+ ExportManager(m_hWnd, m_hContact, GetFilterNr()).Export(IExport::Txt);
break;
case IDM_EXPORTBINARY:
- ExportManager(hWnd, hContact, GetFilterNr()).Export(IExport::Binary);
+ ExportManager(m_hWnd, m_hContact, GetFilterNr()).Export(IExport::Binary);
break;
case IDM_EXPORTDAT:
- ExportManager(hWnd, hContact, GetFilterNr()).Export(IExport::Dat);
+ ExportManager(m_hWnd, m_hContact, GetFilterNr()).Export(IExport::Dat);
break;
case IDM_IMPORTBINARY:
@@ -1937,7 +1839,7 @@ void HistoryWindow::ConfigToolbarClicked(LPNMTOOLBAR lpnmTB)
void HistoryWindow::DoImport(IImport::ImportType type)
{
- ExportManager exp(hWnd, hContact, GetFilterNr());
+ ExportManager exp(m_hWnd, m_hContact, GetFilterNr());
std::vector<IImport::ExternalMessage> messages;
std::wstring err;
std::vector<MCONTACT> contacts;
@@ -1946,40 +1848,39 @@ void HistoryWindow::DoImport(IImport::ImportType type)
contacts.push_back(_hContact);
bool changeContact = false;
- MCONTACT lastContact = hContact;
+ MCONTACT lastContact = m_hContact;
int i = 1;
do {
bool differentContact = false;
if (exp.Import(type, messages, &err, &differentContact, &contacts)) {
- int act = MessageBox(hWnd, TranslateT("Do you want to save imported messages to local profile?"), TranslateT("Import"), MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON2);
+ int act = MessageBox(m_hWnd, TranslateT("Do you want to save imported messages to local profile?"), TranslateT("Import"), MB_ICONQUESTION | MB_YESNOCANCEL | MB_DEFBUTTON2);
if (act == IDYES) {
MargeMessages(messages);
if (!changeContact)
- HistoryWindow::RebuildEvents(hContact);
+ HistoryWindow::RebuildEvents(m_hContact);
}
else if (act == IDNO) {
- HistoryEventList::AddImporter(hContact, type, exp.GetFileName());
+ HistoryEventList::AddImporter(m_hContact, type, exp.GetFileName());
if (!changeContact)
- HistoryWindow::RebuildEvents(hContact);
+ HistoryWindow::RebuildEvents(m_hContact);
}
}
else if (differentContact) {
- int act = MessageBox(hWnd, TranslateT("File contains history for different contact. Do you want to change contact and import?"), TranslateT("Error"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2);
+ int act = MessageBox(m_hWnd, TranslateT("File contains history for different contact. Do you want to change contact and import?"), TranslateT("Error"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2);
if (act == IDYES) {
changeContact = true;
- hContact = exp.hContact;
+ m_hContact = exp.m_hContact;
}
}
else if (!err.empty())
- MessageBox(hWnd, err.c_str(), TranslateT("Error"), MB_ICONERROR);
- }
- while (changeContact && i--);
+ MessageBox(m_hWnd, err.c_str(), TranslateT("Error"), MB_ICONERROR);
+ } while (changeContact && i--);
if (changeContact) {
- hContact = lastContact;
+ m_hContact = lastContact;
ReloadContacts();
- SelectContact(exp.hContact);
- HistoryWindow::RebuildEvents(exp.hContact);
+ SelectContact(exp.m_hContact);
+ HistoryWindow::RebuildEvents(exp.m_hContact);
}
}
@@ -1995,8 +1896,8 @@ void HistoryWindow::DeleteToolbarClicked(LPNMTOOLBAR lpnmTB)
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) {
+ int iResult = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hWnd, 0);
+ switch (iResult) {
case IDM_DELETE:
Delete(0);
break;
@@ -2017,7 +1918,7 @@ 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)m_eventList.size() || what > 2 || what < 0)
return;
if (what == 0) {
CHARRANGE chrg;
@@ -2040,7 +1941,7 @@ void HistoryWindow::Delete(int what)
toDelete = (int)end;
}
else {
- DeleteAllUserHistory(hContact, 0);
+ DeleteAllUserHistory(m_hContact, 0);
return;
}
@@ -2049,13 +1950,13 @@ void HistoryWindow::Delete(int what)
TCHAR message[256];
mir_sntprintf(message, _countof(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(m_hWnd, message, TranslateT("Are You sure?"), MB_OKCANCEL | MB_ICONERROR) != IDOK)
return;
bool areImpMessages = false;
bool rebuild = false;
for (size_t i = start; i < end; ++i) {
- EventIndex& ev = eventList[selected][i];
+ EventIndex& ev = m_eventList[selected][i];
DeleteEvent(ev);
areImpMessages |= ev.isExternal;
}
@@ -2063,15 +1964,15 @@ void HistoryWindow::Delete(int what)
rebuild = (start == 0 && end == currentGroup.size());
if (areImpMessages) {
- TCHAR *message = TranslateT("Do you want to 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) {
- HistoryEventList::DeleteImporter(hContact);
+ TCHAR *ptszMsg = TranslateT("Do you want to delete all imported messages for this contact?\nNote that next scheduler task import this messages again.");
+ if (MessageBox(m_hWnd, ptszMsg, TranslateT("Are You sure?"), MB_YESNO | MB_ICONERROR) == IDYES) {
+ HistoryEventList::DeleteImporter(m_hContact);
rebuild = true;
}
}
if (rebuild)
- RebuildEvents(hContact);
+ RebuildEvents(m_hContact);
else {
RebuildGroup(selected);
SelectEventGroup(selected);
@@ -2081,14 +1982,14 @@ void HistoryWindow::Delete(int what)
bool HistoryWindow::ContactChanged(bool sync)
{
if (!isLoading) {
- MCONTACT hItem = (MCONTACT)SendDlgItemMessage(hWnd, IDC_LIST_CONTACTS, CLM_GETSELECTION, 0, 0);
+ MCONTACT hItem = (MCONTACT)SendDlgItemMessage(m_hWnd, IDC_LIST_CONTACTS, CLM_GETSELECTION, 0, 0);
if (hItem != NULL) {
- int typeOf = SendDlgItemMessage(hWnd, IDC_LIST_CONTACTS, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
+ int typeOf = SendDlgItemMessage(m_hWnd, IDC_LIST_CONTACTS, CLM_GETITEMTYPE, (WPARAM)hItem, 0);
if (typeOf == CLCIT_CONTACT) {
- if (hContact != hItem) {
+ if (m_hContact != hItem) {
ChangeToFreeWindow(this);
isLoading = true;
- hContact = hItem;
+ m_hContact = hItem;
ReloadContacts();
if (sync)
FillHistoryThread(this);
@@ -2098,10 +1999,10 @@ bool HistoryWindow::ContactChanged(bool sync)
}
}
else if (typeOf == CLCIT_INFO && hSystem == hItem) {
- if (hContact != NULL) {
+ if (m_hContact != NULL) {
ChangeToFreeWindow(this);
isLoading = true;
- hContact = NULL;
+ m_hContact = NULL;
ReloadContacts();
if (sync)
FillHistoryThread(this);
@@ -2127,12 +2028,12 @@ void HistoryWindow::GroupImagesChanged()
}
}
-void HistoryWindow::FormatQuote(std::wstring& quote, const MessageData& md, const std::wstring& msg)
+void HistoryWindow::FormatQuote(std::wstring &quote, const MessageData &md, const std::wstring &msg)
{
if (md.isMe)
- quote += myName;
+ quote += m_myName;
else
- quote += contactName;
+ quote += m_contactName;
TCHAR str[32];
TimeZone_PrintTimeStamp(NULL, md.timestamp, _T("d t"), str, 32, 0);
quote += _T(", ");
@@ -2159,93 +2060,55 @@ void HistoryWindow::FormatQuote(std::wstring& quote, const MessageData& md, cons
f = -1;
}
else f = -1;
- }
- while (f > 0 && f < (int)msg.length());
+ } while (f > 0 && f < (int)msg.length());
}
MCONTACT HistoryWindow::GetNextContact(MCONTACT hContact, int adder)
{
- HWND contactList = GetDlgItem(hWnd, IDC_LIST_CONTACTS);
- bool find = false;
- MCONTACT _hContact;
+ HWND contactList = GetDlgItem(m_hWnd, IDC_LIST_CONTACTS);
if (adder > 0) {
if (hContact != NULL) {
- _hContact = db_find_next(hContact);
- while (_hContact) {
- HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
- if (hItem != NULL) {
- find = true;
- break;
- }
+ for (MCONTACT cc = db_find_next(hContact); cc; cc = db_find_next(cc))
+ if (SendMessage(contactList, CLM_FINDCONTACT, cc, 0) != NULL)
+ return cc;
- _hContact = db_find_next(_hContact);
- }
-
- if (!find && HistoryEventList::GetContactMessageNumber(NULL)) {
- _hContact = NULL;
- find = true;
- }
+ if (HistoryEventList::GetContactMessageNumber(NULL))
+ return NULL;
}
- if (!find) {
- _hContact = db_find_first();
- while (_hContact && _hContact != hContact) {
- HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
- if (hItem != NULL) {
- find = true;
- break;
- }
-
- _hContact = db_find_next(_hContact);
- }
- }
+ for (MCONTACT cc = db_find_first(); cc && cc != hContact; cc = db_find_next(cc))
+ if (SendMessage(contactList, CLM_FINDCONTACT, cc, 0) != NULL)
+ return cc;
}
else {
MCONTACT lastContact = NULL;
- _hContact = db_find_first();
- while (_hContact && _hContact != hContact) {
- HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
- if (hItem != NULL)
- lastContact = _hContact;
-
- _hContact = db_find_next(_hContact);
- }
+ for (MCONTACT cc = db_find_first(); cc && cc != hContact; cc = db_find_next(cc))
+ if (SendMessage(contactList, CLM_FINDCONTACT, cc, 0) != NULL)
+ lastContact = cc;
if (hContact != NULL) {
if (lastContact == NULL && !HistoryEventList::GetContactMessageNumber(NULL)) {
- _hContact = db_find_next(hContact);
- while (_hContact) {
- HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
- if (hItem != NULL)
- lastContact = _hContact;
-
- _hContact = db_find_next(_hContact);
- }
+ for (MCONTACT cc = db_find_next(hContact); cc; cc = db_find_next(cc))
+ if (SendMessage(contactList, CLM_FINDCONTACT, cc, 0) != NULL)
+ lastContact = cc;
}
- if (lastContact != NULL || HistoryEventList::GetContactMessageNumber(NULL)) {
- _hContact = lastContact;
- find = true;
- }
- }
- else if (lastContact != NULL) {
- _hContact = lastContact;
- find = true;
+ if (lastContact != NULL || HistoryEventList::GetContactMessageNumber(NULL))
+ return lastContact;
}
+ else if (lastContact != NULL)
+ return lastContact;
}
- if (find)
- return _hContact;
-
return hContact;
}
-void HistoryWindow::SelectContact(MCONTACT _hContact)
+void HistoryWindow::SelectContact(MCONTACT hContact)
{
- if (hContact != _hContact) {
- HWND contactList = GetDlgItem(hWnd, IDC_LIST_CONTACTS);
- if (_hContact != NULL) {
- HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0);
+ if (m_hContact != hContact) {
+ HWND contactList = GetDlgItem(m_hWnd, IDC_LIST_CONTACTS);
+ if (hContact != NULL) {
+ HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, hContact, 0);
if (hItem != NULL) {
SendMessage(contactList, CLM_ENSUREVISIBLE, (WPARAM)hItem, 0);
SendMessage(contactList, CLM_SELECTITEM, (WPARAM)hItem, 0);
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp
index 44fe768616..523cc4bce1 100644
--- a/plugins/BasicHistory/src/Options.cpp
+++ b/plugins/BasicHistory/src/Options.cpp
@@ -1747,9 +1747,9 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
BOOL isOK = FALSE;
toCp.eventDeltaTime = GetDlgItemInt(hwndDlg, IDC_EVENT_TIME, &isOK, TRUE);
if (!isOK) {
- TCHAR msg[256];
- mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value."), TranslateT("Events older than"));
- MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
+ TCHAR tszBuf[256];
+ mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Events older than"));
+ MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR);
break;
}
toCp.eventUnit = (enum TaskOptions::EventUnit)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_EVENT_UNIT));
@@ -1778,9 +1778,9 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
toCp.dayOfMonth = GetDlgItemInt(hwndDlg, IDC_TRIGER_DAY, &isOK, FALSE);
if (!isOK) {
if (toCp.trigerType == TaskOptions::Monthly) {
- TCHAR msg[256];
- mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value."), TranslateT("Day"));
- MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
+ TCHAR tszBuf[256];
+ mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Day"));
+ MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR);
break;
}
else toCp.dayOfMonth = to->dayOfMonth;
@@ -1788,9 +1788,9 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
toCp.deltaTime = GetDlgItemInt(hwndDlg, IDC_TRIGER_DELTA_TIME, &isOK, FALSE);
if (!isOK) {
if (toCp.trigerType == TaskOptions::DeltaMin || toCp.trigerType == TaskOptions::DeltaHour) {
- TCHAR msg[256];
- mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value."), TranslateT("Delta time"));
- MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
+ TCHAR tszBuf[256];
+ mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Delta time"));
+ MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR);
break;
}
else toCp.deltaTime = to->deltaTime;
@@ -1802,14 +1802,14 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam,
to->taskName = L"";
if (!IsValidTask(toCp, top->tasks, &err, &errDescr)) {
to->taskName = lastName;
- TCHAR msg[256];
+ TCHAR tszBuf[256];
if (err.empty())
- _tcscpy_s(msg, TranslateT("Some value is invalid"));
+ _tcscpy_s(tszBuf, TranslateT("Some value is invalid"));
else if (errDescr.empty())
- mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value."), err.c_str());
+ mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), err.c_str());
else
- mir_sntprintf(msg, _countof(msg), TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
- MessageBox(hwndDlg, msg, TranslateT("Error"), MB_ICONERROR);
+ mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str());
+ MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR);
break;
}
diff --git a/plugins/BasicHistory/src/PlainHtmlExport.cpp b/plugins/BasicHistory/src/PlainHtmlExport.cpp
index 006782e96a..b2f4d9b1a8 100644
--- a/plugins/BasicHistory/src/PlainHtmlExport.cpp
+++ b/plugins/BasicHistory/src/PlainHtmlExport.cpp
@@ -85,7 +85,7 @@ void PlainHtmlExport::WriteMessage(bool isMe, const std::wstring &longDate, cons
TCHAR *id = isMe ? _T("out") : _T("inc");
TCHAR* ev = (isMe ? _T("1") : _T("0"));
bool isUrl = false;
- std::wstring& mes = UrlHighlightHtml(MakeTextHtmled(message), isUrl);
+ std::wstring mes = UrlHighlightHtml(MakeTextHtmled(message), isUrl);
if (isUrl)
ev = _T("2");
EXP_FILE << _T("<div class=mes id=event") << ev << _T(">\n");
diff --git a/plugins/BasicHistory/src/RichHtmlExport.cpp b/plugins/BasicHistory/src/RichHtmlExport.cpp
index 0c08f97368..5301e76b9d 100644
--- a/plugins/BasicHistory/src/RichHtmlExport.cpp
+++ b/plugins/BasicHistory/src/RichHtmlExport.cpp
@@ -120,16 +120,16 @@ std::wstring GetName(const std::wstring &path)
return path;
}
-void ExtractFile(short int res, const std::wstring &fileName)
+void ExtractFile(short int iRes, const std::wstring &fileName)
{
- HRSRC rSrc = FindResource(hInst, MAKEINTRESOURCE(res), MAKEINTRESOURCE(CUSTOMRES));
+ HRSRC rSrc = FindResource(hInst, MAKEINTRESOURCE(iRes), MAKEINTRESOURCE(CUSTOMRES));
if (rSrc != NULL) {
HGLOBAL res = LoadResource(hInst, rSrc);
int size = SizeofResource(hInst, rSrc);
if (res != NULL) {
char* resData = (char*)LockResource(res);
if (resData != NULL) {
- std::ofstream stream (fileName.c_str(), std::ios_base::binary);
+ std::ofstream stream(fileName.c_str(), std::ios_base::binary);
if (stream.is_open()) {
stream.write(resData, size);
stream.close();
@@ -371,7 +371,7 @@ void RichHtmlExport::WriteGroup(bool isMe, const std::wstring &time, const std::
EXP_FILE << _T("</div>\n");
bool isUrl = false;
- std::wstring& mes = ReplaceSmileys(isMe, eventText, isUrl);
+ std::wstring mes = ReplaceSmileys(isMe, eventText, isUrl);
EXP_FILE << _T("<div class=mes id=session>\n");
EXP_FILE << _T("<span class=eventimg id=") << id << _T("><img src=\"") << folderName << _T("\\pnode.ico\" class=sessionimage width=\"16\" height=\"16\" onclick=\"toggleFolder('group") << groupId << _T("', this)\"/>");
EXP_FILE << _T("<img src=\"") << folderName << _T("\\event") << ev << _T(".ico\" class=sessionimage width=\"16\" height=\"16\" onclick=\"toggleFolder('group") << groupId << _T("', this)\"/></span>\n");
@@ -387,7 +387,7 @@ void RichHtmlExport::WriteMessage(bool isMe, const std::wstring &longDate, const
TCHAR* ev = (isMe ? _T("1") : _T("0"));
TCHAR* ev1 = ev;
bool isUrl = false;
- std::wstring& mes = ReplaceSmileys(isMe, message, isUrl);
+ std::wstring mes = ReplaceSmileys(isMe, message, isUrl);
if (isUrl)
ev = _T("2");
EXP_FILE << _T("<div class=mes id=event") << ev << _T(">\n");
diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp
index 4ac0220a21..cd4129a5f5 100644
--- a/plugins/BasicHistory/src/Scheduler.cpp
+++ b/plugins/BasicHistory/src/Scheduler.cpp
@@ -304,7 +304,7 @@ bool DoTask(TaskOptions& to)
}
for (size_t i = 0; i < to.contacts.size(); ++i) {
- mExp.hContact = to.contacts[i];
+ mExp.m_hContact = to.contacts[i];
std::wstring n = GetFileName(filePath, mExp.GetContactName(), existingContacts1, true);
n = ReplaceExt(n, ext);
files.push_back(n);
@@ -363,7 +363,7 @@ bool DoTask(TaskOptions& to)
std::map<std::wstring, bool> existingContacts;
std::wstring name = GetName(*it);
for (ret = 0; ret < (int)contacts.size(); ++ret) {
- mExp.hContact = contacts[ret];
+ mExp.m_hContact = contacts[ret];
std::wstring n = GetFileName(to.filePath, mExp.GetContactName(), existingContacts, true);
n = ReplaceExt(n, ext);
n = GetName(n);
@@ -377,16 +377,16 @@ bool DoTask(TaskOptions& to)
}
if (ret >= 0) {
- mExp.hContact = contacts[ret];
+ mExp.m_hContact = contacts[ret];
if (to.type == TaskOptions::Import) {
- HistoryEventList::AddImporter(mExp.hContact, to.importType, *it);
- contactList.push_back(mExp.hContact);
+ HistoryEventList::AddImporter(mExp.m_hContact, to.importType, *it);
+ contactList.push_back(mExp.m_hContact);
}
else {
std::vector<IImport::ExternalMessage> messages;
if (mExp.Import(to.importType, messages, NULL)) {
mExp.MargeMessages(messages);
- contactList.push_back(mExp.hContact);
+ contactList.push_back(mExp.m_hContact);
}
}
}
@@ -410,13 +410,13 @@ bool DoTask(TaskOptions& to)
}
if (contactList.size() > 0) {
- MCONTACT *contacts = new MCONTACT[contactList.size() + 1];
- contacts[0] = (MCONTACT)contactList.size();
+ MCONTACT *pContacts = new MCONTACT[contactList.size() + 1];
+ pContacts[0] = (MCONTACT)contactList.size();
int i = 1;
for (std::list<MCONTACT>::iterator it = contactList.begin(); it != contactList.end(); ++it)
- contacts[i++] = *it;
+ pContacts[i++] = *it;
- QueueUserAPC(DoRebuildEventsInMainAPCFunc, g_hMainThread, (ULONG_PTR) contacts);
+ QueueUserAPC(DoRebuildEventsInMainAPCFunc, g_hMainThread, (ULONG_PTR)pContacts);
}
}
@@ -452,7 +452,7 @@ bool DoTask(TaskOptions& to)
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;
+ exp->m_useImportedMessages = to.exportImported;
if (!exp->Export(to.exportType)) {
error = true;
if (!errorStr.empty())
@@ -474,7 +474,7 @@ bool DoTask(TaskOptions& to)
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;
+ exp->m_useImportedMessages = to.exportImported;
if (!exp->Export(to.exportType)) {
error = true;
if (!errorStr.empty())
@@ -800,44 +800,48 @@ static void CALLBACK DoTaskFinishInMainAPCFunc(ULONG_PTR dwParam)
bool ExecuteCurrentTask(time_t now)
{
- mir_cslock lck(Options::instance->criticalSection);
TaskOptions to;
bool isExport = false;
- for (std::vector<TaskOptions>::iterator it = Options::instance->taskOptions.begin(); it != Options::instance->taskOptions.end(); ++it) {
- if (it->forceExecute) {
- it->lastExport = time(NULL);
- Options::instance->SaveTaskTime(*it);
- to = *it;
- isExport = true;
- break;
- }
- else if (it->active && it->trigerType != TaskOptions::AtStart && it->trigerType != TaskOptions::AtEnd) {
- time_t t = GetNextExportTime(*it);
- if (t <= now) {
+ {
+ mir_cslock lck(Options::instance->criticalSection);
+ for (auto it = Options::instance->taskOptions.begin(); it != Options::instance->taskOptions.end(); ++it) {
+ if (it->forceExecute) {
it->lastExport = time(NULL);
Options::instance->SaveTaskTime(*it);
to = *it;
isExport = true;
break;
}
+ else if (it->active && it->trigerType != TaskOptions::AtStart && it->trigerType != TaskOptions::AtEnd) {
+ time_t t = GetNextExportTime(*it);
+ if (t <= now) {
+ it->lastExport = time(NULL);
+ Options::instance->SaveTaskTime(*it);
+ to = *it;
+ isExport = true;
+ break;
+ }
+ }
}
}
if (isExport) {
bool error = DoTask(to);
if (to.forceExecute) {
- mir_cslock lck(Options::instance->criticalSection);
- for (std::vector<TaskOptions>::iterator it = Options::instance->taskOptions.begin(); it != Options::instance->taskOptions.end(); ++it) {
- if (it->taskName == to.taskName) {
- it->forceExecute = false;
- it->showMBAfterExecute = false;
- break;
+ {
+ mir_cslock lck(Options::instance->criticalSection);
+ for (auto it = Options::instance->taskOptions.begin(); it != Options::instance->taskOptions.end(); ++it) {
+ if (it->taskName == to.taskName) {
+ it->forceExecute = false;
+ it->showMBAfterExecute = false;
+ break;
+ }
}
}
if (to.showMBAfterExecute) {
size_t size = to.taskName.size() + 1024;
- TCHAR* name = new TCHAR[size];
+ TCHAR *name = new TCHAR[size];
if (error)
mir_sntprintf(name, size, TranslateT("Task '%s' execution failed"), to.taskName.c_str());
else
@@ -864,7 +868,7 @@ void GetZipFileTime(const TCHAR *file, uLong *dt)
/* calculate the CRC32 of a file,
because to encrypt a file, we need known the CRC32 of the file before */
-bool GetFileCrc(const TCHAR* filenameinzip, unsigned char* buf, unsigned long, unsigned long* result_crc)
+bool GetFileCrc(const TCHAR *filenameinzip, unsigned char *buf, unsigned long, unsigned long *result_crc)
{
unsigned long calculate_crc = 0;
bool error = true;
@@ -890,7 +894,7 @@ bool GetFileCrc(const TCHAR* filenameinzip, unsigned char* buf, unsigned long, u
return error;
}
-bool ZipFiles(const std::wstring& dir, std::wstring zipFilePath, const std::string& password)
+bool ZipFiles(const std::wstring &dir, std::wstring zipFilePath, const std::string &password)
{
std::list<std::wstring> files;
std::map<std::wstring, bool> existingContacts;
@@ -977,7 +981,7 @@ bool ZipFiles(const std::wstring& dir, std::wstring zipFilePath, const std::stri
return error;
}
-bool UnzipFiles(const std::wstring& dir, std::wstring& zipFilePath, const std::string& password)
+bool UnzipFiles(const std::wstring &dir, std::wstring &zipFilePath, const std::string &password)
{
bool error = false;
zlib_filefunc_def pzlib_filefunc_def;
@@ -1094,7 +1098,7 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std::
std::map<std::wstring, bool> existingContacts;
ListDirectory(dir, L"\\", files);
if (files.size() > 0) {
- std::wofstream stream ((dir + _T("\\script.sc")).c_str());
+ std::wofstream stream((dir + _T("\\script.sc")).c_str());
if (stream.is_open()) {
std::wstring ftpDir = GetDirectoryName(filePath);
ftpDir = GetFileName(ftpDir, L"", existingContacts, false);
@@ -1102,7 +1106,7 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std::
<< ftpName << "\"\noption transfer binary\n";
std::wstring lastCD;
size_t filSize = files.size();
- while(files.size() > 0) {
+ while (files.size() > 0) {
std::wstring localDir = *files.begin();
std::wstring currentCD = ftpDir + GetDirectoryName(ReplaceStr(localDir, L'\\', L'/'));
if (currentCD != lastCD) {
@@ -1123,23 +1127,26 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std::
std::wstring &log = Options::instance->ftpLogPath;
CreateDirectory(GetDirectoryName(log).c_str(), NULL);
DeleteFile(log.c_str());
+
TCHAR cmdLine[MAX_PATH];
mir_sntprintf(cmdLine, _countof(cmdLine), _T("\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc"), Options::instance->ftpExePath.c_str(), log.c_str());
- STARTUPINFO startupInfo = {0};
- PROCESS_INFORMATION processInfo;
- startupInfo.cb = sizeof(STARTUPINFO);
+
+ STARTUPINFO startupInfo = { 0 };
+ startupInfo.cb = sizeof(STARTUPINFO);
+
+ PROCESS_INFORMATION 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())
return false;
-
- std::wifstream logStream (log.c_str());
+
+ std::wifstream logStream(log.c_str());
if (logStream.is_open()) {
bool isInMDTM = false;
std::list<std::wstring> dates;
- while(!logStream.eof()) {
+ while (!logStream.eof()) {
std::wstring lineStr;
std::getline(logStream, lineStr);
if (lineStr.length() > 1) {
@@ -1190,7 +1197,7 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std::
bool FtpGetFiles(const std::wstring& dir, const std::list<std::wstring>& files, const std::wstring& ftpName)
{
std::wstring script = dir + _T("\\script.sc");
- std::wofstream stream (script.c_str());
+ std::wofstream stream(script.c_str());
if (stream.is_open()) {
stream << "option batch continue\noption confirm off\nopen \""
<< ftpName << "\"\noption transfer binary\n";
@@ -1204,7 +1211,7 @@ bool FtpGetFiles(const std::wstring& dir, const std::list<std::wstring>& files,
stream << "cd \"" << currentCD << "\"\n";
lastCD = currentCD;
}
-
+
stream << "get \"" << fileName << "\"\n";
}
@@ -1214,9 +1221,9 @@ bool FtpGetFiles(const std::wstring& dir, const std::list<std::wstring>& files,
DeleteFile(log.c_str());
TCHAR cmdLine[MAX_PATH];
mir_sntprintf(cmdLine, _countof(cmdLine), _T("\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc"), Options::instance->ftpExePath.c_str(), log.c_str());
- STARTUPINFO startupInfo = {0};
+ STARTUPINFO startupInfo = { 0 };
PROCESS_INFORMATION processInfo;
- startupInfo.cb = sizeof(STARTUPINFO);
+ startupInfo.cb = sizeof(STARTUPINFO);
if (CreateProcess(NULL, cmdLine, NULL, NULL, FALSE, 0, NULL, dir.c_str(), &startupInfo, &processInfo)) {
WaitForSingleObject(processInfo.hProcess, INFINITE);
CloseHandle(processInfo.hThread);
@@ -1236,37 +1243,39 @@ bool FtpGetFiles(const std::wstring& dir, const std::list<std::wstring>& files,
return true;
}
-void CreatePath(const TCHAR *szDir)
+void CreatePath(const TCHAR *szDir)
{
if (!szDir) return;
DWORD dwAttributes;
- TCHAR *pszLastBackslash, szTestDir[ MAX_PATH ];
+ TCHAR *pszLastBackslash, szTestDir[MAX_PATH];
- mir_tstrncpy( szTestDir, szDir, _countof( szTestDir ));
- if (( dwAttributes = GetFileAttributes( szTestDir )) != INVALID_FILE_ATTRIBUTES && ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ))
+ mir_tstrncpy(szTestDir, szDir, _countof(szTestDir));
+ if ((dwAttributes = GetFileAttributes(szTestDir)) != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
return;
- pszLastBackslash = _tcsrchr( szTestDir, '\\' );
- if ( pszLastBackslash == NULL )
+ pszLastBackslash = _tcsrchr(szTestDir, '\\');
+ if (pszLastBackslash == NULL)
return;
*pszLastBackslash = '\0';
- CreatePath( szTestDir );
+ CreatePath(szTestDir);
*pszLastBackslash = '\\';
- CreateDirectory( szTestDir, NULL );
+ CreateDirectory(szTestDir, NULL);
}
INT_PTR ExecuteTaskService(WPARAM wParam, LPARAM)
{
- mir_cslock lck(Options::instance->criticalSection);
- int taskNr = (int)wParam;
- if (taskNr < 0 || taskNr >= (int)Options::instance->taskOptions.size())
- return FALSE;
+ {
+ mir_cslock lck(Options::instance->criticalSection);
+ int taskNr = (int)wParam;
+ if (taskNr < 0 || taskNr >= (int)Options::instance->taskOptions.size())
+ return FALSE;
- Options::instance->taskOptions[taskNr].forceExecute = true;
- Options::instance->taskOptions[taskNr].showMBAfterExecute = true;
+ Options::instance->taskOptions[taskNr].forceExecute = true;
+ Options::instance->taskOptions[taskNr].showMBAfterExecute = true;
+ }
StartThread(false);
return TRUE;
}
@@ -1293,15 +1302,15 @@ void DoError(const TaskOptions& to, const std::wstring _error)
dbei.pBlob = (PBYTE)buf;
db_event_add(NULL, &dbei);
}
-
+
if (Options::instance->schedulerAlerts) {
- if ( CallService(MS_SYSTEM_TERMINATED, 0, 0))
+ if (CallService(MS_SYSTEM_TERMINATED, 0, 0))
return;
-
- if ( ServiceExists(MS_POPUP_ADDPOPUPCLASS))
+
+ if (ServiceExists(MS_POPUP_ADDPOPUPCLASS))
ShowClassPopupT(MODULE, msg, (wchar_t*)_error.c_str());
- else if ( ServiceExists(MS_POPUP_ADDPOPUPT)) {
- POPUPDATAT ppd = {0};
+ else if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
+ POPUPDATAT ppd = { 0 };
ppd.lchIcon = Skin_LoadIcon(SKINICON_OTHER_HISTORY);
_tcscpy_s(ppd.lptzContactName, msg);
_tcscpy_s(ppd.lptzText, _error.c_str());
diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp
index 2723c6c764..bac7c8f37c 100644
--- a/plugins/BasicHistory/src/Searcher.cpp
+++ b/plugins/BasicHistory/src/Searcher.cpp
@@ -106,7 +106,7 @@ void Searcher::Find()
if (!str[0]) {
TCHAR buf[256];
mir_sntprintf(buf, TranslateT("\"%s\" not found"), str);
- MessageBox(context->hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(context->m_hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
return;
}
if (!matchCase) {
@@ -123,7 +123,7 @@ void Searcher::Find()
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);
+ SendDlgItemMessage(context->m_hWnd,IDC_EDIT,EM_EXGETSEL,0,(LPARAM)&ft.chrg);
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;
@@ -136,7 +136,7 @@ void Searcher::Find()
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->m_hContact && isFindSelChanged && context->selected == startFindSel && ((!findBack1 && ft.chrg.cpMin >= startFindPos) || (findBack1 && ft.chrg.cpMax <= startFindPos)))
finished = true;
else {
curSel = lastFindSelection;
@@ -157,7 +157,7 @@ void Searcher::Find()
if (startFindPos < 0)
startFindPos = 0;
isFindSelChanged = false;
- startFindContact = context->hContact;
+ startFindContact = context->m_hContact;
isFindContactChanged = !allUsers;
if (findBack1) {
for (curSel = (int)context->currentGroup.size() - 1; curSel >= 0; --curSel)
@@ -190,7 +190,7 @@ void Searcher::Find()
}
SendMessage(context->editWindow,EM_FINDTEXTEX, findStyle,(LPARAM)&ft);
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->m_hContact && isFindSelChanged && context->selected == startFindSel && ((!findBack1 && ft.chrg.cpMin >= startFindPos) || (findBack1 && ft.chrg.cpMax <= startFindPos))) {
finished = true;
break;
}
@@ -203,7 +203,7 @@ void Searcher::Find()
}
}
- if (isFindContactChanged && startFindContact == context->hContact && isFindSelChanged && context->selected == startFindSel)
+ if (isFindContactChanged && startFindContact == context->m_hContact && isFindSelChanged && context->selected == startFindSel)
finished = true;
if (!finished) {
@@ -223,7 +223,7 @@ void Searcher::Find()
if (sel < 0) {
isFindContactChanged = true;
if (allUsers) {
- MCONTACT hNext = context->hContact;
+ MCONTACT hNext = context->m_hContact;
do
{
hNext = context->GetNextContact(hNext, adder2);
@@ -232,12 +232,12 @@ void Searcher::Find()
context->SelectContact(hNext);
}
- sel = (int)context->eventList.size() - 1;
+ sel = (int)context->m_eventList.size() - 1;
}
- else if (sel >= (int)context->eventList.size()) {
+ else if (sel >= (int)context->m_eventList.size()) {
isFindContactChanged = true;
if (allUsers) {
- MCONTACT hNext = context->hContact;
+ MCONTACT hNext = context->m_hContact;
do
{
hNext = context->GetNextContact(hNext, adder2);
@@ -268,13 +268,13 @@ void Searcher::Find()
Find();
return;
}
- if (startFindContact == context->hContact && sel == startFindSel)
+ if (startFindContact == context->m_hContact && sel == startFindSel)
break;
}
}
}
- if (startFindContact != context->hContact)
+ if (startFindContact != context->m_hContact)
context->SelectContact(startFindContact);
if (startFindSel != context->selected) {
@@ -300,19 +300,19 @@ void Searcher::Find()
TCHAR buf[256];
GetWindowText(context->findWindow, str, _countof(str));
mir_sntprintf(buf, TranslateT("\"%s\" not found"), str);
- MessageBox(context->hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
+ MessageBox(context->m_hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
}
- else MessageBox(context->hWnd, TranslateTS(onlyGroup ? LPGENT("You have reached the end of the group.") : LPGENT("You have reached the end of the history.")), TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
+ else MessageBox(context->m_hWnd, TranslateTS(onlyGroup ? LPGENT("You have reached the end of the group.") : LPGENT("You have reached the end of the history.")), TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
}
bool Searcher::IsInSel(int sel, TCHAR *strFind)
{
- if (sel < 0 || sel >= (int)context->eventList.size())
+ if (sel < 0 || sel >= (int)context->m_eventList.size())
return false;
TCHAR str[MAXSELECTSTR + 8]; // for safety reason
HistoryEventList::EventData data;
- for (std::deque<HistoryEventList::EventIndex>::iterator it = context->eventList[sel].begin(); it != context->eventList[sel].end(); ++it) {
+ for (std::deque<HistoryEventList::EventIndex>::iterator it = context->m_eventList[sel].begin(); it != context->m_eventList[sel].end(); ++it) {
HistoryEventList::EventIndex hDbEvent = *it;
if (context->GetEventData(hDbEvent, data)) {
bool isMe = data.isMe;