From 10bc9e42dfba6ed8be41199243d688c2e367dc0d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 30 Jun 2015 18:59:38 +0000 Subject: MS_CLIST_GETSTATUSMODEDESCRIPTION & MS_CLIST_GETCONTACTDISPLAYNAME replaced with pcli->* members git-svn-id: http://svn.miranda-ng.org/main/trunk@14459 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/BasicHistory/src/BasicHistory.cpp | 4 +- plugins/BasicHistory/src/DatExport.cpp | 2 +- plugins/BasicHistory/src/EventList.cpp | 84 +++++++++++++++--------------- plugins/BasicHistory/src/EventList.h | 8 +-- plugins/BasicHistory/src/ExportManager.cpp | 2 +- plugins/BasicHistory/src/ExportManager.h | 2 +- plugins/BasicHistory/src/HistoryWindow.cpp | 20 +++---- plugins/BasicHistory/src/Scheduler.cpp | 2 +- plugins/BasicHistory/src/SearchContext.h | 2 +- plugins/BasicHistory/src/Searcher.cpp | 6 +-- 10 files changed, 67 insertions(+), 65 deletions(-) (limited to 'plugins/BasicHistory/src') diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index 3c372011a4..38cf5d3044 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -18,6 +18,7 @@ along with this program. If not, see . #include "stdafx.h" +CLIST_INTERFACE *pcli; HINSTANCE hInst; #define MS_HISTORY_DELETEALLCONTACTHISTORY "BasicHistory/DeleteAllContactHistory" @@ -240,6 +241,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); + mir_getCLI(); hTaskMainMenu = NULL; DuplicateHandle(GetCurrentProcess(),GetCurrentThread(),GetCurrentProcess(),&g_hMainThread,0,FALSE,DUPLICATE_SAME_ACCESS); @@ -256,7 +258,7 @@ extern "C" int __declspec(dllexport) Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); HookEvent(ME_OPT_INITIALISE, Options::InitOptions); - EventList::Init(); + HistoryEventList::Init(); Icon_Register(hInst, LPGEN("History"), iconList, _countof(iconList)); return 0; diff --git a/plugins/BasicHistory/src/DatExport.cpp b/plugins/BasicHistory/src/DatExport.cpp index 43809f6f58..f11cef9a17 100644 --- a/plugins/BasicHistory/src/DatExport.cpp +++ b/plugins/BasicHistory/src/DatExport.cpp @@ -182,7 +182,7 @@ bool DatExport::GetEventList(std::vector& eventList) info.timestamp = messageHeader.timestamp; info.cbBlob = messageHeader.cbBlob; info.pBlob = (PBYTE)memBuf.c_str(); - EventList::GetObjectDescription(&info, _str, MAXSELECTSTR); + HistoryEventList::GetObjectDescription(&info, _str, MAXSELECTSTR); exMsg.message = _str; sortedEvents.insert(std::pair(messageHeader.timestamp, exMsg)); dataSize -= messageHeader.cbSize + messageHeader.cbBlob; diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index 947c2139d8..b6b5ec7a02 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -29,7 +29,7 @@ static mir_cs csEventList; bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true); std::wstring GetName(const std::wstring &path); -EventList::EventList() +HistoryEventList::HistoryEventList() :hWnd(NULL), isWnd(false), hContact(NULL), @@ -42,7 +42,7 @@ EventList::EventList() goldBlobSize = 0; } -EventList::EventList(MCONTACT _hContact, int filter) +HistoryEventList::HistoryEventList(MCONTACT _hContact, int filter) :hWnd(NULL), isWnd(false), hContact(_hContact), @@ -56,13 +56,13 @@ EventList::EventList(MCONTACT _hContact, int filter) SetDefFilter(filter); } -EventList::~EventList() +HistoryEventList::~HistoryEventList() { mir_free(gdbei.pBlob); eventList.clear(); } -bool EventList::CanShowHistory(DBEVENTINFO* dbei) +bool HistoryEventList::CanShowHistory(DBEVENTINFO* dbei) { if (deltaTime != 0) { if (deltaTime > 0) { @@ -106,7 +106,7 @@ bool EventList::CanShowHistory(DBEVENTINFO* dbei) return false; } -bool EventList::CanShowHistory(const IImport::ExternalMessage& message) +bool HistoryEventList::CanShowHistory(const IImport::ExternalMessage& message) { if (deltaTime != 0) { if (deltaTime > 0) { @@ -145,7 +145,7 @@ bool EventList::CanShowHistory(const IImport::ExternalMessage& message) return false; } -void EventList::InitFilters() +void HistoryEventList::InitFilters() { filterMap.clear(); onlyInFilter = false; @@ -169,7 +169,7 @@ void EventList::InitFilters() else filterName = L""; } -void EventList::SetDefFilter(int filter) +void HistoryEventList::SetDefFilter(int filter) { defFilter = filter; if (filter >= 2 && filter - 2 < (int)Options::instance->customFilters.size()) @@ -180,17 +180,17 @@ void EventList::SetDefFilter(int filter) filterName = TranslateT("Default history events"); } -int EventList::GetFilterNr() +int HistoryEventList::GetFilterNr() { return defFilter; } -std::wstring EventList::GetFilterName() +std::wstring HistoryEventList::GetFilterName() { return filterName; } -void EventList::GetTempList(std::list& tempList, bool noFilter, bool noExt, MCONTACT _hContact) +void HistoryEventList::GetTempList(std::list& tempList, bool noFilter, bool noExt, MCONTACT _hContact) { bool isWndLocal = isWnd; EventTempIndex ti; @@ -231,7 +231,7 @@ void EventList::GetTempList(std::list& tempList, bool noFilter, } } -void EventList::RefreshEventList() +void HistoryEventList::RefreshEventList() { InitNames(); InitFilters(); @@ -240,7 +240,7 @@ void EventList::RefreshEventList() std::vector messages; { mir_cslock lck(csEventList); - std::map::iterator it = contactFileMap.find(hContact); + std::map::iterator it = contactFileMap.find(hContact); if (it != contactFileMap.end()) { ExportManager imp(hWnd, hContact, 1); imp.SetAutoImport(it->second.file); @@ -300,7 +300,7 @@ void EventList::RefreshEventList() } } -bool EventList::SearchInContact(MCONTACT hContact, TCHAR *strFind, ComparatorInterface* compFun) +bool HistoryEventList::SearchInContact(MCONTACT hContact, TCHAR *strFind, ComparatorInterface* compFun) { InitFilters(); @@ -308,7 +308,7 @@ bool EventList::SearchInContact(MCONTACT hContact, TCHAR *strFind, ComparatorInt std::vector messages; { mir_cslock lck(csEventList); - std::map::iterator it = contactFileMap.find(hContact); + std::map::iterator it = contactFileMap.find(hContact); if (it != contactFileMap.end()) { ExportManager imp(hWnd, hContact, 1); imp.SetAutoImport(it->second.file); @@ -341,11 +341,11 @@ bool EventList::SearchInContact(MCONTACT hContact, TCHAR *strFind, ComparatorInt return false; } -void EventList::InitNames() +void HistoryEventList::InitNames() { TCHAR str[200]; if (hContact) { - _tcscpy_s(contactName, 256, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR )); + _tcscpy_s(contactName, 256, pcli->pfnGetContactDisplayName(hContact, 0)); mir_sntprintf(str, _countof(str), TranslateT("History for %s"),contactName); } else { @@ -359,7 +359,7 @@ void EventList::InitNames() _tcscpy_s(myName, GetMyName().c_str()); } -void EventList::AddGroup(const EventIndex& ev) +void HistoryEventList::AddGroup(const EventIndex& ev) { EventData data; GetEventData(ev, data); @@ -388,10 +388,10 @@ void EventList::AddGroup(const EventIndex& ev) AddGroup(data.isMe, time, user, eventText, ico); } -std::wstring EventList::GetContactName() +std::wstring HistoryEventList::GetContactName() { if (hContact) - return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR ); + return pcli->pfnGetContactDisplayName(hContact, 0); return TranslateT("System"); } @@ -416,7 +416,7 @@ void GetInfo(CONTACTINFO& ci, std::wstring& str) } } -std::wstring EventList::GetMyName() +std::wstring HistoryEventList::GetMyName() { std::wstring myName; CONTACTINFO ci; @@ -448,18 +448,18 @@ inline std::wstring GetProtocolName(MCONTACT hContact) return proto1; } -std::wstring EventList::GetProtocolName() +std::wstring HistoryEventList::GetProtocolName() { return ::GetProtocolName(hContact); } -std::string EventList::GetBaseProtocol() +std::string HistoryEventList::GetBaseProtocol() { char* proto = GetContactProto(hContact); return proto == NULL ? "" : proto; } -std::wstring EventList::GetMyId() +std::wstring HistoryEventList::GetMyId() { std::wstring myId; CONTACTINFO ci; @@ -485,7 +485,7 @@ inline std::wstring GetContactId(MCONTACT hContact) return id; } -std::wstring EventList::GetContactId() +std::wstring HistoryEventList::GetContactId() { return ::GetContactId(hContact); } @@ -498,12 +498,12 @@ static void GetMessageDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf ) mir_free(msg); } -void EventList::GetObjectDescription( DBEVENTINFO *dbei, TCHAR* str, int cbStr ) +void HistoryEventList::GetObjectDescription( DBEVENTINFO *dbei, TCHAR* str, int cbStr ) { GetMessageDescription( dbei, str, cbStr ); } -bool EventList::GetEventIcon(bool isMe, int eventType, int &id) +bool HistoryEventList::GetEventIcon(bool isMe, int eventType, int &id) { switch(eventType) { case EVENTTYPE_MESSAGE: @@ -524,7 +524,7 @@ bool EventList::GetEventIcon(bool isMe, int eventType, int &id) } } -void EventList::ImportMessages(const std::vector& messages) +void HistoryEventList::ImportMessages(const std::vector& messages) { DWORD lastTime = 0; importedMessages.clear(); @@ -540,7 +540,7 @@ void EventList::ImportMessages(const std::vector& mess } } -void EventList::MargeMessages(const std::vector& messages) +void HistoryEventList::MargeMessages(const std::vector& messages) { ImportMessages(messages); std::list tempList; @@ -572,7 +572,7 @@ void EventList::MargeMessages(const std::vector& messa ImportMessages(emessages); } -bool EventList::GetEventData(const EventIndex& ev, EventData& data) +bool HistoryEventList::GetEventData(const EventIndex& ev, EventData& data) { if (!ev.isExternal) { DWORD newBlobSize = db_event_getBlobSize(ev.hEvent); @@ -600,7 +600,7 @@ bool EventList::GetEventData(const EventIndex& ev, EventData& data) return false; } -void EventList::GetExtEventDBei(const EventIndex& ev) +void HistoryEventList::GetExtEventDBei(const EventIndex& ev) { IImport::ExternalMessage& em = importedMessages[ev.exIdx]; gdbei.flags = em.flags | 0x800; @@ -608,7 +608,7 @@ void EventList::GetExtEventDBei(const EventIndex& ev) gdbei.timestamp = em.timestamp; } -HICON EventList::GetEventCoreIcon(const EventIndex& ev) +HICON HistoryEventList::GetEventCoreIcon(const EventIndex& ev) { if (ev.isExternal) return NULL; @@ -621,7 +621,7 @@ HICON EventList::GetEventCoreIcon(const EventIndex& ev) return ico; } -void EventList::RebuildGroup(int selected) +void HistoryEventList::RebuildGroup(int selected) { std::deque newGroup; for (size_t i = 0; i < eventList[selected].size(); ++i) { @@ -637,10 +637,10 @@ void EventList::RebuildGroup(int selected) eventList[selected].insert(eventList[selected].begin(), newGroup.begin(), newGroup.end()); } -std::map EventList::contactFileMap; -std::wstring EventList::contactFileDir; +std::map HistoryEventList::contactFileMap; +std::wstring HistoryEventList::contactFileDir; -void EventList::AddImporter(MCONTACT hContact, IImport::ImportType type, const std::wstring& file) +void HistoryEventList::AddImporter(MCONTACT hContact, IImport::ImportType type, const std::wstring& file) { mir_cslock lck(csEventList); @@ -653,7 +653,7 @@ void EventList::AddImporter(MCONTACT hContact, IImport::ImportType type, const s contactFileMap[hContact] = data; } -void EventList::Init() +void HistoryEventList::Init() { TCHAR temp[MAX_PATH]; temp[0] = 0; @@ -664,33 +664,33 @@ void EventList::Init() CreateDirectory(contactFileDir.c_str(), NULL); } -int EventList::GetContactMessageNumber(MCONTACT hContact) +int HistoryEventList::GetContactMessageNumber(MCONTACT hContact) { int count = db_event_count(hContact); mir_cslock lck(csEventList); - std::map::iterator it = contactFileMap.find(hContact); + std::map::iterator it = contactFileMap.find(hContact); if (it != contactFileMap.end()) ++count; return count; } -bool EventList::IsImportedHistory(MCONTACT hContact) +bool HistoryEventList::IsImportedHistory(MCONTACT hContact) { bool count = false; mir_cslock lck(csEventList); - std::map::iterator it = contactFileMap.find(hContact); + std::map::iterator it = contactFileMap.find(hContact); if (it != contactFileMap.end()) count = true; return count; } -void EventList::DeleteImporter(MCONTACT hContact) +void HistoryEventList::DeleteImporter(MCONTACT hContact) { mir_cslock lck(csEventList); - std::map::iterator it = contactFileMap.find(hContact); + std::map::iterator it = contactFileMap.find(hContact); if (it != contactFileMap.end()) { DeleteFile(it->second.file.c_str()); contactFileMap.erase(it); diff --git a/plugins/BasicHistory/src/EventList.h b/plugins/BasicHistory/src/EventList.h index 3b037b0a5a..e0586f30ce 100644 --- a/plugins/BasicHistory/src/EventList.h +++ b/plugins/BasicHistory/src/EventList.h @@ -27,7 +27,7 @@ public: virtual bool Compare(const bool isMe, const std::wstring& message, TCHAR *strFind) = 0; }; -class EventList +class HistoryEventList { public: struct EventData @@ -101,9 +101,9 @@ protected: void RebuildGroup(int selected); public: - EventList(); - EventList(MCONTACT _hContact, int filter); - ~EventList(); + HistoryEventList(); + HistoryEventList(MCONTACT _hContact, int filter); + ~HistoryEventList(); HWND hWnd; MCONTACT hContact; diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp index e6fef029e1..0800d6ad89 100644 --- a/plugins/BasicHistory/src/ExportManager.cpp +++ b/plugins/BasicHistory/src/ExportManager.cpp @@ -27,7 +27,7 @@ along with this program. If not, see . #include "codecvt_CodePage.h" ExportManager::ExportManager(HWND _hwnd, MCONTACT _hContact, int filter) : - EventList(_hContact, filter), + HistoryEventList(_hContact, filter), hwnd(_hwnd), oldOnTop(false) { diff --git a/plugins/BasicHistory/src/ExportManager.h b/plugins/BasicHistory/src/ExportManager.h index 09fa0c697b..ea3aa208b3 100644 --- a/plugins/BasicHistory/src/ExportManager.h +++ b/plugins/BasicHistory/src/ExportManager.h @@ -20,7 +20,7 @@ along with this program. If not, see . #include "EventList.h" #include "IExport.h" #include "IImport.h" -class ExportManager : public EventList +class ExportManager : public HistoryEventList { private: IExport* exp; diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index 6c8262cf10..56488dad5e 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -430,7 +430,7 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM) HWND hWnd = NULL; int start = 0; int end = 0; - int count = EventList::GetContactMessageNumber(hContact); + int count = HistoryEventList::GetContactMessageNumber(hContact); if (!count) return FALSE; @@ -482,10 +482,10 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM) } CallService(MS_DB_SETSAFETYMODE, TRUE, 0); - if (EventList::IsImportedHistory(hContact)) { + 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."); if (MessageBox(hWnd, message, TranslateT("Are You sure?"), MB_YESNO | MB_ICONERROR) == IDYES) - EventList::DeleteImporter(hContact); + HistoryEventList::DeleteImporter(hContact); } RebuildEvents(hContact); @@ -1604,7 +1604,7 @@ void HistoryWindow::EnableWindows(BOOL enable) void HistoryWindow::ReloadContacts() { HWND contactList = GetDlgItem(hWnd,IDC_LIST_CONTACTS); - if (EventList::GetContactMessageNumber(NULL)) { + if (HistoryEventList::GetContactMessageNumber(NULL)) { if (hSystem == NULL) { CLCINFOITEM cii = { sizeof(cii) }; cii.flags = CLCIIF_GROUPFONT | CLCIIF_BELOWCONTACTS; @@ -1620,7 +1620,7 @@ void HistoryWindow::ReloadContacts() } for (MCONTACT _hContact = db_find_first(); _hContact; _hContact = db_find_next(_hContact)) { - if (EventList::GetContactMessageNumber(_hContact) && (metaContactProto == NULL || !db_mc_isSub(_hContact))) { + if (HistoryEventList::GetContactMessageNumber(_hContact) && (metaContactProto == NULL || !db_mc_isSub(_hContact))) { HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0); if (hItem == NULL) SendMessage(contactList, CLM_ADDCONTACT, (WPARAM)_hContact, 0); @@ -1964,7 +1964,7 @@ void HistoryWindow::DoImport(IImport::ImportType type) HistoryWindow::RebuildEvents(hContact); } else if (act == IDNO) { - EventList::AddImporter(hContact, type, exp.GetFileName()); + HistoryEventList::AddImporter(hContact, type, exp.GetFileName()); if (!changeContact) HistoryWindow::RebuildEvents(hContact); } @@ -2071,7 +2071,7 @@ void HistoryWindow::Delete(int what) 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) { - EventList::DeleteImporter(hContact); + HistoryEventList::DeleteImporter(hContact); rebuild = true; } } @@ -2187,7 +2187,7 @@ MCONTACT HistoryWindow::GetNextContact(MCONTACT hContact, int adder) _hContact = db_find_next(_hContact); } - if (!find && EventList::GetContactMessageNumber(NULL)) { + if (!find && HistoryEventList::GetContactMessageNumber(NULL)) { _hContact = NULL; find = true; } @@ -2218,7 +2218,7 @@ MCONTACT HistoryWindow::GetNextContact(MCONTACT hContact, int adder) } if (hContact != NULL) { - if (lastContact == NULL && !EventList::GetContactMessageNumber(NULL)) { + if (lastContact == NULL && !HistoryEventList::GetContactMessageNumber(NULL)) { _hContact = db_find_next(hContact); while (_hContact) { HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0); @@ -2229,7 +2229,7 @@ MCONTACT HistoryWindow::GetNextContact(MCONTACT hContact, int adder) } } - if (lastContact != NULL || EventList::GetContactMessageNumber(NULL)) { + if (lastContact != NULL || HistoryEventList::GetContactMessageNumber(NULL)) { _hContact = lastContact; find = true; } diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 0875b05596..fdd218fa75 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -379,7 +379,7 @@ bool DoTask(TaskOptions& to) if (ret >= 0) { mExp.hContact = contacts[ret]; if (to.type == TaskOptions::Import) { - EventList::AddImporter(mExp.hContact, to.importType, *it); + HistoryEventList::AddImporter(mExp.hContact, to.importType, *it); contactList.push_back(mExp.hContact); } else { diff --git a/plugins/BasicHistory/src/SearchContext.h b/plugins/BasicHistory/src/SearchContext.h index 3e26475e2f..cab81a213c 100644 --- a/plugins/BasicHistory/src/SearchContext.h +++ b/plugins/BasicHistory/src/SearchContext.h @@ -19,7 +19,7 @@ along with this program. If not, see . #pragma once #include "EventList.h" -class SearchContext : public EventList +class SearchContext : public HistoryEventList { public: HWND editWindow; diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp index 13d7cfb645..2723c6c764 100644 --- a/plugins/BasicHistory/src/Searcher.cpp +++ b/plugins/BasicHistory/src/Searcher.cpp @@ -311,9 +311,9 @@ bool Searcher::IsInSel(int sel, TCHAR *strFind) return false; TCHAR str[MAXSELECTSTR + 8]; // for safety reason - EventList::EventData data; - for (std::deque::iterator it = context->eventList[sel].begin(); it != context->eventList[sel].end(); ++it) { - EventList::EventIndex hDbEvent = *it; + HistoryEventList::EventData data; + for (std::deque::iterator it = context->eventList[sel].begin(); it != context->eventList[sel].end(); ++it) { + HistoryEventList::EventIndex hDbEvent = *it; if (context->GetEventData(hDbEvent, data)) { bool isMe = data.isMe; if (onlyIn && isMe || onlyOut && !isMe) -- cgit v1.2.3