From 85c0b6a96f366bdf0ca334ee7cb1877fb3f2288c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 16 Jan 2015 17:49:54 +0000 Subject: MEVENT - the strict type for events, they are not HANDLE anymore git-svn-id: http://svn.miranda-ng.org/main/trunk@11866 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirandaG15/src/CAppletManager.cpp | 18 +++++++----------- plugins/MirandaG15/src/CAppletManager.h | 6 +++--- plugins/MirandaG15/src/CChatScreen.cpp | 6 +++--- plugins/MirandaG15/src/CChatScreen.h | 2 +- plugins/MirandaG15/src/CContactList.cpp | 6 ++---- plugins/MirandaG15/src/CEvent.h | 2 +- 6 files changed, 17 insertions(+), 23 deletions(-) (limited to 'plugins/MirandaG15/src') diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index a6456866f8..dbc34fd1c3 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -797,7 +797,7 @@ void CAppletManager::SendTypingNotification(MCONTACT hContact,bool bEnable) //************************************************************************ // sends a message to the specified contact //************************************************************************ -HANDLE CAppletManager::SendMessageToContact(MCONTACT hContact,tstring strMessage) +MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact,tstring strMessage) { tstring strAscii = _A2T(toNarrowString(strMessage).c_str()); int bufSize = mir_tstrlen(strAscii.c_str())+1; @@ -870,7 +870,7 @@ HANDLE CAppletManager::SendMessageToContact(MCONTACT hContact,tstring strMessage pJob->pcBuffer = NULL; return NULL; } - pJob->hEvent = (HANDLE) CallContactService(pJob->hContact, szService , pref, (LPARAM)pJob->pcBuffer ); + pJob->hEvent = (MEVENT)CallContactService(pJob->hContact, szService , pref, (LPARAM)pJob->pcBuffer ); CAppletManager::GetInstance()->AddMessageJob(pJob); } @@ -898,7 +898,7 @@ bool CAppletManager::IsMessageWindowOpen(MCONTACT hContact) //************************************************************************ // marks the given message as read //************************************************************************ -void CAppletManager::MarkMessageAsRead(MCONTACT hContact,HANDLE hEvent) +void CAppletManager::MarkMessageAsRead(MCONTACT hContact,MEVENT hEvent) { db_event_markRead(hContact, hEvent); CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)hEvent); @@ -907,12 +907,8 @@ void CAppletManager::MarkMessageAsRead(MCONTACT hContact,HANDLE hEvent) //************************************************************************ // translates the given database event //************************************************************************ -bool CAppletManager::TranslateDBEvent(CEvent *pEvent,WPARAM wParam, LPARAM lParam) +bool CAppletManager::TranslateDBEvent(CEvent *pEvent, WPARAM hContact, LPARAM hdbevent) { - MCONTACT hContact = wParam; - HANDLE hdbevent = (HANDLE)lParam; - - // Create struct for dbevent DBEVENTINFO dbevent; memset(&dbevent, 0, sizeof(dbevent)); @@ -1240,7 +1236,7 @@ int CAppletManager::HookChatInbound(WPARAM wParam,LPARAM lParam) else Event.eType = EVENT_IRC_RECEIVED; Event.iValue = gcd->iType; - Event.hValue = (HANDLE)lParam; + Event.hValue = lParam; CIRCHistory *pHistory = NULL; if(gcd->ptszID) @@ -1673,10 +1669,10 @@ int CAppletManager::HookProtoAck(WPARAM wParam, LPARAM lParam) list::iterator iter = CAppletManager::GetInstance()->m_MessageJobs.begin(); while(iter != CAppletManager::GetInstance()->m_MessageJobs.end()) { - if((*iter)->hEvent == pAck->hProcess && (*iter)->hContact == pAck->hContact) + if((*iter)->hEvent == (MEVENT)pAck->hProcess && (*iter)->hContact == pAck->hContact) { Event.eType = EVENT_MESSAGE_ACK; - Event.hValue = pAck->hProcess; + Event.hValue = (MEVENT)pAck->hProcess; Event.hContact = pAck->hContact; Event.iValue = pAck->result; if(pAck->lParam != 0) diff --git a/plugins/MirandaG15/src/CAppletManager.h b/plugins/MirandaG15/src/CAppletManager.h index e95a063cb8..5af6058273 100644 --- a/plugins/MirandaG15/src/CAppletManager.h +++ b/plugins/MirandaG15/src/CAppletManager.h @@ -18,7 +18,7 @@ struct SMessageJob { - HANDLE hEvent; + MEVENT hEvent; MCONTACT hContact; DWORD dwFlags; char *pcBuffer; @@ -75,11 +75,11 @@ public: // check if a contacts message window is opened static bool IsMessageWindowOpen(MCONTACT hContact); // marks the given event as read - static void MarkMessageAsRead(MCONTACT hContact,HANDLE hEvent); + static void MarkMessageAsRead(MCONTACT hContact, MEVENT hEvent); // translates the given database event static bool TranslateDBEvent(CEvent *pEvent,WPARAM wParam, LPARAM lParam); // sends a message to the specified contact - static HANDLE SendMessageToContact(MCONTACT hContact,tstring strMessage); + static MEVENT SendMessageToContact(MCONTACT hContact,tstring strMessage); // sends typing notifications to the specified contact static void SendTypingNotification(MCONTACT hContact,bool bEnable); diff --git a/plugins/MirandaG15/src/CChatScreen.cpp b/plugins/MirandaG15/src/CChatScreen.cpp index f519baaae8..34a82de04f 100644 --- a/plugins/MirandaG15/src/CChatScreen.cpp +++ b/plugins/MirandaG15/src/CChatScreen.cpp @@ -303,9 +303,9 @@ void CChatScreen::LoadHistory() { // Get last events from database CEvent Event; - list LHandles; - HANDLE hEvent = db_event_last(m_hContact); - HANDLE hUnread = db_event_firstUnread(m_hContact); + list LHandles; + MEVENT hEvent = db_event_last(m_hContact); + MEVENT hUnread = db_event_firstUnread(m_hContact); if(CConfig::GetBoolSetting(SESSION_LOADDB)) { diff --git a/plugins/MirandaG15/src/CChatScreen.h b/plugins/MirandaG15/src/CChatScreen.h index 0f10a17614..4f1582083b 100644 --- a/plugins/MirandaG15/src/CChatScreen.h +++ b/plugins/MirandaG15/src/CChatScreen.h @@ -93,7 +93,7 @@ protected: DWORD m_dwMaximizedDuration; MCONTACT m_hContact; - HANDLE m_hMessage; + MEVENT m_hMessage; int m_iStatus; diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index 69e6165d38..965607226c 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -905,9 +905,7 @@ void CContactList::UpdateMessageCounter(CListEntryiMessages; bool bSort = false; - HANDLE hEvent= NULL; - - hEvent = db_event_firstUnread(pEntry->hHandle); + MEVENT hEvent = db_event_firstUnread(pEntry->hHandle); if(CAppletManager::IsMessageWindowOpen(pEntry->hHandle) || (hEvent == NULL && pEntry->iMessages > 0)) { pEntry->iMessages = 0; @@ -916,7 +914,7 @@ void CContactList::UpdateMessageCounter(CListEntryiMessages = 0; - HANDLE hLastEvent = db_event_last(pEntry->hHandle); + MEVENT hLastEvent = db_event_last(pEntry->hHandle); while(hLastEvent != NULL && hEvent != NULL) { pEntry->iMessages++; diff --git a/plugins/MirandaG15/src/CEvent.h b/plugins/MirandaG15/src/CEvent.h index d07080b70c..c94e98d108 100644 --- a/plugins/MirandaG15/src/CEvent.h +++ b/plugins/MirandaG15/src/CEvent.h @@ -63,7 +63,7 @@ public: tstring strDescription; tstring strSummary; - HANDLE hValue; + MEVENT hValue; int iValue; tstring strValue; }; -- cgit v1.2.3