From 33953cc6a0fab6a91af293c6838f8a46dd7922da Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 10 Feb 2014 14:42:51 +0000 Subject: HCONTACT, part 3 git-svn-id: http://svn.miranda-ng.org/main/trunk@8081 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_addcontact.h | 6 +- include/m_avatars.h | 4 +- plugins/AVS/src/acc.cpp | 2 +- plugins/AVS/src/utils.cpp | 8 +- plugins/Boltun/src/Engine/TalkEngine.cpp | 25 ++-- plugins/Boltun/src/Engine/TalkEngine.h | 29 +++-- plugins/Boltun/src/actionQueue.cpp | 2 +- .../ClientChangeNotify/src/ClientChangeNotify.cpp | 8 +- .../Clist_modern/src/hdr/modern_commonprototypes.h | 2 +- plugins/Clist_modern/src/modern_awaymsg.cpp | 4 +- plugins/Clist_modern/src/modern_clc.cpp | 58 +++++---- plugins/Clist_modern/src/modern_clcidents.cpp | 30 ++--- plugins/Clist_modern/src/modern_clcitems.cpp | 12 +- plugins/Clist_modern/src/modern_clcmsgs.cpp | 6 +- plugins/Clist_modern/src/modern_clistmod.cpp | 2 +- plugins/Clist_mw/src/clc.cpp | 8 +- plugins/Clist_mw/src/clcidents.cpp | 11 +- plugins/Clist_mw/src/clcitems.cpp | 7 +- plugins/Clist_mw/src/clistmod.cpp | 2 +- plugins/Clist_nicer/src/clc.cpp | 34 +++--- plugins/Clist_nicer/src/clcidents.cpp | 5 +- plugins/Clist_nicer/src/clcmsgs.cpp | 8 +- plugins/Clist_nicer/src/clistmenus.cpp | 12 +- plugins/CmdLine/src/mimcmd_handlers.cpp | 4 +- plugins/ContactsPlus/src/utils.cpp | 6 +- plugins/ContactsPlus/src/utils.h | 2 +- plugins/CyrTranslit/src/MirandaContact.cpp | 4 +- plugins/DbEditorPP/src/exportimport.cpp | 4 +- plugins/DbEditorPP/src/moduletree.cpp | 4 +- plugins/ExternalAPI/m_LogService.h | 6 +- plugins/ExternalAPI/m_voice.h | 2 +- plugins/FavContacts/src/main.cpp | 6 +- plugins/FlashAvatars/src/cflash.cpp | 4 +- plugins/FloatingContacts/src/main.cpp | 2 +- plugins/FloatingContacts/src/thumbs.cpp | 2 +- plugins/IEView/src/IEView.h | 32 ++--- plugins/Import/src/utils.cpp | 4 +- plugins/KeyboardNotify/src/main.cpp | 2 +- plugins/MenuItemEx/src/main.cpp | 6 +- plugins/MetaContacts/src/meta_api.cpp | 6 +- plugins/MetaContacts/src/meta_menu.cpp | 2 +- plugins/MetaContacts/src/meta_services.cpp | 4 +- plugins/MirOTR/MirOTR/src/dbfilter.cpp | 2 +- plugins/MirOTR/MirOTR/src/options.cpp | 2 +- plugins/MirOTR/MirOTR/src/svcs_menu.cpp | 4 +- plugins/MirOTR/MirOTR/src/utils.cpp | 3 +- plugins/MirandaG15/src/CChatScreen.cpp | 2 +- plugins/MirandaG15/src/CChatScreen.h | 2 +- plugins/Msg_Export/src/options.cpp | 34 +++--- plugins/NewXstatusNotify/src/main.cpp | 2 +- plugins/NewXstatusNotify/src/popup.cpp | 2 +- plugins/NewXstatusNotify/src/xstatus.cpp | 2 +- plugins/New_GPG/src/messages.cpp | 4 +- plugins/PasteIt/src/PasteIt.cpp | 8 +- plugins/Popup/src/avatars.cpp | 2 +- plugins/Popup/src/avatars_gif.cpp | 2 +- plugins/Popup/src/popup_wnd2.cpp | 4 +- plugins/Popup/src/popup_wnd2.h | 4 +- plugins/QuickContacts/src/quickcontacts.cpp | 20 ++-- plugins/Quotes/src/ExtraImages.cpp | 2 +- plugins/Quotes/src/Forex.cpp | 2 +- plugins/Quotes/src/ImportExport.cpp | 10 +- plugins/Quotes/src/QuoteInfoDlg.cpp | 36 +++--- plugins/Quotes/src/QuotesProviderBase.cpp | 30 ++--- plugins/Quotes/src/QuotesProviderDukasCopy.cpp | 2 +- plugins/Quotes/src/QuotesProviderFinance.cpp | 2 +- plugins/Quotes/src/QuotesProviderGoogle.cpp | 2 +- plugins/Quotes/src/SettingsDlg.cpp | 4 +- plugins/Scriver/src/cmdlist.h | 2 +- plugins/Scriver/src/msgdialog.cpp | 8 +- plugins/SecureIM/src/crypt_metacontacts.cpp | 2 +- plugins/SecureIM/src/crypt_misc.cpp | 2 +- plugins/SeenPlugin/src/utils.cpp | 14 +-- plugins/Sessions/Src/Main.cpp | 3 +- plugins/Sessions/Src/Options.cpp | 2 +- plugins/Sessions/Src/Utils.cpp | 8 +- plugins/Sessions/Src/Utils.h | 6 +- plugins/SmileyAdd/src/customsmiley.cpp | 2 +- plugins/SmileyAdd/src/customsmiley.h | 8 +- plugins/SmileyAdd/src/dlgboxsubclass.cpp | 2 +- plugins/StopSpamMod/src/utilities.cpp | 3 +- plugins/TabSRMM/src/chat/chat.h | 2 +- plugins/TabSRMM/src/chat/manager.cpp | 2 +- plugins/TabSRMM/src/chat/window.cpp | 2 +- plugins/TabSRMM/src/contactcache.cpp | 14 +-- plugins/TabSRMM/src/container.cpp | 2 +- plugins/TabSRMM/src/functions.h | 2 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 5 +- plugins/TabSRMM/src/hotkeyhandler.cpp | 32 +++-- plugins/TabSRMM/src/msgdialog.cpp | 6 +- plugins/TabSRMM/src/msgs.cpp | 2 +- plugins/TabSRMM/src/nen.h | 2 +- plugins/TabSRMM/src/sendlater.cpp | 14 +-- plugins/TabSRMM/src/sendlater.h | 22 ++-- plugins/TabSRMM/src/sidebar.cpp | 2 +- plugins/TabSRMM/src/sidebar.h | 2 +- plugins/TabSRMM/src/tabctrl.cpp | 2 +- plugins/TipperYM/src/message_pump.cpp | 18 +-- plugins/TipperYM/src/popwin.cpp | 6 +- plugins/UserInfoEx/src/classMAnnivDate.cpp | 8 +- plugins/UserInfoEx/src/classMTime.cpp | 19 +-- plugins/UserInfoEx/src/dlg_propsheet.cpp | 10 +- plugins/UserInfoEx/src/dlg_propsheet.h | 30 ++--- .../src/ex_import/classExImContactBase.cpp | 4 +- .../src/ex_import/classExImContactBase.h | 37 +++--- .../src/ex_import/classExImContactXML.cpp | 10 +- plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp | 6 +- plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp | 2 +- plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp | 8 +- plugins/UserInfoEx/src/ex_import/svc_ExImXML.h | 30 ++--- plugins/Variables/src/help.cpp | 8 +- plugins/Weather/src/weather_svcs.cpp | 4 +- plugins/WhenWasIt/src/dlg_handlers.cpp | 8 +- plugins/WhenWasIt/src/notifiers.cpp | 15 +-- plugins/WinterSpeak/src/SpeakAnnounce.cpp | 130 ++++++++------------- plugins/WinterSpeak/src/SpeakAnnounce.h | 25 ++-- plugins/WinterSpeak/src/UserInformation.cpp | 10 +- plugins/WinterSpeak/src/UserInformation.h | 16 +-- plugins/WinterSpeak/src/main.cpp | 11 +- plugins/YAPP/src/popwin.cpp | 2 +- protocols/AimOscar/src/proto.cpp | 2 +- protocols/AimOscar/src/services.cpp | 2 +- protocols/FacebookRM/src/messages.cpp | 2 - protocols/FacebookRM/src/proto.cpp | 16 +-- protocols/FacebookRM/src/theme.cpp | 6 +- protocols/Gadu-Gadu/src/core.cpp | 2 +- protocols/Gadu-Gadu/src/filetransfer.cpp | 6 +- protocols/Gadu-Gadu/src/gg_proto.cpp | 10 +- protocols/Gadu-Gadu/src/oauth.cpp | 2 +- protocols/IRCG/src/input.cpp | 2 +- protocols/IRCG/src/ircproto.cpp | 4 +- protocols/JabberG/src/jabber_archive.cpp | 4 +- protocols/JabberG/src/jabber_chat.cpp | 2 +- protocols/JabberG/src/jabber_iqid.cpp | 2 +- protocols/JabberG/src/jabber_proto.cpp | 2 +- protocols/MSN/src/msn_commands.cpp | 2 +- protocols/MSN/src/msn_misc.cpp | 14 +-- protocols/MSN/src/msn_proto.cpp | 2 +- protocols/Omegle/src/chat.cpp | 2 +- protocols/Omegle/src/proto.h | 2 +- protocols/SkypeClassic/src/skype.cpp | 32 ++--- protocols/SkypeClassic/src/skypeapi.cpp | 5 +- protocols/SkypeClassic/src/voiceservice.cpp | 10 +- protocols/Tlen/src/tlen_misc.cpp | 2 +- protocols/Tlen/src/tlen_svc.cpp | 12 +- protocols/Twitter/src/theme.cpp | 4 +- protocols/Xfire/src/Xfire_avatar_loader.cpp | 3 +- protocols/Xfire/src/Xfire_avatar_loader.h | 4 +- protocols/Xfire/src/main.cpp | 13 ++- protocols/Xfire/src/recvremovebuddypacket.h | 40 +++---- protocols/Xfire/src/userdetails.cpp | 4 +- protocols/Yahoo/src/im.cpp | 10 +- protocols/Yahoo/src/proto.cpp | 4 +- protocols/Yahoo/src/yahoo.cpp | 20 ++-- src/core/stdauth/authdialogs.cpp | 14 +-- src/core/stdfile/filerecvdlg.cpp | 6 +- src/core/stdmsg/src/msgdialog.cpp | 4 +- src/core/stdurl/urldialogs.cpp | 6 +- src/modules/addcontact/addcontact.cpp | 20 ++-- src/modules/clist/clc.cpp | 26 ++--- src/modules/clist/clcidents.cpp | 24 ++-- src/modules/clist/clcitems.cpp | 6 +- src/modules/clist/clcmsgs.cpp | 30 ++--- src/modules/clist/clcutils.cpp | 2 +- src/modules/clist/clistevents.cpp | 2 +- src/modules/clist/clistsettings.cpp | 2 +- src/modules/clist/clui.cpp | 6 +- src/modules/findadd/searchresults.cpp | 4 +- 168 files changed, 736 insertions(+), 833 deletions(-) diff --git a/include/m_addcontact.h b/include/m_addcontact.h index 383d9e48e8..b4dad7f90c 100644 --- a/include/m_addcontact.h +++ b/include/m_addcontact.h @@ -27,7 +27,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct{ int handleType; // one of the HANDLE_ constants - HANDLE handle; // hDbEvent if acs.handleType == HANDLE_EVENT, hContact if acs.handleType == HANDLE_CONTACT, ignored if acs.handleType == HANDLE_SEARCHRESULT + union { + HANDLE hDbEvent; // hDbEvent if acs.handleType == HANDLE_EVENT + HCONTACT hContact; // hContact if acs.handleType == HANDLE_CONTACT + // ignored if acs.handleType == HANDLE_SEARCHRESULT + }; const char *szProto; // ignored if acs.handleType != HANDLE_SEARCHRESULT PROTOSEARCHRESULT *psr; // ignored if acs.handleType != HANDLE_SEARCHRESULT }ADDCONTACTSTRUCT; diff --git a/include/m_avatars.h b/include/m_avatars.h index ce1e6eab69..1b03a3f33b 100644 --- a/include/m_avatars.h +++ b/include/m_avatars.h @@ -101,7 +101,7 @@ typedef struct avatarCacheEntry { typedef struct _avatarDrawRequest { DWORD cbSize; // set this to sizeof(AVATARDRAWREQUEST) - mandatory, service will return failure code if // cbSize is wrong - HANDLE hContact; // the contact for which the avatar should be drawn. set it to 0 to draw a protocol picture + HCONTACT hContact; // the contact for which the avatar should be drawn. set it to 0 to draw a protocol picture HDC hTargetDC; // target device context RECT rcDraw; // target rectangle. The avatar will be centered within the rectangle and scaled to fit. DWORD dwFlags; // flags (see above for valid bitflags) @@ -212,7 +212,7 @@ typedef struct _avatarDrawRequest { typedef struct _contactAvatarChangedNotification { int cbSize; // sizeof() - HANDLE hContact; // this might have to be set by the caller too + HCONTACT hContact; // this might have to be set by the caller too int format; // PA_FORMAT_* TCHAR filename[MAX_PATH]; // full path to filename which contains the avatar TCHAR hash[128]; // avatar hash diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp index d664fd1995..3a743a2f08 100644 --- a/plugins/AVS/src/acc.cpp +++ b/plugins/AVS/src/acc.cpp @@ -708,7 +708,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l } case DM_AVATARCHANGED: { - if (data->hContact == (HANDLE) wParam) + if (data->hContact == (HCONTACT)wParam) { DestroyAnimation(hwnd, data); StartAnimation(hwnd, data); diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index 3c6a40c4e8..ed9e674750 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -212,7 +212,7 @@ int CreateAvatarInCache(HCONTACT hContact, avatarCacheEntry *ace, char *szProto) } } } - else if (hContact == (HANDLE)-1) { // create own picture - note, own avatars are not on demand, they are loaded once at + else if (hContact == (HCONTACT)-1) { // create own picture - note, own avatars are not on demand, they are loaded once at // startup and everytime they are changed. if (szProto[0] == '\0') { // Global avatar @@ -274,7 +274,7 @@ int CreateAvatarInCache(HCONTACT hContact, avatarCacheEntry *ace, char *szProto) BOOL noTransparency = db_get_b(0, AVS_MODULE, "RemoveAllTransparency", 0); // Calc image hash - if (hContact != 0 && hContact != (HANDLE)-1) { + if (hContact != 0 && hContact != (HCONTACT)-1) { // Have to reset settings? -> do it if image changed DWORD imgHash = GetImgHash(ace->hbmPic); if (imgHash != db_get_dw(hContact, "ContactPhoto", "ImageHash", 0)) { @@ -297,7 +297,7 @@ int CreateAvatarInCache(HCONTACT hContact, avatarCacheEntry *ace, char *szProto) } } } - else if (hContact == (HANDLE)-1) { // My avatars + else if (hContact == (HCONTACT)-1) { // My avatars if (!noTransparency && !isTransparentImage && db_get_b(0, AVS_MODULE, "MakeTransparentBkg", 0) && db_get_b(0, AVS_MODULE, "MakeMyAvatarsTransparent", 0)) @@ -329,7 +329,7 @@ int CreateAvatarInCache(HCONTACT hContact, avatarCacheEntry *ace, char *szProto) protoPicCacheEntry *pAce = (protoPicCacheEntry *)ace; if (hContact == 0) pAce->dwFlags |= AVS_PROTOPIC; - else if (hContact == (HANDLE)-1) + else if (hContact == (HCONTACT)-1) pAce->dwFlags |= AVS_OWNAVATAR; } diff --git a/plugins/Boltun/src/Engine/TalkEngine.cpp b/plugins/Boltun/src/Engine/TalkEngine.cpp index a72bbdeb80..d771012a5f 100644 --- a/plugins/Boltun/src/Engine/TalkEngine.cpp +++ b/plugins/Boltun/src/Engine/TalkEngine.cpp @@ -76,7 +76,7 @@ TalkBot::TalkBot(const Mind& goodMind) :mind(goodMind), beSilent(false), makeLowercase(false), understandAlways(false) { - contactDatas = new PerContactData(mind); + contactDatas = new PerContactData(mind); } TalkBot::~TalkBot() @@ -84,7 +84,7 @@ TalkBot::~TalkBot() delete contactDatas; } -tstring TalkBot::GetInitMessage(void* contact) +tstring TalkBot::GetInitMessage(HCONTACT contact) { ContactData* d = contactDatas->GetData(contact); tstring s = d->initial.GetString(); @@ -108,8 +108,7 @@ tstring TalkBot::ReplaceAliases(const tstring &message) for (unsigned j = max; j > 0; j--) { tstring item = sentence.substr(i, j); - if (mind.GetData()->smiles.find(item) - != mind.GetData()->smiles.end()) + if (mind.GetData()->smiles.find(item) != mind.GetData()->smiles.end()) { sm[i] = item; sentence.replace(i, j, _T("\1")); @@ -160,7 +159,7 @@ tstring TalkBot::ReplaceAliases(const tstring &message) return result; } -tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData* contactData, Level &maxValue, std::multimap &mm) +tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contactData, Level &maxValue, std::multimap &mm) { tstring res; //Part 1 @@ -273,14 +272,14 @@ tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData* contact return tstring(); } -TalkBot::MessageInfo* TalkBot::Reply(void* contact, tstring incomingMessage, bool saveChoice) +TalkBot::MessageInfo* TalkBot::Reply(HCONTACT contact, tstring incomingMessage, bool saveChoice) { TCHAR* str = new TCHAR[incomingMessage.length()+1]; _tcscpy(str, incomingMessage.c_str()); CharLower(str); incomingMessage = str; delete [] str; - ContactData* contactData = contactDatas->GetData(contact); + ContactData *contactData = contactDatas->GetData(contact); if (incomingMessage == contactData->lastMessage && GetTickCount() < contactData->lastMessageTime + 30*60*1000) { @@ -353,7 +352,7 @@ TalkBot::MessageInfo* TalkBot::Reply(void* contact, tstring incomingMessage, boo return info; } -bool TalkBot::FindExact(ContactData* contactData, const tstring &incomingMessage, +bool TalkBot::FindExact(ContactData *contactData, const tstring &incomingMessage, const multimap& map, tstring& res) { int max = (int)map.count(incomingMessage); @@ -371,9 +370,9 @@ bool TalkBot::FindExact(ContactData* contactData, const tstring &incomingMessage return true; } -void TalkBot::AnswerGiven(void* contact, const TalkBot::MessageInfo& info) +void TalkBot::AnswerGiven(HCONTACT contact, const TalkBot::MessageInfo& info) { - ContactData* contactData = contactDatas->GetData(contact); + ContactData *contactData = contactDatas->GetData(contact); RecordAnswer(contactData, info); contactDatas->PutData(contact); } @@ -441,7 +440,7 @@ tstring LevelToStr(TalkBot::Level target) } #endif -tstring TalkBot::ChooseResult(ContactData* contactData, Level maxValue, const multimap &mm) +tstring TalkBot::ChooseResult(ContactData *contactData, Level maxValue, const multimap &mm) { #ifdef DEBUG_SHOW_VARIANTS AddBotMessage(_T(">>Availabe:")); @@ -470,7 +469,7 @@ tstring TalkBot::ChooseResult(ContactData* contactData, Level maxValue, const mu #endif } -void TalkBot::FindByKeywords(ContactData* contactData, const vector &keywords, tstring& res/*, tstring& ures*/, +void TalkBot::FindByKeywords(ContactData *contactData, const vector &keywords, tstring& res/*, tstring& ures*/, bool isQuestion) { if (keywords.size() == 0) @@ -490,7 +489,7 @@ void TalkBot::FindByKeywords(ContactData* contactData, const vector &ke res = contactData->chooser.Choose(); } -bool TalkBot::FindByOthers(ContactData* contactData, const vector &otherwords, tstring& res, bool isQuestion) +bool TalkBot::FindByOthers(ContactData *contactData, const vector &otherwords, tstring& res, bool isQuestion) { //vector results; const multimap &specs = isQuestion ? mind.GetData()->qspecialEscapes : diff --git a/plugins/Boltun/src/Engine/TalkEngine.h b/plugins/Boltun/src/Engine/TalkEngine.h index b57cb7f89c..9701b09637 100644 --- a/plugins/Boltun/src/Engine/TalkEngine.h +++ b/plugins/Boltun/src/Engine/TalkEngine.h @@ -74,27 +74,26 @@ private: } }; - PerContactData* contactDatas; + PerContactData* contactDatas; const Mind mind; bool beSilent; bool makeLowercase; bool understandAlways; - void UpdateStartChar(std::tstring& str); + void UpdateStartChar(std::tstring &str); typedef std::multimap::const_iterator mm_cit; - bool FindExact(ContactData* contactData, const std::tstring &incomingMessage, - const std::multimap& map, std::tstring& res); - bool FindAny(ValueChooser<> &ch, std::tstring& res); - void FindByKeywords(ContactData* contactData, const std::vector &keywords, std::tstring& res/*, std::tstring& ures*/, bool isQuestion); - bool FindByOthers(ContactData* contactData, const std::vector &otherwords, std::tstring& res, bool isQuestion); - std::tstring AllReplies(const std::tstring &incomingMessage, ContactData* contactData, Level &maxValue, std::multimap &mm); + bool FindExact(ContactData *contactData, const std::tstring &incomingMessage, const std::multimap &map, std::tstring &res); + bool FindAny(ValueChooser<> &ch, std::tstring &res); + void FindByKeywords(ContactData *contactData, const std::vector &keywords, std::tstring &res/*, std::tstring& ures*/, bool isQuestion); + bool FindByOthers(ContactData *contactData, const std::vector &otherwords, std::tstring &res, bool isQuestion); + std::tstring AllReplies(const std::tstring &incomingMessage, ContactData *contactData, Level &maxValue, std::multimap &mm); std::tstring ReplaceAliases(const std::tstring &message); - std::tstring ChooseResult(ContactData* contactData, Level maxValue, const std::multimap &mm); - void RecordAnswer(ContactData *contactData, const TalkBot::MessageInfo& info); + std::tstring ChooseResult(ContactData *contactData, Level maxValue, const std::multimap &mm); + void RecordAnswer(ContactData *contactData, const TalkBot::MessageInfo &info); #ifdef _DEBUG public: #endif - void SplitSectences(const std::tstring &incomingMessage, std::vector& vec); - void SplitAndSortWords(std::tstring sentence, std::vector& keywords, + void SplitSectences(const std::tstring &incomingMessage, std::vector &vec); + void SplitAndSortWords(std::tstring sentence, std::vector &keywords, std::vector& otherwords, bool& isQuestion); public: TalkBot(const Mind& goodMind); @@ -104,9 +103,9 @@ public: void SetLowercase(const bool isLowercase); void SetUnderstandAlways(const bool understandAlways); //const MindData *GetData(); - std::tstring GetInitMessage(void* contact); - MessageInfo* Reply(void* contact, const std::tstring incomingMessage, bool saveChoice); - void AnswerGiven(void* contact, const MessageInfo& info); + std::tstring GetInitMessage(HCONTACT contact); + MessageInfo* Reply(HCONTACT contact, const std::tstring incomingMessage, bool saveChoice); + void AnswerGiven(HCONTACT contact, const MessageInfo &info); }; #endif diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp index 3f0fead59b..fab338a8dc 100644 --- a/plugins/Boltun/src/actionQueue.cpp +++ b/plugins/Boltun/src/actionQueue.cpp @@ -44,7 +44,7 @@ typedef struct _QueueElement { } QueueElement; static list actionQueue; -static set typingContacts; +static set typingContacts; UINT_PTR timerID = 0; CriticalSection cs; diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index f52a7e44a4..9036ac1e00 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -86,22 +86,22 @@ void Popup_DoAction(HWND hWnd, BYTE Action, PLUGIN_DATA *pdata) HCONTACT hContact = (HCONTACT)CallService(MS_POPUP_GETCONTACT, (WPARAM)hWnd, 0); switch (Action) { case PCA_OPENMESSAGEWND: // open message window - if (hContact && hContact != INVALID_HANDLE_VALUE) + if (hContact && hContact != (HCONTACT)INVALID_HANDLE_VALUE) CallServiceSync(ServiceExists("SRMsg/LaunchMessageWindow") ? "SRMsg/LaunchMessageWindow" : MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); break; case PCA_OPENMENU: // open contact menu - if (hContact && hContact != INVALID_HANDLE_VALUE) + if (hContact && hContact != (HCONTACT)INVALID_HANDLE_VALUE) QueueUserAPC(ShowContactMenu, g_hMainThread, (ULONG_PTR)hContact); break; case PCA_OPENDETAILS: // open contact details window - if (hContact != INVALID_HANDLE_VALUE) + if (hContact != (HCONTACT)INVALID_HANDLE_VALUE) CallServiceSync(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); break; case PCA_OPENHISTORY: // open contact history - if (hContact != INVALID_HANDLE_VALUE) + if (hContact != (HCONTACT)INVALID_HANDLE_VALUE) CallServiceSync(MS_HISTORY_SHOWCONTACTHISTORY, (WPARAM)hContact, 0); break; diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index 64409abab3..838686b5d7 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -216,7 +216,7 @@ HICON cliGetIconFromStatusMode(HCONTACT hContact, const char *szProto,int stat HICON GetMainStatusOverlay(int STATUS); //clc.c int __fastcall CLVM_GetContactHiddenStatus(HCONTACT hContact, char *szStatus, ClcData *dat); //clcitems.c int BgStatusBarChange(WPARAM wParam,LPARAM lParam); //clcopts.c -int ClcDoProtoAck(HANDLE wParam,ACKDATA * ack); //clc.c +int ClcDoProtoAck(HCONTACT wParam, ACKDATA *ack); //clc.c int ModernSkinButtonDeleteAll(); //modernbutton.c int GetContactCachedStatus(HCONTACT hContact); //clistsettings.c int GetContactIconC(ClcCacheEntry *cacheEntry); //clistmod.c diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp index b9b66caab0..d38758b403 100644 --- a/plugins/Clist_modern/src/modern_awaymsg.cpp +++ b/plugins/Clist_modern/src/modern_awaymsg.cpp @@ -48,10 +48,10 @@ static DWORD amRequestTick = 0; static int amAddHandleToChain(HCONTACT hContact) { mir_cslockfull lck(amCS); - if (amItems.find(hContact) != NULL) + if (amItems.find((HANDLE)hContact) != NULL) return 0; - amItems.insert(hContact); + amItems.insert((HANDLE)hContact); lck.unlock(); SetEvent(hamProcessEvent); return 1; diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 8aaad5eddf..9fb0abf495 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -160,10 +160,11 @@ static int clcHookSmileyAddOptionsChanged(WPARAM wParam,LPARAM lParam) return 0; } -static int clcHookProtoAck(WPARAM wParam,LPARAM lParam) +static int clcHookProtoAck(WPARAM wParam, LPARAM lParam) { - return ClcDoProtoAck((HANDLE) wParam,(ACKDATA*) lParam); + return ClcDoProtoAck((HCONTACT)wParam, (ACKDATA*)lParam); } + static int clcHookIconsChanged(WPARAM wParam, LPARAM lParam) { int i; @@ -1256,7 +1257,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if ( ServiceExists(MS_MC_ADDTOMETA)) { ClcContact *contDest, *contSour; int res; - HANDLE handle,hcontact; + HCONTACT handle, hcontact; cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL); cliGetRowByIndex(dat,dat->selection,&contDest,NULL); @@ -1264,23 +1265,23 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (contSour->type == CLCIT_CONTACT) { if (g_szMetaModuleName && mir_strcmp(contSour->proto,g_szMetaModuleName)) { if (!contSour->isSubcontact) { - HANDLE hDest = contDest->hContact; + HCONTACT hDest = contDest->hContact; mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be converted to MetaContact and '%s' be added to it?"),contDest->szText, contSour->szText); res = MessageBox(hwnd,Wording,TranslateT("Converting to MetaContact"),MB_OKCANCEL|MB_ICONQUESTION); if (res == 1) { - handle = (HANDLE)CallService(MS_MC_CONVERTTOMETA,(WPARAM)hDest,0); + handle = (HCONTACT)CallService(MS_MC_CONVERTTOMETA,(WPARAM)hDest,0); if (!handle) return 0; CallService(MS_MC_ADDTOMETA,(WPARAM)hcontact,(LPARAM)handle); } } else { - HANDLE hcontact = contSour->hContact; - HANDLE hfrom = contSour->subcontacts->hContact; - HANDLE hdest = contDest->hContact; + hcontact = contSour->hContact; + HCONTACT hfrom = contSour->subcontacts->hContact; + HCONTACT hdest = contDest->hContact; mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be converted to MetaContact and '%s' be added to it (remove it from '%s')?"), contDest->szText,contSour->szText,contSour->subcontacts->szText); res = MessageBox(hwnd,Wording,TranslateT("Converting to MetaContact (Moving)"),MB_OKCANCEL|MB_ICONQUESTION); if (res == 1) { - HANDLE handle = (HANDLE)CallService(MS_MC_CONVERTTOMETA,(WPARAM)hdest,0); + HCONTACT handle = (HCONTACT)CallService(MS_MC_CONVERTTOMETA,(WPARAM)hdest,0); if (!handle) return 0; @@ -1302,9 +1303,8 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (contSour->type == CLCIT_CONTACT) { if (g_szMetaModuleName && strcmp(contSour->proto,g_szMetaModuleName)) { if (!contSour->isSubcontact) { - HANDLE handle,hcontact; - hcontact = contSour->hContact; - handle = contDest->hContact; + HCONTACT hcontact = contSour->hContact; + HCONTACT handle = contDest->hContact; mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"),contSour->szText, contDest->szText); res = MessageBox(hwnd,Wording,TranslateT("Adding contact to MetaContact"),MB_OKCANCEL|MB_ICONQUESTION); if (res == 1) { @@ -1314,17 +1314,16 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, } else { if (contSour->subcontacts == contDest) { - HANDLE hsour; - hsour = contSour->hContact; + HCONTACT hsour = contSour->hContact; mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be default?"),contSour->szText); res = MessageBox(hwnd,Wording,TranslateT("Set default contact"),MB_OKCANCEL|MB_ICONQUESTION); if (res == 1) CallService(MS_MC_SETDEFAULTCONTACT,(WPARAM)contDest->hContact,(LPARAM)hsour); } else { - HANDLE hcontact = contSour->hContact; - HANDLE hfrom = contSour->subcontacts->hContact; - HANDLE handle = contDest->hContact; + HCONTACT hcontact = contSour->hContact; + HCONTACT hfrom = contSour->subcontacts->hContact; + HCONTACT handle = contDest->hContact; mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be removed from MetaContact '%s' and added to '%s'?"), contSour->szText,contSour->subcontacts->szText,contDest->szText); res = MessageBox(hwnd,Wording,TranslateT("Changing MetaContacts (Moving)"),MB_OKCANCEL|MB_ICONQUESTION); if (res == 1) { @@ -1348,8 +1347,8 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (contSour->type == CLCIT_CONTACT) { if (g_szMetaModuleName && strcmp(contSour->proto,g_szMetaModuleName)) { if (!contSour->isSubcontact) { - HANDLE hcontact = contSour->hContact; - HANDLE handle = contDest->subcontacts->hContact; + HCONTACT hcontact = contSour->hContact; + HCONTACT handle = contDest->subcontacts->hContact; mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be added to MetaContact '%s'?"), contSour->szText,contDest->subcontacts->szText); int res = MessageBox(hwnd,Wording,TranslateT("Changing MetaContacts (Moving)"),MB_OKCANCEL|MB_ICONQUESTION); if (res == 1) { @@ -1358,10 +1357,9 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, } } else if (contSour->subcontacts != contDest->subcontacts) { - HANDLE handle,hcontact,hfrom; - hcontact = contSour->hContact; - hfrom = contSour->subcontacts->hContact; - handle = contDest->subcontacts->hContact; + HCONTACT hcontact = contSour->hContact; + HCONTACT hfrom = contSour->subcontacts->hContact; + HCONTACT handle = contDest->subcontacts->hContact; mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be removed from MetaContact '%s' and added to '%s'?"), contSour->szText,contSour->subcontacts->szText,contDest->subcontacts->szText); int res = MessageBox(hwnd,Wording,TranslateT("Changing MetaContacts (Moving)"),MB_OKCANCEL|MB_ICONQUESTION); if (res == 1) { @@ -1472,7 +1470,7 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM w BYTE flags = 0; ClcContact *contact; - if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) memset(iExtraImage, 0xFF, sizeof(iExtraImage)); else { memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); @@ -1482,7 +1480,7 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM w if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b((HCONTACT)wParam, "CList", "Hidden", 0)) { NMCLISTCONTROL nm; pcli->pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, 1, 1); - if (pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { + if (pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); if (flags & CONTACTF_CHECKED) contact->flags |= CONTACTF_CHECKED; @@ -1491,7 +1489,7 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM w nm.hdr.hwndFrom = hwnd; nm.hdr.idFrom = GetDlgCtrlID(hwnd); nm.flags = 0; - nm.hItem = (HANDLE) wParam; + nm.hItem = (HANDLE)wParam; SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm); dat->needsResort = 1; } @@ -1530,14 +1528,14 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown - if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL)) { + if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) { if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) hSelItem = (HCONTACT)pcli->pfnContactToHItem(selcontact); pcli->pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, (style & CLS_CONTACTLIST) == 0, 0); recalcScrollBar = 1; needRepaint = TRUE; - pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL); + pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL); if (contact) { contact->iImage = lParam; contact->image_is_special = image_is_special; @@ -1579,7 +1577,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP if (hSelItem) { ClcGroup *selgroup; - if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) + if (pcli->pfnFindItem(hwnd, dat, (HANDLE)hSelItem, &selcontact, &selgroup, NULL)) dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf(( SortedList* )&selgroup->cl, selcontact)); else dat->selection = -1; @@ -1766,7 +1764,7 @@ int ClcUnloadModule() return 0; } -int ClcDoProtoAck(HANDLE wParam,ACKDATA * ack) +int ClcDoProtoAck(HCONTACT wParam, ACKDATA * ack) { if (MirandaExiting()) return 0; if (ack->type == ACKTYPE_STATUS) { diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index 2bd079760f..26260fd015 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -140,7 +140,7 @@ int FindItem(HWND hwnd, ClcData *dat, HCONTACT hItem, ClcContact **contact, ClcG if (nowVisible) index++; if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR)hItem&~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == hItem) || - (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (HANDLE)((UINT_PTR)hItem&~HCONTACT_ISINFO))) + (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (HCONTACT)((UINT_PTR)hItem&~HCONTACT_ISINFO))) { if (isVisible) { if (!nowVisible) *isVisible = 0; @@ -277,12 +277,12 @@ int cliGetRowByIndex(ClcData *dat,int testindex,ClcContact **contact,ClcGroup ** HANDLE ContactToHItem(ClcContact *contact) { switch(contact->type) { -case CLCIT_CONTACT: - return contact->hContact; -case CLCIT_GROUP: - return (HANDLE)(contact->groupId|HCONTACT_ISGROUP); -case CLCIT_INFO: - return (HANDLE)((DWORD_PTR)contact->hContact|HCONTACT_ISINFO); + case CLCIT_CONTACT: + return (HANDLE)contact->hContact; + case CLCIT_GROUP: + return (HANDLE)(contact->groupId|HCONTACT_ISGROUP); + case CLCIT_INFO: + return (HANDLE)((DWORD_PTR)contact->hContact|HCONTACT_ISINFO); } return NULL; } @@ -290,14 +290,14 @@ case CLCIT_INFO: HANDLE ContactToItemHandle(ClcContact *contact,DWORD *nmFlags) { switch(contact->type) { -case CLCIT_CONTACT: - return contact->hContact; -case CLCIT_GROUP: - if (nmFlags) *nmFlags |= CLNF_ISGROUP; - return (HANDLE)contact->groupId; -case CLCIT_INFO: - if (nmFlags) *nmFlags |= CLNF_ISINFO; - return (HANDLE)((DWORD_PTR)contact->hContact|HCONTACT_ISINFO); + case CLCIT_CONTACT: + return (HANDLE)contact->hContact; + case CLCIT_GROUP: + if (nmFlags) *nmFlags |= CLNF_ISGROUP; + return (HANDLE)contact->groupId; + case CLCIT_INFO: + if (nmFlags) *nmFlags |= CLNF_ISINFO; + return (HANDLE)((DWORD_PTR)contact->hContact|HCONTACT_ISINFO); } return NULL; } \ No newline at end of file diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index b01e397d01..dcb0d89b10 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -314,18 +314,14 @@ int RestoreSelection(ClcData *dat, HCONTACT hSelected) ClcContact *selcontact = NULL; ClcGroup *selgroup = NULL; - if (!hSelected || !pcli->pfnFindItem( dat->hWnd, dat, hSelected, &selcontact, &selgroup, NULL)) - { + if (!hSelected || !pcli->pfnFindItem(dat->hWnd, dat, (HANDLE)hSelected, &selcontact, &selgroup, NULL)) { dat->selection = -1; return dat->selection; } if (!selcontact->isSubcontact ) - { dat->selection = pcli->pfnGetRowsPriorTo( &dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact )); - } - else - { + else { dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact->subcontacts )); if (dat->selection != -1 ) @@ -583,7 +579,7 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) if (savedInfo[i].parentId == -1) group = &dat->list; else { - if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)(savedInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, HANDLE(savedInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL)) continue; group = contact->group; } @@ -640,7 +636,7 @@ ClcCacheEntry* cliCreateCacheItem(HCONTACT hContact ) void cliInvalidateDisplayNameCacheEntry(HCONTACT hContact) { - if (hContact == INVALID_HANDLE_VALUE) + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) corecli.pfnInvalidateDisplayNameCacheEntry((HCONTACT)INVALID_HANDLE_VALUE); else { ClcCacheEntry *p = pcli->pfnGetCacheEntry(hContact); diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index 047b671172..652564c0ba 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -108,7 +108,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara { int i; if (wParam != CLGN_ROOT) { - if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)lParam, &contact, &group, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)lParam, &contact, &group, NULL)) return NULL; i = List_IndexOf((SortedList*)&group->cl,contact); if (i < 0) return 0; @@ -183,7 +183,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara ClcGroup *tgroup; int index = -1; int mainindex = -1; - if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) break; for (tgroup = group; tgroup; tgroup = tgroup->parent) pcli->pfnSetGroupExpand(hwnd, dat, tgroup, 1); @@ -217,7 +217,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara if (LOWORD(lParam) >= dat->extraColumnsCount) return 0; - if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam); diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index c8b4523352..d7da7a01a5 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -86,7 +86,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HCONTACT hContact) if (hContact && szProto) { char *szActProto = (char*)szProto; int nActStatus = nStatus; - HANDLE hActContact = hContact; + HCONTACT hActContact = hContact; if (!db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) && g_szMetaModuleName && !mir_strcmp(szActProto,g_szMetaModuleName)) { // substitute params by mostonline contact datas HCONTACT hMostOnlineContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hActContact, 0); diff --git a/plugins/Clist_mw/src/clc.cpp b/plugins/Clist_mw/src/clc.cpp index b138a66c92..4f406eee21 100644 --- a/plugins/Clist_mw/src/clc.cpp +++ b/plugins/Clist_mw/src/clc.cpp @@ -162,14 +162,14 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L ClcContact *contact; ClcGroup *group; - if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL)) { + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) { if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1) hSelItem = (HCONTACT)pcli->pfnContactToHItem(selcontact); AddContactToTree(hwnd, dat, (HCONTACT)wParam, 0, 0); needsResort = 1; recalcScrollBar = 1; - FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL); + FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL); if (contact) { contact->iImage = (WORD)lParam; pcli->pfnNotifyNewContact(hwnd, (HCONTACT)wParam); @@ -201,7 +201,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } } if (hSelItem) { ClcGroup *selgroup; - if ( FindItem(hwnd,dat,hSelItem,&selcontact,&selgroup,NULL)) + if ( FindItem(hwnd, dat, (HANDLE)hSelItem,&selcontact,&selgroup,NULL)) dat->selection = GetRowsPriorTo(&dat->list,selgroup,List_IndexOf((SortedList*)&selgroup->cl, selcontact)); else dat->selection = -1; @@ -220,7 +220,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L ClcContact *contact; ClcGroup *group; - if (FindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL) && contact != NULL) { + if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL) && contact != NULL) { contact->flags &= ~CONTACTF_STATUSMSG; if (!db_get_ts((HCONTACT)wParam, "CList", "StatusMsg", &dbv)) { int j; diff --git a/plugins/Clist_mw/src/clcidents.cpp b/plugins/Clist_mw/src/clcidents.cpp index 803b7b9f6b..20c361e321 100644 --- a/plugins/Clist_mw/src/clcidents.cpp +++ b/plugins/Clist_mw/src/clcidents.cpp @@ -111,7 +111,7 @@ void ClearClcContactCache(struct ClcData *dat,HCONTACT hContact) { ClcCacheEntry *cacheEntry; - if (hContact == INVALID_HANDLE_VALUE) { + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) { int i,tick; tick = GetTickCount(); @@ -193,9 +193,10 @@ int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **c continue; } if (nowVisible) index++; - if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR)hItem&~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || - (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == hItem) || - (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (HANDLE)((UINT_PTR)hItem&~HCONTACT_ISINFO))) { + if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR)hItem & ~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || + (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && (HANDLE)group->cl.items[group->scanIndex]->hContact == hItem) || + (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && (HANDLE)group->cl.items[group->scanIndex]->hContact == (HANDLE)((UINT_PTR)hItem & ~HCONTACT_ISINFO))) + { if (isVisible) { if ( !nowVisible) *isVisible = 0; else { @@ -215,7 +216,7 @@ int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **c if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->SubAllocated>0) for (i = 1; i<=group->cl.items[group->scanIndex]->SubAllocated; i++) - if (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->subcontacts[i-1].hContact == hItem) { + if (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->subcontacts[i-1].hContact == (HCONTACT)hItem) { if (contact) *contact = &group->cl.items[group->scanIndex]->subcontacts[i-1]; if (subgroup) *subgroup = group; return 1; diff --git a/plugins/Clist_mw/src/clcitems.cpp b/plugins/Clist_mw/src/clcitems.cpp index 57b4a43fad..ff0e148a15 100644 --- a/plugins/Clist_mw/src/clcitems.cpp +++ b/plugins/Clist_mw/src/clcitems.cpp @@ -184,7 +184,7 @@ static struct ClcContact* AddContactToGroup(struct ClcData *dat,ClcGroup *group, void AddContactToTree(HWND hwnd, ClcData *dat, HCONTACT hContact, int updateTotalCount, int checkHideOffline) { - if ( FindItem(hwnd,dat,hContact,NULL,NULL,NULL) == 1) + if ( FindItem(hwnd,dat,(HANDLE)hContact,NULL,NULL,NULL) == 1) return; ClcCacheEntry *cacheEntry = GetContactFullCacheEntry(hContact); @@ -283,7 +283,7 @@ void DeleteItemFromTree(HWND hwnd, HCONTACT hItem) ClearRowByIndexCache(); dat->needsResort = 1; - if ( !FindItem(hwnd,dat,hItem,&contact,&group,NULL)) { + if ( !FindItem(hwnd,dat,(HANDLE)hItem,&contact,&group,NULL)) { DBVARIANT dbv; int i,nameOffset; if ( !IsHContactContact(hItem)) return; @@ -653,7 +653,8 @@ void SaveStateAndRebuildList(HWND hwnd,struct ClcData *dat) for (i = 0;ilist; else { - if (!FindItem(hwnd, dat, (HCONTACT)(savedInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL)) continue; + if (!FindItem(hwnd, dat, (HANDLE)(savedInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL)) + continue; group = contact->group; } j = AddInfoItemToGroup(group,savedInfo[i].contact.flags,_T("")); diff --git a/plugins/Clist_mw/src/clistmod.cpp b/plugins/Clist_mw/src/clistmod.cpp index aff0c241fe..be79bfcfcf 100644 --- a/plugins/Clist_mw/src/clistmod.cpp +++ b/plugins/Clist_mw/src/clistmod.cpp @@ -52,7 +52,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HCONTACT hContact) if ( !db_get_b(NULL,"CLC","Meta",0) && !strcmp(szActProto,"MetaContacts")) { // substitute params by mostonline contact datas HCONTACT hMostOnlineContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hActContact, 0); - if (hMostOnlineContact && hMostOnlineContact != (HANDLE)CALLSERVICE_NOTFOUND) { + if (hMostOnlineContact && hMostOnlineContact != (HCONTACT)CALLSERVICE_NOTFOUND) { ClcCacheEntry *cacheEntry = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hMostOnlineContact); if (cacheEntry && cacheEntry->szProto) { szActProto = cacheEntry->szProto; diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 00d7be37d2..973cb5a267 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -282,7 +282,7 @@ LBL_Def: { WORD iExtraImage[EXTRA_ICON_COUNT]; BYTE flags = 0; - if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) memset(iExtraImage, 0xFF, sizeof(iExtraImage)); else { memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); @@ -291,7 +291,7 @@ LBL_Def: pcli->pfnDeleteItemFromTree(hwnd, (HCONTACT)wParam); if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus((HCONTACT)wParam, NULL, dat)) { pcli->pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, 1, 1); - if (FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { + if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); if (flags & CONTACTF_CHECKED) contact->flags |= CONTACTF_CHECKED; @@ -329,13 +329,13 @@ LBL_Def: !CLVM_GetContactHiddenStatus(hContact, szProto, dat)) && ((cfg::dat.bFilterEffective ? TRUE : !pcli->pfnIsHiddenMode(dat, status)) || pcli->pfnGetContactIcon(hContact) != lParam); // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown - if (!FindItem(hwnd, dat, hContact, &contact, &group, NULL)) { + if (!FindItem(hwnd, dat, (HANDLE)hContact, &contact, &group, NULL)) { if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) hSelItem = (HCONTACT)pcli->pfnContactToHItem(selcontact); pcli->pfnAddContactToTree(hwnd, dat, hContact, 0, 0); recalcScrollBar = 1; - FindItem(hwnd, dat, hContact, &contact, NULL, NULL); + FindItem(hwnd, dat, (HANDLE)hContact, &contact, NULL, NULL); if (contact) { contact->iImage = (WORD)lParam; pcli->pfnNotifyNewContact(hwnd, hContact); @@ -364,7 +364,7 @@ LBL_Def: } if (hSelItem) { ClcGroup *selgroup; - if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) + if (pcli->pfnFindItem(hwnd, dat, (HANDLE)hSelItem, &selcontact, &selgroup, NULL)) dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)& selgroup->cl, selcontact)); else dat->selection = -1; @@ -378,7 +378,7 @@ LBL_Def: goto LBL_Def; case INTM_METACHANGED: - if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; if (contact->bIsMeta && cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { @@ -388,7 +388,7 @@ LBL_Def: if (contact->pExtra) { TExtraCache *pSub = cfg::getCache(contact->hSubContact, contact->metaProto); ClcContact *subContact; - if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)contact->hSubContact, &subContact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)contact->hSubContact, &subContact, NULL, NULL)) break; contact->pExtra->proto_status_item = GetProtocolStatusItem(contact->metaProto); @@ -402,7 +402,7 @@ LBL_Def: goto LBL_Def; case INTM_METACHANGEDEVENT: - if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; if (lParam == 0) SendMessage(hwnd, CLM_AUTOREBUILD, 0, 0); @@ -410,7 +410,7 @@ LBL_Def: case INTM_NAMECHANGED: ClcContact *contact; - if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HCONTACT)wParam, 0), SIZEOF(contact->szText)); @@ -421,7 +421,7 @@ LBL_Def: goto LBL_Def; case INTM_CODEPAGECHANGED: - if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; contact->codePage = cfg::getDword((HCONTACT)wParam, "Tab_SRMsg", "ANSIcodepage", cfg::getDword((HCONTACT)wParam, "UserInfo", "ANSIcodepage", CP_ACP)); PostMessage(hwnd, INTM_INVALIDATE, 0, 0); @@ -440,7 +440,7 @@ LBL_Def: goto LBL_Def; } - if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; contact->ace = cEntry; if (cEntry == NULL) @@ -466,7 +466,7 @@ LBL_Def: TExtraCache *p; char *szProto = NULL; - if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) p = cfg::getCache((HCONTACT)wParam, NULL); else { p = contact->pExtra; @@ -478,7 +478,7 @@ LBL_Def: goto LBL_Def; case INTM_STATUSCHANGED: - if (FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { + if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { WORD wStatus = cfg::getWord((HCONTACT)wParam, contact->proto, "Status", ID_STATUS_OFFLINE); if (cfg::dat.bNoOfflineAvatars && wStatus != ID_STATUS_OFFLINE && contact->wStatus == ID_STATUS_OFFLINE) { contact->wStatus = wStatus; @@ -491,7 +491,7 @@ LBL_Def: break; case INTM_PROTOCHANGED: - if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; contact->proto = GetContactProto((HCONTACT)wParam); @@ -513,7 +513,7 @@ LBL_Def: goto LBL_Def; case INTM_INVALIDATECONTACT: - if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL)) + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) break; if (contact == 0 || group == 0) @@ -538,7 +538,7 @@ LBL_Def: goto LBL_Def; case INTM_IDLECHANGED: - if (FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { + if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; char *szProto = (char*)cws->szModule; if (szProto == NULL) @@ -560,7 +560,7 @@ LBL_Def: HCONTACT hContact = (HCONTACT)wParam; TExtraCache *p; - if (!FindItem(hwnd, dat, hContact, &contact, NULL, NULL)) { + if (!FindItem(hwnd, dat, (HANDLE)hContact, &contact, NULL, NULL)) { p = cfg::getCache(hContact, szProto); if (!dat->bisEmbedded && cfg::dat.bMetaAvail && szProto) { // may be a subcontact, forward the xstatus if (cfg::getByte(hContact, cfg::dat.szMetaName, "IsSubcontact", 0)) { diff --git a/plugins/Clist_nicer/src/clcidents.cpp b/plugins/Clist_nicer/src/clcidents.cpp index 3b6f294188..18dae02c34 100644 --- a/plugins/Clist_nicer/src/clcidents.cpp +++ b/plugins/Clist_nicer/src/clcidents.cpp @@ -65,7 +65,10 @@ int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact, } if (nowVisible) index++; - if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR) hItem & ~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == hItem) || (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (HANDLE)((UINT_PTR) hItem & ~HCONTACT_ISINFO))) { + if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR) hItem & ~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || + (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == (HCONTACT)hItem) || + (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (HCONTACT)((UINT_PTR) hItem & ~HCONTACT_ISINFO))) + { if (isVisible) { if ( !nowVisible) *isVisible = 0; diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp index def28802ac..5eace41b51 100644 --- a/plugins/Clist_nicer/src/clcmsgs.cpp +++ b/plugins/Clist_nicer/src/clcmsgs.cpp @@ -35,7 +35,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM { ClcContact *contact; ClcGroup *group; - if (wParam == 0 || !FindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL)) + if (wParam == 0 || !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) return 0; if (lParam) @@ -48,7 +48,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_GETSTATUSMSG: if (wParam) { ClcContact *contact = NULL; - if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) @@ -67,7 +67,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_TOGGLEPRIORITYCONTACT: if (wParam) { ClcContact *contact = NULL; - if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) return 0; @@ -80,7 +80,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_QUERYPRIORITYCONTACT: if (wParam) { ClcContact *contact = NULL; - if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) return 0; diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index a5d2ca8255..1fec1b1175 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -109,7 +109,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA SendDlgItemMessage(hWnd, IDC_SECONDLINEMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("When needed by status message")); if (cfg::clcdat) { - FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL); + FindItem(pcli->hwndContactTree, cfg::clcdat, (HANDLE)hContact, &contact, NULL, NULL); if (contact && contact->type != CLCIT_CONTACT) { DestroyWindow(hWnd); return FALSE; @@ -189,9 +189,8 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA case IDC_IGN_ADDPERMANENTLY: { ADDCONTACTSTRUCT acs = {0}; - acs.handle = hContact; + acs.hContact = hContact; acs.handleType = HANDLE_CONTACT; - acs.szProto = 0; CallService(MS_ADDCONTACT_SHOW, (WPARAM)hWnd, (LPARAM)&acs); Utils::enableDlgControl(hWnd, IDC_IGN_ADDPERMANENTLY, cfg::getByte(hContact, "CList", "NotOnList", 0)); break; @@ -221,7 +220,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA LRESULT checked = 0; int i = 0; - FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL); + FindItem(pcli->hwndContactTree, cfg::clcdat, (HANDLE)hContact, &contact, NULL, NULL); if (iSel != CB_ERR) { dwFlags &= ~(ECF_FORCEAVATAR | ECF_HIDEAVATAR); @@ -308,8 +307,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA case WM_USER + 120: // set visibility status { ClcContact *contact = NULL; - - if (FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL)) { + if (FindItem(pcli->hwndContactTree, cfg::clcdat, (HANDLE)hContact, &contact, NULL, NULL)) { if (contact) { WORD wApparentMode = cfg::getWord(contact->hContact, contact->proto, "ApparentMode", 0); @@ -323,7 +321,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA { ClcContact *contact = NULL; - if (FindItem(pcli->hwndContactTree, cfg::clcdat, hContact, &contact, NULL, NULL)) { + if (FindItem(pcli->hwndContactTree, cfg::clcdat, (HANDLE)hContact, &contact, NULL, NULL)) { if (contact) { WORD wApparentMode = 0, oldApparentMode = cfg::getWord(hContact, contact->proto, "ApparentMode", 0); diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index c99ef5dc06..5c2b9388a3 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -1829,7 +1829,7 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r if (ContactMatchSearch(hContact, contact, id, protocol, &argv[3], argc - 3)) { DWORD threadID; - HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, hContact, NULL, &threadID); + HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, (void*)hContact, NULL, &threadID); } free(contact); @@ -1844,7 +1844,7 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r HANDLE hUnreadEvent = db_event_firstUnread(hContact); if (hUnreadEvent != NULL) { DWORD threadID; - HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, hContact, NULL, &threadID); + HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, (void*)hContact, NULL, &threadID); } } } diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index 9b64ae65d5..523c6ad055 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -87,13 +87,11 @@ TCHAR* GetContactUID(HCONTACT hContact) return NULL; } -void DialogAddContactExecute(HWND hwndDlg, HANDLE hNewContact) +void DialogAddContactExecute(HWND hwndDlg, HCONTACT hNewContact) { ADDCONTACTSTRUCT acs = { 0 }; - - acs.handle = hNewContact; + acs.hContact = hNewContact; acs.handleType = HANDLE_CONTACT; - CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); } diff --git a/plugins/ContactsPlus/src/utils.h b/plugins/ContactsPlus/src/utils.h index 4d633d0aa5..d62bee86ae 100644 --- a/plugins/ContactsPlus/src/utils.h +++ b/plugins/ContactsPlus/src/utils.h @@ -40,7 +40,7 @@ void UpdateDialogAddButton(HWND hwndDlg, HCONTACT hContact); HICON InitMButton(HWND hDlg, int idButton, LPCSTR szIcon, char* szTip); -void DialogAddContactExecute(HWND hwndDlg, HANDLE hNewContact); +void DialogAddContactExecute(HWND hwndDlg, HCONTACT hNewContact); HICON LoadContactProtoIcon(HCONTACT hContact); diff --git a/plugins/CyrTranslit/src/MirandaContact.cpp b/plugins/CyrTranslit/src/MirandaContact.cpp index ff6da97add..a42cc054de 100644 --- a/plugins/CyrTranslit/src/MirandaContact.cpp +++ b/plugins/CyrTranslit/src/MirandaContact.cpp @@ -80,7 +80,7 @@ void MirandaContact::addMenuItem() INT_PTR MirandaContact::onMenuCommandTransliterate(WPARAM wParam, LPARAM lParam) { - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); if (!CallService(MS_DB_CONTACT_IS, wParam, 0)) return 0; @@ -93,7 +93,7 @@ INT_PTR MirandaContact::onMenuCommandTransliterate(WPARAM wParam, LPARAM lParam) int MirandaContact::onPreBuildContactMenu(WPARAM wParam, LPARAM lParam) { if (!hTransliterateCmdMenuItem) return 0; - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); if (!CallService(MS_DB_CONTACT_IS, wParam, 0)) return 0; CLISTMENUITEM mi = { sizeof(mi) }; diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index aaae21dcd1..b1c5cf436d 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -211,7 +211,7 @@ void exportDB(HCONTACT hContact, char* module) // hContact == -1 export entire d SetCursor(LoadCursor(NULL,IDC_WAIT)); // exporting entire db - if (hContact == INVALID_HANDLE_VALUE) + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) { hContact = NULL; @@ -403,7 +403,7 @@ void importSettings(HCONTACT hContact, char *importstring ) } } - if (hContact == INVALID_HANDLE_VALUE) + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) { HCONTACT temp = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if (temp) diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index 2f3c1d13f4..f2ed81003f 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -403,7 +403,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) case 2: // restore saved if (GetValue(NULL,modname,"LastModule",SelectedModule,SIZEOF(SelectedModule))) { hSelectedContact = (HCONTACT)db_get_dw(NULL, modname, "LastContact", (DWORD)INVALID_HANDLE_VALUE); - if (hSelectedContact != INVALID_HANDLE_VALUE) + if (hSelectedContact != (HCONTACT)INVALID_HANDLE_VALUE) Select = 1; GetValue(NULL,modname,"LastSetting",SelectedSetting,SIZEOF(SelectedSetting)); } @@ -411,7 +411,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) case 3: // restore from user menu case 4: // jump from user menu - if (hSelectedContact && hSelectedContact != INVALID_HANDLE_VALUE) + if (hSelectedContact && hSelectedContact != (HCONTACT)INVALID_HANDLE_VALUE) Select = 1; break; } diff --git a/plugins/ExternalAPI/m_LogService.h b/plugins/ExternalAPI/m_LogService.h index 92c6898bc7..a8cf3f348c 100644 --- a/plugins/ExternalAPI/m_LogService.h +++ b/plugins/ExternalAPI/m_LogService.h @@ -89,7 +89,7 @@ __inline static INT_PTR logservice_register(char *szID, TCHAR *tszTitle, TCHAR * typedef struct { int cbSize; // sizeof(LS_MSGINFO) char *szID; - HANDLE hContact; // may be NULL if no contact is associated with the message + HCONTACT hContact; // may be NULL if no contact is associated with the message union { char *szMsg; // the message @@ -106,7 +106,7 @@ typedef struct { // returns 0 on success #define MS_LOGSERVICE_LOG "LogService/Log" -__inline static INT_PTR logservice_log(char *szID, HANDLE hContact, TCHAR *tszMsg) +__inline static INT_PTR logservice_log(char *szID, HCONTACT hContact, TCHAR *tszMsg) { LS_MSGINFO mi; ZeroMemory(&mi, sizeof(LS_MSGINFO)); @@ -131,7 +131,7 @@ __inline static INT_PTR logservice_log(char *szID, HANDLE hContact, TCHAR *tszMs typedef struct { int cbSize; // [in]; sizeof(LS_LOGINFO) char *szID; // [in] - HANDLE hContact; // [in]; may be NULL + HCONTACT hContact; // [in]; may be NULL union { char *szLogPath; // [in]; pointer to a string to receive log file name, including full path. May be NULL. The string must be at least MAX_PATH characters long diff --git a/plugins/ExternalAPI/m_voice.h b/plugins/ExternalAPI/m_voice.h index a81d866754..68d48510d3 100644 --- a/plugins/ExternalAPI/m_voice.h +++ b/plugins/ExternalAPI/m_voice.h @@ -48,7 +48,7 @@ typedef struct { char *id; // Protocol especific ID for this call int flags; // Can be VOICE_CALL_CONTACT or VOICE_CALL_STRING (VOICE_UNICODE to say the string is unicode) union { // Who to call - HANDLE hContact; + HCONTACT hContact; TCHAR *ptszContact; char *pszContact; WCHAR *pwszContact; diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index b83dc2aeba..4982a7fcb9 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -75,7 +75,7 @@ TCHAR g_filter[1024] = {0}; Options g_Options = {0}; static HANDLE hDialogsList = NULL; -static HANDLE hContactToActivate = NULL; +static HCONTACT hContactToActivate = NULL; BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { @@ -892,7 +892,7 @@ INT_PTR svcShowMenuCentered(WPARAM wParam, LPARAM lParam) INT_PTR svcOpenContact(WPARAM wParam, LPARAM lParam) { - hContactToActivate = (HANDLE)wParam; + hContactToActivate = (HCONTACT)wParam; CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)hContactToActivate, 0); return 0; } @@ -977,7 +977,7 @@ static void sttResetListOptions(HWND hwndList) static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { static bool bInitialized = false; - static HANDLE hSelectedContact = 0; + static HCONTACT hSelectedContact = 0; switch (msg) { case WM_INITDIALOG: diff --git a/plugins/FlashAvatars/src/cflash.cpp b/plugins/FlashAvatars/src/cflash.cpp index b6fca56704..c06a6c40d7 100644 --- a/plugins/FlashAvatars/src/cflash.cpp +++ b/plugins/FlashAvatars/src/cflash.cpp @@ -477,13 +477,13 @@ static int statusChanged(WPARAM wParam, LPARAM lParam) Lock l(cs); for(int i = 0; i < FlashList.getCount(); i++) { flash_avatar_item *item = FlashList[i]; - if (item->hContact == (HANDLE)wParam) { + if (item->hContact == (HCONTACT)wParam) { IShockwaveFlash* flash = item->pFlash; if (flash) { getFace(); flash->SetVariable(L"face.emotion", _bstr_t(face).copy()); } - } else if (item->hContact > (HANDLE)wParam) + } else if (item->hContact > (HCONTACT)wParam) break; // the list is sorted by hContact } return 0; diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 17e2cb089e..4194fad79a 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -44,7 +44,7 @@ HINSTANCE hInst; HFONT hFont[FLT_FONTIDS]; COLORREF tColor[FLT_FONTIDS]; HIMAGELIST himlMiranda; -HANDLE hNewContact; +HCONTACT hNewContact; HPEN hLTEdgesPen; HPEN hRBEdgesPen; diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index 4e0d991496..37b51e95b9 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -723,7 +723,7 @@ void ThumbInfo::OnTimer(BYTE idTimer) fTipActive = TRUE; ti.isGroup = 0; - ti.hItem = hContact; + ti.hItem = (HANDLE)hContact; ti.isTreeFocused = 0; CallService("mToolTip/ShowTip", 0, (LPARAM)&ti); } diff --git a/plugins/IEView/src/IEView.h b/plugins/IEView/src/IEView.h index c552525c84..2e869b96e7 100644 --- a/plugins/IEView/src/IEView.h +++ b/plugins/IEView/src/IEView.h @@ -424,24 +424,24 @@ private: static IEView *list; static CRITICAL_SECTION mutex; static bool isInited; - HWND parent; - HWND hwnd; - IEView *prev, *next; - int m_cRef; - RECT rcClient; - BOOL m_bInPlaceActive; - DWORD m_dwCookie; - IConnectionPoint* m_pConnectionPoint; - IEViewSink *sink; - IWebBrowser2* pWebBrowser; + HWND parent; + HWND hwnd; + IEView *prev, *next; + int m_cRef; + RECT rcClient; + BOOL m_bInPlaceActive; + DWORD m_dwCookie; + IConnectionPoint *m_pConnectionPoint; + IEViewSink *sink; + IWebBrowser2 *pWebBrowser; HTMLBuilder *builder; - WNDPROC mainWndProc, docWndProc, serverWndProc; - bool getFocus; - bool clearRequired; - BSTR selectedText; - bool isContactSet; - HANDLE hContact; + WNDPROC mainWndProc, docWndProc, serverWndProc; + bool getFocus; + bool clearRequired; + BSTR selectedText; + bool isContactSet; + HCONTACT hContact; // IUnknown STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppv); diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp index c5660133ba..4d3cca3b77 100644 --- a/plugins/Import/src/utils.cpp +++ b/plugins/Import/src/utils.cpp @@ -78,7 +78,7 @@ int CreateGroup(const TCHAR* group, HCONTACT hContact) BOOL IsDuplicateEvent(HCONTACT hContact, DBEVENTINFO dbei) { static DWORD dwPreviousTimeStamp = -1; - static HANDLE hPreviousContact = INVALID_HANDLE_VALUE; + static HCONTACT hPreviousContact = (HCONTACT)INVALID_HANDLE_VALUE; static HANDLE hPreviousDbEvent = NULL; HANDLE hExistingDbEvent; @@ -220,6 +220,6 @@ BOOL IsDuplicateEvent(HCONTACT hContact, DBEVENTINFO dbei) } } // reset last event - hPreviousContact = INVALID_HANDLE_VALUE; + hPreviousContact = (HCONTACT)INVALID_HANDLE_VALUE; return FALSE; } diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 98dda0467d..0ec2edad37 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -128,7 +128,7 @@ BOOL isMetaContactsSubContact(HCONTACT hMetaContact, HCONTACT hContact) char *szProto = GetContactProto(hMetaContact); if (szProto && !strcmp(szMetaProto, szProto)) { // Safety check int i = db_get_dw(hContact, szMetaProto, "ContactNumber", -1); - if (i >= 0 && hContact == (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hMetaContact, i)) + if (i >= 0 && hContact == (HCONTACT)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hMetaContact, i)) return TRUE; } return FALSE; diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index d2f6888f4f..639e3fa0ac 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -752,7 +752,7 @@ INT_PTR onChangeProto(WPARAM wparam, LPARAM lparam) return 0; } -int isIgnored(HANDLE hContact, int type) +int isIgnored(HCONTACT hContact, int type) { if (type != IGNOREEVENT_ALL) return CallService(MS_IGNORE_ISIGNORED, (WPARAM)hContact, (LPARAM)type); @@ -768,9 +768,9 @@ int isIgnored(HANDLE hContact, int type) INT_PTR onIgnore(WPARAM wparam, LPARAM lparam) { if (db_get_b(NULL, MODULENAME, "ignorehide", 0) && (lparam == IGNOREEVENT_ALL)) - db_set_b((HCONTACT)wparam, "CList", "Hidden", (isIgnored((HANDLE)wparam, lparam) ? (byte)0 : (byte)1)); + db_set_b((HCONTACT)wparam, "CList", "Hidden", (isIgnored((HCONTACT)wparam, lparam) ? (byte)0 : (byte)1)); - CallService(isIgnored((HANDLE)wparam, lparam) ? MS_IGNORE_UNIGNORE : MS_IGNORE_IGNORE, wparam, lparam); + CallService(isIgnored((HCONTACT)wparam, lparam) ? MS_IGNORE_UNIGNORE : MS_IGNORE_IGNORE, wparam, lparam); return 0; } diff --git a/plugins/MetaContacts/src/meta_api.cpp b/plugins/MetaContacts/src/meta_api.cpp index 77a09a6a4a..71cdfeb1ec 100644 --- a/plugins/MetaContacts/src/meta_api.cpp +++ b/plugins/MetaContacts/src/meta_api.cpp @@ -104,7 +104,7 @@ INT_PTR MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam) { INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam) { HCONTACT hMeta = (HCONTACT)db_get_dw((HCONTACT)lParam, META_PROTO, "Handle", 0); DWORD contact_number = Meta_GetContactNumber((HCONTACT)lParam); - if (contact_number == -1 || !hMeta || hMeta != (HANDLE)wParam) + if (contact_number == -1 || !hMeta || hMeta != (HCONTACT)wParam) return 1; if (db_set_dw(hMeta, META_PROTO, "Default", contact_number)) return 1; @@ -120,7 +120,7 @@ INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam) { INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam) { HCONTACT hContact = Meta_GetContactHandle((HCONTACT)wParam, (int)lParam); HCONTACT hMeta = (HCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0); - if (!hContact || !hMeta || hMeta != (HANDLE)wParam || db_get_b(hMeta, META_PROTO, "ForceDefault", 0)) + if (!hContact || !hMeta || hMeta != (HCONTACT)wParam || db_get_b(hMeta, META_PROTO, "ForceDefault", 0)) return 1; db_set_dw(hMeta, META_PROTO, "ForceSend", (DWORD)hContact); @@ -136,7 +136,7 @@ INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam) { INT_PTR MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam) { HCONTACT hContact = (HCONTACT)lParam; HCONTACT hMeta = (HCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0); - if ( !hContact || !hMeta || hMeta != (HANDLE)wParam || db_get_b(hMeta, META_PROTO, "ForceDefault", 0)) + if (!hContact || !hMeta || hMeta != (HCONTACT)wParam || db_get_b(hMeta, META_PROTO, "ForceDefault", 0)) return 1; db_set_dw(hMeta, META_PROTO, "ForceSend", (DWORD)hContact); diff --git a/plugins/MetaContacts/src/meta_menu.cpp b/plugins/MetaContacts/src/meta_menu.cpp index 53ed386ff6..7c8ae2d560 100644 --- a/plugins/MetaContacts/src/meta_menu.cpp +++ b/plugins/MetaContacts/src/meta_menu.cpp @@ -117,7 +117,7 @@ void Meta_RemoveContactNumber(HCONTACT hMeta, int number) HCONTACT hContact = Meta_GetContactHandle(hMeta, number); // make sure this contact thinks it's part of this metacontact - if ((HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0) == hMeta) { + if ((HCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0) == hMeta) { // remove link to meta contact db_unset(hContact, META_PROTO, "IsSubcontact"); db_unset(hContact, META_PROTO, META_LINK); diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp index f829412474..3851c575e0 100755 --- a/plugins/MetaContacts/src/meta_services.cpp +++ b/plugins/MetaContacts/src/meta_services.cpp @@ -388,7 +388,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) CLISTEVENT cle = { sizeof(cle) }; cle.hContact = hMeta; cle.flags = CLEF_TCHAR; - cle.hDbEvent = ccs->hContact; // use subcontact handle as key - then we can remove all events if the subcontact window is opened + cle.hDbEvent = (HANDLE)ccs->hContact; // use subcontact handle as key - then we can remove all events if the subcontact window is opened cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); cle.pszService = "MetaContacts/CListMessageEvent"; mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hMeta, GCDNF_TCHAR)); @@ -1124,7 +1124,7 @@ INT_PTR Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam) } else if (options.menu_function == FT_MENU) { // show contact's context menu - CallFunctionAsync(sttMenuThread, hContact); + CallFunctionAsync(sttMenuThread, (void*)hContact); } else if (options.menu_function == FT_INFO) { // show user info for subcontact CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); diff --git a/plugins/MirOTR/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/MirOTR/src/dbfilter.cpp index 443c009574..b8e6319291 100644 --- a/plugins/MirOTR/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/MirOTR/src/dbfilter.cpp @@ -281,7 +281,7 @@ int StatusModeChange(WPARAM wParam, LPARAM lParam) { hContact = (HCONTACT)context->app_data; if(hContact) { - otrl_message_disconnect(otr_user_state, &ops, hContact, context->accountname, context->protocol, context->username); + otrl_message_disconnect(otr_user_state, &ops, (void*)hContact, context->accountname, context->protocol, context->username); SetEncryptionStatus(hContact, TRUST_NOT_PRIVATE); } diff --git a/plugins/MirOTR/MirOTR/src/options.cpp b/plugins/MirOTR/MirOTR/src/options.cpp index 7ecb6051c7..a3645f52c7 100644 --- a/plugins/MirOTR/MirOTR/src/options.cpp +++ b/plugins/MirOTR/MirOTR/src/options.cpp @@ -159,7 +159,7 @@ void SaveOptions() { extern "C" void set_context_contact(void *data, ConnContext *context) { HCONTACT hContact = find_contact(context->username, context->protocol); - context->app_data = hContact; + context->app_data = (void*)hContact; } void ReadPrivkeyFiles() { diff --git a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp index 762ee5adf2..d764a9664b 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp @@ -16,7 +16,7 @@ int StartOTR(HCONTACT hContact) { lib_cs_lock(); char *msg = otrl_proto_default_query_msg(MODULENAME, pol); - otr_gui_inject_message(hContact, proto, proto, uname, msg ? msg : "?OTRv2?"); + otr_gui_inject_message((void*)hContact, proto, proto, uname, msg ? msg : "?OTRv2?"); lib_cs_unlock(); otrl_message_free(msg); mir_free(uname); @@ -81,7 +81,7 @@ int otr_disconnect_contact(HCONTACT hContact) if (!uname) return 1; // error lib_cs_lock(); - otrl_message_disconnect(otr_user_state, &ops, hContact, proto, proto, uname); + otrl_message_disconnect(otr_user_state, &ops, (void*)hContact, proto, proto, uname); lib_cs_unlock(); mir_free(uname); return 0; diff --git a/plugins/MirOTR/MirOTR/src/utils.cpp b/plugins/MirOTR/MirOTR/src/utils.cpp index 3142c0852e..424f4d8886 100644 --- a/plugins/MirOTR/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/MirOTR/src/utils.cpp @@ -49,7 +49,8 @@ ConnContext * otrl_context_find_miranda(OtrlUserState us, HCONTACT hContact) ConnContext ** curp; if (!hContact) return NULL; for (curp = &(us->context_root); *curp; curp = &((*curp)->next)) { - if ((*curp)->app_data == hContact ) return *curp; + if ((*curp)->app_data == (void*)hContact) + return *curp; } return NULL; } diff --git a/plugins/MirandaG15/src/CChatScreen.cpp b/plugins/MirandaG15/src/CChatScreen.cpp index 9fb9acb88b..6ecc2acf97 100644 --- a/plugins/MirandaG15/src/CChatScreen.cpp +++ b/plugins/MirandaG15/src/CChatScreen.cpp @@ -216,7 +216,7 @@ bool CChatScreen::IsInputActive() //************************************************************************ // returns the chat contact //************************************************************************ -HANDLE CChatScreen::GetContact() +HCONTACT CChatScreen::GetContact() { return m_hContact; } diff --git a/plugins/MirandaG15/src/CChatScreen.h b/plugins/MirandaG15/src/CChatScreen.h index 6a29dea079..5fd9607ecc 100644 --- a/plugins/MirandaG15/src/CChatScreen.h +++ b/plugins/MirandaG15/src/CChatScreen.h @@ -46,7 +46,7 @@ public: // Set's the chat contact bool SetContact(HCONTACT hContact); // returns the chat contact - HANDLE GetContact(); + HCONTACT GetContact(); // returns wether the input mode is active bool IsInputActive(); diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 30b37937d8..a56473331b 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -54,24 +54,24 @@ BOOL bUnaplyedChanges = FALSE; class CLDBEvent { - DWORD time; - public: - HANDLE hUser; - HANDLE hDbEvent; + DWORD time; +public: + HCONTACT hUser; + HANDLE hDbEvent; - CLDBEvent( HANDLE hU, HANDLE hDBE ) - { - hUser = hU; - hDbEvent = hDBE; + CLDBEvent(HCONTACT hU, HANDLE hDBE ) + { + hUser = hU; + hDbEvent = hDBE; - DBEVENTINFO dbei = { sizeof(dbei) }; - db_event_get(hDbEvent, &dbei); - time = dbei.timestamp; - } - bool operator <(const CLDBEvent& rOther) const - { - return time < rOther.time; - } + DBEVENTINFO dbei = { sizeof(dbei) }; + db_event_get(hDbEvent, &dbei); + time = dbei.timestamp; + } + bool operator <(const CLDBEvent& rOther) const + { + return time < rOther.time; + } }; ///////////////////////////////////////////////////////////////////// @@ -227,7 +227,7 @@ int nExportCompleatList(HWND hParent, bool bOnlySelected ) HANDLE hDbEvent = db_event_first(hContact); while( hDbEvent) { - rclCurList.push_back( CLDBEvent( hContact, hDbEvent)); + rclCurList.push_back(CLDBEvent(hContact, hDbEvent)); hDbEvent = db_event_next(hDbEvent); } diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 5616832ce7..42a831073a 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -694,7 +694,7 @@ void BlinkIcon(HCONTACT hContact, char* szProto, WORD status) cle.cbSize = sizeof(cle); cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR; cle.hContact = hContact; - cle.hDbEvent = hContact; + cle.hDbEvent = (HANDLE)hContact; cle.hIcon = (opt.BlinkIcon_Status ? LoadSkinnedProtoIcon(szProto, status) : LoadSkinnedIcon(SKINICON_OTHER_USERONLINE)); cle.pszService = "UserOnline/Description"; cle.ptszTooltip = stzTooltip; diff --git a/plugins/NewXstatusNotify/src/popup.cpp b/plugins/NewXstatusNotify/src/popup.cpp index 2a35c7f8ed..7aba8a569e 100644 --- a/plugins/NewXstatusNotify/src/popup.cpp +++ b/plugins/NewXstatusNotify/src/popup.cpp @@ -77,7 +77,7 @@ void QueryAwayMessage(HWND hWnd, PLUGINDATA *pdp) void PopupAction(HWND hWnd, BYTE action) { HCONTACT hContact = PUGetContact(hWnd); - if (hContact && hContact != INVALID_HANDLE_VALUE) { + if (hContact && hContact != (HCONTACT)INVALID_HANDLE_VALUE) { switch (action) { case PCA_OPENMESSAGEWND: CallServiceSync(MS_MSG_SENDMESSAGET, (WPARAM)hContact, 0); diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index e1d6313bb1..ed150f927a 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -449,7 +449,7 @@ int OnWindowEvent(WPARAM wParam, LPARAM lParam) (templates.LogFlags & NOTIFY_OPENING_ML) && (db_get_b(mwed->hContact, MODULE, "EnableLogging", 1) == 1)) { - mir_forkthread(AddEventThread, mwed->hContact); + mir_forkthread(AddEventThread, (void*)mwed->hContact); } return 0; diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index 514f7ae2c8..5638a297c4 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -883,7 +883,7 @@ int HookSendMsg(WPARAM w, LPARAM l) debuglog<flags & DBEF_UTF) ? PREF_UTF : 0, (LPARAM)"-----PGP KEY REQUEST-----"); hcontact_data[hContact].msgs_to_send.push_back((char*)dbei->pBlob); - boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, hContact)); + boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, (void*)hContact)); //TODO: wait for message return 0; } @@ -918,7 +918,7 @@ int HookSendMsg(WPARAM w, LPARAM l) debuglog<flags & DBEF_UTF) ? PREF_UTF : 0, (LPARAM)"-----PGP KEY REQUEST-----"); hcontact_data[hContact].msgs_to_send.push_back((char*)dbei->pBlob); - boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, hContact)); + boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, (void*)hContact)); //mir_free((char*)dbei->pBlob); //TODO: wait for message return 0; diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 10fba85cac..1f85553a95 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -19,7 +19,7 @@ along with this program. If not, see . #include "stdafx.h" PasteToWeb* pasteToWebs[PasteToWeb::pages]; -std::map* contactWindows; +std::map* contactWindows; DWORD gMirandaVersion; HANDLE hModulesLoaded, hTabsrmmButtonPressed; @@ -184,7 +184,7 @@ void PasteIt(HCONTACT hContact, int mode) // contactWindows map contains all opened hContact // with assaigned to them chat windows. // This map is prepared in ME_MSG_WINDOWEVENT event. - std::map::iterator it = contactWindows->find(hContact); + std::map::iterator it = contactWindows->find(hContact); if(it != contactWindows->end()) { // it->second is imput window, so now I can send to them @@ -384,7 +384,7 @@ int WindowEvent(WPARAM wParam, MessageWindowEventData* lParam) } else if(lParam->uType == MSG_WINDOW_EVT_CLOSE) { - std::map::iterator it = contactWindows->find(lParam->hContact); + std::map::iterator it = contactWindows->find(lParam->hContact); if(it != contactWindows->end()) { contactWindows->erase(it); @@ -429,7 +429,7 @@ extern "C" int __declspec(dllexport) Load(void) hOptionsInit = HookEvent(ME_OPT_INITIALISE, Options::InitOptions); hTabsrmmButtonPressed = NULL; hServiceContactMenu = CreateServiceFunction(MS_PASTEIT_CONTACTMENU, ContactMenuService); - contactWindows = new std::map(); + contactWindows = new std::map(); return 0; } diff --git a/plugins/Popup/src/avatars.cpp b/plugins/Popup/src/avatars.cpp index 79dd9d2b38..e40c13eb04 100644 --- a/plugins/Popup/src/avatars.cpp +++ b/plugins/Popup/src/avatars.cpp @@ -47,5 +47,5 @@ PopupAvatar *PopupAvatar::create(HCONTACT hContact) } } - return new SimpleAvatar(hContact); + return new SimpleAvatar((HANDLE)hContact); } diff --git a/plugins/Popup/src/avatars_gif.cpp b/plugins/Popup/src/avatars_gif.cpp index 5526f9cef3..2297a3b5a9 100644 --- a/plugins/Popup/src/avatars_gif.cpp +++ b/plugins/Popup/src/avatars_gif.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "headers.h" -GifAvatar::GifAvatar(HCONTACT hContact): PopupAvatar(hContact) +GifAvatar::GifAvatar(HCONTACT hContact): PopupAvatar((HANDLE)hContact) { av = (avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0); bIsAnimated = true; diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 5f0f2e65f3..0a04b15a54 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -1078,7 +1078,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara break; case UM_AVATARCHANGED: - if ((HANDLE)wParam == m_hContact) + if ((HCONTACT)wParam == m_hContact) { m_avatar->invalidate(); update(); @@ -1142,7 +1142,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara case ACT_DEF_ADD: { ADDCONTACTSTRUCT acs = {0}; - acs.handle = m_hContact; + acs.hContact = m_hContact; acs.handleType = HANDLE_CONTACT; acs.szProto = 0; CallServiceSync(MS_ADDCONTACT_SHOW, NULL, (LPARAM)&acs); diff --git a/plugins/Popup/src/popup_wnd2.h b/plugins/Popup/src/popup_wnd2.h index 4c851275d9..268bf9d372 100644 --- a/plugins/Popup/src/popup_wnd2.h +++ b/plugins/Popup/src/popup_wnd2.h @@ -162,8 +162,8 @@ public: char *getTime() { return m_time; } HICON getIcon() { return m_hIcon; } - HANDLE getContact() { return m_hContact; } - HANDLE getContactPassed() { return m_hContactPassed; } + HCONTACT getContact() { return m_hContact; } + HCONTACT getContactPassed() { return m_hContactPassed; } int getTimeout() { return m_iTimeout; } HWND getHwnd() { return m_hwnd; } void *getData() { return m_PluginData; } diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 6d35216f40..fd52f59a93 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -571,15 +571,12 @@ HCONTACT GetSelectedContact(HWND hwndDlg) } // get array position from handle -int GetItemPos(HANDLE hcontact) +int GetItemPos(HCONTACT hcontact) { - int loop; - - for(loop=0;loophcontact) + for(int loop=0; loop < contacts.getCount(); loop++) + if(hcontact == contacts[loop]->hcontact) return loop; - } + return -1; } @@ -819,12 +816,9 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA LoadContacts(hwndDlg, FALSE); EnableButtons(hwndDlg, NULL); - if (db_get_b(NULL, MODULE_NAME, "EnableLastSentTo", 0)) - { - int pos = GetItemPos((HANDLE) db_get_dw(NULL, MODULE_NAME, "LastSentTo", -1)); - - if (pos != -1) - { + if (db_get_b(NULL, MODULE_NAME, "EnableLastSentTo", 0)) { + int pos = GetItemPos((HCONTACT)db_get_dw(NULL, MODULE_NAME, "LastSentTo", -1)); + if (pos != -1) { SendDlgItemMessage(hwndDlg, IDC_USERNAME, CB_SETCURSEL, (WPARAM) pos, 0); EnableButtons(hwndDlg, contacts[pos]->hcontact); } diff --git a/plugins/Quotes/src/ExtraImages.cpp b/plugins/Quotes/src/ExtraImages.cpp index ad2ac5e54a..99350fab93 100644 --- a/plugins/Quotes/src/ExtraImages.cpp +++ b/plugins/Quotes/src/ExtraImages.cpp @@ -47,7 +47,7 @@ bool CExtraImages::SetContactExtraImage(HCONTACT hContact,EImageIndex nIndex)con int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp) { - HCONTACT hContact = reinterpret_cast(wp); + HCONTACT hContact = HCONTACT(wp); const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr(); CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact); diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 1536bf8e9f..03a8565806 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -191,7 +191,7 @@ namespace int QuotesEventFunc_OnContactDeleted(WPARAM wParam, LPARAM) { - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr(); CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact); diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index 282d5aa448..6bf10e2de3 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -128,7 +128,6 @@ namespace int EnumDbModules(const char* szModuleName, DWORD ofsModuleName, LPARAM lp) { -// USES_CONVERSION; CEnumContext* ctx = reinterpret_cast(lp); IXMLNode::TXMLNodePtr pXml = ctx->m_pNode; IXMLNode::TXMLNodePtr pModule = ctx->m_pXmlEngine->CreateNode(g_pszXmlModule,quotes_a2t(szModuleName)/*A2CT(szModuleName)*/); @@ -142,11 +141,10 @@ namespace dbces.szModule = szModuleName; dbces.lParam = reinterpret_cast(ctx); - CallService(MS_DB_CONTACT_ENUMSETTINGS,reinterpret_cast(ctx->m_hContact),reinterpret_cast(&dbces)); + CallService(MS_DB_CONTACT_ENUMSETTINGS, WPARAM(ctx->m_hContact),reinterpret_cast(&dbces)); if(pModule->GetChildCount() > 0) - { pXml->AddChild(pModule); - } + ctx->m_pNode = pXml; } @@ -273,7 +271,7 @@ INT_PTR Quotes_Export(WPARAM wp,LPARAM lp) CModuleInfo::TXMLEnginePtr pXmlEngine = CModuleInfo::GetInstance().GetXMLEnginePtr(); CModuleInfo::TQuotesProvidersPtr pProviders = CModuleInfo::GetInstance().GetQuoteProvidersPtr(); IXMLNode::TXMLNodePtr pRoot = pXmlEngine->CreateNode(g_pszXmlContacts,tstring()); - HCONTACT hContact = reinterpret_cast(wp); + HCONTACT hContact = HCONTACT(wp); if(hContact) { CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact); @@ -676,7 +674,7 @@ namespace { if(NULL == cst.m_hContact) { - cst.m_hContact = reinterpret_cast(CallService(MS_DB_CONTACT_ADD,0,0)); + cst.m_hContact = HCONTACT(CallService(MS_DB_CONTACT_ADD,0,0)); cst.m_bNewContact = true; } else if(impctx.m_nFlags"ES_IMPORT_SKIP_EXISTING_CONTACTS) diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp index fa7ae638c2..a5be52dd9d 100644 --- a/plugins/Quotes/src/QuoteInfoDlg.cpp +++ b/plugins/Quotes/src/QuoteInfoDlg.cpp @@ -24,7 +24,7 @@ namespace inline HCONTACT get_contact(HWND hWnd) { - return reinterpret_cast(GetWindowLongPtr(hWnd,GWLP_USERDATA)); + return HCONTACT(GetWindowLongPtr(hWnd,GWLP_USERDATA)); } @@ -118,7 +118,7 @@ namespace int QuotesEventFunc_OnUserInfoInit(WPARAM wp,LPARAM lp) { - HCONTACT hContact = reinterpret_cast(lp); + HCONTACT hContact = HCONTACT(lp); if(NULL == hContact) return 0; @@ -141,7 +141,7 @@ int QuotesEventFunc_OnUserInfoInit(WPARAM wp,LPARAM lp) INT_PTR QuotesMenu_EditSettings(WPARAM wp,LPARAM lp) { - HCONTACT hContact = reinterpret_cast(wp); + HCONTACT hContact = HCONTACT(wp); if(NULL == hContact) { return 0; @@ -163,7 +163,7 @@ namespace INT_PTR QuotesMenu_OpenLogFile(WPARAM wp,LPARAM lp) { - HCONTACT hContact = reinterpret_cast(wp); + HCONTACT hContact = HCONTACT(wp); if(NULL == hContact) { return 0; @@ -180,7 +180,7 @@ INT_PTR QuotesMenu_OpenLogFile(WPARAM wp,LPARAM lp) INT_PTR QuotesMenu_RefreshContact(WPARAM wp,LPARAM lp) { - HCONTACT hContact = reinterpret_cast(wp); + HCONTACT hContact = HCONTACT(wp); if(NULL == hContact) { return 0; @@ -202,17 +202,16 @@ namespace INT_PTR CALLBACK QuoteInfoDlgProc1(HWND hdlg,UINT msg,WPARAM wParam,LPARAM lParam) { HCONTACT hContact = NULL; - switch(msg) - { + switch(msg) { case WM_INITDIALOG: { - hContact = reinterpret_cast(lParam); + hContact = HCONTACT(lParam); HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO,false); assert(hWL); WindowList_Add(hWL,hdlg,hContact); - ::SetWindowLongPtr(hdlg,GWLP_USERDATA,reinterpret_cast(hContact)); - Utils_RestoreWindowPositionNoSize(hdlg,hContact,QUOTES_MODULE_NAME,WINDOW_PREFIX_INFO); + ::SetWindowLongPtr(hdlg, GWLP_USERDATA, (LPARAM)hContact); + Utils_RestoreWindowPositionNoSize(hdlg, hContact, QUOTES_MODULE_NAME, WINDOW_PREFIX_INFO); ::ShowWindow(hdlg,SW_SHOW); } break; @@ -251,28 +250,23 @@ namespace int Quotes_OnContactDoubleClick(WPARAM wp,LPARAM/* lp*/) { - HCONTACT hContact = reinterpret_cast(wp); + HCONTACT hContact = HCONTACT(wp); if(CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact)) { HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO,true); assert(hWL); HWND hWnd = WindowList_Find(hWL,hContact); - if(NULL != hWnd) - { + if(NULL != hWnd) { SetForegroundWindow(hWnd); SetFocus(hWnd); } else if(true == IsMyContact(hContact)) - { - CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_DIALOG_QUOTE_INFO_1),NULL,QuoteInfoDlgProc1,reinterpret_cast(hContact)); - } + CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG_QUOTE_INFO_1), NULL, QuoteInfoDlgProc1, LPARAM(hContact)); return 1; } - else - { - return 0; - } + + return 0; } namespace @@ -297,7 +291,7 @@ int Quotes_PrebuildContactMenu(WPARAM wp,LPARAM lp) #endif enable_menu(g_hMenuRefresh,false); - HCONTACT hContact = reinterpret_cast(wp); + HCONTACT hContact = HCONTACT(wp); if(NULL == hContact) { return 0; diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp index b017c7c162..462154c478 100644 --- a/plugins/Quotes/src/QuotesProviderBase.cpp +++ b/plugins/Quotes/src/QuotesProviderBase.cpp @@ -827,24 +827,19 @@ void CQuotesProviderBase::WriteContactRate(HCONTACT hContact,double dRate,const HCONTACT CQuotesProviderBase::CreateNewContact(const tstring& rsName) { - HCONTACT hContact = reinterpret_cast(CallService(MS_DB_CONTACT_ADD,0,0)); - if(hContact) - { - if(0 == CallService(MS_PROTO_ADDTOCONTACT,reinterpret_cast(hContact),(LPARAM)QUOTES_PROTOCOL_NAME)) - { + HCONTACT hContact = HCONTACT(CallService(MS_DB_CONTACT_ADD,0,0)); + if(hContact) { + if(0 == CallService(MS_PROTO_ADDTOCONTACT, WPARAM(hContact), (LPARAM)QUOTES_PROTOCOL_NAME)) { tstring sProvName = GetInfo().m_sName; db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_PROVIDER,sProvName.c_str()); db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_SYMBOL,rsName.c_str()); db_set_ts(hContact,LIST_MODULE_NAME,CONTACT_LIST_NAME,rsName.c_str()); - {// for CCritSection - CGuard cs(m_cs); - m_aContacts.push_back(hContact); - } + CGuard cs(m_cs); + m_aContacts.push_back(hContact); } - else - { - CallService(MS_DB_CONTACT_DELETE,reinterpret_cast(hContact),0); + else { + CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0); hContact = NULL; } } @@ -979,14 +974,11 @@ void CQuotesProviderBase::Run() { DWORD dwTimeRest = ::GetTickCount()-dwBegin; if(dwTimeRest < nTimeout) - { nTimeout -= dwTimeRest; - } - { - CGuard cs(m_cs); - anContacts = m_aRefreshingContacts; - m_aRefreshingContacts.clear(); - } + + CGuard cs(m_cs); + anContacts = m_aRefreshingContacts; + m_aRefreshingContacts.clear(); } break; case WAIT_TIMEOUT: diff --git a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp index 1d660b155d..8fd913fa25 100644 --- a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp +++ b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp @@ -42,7 +42,7 @@ bool CQuotesProviderDukasCopy::WatchForQuote(const CQuote& rQuote,bool bWatch) m_aContacts.erase(i); } - CallService(MS_DB_CONTACT_DELETE,reinterpret_cast(hContact),0); + CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0); return true; } else if((true == bWatch) && (i == m_aContacts.end())) diff --git a/plugins/Quotes/src/QuotesProviderFinance.cpp b/plugins/Quotes/src/QuotesProviderFinance.cpp index 83e6389d54..49d2c5bf23 100644 --- a/plugins/Quotes/src/QuotesProviderFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderFinance.cpp @@ -41,7 +41,7 @@ bool CQuotesProviderFinance::WatchForQuote(const CQuote& rQuote,bool bWatch) m_aContacts.erase(i); } - CallService(MS_DB_CONTACT_DELETE,reinterpret_cast(hContact),0); + CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0); return true; } else if ((true == bWatch) && (i == m_aContacts.end())) diff --git a/plugins/Quotes/src/QuotesProviderGoogle.cpp b/plugins/Quotes/src/QuotesProviderGoogle.cpp index 14f9ae1daa..fb64f3b730 100644 --- a/plugins/Quotes/src/QuotesProviderGoogle.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogle.cpp @@ -61,7 +61,7 @@ bool CQuotesProviderGoogle::WatchForRate(const CRateInfo& ri, m_aContacts.erase(i); } - CallService(MS_DB_CONTACT_DELETE,reinterpret_cast(hContact),0); + CallService(MS_DB_CONTACT_DELETE, WPARAM(hContact), 0); return true; } diff --git a/plugins/Quotes/src/SettingsDlg.cpp b/plugins/Quotes/src/SettingsDlg.cpp index 0045c21cad..e52be731bd 100644 --- a/plugins/Quotes/src/SettingsDlg.cpp +++ b/plugins/Quotes/src/SettingsDlg.cpp @@ -268,7 +268,7 @@ namespace { case WM_INITDIALOG: { - HCONTACT hContact = reinterpret_cast(lp); + HCONTACT hContact = HCONTACT(lp); TranslateDialogDefault(hWnd); HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_SETTINGS,false); @@ -519,7 +519,7 @@ void ShowSettingsDlg(HCONTACT hContact) } else { - CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_CONTACT_SETTINGS),NULL,EditSettingsPerContactDlgProc,reinterpret_cast(hContact)); + CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_CONTACT_SETTINGS),NULL,EditSettingsPerContactDlgProc, LPARAM(hContact)); } } diff --git a/plugins/Scriver/src/cmdlist.h b/plugins/Scriver/src/cmdlist.h index ec9675474c..1c2509ad31 100644 --- a/plugins/Scriver/src/cmdlist.h +++ b/plugins/Scriver/src/cmdlist.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct _TCmdList { struct _TCmdList *next; struct _TCmdList *prev; - HANDLE hContact; + HCONTACT hContact; char *szCmd; BOOL temporary; } TCmdList; diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 2f76dded88..8d7856eb8b 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1093,7 +1093,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; case DM_CLISTSETTINGSCHANGED: - if ((HANDLE)wParam == dat->windowData.hContact) { + if ((HCONTACT)wParam == dat->windowData.hContact) { if (dat->windowData.hContact && dat->szProto) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; char idbuf[128]; @@ -1353,7 +1353,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case DM_REMAKELOG: dat->lastEventType = -1; - if (wParam == 0 || (HANDLE)wParam == dat->windowData.hContact) + if (wParam == 0 || (HCONTACT)wParam == dat->windowData.hContact) StreamInEvents(hwndDlg, dat->hDbEventFirst, -1, 0); InvalidateRect(GetDlgItem(hwndDlg, IDC_LOG), NULL, FALSE); @@ -1390,7 +1390,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; case HM_DBEVENTADDED: - if ((HANDLE)wParam == dat->windowData.hContact) { + if ((HCONTACT)wParam == dat->windowData.hContact) { HANDLE hDbEvent = (HANDLE)lParam; DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get(hDbEvent, &dbei); @@ -1830,7 +1830,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_ADD: { ADDCONTACTSTRUCT acs = { 0 }; - acs.handle = dat->windowData.hContact; + acs.hContact = dat->windowData.hContact; acs.handleType = HANDLE_CONTACT; acs.szProto = 0; CallService(MS_ADDCONTACT_SHOW, (WPARAM) hwndDlg, (LPARAM)& acs); diff --git a/plugins/SecureIM/src/crypt_metacontacts.cpp b/plugins/SecureIM/src/crypt_metacontacts.cpp index 50bd21767e..113bf22abc 100644 --- a/plugins/SecureIM/src/crypt_metacontacts.cpp +++ b/plugins/SecureIM/src/crypt_metacontacts.cpp @@ -13,7 +13,7 @@ BOOL isProtoMetaContacts(HCONTACT hContact) BOOL isDefaultSubContact(HCONTACT hContact) { if (bMetaContacts) - return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0),0) == hContact; + return (HCONTACT)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0),0) == hContact; return false; } diff --git a/plugins/SecureIM/src/crypt_misc.cpp b/plugins/SecureIM/src/crypt_misc.cpp index 6e34f77aee..ec7d6d1088 100644 --- a/plugins/SecureIM/src/crypt_misc.cpp +++ b/plugins/SecureIM/src/crypt_misc.cpp @@ -86,7 +86,7 @@ void waitForExchange(pUinKey ptr, int flag) break; ptr->waitForExchange = 1; - mir_forkthread(sttWaitForExchange, ptr->hContact); + mir_forkthread(sttWaitForExchange, (void*)ptr->hContact); break; } } diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 9bcb42000b..34c839d0d6 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -502,7 +502,7 @@ void ShowPopup(HCONTACT hcontact, const char * lpzProto, int newStatus) PUAddPopupT(&ppd); } -void myPlaySound(HANDLE hcontact, WORD newStatus, WORD oldStatus) +void myPlaySound(HCONTACT hcontact, WORD newStatus, WORD oldStatus) { if (CallService(MS_IGNORE_ISIGNORED,(WPARAM)hcontact,IGNOREEVENT_USERONLINE)) return; //oldStatus and hcontact are not used yet @@ -562,11 +562,11 @@ int UpdateValues(WPARAM wparam,LPARAM lparam) } if ((cws->value.wVal|0x8000)<=ID_STATUS_OFFLINE) { - char * proto; // avoid repeating the offline status if ((prevStatus|0x8000)<=ID_STATUS_OFFLINE) return 0; - proto = GetContactProto(hContact); + + char *proto = GetContactProto(hContact); db_set_b(hContact, S_MOD, "Offline", 1); { DWORD t; @@ -606,14 +606,14 @@ int UpdateValues(WPARAM wparam,LPARAM lparam) //db_set_w(hContact,S_MOD,"StatusTriger",(WORD)cws->value.wVal); - if ( db_get_b(NULL, S_MOD, "FileOutput", 0)) FileWrite(hContact); + if (db_get_b(NULL, S_MOD, "FileOutput", 0)) FileWrite(hContact); if (prevStatus != cws->value.wVal) myPlaySound(hContact, cws->value.wVal, prevStatus); - if ( db_get_b(NULL, S_MOD, "UsePopups", 0)) + if (db_get_b(NULL, S_MOD, "UsePopups", 0)) if (prevStatus != cws->value.wVal) ShowPopup(hContact, GetContactProto(hContact), cws->value.wVal|0x8000); - if ( db_get_b(NULL, S_MOD, "KeepHistory", 0)) HistoryWrite(hContact); - if ( db_get_b(hContact, S_MOD, "OnlineAlert", 0)) ShowHistory(hContact, 1); + if (db_get_b(NULL, S_MOD, "KeepHistory", 0)) HistoryWrite(hContact); + if (db_get_b(hContact, S_MOD, "OnlineAlert", 0)) ShowHistory(hContact, 1); db_set_b(hContact, S_MOD, "Offline", 0); } } diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 475e00ad62..6e50caec00 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -790,7 +790,8 @@ static int GetContactHandle(WPARAM wparam,LPARAM lParam) if (g_bCrashRecovery) db_set_b(MWeventdata->hContact, MODNAME, "wasInLastSession", 1); } else if (MWeventdata->uType == MSG_WINDOW_EVT_CLOSE) { - if (!DONT) DelFromCurSession(MWeventdata->hContact,0); + if (!DONT) + DelFromCurSession(MWeventdata->hContact,0); if (g_bCrashRecovery) db_set_b(MWeventdata->hContact, MODNAME, "wasInLastSession", 0); } diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp index 64932b37e7..9a6853f29d 100644 --- a/plugins/Sessions/Src/Options.cpp +++ b/plugins/Sessions/Src/Options.cpp @@ -31,7 +31,7 @@ static BOOL bOptionsInit; int opses_count; BOOL bSesssionNameChanged=0; -HANDLE session_list_t[255]={0}; +HCONTACT session_list_t[255]={0}; HWND g_opHdlg; diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index dd5315185a..0ac06a0e1c 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -332,7 +332,7 @@ int AddToCurSession(HCONTACT wparam, LPARAM lparam) return 0; } -int DelFromCurSession(HANDLE wparam,LPARAM lparam) +int DelFromCurSession(HCONTACT wparam,LPARAM lparam) { for (int i=0; session_list[i] != 0; i++) { if (session_list[i] == wparam) { @@ -346,11 +346,11 @@ int DelFromCurSession(HANDLE wparam,LPARAM lparam) return 0; } -int CheckForDuplicate(HCONTACT contact_list[], HANDLE lparam) +int CheckForDuplicate(HCONTACT contact_list[], HCONTACT lparam) { int i=0; - HANDLE s_list[255] = {0}; - memcpy(s_list, contact_list,SIZEOF(s_list)); + HCONTACT s_list[255] = {0}; + memcpy(s_list, contact_list, SIZEOF(s_list)); for (i=0;;i++) { if (s_list[i] == lparam) return i; diff --git a/plugins/Sessions/Src/Utils.h b/plugins/Sessions/Src/Utils.h index 174ef38afc..19d81dad37 100644 --- a/plugins/Sessions/Src/Utils.h +++ b/plugins/Sessions/Src/Utils.h @@ -27,9 +27,9 @@ void AddSessionMark(HCONTACT hContact,int mode,char bit); void RemoveSessionMark(HCONTACT hContact,int mode,int marknum); void SetSessionMark(HCONTACT hContact,int mode,char bit,unsigned int marknum); BOOL LoadContactsFromMask(HCONTACT hContact,int mode,int count); -int AddToCurSession(HCONTACT wparam, LPARAM lparam); -int DelFromCurSession(HANDLE wparam,LPARAM lparam); -int CheckForDuplicate(HCONTACT contact_list[], HANDLE lparam); +int AddToCurSession(HCONTACT hContact, LPARAM lparam); +int DelFromCurSession(HCONTACT hContact,LPARAM lparam); +int CheckForDuplicate(HCONTACT contact_list[], HCONTACT lparam); BOOL ResaveSettings(char* szName,int iFirst,int iLimit,TCHAR* pszPrevSetting); void OffsetWindow(HWND parent, HWND hwnd, int dx, int dy); int LoadSessionToCombobox (HWND hdlg,BOOL mode,int iLimit,char* pszSetting,int iFirstNum); diff --git a/plugins/SmileyAdd/src/customsmiley.cpp b/plugins/SmileyAdd/src/customsmiley.cpp index e9efd4ddee..7249242fa7 100644 --- a/plugins/SmileyAdd/src/customsmiley.cpp +++ b/plugins/SmileyAdd/src/customsmiley.cpp @@ -51,7 +51,7 @@ bool SmileyPackCListType::AddSmiley(HCONTACT hContact, TCHAR* path) } -SmileyPackCType* SmileyPackCListType::GetSmileyPack(HANDLE id) +SmileyPackCType* SmileyPackCListType::GetSmileyPack(HCONTACT id) { for (int i = 0; i < m_SmileyPacks.getCount(); i++) if (m_SmileyPacks[i].GetId() == id) diff --git a/plugins/SmileyAdd/src/customsmiley.h b/plugins/SmileyAdd/src/customsmiley.h index fc8e0dff02..5ccfa5e04f 100644 --- a/plugins/SmileyAdd/src/customsmiley.h +++ b/plugins/SmileyAdd/src/customsmiley.h @@ -37,7 +37,7 @@ private: SmileyVectorType m_SmileyList; SmileyLookupType m_SmileyLookup; - HANDLE m_id; + HCONTACT m_id; void InsertLookup(SmileyCType& sml, CMString& lk, bool first); void AddTriggersToSmileyLookup(void); @@ -50,8 +50,8 @@ public: SmileyCType* GetSmiley(unsigned index) { return &m_SmileyList[index]; } - HANDLE GetId(void) { return m_id; } - void SetId(HANDLE id) { m_id = id; } + HCONTACT GetId(void) { return m_id; } + void SetId(HCONTACT id) { m_id = id; } bool LoadSmileyDir(TCHAR* dir); bool LoadSmiley(TCHAR* path); @@ -74,7 +74,7 @@ public: void ClearAndFreeAll(void) { m_SmileyPacks.destroy(); } - SmileyPackCType* GetSmileyPack(HANDLE id); + SmileyPackCType* GetSmileyPack(HCONTACT id); }; extern SmileyPackCListType g_SmileyPackCStore; diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index d46eb2da72..84723b91fa 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -267,7 +267,7 @@ int UpdateSrmmDlg(WPARAM wParam, LPARAM /* lParam */) { WaitForSingleObject(g_hMutex, 2000); for (int i=0; i < g_MsgWndList.getCount(); ++i) { - if (wParam == 0 || g_MsgWndList[i]->hContact == (HANDLE)wParam) { + if (wParam == 0 || g_MsgWndList[i]->hContact == (HCONTACT)wParam) { SendMessage(g_MsgWndList[i]->hwnd, WM_SETREDRAW, FALSE, 0); SendMessage(g_MsgWndList[i]->hwnd, DM_OPTIONSAPPLIED, 0, 0); SendMessage(g_MsgWndList[i]->hwnd, WM_SETREDRAW, TRUE, 0); diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index ac092f927d..e4a7793514 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -374,8 +374,9 @@ void HistoryLogFunc(HCONTACT hContact, std::string message) { if(gbHistoryLog) { - if(hContact == INVALID_HANDLE_VALUE) + if(hContact == (HCONTACT)INVALID_HANDLE_VALUE) return; + std::string msg = message; msg.append("\n"); msg.append("Protocol: ").append(GetContactProto(hContact)).append(" Contact: "); diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index 9192f6960f..1e1e8caa16 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -151,7 +151,7 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT // manager.c SESSION_INFO* SM_FindSessionByHWND(HWND h); -SESSION_INFO* SM_FindSessionByHCONTACT(HANDLE h); +SESSION_INFO* SM_FindSessionByHCONTACT(HCONTACT h); SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const TCHAR* pszOriginal, const TCHAR* pszCurrent); void SM_RemoveContainer(TContainerData *pContainer); diff --git a/plugins/TabSRMM/src/chat/manager.cpp b/plugins/TabSRMM/src/chat/manager.cpp index 1a4f357acd..9aff83efd0 100644 --- a/plugins/TabSRMM/src/chat/manager.cpp +++ b/plugins/TabSRMM/src/chat/manager.cpp @@ -93,7 +93,7 @@ SESSION_INFO* SM_FindSessionByHWND(HWND hWnd) return NULL; } -SESSION_INFO* SM_FindSessionByHCONTACT(HANDLE h) +SESSION_INFO* SM_FindSessionByHCONTACT(HCONTACT h) { for (SESSION_INFO *si = pci->wndList; si; si = si->next) if (si->hContact == h) diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 622b0b86ad..3c940648d4 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -3332,7 +3332,7 @@ LABEL_SHOWWINDOW: case DM_QUERYHCONTACT: if (lParam) - *(HANDLE*)lParam = dat->hContact; + *(HCONTACT*)lParam = dat->hContact; return 0; case GC_CLOSEWINDOW: diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 63001f7931..a255657c65 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -622,15 +622,10 @@ HICON CContactCache::getIcon(int& iSize) const int CContactCache::getMaxMessageLength() { - HANDLE hContact; - const char* szProto; - - hContact = getActiveContact(); - szProto = getActiveProto(); - + HCONTACT hContact = getActiveContact(); + LPCSTR szProto = getActiveProto(); if (szProto) { - - m_nMax = CallProtoService(szProto, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, reinterpret_cast(hContact)); + m_nMax = CallProtoService(szProto, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, (LPARAM)hContact); if (m_nMax) { if (M.GetByte("autosplit", 0)) { if (m_hwnd) @@ -640,7 +635,8 @@ int CContactCache::getMaxMessageLength() if (m_hwnd) ::SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_EXLIMITTEXT, 0, (LPARAM)m_nMax); } - } else { + } + else { if (m_hwnd) ::SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_EXLIMITTEXT, 0, 20000); m_nMax = 20000; diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index f7d48af5fe..61dd9940e6 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -1199,7 +1199,7 @@ panel_found: else { HWND hwnd = M.FindWindow((HCONTACT)wParam); if (hwnd == 0) { - SESSION_INFO *si = SM_FindSessionByHCONTACT((HANDLE)wParam); + SESSION_INFO *si = SM_FindSessionByHCONTACT((HCONTACT)wParam); if (si) { SendMessage(si->hWnd, GC_UPDATETITLE, 0, 0); return 0; diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h index f111e98d0c..cfb6b5204e 100644 --- a/plugins/TabSRMM/src/functions.h +++ b/plugins/TabSRMM/src/functions.h @@ -68,7 +68,7 @@ void TSAPI LoadFavoritesAndRecent(); void TSAPI AddContactToFavorites(HCONTACT hContact, const TCHAR *szNickname, const char *szProto, TCHAR *szStatus, WORD wStatus, HICON hIcon, BOOL mode, HMENU hMenu); void TSAPI CreateTrayMenus(int mode); -void TSAPI HandleMenuEntryFromhContact(int iSelection); +void TSAPI HandleMenuEntryFromhContact(HCONTACT iSelection); /* * gneric msgwindow functions(creation, container management etc.) diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 98e87b970a..a6cb622037 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1010,7 +1010,7 @@ void TSAPI DM_LoadLocale(TWindowData *dat) } } - mir_forkthread(LoadKLThread, dat->hContact); + mir_forkthread(LoadKLThread, (void*)dat->hContact); } LRESULT TSAPI DM_RecalcPictureSize(TWindowData *dat) @@ -1768,7 +1768,6 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) TCHAR newcontactname[128]; DWORD dwOldIdle = dat->idle; const char* szActProto = 0; - HANDLE hActContact = 0; HWND hwndDlg = dat->hwnd; HWND hwndTab = GetParent(hwndDlg); @@ -1790,7 +1789,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) if (dat->szProto) { szActProto = dat->cache->getActiveProto(); - hActContact = dat->hContact; + HCONTACT hActContact = dat->hContact; bool bHasName = (dat->cache->getUIN()[0] != 0); dat->idle = dat->cache->getIdleTS(); diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index d1918004c7..cd2cf9333a 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -93,13 +93,12 @@ static INT_PTR HotkeyProcessor(WPARAM wParam, LPARAM lParam) return 0; } -void TSAPI HandleMenuEntryFromhContact(int iSelection) +void TSAPI HandleMenuEntryFromhContact(HCONTACT hContact) { - HWND hWnd = M.FindWindow((HCONTACT)iSelection); - - if (iSelection == 0) + if (hContact == 0) return; + HWND hWnd = M.FindWindow(hContact); if (hWnd && IsWindow(hWnd)) { TContainerData *pContainer = 0; SendMessage(hWnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer); @@ -108,11 +107,11 @@ void TSAPI HandleMenuEntryFromhContact(int iSelection) pContainer->hwndSaved = 0; SetForegroundWindow(pContainer->hwnd); } - else CallService(MS_MSG_SENDMESSAGE, (WPARAM)iSelection, 0); + else CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); return; } - SESSION_INFO *si = SM_FindSessionByHCONTACT((HANDLE)iSelection); + SESSION_INFO *si = SM_FindSessionByHCONTACT(hContact); if (si != NULL) { // session does exist, but no window is open for it if (si->hWnd) { @@ -128,7 +127,7 @@ void TSAPI HandleMenuEntryFromhContact(int iSelection) } } - CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)iSelection, 0); + CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)hContact, 0); } void TSAPI DrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, DWORD dwIdle) @@ -153,7 +152,6 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP } TContainerData *p; - int iSelection; switch (msg) { case WM_CREATE: @@ -209,7 +207,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP DWORD idle = 0; if (hWnd == NULL) { - SESSION_INFO *si = SM_FindSessionByHCONTACT((HANDLE)dis->itemID); + SESSION_INFO *si = SM_FindSessionByHCONTACT((HCONTACT)dis->itemID); hWnd = si ? si->hWnd : 0; } @@ -244,8 +242,8 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (wParam == 100) SetForegroundWindow(hwndDlg); if (GetMenuItemCount(PluginConfig.g_hMenuTrayUnread) > 0) { - iSelection = TrackPopupMenu(PluginConfig.g_hMenuTrayUnread, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); - HandleMenuEntryFromhContact(iSelection); + BOOL iSelection = TrackPopupMenu(PluginConfig.g_hMenuTrayUnread, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + HandleMenuEntryFromhContact((HCONTACT)iSelection); } else TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 8), TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); @@ -269,8 +267,8 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP do { GetMenuItemInfoA(PluginConfig.g_hMenuTrayUnread, i, TRUE, &mii); if (mii.dwItemData > 0) { - uid = GetMenuItemID(PluginConfig.g_hMenuTrayUnread, i); - HandleMenuEntryFromhContact(uid); + UINT uid = GetMenuItemID(PluginConfig.g_hMenuTrayUnread, i); + HandleMenuEntryFromhContact((HCONTACT)uid); break; } } @@ -312,7 +310,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP CheckMenuItem(submenu, ID_TRAYCONTEXT_DON, MF_BYCOMMAND | (nen_options.iNoAutoPopup ? MF_CHECKED : MF_UNCHECKED)); EnableMenuItem(submenu, ID_TRAYCONTEXT_HIDEALLMESSAGECONTAINERS, MF_BYCOMMAND | (nen_options.bTraySupport) ? MF_ENABLED : MF_GRAYED); CheckMenuItem(submenu, ID_TRAYCONTEXT_SHOWTHETRAYICON, MF_BYCOMMAND | (nen_options.bTraySupport ? MF_CHECKED : MF_UNCHECKED)); - iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + BOOL iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); if (iSelection) { MENUITEMINFO mii = {0}; @@ -320,7 +318,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP mii.fMask = MIIM_DATA | MIIM_ID; GetMenuItemInfo(submenu, (UINT_PTR)iSelection, FALSE, &mii); if (mii.dwItemData != 0) // this must be an itm of the fav or recent menu - HandleMenuEntryFromhContact(iSelection); + HandleMenuEntryFromhContact((HCONTACT)iSelection); else { switch (iSelection) { case ID_TRAYCONTEXT_SHOWTHETRAYICON: @@ -374,7 +372,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP * if lParam == NULL, don't consider clist events, just open the message tab */ if (lParam == 0) - HandleMenuEntryFromhContact((int)wParam); + HandleMenuEntryFromhContact((HCONTACT)wParam); else { CLISTEVENT *cle = (CLISTEVENT *)CallService(MS_CLIST_GETEVENT, wParam, 0); if (cle) { @@ -384,7 +382,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP } } // still, we got that message posted.. the event may be waiting in tabSRMMs tray... - else HandleMenuEntryFromhContact((int)wParam); + else HandleMenuEntryFromhContact((HCONTACT)wParam); } break; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 7662b3703b..9cc6c056b2 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -2547,7 +2547,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case HM_DBEVENTADDED: if (!dat) return 0; - if ((HANDLE)wParam != dat->hContact) + if ((HCONTACT)wParam != dat->hContact) return 0; if (dat->hContact == NULL) return 0; @@ -2693,7 +2693,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case DM_QUERYHCONTACT: { - HANDLE *phContact = (HANDLE*) lParam; + HCONTACT *phContact = (HCONTACT*)lParam; if (phContact) *phContact = dat->hContact; } @@ -3084,7 +3084,7 @@ quote_from_last: case IDC_ADD: { ADDCONTACTSTRUCT acs = {0}; - acs.handle = dat->hContact; + acs.hContact = dat->hContact; acs.handleType = HANDLE_CONTACT; acs.szProto = 0; CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 9185fea23e..974da99469 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -150,7 +150,7 @@ static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) return 1; } else { - SESSION_INFO *si = SM_FindSessionByHCONTACT((HANDLE)wParam); + SESSION_INFO *si = SM_FindSessionByHCONTACT((HCONTACT)wParam); if (si == NULL || si->hWnd == 0 || (pContainer = si->pContainer) == NULL || pContainer->hwndActive != si->hWnd) return 1; } diff --git a/plugins/TabSRMM/src/nen.h b/plugins/TabSRMM/src/nen.h index 812369f357..f92f3308e9 100644 --- a/plugins/TabSRMM/src/nen.h +++ b/plugins/TabSRMM/src/nen.h @@ -143,7 +143,7 @@ struct EVENT_DATAT struct PLUGIN_DATAT { - HANDLE hContact; + HCONTACT hContact; UINT eventType; NEN_OPTIONS *pluginOptions; POPUPDATAT *pud; diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 81631416d7..a7e2748315 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -491,7 +491,7 @@ void CSendLater::addContact(const HCONTACT hContact) return; if (m_sendLaterContactList.getCount() == 0) { - m_sendLaterContactList.insert(hContact); + m_sendLaterContactList.insert((HANDLE)hContact); m_last_sendlater_processed = 0; // force processing at next tick return; } @@ -500,10 +500,10 @@ void CSendLater::addContact(const HCONTACT hContact) * this list should not have duplicate entries */ - if (m_sendLaterContactList.find(hContact)) + if (m_sendLaterContactList.find((HANDLE)hContact)) return; - m_sendLaterContactList.insert(hContact); + m_sendLaterContactList.insert((HANDLE)hContact); m_last_sendlater_processed = 0; // force processing at next tick } @@ -565,7 +565,7 @@ LRESULT CSendLater::qMgrAddFilter(const HCONTACT hContact, const TCHAR* tszNick) lr = ::SendMessage(m_hwndFilter, CB_FINDSTRING, 0, reinterpret_cast(tszNick)); if (lr == CB_ERR) { lr = ::SendMessage(m_hwndFilter, CB_INSERTSTRING, -1, reinterpret_cast(tszNick)); - ::SendMessage(m_hwndFilter, CB_SETITEMDATA, lr, reinterpret_cast(hContact)); + ::SendMessage(m_hwndFilter, CB_SETITEMDATA, lr, (LPARAM)hContact); if (hContact == m_hFilter) m_sel = lr; } @@ -773,7 +773,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM TranslateDialogDefault(hwnd); m_hwndList = ::GetDlgItem(m_hwndDlg, IDC_QMGR_LIST); m_hwndFilter = ::GetDlgItem(m_hwndDlg, IDC_QMGR_FILTER); - m_hFilter = reinterpret_cast(db_get_dw(0, SRMSGMOD_T, "qmgrFilterContact", 0)); + m_hFilter = (HCONTACT)(db_get_dw(0, SRMSGMOD_T, "qmgrFilterContact", 0)); ::SetWindowLongPtr(m_hwndList, GWL_STYLE, ::GetWindowLongPtr(m_hwndList, GWL_STYLE) | LVS_SHOWSELALWAYS); ::SendMessage(m_hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_LABELTIP|LVS_EX_DOUBLEBUFFER); @@ -832,7 +832,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (HIWORD(wParam) == CBN_SELCHANGE && reinterpret_cast(lParam) == m_hwndFilter) { LRESULT lr = ::SendMessage(m_hwndFilter, CB_GETCURSEL, 0, 0); if (lr != CB_ERR) { - m_hFilter = reinterpret_cast(::SendMessage(m_hwndFilter, CB_GETITEMDATA, lr, 0)); + m_hFilter = (HCONTACT)::SendMessage(m_hwndFilter, CB_GETITEMDATA, lr, 0); qMgrFillList(); } break; @@ -923,7 +923,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_NCDESTROY: m_hwndDlg = 0; - db_set_dw(0, SRMSGMOD_T, "qmgrFilterContact", reinterpret_cast(m_hFilter)); + db_set_dw(0, SRMSGMOD_T, "qmgrFilterContact", DWORD(m_hFilter)); break; } return FALSE; diff --git a/plugins/TabSRMM/src/sendlater.h b/plugins/TabSRMM/src/sendlater.h index 9c49b3fc00..102701c5db 100644 --- a/plugins/TabSRMM/src/sendlater.h +++ b/plugins/TabSRMM/src/sendlater.h @@ -132,17 +132,17 @@ private: LIST m_sendLaterContactList; LIST m_sendLaterJobList; - bool m_fAvail; - bool m_fIsInteractive; - bool m_fErrorPopups; - bool m_fSuccessPopups; - time_t m_last_sendlater_processed; - int m_currJob; - - HWND m_hwndDlg; - HWND m_hwndList, m_hwndFilter; - HANDLE m_hFilter; // contact handle to filter the qmgr list (0 = no filter, show all) - LRESULT m_sel; // index of the combo box entry corresponding to the contact filter; + bool m_fAvail; + bool m_fIsInteractive; + bool m_fErrorPopups; + bool m_fSuccessPopups; + time_t m_last_sendlater_processed; + int m_currJob; + + HWND m_hwndDlg; + HWND m_hwndList, m_hwndFilter; + HCONTACT m_hFilter; // contact handle to filter the qmgr list (0 = no filter, show all) + LRESULT m_sel; // index of the combo box entry corresponding to the contact filter; }; extern CSendLater* sendLater; diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index 68ae9c218f..3be0d53a5b 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -75,7 +75,7 @@ TSideBarLayout CSideBar::m_layouts[CSideBar::NR_LAYOUTS] = { CSideBarButton::CSideBarButton(const TWindowData *dat, CSideBar *sideBar) { m_dat = dat; - m_id = reinterpret_cast(dat->hContact); // set the control id + m_id = UINT(dat->hContact); // set the control id m_sideBar = sideBar; _create(); } diff --git a/plugins/TabSRMM/src/sidebar.h b/plugins/TabSRMM/src/sidebar.h index 6150b2526b..74704ea82a 100644 --- a/plugins/TabSRMM/src/sidebar.h +++ b/plugins/TabSRMM/src/sidebar.h @@ -74,7 +74,7 @@ public: const bool isTopAligned() const { return(m_isTopAligned); } const HWND getHwnd() const { return(m_hwnd); } const UINT getID() const { return(m_id); } - const HANDLE getContactHandle() const { return(m_dat->hContact); } + const HCONTACT getContactHandle() const { return(m_dat->hContact); } const TWindowData* getDat() const { return(m_dat); } const TSideBarLayout* getLayout() const { return(m_sideBarLayout); } diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index 0bbe718678..5db14bfa39 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -1325,7 +1325,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara if (dat) { tabdat->fTipActive = TRUE; ti.isGroup = 0; - ti.hItem = dat->hContact; + ti.hItem = (HANDLE)dat->hContact; ti.isTreeFocused = 0; CallService("mToolTip/ShowTip", 0, (LPARAM)&ti); } diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp index dd0ffc75d4..7bd6e7980b 100644 --- a/plugins/TipperYM/src/message_pump.cpp +++ b/plugins/TipperYM/src/message_pump.cpp @@ -156,19 +156,13 @@ unsigned int CALLBACK MessagePumpThread(void *param) HCONTACT hContact = (HCONTACT)hwndMsg.wParam; TCHAR *swzMsg = (TCHAR *)hwndMsg.lParam; - if (opt.bWaitForContent && - bStatusMsgReady == false && - clcitex && - clcitex->hItem == hContact) - { - if (WaitForContentTimerID) - { + if (opt.bWaitForContent && bStatusMsgReady == false && clcitex && clcitex->hItem == (HANDLE)hContact) { + if (WaitForContentTimerID) { KillTimer(0, WaitForContentTimerID); WaitForContentTimerID = 0; } - if (swzMsg) - { + if (swzMsg) { db_set_ts((HCONTACT)clcitex->hItem, MODULE, "TempStatusMsg", swzMsg); mir_free(swzMsg); } @@ -192,11 +186,7 @@ unsigned int CALLBACK MessagePumpThread(void *param) case MUM_GOTAVATAR: { HCONTACT hContact = (HCONTACT)hwndMsg.wParam; - - if (opt.bWaitForContent && - bAvatarReady == false && - clcitex && - clcitex->hItem == hContact) + if (opt.bWaitForContent && bAvatarReady == false && clcitex && clcitex->hItem == (HANDLE)hContact) { if (WaitForContentTimerID) { diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index b9c3d80277..0a7cfa7dce 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -976,7 +976,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa break; case PUM_SETSTATUSTEXT: - if (pwd && (HANDLE)wParam == pwd->hContact) { + if (pwd && (HCONTACT)wParam == pwd->hContact) { db_set_ts(pwd->hContact, MODULE, "TempStatusMsg", (TCHAR *)lParam); pwd->bIsPainted = false; pwd->bNeedRefresh = true; @@ -988,7 +988,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa return TRUE; case PUM_SHOWXSTATUS: - if (pwd && (HANDLE)wParam == pwd->hContact) { + if (pwd && (HCONTACT)wParam == pwd->hContact) { // in case we have retrieve xstatus pwd->bIsPainted = false; SendMessage(hwnd, PUM_REFRESH_VALUES, TRUE, 0); @@ -997,7 +997,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa return TRUE; case PUM_SETAVATAR: - if (pwd && (HANDLE)wParam == pwd->hContact) { + if (pwd && (HCONTACT)wParam == pwd->hContact) { pwd->bIsPainted = false; SendMessage(hwnd, PUM_GETHEIGHT, 0, 0); SendMessage(hwnd, PUM_CALCPOS, 0, 0); diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index 2731b85bca..f23bf33c74 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -257,8 +257,9 @@ MZodiac MAnnivDate::Zodiac() **/ int MAnnivDate::DBGetReminderOpts(HCONTACT hContact) { - if (!hContact || hContact == INVALID_HANDLE_VALUE) + if (!hContact || hContact == (HCONTACT)INVALID_HANDLE_VALUE) return 1; + if (_wID == ANID_BIRTHDAY) { _bRemind = db_get_b(hContact, USERINFO, SET_REMIND_BIRTHDAY_ENABLED, BST_INDETERMINATE); _wDaysEarlier = db_get_w(hContact, USERINFO, SET_REMIND_BIRTHDAY_OFFSET, (WORD)-1); @@ -289,8 +290,9 @@ int MAnnivDate::DBGetReminderOpts(HCONTACT hContact) **/ int MAnnivDate::DBWriteReminderOpts(HCONTACT hContact) { - if (!hContact || hContact == INVALID_HANDLE_VALUE) + if (!hContact || hContact == (HCONTACT)INVALID_HANDLE_VALUE) return 1; + if (_wID == ANID_BIRTHDAY) { if (_bRemind == BST_INDETERMINATE) db_unset(hContact, USERINFO, SET_REMIND_BIRTHDAY_ENABLED); @@ -438,7 +440,7 @@ int MAnnivDate::DBGetDateStamp(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSe **/ int MAnnivDate::DBWriteDateStamp(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) { - if (hContact == INVALID_HANDLE_VALUE || pszModule == 0 || *pszModule == 0 || pszSetting == 0 || *pszSetting == 0) + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE || pszModule == 0 || *pszModule == 0 || pszSetting == 0 || *pszSetting == 0) return 1; DWORD dwStamp = DateStamp(); diff --git a/plugins/UserInfoEx/src/classMTime.cpp b/plugins/UserInfoEx/src/classMTime.cpp index 5035d8eac9..190488b10a 100644 --- a/plugins/UserInfoEx/src/classMTime.cpp +++ b/plugins/UserInfoEx/src/classMTime.cpp @@ -423,20 +423,14 @@ void MTime::GetLocalTime(HCONTACT hContact) * read and write time to miranda's database *********************************************/ -int MTime::DBGetStamp (HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) +int MTime::DBGetStamp (HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) { - DWORD dwTimeStamp; - - if (hContact == INVALID_HANDLE_VALUE || - pszModule == NULL || pszModule[0] == 0 || - pszSetting == NULL || pszSetting[0] == 0) - { + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE || pszModule == NULL || pszModule[0] == 0 || pszSetting == NULL || pszSetting[0] == 0) { ZeroDate(); return 1; } - dwTimeStamp = db_get_dw(hContact, pszModule, pszSetting, 0); - + DWORD dwTimeStamp = db_get_dw(hContact, pszModule, pszSetting, 0); if (dwTimeStamp == 0) { ZeroDate(); return 1; @@ -448,11 +442,8 @@ int MTime::DBGetStamp (HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) int MTime::DBWriteStamp(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) { - if (hContact == INVALID_HANDLE_VALUE || - pszModule == NULL || pszModule[0] == 0 || - pszSetting == NULL || pszSetting[0] == 0) - { + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE || pszModule == NULL || pszModule[0] == 0 || pszSetting == NULL || pszSetting[0] == 0) return 1; - } + return db_set_dw(hContact, pszModule, pszSetting, TimeStamp()); } diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 653f9c77b2..1efc6eb034 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -986,15 +986,15 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar : pPs->pTree->CurrentItem(); // prefer to return the contact accociated with the current page - if (pti && pti->hContact() != INVALID_HANDLE_VALUE) { - *(HANDLE*)lParam = pti->hContact(); + if (pti && pti->hContact() != (HCONTACT)INVALID_HANDLE_VALUE) { + *(HCONTACT*)lParam = pti->hContact(); SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pti->hContact()); return TRUE; } // return contact who owns the details dialog - if (pPs->hContact != INVALID_HANDLE_VALUE) { - *(HANDLE*)lParam = pPs->hContact; + if (pPs->hContact != (HCONTACT)INVALID_HANDLE_VALUE) { + *(HCONTACT*)lParam = pPs->hContact; SetWindowLongPtr(hDlg, DWLP_MSGRESULT, (LONG_PTR)pPs->hContact); return TRUE; } @@ -1362,7 +1362,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (hContact != pPs->hContact) { if (!myGlobals.szMetaProto) break; - if (pPs->hContact != (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, NULL)) + if (pPs->hContact != (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, NULL)) break; if (!db_get_b(NULL, MODNAME, SET_META_SCAN, TRUE)) break; diff --git a/plugins/UserInfoEx/src/dlg_propsheet.h b/plugins/UserInfoEx/src/dlg_propsheet.h index dce0416454..88e9f4a643 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.h +++ b/plugins/UserInfoEx/src/dlg_propsheet.h @@ -247,25 +247,25 @@ struct TPropSheet { // dialogs owner HCONTACT hContact; - CHAR pszProto[MAXMODULELABELLENGTH]; - - HANDLE hProtoAckEvent; // eventhook for protocol acks - HANDLE hSettingChanged; // eventhook searching for changed contact information - HANDLE hIconsChanged; // eventhook for changed icons in icolib - HFONT hCaptionFont; - HFONT hBoldFont; - RECT rcDisplay; - BYTE updateAnimFrame; - CHAR szUpdating[64]; - DWORD dwFlags; + CHAR pszProto[MAXMODULELABELLENGTH]; + + HANDLE hProtoAckEvent; // eventhook for protocol acks + HANDLE hSettingChanged; // eventhook searching for changed contact information + HANDLE hIconsChanged; // eventhook for changed icons in icolib + HFONT hCaptionFont; + HFONT hBoldFont; + RECT rcDisplay; + BYTE updateAnimFrame; + CHAR szUpdating[64]; + DWORD dwFlags; TAckInfo *infosUpdated; - int nSubContacts; + int nSubContacts; // controls - HWND hDlg; - CPsTree *pTree; - CPsUpload *pUpload; + HWND hDlg; + CPsTree *pTree; + CPsUpload *pUpload; }; void DlgContactInfoInitTreeIcons(); diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index efb32e0efc..023f551096 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -227,7 +227,7 @@ BYTE CExImContactBase::fromIni(LPSTR& row) HCONTACT CExImContactBase::toDB() { // create new contact if none exists - if (_hContact == INVALID_HANDLE_VALUE && _pszProto && _pszUIDKey && _dbvUID.type != DBVT_DELETED) { + if (_hContact == (HCONTACT)INVALID_HANDLE_VALUE && _pszProto && _pszUIDKey && _dbvUID.type != DBVT_DELETED) { PROTOACCOUNT* pszAccount = 0; if (NULL == (pszAccount = ProtoGetAccount( _pszProto ))) { //account does not exist @@ -521,7 +521,7 @@ BYTE CExImContactBase::isHandle(HCONTACT hContact) * param: none * return: handle if successful, INVALID_HANDLE_VALUE otherwise **/ -HANDLE CExImContactBase::findHandle() +HCONTACT CExImContactBase::findHandle() { for (HCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { if (isHandle(hContact)) { diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.h b/plugins/UserInfoEx/src/ex_import/classExImContactBase.h index c9bb3fee24..e248c1d2a7 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.h +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.h @@ -23,34 +23,29 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HANDLE CListFindGroup(LPCSTR pszGroup); -class CExImContactBase { - BYTE compareUID(DBVARIANT *dbv); +class CExImContactBase +{ + BYTE compareUID(DBVARIANT *dbv); protected: - LPSTR _pszNick; // utf8 encoded - LPSTR _pszDisp; // utf8 encoded - LPSTR _pszGroup; // utf8 encoded - LPSTR _pszAMPro; - LPSTR _pszProto; - LPSTR _pszProtoOld; - LPSTR _pszUIDKey; - DWORD _dbvUIDHash; - DBVARIANT _dbvUID; - HCONTACT _hContact; - BYTE _isNewContact; // is this contact a new one? - - HANDLE findHandle(); + LPSTR _pszNick; // utf8 encoded + LPSTR _pszDisp; // utf8 encoded + LPSTR _pszGroup; // utf8 encoded + LPSTR _pszAMPro; + LPSTR _pszProto; + LPSTR _pszProtoOld; + LPSTR _pszUIDKey; + DWORD _dbvUIDHash; + DBVARIANT _dbvUID; + HCONTACT _hContact; + BYTE _isNewContact; // is this contact a new one? + + HCONTACT findHandle(); public: CExImContactBase(); ~CExImContactBase(); -// __inline LPCSTR disp() const { return mir_strcmp(_pszDisp,"")? _pszDisp : NULL; } -// __inline LPCSTR group() const { return mir_strcmp(_pszGroup,"")? _pszGroup : NULL; } -// __inline LPCSTR nick() const { return mir_strcmp(_pszNick,"")? _pszNick : NULL; } -// __inline LPCSTR proto() const { return mir_strcmp(_pszProto,"")? _pszProto : NULL; } -// __inline LPCSTR ampro() const { return mir_strcmp(_pszAMPro,"")? _pszAMPro : NULL; } -// __inline LPCSTR uidk() const { return mir_strcmp(_pszUIDKey,"")? _pszUIDKey : NULL; } __inline DBVARIANT& uid() { return _dbvUID; } __inline HCONTACT handle() const { return _hContact; } diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index 8aa92d5285..1bef0889b8 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -207,7 +207,7 @@ int CExImContactXML::Export(FILE *xmlfile, DB::CEnumList* pModules) if (!xmlfile) return ERROR_INVALID_PARAMS; - if (_hContact == INVALID_HANDLE_VALUE) + if (_hContact == (HCONTACT)INVALID_HANDLE_VALUE) return ERROR_INVALID_CONTACT; if (!CreateXmlElement()) @@ -510,7 +510,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) CExImContactXML vSub(_pXmlFile); if (vSub = xSub) { // identify metacontact by the first valid subcontact in xmlfile - if (_hContact == INVALID_HANDLE_VALUE && vSub.handle() != INVALID_HANDLE_VALUE) { + if (_hContact == (HCONTACT)INVALID_HANDLE_VALUE && vSub.handle() != (HCONTACT)INVALID_HANDLE_VALUE) { HCONTACT hMeta = (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)vSub.handle(), NULL); if (hMeta != NULL) { _hContact = hMeta; @@ -520,7 +520,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) } } // if no handle was found, this is a new meta contact - _isNewContact = _hContact == INVALID_HANDLE_VALUE; + _isNewContact = _hContact == (HCONTACT)INVALID_HANDLE_VALUE; } // entry is a default contact else { @@ -588,7 +588,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) int CExImContactXML::ImportContact() { // create the contact if not yet exists - if (toDB() != INVALID_HANDLE_VALUE) { + if (toDB() != (HCONTACT)INVALID_HANDLE_VALUE) { _hEvent = NULL; // count settings and events and init progress dialog @@ -736,7 +736,7 @@ int CExImContactXML::ImportMetaSubContact(CExImContactXML * pMetaContact) return err; // check if contact is subcontact of the desired meta contact - if ((HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)_hContact, NULL) != pMetaContact->handle()) { + if ((HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)_hContact, NULL) != pMetaContact->handle()) { // add contact to the metacontact (this service returns TRUE if successful) err = CallService(MS_MC_ADDTOMETA, (WPARAM)_hContact, (LPARAM)pMetaContact->handle()); if (err == FALSE) { diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp index 3ddfbe0f93..acd8410463 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp @@ -303,7 +303,7 @@ static HCONTACT ImportFindContact(HCONTACT hContact, LPSTR &strBuf, BYTE bCanCre CExImContactBase vcc; vcc.fromIni(strBuf); - if (vcc.handle() != INVALID_HANDLE_VALUE) { + if (vcc.handle() != (HCONTACT)INVALID_HANDLE_VALUE) { //if (vcc.isHandle(hContact)) // return hContact; return vcc.handle(); @@ -452,11 +452,11 @@ int SvcExImINI_Import(HCONTACT hContact, LPCSTR pszFileName) numLines++; // contact was found and imported - if (hContact != INVALID_HANDLE_VALUE && hNewContact != INVALID_HANDLE_VALUE) + if (hContact != (HCONTACT)INVALID_HANDLE_VALUE && hNewContact != (HCONTACT)INVALID_HANDLE_VALUE) break; // importing settings is only valid vor the main menu item - if (hContact == INVALID_HANDLE_VALUE) { + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) { if (!strncmp(strBuf, "SETTINGS:", 9)) { *szModule = 0; hNewContact = NULL; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp index 824c4c0fd1..0cea3cff25 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp @@ -854,7 +854,7 @@ BYTE CVCardFileVCF::Open(HCONTACT hContact, LPCSTR pszFileName, LPCSTR pszMode) { if (!(_pFile = fopen(pszFileName, pszMode))) return FALSE; - if ((_hContact = hContact) == INVALID_HANDLE_VALUE) + if ((_hContact = hContact) == (HCONTACT)INVALID_HANDLE_VALUE) return FALSE; if (!(_pszBaseProto = DB::Contact::Proto(_hContact))) return FALSE; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index c4664b0975..245c28e016 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -139,7 +139,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) } else { // other export mode - _hContactToWorkOn = INVALID_HANDLE_VALUE; + _hContactToWorkOn = (HCONTACT)INVALID_HANDLE_VALUE; #ifdef _DEBUG LARGE_INTEGER freq, t1, t2; @@ -265,8 +265,8 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) switch (result) { case ERROR_OK: // init contact class and import if matches the user desires - if (_hContactToWorkOn == INVALID_HANDLE_VALUE || vContact.handle() == _hContactToWorkOn) { - result = vContact.Import(_hContactToWorkOn != INVALID_HANDLE_VALUE); + if (_hContactToWorkOn == (HCONTACT)INVALID_HANDLE_VALUE || vContact.handle() == _hContactToWorkOn) { + result = vContact.Import(_hContactToWorkOn != (HCONTACT)INVALID_HANDLE_VALUE); switch (result) { case ERROR_OK: _numContactsDone++; @@ -295,7 +295,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent) if (pszNick) mir_free(pszNick); } // import owner contact - else if (_hContactToWorkOn == INVALID_HANDLE_VALUE && !mir_stricmp(xContact->Value(), XKEY_OWNER) && (vContact = xContact)) { + else if (_hContactToWorkOn == (HCONTACT)INVALID_HANDLE_VALUE && !mir_stricmp(xContact->Value(), XKEY_OWNER) && (vContact = xContact)) { result = vContact.Import(); switch (result) { case ERROR_OK: diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h index 382fdb6dde..cbc64d761d 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h @@ -29,24 +29,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CFileXml { friend class CExImContactXML; - DWORD _numContactsTodo; - DWORD _numContactsDone; - DWORD _numSettingsTodo; - DWORD _numSettingsDone; - DWORD _numEventsTodo; - DWORD _numEventsDone; - DWORD _numEventsDuplicated; + DWORD _numContactsTodo; + DWORD _numContactsDone; + DWORD _numSettingsTodo; + DWORD _numSettingsDone; + DWORD _numEventsTodo; + DWORD _numEventsDone; + DWORD _numEventsDuplicated; - HANDLE _hContactToWorkOn; // contact to ex/import (NULL=owner|INVALID_HANDLE_VALUE=all|HADNLE=one user) + HCONTACT _hContactToWorkOn; // contact to ex/import (NULL=owner|INVALID_HANDLE_VALUE=all|HADNLE=one user) - WORD _wExport; + WORD _wExport; - CProgress _progress; + CProgress _progress; - int ImportOwner(TiXmlElement* xmlContact); - int ImportContacts(TiXmlElement* xmlParent); + int ImportOwner(TiXmlElement* xmlContact); + int ImportContacts(TiXmlElement* xmlParent); - DWORD CountContacts(TiXmlElement* xmlParent); + DWORD CountContacts(TiXmlElement* xmlParent); /* int ExportOwner(FILE *xmlfile, BYTE bExportEvents); @@ -56,8 +56,8 @@ class CFileXml { public: CFileXml(); - int Import(HCONTACT hContact, LPCSTR pszFileName); - int Export(lpExImParam ExImContact, LPCSTR pszFileName); + int Import(HCONTACT hContact, LPCSTR pszFileName); + int Export(lpExImParam ExImContact, LPCSTR pszFileName); }; #endif /* _SVC_FILEXML_INCLUDED_ */ \ No newline at end of file diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index 669d737aa3..6cabbab4b7 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -140,11 +140,9 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM case VARM_SETSUBJECT: { LPARAM res = 0; - HCONTACT hContact, hItem; - - hContact = (HCONTACT)wParam; + HCONTACT hItem, hContact = (HCONTACT)wParam; log_debugA("VARM_SETSUBJECT: %u", hContact); - if (hContact == INVALID_HANDLE_VALUE) { + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) { TCHAR *tszContact = db_get_tsa(NULL, MODULENAME, SETTING_SUBJECT); log_debugA("VARM_SETSUBJECT: %s", tszContact); if (tszContact != NULL) { @@ -153,7 +151,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM mir_free(tszContact); } } - if ((hContact != INVALID_HANDLE_VALUE) && (hContact != NULL)) + if ((hContact != (HCONTACT)INVALID_HANDLE_VALUE) && (hContact != NULL)) hItem = (HCONTACT)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); else hItem = NULL; diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index 6362a9c65d..5bbe057899 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -118,7 +118,7 @@ static void __cdecl AckThreadProc(HANDLE param) INT_PTR WeatherGetInfo(WPARAM wParam,LPARAM lParam) { CCSDATA *ccs = (CCSDATA *) lParam; - mir_forkthread(AckThreadProc, ccs->hContact); + mir_forkthread(AckThreadProc, (void*)ccs->hContact); return 0; } @@ -194,7 +194,7 @@ static INT_PTR WeatherGetAwayMsg(WPARAM wParam, LPARAM lParam) if (ccs == NULL) return 0; - mir_forkthread(WeatherGetAwayMsgThread, ccs->hContact); + mir_forkthread(WeatherGetAwayMsgThread, (void*)ccs->hContact); return 1; } diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index dfbd581dd5..a38258c5c8 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -757,7 +757,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa for (i = 0; (i < count) && (!found); i++) { item.iItem = i; ListView_GetItem(hList, &item); - if (hContact == (HANDLE) item.lParam) { + if (hContact == (HCONTACT)item.lParam) { UpdateBirthdayEntry(hList, hContact, i, IsDlgButtonChecked(hWnd, IDC_SHOW_ALL), commonData.cShowAgeMode, 0); found = 1; } @@ -939,8 +939,8 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar DWORD WINAPI OpenMessageWindowThread(void *data) { HCONTACT hContact = (HCONTACT)data; - CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM) hContact, 0); - CallServiceSync("SRMsg/LaunchMessageWindow", (WPARAM) hContact, 0); + CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); + CallServiceSync("SRMsg/LaunchMessageWindow", (WPARAM)hContact, 0); return 0; } @@ -952,7 +952,7 @@ int HandlePopupClick(HWND hWnd, int action) HCONTACT hContact = (HCONTACT)PUGetContact(hWnd); if (hContact) { DWORD threadID; - HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, hContact, 0, &threadID); + HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, (void*)hContact, 0, &threadID); } }//fallthrough diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp index b759b405df..267b6bd8d7 100644 --- a/plugins/WhenWasIt/src/notifiers.cpp +++ b/plugins/WhenWasIt/src/notifiers.cpp @@ -70,14 +70,11 @@ int PopupNotifyBirthday(HCONTACT hContact, int dtb, int age) const int MAX_SIZE = 1024; TCHAR text[MAX_SIZE]; //int bIgnoreSubcontacts = db_get_b(NULL, ModuleName, "IgnoreSubcontacts", FALSE); - if (commonData.bIgnoreSubcontacts) - { - HANDLE hMetacontact = (HANDLE) CallService(MS_MC_GETMETACONTACT, (WPARAM) hContact, 0); - if ((hMetacontact) && (hMetacontact != hContact)) //not main metacontact - { - return 0; - } - } + if (commonData.bIgnoreSubcontacts) { + HCONTACT hMetacontact = (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM) hContact, 0); + if ((hMetacontact) && (hMetacontact != hContact)) //not main metacontact + return 0; + } BuildDTBText(dtb, name, text, MAX_SIZE); int gender = GetContactGender(hContact); @@ -118,7 +115,7 @@ int PopupNotifyMissedBirthday(HCONTACT hContact, int dab, int age) TCHAR text[MAX_SIZE]; //int bIgnoreSubcontacts = db_get_b(NULL, ModuleName, "IgnoreSubcontacts", FALSE); if (commonData.bIgnoreSubcontacts) { - HANDLE hMetacontact = (HANDLE) CallService(MS_MC_GETMETACONTACT, (WPARAM) hContact, 0); + HCONTACT hMetacontact = (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM) hContact, 0); if (hMetacontact && hMetacontact != hContact) //not main metacontact return 0; } diff --git a/plugins/WinterSpeak/src/SpeakAnnounce.cpp b/plugins/WinterSpeak/src/SpeakAnnounce.cpp index e9120f20eb..1d95b743f6 100644 --- a/plugins/WinterSpeak/src/SpeakAnnounce.cpp +++ b/plugins/WinterSpeak/src/SpeakAnnounce.cpp @@ -12,7 +12,7 @@ SpeakAnnounce::~SpeakAnnounce() } //------------------------------------------------------------------------------ -void SpeakAnnounce::statusChange(DBCONTACTWRITESETTING *write_setting, HANDLE user) +void SpeakAnnounce::statusChange(DBCONTACTWRITESETTING *write_setting, HCONTACT user) { const std::string STATUS = "Status"; @@ -20,15 +20,11 @@ void SpeakAnnounce::statusChange(DBCONTACTWRITESETTING *write_setting, HANDLE us // if it's not a status change then return // check and update the user's status, if status didn't change the return if ((NULL == user) || (STATUS != write_setting->szSetting) || (!m_user_info.updateStatus(user, write_setting->value.wVal))) - { return; - } // check if we just connected, and want to suppress status changes if (!m_db.getStatusFlag(AnnounceDatabase::StatusFlag_SuppressConnect) && m_protocol_info.isDisabled((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)user, 0))) - { return; - } bool speak = false; @@ -61,9 +57,7 @@ void SpeakAnnounce::statusChange(DBCONTACTWRITESETTING *write_setting, HANDLE us } if (!speak) - { return; - } // translate, insert name then speak std::wstring status_str = TranslateW(m_user_info.statusString(user).c_str()); @@ -74,61 +68,50 @@ void SpeakAnnounce::statusChange(DBCONTACTWRITESETTING *write_setting, HANDLE us //------------------------------------------------------------------------------ void SpeakAnnounce::incomingEvent(HCONTACT user, HANDLE event) { - if (m_event_info.isValidEvent(event)) - { - bool speak = false; - switch (m_event_info.getLastEvent()) - { - case EVENTTYPE_MESSAGE: - speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_Message); - break; - - case EVENTTYPE_URL: - speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_Url); - break; - - case EVENTTYPE_ADDED: - speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_Added); - break; - - case EVENTTYPE_AUTHREQUEST: - speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_AuthRequest); - break; - - case EVENTTYPE_FILE: - speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_File); - break; - - } - - if (!speak) - { - return; - } - std::wstring event_str = L""; - - if (EVENTTYPE_MESSAGE == m_event_info.getLastEvent()) - { - if (!readMessage(user)) - { - return; // message dialog is open so just leave without saying anything - } - if ((m_db.getEventFlag(AnnounceDatabase::EventFlag_ReadMsgLength)) && (m_event_info.getMessageSize() <= m_db.getMaxMsgSize())) - { - event_str = m_event_info.getMessage(); // conditions met to read the message - } - else - { - event_str = m_event_info.eventString(); - } - } + if (!m_event_info.isValidEvent(event)) + return; + + bool speak = false; + switch (m_event_info.getLastEvent()) { + case EVENTTYPE_MESSAGE: + speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_Message); + break; + + case EVENTTYPE_URL: + speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_Url); + break; + + case EVENTTYPE_ADDED: + speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_Added); + break; + + case EVENTTYPE_AUTHREQUEST: + speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_AuthRequest); + break; + + case EVENTTYPE_FILE: + speak = m_db.getEventFlag(AnnounceDatabase::EventFlag_File); + break; + } + + if (!speak) + return; + + std::wstring event_str = L""; + + if (EVENTTYPE_MESSAGE == m_event_info.getLastEvent()) { + if (!readMessage(user)) + return; // message dialog is open so just leave without saying anything + + if ((m_db.getEventFlag(AnnounceDatabase::EventFlag_ReadMsgLength)) && (m_event_info.getMessageSize() <= m_db.getMaxMsgSize())) + event_str = m_event_info.getMessage(); // conditions met to read the message else - { event_str = m_event_info.eventString(); - } - m_user_info.insertName(event_str, user); // translate the string, insert the name, then speak it - message(event_str, user); } + else event_str = m_event_info.eventString(); + + m_user_info.insertName(event_str, user); // translate the string, insert the name, then speak it + message(event_str, user); } //------------------------------------------------------------------------------ @@ -148,52 +131,41 @@ void SpeakAnnounce::protocolAck(ACKDATA *ack) } //------------------------------------------------------------------------------ -void SpeakAnnounce::message(const std::wstring &sentence, HANDLE user) +void SpeakAnnounce::message(const std::wstring &sentence, HCONTACT user) { - CallService(MS_SPEAK_MESSAGE, reinterpret_cast(user), reinterpret_cast(sentence.c_str())); + CallService(MS_SPEAK_MESSAGE, LPARAM(user), reinterpret_cast(sentence.c_str())); } -void SpeakAnnounce::status(const std::wstring &sentence, HANDLE user) + +void SpeakAnnounce::status(const std::wstring &sentence, HCONTACT user) { - CallService(MS_SPEAK_STATUS, reinterpret_cast(user), reinterpret_cast(sentence.c_str())); + CallService(MS_SPEAK_STATUS, LPARAM(user), reinterpret_cast(sentence.c_str())); } //------------------------------------------------------------------------------ -bool SpeakAnnounce::readMessage(HANDLE contact) +bool SpeakAnnounce::readMessage(HCONTACT contact) { std::wstring title = m_user_info.nameString(contact) + L" (" + m_user_info.statusModeString(contact) + L"): "; - HWND window = NULL; - - window = FindWindow(L"#32770", (title + TranslateW(L"Message Session")).c_str()); - if (window) - { + HWND window = FindWindow(L"#32770", (title + TranslateW(L"Message Session")).c_str()); + if (window) { // check if we dont want to read message if dialog is open if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen)) - { return false; - } // check if we dont want to read message if dialog if focused if ((window == GetForegroundWindow()) && m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogFocused)) - { return false; - } } window = FindWindow(L"#32770", (title + TranslateW(L"Message Received")).c_str()); - if (window) - { + if (window) { // check if we dont want to read message if dialog is open if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen)) - { return false; - } // check if we dont want to read message if dialog if focused if ((window == GetForegroundWindow()) && m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogFocused)) - { return false; - } } return true; diff --git a/plugins/WinterSpeak/src/SpeakAnnounce.h b/plugins/WinterSpeak/src/SpeakAnnounce.h index e4980a292a..cb1a53f8bf 100644 --- a/plugins/WinterSpeak/src/SpeakAnnounce.h +++ b/plugins/WinterSpeak/src/SpeakAnnounce.h @@ -5,14 +5,14 @@ class SpeakAnnounce { - public: +public: SpeakAnnounce(HINSTANCE instance); ~SpeakAnnounce(); //-------------------------------------------------------------------------- // Description : handle a status change //-------------------------------------------------------------------------- - void statusChange(DBCONTACTWRITESETTING *write_setting, HANDLE user); + void statusChange(DBCONTACTWRITESETTING *write_setting, HCONTACT user); //-------------------------------------------------------------------------- // Description : handle an event @@ -22,33 +22,32 @@ class SpeakAnnounce //-------------------------------------------------------------------------- // Description : handle a protocol state change //-------------------------------------------------------------------------- - void protocolAck(ACKDATA *ack); + void protocolAck(ACKDATA *ack); //-------------------------------------------------------------------------- // Description : speak a sentence // Parameters : sentence - the sentence to speak - // user - the user who is speaking, or NULL for no user + // user - the user who is speaking, or NULL for no user // Returns : true - speak successful // false - speak failed //-------------------------------------------------------------------------- - void message(const std::wstring &sentence, HANDLE user); - void status(const std::wstring &sentence, HANDLE user); + void message(const std::wstring &sentence, HCONTACT user); + void status(const std::wstring &sentence, HCONTACT user); - private: +private: //-------------------------------------------------------------------------- // Description : check if the users message window is open and focused // Parameters : contact - the user to check for // Returns : true = message window is open // false = message window not open //-------------------------------------------------------------------------- - bool readMessage(HANDLE contact); + bool readMessage(HCONTACT contact); - HINSTANCE m_instance; + HINSTANCE m_instance; AnnounceDatabase m_db; - AnnounceDialog m_dialog; - UserInformation m_user_info; + AnnounceDialog m_dialog; + UserInformation m_user_info; EventInformation m_event_info; - ProtocolInformation m_protocol_info; + ProtocolInformation m_protocol_info; }; - diff --git a/plugins/WinterSpeak/src/UserInformation.cpp b/plugins/WinterSpeak/src/UserInformation.cpp index 046c148542..ba081d2b95 100644 --- a/plugins/WinterSpeak/src/UserInformation.cpp +++ b/plugins/WinterSpeak/src/UserInformation.cpp @@ -20,7 +20,7 @@ UserInformation::~UserInformation() } //------------------------------------------------------------------------------ -bool UserInformation::updateStatus(HANDLE user, int status) +bool UserInformation::updateStatus(HCONTACT user, int status) { bool ret = false; @@ -38,13 +38,13 @@ bool UserInformation::updateStatus(HANDLE user, int status) } //------------------------------------------------------------------------------ -std::wstring UserInformation::statusString(HANDLE user) +std::wstring UserInformation::statusString(HCONTACT user) { return m_status_strings[m_status_info[user]]; } //------------------------------------------------------------------------------ -std::wstring UserInformation::statusModeString(HANDLE user) +std::wstring UserInformation::statusModeString(HCONTACT user) { int status = CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, m_status_info[user], 0); @@ -57,14 +57,14 @@ std::wstring UserInformation::statusModeString(HANDLE user) } //------------------------------------------------------------------------------ -void UserInformation::insertName(std::wstring &str, HANDLE user) const +void UserInformation::insertName(std::wstring &str, HCONTACT user) const { // insert the user's name into the string str.replace(str.find(L"%u"), 2, nameString(user)); } //------------------------------------------------------------------------------ -std::wstring UserInformation::nameString(HANDLE user) const +std::wstring UserInformation::nameString(HCONTACT user) const { //WCHAR *ret = reinterpret_cast(CallService(MS_CLIST_GETCONTACTDISPLAYNAME, reinterpret_cast(user), 0)); char* ret = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(user), 0); diff --git a/plugins/WinterSpeak/src/UserInformation.h b/plugins/WinterSpeak/src/UserInformation.h index a9d972d96d..7ab11ecddc 100644 --- a/plugins/WinterSpeak/src/UserInformation.h +++ b/plugins/WinterSpeak/src/UserInformation.h @@ -5,7 +5,7 @@ class UserInformation { - public: +public: UserInformation(); ~UserInformation(); @@ -16,38 +16,38 @@ class UserInformation // Returns : true - the status changed // false - the status stayed the same //-------------------------------------------------------------------------- - bool updateStatus(HANDLE user, int status); + bool updateStatus(HCONTACT user, int status); //-------------------------------------------------------------------------- // Description : get a string containing the users current status string // Parameters : user - the current user // Returns : the string containing the users status //-------------------------------------------------------------------------- - std::wstring statusString(HANDLE user); + std::wstring statusString(HCONTACT user); //-------------------------------------------------------------------------- // Description : return the status mode of the user // Parameters : user - the current user // Returns : the string containing the users status mode //-------------------------------------------------------------------------- - std::wstring statusModeString(HANDLE user); + std::wstring statusModeString(HCONTACT user); //-------------------------------------------------------------------------- // Description : insert the name into the string at the %u location // Parameters : str - the string to have the username inserted into // user - the current user //-------------------------------------------------------------------------- - void insertName(std::wstring &str, HANDLE user) const; + void insertName(std::wstring &str, HCONTACT user) const; //-------------------------------------------------------------------------- // Description : get the name string for the user // Parameters : user - the current user // Returns : a string containing the user's name //-------------------------------------------------------------------------- - std::wstring nameString(HANDLE user) const; + std::wstring nameString(HCONTACT user) const; - private: - std::map m_status_info; +private: + std::map m_status_info; std::map m_status_strings; }; diff --git a/plugins/WinterSpeak/src/main.cpp b/plugins/WinterSpeak/src/main.cpp index e20c0fa113..f218b87f43 100644 --- a/plugins/WinterSpeak/src/main.cpp +++ b/plugins/WinterSpeak/src/main.cpp @@ -31,12 +31,12 @@ PLUGININFOEX pluginInfo={ //----------------------------------------------------------------------------- INT_PTR status(WPARAM wParam, LPARAM lParam) { - return g_speak_config->status(reinterpret_cast(lParam), reinterpret_cast(wParam)); + return g_speak_config->status(reinterpret_cast(lParam), HCONTACT(wParam)); } INT_PTR message(WPARAM wParam, LPARAM lParam) { - return g_speak_config->message(reinterpret_cast(lParam), reinterpret_cast(wParam)); + return g_speak_config->message(reinterpret_cast(lParam), HCONTACT(wParam)); } //----------------------------------------------------------------------------- @@ -44,10 +44,7 @@ INT_PTR message(WPARAM wParam, LPARAM lParam) //----------------------------------------------------------------------------- int eventStatusChange(WPARAM wParam, LPARAM lParam) { - g_speak_announce->statusChange( - reinterpret_cast(lParam), - reinterpret_cast(wParam)); - + g_speak_announce->statusChange(reinterpret_cast(lParam), HCONTACT(wParam)); return 0; } @@ -56,7 +53,7 @@ int eventStatusChange(WPARAM wParam, LPARAM lParam) //----------------------------------------------------------------------------- int eventMessageAdded(WPARAM wParam, LPARAM lParam) { - g_speak_announce->incomingEvent(reinterpret_cast(wParam), reinterpret_cast(lParam)); + g_speak_announce->incomingEvent(HCONTACT(wParam), reinterpret_cast(lParam)); return 0; } diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp index 7089f01b98..0ff42ee951 100644 --- a/plugins/YAPP/src/popwin.cpp +++ b/plugins/YAPP/src/popwin.cpp @@ -566,7 +566,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa case PUM_GETCONTACT: { - HANDLE *phContact = (HANDLE*)wParam; + HCONTACT *phContact = (HCONTACT*)wParam; *phContact = pd->hContact; if (lParam) SetEvent((HANDLE)lParam); diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index d47a759b62..c7001071cc 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -733,7 +733,7 @@ HANDLE __cdecl CAimProto::GetAwayMsg(HCONTACT hContact) switch (status) { case ID_STATUS_AWAY: case ID_STATUS_ONLINE: - ForkThread(&CAimProto::get_online_msg_thread, hContact); + ForkThread(&CAimProto::get_online_msg_thread, (void*)hContact); break; default: diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp index 3a484527b3..f2646551c0 100644 --- a/protocols/AimOscar/src/services.cpp +++ b/protocols/AimOscar/src/services.cpp @@ -392,7 +392,7 @@ INT_PTR CAimProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (state == 1) { - ForkThread(&CAimProto::avatar_request_thread, AI->hContact); + ForkThread(&CAimProto::avatar_request_thread, (void*)AI->hContact); return GAIR_WAITFOR; } diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index a06efacc46..0efbe5ea1c 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -35,8 +35,6 @@ void FacebookProto::SendMsgWorker(void *p) if(p == NULL) return; -// ScopedLock s(facy.send_message_lock_, 500); - send_direct *data = static_cast(p); DBVARIANT dbv; diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 2bb3659f87..ea869c4830 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -287,7 +287,7 @@ int FacebookProto::Authorize(HANDLE hDbEvent) return 1; HCONTACT hContact = HContactFromAuthEvent(hDbEvent); - if (hContact == INVALID_HANDLE_VALUE) + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) return 1; return ApproveFriendship((WPARAM)hContact, NULL); @@ -299,7 +299,7 @@ int FacebookProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason) return 1; HCONTACT hContact = HContactFromAuthEvent(hDbEvent); - if (hContact == INVALID_HANDLE_VALUE) + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) return 1; // TODO: hide from facebook requests list @@ -450,7 +450,7 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM lParam) if (!isOnline()) return 1; - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); wall_data *wall = new wall_data(); wall->user_id = ptrA(getStringA(hContact, FACEBOOK_KEY_ID)); @@ -504,7 +504,7 @@ INT_PTR FacebookProto::RefreshBuddyList(WPARAM, LPARAM) INT_PTR FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam) { - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); std::string url = FACEBOOK_URL_PROFILE; @@ -527,7 +527,7 @@ INT_PTR FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam) INT_PTR FacebookProto::VisitFriendship(WPARAM wParam,LPARAM lParam) { - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); if (wParam == 0 || !IsMyContact(hContact)) return 1; @@ -547,7 +547,7 @@ INT_PTR FacebookProto::Poke(WPARAM wParam,LPARAM lParam) if (wParam == NULL || isOffline()) return 1; - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); ptrA id(getStringA(hContact, FACEBOOK_KEY_ID)); if (id == NULL) @@ -564,7 +564,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam) bool deleting = (lParam == 1); - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); // Ignore groupchats and, if deleting, also not-friends if (isChatRoom(hContact) || (deleting && getByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, 0) != CONTACT_FRIEND)) @@ -601,7 +601,7 @@ INT_PTR FacebookProto::RequestFriendship(WPARAM wParam,LPARAM lParam) if (wParam == NULL || isOffline()) return 1; - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); ptrA id(getStringA(hContact, FACEBOOK_KEY_ID)); if (id == NULL) diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index e0b7fd134e..61025d53d3 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -69,7 +69,7 @@ static FacebookProto * GetInstanceByHContact(HCONTACT hContact) template INT_PTR GlobalService(WPARAM wParam,LPARAM lParam) { - FacebookProto *proto = GetInstanceByHContact(reinterpret_cast(wParam)); + FacebookProto *proto = GetInstanceByHContact(HCONTACT(wParam)); return proto ? (proto->*Fcn)(wParam,lParam) : 0; } @@ -78,7 +78,7 @@ static int PrebuildContactMenu(WPARAM wParam,LPARAM lParam) for (size_t i=0; i(wParam)); + FacebookProto *proto = GetInstanceByHContact(HCONTACT(wParam)); return proto ? proto->OnPrebuildContactMenu(wParam,lParam) : 0; } @@ -152,7 +152,7 @@ void UninitContactMenus() int FacebookProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam) { - HCONTACT hContact = reinterpret_cast(wParam); + HCONTACT hContact = HCONTACT(wParam); bool bIsChatroom = isChatRoom(hContact); Menu_ShowItem(g_hContactMenuItems[CMI_VISIT_PROFILE], true); diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 562468c5e9..2c210c57a7 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -1035,7 +1035,7 @@ retry: { struct gg_dcc7 *dcc7 = e->event.dcc7_new; debugLogA("mainthread() (%x): Incoming direct connection.", this); - dcc7->contact = getcontact(dcc7->peer_uin, 0, 0, NULL); + dcc7->contact = (void*)getcontact(dcc7->peer_uin, 0, 0, NULL); // Check if user is on the list and if it is my uin if (!dcc7->contact || getDword(GG_KEY_UIN, -1) != dcc7->uin) { diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 38a38bf22c..14d4f6bd62 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -381,7 +381,7 @@ void __cdecl GGPROTO::dccmainthread(void*) // Add file recv request { // Make new ggtransfer struct - local_dcc->contact = getcontact(local_dcc->peer_uin, 0, 0, NULL); + local_dcc->contact = (void*)getcontact(local_dcc->peer_uin, 0, 0, NULL); TCHAR* filenameT = mir_utf8decodeT((char*)dcc->file_info.filename); PROTORECVFILET pre = {0}; @@ -952,7 +952,7 @@ HANDLE GGPROTO::SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROT list_add(&watches, dcc7, 0); // Store handle - dcc7->contact = hContact; + dcc7->contact = (void*)hContact; dcc7->folder = _strdup(filename); dcc7->tick = 0; // Make folder name @@ -1006,7 +1006,7 @@ HANDLE GGPROTO::SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROT if (dcc->fd != -1) list_add(&watches, dcc, 0); // Store handle - dcc->contact = hContact; + dcc->contact = (void*)hContact; dcc->folder = _strdup(filename); dcc->tick = 0; // Make folder name diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index b3ad11201c..1d8e211195 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -206,7 +206,7 @@ int GGPROTO::GetInfo(HCONTACT hContact, int infoType) #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 6 GGPROTO::cmdgetinfothread"); #endif - ForkThread(&GGPROTO::cmdgetinfothread, hContact); + ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } @@ -224,7 +224,7 @@ int GGPROTO::GetInfo(HCONTACT hContact, int infoType) #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 7 GGPROTO::cmdgetinfothread"); #endif - ForkThread(&GGPROTO::cmdgetinfothread, hContact); + ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 48, 2, "sess_mutex", 1); @@ -238,7 +238,7 @@ int GGPROTO::GetInfo(HCONTACT hContact, int infoType) #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 8 GGPROTO::cmdgetinfothread"); #endif - ForkThread(&GGPROTO::cmdgetinfothread, hContact); + ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } @@ -255,7 +255,7 @@ int GGPROTO::GetInfo(HCONTACT hContact, int infoType) #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 9 GGPROTO::cmdgetinfothread"); #endif - ForkThread(&GGPROTO::cmdgetinfothread, hContact); + ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 49, 2, "sess_mutex", 1); @@ -686,7 +686,7 @@ HANDLE GGPROTO::GetAwayMsg(HCONTACT hContact) #ifdef DEBUGMODE debugLogA("GetAwayMsg(): ForkThread 17 GGPROTO::getawaymsgthread"); #endif - ForkThread(&GGPROTO::getawaymsgthread, hContact); + ForkThread(&GGPROTO::getawaymsgthread, (void*)hContact); return (HANDLE)1; } diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 8816eae8c3..6d4749f585 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -225,7 +225,7 @@ char *oauth_generate_nonce() mir_snprintf(timestamp, sizeof(timestamp), "%ld", time(NULL)); CallService(MS_UTILS_GETRANDOM, (WPARAM)sizeof(randnum), (LPARAM)randnum); - int strSizeB = strlen(timestamp) + sizeof(randnum); + int strSizeB = int(strlen(timestamp) + sizeof(randnum)); ptrA str((char *)mir_calloc(strSizeB + 1)); strcpy(str, timestamp); strncat(str, randnum, sizeof(randnum)); diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index a78fabf304..fbc43f7cec 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -555,7 +555,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, HCONTACT hConta return true; CONTACT user = { (TCHAR*)one.c_str(), NULL, NULL, false, false, false }; - HANDLE hContact2 = CList_AddContact(&user, false, false); + HCONTACT hContact2 = CList_AddContact(&user, false, false); if (hContact2) { if (getByte(hContact, "AdvancedMode", 0) == 0) DoUserhostWithReason(1, (_T("S") + one).c_str(), true, one.c_str()); diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 1a33ac9a73..a74fe449da 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -810,11 +810,11 @@ int __cdecl CIrcProto::SendMsg(HCONTACT hContact, int flags, const char* pszSrc) BYTE bDcc = getByte(hContact, "DCC", 0); WORD wStatus = getWord(hContact, "Status", ID_STATUS_OFFLINE); if (bDcc && wStatus != ID_STATUS_ONLINE) { - ForkThread(&CIrcProto::AckMessageFailDcc, hContact); + ForkThread(&CIrcProto::AckMessageFailDcc, (void*)hContact); return 0; } if (!bDcc && (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING)) { - ForkThread(&CIrcProto::AckMessageFail, hContact); + ForkThread(&CIrcProto::AckMessageFail, (void*)hContact); return 0; } diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index 0786b363bf..11c972ca3b 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -95,7 +95,7 @@ void CJabberProto::OnIqResultGetCollectionList(HXML iqNode, CJabberIqInfo*) ///////////////////////////////////////////////////////////////////////////////////////// static DWORD dwPreviousTimeStamp = -1; -static HANDLE hPreviousContact = INVALID_HANDLE_VALUE; +static HCONTACT hPreviousContact = (HCONTACT)INVALID_HANDLE_VALUE; static HANDLE hPreviousDbEvent = NULL; // Returns TRUE if the event already exist in the database @@ -240,7 +240,7 @@ BOOL IsDuplicateEvent(HCONTACT hContact, DBEVENTINFO& dbei) } } // reset last event - hPreviousContact = INVALID_HANDLE_VALUE; + hPreviousContact = (HCONTACT)INVALID_HANDLE_VALUE; return FALSE; } diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index d43a3b85ff..4e1ce74aa6 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -1328,7 +1328,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g case IDM_PRESENCE_NA: case IDM_PRESENCE_DND: case IDM_PRESENCE_FREE4CHAT: - if (HANDLE h = ppro->HContactFromJID(item->jid)) + if (HCONTACT h = ppro->HContactFromJID(item->jid)) ppro->OnMenuHandleDirectPresence((WPARAM)h, 0, gch->dwData); break; diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index c069d7fb31..04f05dd3e8 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -458,7 +458,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw); db_unset(hContact, "CList", "Hidden"); - chatRooms.insert(hContact); + chatRooms.insert((HANDLE)hContact); } else UpdateSubscriptionInfo(hContact, item); diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index fad43be645..fc34abf429 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -1276,7 +1276,7 @@ HANDLE __cdecl CJabberProto::GetAwayMsg(HCONTACT hContact) { debugLogA("GetAwayMsg called, hContact=%08X", hContact); - ForkThread(&CJabberProto::GetAwayMsgThread, hContact); + ForkThread(&CJabberProto::GetAwayMsgThread, (void*)hContact); return (HANDLE)1; } diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 9cdce62c55..56dc3e9807 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -496,7 +496,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para } else if (!_strnicmp(tContentType, "text/x-msnmsgr-datacast", 23)) { if (info->mJoinedContactsWLID.getCount()) { - HANDLE tContact; + HCONTACT tContact; if (info->mChatID[0]) { GC_INFO gci = { 0 }; diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 4e2a8bfb0e..704adaf6f4 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -106,13 +106,13 @@ void CMsnProto::MSN_AddAuthRequest(const char *email, const char *nick, const ch char* pCurBlob = (char*)alloca(pre.lParam); pre.szMessage = pCurBlob; - *(PDWORD)pCurBlob = 0; pCurBlob += sizeof(DWORD); // UID - *(PHANDLE)pCurBlob = hContact; pCurBlob += sizeof(HANDLE); // Contact Handle - strcpy(pCurBlob, nick); pCurBlob += nicklen + 1; // Nickname - *pCurBlob = '\0'; pCurBlob++; // First Name - *pCurBlob = '\0'; pCurBlob++; // Last Name - strcpy(pCurBlob, email); pCurBlob += emaillen + 1; // E-mail - strcpy(pCurBlob, reason); // Reason + *(PDWORD)pCurBlob = 0; pCurBlob += sizeof(DWORD); // UID + *(PDWORD)pCurBlob = (DWORD)hContact; pCurBlob += sizeof(DWORD); // Contact Handle + strcpy(pCurBlob, nick); pCurBlob += nicklen + 1; // Nickname + *pCurBlob = '\0'; pCurBlob++; // First Name + *pCurBlob = '\0'; pCurBlob++; // Last Name + strcpy(pCurBlob, email); pCurBlob += emaillen + 1; // E-mail + strcpy(pCurBlob, reason); // Reason ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre); } diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 8ce3a13620..7f4ad25621 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -846,7 +846,7 @@ void CMsnProto::MsnFakeAck(void* arg) Sleep(150); tParam->proto->ProtoBroadcastAck(tParam->hContact, ACKTYPE_MESSAGE, tParam->msg ? ACKRESULT_FAILED : ACKRESULT_SUCCESS, - (HCONTACT)tParam->id, LPARAM(tParam->msg)); + (HANDLE)tParam->id, LPARAM(tParam->msg)); delete tParam; } diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index 1c14409e74..f9d1c75b0a 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -361,7 +361,7 @@ void OmegleProto::ClearChat() } // TODO: Could this be done better? -HANDLE OmegleProto::GetChatHandle() +HCONTACT OmegleProto::GetChatHandle() { /*if (facy.chatHandle_ != NULL) return facy.chatHandle_; diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h index 0827d7616c..f274dc0174 100644 --- a/protocols/Omegle/src/proto.h +++ b/protocols/Omegle/src/proto.h @@ -132,7 +132,7 @@ public: void SetChatStatus(int); void ClearChat(); void SetTopic(const TCHAR *topic = NULL); - HANDLE GetChatHandle(); + HCONTACT GetChatHandle(); // Connection client Omegle_client facy; diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 49e0c528b7..3a6b431f96 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -1186,7 +1186,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { mir_free (ci.pszVal); } } - newlen = strlen(msgptr) + (pszUTFnick?strlen(pszUTFnick):0) + 9; + newlen = int(strlen(msgptr) + (pszUTFnick?strlen(pszUTFnick):0) + 9); if (pMsg = (char *)malloc(newlen)) { sprintf (pMsg, "** %s%s%s **", (pszUTFnick?pszUTFnick:""),(pszUTFnick?" ":""),(char*)msgptr); free (ptr); @@ -1211,9 +1211,9 @@ void FetchMessageThread(fetchmsg_arg *pargs) { __leave; } #ifdef _UNICODE - msglen = strlen(msg)+1; + msglen = (int)strlen(msg)+1; msgptr = (char*)make_unicode_string ((const unsigned char*)msgptr); - wcLen = (_tcslen((TCHAR*)msgptr)+1)*sizeof(TCHAR); + wcLen = int(_tcslen((TCHAR*)msgptr)+1)*sizeof(TCHAR); msg=(char*)realloc(msg, msglen+wcLen); memcpy (msg+msglen, msgptr, wcLen); free(msgptr); @@ -1222,8 +1222,9 @@ void FetchMessageThread(fetchmsg_arg *pargs) { msgptr = msg; free (ptr); } - msglen = strlen(msgptr)+1; - } else { + msglen = (int)strlen(msgptr)+1; + } + else { free (ptr); __leave; } @@ -1258,7 +1259,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { gce.ptszText = (TCHAR*)(msgptr+msglen); gce.dwFlags = GCEF_ADDTOLOG; CallService(MS_GC_EVENT, 0, (LPARAM)&gce); - MsgList_Add (pre.lParam, INVALID_HANDLE_VALUE); // Mark as groupchat + MsgList_Add(pre.lParam, INVALID_HANDLE_VALUE); // Mark as groupchat if (ci.pszVal) mir_free (ci.pszVal); free_nonutf_tchar_string((void*)gce.ptszUID); free_nonutf_tchar_string((void*)gcd.ptszID); @@ -1298,7 +1299,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { if (pre.flags & PREF_CREATEREAD) dbei.flags|=DBEF_READ; if (pre.flags & PREF_UTF) dbei.flags|=DBEF_UTF; dbei.eventType=EVENTTYPE_MESSAGE; - pme = MsgList_Add (pre.lParam, db_event_add(hContact, &dbei)); + pme = MsgList_Add(pre.lParam, db_event_add(hContact, &dbei)); // We could call MS_PROTO_CHAINSEND if we want to have MetaContact adding the history for us, // however we all know that CCSDATA doesn't contain timestamp-information which is @@ -1877,7 +1878,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) if((WORD)SkypeStatusToMiranda(ptr+13) != ID_STATUS_OFFLINE) { LOG(("WndProc Status is not offline so get user info")); - pthread_create(GetInfoThread, hContact); + pthread_create(GetInfoThread, (void*)hContact); } } } @@ -2273,7 +2274,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) break; } --iReentranceCnt; - return (DefWindowProc(hWndDlg, message, wParam, lParam)); + return DefWindowProc(hWndDlg, message, wParam, lParam); } LOG(("WM_COPYDATA exit (%08X)", message)); if (szSkypeMsg) free(szSkypeMsg); @@ -2358,17 +2359,16 @@ INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam) return iRet; } -int __stdcall SendBroadcast( HCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam ) +int __stdcall SendBroadcast(HCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam) { - ACKDATA ack = {0}; - ack.cbSize = sizeof( ACKDATA ); + ACKDATA ack = { sizeof( ACKDATA ) }; ack.szModule = SKYPE_PROTONAME; ack.hContact = hContact; ack.type = type; ack.result = result; ack.hProcess = hProcess; ack.lParam = lParam; - return CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack ); + return CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack ); } static void __cdecl SkypeGetAwayMessageThread(void *hContact) @@ -2387,7 +2387,7 @@ INT_PTR SkypeGetAwayMessage(WPARAM wParam,LPARAM lParam) UNREFERENCED_PARAMETER(wParam); - pthread_create(SkypeGetAwayMessageThread, ccs->hContact); + pthread_create(SkypeGetAwayMessageThread, (void*)ccs->hContact); return 1; } @@ -2649,7 +2649,7 @@ INT_PTR SkypeGetInfo(WPARAM wParam,LPARAM lParam) { UNREFERENCED_PARAMETER(wParam); - pthread_create(GetInfoThread, ccs->hContact); + pthread_create(GetInfoThread, (void*)ccs->hContact); return 0; } @@ -2932,7 +2932,7 @@ void CleanupNicknames(char *dummy) { continue; } db_unset(hContact, SKYPE_PROTONAME, "Nick"); - GetInfoThread(hContact); + GetInfoThread((void*)hContact); db_free(&dbv); db_free(&dbv2); } diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp index 84e886b61a..310d26b975 100644 --- a/protocols/SkypeClassic/src/skypeapi.cpp +++ b/protocols/SkypeClassic/src/skypeapi.cpp @@ -811,14 +811,13 @@ static INT_PTR CALLBACK CallstatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, case WM_INITDIALOG: { HCONTACT hContact; - char *szProto; if (!db_get_s((HCONTACT)lParam, SKYPE_PROTONAME, "CallId", &dbv)) { // Check, if another call is in progress for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) { - szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 ); - if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) && hContact!=(HANDLE)lParam && + char *szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 ); + if (szProto != NULL && !strcmp(szProto, SKYPE_PROTONAME) && hContact != (HCONTACT)lParam && db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0) == 0 && !db_get_s(hContact, SKYPE_PROTONAME, "CallId", &dbv2)) { diff --git a/protocols/SkypeClassic/src/voiceservice.cpp b/protocols/SkypeClassic/src/voiceservice.cpp index 11b1f1becd..93181d0d4c 100644 --- a/protocols/SkypeClassic/src/voiceservice.cpp +++ b/protocols/SkypeClassic/src/voiceservice.cpp @@ -40,14 +40,11 @@ static INT_PTR VoiceGetInfo(WPARAM wParam, LPARAM lParam) return VOICE_SUPPORTED | VOICE_CALL_CONTACT | VOICE_CAN_HOLD; } -static HANDLE FindContactByCallId(char *callId) +static HCONTACT FindContactByCallId(char *callId) { HCONTACT hContact; int iCmpRes; - for (hContact = db_find_first(); - hContact != NULL; - hContact = db_find_next(hContact)) - { + for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { char *szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); DBVARIANT dbv; @@ -58,7 +55,8 @@ static HANDLE FindContactByCallId(char *callId) { iCmpRes = strcmp(callId, dbv.pszVal); db_free(&dbv); - if (iCmpRes == 0) return hContact; + if (iCmpRes == 0) + return hContact; } } diff --git a/protocols/Tlen/src/tlen_misc.cpp b/protocols/Tlen/src/tlen_misc.cpp index 670d014fc6..6aed4ecadc 100644 --- a/protocols/Tlen/src/tlen_misc.cpp +++ b/protocols/Tlen/src/tlen_misc.cpp @@ -63,7 +63,7 @@ void TlenDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick) cbBlob = sizeof(DWORD) + sizeof(HANDLE) + (int)strlen(nick) + (int)strlen(jid) + 5; pBlob = pCurBlob = (PBYTE) mir_alloc(cbBlob); *((PDWORD)pCurBlob) = 0; pCurBlob += sizeof(DWORD); - *((PHANDLE)pCurBlob) = hContact; pCurBlob += sizeof(DWORD); + *((PDWORD)pCurBlob) = (DWORD)hContact; pCurBlob += sizeof(DWORD); strcpy((char *) pCurBlob, nick); pCurBlob += strlen(nick)+1; *pCurBlob = '\0'; pCurBlob++; //firstName *pCurBlob = '\0'; pCurBlob++; //lastName diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 034bfd0ea8..479026eb1b 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -219,7 +219,7 @@ HCONTACT TlenProtocol::AddToList(int flags, PROTOSEARCHRESULT *psr) HCONTACT hContact; TLEN_SEARCH_RESULT *jsr = (TLEN_SEARCH_RESULT*)psr; if (jsr->hdr.cbSize != sizeof(TLEN_SEARCH_RESULT)) - return (int) NULL; + return NULL; hContact = AddToListByJID(this, jsr->jid, flags); // wParam is flag e.g. PALF_TEMPORARY return hContact; } @@ -228,16 +228,16 @@ HCONTACT TlenProtocol::AddToListByEvent( int flags, int iContact, HANDLE hDbEven { DBEVENTINFO dbei = { sizeof(dbei) }; if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1)) - return (HANDLE) NULL; + return NULL; if ((dbei.pBlob=(PBYTE) mir_alloc(dbei.cbBlob)) == NULL) - return (HANDLE) NULL; + return NULL; if (db_event_get(hDbEvent, &dbei)) { mir_free(dbei.pBlob); - return (HANDLE) NULL; + return NULL; } if (strcmp(dbei.szModule, m_szModuleName)) { mir_free(dbei.pBlob); - return (HANDLE) NULL; + return NULL; } /* @@ -249,7 +249,7 @@ HCONTACT TlenProtocol::AddToListByEvent( int flags, int iContact, HANDLE hDbEven if (dbei.eventType != EVENTTYPE_AUTHREQUEST) { mir_free(dbei.pBlob); - return (HANDLE) NULL; + return NULL; } char *nick = (char *)dbei.pBlob + sizeof(DWORD)*2; diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp index 9d8de71c0e..81891adc44 100644 --- a/protocols/Twitter/src/theme.cpp +++ b/protocols/Twitter/src/theme.cpp @@ -68,7 +68,7 @@ static TwitterProto * GetInstanceByHContact(HCONTACT hContact) template INT_PTR GlobalService(WPARAM wParam,LPARAM lParam) { - TwitterProto *proto = GetInstanceByHContact(reinterpret_cast(wParam)); + TwitterProto *proto = GetInstanceByHContact(HCONTACT(wParam)); return proto ? (proto->*Fcn)(wParam,lParam) : 0; } @@ -76,7 +76,7 @@ static int PrebuildContactMenu(WPARAM wParam,LPARAM lParam) { ShowContactMenus(false); - TwitterProto *proto = GetInstanceByHContact(reinterpret_cast(wParam)); + TwitterProto *proto = GetInstanceByHContact(HCONTACT(wParam)); return proto ? proto->OnPrebuildContactMenu(wParam,lParam) : 0; } diff --git a/protocols/Xfire/src/Xfire_avatar_loader.cpp b/protocols/Xfire/src/Xfire_avatar_loader.cpp index 2e509d3b35..674329f762 100644 --- a/protocols/Xfire/src/Xfire_avatar_loader.cpp +++ b/protocols/Xfire/src/Xfire_avatar_loader.cpp @@ -66,7 +66,8 @@ void Xfire_avatar_loader::loadThread(LPVOID lparam) { return; } -BOOL Xfire_avatar_loader::loadAvatar(HANDLE hcontact,char*username,unsigned int userid) { +BOOL Xfire_avatar_loader::loadAvatar(HCONTACT hcontact,char*username,unsigned int userid) +{ Xfire_avatar_process process={0}; //struktur füllen diff --git a/protocols/Xfire/src/Xfire_avatar_loader.h b/protocols/Xfire/src/Xfire_avatar_loader.h index a51082629e..c6305270d1 100644 --- a/protocols/Xfire/src/Xfire_avatar_loader.h +++ b/protocols/Xfire/src/Xfire_avatar_loader.h @@ -37,7 +37,7 @@ using namespace xfirelib; struct Xfire_avatar_process { - HANDLE hcontact; + HCONTACT hcontact; char username[128]; unsigned int userid; }; @@ -50,7 +50,7 @@ private: public: vector list; BOOL threadrunning; - BOOL loadAvatar(HANDLE hcontact,char*username,unsigned int userid); + BOOL loadAvatar(HCONTACT hcontact,char*username,unsigned int userid); Xfire_avatar_loader(xfirelib::Client* client); ~Xfire_avatar_loader(); }; diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index bc9e744231..51d217717f 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -221,7 +221,7 @@ class XFireClient : public PacketListener { void getBuddyList(); void sendmsg(char*usr,char*msg); void setNick(char*nnick); - void handlingBuddy(HANDLE handle); + void handlingBuddy(HCONTACT handle); void CheckAvatar(BuddyListEntry* entry); private: @@ -259,11 +259,12 @@ void XFireClient::CheckAvatar(BuddyListEntry* entry) { } } -void XFireClient::handlingBuddy(HANDLE handle){ +void XFireClient::handlingBuddy(HCONTACT handle) +{ vector *entries = client->getBuddyList()->getEntries(); for(uint i = 0 ; i < entries->size() ; i ++) { BuddyListEntry *entry = entries->at(i); - if (entry->hcontact==handle) + if (entry->hcontact == handle) { handlingBuddys(entry,0,NULL); break; @@ -1373,10 +1374,10 @@ INT_PTR SendMessage(WPARAM wParam, LPARAM lParam) if (myClient->client->connected&&db_get_w(ccs->hContact, protocolname, "Status", -1)!=ID_STATUS_OFFLINE) { myClient->sendmsg(dbv.pszVal, ptrA( mir_utf8encode((char*)ccs->lParam))); - mir_forkthread(SendAck,ccs->hContact); + mir_forkthread(SendAck, (void*)ccs->hContact); sended=1; } - else mir_forkthread(SendBadAck,ccs->hContact); + else mir_forkthread(SendBadAck, (void*)ccs->hContact); db_free(&dbv); return sended; @@ -1684,7 +1685,7 @@ HCONTACT CList_FindContact (int uid) void CList_MakeAllOffline() { - vector fhandles; + vector fhandles; for (HCONTACT hContact = db_find_first(protocolname); hContact; hContact = db_find_next(hContact, protocolname)) { //freunde von freunden in eine seperate liste setzen //nur wenn das nicht abgestellt wurde diff --git a/protocols/Xfire/src/recvremovebuddypacket.h b/protocols/Xfire/src/recvremovebuddypacket.h index 87c75c0012..842163ad1a 100644 --- a/protocols/Xfire/src/recvremovebuddypacket.h +++ b/protocols/Xfire/src/recvremovebuddypacket.h @@ -29,26 +29,26 @@ #define XFIRE_RECVREMOVEBUDDYPACKET 139 namespace xfirelib { - class RecvRemoveBuddyPacket : public XFireRecvPacketContent { - public: - virtual ~RecvRemoveBuddyPacket() { } - int getPacketId() { return XFIRE_RECVREMOVEBUDDYPACKET; } - - XFirePacketContent *newPacket() { return new RecvRemoveBuddyPacket(); } - void parseContent(char *buf, int length, int numberOfAtts); - - long userid; - - /** - * I've added this attribute altough it is not part of the actual packet - * because by the time the packet content reaches the client - * application the user will no longer be in the BuddyList .. so no - * way for the client application to know which buddy was just removed. - * (it will be set by the BuddyList, not when parsing the packet) - */ - std::string username; - void* handle; // handle eingefügt, damit ich schnell den buddy killen kann - dufte - }; + class RecvRemoveBuddyPacket : public XFireRecvPacketContent { + public: + virtual ~RecvRemoveBuddyPacket() { } + int getPacketId() { return XFIRE_RECVREMOVEBUDDYPACKET; } + + XFirePacketContent *newPacket() { return new RecvRemoveBuddyPacket(); } + void parseContent(char *buf, int length, int numberOfAtts); + + long userid; + + /** + * I've added this attribute altough it is not part of the actual packet + * because by the time the packet content reaches the client + * application the user will no longer be in the BuddyList .. so no + * way for the client application to know which buddy was just removed. + * (it will be set by the BuddyList, not when parsing the packet) + */ + std::string username; + HCONTACT handle; // handle eingefügt, damit ich schnell den buddy killen kann - dufte + }; }; diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp index bb30eccb98..d2301f4fe6 100644 --- a/protocols/Xfire/src/userdetails.cpp +++ b/protocols/Xfire/src/userdetails.cpp @@ -85,7 +85,7 @@ void SetItemTxt(HWND hwndDlg,int feldid,char*feld,HCONTACT hcontact,int type) } } -static int GetIPPortUDetails(HANDLE wParam,char* feld1,char* feld2) +static int GetIPPortUDetails(HCONTACT wParam,char* feld1,char* feld2) { char temp[255]; HGLOBAL clipbuffer; @@ -185,7 +185,7 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam static WCHAR wpath[256]; static HICON gameicon=0; static HICON voiceicon=0; - static HANDLE uhandle=0; + static HCONTACT uhandle=0; static HWND listbox; LVCOLUMNA pcol; diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index 224c65677b..fc295a4a42 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -174,7 +174,7 @@ void __cdecl CYahooProto::im_sendackfail_longmsg(void *hContact) int __cdecl CYahooProto::SendMsg(HCONTACT hContact, int flags, const char* pszSrc) { if (!m_bLoggedIn) {/* don't send message if we not connected! */ - ForkThread(&CYahooProto::im_sendackfail, hContact); + ForkThread(&CYahooProto::im_sendackfail, (void*)hContact); return 1; } @@ -187,7 +187,7 @@ int __cdecl CYahooProto::SendMsg(HCONTACT hContact, int flags, const char* pszSr msg = mir_utf8encode(pszSrc); if (lstrlenA(msg) > 800) { - ForkThread(&CYahooProto::im_sendackfail_longmsg, hContact); + ForkThread(&CYahooProto::im_sendackfail_longmsg, (void*)hContact); return 1; } @@ -195,7 +195,7 @@ int __cdecl CYahooProto::SendMsg(HCONTACT hContact, int flags, const char* pszSr if (!getString(hContact, YAHOO_LOGINID, &dbv)) { send_msg(dbv.pszVal, getWord(hContact, "yprotoid", 0), msg, 1); - ForkThread(&CYahooProto::im_sendacksuccess, hContact); + ForkThread(&CYahooProto::im_sendacksuccess, (void*)hContact); db_free(&dbv); return 1; @@ -232,7 +232,7 @@ INT_PTR __cdecl CYahooProto::SendNudge(WPARAM wParam, LPARAM lParam) debugLogA("[YAHOO_SENDNUDGE]"); if (!m_bLoggedIn) {/* don't send nudge if we not connected! */ - ForkThread(&CYahooProto::im_sendackfail, hContact); + ForkThread(&CYahooProto::im_sendackfail, (void*)hContact); return 1; } @@ -241,7 +241,7 @@ INT_PTR __cdecl CYahooProto::SendNudge(WPARAM wParam, LPARAM lParam) send_msg(dbv.pszVal, getWord(hContact, "yprotoid", 0), "", 0); db_free(&dbv); - ForkThread(&CYahooProto::im_sendacksuccess, hContact); + ForkThread(&CYahooProto::im_sendacksuccess, (void*)hContact); return 1; } diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index b97c79b396..b607385fa0 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -339,7 +339,7 @@ void __cdecl CYahooProto::get_info_thread(void *hContact) int __cdecl CYahooProto::GetInfo(HCONTACT hContact, int /*infoType*/ ) { - ForkThread(&CYahooProto::get_info_thread, hContact); + ForkThread(&CYahooProto::get_info_thread, (void*)hContact); return 0; } @@ -591,7 +591,7 @@ HANDLE __cdecl CYahooProto::GetAwayMsg(HCONTACT hContact) if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) return 0; /* user offline, what Status message? */ - ForkThread(&CYahooProto::get_status_thread, hContact); + ForkThread(&CYahooProto::get_status_thread, (void*)hContact); return (HANDLE)1; //Success } diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 9c5edf2f63..ef7fcfb7c0 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -831,36 +831,36 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha if (msg != NULL) pre.lParam += lstrlenA(msg); - pCurBlob=(PBYTE)malloc(pre.lParam); + pCurBlob = (PBYTE)malloc(pre.lParam); pre.szMessage = (char *)pCurBlob; // UIN - *( PDWORD )pCurBlob = 0; - pCurBlob+=sizeof(DWORD); + *(PDWORD)pCurBlob = 0; + pCurBlob += sizeof(DWORD); // hContact - *( PHANDLE )pCurBlob = hContact; - pCurBlob+=sizeof(HANDLE); + *(PDWORD)pCurBlob = (DWORD)hContact; + pCurBlob += sizeof(DWORD); // NICK - lstrcpyA((char *)pCurBlob, nick); + lstrcpyA((char*)pCurBlob, nick); pCurBlob+=lstrlenA((char *)pCurBlob)+1; // FIRST - lstrcpyA((char *)pCurBlob, (fname != NULL) ? fname : ""); + lstrcpyA((char*)pCurBlob, (fname != NULL) ? fname : ""); pCurBlob+=lstrlenA((char *)pCurBlob)+1; // LAST - lstrcpyA((char *)pCurBlob, (lname != NULL) ? lname : ""); + lstrcpyA((char*)pCurBlob, (lname != NULL) ? lname : ""); pCurBlob+=lstrlenA((char *)pCurBlob)+1; // E-mail - lstrcpyA((char *)pCurBlob,who); + lstrcpyA((char*)pCurBlob,who); pCurBlob+=lstrlenA((char *)pCurBlob)+1; // Reason - lstrcpyA((char *)pCurBlob, (msg != NULL) ? msg : ""); + lstrcpyA((char*)pCurBlob, (msg != NULL) ? msg : ""); ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre); } diff --git a/src/core/stdauth/authdialogs.cpp b/src/core/stdauth/authdialogs.cpp index 7c367b78d1..d66941dd31 100644 --- a/src/core/stdauth/authdialogs.cpp +++ b/src/core/stdauth/authdialogs.cpp @@ -96,7 +96,7 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA, (LONG_PTR)hContact); - if (hContact == INVALID_HANDLE_VALUE || !db_get_b(hContact, "CList", "NotOnList", 0)) + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE || !db_get_b(hContact, "CList", "NotOnList", 0)) ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); } return TRUE; @@ -106,14 +106,14 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case IDC_ADD: { ADDCONTACTSTRUCT acs = {0}; - acs.handle = hDbEvent; + acs.hDbEvent = hDbEvent; acs.handleType = HANDLE_EVENT; acs.szProto = ""; CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); HCONTACT hContact = (HCONTACT)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA); - if ((hContact == INVALID_HANDLE_VALUE) || !db_get_b(hContact, "CList", "NotOnList", 0)) - ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); + if ((hContact == (HCONTACT)INVALID_HANDLE_VALUE) || !db_get_b(hContact, "CList", "NotOnList", 0)) + ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); break; } case IDC_DETAILS: @@ -126,7 +126,7 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case IDOK: { ADDCONTACTSTRUCT acs = {0}; - acs.handle = hDbEvent; + acs.hDbEvent = hDbEvent; acs.handleType = HANDLE_EVENT; acs.szProto = ""; CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); @@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr); SetDlgItemText(hwndDlg, IDC_REASON, reasonT); - if (hContact == INVALID_HANDLE_VALUE || !db_get_b(hContact, "CList", "NotOnList", 0)) + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE || !db_get_b(hContact, "CList", "NotOnList", 0)) ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE); SendDlgItemMessage(hwndDlg, IDC_DENYREASON, EM_LIMITTEXT, 255, 0); @@ -250,7 +250,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (IsDlgButtonChecked(hwndDlg, IDC_ADDCHECK)) { ADDCONTACTSTRUCT acs = {0}; - acs.handle = hDbEvent; + acs.hDbEvent = hDbEvent; acs.handleType = HANDLE_EVENT; acs.szProto = ""; CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); diff --git a/src/core/stdfile/filerecvdlg.cpp b/src/core/stdfile/filerecvdlg.cpp index ca00c0f642..b98aa94ea6 100644 --- a/src/core/stdfile/filerecvdlg.cpp +++ b/src/core/stdfile/filerecvdlg.cpp @@ -395,9 +395,9 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break; case IDC_ADD: - { ADDCONTACTSTRUCT acs = {0}; - - acs.handle = dat->hContact; + { + ADDCONTACTSTRUCT acs = {0}; + acs.hContact = dat->hContact; acs.handleType = HANDLE_CONTACT; acs.szProto = ""; CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 47b867c439..1861bf13af 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -1308,7 +1308,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; case HM_DBEVENTADDED: - if ((HANDLE)wParam == dat->hContact) { + if ((HCONTACT)wParam == dat->hContact) { HANDLE hDbEvent = (HANDLE)lParam; if (dat->hDbEventFirst == NULL) dat->hDbEventFirst = hDbEvent; @@ -1531,7 +1531,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_ADD: { ADDCONTACTSTRUCT acs = { 0 }; - acs.handle = dat->hContact; + acs.hContact = dat->hContact; acs.handleType = HANDLE_CONTACT; acs.szProto = 0; CallService(MS_ADDCONTACT_SHOW, (WPARAM) hwndDlg, (LPARAM) & acs); diff --git a/src/core/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp index a82ef7510c..9a654fa9ff 100644 --- a/src/core/stdurl/urldialogs.cpp +++ b/src/core/stdurl/urldialogs.cpp @@ -212,10 +212,8 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_ADD: { ADDCONTACTSTRUCT acs = {0}; - - acs.handle = dat->hContact; + acs.hContact = dat->hContact; acs.handleType = HANDLE_CONTACT; - acs.szProto = 0; CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); } if ( !db_get_b(dat->hContact, "CList", "NotOnList", 0)) { @@ -608,7 +606,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_ADD: ADDCONTACTSTRUCT acs = {0}; - acs.handle = dat->hContact; + acs.hContact = dat->hContact; acs.handleType = HANDLE_CONTACT; acs.szProto = 0; CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); diff --git a/src/modules/addcontact/addcontact.cpp b/src/modules/addcontact/addcontact.cpp index c44183faba..2659705072 100644 --- a/src/modules/addcontact/addcontact.cpp +++ b/src/modules/addcontact/addcontact.cpp @@ -42,25 +42,25 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp DBEVENTINFO dbei = { sizeof(dbei) }; dbei.cbBlob = sizeof(DWORD); dbei.pBlob = (PBYTE)&dwUin; - db_event_get(acs->handle, &dbei); + db_event_get(acs->hDbEvent, &dbei); _ltoa(dwUin, szUin, 10); acs->szProto = dbei.szModule; } { TCHAR *szName = NULL, *tmpStr = NULL; if (acs->handleType == HANDLE_CONTACT) - szName = cli.pfnGetContactDisplayName((HCONTACT)acs->handle, GCDNF_TCHAR); + szName = cli.pfnGetContactDisplayName(acs->hContact, GCDNF_TCHAR); else { int isSet = 0; if (acs->handleType == HANDLE_EVENT) { DBEVENTINFO dbei = { sizeof(dbei) }; - dbei.cbBlob = db_event_getBlobSize(acs->handle); + dbei.cbBlob = db_event_getBlobSize(acs->hDbEvent); dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob); - db_event_get(acs->handle, &dbei); + db_event_get(acs->hDbEvent, &dbei); HCONTACT hcontact = *(HCONTACT*)(dbei.pBlob + sizeof(DWORD)); mir_free(dbei.pBlob); - if (hcontact != INVALID_HANDLE_VALUE) { + if (hcontact != (HCONTACT)INVALID_HANDLE_VALUE) { szName = cli.pfnGetContactDisplayName(hcontact, 0); isSet = 1; } @@ -81,9 +81,9 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp } } - if (acs->handleType == HANDLE_CONTACT && acs->handle) + if (acs->handleType == HANDLE_CONTACT && acs->hContact) if (acs->szProto == NULL || (acs->szProto != NULL && *acs->szProto == 0)) - acs->szProto = GetContactProto((HCONTACT)acs->handle); + acs->szProto = GetContactProto(acs->hContact); { TCHAR *grpName; @@ -152,8 +152,8 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp case HANDLE_EVENT: { DBEVENTINFO dbei = { sizeof(dbei) }; - db_event_get(acs->handle, &dbei); - hContact = (HCONTACT)CallProtoServiceInt(NULL, dbei.szModule, PS_ADDTOLISTBYEVENT, 0, (LPARAM)acs->handle); + db_event_get(acs->hDbEvent, &dbei); + hContact = (HCONTACT)CallProtoServiceInt(NULL, dbei.szModule, PS_ADDTOLISTBYEVENT, 0, (LPARAM)acs->hDbEvent); } break; @@ -162,7 +162,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp break; case HANDLE_CONTACT: - hContact = (HCONTACT)acs->handle; + hContact = acs->hContact; break; } diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index c07c11441c..f087f87039 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -397,7 +397,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, TCHAR szFullName[512]; int i, nameLen, eq; //check name of group and ignore message if just being expanded/collapsed - if (cli.pfnFindItem(hwnd, dat, (HCONTACT)(groupId | HCONTACT_ISGROUP), &contact, &group, NULL)) { + if (cli.pfnFindItem(hwnd, dat, (HANDLE)(groupId | HCONTACT_ISGROUP), &contact, &group, NULL)) { lstrcpy(szFullName, contact->szText); while (group->parent) { for (i=0; i < group->parent->cl.count; i++) @@ -459,7 +459,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN) break; if (dbcws->value.type == DBVT_DELETED || dbcws->value.bVal == 0) { - if (cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, NULL, NULL, NULL)) + if (cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, NULL, NULL, NULL)) break; cli.pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, 1, 1); cli.pfnNotifyNewContact(hwnd, (HCONTACT)wParam); @@ -475,7 +475,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, { WORD iExtraImage[EXTRA_ICON_COUNT]; BYTE flags = 0; - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) memset(iExtraImage, 0xFF, sizeof(iExtraImage)); else { memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); @@ -485,7 +485,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b((HCONTACT)wParam, "CList", "Hidden", 0)) { NMCLISTCONTROL nm; cli.pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, 1, 1); - if (cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { + if (cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); if (flags & CONTACTF_CHECKED) contact->flags |= CONTACTF_CHECKED; @@ -522,13 +522,13 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, contact = NULL; group = NULL; - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL)) { + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) { if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) hSelItem = (HCONTACT)cli.pfnContactToHItem(selcontact); cli.pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, (style & CLS_CONTACTLIST) == 0, 0); recalcScrollBar = 1; - cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL); + cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL); if (contact) { contact->iImage = (WORD) lParam; cli.pfnNotifyNewContact(hwnd, (HCONTACT)wParam); @@ -556,7 +556,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, } if (hSelItem) { ClcGroup *selgroup; - if (cli.pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) + if (cli.pfnFindItem(hwnd, dat, (HANDLE)hSelItem, &selcontact, &selgroup, NULL)) dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact)); else dat->selection = -1; @@ -566,7 +566,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; case INTM_NAMECHANGED: - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HCONTACT)wParam, 0), SIZEOF(contact->szText)); @@ -575,7 +575,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; case INTM_PROTOCHANGED: - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; contact->proto = GetContactProto((HCONTACT)wParam); @@ -585,7 +585,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; case INTM_NOTONLISTCHANGED: - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; if (contact->type == CLCIT_CONTACT) { @@ -603,7 +603,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; case INTM_APPARENTMODECHANGED: - if (cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { + if (cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { char *szProto = GetContactProto((HCONTACT)wParam); if (szProto == NULL) break; @@ -625,7 +625,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; case INTM_IDLECHANGED: - if (cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { + if (cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { char *szProto = GetContactProto((HCONTACT)wParam); if (szProto == NULL) break; @@ -890,7 +890,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, it.rcItem.bottom = it.rcItem.top + cli.pfnGetRowHeight(dat, hit); OffsetRect(&it.rcItem, ptClientOffset.x, ptClientOffset.y); it.isGroup = contact->type == CLCIT_GROUP; - it.hItem = contact->type == CLCIT_GROUP ? (HANDLE) contact->groupId : contact->hContact; + it.hItem = (contact->type == CLCIT_GROUP) ? (HANDLE)contact->groupId : (HANDLE)contact->hContact; it.cbSize = sizeof(it); dat->hInfoTipItem = cli.pfnContactToHItem(contact); NotifyEventHooks(hShowInfoTipEvent, 0, (LPARAM) & it); diff --git a/src/modules/clist/clcidents.cpp b/src/modules/clist/clcidents.cpp index 5ec0b48600..7165d61b48 100644 --- a/src/modules/clist/clcidents.cpp +++ b/src/modules/clist/clcidents.cpp @@ -96,12 +96,12 @@ int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contac } if (nowVisible) index++; - if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP - && ((unsigned) hItem & ~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || (IsHContactContact(hItem) - && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT - && group->cl.items[group->scanIndex]->hContact == hItem) || (IsHContactInfo(hItem) - && group->cl.items[group->scanIndex]->type == CLCIT_INFO - && group->cl.items[group->scanIndex]->hContact == (HANDLE) ((UINT_PTR)hItem & ~HCONTACT_ISINFO))) + if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && + ((unsigned) hItem & ~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || (IsHContactContact(hItem) && + group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && + group->cl.items[group->scanIndex]->hContact == (HCONTACT)hItem) || (IsHContactInfo(hItem) && + group->cl.items[group->scanIndex]->type == CLCIT_INFO && + group->cl.items[group->scanIndex]->hContact == (HCONTACT)((UINT_PTR)hItem & ~HCONTACT_ISINFO))) { if (isVisible) { if (!nowVisible) @@ -180,11 +180,11 @@ HANDLE fnContactToHItem(ClcContact *contact) { switch (contact->type) { case CLCIT_CONTACT: - return contact->hContact; + return (HANDLE)contact->hContact; case CLCIT_GROUP: - return (HCONTACT)(contact->groupId | HCONTACT_ISGROUP); + return (HANDLE)(contact->groupId | HCONTACT_ISGROUP); case CLCIT_INFO: - return (HCONTACT)((UINT_PTR)contact->hContact | HCONTACT_ISINFO); + return (HANDLE)((UINT_PTR)contact->hContact | HCONTACT_ISINFO); } return NULL; } @@ -193,15 +193,15 @@ HANDLE fnContactToItemHandle(ClcContact *contact, DWORD *nmFlags) { switch (contact->type) { case CLCIT_CONTACT: - return contact->hContact; + return (HANDLE)contact->hContact; case CLCIT_GROUP: if (nmFlags) *nmFlags |= CLNF_ISGROUP; - return (HCONTACT)contact->groupId; + return (HANDLE)contact->groupId; case CLCIT_INFO: if (nmFlags) *nmFlags |= CLNF_ISINFO; - return (HCONTACT)((UINT_PTR)contact->hContact | HCONTACT_ISINFO); + return (HANDLE)((UINT_PTR)contact->hContact | HCONTACT_ISINFO); } return NULL; } diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index 0a66b5933e..690de3c4cb 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -316,7 +316,7 @@ void fnDeleteItemFromTree(HWND hwnd, HCONTACT hItem) struct ClcData *dat = (struct ClcData *) GetWindowLongPtr(hwnd, 0); dat->needsResort = 1; - if (!cli.pfnFindItem(hwnd, dat, hItem, &contact, &group, NULL)) { + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)hItem, &contact, &group, NULL)) { DBVARIANT dbv; int i, nameOffset; if (!IsHContactContact(hItem)) @@ -569,7 +569,7 @@ void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort) group->scanIndex++; } if (hSelItem) - if (cli.pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) + if (cli.pfnFindItem(hwnd, dat, (HANDLE)hSelItem, &selcontact, &selgroup, NULL)) dat->selection = cli.pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact)); cli.pfnRecalcScrollBar(hwnd, dat); @@ -685,7 +685,7 @@ void fnSaveStateAndRebuildList(HWND hwnd, struct ClcData *dat) if (saveInfo[i].parentId == -1) group = &dat->list; else { - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)(saveInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)(saveInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL)) continue; group = contact->group; } diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp index f1cc63ed18..9ce6f5c3a9 100644 --- a/src/modules/clist/clcmsgs.cpp +++ b/src/modules/clist/clcmsgs.cpp @@ -59,7 +59,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR if (cii->hParentGroup == NULL) group = &dat->list; else { - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)((UINT_PTR)cii->hParentGroup | HCONTACT_ISGROUP), &groupContact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)((UINT_PTR)cii->hParentGroup | HCONTACT_ISGROUP), &groupContact, NULL, NULL)) return NULL; group = groupContact->group; } @@ -97,7 +97,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR { ClcContact *contact; ClcGroup *group, *tgroup; - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) break; for (tgroup = group; tgroup; tgroup = tgroup->parent) cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1); @@ -108,7 +108,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_EXPAND: { ClcContact *contact; - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; if (contact->type != CLCIT_GROUP) break; @@ -117,12 +117,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR } case CLM_FINDCONTACT: - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, NULL, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, NULL, NULL, NULL)) return NULL; return wParam; case CLM_FINDGROUP: - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)(wParam | HCONTACT_ISGROUP), NULL, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)(wParam | HCONTACT_ISGROUP), NULL, NULL, NULL)) return NULL; return wParam | HCONTACT_ISGROUP; @@ -132,7 +132,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETCHECKMARK: { ClcContact *contact; - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; return (contact->flags & CONTACTF_CHECKED) != 0; } @@ -146,7 +146,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETEXPAND: { ClcContact *contact; - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return CLE_INVALID; if (contact->type != CLCIT_GROUP) return CLE_INVALID; @@ -164,7 +164,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETEXTRAIMAGE: if (LOWORD(lParam) < dat->extraColumnsCount) { ClcContact *contact; - if (cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return contact->iExtraImage[LOWORD(lParam)]; } return EMPTY_EXTRA_ICON; @@ -190,7 +190,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETITEMTEXT: { ClcContact *contact; - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; lstrcpy((TCHAR*) lParam, contact->szText); return lstrlen(contact->szText); @@ -199,7 +199,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETITEMTYPE: { ClcContact *contact; - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return CLCIT_INVALID; return contact->type; } @@ -217,7 +217,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcContact *contact; ClcGroup *group; - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)lParam, &contact, &group, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)lParam, &contact, &group, NULL)) return NULL; int i = List_IndexOf((SortedList*)&group->cl, contact); @@ -320,7 +320,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR { ClcContact *contact; ClcGroup *group, *tgroup; - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) break; for (tgroup = group; tgroup; tgroup = tgroup->parent) cli.pfnSetGroupExpand(hwnd, dat, tgroup, 1); @@ -353,7 +353,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_SETCHECKMARK: { ClcContact *contact; - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; if (lParam) contact->flags |= CONTACTF_CHECKED; @@ -375,7 +375,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_SETEXTRAIMAGE: if ( LOWORD(lParam) < dat->extraColumnsCount) { ClcContact *contact; - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) return 0; contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam); @@ -433,7 +433,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_SETITEMTEXT: { ClcContact *contact; - if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; lstrcpyn(contact->szText, (TCHAR*)lParam, SIZEOF(contact->szText)); cli.pfnSortCLC(hwnd, dat, 1); diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 49946868c7..d5cb14fdbf 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -640,7 +640,7 @@ void fnNotifyNewContact(HWND hwnd, HCONTACT hContact) nm.hdr.hwndFrom = hwnd; nm.hdr.idFrom = GetDlgCtrlID(hwnd); nm.flags = 0; - nm.hItem = hContact; + nm.hItem = (HANDLE)hContact; SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm); } diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp index 2347021133..4acefdf247 100644 --- a/src/modules/clist/clistevents.cpp +++ b/src/modules/clist/clistevents.cpp @@ -259,7 +259,7 @@ int fnRemoveEvent(HCONTACT hContact, HANDLE dbEvent) CLISTEVENT* fnGetEvent(HCONTACT hContact, int idx) { - if (hContact == INVALID_HANDLE_VALUE) { + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) { if (idx >= cli.events.count) return NULL; return &cli.events.items[idx]->cle; diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp index bf11aa6e95..7e23fb67bc 100644 --- a/src/modules/clist/clistsettings.cpp +++ b/src/modules/clist/clistsettings.cpp @@ -104,7 +104,7 @@ ClcCacheEntry* fnGetCacheEntry(HCONTACT hContact) void fnInvalidateDisplayNameCacheEntry(HCONTACT hContact) { - if (hContact == INVALID_HANDLE_VALUE) { + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) { FreeDisplayNameCache(); InitDisplayNameCache(); SendMessage(cli.hwndContactTree, CLM_AUTOREBUILD, 0, 0); diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index ce1996d89e..4683169736 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -222,12 +222,10 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) static INT_PTR MenuItem_AddContactToList(WPARAM wParam, LPARAM) { ADDCONTACTSTRUCT acs = { 0 }; - - acs.handle = (HANDLE)wParam; + acs.hContact = (HCONTACT)wParam; acs.handleType = HANDLE_CONTACT; acs.szProto = ""; - - CallService(MS_ADDCONTACT_SHOW, (WPARAM) NULL, (LPARAM) & acs); + CallService(MS_ADDCONTACT_SHOW, NULL, (LPARAM)&acs); return 0; } diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index d3f32ea6d5..726ce32bcd 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -368,9 +368,7 @@ void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y) switch(commandId) { case IDC_ADD: { - ADDCONTACTSTRUCT acs; - - acs.handle = NULL; + ADDCONTACTSTRUCT acs = { 0 }; acs.handleType = HANDLE_SEARCHRESULT; acs.szProto = lsr->szProto; acs.psr = &lsr->psr; -- cgit v1.2.3