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 --- protocols/AimOscar/src/proto.cpp | 6 +-- protocols/AimOscar/src/proto.h | 6 +-- protocols/Dummy/src/dummy_proto.cpp | 6 +-- protocols/Dummy/src/dummy_proto.h | 6 +-- protocols/FacebookRM/src/proto.cpp | 6 +-- protocols/FacebookRM/src/proto.h | 8 ++-- protocols/FacebookRM/src/stubs.cpp | 2 +- protocols/GTalkExt/src/notifications.cpp | 22 ++++----- protocols/Gadu-Gadu/src/core.cpp | 2 +- protocols/Gadu-Gadu/src/gg_proto.cpp | 6 +-- protocols/Gadu-Gadu/src/gg_proto.h | 6 +-- protocols/IRCG/src/clist.cpp | 4 +- protocols/IRCG/src/irc.h | 6 +-- protocols/IRCG/src/ircproto.cpp | 6 +-- protocols/IcqOscarJ/src/icq_db.cpp | 2 +- protocols/IcqOscarJ/src/icq_proto.cpp | 6 +-- protocols/IcqOscarJ/src/icq_proto.h | 10 ++-- protocols/IcqOscarJ/src/utilities.cpp | 2 +- protocols/JabberG/src/jabber_archive.cpp | 4 +- protocols/JabberG/src/jabber_iq_handlers.cpp | 5 +- protocols/JabberG/src/jabber_notes.cpp | 2 +- protocols/JabberG/src/jabber_proto.cpp | 6 +-- protocols/JabberG/src/jabber_proto.h | 6 +-- protocols/JabberG/src/jabber_rc.cpp | 4 +- protocols/JabberG/src/jabber_thread.cpp | 2 +- protocols/MRA/src/MraProto.cpp | 6 +-- protocols/MRA/src/MraProto.h | 6 +-- protocols/MSN/src/msn_mail.cpp | 2 +- protocols/MSN/src/msn_proto.cpp | 6 +-- protocols/MSN/src/msn_proto.h | 6 +-- protocols/Omegle/src/proto.h | 6 +-- protocols/Omegle/src/stubs.cpp | 6 +-- protocols/Sametime/src/sametime_proto.cpp | 6 +-- protocols/Sametime/src/sametime_proto.h | 6 +-- protocols/SkypeClassic/src/filexfer.cpp | 2 +- protocols/SkypeClassic/src/msglist.cpp | 4 +- protocols/SkypeClassic/src/msglist.h | 6 +-- protocols/SkypeClassic/src/skype.cpp | 18 ++++--- protocols/Steam/src/steam_contacts.cpp | 2 +- protocols/Steam/src/steam_proto.cpp | 6 +-- protocols/Steam/src/steam_proto.h | 10 ++-- protocols/Steam/src/steam_utils.cpp | 2 +- protocols/Tlen/src/tlen.h | 6 +-- protocols/Tlen/src/tlen_svc.cpp | 6 +-- protocols/Tlen/src/tlen_thread.cpp | 2 +- protocols/Tox/src/tox_contacts.cpp | 2 +- protocols/Tox/src/tox_proto.cpp | 6 +-- protocols/Tox/src/tox_proto.h | 10 ++-- protocols/Tox/src/tox_utils.cpp | 2 +- protocols/Twitter/src/proto.h | 6 +-- protocols/Twitter/src/stubs.cpp | 6 +-- protocols/VKontakte/src/misc.cpp | 70 ++++++++++++++-------------- protocols/VKontakte/src/vk_feed.cpp | 4 +- protocols/VKontakte/src/vk_history.cpp | 8 ++-- protocols/VKontakte/src/vk_proto.cpp | 6 +-- protocols/VKontakte/src/vk_proto.h | 8 ++-- protocols/WhatsApp/src/proto.cpp | 2 +- protocols/WhatsApp/src/proto.h | 6 +-- protocols/Yahoo/src/im.cpp | 2 +- protocols/Yahoo/src/proto.cpp | 6 +-- protocols/Yahoo/src/proto.h | 6 +-- 61 files changed, 201 insertions(+), 204 deletions(-) (limited to 'protocols') diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index ec60663c33..db4fab68ce 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -130,7 +130,7 @@ MCONTACT CAimProto::AddToList(int flags, PROTOSEARCHRESULT* psr) return hContact; //See authrequest for serverside addition } -MCONTACT __cdecl CAimProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) +MCONTACT __cdecl CAimProto::AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) { return NULL; } @@ -138,7 +138,7 @@ MCONTACT __cdecl CAimProto::AddToListByEvent(int flags, int iContact, HANDLE hDb //////////////////////////////////////////////////////////////////////////////////////// // AuthAllow - processes the successful authorization -int CAimProto::Authorize(HANDLE hDbEvent) +int CAimProto::Authorize(MEVENT hDbEvent) { return 0; } @@ -146,7 +146,7 @@ int CAimProto::Authorize(HANDLE hDbEvent) //////////////////////////////////////////////////////////////////////////////////////// // AuthDeny - handles the unsuccessful authorization -int CAimProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) +int CAimProto::AuthDeny(MEVENT hDbEvent, const TCHAR* szReason) { return 0; } diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h index 4382514b16..6635cc7a74 100644 --- a/protocols/AimOscar/src/proto.h +++ b/protocols/AimOscar/src/proto.h @@ -29,10 +29,10 @@ struct CAimProto : public PROTO //==================================================================================== virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ); - virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ); + virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, MEVENT hDbEvent ); - virtual int __cdecl Authorize( HANDLE hDbEvent ); - virtual int __cdecl AuthDeny( HANDLE hDbEvent, const TCHAR* szReason ); + virtual int __cdecl Authorize( MEVENT hDbEvent ); + virtual int __cdecl AuthDeny( MEVENT hDbEvent, const TCHAR* szReason ); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT* ); virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage ); diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 72819d962b..310c450ee1 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -138,12 +138,12 @@ int CDummyProto::AuthRequest(MCONTACT hContact,const PROTOCHAR *message) return 0; } -int CDummyProto::Authorize(HANDLE hDbEvent) +int CDummyProto::Authorize(MEVENT hDbEvent) { return 1; } -int CDummyProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason) +int CDummyProto::AuthDeny(MEVENT hDbEvent, const PROTOCHAR *reason) { return 1; } @@ -153,7 +153,7 @@ int CDummyProto::UserIsTyping(MCONTACT hContact, int type) return 1; } -MCONTACT CDummyProto::AddToListByEvent(int flags,int iContact,HANDLE hDbEvent) +MCONTACT CDummyProto::AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) { return NULL; } diff --git a/protocols/Dummy/src/dummy_proto.h b/protocols/Dummy/src/dummy_proto.h index 70bdcd0b19..f6c98ea969 100644 --- a/protocols/Dummy/src/dummy_proto.h +++ b/protocols/Dummy/src/dummy_proto.h @@ -27,10 +27,10 @@ struct CDummyProto : public PROTO //==================================================================================== virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); - virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent); + virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); - virtual int __cdecl Authorize(HANDLE hDbEvent); - virtual int __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR *szReason); + virtual int __cdecl Authorize(MEVENT hDbEvent); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage); diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index f1785af1d5..62c1cd8468 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -315,7 +315,7 @@ int FacebookProto::AuthRequest(MCONTACT hContact, const PROTOCHAR *) return RequestFriendship(hContact, NULL); } -int FacebookProto::Authorize(HANDLE hDbEvent) +int FacebookProto::Authorize(MEVENT hDbEvent) { if (!hDbEvent || isOffline()) return 1; @@ -327,7 +327,7 @@ int FacebookProto::Authorize(HANDLE hDbEvent) return ApproveFriendship(hContact, NULL); } -int FacebookProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *) +int FacebookProto::AuthDeny(MEVENT hDbEvent, const PROTOCHAR *) { if (!hDbEvent || isOffline()) return 1; @@ -817,7 +817,7 @@ INT_PTR FacebookProto::OnCancelFriendshipRequest(WPARAM wParam, LPARAM) return 0; } -MCONTACT FacebookProto::HContactFromAuthEvent(HANDLE hEvent) +MCONTACT FacebookProto::HContactFromAuthEvent(MEVENT hEvent) { DWORD body[2]; DBEVENTINFO dbei = { sizeof(dbei) }; diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index f5d697e749..4c4a7e64e1 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -69,10 +69,10 @@ public: //PROTO_INTERFACE virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); - virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent); + virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); - virtual int __cdecl Authorize(HANDLE hDbEvent); - virtual int __cdecl AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason); + virtual int __cdecl Authorize(MEVENT hDbEvent); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const PROTOCHAR* szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl AuthRequest(MCONTACT hContact, const PROTOCHAR* szMessage); @@ -207,7 +207,7 @@ public: void LoadContactInfo(facebook_user* fbu); MCONTACT AddToContactList(facebook_user*, ContactType type, bool force_add = false, bool add_temporarily = false); void SetAllContactStatuses(int status); - MCONTACT HContactFromAuthEvent(HANDLE hEvent); + MCONTACT HContactFromAuthEvent(MEVENT hEvent); void StartTyping(MCONTACT hContact); void StopTyping(MCONTACT hContact); diff --git a/protocols/FacebookRM/src/stubs.cpp b/protocols/FacebookRM/src/stubs.cpp index a52baef931..c17651eaf1 100644 --- a/protocols/FacebookRM/src/stubs.cpp +++ b/protocols/FacebookRM/src/stubs.cpp @@ -22,7 +22,7 @@ along with this program. If not, see . #include "common.h" -MCONTACT FacebookProto::AddToListByEvent(int, int, HANDLE) +MCONTACT FacebookProto::AddToListByEvent(int, int, MEVENT) { return NULL; } diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index 7b56eabf26..1a6eb2825d 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -39,7 +39,7 @@ struct POPUP_DATA_HEADER { BOOL MarkRead; - HANDLE hDbEvent; + MEVENT hDbEvent; MCONTACT hContact; LPTSTR jid; LPTSTR url; @@ -63,14 +63,14 @@ LPCSTR GetJidAcc(LPCTSTR jid) return NULL; } -void MarkEventRead(MCONTACT hCnt, HANDLE hEvt) +void MarkEventRead(MCONTACT hCnt, MEVENT hEvt) { DWORD settings = (DWORD)TlsGetValue(itlsSettings); if (ReadCheckbox(0, IDC_POPUPSENABLED, settings) && - ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, settings) && - ReadCheckbox(0, IDC_MARKEVENTREAD, settings) && - db_event_markRead(hCnt, hEvt) != -1) - CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hCnt, (LPARAM)hEvt); + ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, settings) && + ReadCheckbox(0, IDC_MARKEVENTREAD, settings) && + db_event_markRead(hCnt, hEvt) != -1) + CallService(MS_CLIST_REMOVEEVENT, hCnt, hEvt); } int OnEventDeleted(WPARAM hContact, LPARAM hDbEvent, LPARAM wnd) @@ -89,7 +89,7 @@ LRESULT CALLBACK PopupProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) LPCSTR acc; if (EVENT_DELETED_MSG == msg) { - if ((HANDLE)lParam == ppdh->hDbEvent) + if ((MEVENT)lParam == ppdh->hDbEvent) ppdh->hDbEvent = NULL; return 0; } @@ -188,7 +188,7 @@ MCONTACT SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTST return hContact; } -HANDLE AddCListNotification(MCONTACT hContact, LPCSTR acc, POPUPDATAT *data, LPCTSTR url) +static MEVENT AddCListNotification(MCONTACT hContact, LPCSTR acc, POPUPDATAT *data, LPCTSTR url) { mir_ptr szUrl(mir_utf8encodeT(url)), szText(mir_utf8encodeT(data->lptzText)); @@ -214,7 +214,7 @@ BOOL UsePopups() void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount) { MCONTACT hCnt = SetupPseudocontact(jid, unreadCount, acc, &data->lptzContactName[0]); - HANDLE hEvt = ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, (DWORD)TlsGetValue(itlsSettings)) + MEVENT hEvt = ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, (DWORD)TlsGetValue(itlsSettings)) ? AddCListNotification(hCnt, acc, data, url) : NULL; if (!UsePopups()) @@ -291,8 +291,8 @@ void ClearNotificationContactHistory(LPCSTR acc) if (!hContact || !db_get_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) return; - for (HANDLE hEvent = db_event_first(hContact); hEvent;) { - HANDLE hEvent1 = db_event_next(hContact, hEvent); + for (MEVENT hEvent = db_event_first(hContact); hEvent;) { + MEVENT hEvent1 = db_event_next(hContact, hEvent); db_event_delete(hContact, hEvent); hEvent = hEvent1; } diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 52a988e025..08dfae9cb7 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -1015,7 +1015,7 @@ retry: cle.hContact = hContact; cle.hIcon = LoadIconEx("image", FALSE); cle.flags = CLEF_URGENT; - cle.hDbEvent = (HANDLE)"img"; + cle.hDbEvent = -98; cle.lParam = (LPARAM)img; cle.pszService = service; cle.pszTooltip = Translate("Incoming image"); diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 716a75e376..d2ccaed460 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -124,9 +124,9 @@ GGPROTO::~GGPROTO() ////////////////////////////////////////////////////////// // Dummies for function that have to be implemented -MCONTACT GGPROTO::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) { return NULL; } -int GGPROTO::Authorize(HANDLE hDbEvent) { return 1; } -int GGPROTO::AuthDeny(HANDLE hDbEvent, const TCHAR *szReason) { return 1; } +MCONTACT GGPROTO::AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) { return NULL; } +int GGPROTO::Authorize(MEVENT hDbEvent) { return 1; } +int GGPROTO::AuthDeny(MEVENT hDbEvent, const TCHAR *szReason) { return 1; } int GGPROTO::AuthRecv(MCONTACT hContact, PROTORECVEVENT *pre) { return 1; } int GGPROTO::AuthRequest(MCONTACT hContact, const TCHAR *szMessage) { return 1; } int GGPROTO::FileResume(HANDLE hTransfer, int *action, const PROTOCHAR** szFilename) { return 1; } diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index 4629a06824..816292100c 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -32,10 +32,10 @@ struct GGPROTO : public PROTO //==================================================================================== virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ); - virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ); + virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, MEVENT hDbEvent ); - virtual int __cdecl Authorize( HANDLE hDbEvent ); - virtual int __cdecl AuthDeny( HANDLE hDbEvent, const TCHAR* szReason ); + virtual int __cdecl Authorize( MEVENT hDbEvent ); + virtual int __cdecl AuthDeny( MEVENT hDbEvent, const TCHAR* szReason ); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT* ); virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage ); diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index 3dd962a4a3..e52c1c50d7 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -64,7 +64,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, else { CLISTEVENT cle = { sizeof(cle) }; cle.hContact = hContact; - cle.hDbEvent = (HANDLE)"dccchat"; + cle.hDbEvent = -100; cle.flags = CLEF_TCHAR; cle.hIcon = LoadIconEx(IDI_DCC); mir_snprintf(szService, SIZEOF(szService), "%s/DblClickEvent", m_szModuleName); @@ -74,7 +74,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, cle.lParam = (LPARAM)pdci; if (CallService(MS_CLIST_GETEVENT, hContact, 0)) - CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)"dccchat"); + CallService(MS_CLIST_REMOVEEVENT, hContact, -100); CallService(MS_CLIST_ADDEVENT, hContact, (LPARAM)&cle); } return TRUE; diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h index 68df80a0d8..991a01988d 100644 --- a/protocols/IRCG/src/irc.h +++ b/protocols/IRCG/src/irc.h @@ -212,10 +212,10 @@ struct CIrcProto : public PROTO // Protocol interface virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ); - virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ); + virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, MEVENT hDbEvent ); - virtual int __cdecl Authorize(HANDLE hDbEvent); - virtual int __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR* szReason); + virtual int __cdecl Authorize(MEVENT hDbEvent); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage); diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 9dfd53c061..0a259851c1 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -338,7 +338,7 @@ MCONTACT __cdecl CIrcProto::AddToList(int, PROTOSEARCHRESULT* psr) //////////////////////////////////////////////////////////////////////////////////////// // AddToList - adds a contact to the contact list -MCONTACT __cdecl CIrcProto::AddToListByEvent(int, int, HANDLE) +MCONTACT __cdecl CIrcProto::AddToListByEvent(int, int, MEVENT) { return NULL; } @@ -346,7 +346,7 @@ MCONTACT __cdecl CIrcProto::AddToListByEvent(int, int, HANDLE) //////////////////////////////////////////////////////////////////////////////////////// // AuthAllow - processes the successful authorization -int __cdecl CIrcProto::Authorize(HANDLE) +int __cdecl CIrcProto::Authorize(MEVENT) { return 0; } @@ -354,7 +354,7 @@ int __cdecl CIrcProto::Authorize(HANDLE) //////////////////////////////////////////////////////////////////////////////////////// // AuthDeny - handles the unsuccessful authorization -int __cdecl CIrcProto::AuthDeny(HANDLE, const TCHAR*) +int __cdecl CIrcProto::AuthDeny(MEVENT, const TCHAR*) { return 0; } diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp index 4871d2d7b3..53e41ef407 100644 --- a/protocols/IcqOscarJ/src/icq_db.cpp +++ b/protocols/IcqOscarJ/src/icq_db.cpp @@ -189,7 +189,7 @@ int CIcqProto::IsICQContact(MCONTACT hContact) return !strcmpnull(szProto, m_szModuleName); } -HANDLE CIcqProto::AddEvent(MCONTACT hContact, WORD wType, DWORD dwTime, DWORD flags, size_t cbBlob, PBYTE pBlob) +MEVENT CIcqProto::AddEvent(MCONTACT hContact, WORD wType, DWORD dwTime, DWORD flags, size_t cbBlob, PBYTE pBlob) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.szModule = m_szModuleName; diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 330ff5235f..825cdd8068 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -342,7 +342,7 @@ MCONTACT CIcqProto::AddToList(int flags, PROTOSEARCHRESULT *psr) return AddToListByUID(szUid, flags); } -MCONTACT __cdecl CIcqProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) +MCONTACT __cdecl CIcqProto::AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) { DWORD uin = 0; uid_str uid = { 0 }; @@ -405,7 +405,7 @@ MCONTACT __cdecl CIcqProto::AddToListByEvent(int flags, int iContact, HANDLE hDb //////////////////////////////////////////////////////////////////////////////////////// // PS_AuthAllow - processes the successful authorization -int CIcqProto::Authorize(HANDLE hDbEvent) +int CIcqProto::Authorize(MEVENT hDbEvent) { if (icqOnline() && hDbEvent) { MCONTACT hContact = HContactFromAuthEvent(hDbEvent); @@ -431,7 +431,7 @@ int CIcqProto::Authorize(HANDLE hDbEvent) //////////////////////////////////////////////////////////////////////////////////////// // PS_AuthDeny - handles the unsuccessful authorization -int CIcqProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) +int CIcqProto::AuthDeny(MEVENT hDbEvent, const TCHAR* szReason) { if (icqOnline() && hDbEvent) { MCONTACT hContact = HContactFromAuthEvent(hDbEvent); diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index cd51336809..56db448000 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -55,10 +55,10 @@ struct CIcqProto : public PROTO //==================================================================================== virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT *psr); - virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent); + virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, MEVENT hDbEvent); - virtual int __cdecl Authorize(HANDLE hDbEvent); - virtual int __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR *szReason); + virtual int __cdecl Authorize(MEVENT hDbEvent); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage); @@ -412,7 +412,7 @@ struct CIcqProto : public PROTO const char* detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUserClass, DWORD dwOnlineSince, const char *szCurrentClient, WORD wVersion, DWORD dwFT1, DWORD dwFT2, DWORD dwFT3, DWORD dwDirectCookie, DWORD dwWebPort, BYTE *caps, size_t wLen, BYTE *bClientId, char *szClientBuf); //----| icq_db.cpp |------------------------------------------------------------------ - HANDLE AddEvent(MCONTACT hContact, WORD wType, DWORD dwTime, DWORD flags, size_t cbBlob, PBYTE pBlob); + MEVENT AddEvent(MCONTACT hContact, WORD wType, DWORD dwTime, DWORD flags, size_t cbBlob, PBYTE pBlob); int IsICQContact(MCONTACT hContact); int getSetting(MCONTACT hContact, const char *szSetting, DBVARIANT *dbv); @@ -888,7 +888,7 @@ struct CIcqProto : public PROTO MCONTACT HandleFromCacheByUid(DWORD dwUin, const char *szUid); MCONTACT HContactFromUIN(DWORD dwUin, int *Added); MCONTACT HContactFromUID(DWORD dwUin, const char *szUid, int *Added); - MCONTACT HContactFromAuthEvent(HANDLE hEvent); + MCONTACT HContactFromAuthEvent(MEVENT hEvent); void ResetSettingsOnListReload(); void ResetSettingsOnConnect(); diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 3adf403033..8dc21e8c19 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -552,7 +552,7 @@ MCONTACT CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added) return INVALID_CONTACT_ID; } -MCONTACT CIcqProto::HContactFromAuthEvent(HANDLE hEvent) +MCONTACT CIcqProto::HContactFromAuthEvent(MEVENT hEvent) { DWORD body[3]; diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index bba91d3201..91185d924a 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -96,12 +96,12 @@ void CJabberProto::OnIqResultGetCollectionList(HXML iqNode, CJabberIqInfo*) static DWORD dwPreviousTimeStamp = -1; static MCONTACT hPreviousContact = INVALID_CONTACT_ID; -static HANDLE hPreviousDbEvent = NULL; +static MEVENT hPreviousDbEvent = NULL; // Returns TRUE if the event already exist in the database BOOL IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO& dbei) { - HANDLE hExistingDbEvent; + MEVENT hExistingDbEvent; DWORD dwEventTimeStamp; // get last event diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 4445774672..65b656a594 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -746,12 +746,11 @@ BOOL CJabberProto::AddClistHttpAuthEvent(CJabberHttpAuthParams *pParams) cle.cbSize = sizeof(CLISTEVENT); cle.hIcon = (HICON) LoadIconEx("openid"); cle.flags = CLEF_PROTOCOLGLOBAL | CLEF_TCHAR; - cle.hDbEvent = (HANDLE)("test"); - cle.lParam = (LPARAM) pParams; + cle.hDbEvent = -99; + cle.lParam = (LPARAM)pParams; cle.pszService = szService; cle.ptszTooltip = TranslateT("Http authentication request received"); CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); - return TRUE; } diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index 030c0bbb9f..d39556199e 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -778,7 +778,7 @@ bool CJabberProto::OnIncomingNote(const TCHAR *szFrom, HXML hXml) cle.cbSize = sizeof(CLISTEVENT); cle.hIcon = (HICON)LoadIconEx("notes"); cle.flags = CLEF_PROTOCOLGLOBAL | CLEF_TCHAR; - cle.hDbEvent = (HANDLE)("test"); + cle.hDbEvent = -99; cle.lParam = (LPARAM)pItem; cle.pszService = szService; cle.ptszTooltip = TranslateT("Incoming note"); diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 53530363e4..271c51bed6 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -345,7 +345,7 @@ MCONTACT CJabberProto::AddToList(int flags, PROTOSEARCHRESULT* psr) return AddToListByJID(jid, flags); } -MCONTACT __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, HANDLE hDbEvent) +MCONTACT __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, MEVENT hDbEvent) { debugLogA("AddToListByEvent"); @@ -383,7 +383,7 @@ MCONTACT __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, HAN //////////////////////////////////////////////////////////////////////////////////////// // JabberAuthAllow - processes the successful authorization -int CJabberProto::Authorize(HANDLE hDbEvent) +int CJabberProto::Authorize(MEVENT hDbEvent) { if (!m_bJabberOnline) return 1; @@ -430,7 +430,7 @@ int CJabberProto::Authorize(HANDLE hDbEvent) //////////////////////////////////////////////////////////////////////////////////////// // JabberAuthDeny - handles the unsuccessful authorization -int CJabberProto::AuthDeny(HANDLE hDbEvent, const TCHAR*) +int CJabberProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) { if (!m_bJabberOnline) return 1; diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index c9bbff16c3..96c57806f6 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -83,10 +83,10 @@ struct CJabberProto : public PROTO, public IJabberInterface //==================================================================================== virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); - virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent); + virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); - virtual int __cdecl Authorize(HANDLE hDbEvent); - virtual int __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR *szReason); + virtual int __cdecl Authorize(MEVENT hDbEvent); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage); diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 5c96401afb..049805bea0 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -468,7 +468,7 @@ int CJabberProto::RcGetUnreadEventsCount() ptrT jid( getTStringA(hContact, "jid")); if (jid == NULL) continue; - for (HANDLE hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) { + for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.cbBlob = db_event_getBlobSize(hDbEvent); if (dbei.cbBlob == -1) @@ -555,7 +555,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe if (tszJid == NULL) continue; - for (HANDLE hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) { + for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.cbBlob = db_event_getBlobSize(hDbEvent); if (dbei.cbBlob == -1) diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 99b76a4250..56dec1aa27 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -988,7 +988,7 @@ void CJabberProto::OnProcessPubsubEvent(HXML node) DWORD JabberGetLastContactMessageTime(MCONTACT hContact) { // TODO: time cache can improve performance - HANDLE hDbEvent = db_event_last(hContact); + MEVENT hDbEvent = db_event_last(hContact); if (!hDbEvent) return 0; diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index c7af6e4b1e..df1ae3e97d 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -161,7 +161,7 @@ MCONTACT CMraProto::AddToList(int flags, PROTOSEARCHRESULT *psr) return AddToListByEmail(psr->email, psr->nick, psr->firstName, psr->lastName, flags); } -MCONTACT CMraProto::AddToListByEvent(int, int, HANDLE hDbEvent) +MCONTACT CMraProto::AddToListByEvent(int, int, MEVENT hDbEvent) { DBEVENTINFO dbei = { 0 }; dbei.cbSize = sizeof(dbei); @@ -191,7 +191,7 @@ int CMraProto::SendUrl(MCONTACT, int, const char*) { return 1; } ///////////////////////////////////////////////////////////////////////////////////////// -int CMraProto::Authorize(HANDLE hDBEvent) +int CMraProto::Authorize(MEVENT hDBEvent) { if (!m_bLoggedIn) return 1; @@ -211,7 +211,7 @@ int CMraProto::Authorize(HANDLE hDBEvent) return 0; } -int CMraProto::AuthDeny(HANDLE hDBEvent, const TCHAR* szReason) +int CMraProto::AuthDeny(MEVENT hDBEvent, const TCHAR* szReason) { if (!m_bLoggedIn) return 1; diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 25763f3cd0..6fbab83126 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -39,10 +39,10 @@ struct CMraProto : public PROTO // ==================================================================================== virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); - virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent); + virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); - virtual int __cdecl Authorize(HANDLE hDBEvent); - virtual int __cdecl AuthDeny(HANDLE hDBEvent, const TCHAR* szReason); + virtual int __cdecl Authorize(MEVENT hDBEvent); + virtual int __cdecl AuthDeny(MEVENT hDBEvent, const TCHAR* szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage); diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index 3158934d8e..03ab085bc5 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -291,7 +291,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) cle.cbSize = sizeof(cle); cle.hContact = hContact; - cle.hDbEvent = (HANDLE)1; + cle.hDbEvent = 1; cle.flags = CLEF_URGENT | CLEF_TCHAR; cle.hIcon = LoadSkinnedIcon(SKINICON_OTHER_SENDEMAIL); cle.ptszTooltip = tBuffer2; diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 3e9adec7d7..b21c71a683 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -248,7 +248,7 @@ MCONTACT __cdecl CMsnProto::AddToList(int flags, PROTOSEARCHRESULT* psr) flags); } -MCONTACT __cdecl CMsnProto::AddToListByEvent(int flags, int, HANDLE hDbEvent) +MCONTACT __cdecl CMsnProto::AddToListByEvent(int flags, int, MEVENT hDbEvent) { DBEVENTINFO dbei = { sizeof(dbei) }; if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1)) @@ -303,7 +303,7 @@ int __cdecl CMsnProto::AuthRequest(MCONTACT hContact, const TCHAR* szMessage) ///////////////////////////////////////////////////////////////////////////////////////// // MsnAuthAllow - called after successful authorization -int CMsnProto::Authorize(HANDLE hDbEvent) +int CMsnProto::Authorize(MEVENT hDbEvent) { if (!msnLoggedIn) return 1; @@ -341,7 +341,7 @@ int CMsnProto::Authorize(HANDLE hDbEvent) ///////////////////////////////////////////////////////////////////////////////////////// // MsnAuthDeny - called after unsuccessful authorization -int CMsnProto::AuthDeny(HANDLE hDbEvent, const TCHAR*) +int CMsnProto::AuthDeny(MEVENT hDbEvent, const TCHAR*) { if (!msnLoggedIn) return 1; diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index 42922a2ab4..0600dc1d16 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -33,10 +33,10 @@ struct CMsnProto : public PROTO //==================================================================================== virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); - virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent); + virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); - virtual int __cdecl Authorize(HANDLE hDbEvent); - virtual int __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR* szReason); + virtual int __cdecl Authorize(MEVENT hDbEvent); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage); diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h index 09fcbdc548..6c799f4328 100644 --- a/protocols/Omegle/src/proto.h +++ b/protocols/Omegle/src/proto.h @@ -45,10 +45,10 @@ public: // PROTO_INTERFACE virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ); - virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ); + virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, MEVENT hDbEvent ); - virtual int __cdecl Authorize( HANDLE hDbEvent ); - virtual int __cdecl AuthDeny( HANDLE hDbEvent, const PROTOCHAR* szReason ); + virtual int __cdecl Authorize( MEVENT hDbEvent ); + virtual int __cdecl AuthDeny( MEVENT hDbEvent, const PROTOCHAR* szReason ); virtual int __cdecl AuthRecv( MCONTACT hContact, PROTORECVEVENT* ); virtual int __cdecl AuthRequest( MCONTACT hContact, const PROTOCHAR* szMessage ); diff --git a/protocols/Omegle/src/stubs.cpp b/protocols/Omegle/src/stubs.cpp index f325d90c0e..90683d9cd0 100644 --- a/protocols/Omegle/src/stubs.cpp +++ b/protocols/Omegle/src/stubs.cpp @@ -27,17 +27,17 @@ MCONTACT OmegleProto::AddToList(int flags, PROTOSEARCHRESULT* psr) return NULL; }; -MCONTACT OmegleProto::AddToListByEvent(int flags,int iContact,HANDLE hDbEvent) +MCONTACT OmegleProto::AddToListByEvent(int flags,int iContact,MEVENT hDbEvent) { return NULL; }; -int OmegleProto::Authorize(HANDLE hDbEvent) +int OmegleProto::Authorize(MEVENT hDbEvent) { return 1; } -int OmegleProto::AuthDeny(HANDLE hDbEvent,const PROTOCHAR *reason) +int OmegleProto::AuthDeny(MEVENT hDbEvent,const PROTOCHAR *reason) { return 1; } diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index d69db969f9..f5e2352e9e 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -89,19 +89,19 @@ MCONTACT CSametimeProto::AddToList(int flags, PROTOSEARCHRESULT* psr) return AddSearchedUser(sr, flags & PALF_TEMPORARY); } -MCONTACT CSametimeProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) +MCONTACT CSametimeProto::AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) { debugLog(_T("CSametimeProto::AddToListByEvent() flags=[%d]"), flags); return 0; } -int CSametimeProto::Authorize(HANDLE hDbEvent) +int CSametimeProto::Authorize(MEVENT hDbEvent) { debugLog(_T("CSametimeProto::Authorize()")); return 1; } -int CSametimeProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason) +int CSametimeProto::AuthDeny(MEVENT hDbEvent, const PROTOCHAR* szReason) { debugLog(_T("CSametimeProto::AuthDeny()")); return 1; diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h index 67c036fbf1..c56e291c84 100644 --- a/protocols/Sametime/src/sametime_proto.h +++ b/protocols/Sametime/src/sametime_proto.h @@ -16,10 +16,10 @@ struct CSametimeProto : public PROTO virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); - virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent); + virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); - virtual int __cdecl Authorize(HANDLE hDbEvent); - virtual int __cdecl AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason); + virtual int __cdecl Authorize(MEVENT hDbEvent); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const PROTOCHAR* szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl AuthRequest(MCONTACT hContact, const PROTOCHAR* szMessage); diff --git a/protocols/SkypeClassic/src/filexfer.cpp b/protocols/SkypeClassic/src/filexfer.cpp index 21d475460c..0c53202a83 100644 --- a/protocols/SkypeClassic/src/filexfer.cpp +++ b/protocols/SkypeClassic/src/filexfer.cpp @@ -114,7 +114,7 @@ INT_PTR SkypeSendFile(WPARAM, LPARAM lParam) if (pTok) { ret = strtoul(pTok, NULL, 10); - TYP_MSGLENTRY *pEntry = MsgList_Add(ret, INVALID_HANDLE_VALUE); + TYP_MSGLENTRY *pEntry = MsgList_Add(ret, -1); if (pEntry) { DWORD cbSize = sizeof(PROTOFILETRANSFERSTATUS); /* Allocate basic entry and fill some stuff we already know */ diff --git a/protocols/SkypeClassic/src/msglist.cpp b/protocols/SkypeClassic/src/msglist.cpp index 9ba9b67679..2c33dff807 100644 --- a/protocols/SkypeClassic/src/msglist.cpp +++ b/protocols/SkypeClassic/src/msglist.cpp @@ -1,9 +1,9 @@ #define WIN32_LEAN_AND_MEAN #include +#include "filexfer.h" #include "memlist.h" #include "debug.h" #include "msglist.h" -#include "filexfer.h" #define MSGLIST_TIMEOUT 1800 // Chatmessage references will be kept for 30 minutes @@ -37,7 +37,7 @@ void MsgList_Exit(void) m_hMsgList = NULL; } -TYP_MSGLENTRY *MsgList_Add(DWORD uMsgNum, HANDLE hEvent) +TYP_MSGLENTRY *MsgList_Add(DWORD uMsgNum, MEVENT hEvent) { TYP_MSGLENTRY *pEntry; int iListInd; diff --git a/protocols/SkypeClassic/src/msglist.h b/protocols/SkypeClassic/src/msglist.h index 94316c703e..d5afed9374 100644 --- a/protocols/SkypeClassic/src/msglist.h +++ b/protocols/SkypeClassic/src/msglist.h @@ -2,8 +2,8 @@ typedef struct { DWORD uMsgNum; - HANDLE hEvent; - HANDLE hMetaEvent; + MEVENT hEvent; + MEVENT hMetaEvent; time_t t; time_t tEdited; void *pfts; @@ -11,6 +11,6 @@ typedef struct { void MsgList_Init(void); void MsgList_Exit(void); -TYP_MSGLENTRY *MsgList_Add(DWORD uMsgNum, HANDLE hEvent); +TYP_MSGLENTRY *MsgList_Add(DWORD uMsgNum, MEVENT hEvent); TYP_MSGLENTRY *MsgList_FindMessage(DWORD uMsgNum); void MsgList_CollectGarbage(void); diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 2386fe528f..c9280b616f 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -868,7 +868,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { CCSDATA ccs = { 0 }; PROTORECVEVENT pre = { 0 }; MCONTACT hContact = NULL, hChat = NULL; - HANDLE hDbEvent; + MEVENT hDbEvent; DBEVENTINFO dbei = { 0 }; DBVARIANT dbv = { 0 }; fetchmsg_arg args; @@ -1042,7 +1042,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { free_nonutf_tchar_string((void*)gcd.ptszID); if (!args.bDontMarkSeen) { - MsgList_Add((DWORD)pre.lParam, INVALID_HANDLE_VALUE); + MsgList_Add((DWORD)pre.lParam, -1); SkypeSend("SET %s %s SEEN", cmdMessage, args.msgnum); } __leave; @@ -1169,7 +1169,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { bHasPartList = strncmp(msgptr, "tEdited) { // Mark the message as edited - if (!*msgptr && args.pMsgEntry->hEvent != INVALID_HANDLE_VALUE) { + if (!*msgptr && args.pMsgEntry->hEvent != -1) { // Empty message and edited -> Delete event if ((int)(hContact = db_event_getContact(args.pMsgEntry->hEvent)) != -1) { db_event_delete(hContact, args.pMsgEntry->hEvent); @@ -1273,7 +1273,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { gce.ptszText = (TCHAR*)(msgptr + msglen); gce.dwFlags = GCEF_ADDTOLOG; CallService(MS_GC_EVENT, 0, (LPARAM)&gce); - MsgList_Add((DWORD)pre.lParam, INVALID_HANDLE_VALUE); // Mark as groupchat + MsgList_Add((DWORD)pre.lParam, -1); // Mark as groupchat if (ci.pszVal) mir_free(ci.pszVal); free_nonutf_tchar_string((void*)gce.ptszUID); free_nonutf_tchar_string((void*)gcd.ptszID); @@ -1612,7 +1612,7 @@ l_exitRT: void EndCallThread(char *szSkypeMsg) { MCONTACT hContact = NULL; - HANDLE hDbEvent; + MEVENT hDbEvent; DBEVENTINFO dbei = { 0 }; DBVARIANT dbv; @@ -2675,7 +2675,7 @@ void MessageSendWatchThread(void *a) { if ((ptr=strtok_r(str, " ", &nexttoken)) && (*ptr!='#' || (ptr=strtok_r(NULL, " ", &nexttoken))) && (ptr=strtok_r(NULL, " ", &nexttoken))) { /* Use this to ensure that main thread doesn't pick up sent message */ - MsgList_Add(strtoul(ptr, NULL, 10), INVALID_HANDLE_VALUE); + MsgList_Add(strtoul(ptr, NULL, 10), -1); #ifdef USE_REAL_TS if (err=SkypeGet (cmdMessage, ptr, "TIMESTAMP")) { m_AddEventArg.hContact = arg->hContact; @@ -2847,15 +2847,13 @@ char *__skypeauth(WPARAM wParam) { DBEVENTINFO dbei = { 0 }; dbei.cbSize = sizeof(dbei); - if (((dbei.cbBlob = db_event_getBlobSize((HANDLE)wParam)) == -1 || + if (((dbei.cbBlob = db_event_getBlobSize(wParam)) == -1 || !(dbei.pBlob = (unsigned char*)malloc(dbei.cbBlob)))) { return NULL; } - if (db_event_get((HANDLE)wParam, &dbei) || - dbei.eventType != EVENTTYPE_AUTHREQUEST || - strcmp(dbei.szModule, SKYPE_PROTONAME)) + if (db_event_get(wParam, &dbei) || dbei.eventType != EVENTTYPE_AUTHREQUEST || strcmp(dbei.szModule, SKYPE_PROTONAME)) { free(dbei.pBlob); return NULL; diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index d952d7991e..1ab84505ee 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -59,7 +59,7 @@ void CSteamProto::SetAllContactsStatus(WORD status) } } -MCONTACT CSteamProto::GetContactFromAuthEvent(HANDLE hEvent) +MCONTACT CSteamProto::GetContactFromAuthEvent(MEVENT hEvent) { DWORD body[3]; DBEVENTINFO dbei = { sizeof(DBEVENTINFO) }; diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index a2d609dd20..7c645b4eae 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -105,12 +105,12 @@ MCONTACT __cdecl CSteamProto::AddToList(int flags, PROTOSEARCHRESULT* psr) return hContact; } -MCONTACT __cdecl CSteamProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) +MCONTACT __cdecl CSteamProto::AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) { return 0; } -int __cdecl CSteamProto::Authorize(HANDLE hDbEvent) +int __cdecl CSteamProto::Authorize(MEVENT hDbEvent) { if (IsOnline() && hDbEvent) { @@ -136,7 +136,7 @@ int __cdecl CSteamProto::Authorize(HANDLE hDbEvent) return 1; } -int __cdecl CSteamProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) +int __cdecl CSteamProto::AuthDeny(MEVENT hDbEvent, const TCHAR* szReason) { if (IsOnline() && hDbEvent) { diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index 0b1b2c0d20..acbae5c3c5 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -91,10 +91,10 @@ public: // PROTO_INTERFACE virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT *psr); - virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent); + virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); - virtual int __cdecl Authorize(HANDLE hDbEvent); - virtual int __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR *szReason); + virtual int __cdecl Authorize(MEVENT hDbEvent); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT *); virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR * szMessage); @@ -194,7 +194,7 @@ protected: void SetContactStatus(MCONTACT hContact, WORD status); void SetAllContactsStatus(WORD status); - MCONTACT GetContactFromAuthEvent(HANDLE hEvent); + MCONTACT GetContactFromAuthEvent(MEVENT hEvent); void UpdateContact(MCONTACT hContact, JSONNODE *data); void ProcessContact(std::map::iterator *it, MCONTACT hContact); @@ -275,7 +275,7 @@ protected: static int RsaEncrypt(const char *pszModulus, const char *data, BYTE *encrypted, DWORD &encryptedSize); - HANDLE AddDBEvent(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob); + MEVENT AddDBEvent(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob); static void CSteamProto::ShowNotification(const wchar_t *message, int flags = 0, MCONTACT hContact = NULL); static void CSteamProto::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags = 0, MCONTACT hContact = NULL); diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp index 85aef0a715..40fd27d888 100644 --- a/protocols/Steam/src/steam_utils.cpp +++ b/protocols/Steam/src/steam_utils.cpp @@ -157,7 +157,7 @@ exit: return 0; } -HANDLE CSteamProto::AddDBEvent(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob) +MEVENT CSteamProto::AddDBEvent(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.szModule = m_szModuleName; diff --git a/protocols/Tlen/src/tlen.h b/protocols/Tlen/src/tlen.h index e877986253..1c513aba6d 100644 --- a/protocols/Tlen/src/tlen.h +++ b/protocols/Tlen/src/tlen.h @@ -219,10 +219,10 @@ struct TlenProtocol : public PROTO //==================================================================================== virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ); - virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ); + virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, MEVENT hDbEvent ); - virtual int __cdecl Authorize(HANDLE hDbEvent); - virtual int __cdecl AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason); + virtual int __cdecl Authorize(MEVENT hDbEvent); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const PROTOCHAR* szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl AuthRequest(MCONTACT hContact, const PROTOCHAR* szMessage); diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 6f0c0f263c..b1e35e62b3 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -224,7 +224,7 @@ MCONTACT TlenProtocol::AddToList(int flags, PROTOSEARCHRESULT *psr) return hContact; } -MCONTACT TlenProtocol::AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ) +MCONTACT TlenProtocol::AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) { DBEVENTINFO dbei = { sizeof(dbei) }; if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1)) @@ -262,7 +262,7 @@ MCONTACT TlenProtocol::AddToListByEvent( int flags, int iContact, HANDLE hDbEven return hContact; } -int TlenProtocol::Authorize(HANDLE hDbEvent) +int TlenProtocol::Authorize(MEVENT hDbEvent) { if (!isOnline) return 1; @@ -311,7 +311,7 @@ int TlenProtocol::Authorize(HANDLE hDbEvent) return 0; } -int TlenProtocol::AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason) +int TlenProtocol::AuthDeny(MEVENT hDbEvent, const PROTOCHAR* szReason) { if (!isOnline) return 1; diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index 9f714bbdb6..dd9300d471 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -700,7 +700,7 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info) if (msgTime == 0) { msgTime = time(NULL); } else { - HANDLE hDbEvent = db_event_last(hContact); + MEVENT hDbEvent = db_event_last(hContact); if (hDbEvent != NULL) { DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get( hDbEvent, &dbei); diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 110480ed8c..6a7321546f 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -22,7 +22,7 @@ void CToxProto::SetAllContactsStatus(WORD status) } } -MCONTACT CToxProto::GetContactFromAuthEvent(HANDLE hEvent) +MCONTACT CToxProto::GetContactFromAuthEvent(MEVENT hEvent) { DWORD body[3]; DBEVENTINFO dbei = { sizeof(DBEVENTINFO) }; diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 204777d9ec..e9d93dac78 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -91,12 +91,12 @@ MCONTACT __cdecl CToxProto::AddToList(int flags, PROTOSEARCHRESULT* psr) return AddContact(address, _T(""), flags & PALF_TEMPORARY); } -MCONTACT __cdecl CToxProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) +MCONTACT __cdecl CToxProto::AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) { return 0; } -int __cdecl CToxProto::Authorize(HANDLE hDbEvent) +int __cdecl CToxProto::Authorize(MEVENT hDbEvent) { MCONTACT hContact = GetContactFromAuthEvent(hDbEvent); if (hContact == INVALID_CONTACT_ID) @@ -117,7 +117,7 @@ int __cdecl CToxProto::Authorize(HANDLE hDbEvent) return 0; } -int __cdecl CToxProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason) { return 0; } +int __cdecl CToxProto::AuthDeny(MEVENT hDbEvent, const PROTOCHAR* szReason) { return 0; } int __cdecl CToxProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre) { diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 7dc29878b9..962af5b609 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -66,10 +66,10 @@ public: // Virtual functions virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); - virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent); + virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); - virtual int __cdecl Authorize(HANDLE hDbEvent); - virtual int __cdecl AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason); + virtual int __cdecl Authorize(MEVENT hDbEvent); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const PROTOCHAR* szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl AuthRequest(MCONTACT hContact, const PROTOCHAR* szMessage); @@ -175,7 +175,7 @@ private: MCONTACT FindContact(const int friendNumber); MCONTACT AddContact(const std::string &id, const std::tstring &dnsId, bool isTemporary = false); - MCONTACT GetContactFromAuthEvent(HANDLE hEvent); + MCONTACT GetContactFromAuthEvent(MEVENT hEvent); void LoadFriendList(); @@ -231,7 +231,7 @@ private: static void ShowNotification(const TCHAR *message, int flags = 0, MCONTACT hContact = NULL); static void ShowNotification(const TCHAR *caption, const TCHAR *message, int flags = 0, MCONTACT hContact = NULL); - HANDLE AddDbEvent(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob); + MEVENT AddDbEvent(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob); std::vector HexStringToData(std::string hex); std::string DataToHexString(std::vector); diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index bc515000f9..e3bf7d9707 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -60,7 +60,7 @@ void CToxProto::ShowNotification(const TCHAR *message, int flags, MCONTACT hCont ShowNotification(_T(MODULE), message, flags, hContact); } -HANDLE CToxProto::AddDbEvent(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob) +MEVENT CToxProto::AddDbEvent(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.szModule = m_szModuleName; diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index e19d1578ad..865ed10b17 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -33,10 +33,10 @@ public: //PROTO_INTERFACE virtual MCONTACT __cdecl AddToList(int,PROTOSEARCHRESULT *); - virtual MCONTACT __cdecl AddToListByEvent(int,int,HANDLE); + virtual MCONTACT __cdecl AddToListByEvent(int,int,MEVENT); - virtual int __cdecl Authorize(HANDLE); - virtual int __cdecl AuthDeny(HANDLE,const TCHAR *); + virtual int __cdecl Authorize(MEVENT); + virtual int __cdecl AuthDeny(MEVENT,const TCHAR *); virtual int __cdecl AuthRecv(MCONTACT, PROTORECVEVENT *); virtual int __cdecl AuthRequest(MCONTACT, const TCHAR *); diff --git a/protocols/Twitter/src/stubs.cpp b/protocols/Twitter/src/stubs.cpp index 7a61276701..38f7b93288 100644 --- a/protocols/Twitter/src/stubs.cpp +++ b/protocols/Twitter/src/stubs.cpp @@ -18,17 +18,17 @@ along with this program. If not, see . #include "stdafx.h" #include "proto.h" -MCONTACT TwitterProto::AddToListByEvent(int flags,int iContact,HANDLE hDbEvent) +MCONTACT TwitterProto::AddToListByEvent(int flags,int iContact,MEVENT hDbEvent) { return NULL; } -int TwitterProto::Authorize(HANDLE hDbEvent) +int TwitterProto::Authorize(MEVENT hDbEvent) { return 1; } -int TwitterProto::AuthDeny(HANDLE hDbEvent,const TCHAR *reason) +int TwitterProto::AuthDeny(MEVENT hDbEvent,const TCHAR *reason) { return 1; } diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index c80990c01f..70c28659e5 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -506,23 +506,23 @@ void CVkProto::DBAddAuthRequest(const MCONTACT hContact) mir_free(szNick); } -MCONTACT CVkProto::MContactFromDbEvent(HANDLE hDbEvent) -{ - debugLogA("CVkProto::MContactFromDbEvent"); - if (!hDbEvent || !IsOnline()) - return INVALID_CONTACT_ID; - - DWORD body[2]; - DBEVENTINFO dbei = { sizeof(dbei) }; - dbei.cbBlob = sizeof(DWORD) * 2; - dbei.pBlob = (PBYTE)&body; - - if (db_event_get(hDbEvent, &dbei)) - return INVALID_CONTACT_ID; - if (dbei.eventType != EVENTTYPE_AUTHREQUEST || strcmp(dbei.szModule, m_szModuleName)) - return INVALID_CONTACT_ID; - - MCONTACT hContact = DbGetAuthEventContact(&dbei); +MCONTACT CVkProto::MContactFromDbEvent(MEVENT hDbEvent) +{ + debugLogA("CVkProto::MContactFromDbEvent"); + if (!hDbEvent || !IsOnline()) + return INVALID_CONTACT_ID; + + DWORD body[2]; + DBEVENTINFO dbei = { sizeof(dbei) }; + dbei.cbBlob = sizeof(DWORD) * 2; + dbei.pBlob = (PBYTE)&body; + + if (db_event_get(hDbEvent, &dbei)) + return INVALID_CONTACT_ID; + if (dbei.eventType != EVENTTYPE_AUTHREQUEST || strcmp(dbei.szModule, m_szModuleName)) + return INVALID_CONTACT_ID; + + MCONTACT hContact = DbGetAuthEventContact(&dbei); db_unset(hContact, m_szModuleName, "ReqAuth"); return hContact; } @@ -607,30 +607,30 @@ void CVkProto::ContactTypingThread(void *p) int CVkProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam) { - debugLogA("CVkProto::OnProcessSrmmEvent"); - MessageWindowEventData *event = (MessageWindowEventData *)lParam; - - if (event->uType == MSG_WINDOW_EVT_OPENING) - SetSrmmReadStatus(event->hContact); + debugLogA("CVkProto::OnProcessSrmmEvent"); + MessageWindowEventData *event = (MessageWindowEventData *)lParam; + + if (event->uType == MSG_WINDOW_EVT_OPENING) + SetSrmmReadStatus(event->hContact); return 0; } void CVkProto::SetSrmmReadStatus(MCONTACT hContact) { - time_t time = getDword(hContact, "LastMsgReadTime", 0); - if (!time) - return; - - TCHAR ttime[64]; - _locale_t locale = _create_locale(LC_ALL, ""); - _tcsftime_l(ttime, SIZEOF(ttime), _T("%X - %x"), localtime(&time), locale); - _free_locale(locale); - - StatusTextData st = { 0 }; - st.cbSize = sizeof(st); - st.hIcon = Skin_GetIconByHandle(GetIconHandle(IDI_READMSG)); - mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s"), ttime); + time_t time = getDword(hContact, "LastMsgReadTime", 0); + if (!time) + return; + + TCHAR ttime[64]; + _locale_t locale = _create_locale(LC_ALL, ""); + _tcsftime_l(ttime, SIZEOF(ttime), _T("%X - %x"), localtime(&time), locale); + _free_locale(locale); + + StatusTextData st = { 0 }; + st.cbSize = sizeof(st); + st.hIcon = Skin_GetIconByHandle(GetIconHandle(IDI_READMSG)); + mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s"), ttime); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st); } diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 1c9daf9df9..4744a9e44b 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -631,9 +631,9 @@ void CVkProto::NewsClearHistory() return; time_t tTime = time(NULL) - m_iNewsAutoClearHistoryInterval; - HANDLE hDBEvent = db_event_first(hContact); + MEVENT hDBEvent = db_event_first(hContact); while (hDBEvent) { - HANDLE hDBEventNext = db_event_next(hContact, hDBEvent); + MEVENT hDBEventNext = db_event_next(hContact, hDBEvent); DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get(hDBEvent, &dbei); if (dbei.timestamp < tTime) diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index f9d3ba4ac2..09715eac04 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -32,9 +32,9 @@ INT_PTR __cdecl CVkProto::SvcGetAllServerHistory(WPARAM hContact, LPARAM) if (userID == -1 || userID == VK_FEED_USER) return 0; - HANDLE hDBEvent = db_event_first(hContact); + MEVENT hDBEvent = db_event_first(hContact); while (hDBEvent) { - HANDLE hDBEventNext = db_event_next(hContact, hDBEvent); + MEVENT hDBEventNext = db_event_next(hContact, hDBEvent); db_event_delete(hContact, hDBEvent); hDBEvent = hDBEventNext; } @@ -102,9 +102,9 @@ void CVkProto::GetServerHistoryLastNDay(MCONTACT hContact, int NDay) time_t tTime = time(NULL) - 60 * 60 * 24 * NDay; - HANDLE hDBEvent = db_event_first(hContact); + MEVENT hDBEvent = db_event_first(hContact); while (hDBEvent) { - HANDLE hDBEventNext = db_event_next(hContact, hDBEvent); + MEVENT hDBEventNext = db_event_next(hContact, hDBEvent); DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get(hDBEvent, &dbei); if (dbei.timestamp > tTime) diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index f3881cd76a..e952478e8a 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -677,7 +677,7 @@ void CVkProto::OnReceiveAuthRequest(NETLIBHTTPREQUEST *reply, AsyncHttpRequest * delete param; } -int CVkProto::Authorize(HANDLE hDbEvent) +int CVkProto::Authorize(MEVENT hDbEvent) { debugLogA("CVkProto::Authorize"); if (!IsOnline()) @@ -689,7 +689,7 @@ int CVkProto::Authorize(HANDLE hDbEvent) return AuthRequest(hContact, NULL); } -int CVkProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR*) +int CVkProto::AuthDeny(MEVENT hDbEvent, const PROTOCHAR*) { debugLogA("CVkProto::AuthDeny"); if (!IsOnline()) @@ -721,7 +721,7 @@ int CVkProto::UserIsTyping(MCONTACT hContact, int type) return 1; } -MCONTACT CVkProto::AddToListByEvent(int, int, HANDLE) +MCONTACT CVkProto::AddToListByEvent(int, int, MEVENT) { return NULL; } diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 1e29b642b7..c77952393e 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -250,10 +250,10 @@ struct CVkProto : public PROTO //==================================================================================== virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); - virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent); + virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent); - virtual int __cdecl Authorize(HANDLE hDbEvent); - virtual int __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR *szReason); + virtual int __cdecl Authorize(MEVENT hDbEvent); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*); virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage); @@ -403,7 +403,7 @@ struct CVkProto : public PROTO void ApplyCookies(AsyncHttpRequest*); void DBAddAuthRequest(const MCONTACT hContact); - MCONTACT MContactFromDbEvent(HANDLE hDbEvent); + MCONTACT MContactFromDbEvent(MEVENT hDbEvent); void SetMirVer(MCONTACT hContact, int platform); diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index 50a4e5a389..d4eda7f973 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -131,7 +131,7 @@ int WhatsAppProto::AuthRequest(MCONTACT hContact, const PROTOCHAR *message) return this->RequestFriendship((WPARAM)hContact, NULL); } -int WhatsAppProto::Authorize(HANDLE hDbEvent) +int WhatsAppProto::Authorize(MEVENT hDbEvent) { return 1; } diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index d3ba55b576..5f5416671f 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -33,10 +33,10 @@ public: //PROTO_INTERFACE virtual MCONTACT __cdecl AddToList(int flags, PROTOSEARCHRESULT* psr); - virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) { return NULL; } + virtual MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) { return NULL; } - virtual int __cdecl Authorize(HANDLE hDbEvent); - virtual int __cdecl AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason) { return 1; } + virtual int __cdecl Authorize(MEVENT hDbEvent); + virtual int __cdecl AuthDeny(MEVENT hDbEvent, const PROTOCHAR* szReason) { return 1; } virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT*) { return 1; } virtual int __cdecl AuthRequest(MCONTACT hContact, const PROTOCHAR* szMessage); diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index 54a4d9d1cf..0da62a376a 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -108,7 +108,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons pre.flags = (utf8) ? PREF_UTF : 0; if (tm) { - HANDLE hEvent = db_event_last(hContact); + MEVENT hEvent = db_event_last(hContact); if (hEvent) { // contact has events DWORD dummy; diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 4b75b0355c..020574af1b 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -137,7 +137,7 @@ MCONTACT CYahooProto::AddToList( int flags, PROTOSEARCHRESULT* psr ) return hContact; } -MCONTACT __cdecl CYahooProto::AddToListByEvent( int flags, int /*iContact*/, HANDLE hDbEvent ) +MCONTACT __cdecl CYahooProto::AddToListByEvent( int flags, int /*iContact*/, MEVENT hDbEvent ) { debugLogA("[YahooAddToListByEvent]"); if (!m_bLoggedIn) @@ -178,7 +178,7 @@ MCONTACT __cdecl CYahooProto::AddToListByEvent( int flags, int /*iContact*/, HAN //////////////////////////////////////////////////////////////////////////////////////// // AuthAllow - processes the successful authorization -int CYahooProto::Authorize( HANDLE hdbe ) +int CYahooProto::Authorize(MEVENT hdbe) { debugLogA("[YahooAuthAllow]"); if ( !m_bLoggedIn ) { @@ -217,7 +217,7 @@ int CYahooProto::Authorize( HANDLE hdbe ) //////////////////////////////////////////////////////////////////////////////////////// // AuthDeny - handles the unsuccessful authorization -int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) +int CYahooProto::AuthDeny(MEVENT hdbe, const TCHAR *reason) { debugLogA("[YahooAuthDeny]"); if ( !m_bLoggedIn ) diff --git a/protocols/Yahoo/src/proto.h b/protocols/Yahoo/src/proto.h index 1b7d1fd5c4..207351964f 100644 --- a/protocols/Yahoo/src/proto.h +++ b/protocols/Yahoo/src/proto.h @@ -26,10 +26,10 @@ struct CYahooProto : public PROTO //==================================================================================== virtual MCONTACT __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ); - virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ); + virtual MCONTACT __cdecl AddToListByEvent( int flags, int iContact, MEVENT hDbEvent ); - virtual int __cdecl Authorize( HANDLE hDbEvent ); - virtual int __cdecl AuthDeny( HANDLE hDbEvent, const TCHAR* szReason ); + virtual int __cdecl Authorize( MEVENT hDbEvent ); + virtual int __cdecl AuthDeny( MEVENT hDbEvent, const TCHAR* szReason ); virtual int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT* ); virtual int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage ); -- cgit v1.2.3