From ddba4ede6b451d0cfcd0d32b5180fbd0689966bf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 10 Feb 2014 08:04:30 +0000 Subject: - HANDLE hContact => HCONTACT - GCF_* prefix was added to chat constants to avoid name conflicts git-svn-id: http://svn.miranda-ng.org/main/trunk@8078 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- bin10/lib/mir_core.lib | Bin 55636 -> 55636 bytes bin10/lib/mir_core64.lib | Bin 50896 -> 50896 bytes bin12/lib/mir_core.lib | Bin 55636 -> 55636 bytes bin12/lib/mir_core64.lib | Bin 50896 -> 50896 bytes include/m_addcontact.h | 8 +- include/m_avatars.h | 22 +- include/m_chat.h | 20 +- include/m_chat_int.h | 12 +- include/m_clist.h | 4 +- include/m_clistint.h | 36 +-- include/m_contacts.h | 2 +- include/m_core.h | 72 +++-- include/m_database.h | 11 +- include/m_db_int.h | 2 +- include/m_extraicons.h | 12 +- include/m_jabber.h | 4 +- include/m_message.h | 14 +- include/m_popup.h | 11 +- include/m_protocols.h | 12 +- include/m_protoint.h | 70 ++-- include/m_protomod.h | 6 +- include/m_protosvc.h | 4 +- include/m_timezones.h | 22 +- include/m_utils.h | 20 +- plugins/AVS/src/acc.cpp | 4 +- plugins/AVS/src/acc.h | 2 +- plugins/AVS/src/cache.cpp | 14 +- plugins/AVS/src/commonheaders.h | 22 +- plugins/AVS/src/image_utils.cpp | 6 +- plugins/AVS/src/image_utils.h | 4 +- plugins/AVS/src/main.cpp | 10 +- plugins/AVS/src/options.cpp | 28 +- plugins/AVS/src/poll.cpp | 22 +- plugins/AVS/src/poll.h | 4 +- plugins/AVS/src/services.cpp | 16 +- plugins/AVS/src/utils.cpp | 16 +- plugins/AddContactPlus/src/addcontact.cpp | 2 +- plugins/Alarms/src/alarms.cpp | 4 +- plugins/AssocMgr/src/test.cpp | 22 +- plugins/AuthState/src/main.cpp | 18 +- plugins/AuthState/src/options.cpp | 2 +- plugins/AutoShutdown/src/watcher.cpp | 6 +- plugins/AvatarHistory/src/AvatarDlg.cpp | 32 +- plugins/AvatarHistory/src/AvatarHistory.cpp | 13 +- plugins/AvatarHistory/src/AvatarHistory.h | 8 +- plugins/AvatarHistory/src/icolib.cpp | 2 +- plugins/AvatarHistory/src/options.cpp | 2 +- plugins/AvatarHistory/src/popup.cpp | 8 +- plugins/AvatarHistory/src/popup.h | 8 +- plugins/AvatarHistory/src/utils.cpp | 10 +- plugins/BasicHistory/src/BasicHistory.cpp | 6 +- plugins/BasicHistory/src/BinaryExport.cpp | 6 +- plugins/BasicHistory/src/BinaryExport.h | 2 +- plugins/BasicHistory/src/DatExport.cpp | 6 +- plugins/BasicHistory/src/DatExport.h | 4 +- plugins/BasicHistory/src/EventList.cpp | 18 +- plugins/BasicHistory/src/EventList.h | 16 +- plugins/BasicHistory/src/ExportManager.cpp | 10 +- plugins/BasicHistory/src/ExportManager.h | 6 +- plugins/BasicHistory/src/HistoryWindow.cpp | 53 ++- plugins/BasicHistory/src/HistoryWindow.h | 10 +- plugins/BasicHistory/src/IImport.h | 2 +- plugins/BasicHistory/src/Options.cpp | 8 +- plugins/BasicHistory/src/Options.h | 2 +- plugins/BasicHistory/src/Scheduler.cpp | 10 +- plugins/BasicHistory/src/SearchContext.h | 2 +- plugins/BasicHistory/src/Searcher.cpp | 4 +- plugins/Boltun/src/actionQueue.cpp | 18 +- plugins/Boltun/src/actionQueue.h | 4 +- plugins/Boltun/src/boltun.cpp | 11 +- plugins/BuddyExpectator/src/BuddyExpectator.cpp | 52 +-- plugins/BuddyExpectator/src/options.cpp | 24 +- plugins/BuddyPounce/src/dialog.cpp | 24 +- plugins/BuddyPounce/src/headers.h | 8 +- plugins/BuddyPounce/src/main.cpp | 14 +- plugins/CSList/src/cslist.cpp | 2 +- .../ClientChangeNotify/src/ClientChangeNotify.cpp | 6 +- plugins/ClientChangeNotify/src/Common.h | 2 +- .../ClientChangeNotify/src/CommonLibs/CString.cpp | 6 +- .../ClientChangeNotify/src/CommonLibs/CString.h | 8 +- plugins/Clist_blind/src/clcopts.cpp | 2 +- plugins/Clist_blind/src/clistopts.cpp | 4 +- plugins/Clist_blind/src/init.cpp | 2 +- plugins/Clist_modern/src/hdr/modern_awaymsg.h | 2 +- plugins/Clist_modern/src/hdr/modern_cache_funcs.h | 4 +- plugins/Clist_modern/src/hdr/modern_clc.h | 14 +- plugins/Clist_modern/src/hdr/modern_clist.h | 6 +- .../Clist_modern/src/hdr/modern_commonheaders.h | 10 +- .../Clist_modern/src/hdr/modern_commonprototypes.h | 38 +-- plugins/Clist_modern/src/hdr/modern_gettextasync.h | 4 +- .../Clist_modern/src/hdr/modern_global_structure.h | 2 +- .../Clist_modern/src/hdr/modern_skinned_profile.h | 8 +- plugins/Clist_modern/src/modern_aniavatars.cpp | 14 +- plugins/Clist_modern/src/modern_awaymsg.cpp | 15 +- plugins/Clist_modern/src/modern_cachefuncs.cpp | 4 +- plugins/Clist_modern/src/modern_clc.cpp | 81 ++--- plugins/Clist_modern/src/modern_clcidents.cpp | 6 +- plugins/Clist_modern/src/modern_clcitems.cpp | 47 ++- plugins/Clist_modern/src/modern_clcmsgs.cpp | 44 +-- plugins/Clist_modern/src/modern_clistevents.cpp | 4 +- plugins/Clist_modern/src/modern_clistmenus.cpp | 8 +- plugins/Clist_modern/src/modern_clistmod.cpp | 10 +- plugins/Clist_modern/src/modern_clistsettings.cpp | 32 +- plugins/Clist_modern/src/modern_clui.cpp | 6 +- plugins/Clist_modern/src/modern_contact.cpp | 46 ++- plugins/Clist_modern/src/modern_gettextasync.cpp | 6 +- .../Clist_modern/src/modern_rowheight_funcs.cpp | 4 +- plugins/Clist_modern/src/modern_skinengine.cpp | 8 +- plugins/Clist_modern/src/modern_viewmodebar.cpp | 12 +- plugins/Clist_mw/src/clc.cpp | 30 +- plugins/Clist_mw/src/clc.h | 10 +- plugins/Clist_mw/src/clcidents.cpp | 11 +- plugins/Clist_mw/src/clcitems.cpp | 23 +- plugins/Clist_mw/src/clist.h | 10 +- plugins/Clist_mw/src/clistmod.cpp | 15 +- plugins/Clist_mw/src/clistopts.cpp | 2 +- plugins/Clist_mw/src/clistsettings.cpp | 34 +- plugins/Clist_mw/src/clui.cpp | 2 +- plugins/Clist_mw/src/commonheaders.h | 2 +- plugins/Clist_mw/src/contact.cpp | 20 +- plugins/Clist_mw/src/init.cpp | 6 +- plugins/Clist_nicer/src/Include/clc.h | 56 ++-- plugins/Clist_nicer/src/Include/clist.h | 4 +- plugins/Clist_nicer/src/Include/config.h | 22 +- plugins/Clist_nicer/src/clc.cpp | 330 +++++++++---------- plugins/Clist_nicer/src/clcitems.cpp | 22 +- plugins/Clist_nicer/src/clcmsgs.cpp | 8 +- plugins/Clist_nicer/src/clistevents.cpp | 4 +- plugins/Clist_nicer/src/clistmenus.cpp | 6 +- plugins/Clist_nicer/src/clistmod.cpp | 8 +- plugins/Clist_nicer/src/clistopts.cpp | 2 +- plugins/Clist_nicer/src/clui.cpp | 16 +- plugins/Clist_nicer/src/config.cpp | 22 +- plugins/Clist_nicer/src/contact.cpp | 10 +- plugins/Clist_nicer/src/extBackg.cpp | 2 +- plugins/Clist_nicer/src/init.cpp | 12 +- plugins/Clist_nicer/src/viewmodes.cpp | 21 +- plugins/CmdLine/src/mimcmd_handlers.cpp | 24 +- plugins/CmdLine/src/utils.cpp | 18 +- plugins/CmdLine/src/utils.h | 16 +- plugins/ConnectionNotify/src/ConnectionNotify.cpp | 2 +- plugins/ContactsPlus/src/main.cpp | 19 +- plugins/ContactsPlus/src/receive.cpp | 10 +- plugins/ContactsPlus/src/receive.h | 20 +- plugins/ContactsPlus/src/send.cpp | 40 +-- plugins/ContactsPlus/src/send.h | 16 +- plugins/ContactsPlus/src/utils.cpp | 10 +- plugins/ContactsPlus/src/utils.h | 10 +- plugins/CountryFlags/src/extraimg.cpp | 20 +- plugins/CyrTranslit/src/MirandaContact.cpp | 8 +- plugins/CyrTranslit/src/MirandaContact.h | 4 +- plugins/Db3x_mmap/src/dbevents.cpp | 6 +- plugins/Db3x_mmap/src/dbintf.h | 66 ++-- plugins/DbEditorPP/src/addeditsettingsdlg.cpp | 6 +- plugins/DbEditorPP/src/copymodule.cpp | 10 +- plugins/DbEditorPP/src/deletemodule.cpp | 6 +- plugins/DbEditorPP/src/exportimport.cpp | 24 +- plugins/DbEditorPP/src/findwindow.cpp | 10 +- plugins/DbEditorPP/src/headers.h | 58 ++-- plugins/DbEditorPP/src/main.cpp | 26 +- plugins/DbEditorPP/src/main_window.cpp | 10 +- plugins/DbEditorPP/src/modsettingenum.cpp | 4 +- plugins/DbEditorPP/src/modsettingenum.h | 4 +- plugins/DbEditorPP/src/modules.cpp | 10 +- plugins/DbEditorPP/src/moduletree.cpp | 33 +- plugins/DbEditorPP/src/settinglist.cpp | 12 +- plugins/DbEditorPP/src/watchedvars.cpp | 10 +- plugins/Dbx_tree/src/Compatibility.cpp | 4 +- plugins/Dbx_tree/src/DataBase.h | 62 ++-- plugins/ExternalAPI/m_ContactSettings.h | 2 +- plugins/ExternalAPI/m_account.h | 2 +- plugins/ExternalAPI/m_flash.h | 2 +- plugins/ExternalAPI/m_ftpfile.h | 14 +- plugins/ExternalAPI/m_ieview.h | 20 +- plugins/ExternalAPI/m_msg_buttonsbar.h | 14 +- plugins/ExternalAPI/m_popup2.h | 4 +- plugins/ExternalAPI/m_smileyadd.h | 10 +- plugins/ExternalAPI/m_spellchecker.h | 2 +- plugins/ExternalAPI/m_text.h | 4 +- plugins/ExternalAPI/m_tipper.h | 2 +- plugins/ExternalAPI/m_userinfoex.h | 2 +- plugins/ExternalAPI/m_variables.h | 56 ++-- plugins/ExternalAPI/m_weather.h | 2 +- plugins/FTPFileYM/src/dialog.cpp | 2 +- plugins/FTPFileYM/src/ftpfile.cpp | 12 +- plugins/FTPFileYM/src/job_generic.cpp | 4 +- plugins/FTPFileYM/src/job_generic.h | 4 +- plugins/FTPFileYM/src/job_packer.cpp | 4 +- plugins/FTPFileYM/src/job_packer.h | 2 +- plugins/FTPFileYM/src/job_upload.cpp | 2 +- plugins/FTPFileYM/src/job_upload.h | 2 +- plugins/FTPFileYM/src/mir_db.cpp | 26 +- plugins/FTPFileYM/src/mir_db.h | 26 +- plugins/FavContacts/src/contact_cache.cpp | 8 +- plugins/FavContacts/src/contact_cache.h | 4 +- plugins/FavContacts/src/favlist.h | 12 +- plugins/FavContacts/src/http_api.cpp | 2 +- plugins/FavContacts/src/main.cpp | 26 +- plugins/FileAsMessage/src/dialog.cpp | 10 +- plugins/FileAsMessage/src/dialog.h | 4 +- plugins/FileAsMessage/src/main.cpp | 12 +- plugins/FingerprintNG/src/fingerprint.cpp | 8 +- plugins/FingerprintNG/src/options.cpp | 2 +- plugins/FlashAvatars/src/cflash.cpp | 6 +- plugins/FloatingContacts/src/fltcont.h | 2 +- plugins/FloatingContacts/src/main.cpp | 32 +- plugins/FloatingContacts/src/thumbs.cpp | 4 +- plugins/FloatingContacts/src/thumbs.h | 6 +- plugins/HTTPServer/src/GuiElements.cpp | 4 +- plugins/HistoryLinkListPlus/src/linklist.cpp | 2 +- plugins/HistoryLinkListPlus/src/linklist.h | 2 +- plugins/HistoryLinkListPlus/src/linklist_dlg.cpp | 4 +- plugins/HistoryLinkListPlus/src/linklist_fct.cpp | 2 +- .../src/historysweeperlight.cpp | 6 +- plugins/HistorySweeperLight/src/main.cpp | 6 +- plugins/HistorySweeperLight/src/options.cpp | 4 +- plugins/IEView/src/HTMLBuilder.cpp | 38 +-- plugins/IEView/src/HTMLBuilder.h | 32 +- plugins/IEView/src/IEView.cpp | 2 +- plugins/IEView/src/IEView.h | 2 +- plugins/IEView/src/TemplateHTMLBuilder.cpp | 8 +- plugins/IEView/src/TemplateHTMLBuilder.h | 2 +- plugins/IEView/src/TextToken.cpp | 2 +- plugins/IEView/src/TextToken.h | 2 +- plugins/IgnoreState/src/commonheaders.h | 2 +- plugins/IgnoreState/src/main.cpp | 8 +- plugins/Import/src/import.cpp | 16 +- plugins/Import/src/import.h | 6 +- plugins/Import/src/utils.cpp | 8 +- plugins/KeyboardNotify/src/ignore.cpp | 12 +- plugins/KeyboardNotify/src/ignore.h | 2 +- plugins/KeyboardNotify/src/main.cpp | 28 +- plugins/ListeningTo/src/listeningto.cpp | 8 +- plugins/ListeningTo/src/players/mradio.cpp | 2 +- plugins/LotusNotify/src/LotusNotify.cpp | 2 +- plugins/MenuItemEx/src/main.cpp | 235 +++++++------- plugins/MetaContacts/src/addto.cpp | 14 +- plugins/MetaContacts/src/edit.cpp | 35 +- plugins/MetaContacts/src/meta_api.cpp | 51 ++- plugins/MetaContacts/src/meta_main.cpp | 2 +- plugins/MetaContacts/src/meta_menu.cpp | 48 +-- plugins/MetaContacts/src/meta_services.cpp | 137 ++++---- plugins/MetaContacts/src/meta_utils.cpp | 73 ++--- plugins/MetaContacts/src/metacontacts.h | 34 +- plugins/MirFox/src/MirandaOptions.cpp | 4 +- plugins/MirFox/src/MirandaUtils.cpp | 14 +- plugins/MirFox/src/MirandaUtils.h | 6 +- plugins/MirFox/src/MirfoxData.cpp | 23 +- plugins/MirFox/src/MirfoxData.h | 4 +- plugins/MirOTR/MirOTR/src/dbfilter.cpp | 44 +-- plugins/MirOTR/MirOTR/src/dialogs.cpp | 52 +-- plugins/MirOTR/MirOTR/src/dllmain.cpp | 2 +- plugins/MirOTR/MirOTR/src/mirotrmenu.cpp | 11 +- plugins/MirOTR/MirOTR/src/mirotrmenu.h | 2 +- plugins/MirOTR/MirOTR/src/options.cpp | 23 +- plugins/MirOTR/MirOTR/src/options.h | 2 +- plugins/MirOTR/MirOTR/src/otr.cpp | 52 +-- plugins/MirOTR/MirOTR/src/svcs_menu.cpp | 40 +-- plugins/MirOTR/MirOTR/src/svcs_proto.cpp | 4 +- plugins/MirOTR/MirOTR/src/svcs_srmm.cpp | 10 +- plugins/MirOTR/MirOTR/src/svcs_srmm.h | 2 +- plugins/MirOTR/MirOTR/src/utils.cpp | 54 ++-- plugins/MirOTR/MirOTR/src/utils.h | 24 +- plugins/MirandaG15/src/CAppletManager.cpp | 46 +-- plugins/MirandaG15/src/CAppletManager.h | 28 +- plugins/MirandaG15/src/CChatScreen.cpp | 2 +- plugins/MirandaG15/src/CChatScreen.h | 8 +- plugins/MirandaG15/src/CContactList.cpp | 58 ++-- plugins/MirandaG15/src/CContactList.h | 30 +- plugins/MirandaG15/src/CContactlistScreen.cpp | 9 +- plugins/MirandaG15/src/CContactlistScreen.h | 4 +- plugins/MirandaG15/src/CEvent.h | 2 +- plugins/MirandaG15/src/CEventLog.h | 2 +- plugins/MirandaG15/src/CEventScreen.cpp | 2 +- plugins/MirandaG15/src/CIRCHistory.h | 2 +- plugins/MirandaG15/src/CNotificationScreen.h | 2 +- plugins/MirandaG15/src/Miranda.h | 2 +- plugins/MobileState/src/main.cpp | 12 +- plugins/ModernOpt/src/mopt_ignore.cpp | 2 +- plugins/MsgPopup/src/options.cpp | 2 +- plugins/Msg_Export/src/FileViewer.cpp | 8 +- plugins/Msg_Export/src/FileViewer.h | 4 +- plugins/Msg_Export/src/main.cpp | 4 +- plugins/Msg_Export/src/options.cpp | 46 +-- plugins/Msg_Export/src/utils.cpp | 23 +- plugins/Msg_Export/src/utils.h | 10 +- plugins/NewEventNotify/src/main.cpp | 4 +- plugins/NewEventNotify/src/neweventnotify.h | 10 +- plugins/NewEventNotify/src/popup.cpp | 6 +- plugins/NewXstatusNotify/src/common.h | 4 +- plugins/NewXstatusNotify/src/indsnd.cpp | 240 ++++++-------- plugins/NewXstatusNotify/src/main.cpp | 22 +- plugins/NewXstatusNotify/src/popup.cpp | 6 +- plugins/NewXstatusNotify/src/utils.cpp | 2 +- plugins/NewXstatusNotify/src/utils.h | 2 +- plugins/NewXstatusNotify/src/xstatus.cpp | 12 +- plugins/NewXstatusNotify/src/xstatus.h | 6 +- plugins/New_GPG/src/clist.cpp | 3 +- plugins/New_GPG/src/globals.h | 8 + plugins/New_GPG/src/icons.cpp | 12 +- plugins/New_GPG/src/main.cpp | 270 +++++++--------- plugins/New_GPG/src/messages.cpp | 157 ++++----- plugins/New_GPG/src/metacontacts.cpp | 60 ++-- plugins/New_GPG/src/metacontacts.h | 16 +- plugins/New_GPG/src/options.cpp | 158 ++++----- plugins/New_GPG/src/srmm.cpp | 16 +- plugins/New_GPG/src/utilities.cpp | 68 ++-- plugins/New_GPG/src/utilities.h | 15 +- plugins/NewsAggregator/Src/Authentication.cpp | 2 +- plugins/NewsAggregator/Src/CheckFeed.cpp | 4 +- plugins/NewsAggregator/Src/Common.h | 20 +- plugins/NewsAggregator/Src/ExportImport.cpp | 6 +- plugins/NewsAggregator/Src/Options.cpp | 16 +- plugins/NewsAggregator/Src/Services.cpp | 16 +- plugins/NewsAggregator/Src/Update.cpp | 11 +- plugins/NewsAggregator/Src/Utils.cpp | 14 +- plugins/NoHistory/src/dllmain.cpp | 22 +- plugins/NoHistory/src/options.cpp | 4 +- plugins/Non-IM Contact/src/commonheaders.h | 10 +- plugins/Non-IM Contact/src/contactinfo.cpp | 32 +- plugins/Non-IM Contact/src/dialog.cpp | 8 +- plugins/Non-IM Contact/src/files.cpp | 2 +- plugins/Non-IM Contact/src/main.cpp | 6 +- plugins/Non-IM Contact/src/namereplacing.cpp | 12 +- plugins/Non-IM Contact/src/services.cpp | 4 +- plugins/Non-IM Contact/src/timer.cpp | 2 +- plugins/NotesAndReminders/src/miscutils.cpp | 6 +- plugins/NotesAndReminders/src/miscutils.h | 10 +- plugins/Nudge/src/headers.h | 8 +- plugins/Nudge/src/main.cpp | 52 +-- plugins/Nudge/src/shake.cpp | 2 +- plugins/PasteIt/src/PasteIt.cpp | 10 +- plugins/Popup/src/avatars.cpp | 2 +- plugins/Popup/src/avatars.h | 4 +- plugins/Popup/src/avatars_flash.h | 2 +- plugins/Popup/src/avatars_gif.cpp | 2 +- plugins/Popup/src/avatars_gif.h | 2 +- plugins/Popup/src/avatars_simple.cpp | 11 +- plugins/Popup/src/avatars_simple.h | 2 +- plugins/Popup/src/common.h | 4 +- plugins/Popup/src/opt_contacts.cpp | 4 +- plugins/Popup/src/popup_wnd2.cpp | 29 +- plugins/Popup/src/popup_wnd2.h | 2 +- plugins/Popup/src/srmm_menu.cpp | 4 +- plugins/QuickContacts/src/quickcontacts.cpp | 32 +- plugins/QuickMessages/src/Utils.cpp | 2 +- plugins/QuickMessages/src/Utils.h | 2 +- plugins/QuickReplies/src/events.cpp | 2 +- plugins/Quotes/src/DBUtils.cpp | 8 +- plugins/Quotes/src/DBUtils.h | 8 +- plugins/Quotes/src/ExtraImages.cpp | 4 +- plugins/Quotes/src/ExtraImages.h | 2 +- plugins/Quotes/src/Forex.cpp | 2 +- plugins/Quotes/src/IQuotesProvider.h | 8 +- plugins/Quotes/src/ImportExport.cpp | 18 +- plugins/Quotes/src/QuoteChart.cpp | 12 +- plugins/Quotes/src/QuoteInfoDlg.cpp | 32 +- plugins/Quotes/src/QuotesProviderBase.cpp | 28 +- plugins/Quotes/src/QuotesProviderBase.h | 16 +- plugins/Quotes/src/QuotesProviderDukasCopy.cpp | 42 +-- plugins/Quotes/src/QuotesProviderDukasCopy.h | 4 +- plugins/Quotes/src/QuotesProviderFinance.cpp | 12 +- plugins/Quotes/src/QuotesProviderFinance.h | 2 +- plugins/Quotes/src/QuotesProviderGoogle.cpp | 16 +- plugins/Quotes/src/QuotesProviderGoogle.h | 2 +- plugins/Quotes/src/QuotesProviderGoogleFinance.cpp | 4 +- .../Quotes/src/QuotesProviderVisitorFormater.cpp | 6 +- plugins/Quotes/src/QuotesProviderVisitorFormater.h | 4 +- .../Quotes/src/QuotesProviderVisitorTendency.cpp | 2 +- plugins/Quotes/src/QuotesProviderVisitorTendency.h | 4 +- plugins/Quotes/src/QuotesProviderYahoo.cpp | 8 +- plugins/Quotes/src/QuotesProviders.cpp | 6 +- plugins/Quotes/src/QuotesProviders.h | 2 +- plugins/Quotes/src/SettingsDlg.cpp | 18 +- plugins/Quotes/src/SettingsDlg.h | 10 +- plugins/Rate/src/main.cpp | 6 +- plugins/RecentContacts/src/RecentContacts.cpp | 15 +- plugins/RecentContacts/src/RecentContacts.h | 6 +- plugins/RemovePersonalSettings/src/rps.cpp | 13 +- plugins/SMS/src/SMS_svc.cpp | 10 +- plugins/SMS/src/common.h | 12 +- plugins/SMS/src/functions.cpp | 16 +- plugins/SMS/src/receive.cpp | 8 +- plugins/SMS/src/recvdlg.cpp | 12 +- plugins/SMS/src/recvdlg.h | 2 +- plugins/SMS/src/senddlg.cpp | 67 ++-- plugins/SMS/src/senddlg.h | 40 +-- plugins/Scriver/src/chat/chat.h | 4 +- plugins/Scriver/src/chat/manager.cpp | 2 +- plugins/Scriver/src/chat/tools.cpp | 2 +- plugins/Scriver/src/cmdlist.cpp | 6 +- plugins/Scriver/src/cmdlist.h | 6 +- plugins/Scriver/src/commonheaders.h | 2 +- plugins/Scriver/src/globals.cpp | 8 +- plugins/Scriver/src/globals.h | 2 +- plugins/Scriver/src/input.cpp | 2 +- plugins/Scriver/src/input.h | 2 +- plugins/Scriver/src/msgdialog.cpp | 18 +- plugins/Scriver/src/msglog.cpp | 8 +- plugins/Scriver/src/msgoptions.cpp | 4 +- plugins/Scriver/src/msgs.cpp | 50 ++- plugins/Scriver/src/msgs.h | 12 +- plugins/Scriver/src/msgwindow.cpp | 25 +- plugins/Scriver/src/msgwindow.h | 8 +- plugins/Scriver/src/sendqueue.cpp | 6 +- plugins/Scriver/src/sendqueue.h | 8 +- plugins/Scriver/src/statusicon.cpp | 8 +- plugins/Scriver/src/statusicon.h | 6 +- plugins/SecureIM/src/commonheaders.cpp | 6 +- plugins/SecureIM/src/commonheaders.h | 2 +- plugins/SecureIM/src/crypt.h | 98 +++--- plugins/SecureIM/src/crypt_check.cpp | 28 +- plugins/SecureIM/src/crypt_dll.cpp | 2 +- plugins/SecureIM/src/crypt_icons.cpp | 10 +- plugins/SecureIM/src/crypt_lists.cpp | 20 +- plugins/SecureIM/src/crypt_metacontacts.cpp | 18 +- plugins/SecureIM/src/crypt_misc.cpp | 2 +- plugins/SecureIM/src/crypt_popups.cpp | 18 +- plugins/SecureIM/src/dbevent.cpp | 2 +- plugins/SecureIM/src/dbevent.h | 2 +- plugins/SecureIM/src/options.cpp | 8 +- plugins/SecureIM/src/svcs_clist.cpp | 15 +- plugins/SecureIM/src/svcs_menu.cpp | 58 ++-- plugins/SecureIM/src/svcs_proto.cpp | 4 +- plugins/SecureIM/src/svcs_srmm.cpp | 2 +- plugins/SeenPlugin/src/file.cpp | 2 +- plugins/SeenPlugin/src/history.cpp | 12 +- plugins/SeenPlugin/src/menu.cpp | 8 +- plugins/SeenPlugin/src/missed.cpp | 12 +- plugins/SeenPlugin/src/seen.h | 10 +- plugins/SeenPlugin/src/userinfo.cpp | 6 +- plugins/SeenPlugin/src/utils.cpp | 26 +- plugins/SendScreenshotPlus/src/CSend.cpp | 6 +- plugins/SendScreenshotPlus/src/CSend.h | 19 +- plugins/SendScreenshotPlus/src/CSendEmail.cpp | 2 +- plugins/SendScreenshotPlus/src/CSendEmail.h | 2 +- plugins/SendScreenshotPlus/src/CSendFTPFile.cpp | 2 +- plugins/SendScreenshotPlus/src/CSendFTPFile.h | 2 +- plugins/SendScreenshotPlus/src/CSendFile.cpp | 2 +- plugins/SendScreenshotPlus/src/CSendFile.h | 2 +- plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp | 2 +- plugins/SendScreenshotPlus/src/CSendHTTPServer.h | 2 +- plugins/SendScreenshotPlus/src/CSendImageShack.cpp | 2 +- plugins/SendScreenshotPlus/src/CSendImageShack.h | 2 +- plugins/SendScreenshotPlus/src/Main.cpp | 6 +- plugins/SendScreenshotPlus/src/UMainForm.cpp | 5 +- plugins/SendScreenshotPlus/src/UMainForm.h | 4 +- plugins/SendScreenshotPlus/src/dlg_msgbox.cpp | 2 +- plugins/Sessions/Src/Main.cpp | 28 +- plugins/Sessions/Src/Options.cpp | 10 +- plugins/Sessions/Src/Sessions.h | 4 +- plugins/Sessions/Src/Utils.cpp | 24 +- plugins/Sessions/Src/Utils.h | 20 +- plugins/ShellExt/src/shlcom.cpp | 9 +- plugins/ShellExt/src/shlcom.h | 4 +- plugins/ShellExt/src/shlext.cpp | 2 +- plugins/SimpleAR/src/Main.cpp | 6 +- plugins/SimpleStatusMsg/src/awaymsg.cpp | 22 +- plugins/SimpleStatusMsg/src/main.cpp | 6 +- plugins/SmileyAdd/src/customsmiley.cpp | 4 +- plugins/SmileyAdd/src/customsmiley.h | 4 +- plugins/SmileyAdd/src/dlgboxsubclass.cpp | 8 +- plugins/SmileyAdd/src/general.cpp | 6 +- plugins/SmileyAdd/src/general.h | 4 +- plugins/SmileyAdd/src/options.cpp | 4 +- plugins/SmileyAdd/src/options.h | 4 +- plugins/SmileyAdd/src/richcall.cpp | 4 +- plugins/SmileyAdd/src/services.cpp | 19 +- plugins/SmileyAdd/src/services.h | 2 +- plugins/SmileyAdd/src/smileys.cpp | 10 +- plugins/SmileyAdd/src/smileys.h | 4 +- plugins/SmileyAdd/src/smltool.cpp | 6 +- plugins/SmileyAdd/src/smltool.h | 2 +- plugins/Spamotron/src/bayes.cpp | 4 +- plugins/Spamotron/src/common.h | 12 +- plugins/Spamotron/src/options.cpp | 2 +- plugins/Spamotron/src/popups.cpp | 2 +- plugins/Spamotron/src/spamotron.cpp | 6 +- plugins/Spamotron/src/utils.cpp | 4 +- plugins/SpellChecker/src/commons.h | 4 +- plugins/SpellChecker/src/utils.cpp | 10 +- plugins/SplashScreen/src/debug.h | 2 +- plugins/StartupSilence/src/main.cpp | 2 +- plugins/StopSpamMod/src/init.cpp | 2 +- plugins/StopSpamMod/src/stopspam.cpp | 8 +- plugins/StopSpamMod/src/utilities.cpp | 30 +- plugins/StopSpamMod/src/utilities.h | 12 +- plugins/StopSpamPlus/src/events.cpp | 6 +- plugins/StopSpamPlus/src/headers.h | 4 +- plugins/StopSpamPlus/src/services.cpp | 6 +- plugins/StopSpamPlus/src/utils.cpp | 4 +- plugins/TabSRMM/src/TSButton.cpp | 2 +- plugins/TabSRMM/src/buttonbar.h | 4 +- plugins/TabSRMM/src/buttonsbar.cpp | 10 +- plugins/TabSRMM/src/chat/chat.h | 4 +- plugins/TabSRMM/src/chat/services.cpp | 2 +- plugins/TabSRMM/src/chat/tools.cpp | 2 +- plugins/TabSRMM/src/contactcache.cpp | 8 +- plugins/TabSRMM/src/contactcache.h | 104 +++--- plugins/TabSRMM/src/container.cpp | 40 +-- plugins/TabSRMM/src/containeroptions.cpp | 4 +- plugins/TabSRMM/src/controls.cpp | 4 +- plugins/TabSRMM/src/eventpopups.cpp | 12 +- plugins/TabSRMM/src/functions.h | 22 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 12 +- plugins/TabSRMM/src/globals.cpp | 16 +- plugins/TabSRMM/src/hotkeyhandler.cpp | 16 +- plugins/TabSRMM/src/infopanel.cpp | 2 +- plugins/TabSRMM/src/infopanel.h | 22 +- plugins/TabSRMM/src/mim.cpp | 16 +- plugins/TabSRMM/src/mim.h | 8 +- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TabSRMM/src/msgdlgutils.cpp | 6 +- plugins/TabSRMM/src/msgdlgutils.h | 4 +- plugins/TabSRMM/src/msglog.cpp | 4 +- plugins/TabSRMM/src/msgoptions.cpp | 4 +- plugins/TabSRMM/src/msgs.cpp | 24 +- plugins/TabSRMM/src/msgs.h | 199 ++++++------ plugins/TabSRMM/src/nen.h | 2 +- plugins/TabSRMM/src/sendlater.cpp | 23 +- plugins/TabSRMM/src/sendlater.h | 31 +- plugins/TabSRMM/src/sendqueue.cpp | 36 +-- plugins/TabSRMM/src/sendqueue.h | 4 +- plugins/TabSRMM/src/sidebar.cpp | 2 +- plugins/TabSRMM/src/sidebar.h | 2 +- plugins/TabSRMM/src/srmm.cpp | 2 +- plugins/TabSRMM/src/tabctrl.cpp | 2 +- plugins/TabSRMM/src/templates.cpp | 8 +- plugins/TabSRMM/src/templates.h | 6 +- plugins/TabSRMM/src/trayicon.cpp | 10 +- plugins/TabSRMM/src/typingnotify.cpp | 4 +- plugins/TabSRMM/src/userprefs.cpp | 167 +++++----- plugins/TabSRMM/src/utils.cpp | 10 +- plugins/TabSRMM/src/utils.h | 6 +- plugins/TipperYM/src/message_pump.cpp | 24 +- plugins/TipperYM/src/options.cpp | 4 +- plugins/TipperYM/src/popwin.cpp | 6 +- plugins/TipperYM/src/popwin.h | 2 +- plugins/TipperYM/src/subst.cpp | 56 ++-- plugins/TipperYM/src/subst.h | 14 +- plugins/TipperYM/src/tipper.cpp | 4 +- plugins/TipperYM/src/translations.cpp | 46 +-- plugins/TipperYM/src/translations.h | 6 +- plugins/TooltipNotify/src/DbHelpers.cpp | 8 +- plugins/TooltipNotify/src/DbHelpers.h | 6 +- plugins/TooltipNotify/src/TooltipNotify.cpp | 10 +- plugins/TooltipNotify/src/TooltipNotify.h | 4 +- plugins/UserInfoEx/src/Flags/svc_flags.cpp | 16 +- plugins/UserInfoEx/src/Flags/svc_flags.h | 8 +- plugins/UserInfoEx/src/classMAnnivDate.cpp | 38 +-- plugins/UserInfoEx/src/classMAnnivDate.h | 28 +- plugins/UserInfoEx/src/classMTime.cpp | 6 +- plugins/UserInfoEx/src/classMTime.h | 6 +- plugins/UserInfoEx/src/ctrl_annivedit.cpp | 20 +- plugins/UserInfoEx/src/ctrl_annivedit.h | 12 +- plugins/UserInfoEx/src/ctrl_base.cpp | 4 +- plugins/UserInfoEx/src/ctrl_base.h | 8 +- plugins/UserInfoEx/src/ctrl_combo.cpp | 4 +- plugins/UserInfoEx/src/ctrl_combo.h | 4 +- plugins/UserInfoEx/src/ctrl_contact.cpp | 16 +- plugins/UserInfoEx/src/ctrl_contact.h | 8 +- plugins/UserInfoEx/src/ctrl_edit.cpp | 4 +- plugins/UserInfoEx/src/ctrl_edit.h | 4 +- plugins/UserInfoEx/src/ctrl_tzcombo.cpp | 4 +- plugins/UserInfoEx/src/ctrl_tzcombo.h | 4 +- plugins/UserInfoEx/src/dlg_anniversarylist.cpp | 23 +- plugins/UserInfoEx/src/dlg_msgbox.cpp | 2 +- plugins/UserInfoEx/src/dlg_propsheet.cpp | 24 +- plugins/UserInfoEx/src/dlg_propsheet.h | 14 +- .../src/ex_import/classExImContactBase.cpp | 46 ++- .../src/ex_import/classExImContactBase.h | 20 +- .../src/ex_import/classExImContactXML.cpp | 14 +- .../UserInfoEx/src/ex_import/dlg_ExImModules.cpp | 2 +- plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp | 20 +- plugins/UserInfoEx/src/ex_import/svc_ExImINI.h | 2 +- plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp | 24 +- plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h | 10 +- plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp | 4 +- plugins/UserInfoEx/src/ex_import/svc_ExImXML.h | 6 +- plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp | 8 +- plugins/UserInfoEx/src/ex_import/svc_ExImport.h | 2 +- plugins/UserInfoEx/src/mir_contactqueue.cpp | 14 +- plugins/UserInfoEx/src/mir_contactqueue.h | 18 +- plugins/UserInfoEx/src/mir_db.cpp | 55 ++-- plugins/UserInfoEx/src/mir_db.h | 66 ++-- plugins/UserInfoEx/src/psp_base.cpp | 64 ++-- plugins/UserInfoEx/src/psp_contact.cpp | 8 +- plugins/UserInfoEx/src/psp_general.cpp | 4 +- plugins/UserInfoEx/src/psp_options.cpp | 4 +- plugins/UserInfoEx/src/psp_origin.cpp | 2 +- plugins/UserInfoEx/src/psp_profile.cpp | 16 +- plugins/UserInfoEx/src/svc_avatar.cpp | 8 +- plugins/UserInfoEx/src/svc_contactinfo.cpp | 2 +- plugins/UserInfoEx/src/svc_email.cpp | 12 +- plugins/UserInfoEx/src/svc_gender.cpp | 8 +- plugins/UserInfoEx/src/svc_gender.h | 4 +- plugins/UserInfoEx/src/svc_homepage.cpp | 10 +- plugins/UserInfoEx/src/svc_phone.cpp | 6 +- plugins/UserInfoEx/src/svc_refreshci.cpp | 15 +- plugins/UserInfoEx/src/svc_reminder.cpp | 26 +- plugins/UserInfoEx/src/svc_timezone.cpp | 4 +- plugins/UserInfoEx/src/svc_timezone_old.cpp | 12 +- plugins/UserInfoEx/src/svc_timezone_old.h | 8 +- plugins/Utils/mir_buffer.h | 4 +- plugins/Utils/mir_options.cpp | 2 +- plugins/Variables/src/contact.cpp | 22 +- plugins/Variables/src/contact.h | 6 +- plugins/Variables/src/dbhelpers.h | 18 +- plugins/Variables/src/help.cpp | 12 +- plugins/Variables/src/parse_metacontacts.cpp | 12 +- plugins/Variables/src/parse_miranda.cpp | 26 +- plugins/Variables/src/variables.h | 6 +- plugins/Watrack_MPD/src/utilities.cpp | 2 +- plugins/Watrack_MPD/src/utilities.h | 2 +- plugins/Weather/src/weather.h | 30 +- plugins/Weather/src/weather_addstn.cpp | 4 +- plugins/Weather/src/weather_contacts.cpp | 30 +- plugins/Weather/src/weather_conv.cpp | 2 +- plugins/Weather/src/weather_data.cpp | 14 +- plugins/Weather/src/weather_mwin.cpp | 22 +- plugins/Weather/src/weather_popup.cpp | 33 +- plugins/Weather/src/weather_svcs.cpp | 12 +- plugins/Weather/src/weather_update.cpp | 25 +- plugins/Weather/src/weather_userinfo.cpp | 18 +- plugins/WebView/src/main.cpp | 2 +- plugins/WebView/src/webview.cpp | 24 +- plugins/WebView/src/webview.h | 12 +- plugins/WebView/src/webview_alerts.cpp | 42 +-- plugins/WebView/src/webview_datawnd.cpp | 12 +- plugins/WebView/src/webview_getdata.cpp | 3 +- plugins/WebView/src/webview_opts.cpp | 20 +- plugins/WebView/src/webview_services.cpp | 26 +- plugins/WhenWasIt/src/birthdays.cpp | 10 +- plugins/WhenWasIt/src/birthdays.h | 12 +- plugins/WhenWasIt/src/date_utils.cpp | 8 +- plugins/WhenWasIt/src/date_utils.h | 8 +- plugins/WhenWasIt/src/dlg_handlers.cpp | 25 +- plugins/WhenWasIt/src/hooked_events.cpp | 4 +- plugins/WhenWasIt/src/notifiers.cpp | 10 +- plugins/WhenWasIt/src/notifiers.h | 12 +- plugins/WhenWasIt/src/services.cpp | 12 +- plugins/WhenWasIt/src/services.h | 4 +- plugins/WhenWasIt/src/utils.cpp | 14 +- plugins/WhenWasIt/src/utils.h | 10 +- plugins/WinterSpeak/src/ConfigDatabase.cpp | 10 +- plugins/WinterSpeak/src/ConfigDatabase.h | 31 +- plugins/WinterSpeak/src/DialogConfigActive.cpp | 6 +- plugins/WinterSpeak/src/DialogConfigActive.h | 2 +- plugins/WinterSpeak/src/SpeakAnnounce.cpp | 2 +- plugins/WinterSpeak/src/SpeakAnnounce.h | 2 +- plugins/WinterSpeak/src/SpeakConfig.cpp | 11 +- plugins/WinterSpeak/src/SpeakConfig.h | 36 +-- plugins/WinterSpeak/src/main.cpp | 6 +- plugins/XSoundNotify/src/Common.h | 4 +- plugins/XSoundNotify/src/dialog.cpp | 16 +- plugins/XSoundNotify/src/options.cpp | 12 +- plugins/XSoundNotify/src/xsn_main.cpp | 6 +- plugins/YAMN/src/browser/badconnect.cpp | 4 +- plugins/YAMN/src/browser/mailbrowser.cpp | 43 ++- plugins/YAMN/src/proto/pop3/pop3comm.cpp | 4 +- plugins/YAMN/src/services.cpp | 14 +- plugins/YAPP/src/message_pump.h | 2 +- plugins/YAPP/src/options.cpp | 2 +- plugins/YAPP/src/popwin.cpp | 2 +- plugins/YAPP/src/services.cpp | 2 +- plugins/YARelay/src/main.cpp | 11 +- plugins/YARelay/src/options.cpp | 6 +- plugins/YARelay/src/stdafx.h | 2 +- plugins/YahooGroups/src/services.cpp | 12 +- plugins/YahooGroups/src/utils.cpp | 14 +- plugins/YahooGroups/src/utils.h | 12 +- plugins/mTextControl/src/services.cpp | 4 +- plugins/mTextControl/src/services.h | 2 +- plugins/wbOSD/src/events.cpp | 4 +- protocols/AimOscar/src/avatars.cpp | 12 +- protocols/AimOscar/src/chat.cpp | 6 +- protocols/AimOscar/src/file.cpp | 4 +- protocols/AimOscar/src/file.h | 8 +- protocols/AimOscar/src/links.cpp | 4 +- protocols/AimOscar/src/proto.cpp | 42 +-- protocols/AimOscar/src/proto.h | 71 ++-- protocols/AimOscar/src/server.cpp | 24 +- protocols/AimOscar/src/services.cpp | 21 +- protocols/AimOscar/src/theme.cpp | 16 +- protocols/AimOscar/src/theme.h | 2 +- protocols/AimOscar/src/ui.cpp | 60 ++-- protocols/AimOscar/src/utility.cpp | 40 +-- protocols/EmLanProto/src/mlan.cpp | 27 +- protocols/EmLanProto/src/mlan.h | 6 +- protocols/FacebookRM/src/avatars.cpp | 2 +- protocols/FacebookRM/src/chat.cpp | 8 +- protocols/FacebookRM/src/communication.cpp | 2 +- protocols/FacebookRM/src/contacts.cpp | 32 +- protocols/FacebookRM/src/dialogs.cpp | 19 +- protocols/FacebookRM/src/entities.h | 10 +- protocols/FacebookRM/src/events.cpp | 2 +- protocols/FacebookRM/src/json.cpp | 6 +- protocols/FacebookRM/src/messages.cpp | 12 +- protocols/FacebookRM/src/process.cpp | 14 +- protocols/FacebookRM/src/proto.cpp | 30 +- protocols/FacebookRM/src/proto.h | 64 ++-- protocols/FacebookRM/src/stubs.cpp | 26 +- protocols/FacebookRM/src/theme.cpp | 8 +- protocols/GTalkExt/src/avatar.cpp | 8 +- protocols/GTalkExt/src/db.cpp | 2 +- protocols/GTalkExt/src/handlers.cpp | 2 +- protocols/GTalkExt/src/notifications.cpp | 18 +- protocols/GTalkExt/src/notifications.h | 2 +- protocols/GTalkExt/src/stdafx.h | 2 +- protocols/Gadu-Gadu/src/avatar.cpp | 8 +- protocols/Gadu-Gadu/src/core.cpp | 32 +- protocols/Gadu-Gadu/src/dialogs.cpp | 10 +- protocols/Gadu-Gadu/src/filetransfer.cpp | 52 +-- protocols/Gadu-Gadu/src/gg.cpp | 6 +- protocols/Gadu-Gadu/src/gg.h | 4 +- protocols/Gadu-Gadu/src/gg_proto.cpp | 38 +-- protocols/Gadu-Gadu/src/gg_proto.h | 64 ++-- protocols/Gadu-Gadu/src/groupchat.cpp | 30 +- protocols/Gadu-Gadu/src/image.cpp | 10 +- protocols/Gadu-Gadu/src/import.cpp | 4 +- protocols/Gadu-Gadu/src/links.cpp | 2 +- protocols/Gadu-Gadu/src/services.cpp | 2 +- protocols/IRCG/src/clist.cpp | 32 +- protocols/IRCG/src/commandmonitor.cpp | 30 +- protocols/IRCG/src/input.cpp | 10 +- protocols/IRCG/src/irc.h | 158 ++++----- protocols/IRCG/src/irclib.cpp | 6 +- protocols/IRCG/src/irclib.h | 16 +- protocols/IRCG/src/ircproto.cpp | 48 +-- protocols/IRCG/src/scripting.cpp | 6 +- protocols/IRCG/src/services.cpp | 42 +-- protocols/IRCG/src/ui_utils.cpp | 4 +- protocols/IRCG/src/ui_utils.h | 4 +- protocols/IRCG/src/userinfo.cpp | 12 +- protocols/IcqOscarJ/src/UI/askauthentication.cpp | 4 +- protocols/IcqOscarJ/src/UI/userinfotab.cpp | 6 +- protocols/IcqOscarJ/src/capabilities.cpp | 12 +- protocols/IcqOscarJ/src/cookies.cpp | 17 +- protocols/IcqOscarJ/src/cookies.h | 6 +- protocols/IcqOscarJ/src/directpackets.cpp | 12 +- protocols/IcqOscarJ/src/fam_01service.cpp | 6 +- protocols/IcqOscarJ/src/fam_02location.cpp | 19 +- protocols/IcqOscarJ/src/fam_03buddy.cpp | 6 +- protocols/IcqOscarJ/src/fam_04message.cpp | 161 ++++----- protocols/IcqOscarJ/src/fam_09bos.cpp | 2 +- protocols/IcqOscarJ/src/fam_13servclist.cpp | 22 +- protocols/IcqOscarJ/src/fam_15icqserver.cpp | 10 +- protocols/IcqOscarJ/src/icq_avatar.cpp | 12 +- protocols/IcqOscarJ/src/icq_avatar.h | 6 +- protocols/IcqOscarJ/src/icq_clients.cpp | 2 +- protocols/IcqOscarJ/src/icq_db.cpp | 36 +-- protocols/IcqOscarJ/src/icq_direct.cpp | 14 +- protocols/IcqOscarJ/src/icq_direct.h | 4 +- protocols/IcqOscarJ/src/icq_directmsg.cpp | 4 +- protocols/IcqOscarJ/src/icq_filerequests.cpp | 8 +- protocols/IcqOscarJ/src/icq_infoupdate.cpp | 4 +- protocols/IcqOscarJ/src/icq_menu.cpp | 32 +- protocols/IcqOscarJ/src/icq_popups.cpp | 2 +- protocols/IcqOscarJ/src/icq_proto.cpp | 46 +-- protocols/IcqOscarJ/src/icq_proto.h | 359 +++++++++++---------- protocols/IcqOscarJ/src/icq_rates.h | 2 +- protocols/IcqOscarJ/src/icq_server.cpp | 2 +- protocols/IcqOscarJ/src/icq_servlist.cpp | 117 ++++--- protocols/IcqOscarJ/src/icq_servlist.h | 6 +- protocols/IcqOscarJ/src/icq_uploadui.cpp | 14 +- protocols/IcqOscarJ/src/icq_xstatus.cpp | 22 +- protocols/IcqOscarJ/src/icq_xtraz.cpp | 12 +- protocols/IcqOscarJ/src/icqosc_svcs.cpp | 22 +- protocols/IcqOscarJ/src/oscar_filetransfer.cpp | 18 +- protocols/IcqOscarJ/src/oscar_filetransfer.h | 4 +- protocols/IcqOscarJ/src/stdpackets.cpp | 26 +- protocols/IcqOscarJ/src/utilities.cpp | 88 ++--- protocols/IcqOscarJ/src/utilities.h | 10 +- protocols/JabberG/src/jabber.h | 6 +- protocols/JabberG/src/jabber_adhoc.cpp | 2 +- protocols/JabberG/src/jabber_api.cpp | 4 +- protocols/JabberG/src/jabber_archive.cpp | 8 +- protocols/JabberG/src/jabber_chat.cpp | 22 +- protocols/JabberG/src/jabber_disco.cpp | 14 +- protocols/JabberG/src/jabber_events.cpp | 10 +- protocols/JabberG/src/jabber_groupchat.cpp | 10 +- protocols/JabberG/src/jabber_icolib.cpp | 6 +- protocols/JabberG/src/jabber_iq.h | 4 +- protocols/JabberG/src/jabber_iq_handlers.cpp | 2 +- protocols/JabberG/src/jabber_iqid.cpp | 24 +- protocols/JabberG/src/jabber_list.h | 4 +- protocols/JabberG/src/jabber_menu.cpp | 67 ++-- protocols/JabberG/src/jabber_message_manager.h | 4 +- protocols/JabberG/src/jabber_misc.cpp | 26 +- protocols/JabberG/src/jabber_notes.cpp | 2 +- protocols/JabberG/src/jabber_opt.cpp | 4 +- protocols/JabberG/src/jabber_privacy.cpp | 12 +- protocols/JabberG/src/jabber_proto.cpp | 61 ++-- protocols/JabberG/src/jabber_proto.h | 94 +++--- protocols/JabberG/src/jabber_rc.cpp | 4 +- protocols/JabberG/src/jabber_std.cpp | 4 +- protocols/JabberG/src/jabber_svc.cpp | 6 +- protocols/JabberG/src/jabber_thread.cpp | 22 +- protocols/JabberG/src/jabber_userinfo.cpp | 24 +- protocols/JabberG/src/jabber_util.cpp | 14 +- protocols/JabberG/src/jabber_xstatus.cpp | 28 +- protocols/JabberG/src/jabber_xstatus.h | 16 +- protocols/JabberG/src/ui_utils.cpp | 4 +- protocols/JabberG/src/ui_utils.h | 4 +- protocols/MRA/src/Mra.h | 20 +- protocols/MRA/src/MraAvatars.cpp | 16 +- protocols/MRA/src/MraChat.cpp | 24 +- protocols/MRA/src/MraFilesQueue.cpp | 6 +- protocols/MRA/src/MraPopUp.cpp | 4 +- protocols/MRA/src/MraProto.cpp | 44 +-- protocols/MRA/src/MraProto.h | 158 ++++----- protocols/MRA/src/MraSelectEMail.cpp | 6 +- protocols/MRA/src/MraSendCommand.cpp | 14 +- protocols/MRA/src/MraSendQueue.cpp | 8 +- protocols/MRA/src/MraSendQueue.h | 6 +- protocols/MRA/src/Mra_functions.cpp | 66 ++-- protocols/MRA/src/Mra_menus.cpp | 52 +-- protocols/MRA/src/Mra_proto.cpp | 28 +- protocols/MRA/src/Mra_svcs.cpp | 14 +- protocols/MSN/src/msn_avatar.cpp | 2 +- protocols/MSN/src/msn_chat.cpp | 34 +- protocols/MSN/src/msn_commands.cpp | 35 +- protocols/MSN/src/msn_contact.cpp | 13 +- protocols/MSN/src/msn_global.h | 148 ++++----- protocols/MSN/src/msn_links.cpp | 12 +- protocols/MSN/src/msn_lists.cpp | 65 ++-- protocols/MSN/src/msn_mail.cpp | 4 +- protocols/MSN/src/msn_menu.cpp | 32 +- protocols/MSN/src/msn_misc.cpp | 22 +- protocols/MSN/src/msn_msgqueue.cpp | 4 +- protocols/MSN/src/msn_opts.cpp | 2 +- protocols/MSN/src/msn_p2ps.cpp | 8 +- protocols/MSN/src/msn_proto.cpp | 56 ++-- protocols/MSN/src/msn_proto.h | 110 +++---- protocols/MSN/src/msn_soapab.cpp | 8 +- protocols/MSN/src/msn_srv.cpp | 4 +- protocols/MSN/src/msn_std.cpp | 6 +- protocols/MSN/src/msn_svcs.cpp | 13 +- protocols/MSN/src/msn_switchboard.cpp | 2 +- protocols/MSN/src/msn_threads.cpp | 4 +- protocols/MSN/src/msn_ws.cpp | 4 +- protocols/Omegle/src/chat.cpp | 4 +- protocols/Omegle/src/messages.cpp | 2 +- protocols/Omegle/src/proto.cpp | 4 +- protocols/Omegle/src/proto.h | 38 +-- protocols/Omegle/src/stubs.cpp | 34 +- protocols/Omegle/src/theme.cpp | 2 +- protocols/Skype/src/skype_avatars.cpp | 4 +- protocols/Skype/src/skype_blocked.cpp | 8 +- protocols/Skype/src/skype_chat.cpp | 102 +++--- protocols/Skype/src/skype_chat.h | 2 +- protocols/Skype/src/skype_contacts.cpp | 47 ++- protocols/Skype/src/skype_database.cpp | 8 +- protocols/Skype/src/skype_dialogs.cpp | 4 +- protocols/Skype/src/skype_events.cpp | 8 +- protocols/Skype/src/skype_instances.cpp | 2 +- protocols/Skype/src/skype_menus.cpp | 12 +- protocols/Skype/src/skype_messages.cpp | 24 +- protocols/Skype/src/skype_profile.cpp | 36 +-- protocols/Skype/src/skype_proto.cpp | 42 +-- protocols/Skype/src/skype_proto.h | 128 ++++---- protocols/Skype/src/skype_utils.cpp | 6 +- protocols/SkypeClassic/src/contacts.cpp | 44 +-- protocols/SkypeClassic/src/contacts.h | 11 +- protocols/SkypeClassic/src/gchat.cpp | 28 +- protocols/SkypeClassic/src/gchat.h | 6 +- protocols/SkypeClassic/src/skype.cpp | 111 +++---- protocols/SkypeClassic/src/skype.h | 4 +- protocols/SkypeClassic/src/skypeapi.cpp | 28 +- protocols/SkypeClassic/src/skypeapi.h | 2 +- protocols/SkypeClassic/src/skypeopt.cpp | 4 +- protocols/SkypeClassic/src/voiceservice.cpp | 6 +- protocols/SkypeClassic/src/voiceservice.h | 2 +- protocols/Tlen/src/tlen.cpp | 10 +- protocols/Tlen/src/tlen.h | 50 +-- protocols/Tlen/src/tlen_avatar.cpp | 14 +- protocols/Tlen/src/tlen_avatar.h | 2 +- protocols/Tlen/src/tlen_iqid.cpp | 16 +- protocols/Tlen/src/tlen_misc.cpp | 18 +- protocols/Tlen/src/tlen_muc.cpp | 12 +- protocols/Tlen/src/tlen_picture.cpp | 2 +- protocols/Tlen/src/tlen_picture.h | 2 +- protocols/Tlen/src/tlen_presence.cpp | 4 +- protocols/Tlen/src/tlen_svc.cpp | 66 ++-- protocols/Tlen/src/tlen_thread.cpp | 10 +- protocols/Tlen/src/tlen_userinfo.cpp | 8 +- protocols/Tlen/src/tlen_util.cpp | 2 +- protocols/Tlen/src/tlen_voice.cpp | 6 +- protocols/Twitter/src/chat.cpp | 4 +- protocols/Twitter/src/connection.cpp | 18 +- protocols/Twitter/src/contacts.cpp | 34 +- protocols/Twitter/src/proto.cpp | 20 +- protocols/Twitter/src/proto.h | 50 +-- protocols/Twitter/src/stubs.cpp | 28 +- protocols/Twitter/src/theme.cpp | 6 +- protocols/Twitter/src/ui.cpp | 2 +- protocols/VKontakte/src/misc.cpp | 8 +- protocols/VKontakte/src/vk_avatars.cpp | 10 +- protocols/VKontakte/src/vk_chats.cpp | 16 +- protocols/VKontakte/src/vk_proto.cpp | 44 +-- protocols/VKontakte/src/vk_proto.h | 48 +-- protocols/VKontakte/src/vk_thread.cpp | 10 +- protocols/WhatsApp/src/chat.cpp | 2 +- protocols/WhatsApp/src/contacts.cpp | 93 +++--- protocols/WhatsApp/src/entities.h | 8 +- protocols/WhatsApp/src/messages.cpp | 12 +- protocols/WhatsApp/src/proto.cpp | 10 +- protocols/WhatsApp/src/proto.h | 61 ++-- protocols/WhatsApp/src/theme.cpp | 18 +- protocols/Xfire/src/baseProtocol.h | 55 +--- protocols/Xfire/src/buddylist.cpp | 2 +- protocols/Xfire/src/buddylist.h | 96 +++--- protocols/Xfire/src/main.cpp | 96 +++--- protocols/Xfire/src/processbuddyinfo.cpp | 2 +- protocols/Xfire/src/processbuddyinfo.h | 2 +- protocols/Xfire/src/socket.h | 8 - protocols/Xfire/src/stdafx.h | 44 ++- protocols/Xfire/src/userdetails.cpp | 16 +- protocols/Yahoo/src/avatar.cpp | 17 +- protocols/Yahoo/src/chat.cpp | 34 +- protocols/Yahoo/src/file_transfer.cpp | 33 +- protocols/Yahoo/src/file_transfer.h | 2 +- protocols/Yahoo/src/im.cpp | 51 ++- protocols/Yahoo/src/links.cpp | 2 +- protocols/Yahoo/src/main.cpp | 2 +- protocols/Yahoo/src/proto.cpp | 181 ++++++----- protocols/Yahoo/src/proto.h | 110 +++---- protocols/Yahoo/src/services.cpp | 24 +- protocols/Yahoo/src/user_info.cpp | 4 +- protocols/Yahoo/src/util.cpp | 12 +- protocols/Yahoo/src/yahoo.cpp | 34 +- src/core/miranda.h | 6 +- src/core/stdauth/auth.cpp | 2 +- src/core/stdauth/authdialogs.cpp | 8 +- src/core/stdaway/awaymsg.cpp | 14 +- src/core/stdchat/src/window.cpp | 2 +- src/core/stdclist/src/clistopts.cpp | 23 +- src/core/stdemail/email.cpp | 12 +- src/core/stdfile/file.cpp | 22 +- src/core/stdfile/file.h | 8 +- src/core/stdfile/filerecvdlg.cpp | 2 +- src/core/stdmsg/src/cmdlist.cpp | 4 +- src/core/stdmsg/src/cmdlist.h | 6 +- src/core/stdmsg/src/globals.cpp | 4 +- src/core/stdmsg/src/msgdialog.cpp | 8 +- src/core/stdmsg/src/msglog.cpp | 4 +- src/core/stdmsg/src/msgoptions.cpp | 4 +- src/core/stdmsg/src/msgs.cpp | 34 +- src/core/stdmsg/src/msgs.h | 6 +- src/core/stdmsg/src/msgtimedout.cpp | 6 +- src/core/stdmsg/src/statusicon.cpp | 8 +- src/core/stdmsg/src/statusicon.h | 6 +- src/core/stduihist/history.cpp | 12 +- src/core/stdurl/url.cpp | 12 +- src/core/stdurl/url.h | 4 +- src/core/stdurl/urldialogs.cpp | 4 +- src/core/stduserinfo/contactinfo.cpp | 4 +- src/core/stduserinfo/stdinfo.cpp | 61 ++-- src/core/stduserinfo/userinfo.cpp | 8 +- src/core/stduseronline/useronline.cpp | 14 +- src/mir_core/db.cpp | 64 ++-- src/mir_core/protos.cpp | 2 +- src/modules/addcontact/addcontact.cpp | 14 +- src/modules/chat/chat.h | 26 +- src/modules/chat/chat_svc.cpp | 16 +- src/modules/chat/clist.cpp | 24 +- src/modules/chat/tools.cpp | 2 +- src/modules/clist/clc.cpp | 76 ++--- src/modules/clist/clc.h | 40 +-- src/modules/clist/clcfiledrop.cpp | 7 +- src/modules/clist/clcidents.cpp | 12 +- src/modules/clist/clcitems.cpp | 20 +- src/modules/clist/clcmsgs.cpp | 44 +-- src/modules/clist/clcutils.cpp | 2 +- src/modules/clist/clistevents.cpp | 21 +- src/modules/clist/clistmenus.cpp | 2 +- src/modules/clist/clistmod.cpp | 26 +- src/modules/clist/clistsettings.cpp | 20 +- src/modules/clist/clui.cpp | 12 +- src/modules/clist/contact.cpp | 26 +- src/modules/clist/genmenu.cpp | 2 +- src/modules/clist/groups.cpp | 4 +- src/modules/clist/movetogroup.cpp | 2 +- src/modules/database/dbintf.cpp | 2 +- src/modules/database/dbutils.cpp | 2 +- src/modules/extraicons/BaseExtraIcon.cpp | 4 +- src/modules/extraicons/CallbackExtraIcon.cpp | 6 +- src/modules/extraicons/DefaultExtraIcons.cpp | 14 +- src/modules/extraicons/ExtraIcon.cpp | 2 +- src/modules/extraicons/ExtraIcon.h | 44 +-- src/modules/extraicons/ExtraIconGroup.cpp | 14 +- src/modules/extraicons/IcolibExtraIcon.cpp | 8 +- src/modules/extraicons/extraicons.cpp | 8 +- src/modules/extraicons/extraicons.h | 4 +- src/modules/extraicons/options_ei.cpp | 2 +- src/modules/findadd/searchresults.cpp | 6 +- src/modules/ignore/ignore.cpp | 22 +- src/modules/protocols/protoaccs.cpp | 10 +- src/modules/protocols/protochains.cpp | 14 +- src/modules/protocols/protocols.cpp | 38 +-- src/modules/protocols/protoint.cpp | 46 +-- src/modules/srmm/statusicon.cpp | 4 +- src/modules/utils/path.cpp | 14 +- src/modules/utils/timezones.cpp | 10 +- src/modules/utils/windowlist.cpp | 4 +- src/modules/visibility/visibility.cpp | 4 +- 1006 files changed, 8593 insertions(+), 8964 deletions(-) diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib index 10ac7e7513..b17b49a665 100644 Binary files a/bin10/lib/mir_core.lib and b/bin10/lib/mir_core.lib differ diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib index 8f763d9797..2ec206c9c1 100644 Binary files a/bin10/lib/mir_core64.lib and b/bin10/lib/mir_core64.lib differ diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib index 2f6340a72c..9c8bcce0e2 100644 Binary files a/bin12/lib/mir_core.lib and b/bin12/lib/mir_core.lib differ diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib index fa777946e7..0068df3f94 100644 Binary files a/bin12/lib/mir_core64.lib and b/bin12/lib/mir_core64.lib differ diff --git a/include/m_addcontact.h b/include/m_addcontact.h index ffba5c2ca2..383d9e48e8 100644 --- a/include/m_addcontact.h +++ b/include/m_addcontact.h @@ -26,10 +26,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define M_ADDCONTACT_H__ 1 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 - const char *szProto; //ignored if acs.handleType != HANDLE_SEARCHRESULT - PROTOSEARCHRESULT *psr; //ignored if acs.handleType != HANDLE_SEARCHRESULT + 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 + 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 a91ca7ffb4..ce1e6eab69 100644 --- a/include/m_avatars.h +++ b/include/m_avatars.h @@ -56,6 +56,8 @@ unless AF_FETCHIFPROTONOTVISIBLE is set. #ifndef _M_AVATARS_H #define _M_AVATARS_H +#include + #define AVS_BITMAP_VALID 1 #define AVS_BITMAP_EXPIRED 2 // the bitmap has been expired from the cache. (unused, currently. #define AVS_HIDEONCLIST 4 @@ -65,20 +67,20 @@ unless AF_FETCHIFPROTONOTVISIBLE is set. #define AVS_PROTOPIC 16 // picture is a protocol picture #define AVS_CUSTOMTRANSPBKG 32 // Bitmap was changed to set the background color transparent #define AVS_HASTRANSPARENCY 64 // Bitmap has at least one pixel transparent -#define AVS_OWNAVATAR 128 // is own avatar entry +#define AVS_OWNAVATAR 128 // is own avatar entry #define AVS_NOTREADY 4096 typedef struct avatarCacheEntry { - DWORD cbSize; // set to sizeof(struct) - HANDLE hContact; // contacts handle, 0, if it is a protocol avatar - HBITMAP hbmPic; // bitmap handle of the picutre itself - DWORD dwFlags; // see above for flag values - LONG bmHeight, bmWidth; // bitmap dimensions - DWORD t_lastAccess; // last access time (currently unused, but plugins should still + DWORD cbSize; // set to sizeof(struct) + HCONTACT hContact; // contacts handle, 0, if it is a protocol avatar + HBITMAP hbmPic; // bitmap handle of the picutre itself + DWORD dwFlags; // see above for flag values + LONG bmHeight, bmWidth; // bitmap dimensions + DWORD t_lastAccess; // last access time (currently unused, but plugins should still // use it whenever they access the avatar. may be used in the future - // to implement cache expiration - LPVOID lpDIBSection; // unused field - TCHAR szFilename[MAX_PATH]; // filename of the avatar (absolute path) + // to implement cache expiration + LPVOID lpDIBSection; // unused field + TCHAR szFilename[MAX_PATH]; // filename of the avatar (absolute path) } AVATARCACHEENTRY; #define AVDRQ_FALLBACKPROTO 0x0001 // use the protocol picture as fallback (currently not used) diff --git a/include/m_chat.h b/include/m_chat.h index 0845defe19..7f02c687e1 100644 --- a/include/m_chat.h +++ b/include/m_chat.h @@ -492,15 +492,15 @@ struct GCEVENT */ // Flags -#define BYINDEX 0x0001 // iItem is valid and should contain the index of the session to get -#define BYID 0x0002 // pszID is valid and should contain the ID of the session to get. This is the default if no -#define HCONTACT 0x0004 // hContact is valid -#define DATA 0x0008 // wItemData is valid -#define ID 0x0010 // pszID is valid. -#define NAME 0x0020 // pszName is valid -#define TYPE 0x0040 // iType is valid -#define COUNT 0x0080 // iCount is valid -#define USERS 0x0100 // pszUsers is valid +#define GCF_BYINDEX 0x0001 // iItem is valid and should contain the index of the session to get +#define GCF_BYID 0x0002 // pszID is valid and should contain the ID of the session to get. This is the default if no +#define GCF_HCONTACT 0x0004 // hContact is valid +#define GCF_DATA 0x0008 // wItemData is valid +#define GCF_ID 0x0010 // pszID is valid. +#define GCF_NAME 0x0020 // pszName is valid +#define GCF_TYPE 0x0040 // iType is valid +#define GCF_COUNT 0x0080 // iCount is valid +#define GCF_USERS 0x0100 // pszUsers is valid // The GC_INFO structure struct GC_INFO @@ -515,7 +515,7 @@ struct GC_INFO int iCount; // count of users in the nicklist LPSTR pszUsers; // space separated string containing the UID's of the users in the user list. // NOTE. Use Mirandas mmi_free() on the returned string. - HANDLE hContact; // hContact for the session (can be NULL) + HCONTACT hContact; // hContact for the session (can be NULL) }; #define MS_GC_GETINFO "GChat/GetInfo" diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 98e14d30f7..a3b3c49548 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -209,7 +209,7 @@ struct GCSessionInfoBase WORD wCommandsNum; DWORD dwItemData; DWORD dwFlags; - HANDLE hContact; + HCONTACT hContact; HWND hwndStatus; time_t LastTime; @@ -369,11 +369,11 @@ struct CHAT_MANAGER BOOL (*LM_TrimLog)(LOGINFO** ppLogListStart, LOGINFO** ppLogListEnd, int iCount); BOOL (*LM_RemoveAll)(LOGINFO** ppLogListStart, LOGINFO** ppLogListEnd); - HANDLE (*AddRoom)(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisplayName, int iType); - BOOL (*SetOffline)(HANDLE hContact, BOOL bHide); + HCONTACT (*AddRoom)(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisplayName, int iType); + BOOL (*SetOffline)(HCONTACT hContact, BOOL bHide); BOOL (*SetAllOffline)(BOOL bHide, const char *pszModule); - BOOL (*AddEvent)(HANDLE hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR* fmt, ...); - HANDLE (*FindRoom)(const char *pszModule, const TCHAR *pszRoom); + BOOL (*AddEvent)(HCONTACT hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR* fmt, ...); + HCONTACT (*FindRoom)(const char *pszModule, const TCHAR *pszRoom); char* (*Log_CreateRTF)(LOGSTREAMDATA *streamData); char* (*Log_CreateRtfHeader)(MODULEINFO *mi); @@ -386,7 +386,7 @@ struct CHAT_MANAGER BOOL (*DoSoundsFlashPopupTrayStuff)(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix); BOOL (*DoTrayIcon)(SESSION_INFO *si, GCEVENT *gce); BOOL (*DoPopup)(SESSION_INFO *si, GCEVENT *gce); - int (*ShowPopup)(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...); + int (*ShowPopup)(HCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...); BOOL (*LogToFile)(SESSION_INFO *si, GCEVENT *gce); TCHAR* (*GetChatLogsFilename)(SESSION_INFO *si, time_t tTime); char* (*Log_SetStyle)(int style); diff --git a/include/m_clist.h b/include/m_clist.h index 5b198fd9b4..31df4f723d 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -31,6 +31,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "statusmodes.h" +#include + extern int hLangpack; #if defined _STATIC @@ -283,7 +285,7 @@ sense to store all this information in memory, etc. //bypasses the double-click. typedef struct { int cbSize; //size in bytes of this structure - HANDLE hContact; //handle to the contact to put the icon by + HCONTACT hContact; //handle to the contact to put the icon by HICON hIcon; //icon to flash DWORD flags; //...of course union diff --git a/include/m_clistint.h b/include/m_clistint.h index 8cda5111f7..d72c6738e3 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -107,7 +107,7 @@ struct ClcContactBase union { struct { int iImage; - HANDLE hContact; + HCONTACT hContact; }; struct { WORD groupId; @@ -244,7 +244,7 @@ typedef struct { typedef struct { - HANDLE hContact; + HCONTACT hContact; TCHAR* tszName; TCHAR* tszGroup; int bIsHidden; @@ -290,9 +290,9 @@ typedef struct int (*pfnAddInfoItemToGroup)(ClcGroup *group, int flags, const TCHAR *pszText); int (*pfnAddItemToGroup)(ClcGroup *group, int iAboveItem); - int (*pfnAddContactToGroup)(struct ClcData *dat, ClcGroup *group, HANDLE hContact); - void (*pfnAddContactToTree)(HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline); - void (*pfnDeleteItemFromTree)(HWND hwnd, HANDLE hItem); + int (*pfnAddContactToGroup)(struct ClcData *dat, ClcGroup *group, HCONTACT hContact); + void (*pfnAddContactToTree)(HWND hwnd, struct ClcData *dat, HCONTACT hContact, int updateTotalCount, int checkHideOffline); + void (*pfnDeleteItemFromTree)(HWND hwnd, HCONTACT hItem); void (*pfnRebuildEntireList)(HWND hwnd, struct ClcData *dat); int (*pfnGetGroupContentsCount)(ClcGroup *group, int visibleOnly); void (*pfnSortCLC)(HWND hwnd, struct ClcData *dat, int useInsertionSort); @@ -321,7 +321,7 @@ typedef struct int (*pfnClcStatusToPf2)(int status); int (*pfnIsHiddenMode)(struct ClcData *dat, int status); void (*pfnHideInfoTip)(HWND hwnd, struct ClcData *dat); - void (*pfnNotifyNewContact)(HWND hwnd, HANDLE hContact); + void (*pfnNotifyNewContact)(HWND hwnd, HCONTACT hContact); DWORD (*pfnGetDefaultExStyle)(void); void (*pfnGetDefaultFontSetting)(int i, LOGFONT* lf, COLORREF* colour); void (*pfnGetFontSetting)(int i, LOGFONT* lf, COLORREF* colour); @@ -337,22 +337,22 @@ typedef struct int (*pfnRowHitTest)(struct ClcData *dat, int y); /* clistevents.c */ - int (*pfnEventsProcessContactDoubleClick)(HANDLE hContact); + int (*pfnEventsProcessContactDoubleClick)(HCONTACT hContact); int (*pfnEventsProcessTrayDoubleClick)(int); /* clistmod.c */ - int (*pfnIconFromStatusMode)(const char *szProto, int status, HANDLE hContact); + int (*pfnIconFromStatusMode)(const char *szProto, int status, HCONTACT hContact); int (*pfnShowHide)(WPARAM, LPARAM); TCHAR* (*pfnGetStatusModeDescription)(int mode, int flags); /* clistsettings.c */ - ClcCacheEntry* (*pfnGetCacheEntry)(HANDLE hContact); - ClcCacheEntry* (*pfnCreateCacheItem)(HANDLE hContact); + ClcCacheEntry* (*pfnGetCacheEntry)(HCONTACT hContact); + ClcCacheEntry* (*pfnCreateCacheItem)(HCONTACT hContact); void (*pfnCheckCacheItem)(ClcCacheEntry*); void (*pfnFreeCacheItem)(ClcCacheEntry*); - TCHAR* (*pfnGetContactDisplayName)(HANDLE hContact, int mode); - void (*pfnInvalidateDisplayNameCacheEntry)(HANDLE hContact); + TCHAR* (*pfnGetContactDisplayName)(HCONTACT hContact, int mode); + void (*pfnInvalidateDisplayNameCacheEntry)(HCONTACT hContact); /* clisttray.c */ void (*pfnTrayIconUpdateWithImageList)(int iImage, const TCHAR *szNewTip, char *szPreferredProto); @@ -373,7 +373,7 @@ typedef struct void (*pfnOnCreateClc)(void); /* contact.c */ - void (*pfnChangeContactIcon)(HANDLE hContact, int iIcon, int add); + void (*pfnChangeContactIcon)(HCONTACT hContact, int iIcon, int add); void (*pfnLoadContactTree)(void); int (*pfnCompareContacts)(const ClcContact *contact1, const ClcContact *contact2); void (*pfnSortContacts)(void); @@ -402,9 +402,9 @@ typedef struct void (*pfnFreeEvent)(struct CListEvent*); struct CListEvent* (*pfnAddEvent)(CLISTEVENT*); - CLISTEVENT* (*pfnGetEvent)(HANDLE hContact, int idx); + CLISTEVENT* (*pfnGetEvent)(HCONTACT hContact, int idx); - int (*pfnRemoveEvent)(HANDLE hContact, HANDLE hDbEvent); + int (*pfnRemoveEvent)(HCONTACT hContact, HANDLE hDbEvent); int (*pfnGetImlIconIndex)(HICON hIcon); /************************************************************************************* @@ -443,7 +443,7 @@ typedef struct TCHAR* szTip; BOOL bTrayMenuOnScreen; - HICON (*pfnGetIconFromStatusMode)(HANDLE hContact, const char *szProto, int status); + HICON (*pfnGetIconFromStatusMode)(HCONTACT hContact, const char *szProto, int status); void (*pfnInitTray)(void); int (*pfnTrayIconAdd)(HWND hwnd, const char *szProto, const char *szIconProto, int status); @@ -471,12 +471,12 @@ typedef struct * version 7 additions (0.11.0.x) - extra images *************************************************************************************/ void (*pfnReloadExtraIcons)(void); - void (*pfnSetAllExtraIcons)(HANDLE hContact); + void (*pfnSetAllExtraIcons)(HCONTACT hContact); /************************************************************************************* * Miranda NG additions *************************************************************************************/ - int (*pfnGetContactIcon)(HANDLE hContact); + int (*pfnGetContactIcon)(HCONTACT hContact); int (*pfnTrayCalcChanged)(const char *szChangedProto, int averageMode, int iProtoCount); int (*pfnGetAverageMode)(int *pNetProtoCount); diff --git a/include/m_contacts.h b/include/m_contacts.h index 1e57e90ab2..c77f18e446 100644 --- a/include/m_contacts.h +++ b/include/m_contacts.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct { int cbSize; BYTE dwFlag; - HANDLE hContact; + HCONTACT hContact; char *szProto; BYTE type; union { diff --git a/include/m_core.h b/include/m_core.h index 4f77e965a5..803185233a 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -48,6 +48,8 @@ MIR_CORE_DLL(LPCTSTR) CmdLine_GetOption(LPCTSTR ptszParameter); /////////////////////////////////////////////////////////////////////////////// // database functions +DECLARE_HANDLE(HCONTACT); + typedef UINT32 MCONTACT; #define INVALID_CONTACT_ID (MCONTACT(-1)) @@ -125,9 +127,9 @@ are no contacts in the db. */ #if defined(__cplusplus) - MIR_CORE_DLL(HANDLE) db_find_first(const char *szProto = NULL); + MIR_CORE_DLL(HCONTACT) db_find_first(const char *szProto = NULL); #else - MIR_CORE_DLL(HANDLE) db_find_first(const char *szProto); + MIR_CORE_DLL(HCONTACT) db_find_first(const char *szProto); #endif /* @@ -139,9 +141,9 @@ hContact was the last contact in the db or hContact was invalid. */ #if defined(__cplusplus) - MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto = NULL); + MIR_CORE_DLL(HCONTACT) db_find_next(HCONTACT hContact, const char *szProto = NULL); #else - MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto); + MIR_CORE_DLL(HCONTACT) db_find_next(HCONTACT hContact, const char *szProto); #endif /****************************************************************************** @@ -170,7 +172,7 @@ db/time/x below with useful stuff for dealing with it. #define EVENTTYPE_AUTHREQUEST 1001 //specific codes, hence the module- #define EVENTTYPE_FILE 1002 //specific limit has been raised to 2000 -MIR_CORE_DLL(HANDLE) db_event_add(HANDLE hContact, DBEVENTINFO *dbei); +MIR_CORE_DLL(HANDLE) db_event_add(HCONTACT hContact, DBEVENTINFO *dbei); /* Gets the number of events in the chain belonging to a contact in the database. @@ -178,7 +180,7 @@ Returns the number of events in the chain owned by hContact or -1 if hContact is invalid. They can be retrieved using the db_event_first/last() services. */ -MIR_CORE_DLL(int) db_event_count(HANDLE hContact); +MIR_CORE_DLL(int) db_event_count(HCONTACT hContact); /* Removes a single event from the database @@ -187,7 +189,7 @@ Returns 0 on success, or nonzero if hDbEvent was invalid Triggers a db/event/deleted event just *before* the event is deleted */ -MIR_CORE_DLL(int) db_event_delete(HANDLE hContact, HANDLE hDbEvent); +MIR_CORE_DLL(int) db_event_delete(HCONTACT hContact, HANDLE hDbEvent); /* Retrieves a handle to the first event in the chain for hContact @@ -195,7 +197,7 @@ Returns the handle, or NULL if hContact is invalid or has no events Events in a chain are sorted chronologically automatically */ -MIR_CORE_DLL(HANDLE) db_event_first(HANDLE hContact); +MIR_CORE_DLL(HANDLE) db_event_first(HCONTACT hContact); /* Retrieves a handle to the first unread event in the chain for hContact @@ -209,7 +211,7 @@ This service is designed for startup, reloading all the events that remained unread from last time */ -MIR_CORE_DLL(HANDLE) db_event_firstUnread(HANDLE hContact); +MIR_CORE_DLL(HANDLE) db_event_firstUnread(HCONTACT hContact); /* Retrieves all the information stored in hDbEvent @@ -246,7 +248,7 @@ This service is exceptionally slow. Use only when you have no other choice at all. */ -MIR_CORE_DLL(HANDLE) db_event_getContact(HANDLE hDbEvent); +MIR_CORE_DLL(HCONTACT) db_event_getContact(HANDLE hDbEvent); /* Retrieves a handle to the last event in the chain for hContact @@ -254,7 +256,7 @@ Returns the handle, or NULL if hContact is invalid or has no events Events in a chain are sorted chronologically automatically */ -MIR_CORE_DLL(HANDLE) db_event_last(HANDLE hDbEvent); +MIR_CORE_DLL(HANDLE) db_event_last(HCONTACT hContact); /* Changes the flags for an event to mark it as read. @@ -265,7 +267,7 @@ This is the one database write operation that does not trigger an event. Modules should not save flags states for any length of time. */ -MIR_CORE_DLL(int) db_event_markRead(HANDLE hContact, HANDLE hDbEvent); +MIR_CORE_DLL(int) db_event_markRead(HCONTACT hContact, HANDLE hDbEvent); /* Retrieves a handle to the next event in a chain after hDbEvent @@ -287,33 +289,33 @@ MIR_CORE_DLL(HANDLE) db_event_prev(HANDLE hDbEvent); * DATABASE SETTINGS */ -MIR_CORE_DLL(INT_PTR) db_get(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); -MIR_CORE_DLL(int) db_get_b(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue); -MIR_CORE_DLL(int) db_get_w(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue); -MIR_CORE_DLL(DWORD) db_get_dw(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, DWORD errorValue); -MIR_CORE_DLL(char*) db_get_sa(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting); -MIR_CORE_DLL(WCHAR*) db_get_wsa(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting); +MIR_CORE_DLL(INT_PTR) db_get(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); +MIR_CORE_DLL(int) db_get_b(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue); +MIR_CORE_DLL(int) db_get_w(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, int errorValue); +MIR_CORE_DLL(DWORD) db_get_dw(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DWORD errorValue); +MIR_CORE_DLL(char*) db_get_sa(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting); +MIR_CORE_DLL(WCHAR*) db_get_wsa(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting); -MIR_CORE_DLL(int) db_get_static(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, char *pDest, int cbDest); -MIR_CORE_DLL(int) db_get_static_utf(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, char *pDest, int cbDest); -MIR_CORE_DLL(int) db_get_wstatic(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, WCHAR *pDest, int cbDest); +MIR_CORE_DLL(int) db_get_static(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, char *pDest, int cbDest); +MIR_CORE_DLL(int) db_get_static_utf(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, char *pDest, int cbDest); +MIR_CORE_DLL(int) db_get_wstatic(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, WCHAR *pDest, int cbDest); #if defined(__cplusplus) - MIR_CORE_DLL(INT_PTR) db_get_s(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, const int nType=DBVT_ASCIIZ); + MIR_CORE_DLL(INT_PTR) db_get_s(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, const int nType=DBVT_ASCIIZ); #else - MIR_CORE_DLL(INT_PTR) db_get_s(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, const int nType); + MIR_CORE_DLL(INT_PTR) db_get_s(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, const int nType); #endif -MIR_CORE_DLL(INT_PTR) db_set(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); -MIR_CORE_DLL(INT_PTR) db_set_b(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, BYTE val); -MIR_CORE_DLL(INT_PTR) db_set_w(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, WORD val); -MIR_CORE_DLL(INT_PTR) db_set_dw(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, DWORD val); -MIR_CORE_DLL(INT_PTR) db_set_s(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, LPCSTR val); -MIR_CORE_DLL(INT_PTR) db_set_ws(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, LPCWSTR val); -MIR_CORE_DLL(INT_PTR) db_set_utf(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, LPCSTR val); -MIR_CORE_DLL(INT_PTR) db_set_blob(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting, void *val, unsigned len); +MIR_CORE_DLL(INT_PTR) db_set(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); +MIR_CORE_DLL(INT_PTR) db_set_b(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, BYTE val); +MIR_CORE_DLL(INT_PTR) db_set_w(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, WORD val); +MIR_CORE_DLL(INT_PTR) db_set_dw(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, DWORD val); +MIR_CORE_DLL(INT_PTR) db_set_s(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, LPCSTR val); +MIR_CORE_DLL(INT_PTR) db_set_ws(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, LPCWSTR val); +MIR_CORE_DLL(INT_PTR) db_set_utf(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, LPCSTR val); +MIR_CORE_DLL(INT_PTR) db_set_blob(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting, void *val, unsigned len); -MIR_CORE_DLL(INT_PTR) db_unset(HANDLE hContact, LPCSTR szModule, LPCSTR szSetting); +MIR_CORE_DLL(INT_PTR) db_unset(HCONTACT hContact, LPCSTR szModule, LPCSTR szSetting); #if defined(__cplusplus) MIR_CORE_DLL(BOOL) db_set_resident(LPCSTR szModule, const char *szService, BOOL bEnable=TRUE); @@ -388,10 +390,10 @@ MIR_CORE_DLL(void) KillModuleServices(HINSTANCE hInst); MIR_CORE_DLL(void) KillObjectServices(void* pObject); #if defined(_STATIC) -__declspec(dllexport) INT_PTR CallContactService(HANDLE, const char *, WPARAM, LPARAM); +__declspec(dllexport) INT_PTR CallContactService(HCONTACT, const char *, WPARAM, LPARAM); __declspec(dllexport) INT_PTR CallProtoService(LPCSTR szModule, const char *szService, WPARAM wParam, LPARAM lParam); #else -MIR_C_CORE_DLL(INT_PTR) CallContactService(HANDLE, const char *, WPARAM, LPARAM); +MIR_C_CORE_DLL(INT_PTR) CallContactService(HCONTACT, const char *, WPARAM, LPARAM); MIR_C_CORE_DLL(INT_PTR) CallProtoService(LPCSTR szModule, const char *szService, WPARAM wParam, LPARAM lParam); #endif @@ -614,7 +616,7 @@ MIR_CORE_DLL(int) mir_vsnwprintf(WCHAR *buffer, size_t count, const WCHAR* fm MIR_CORE_DLL(INT_PTR) ProtoCallService(LPCSTR szModule, const char *szService, WPARAM wParam, LPARAM lParam); MIR_CORE_DLL(int) ProtoServiceExists(LPCSTR szModule, const char *szService); -MIR_CORE_DLL(INT_PTR) ProtoBroadcastAck(LPCSTR szModule, HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam); +MIR_CORE_DLL(INT_PTR) ProtoBroadcastAck(LPCSTR szModule, HCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam); // Call it in the very beginning of your proto's constructor MIR_CORE_DLL(void) ProtoConstructor(struct PROTO_INTERFACE *pThis, const char *pszModuleName, const TCHAR *ptszUserName); diff --git a/include/m_database.h b/include/m_database.h index b69663387e..a4891d6a4f 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -264,8 +264,9 @@ Returns DBEVENTTYPEDESCR* or NULL, if an event isn't found. #define MS_DB_EVENT_GETTYPE "DB/EventType/Get" -__forceinline HANDLE DbGetAuthEventContact(DBEVENTINFO* dbei) -{ return (HANDLE)(*(DWORD*)&dbei->pBlob[sizeof(DWORD)]); +__forceinline HCONTACT DbGetAuthEventContact(DBEVENTINFO* dbei) +{ + return (HCONTACT)(*(DWORD*)&dbei->pBlob[sizeof(DWORD)]); } /* DB/Event/GetText (0.7.0+) @@ -530,19 +531,19 @@ don't change any of the members. /* inlined range tolerate versions */ -__inline BYTE DBGetContactSettingRangedByte(HANDLE hContact, const char *szModule, const char *szSetting, BYTE errorValue, BYTE minValue, BYTE maxValue) +__inline BYTE DBGetContactSettingRangedByte(HCONTACT hContact, const char *szModule, const char *szSetting, BYTE errorValue, BYTE minValue, BYTE maxValue) { BYTE bVal = db_get_b(hContact, szModule, szSetting, errorValue); return (bVal < minValue || bVal > maxValue) ? errorValue : bVal; } -__inline WORD DBGetContactSettingRangedWord(HANDLE hContact, const char *szModule, const char *szSetting, WORD errorValue, WORD minValue, WORD maxValue) +__inline WORD DBGetContactSettingRangedWord(HCONTACT hContact, const char *szModule, const char *szSetting, WORD errorValue, WORD minValue, WORD maxValue) { WORD wVal = db_get_w(hContact, szModule, szSetting, errorValue); return (wVal < minValue || wVal > maxValue) ? errorValue : wVal; } -__inline DWORD DBGetContactSettingRangedDword(HANDLE hContact, const char *szModule, const char *szSetting, DWORD errorValue, DWORD minValue, DWORD maxValue) +__inline DWORD DBGetContactSettingRangedDword(HCONTACT hContact, const char *szModule, const char *szSetting, DWORD errorValue, DWORD minValue, DWORD maxValue) { DWORD dwVal = db_get_dw(hContact, szModule, szSetting, errorValue); return (dwVal < minValue || dwVal > maxValue) ? errorValue : dwVal; diff --git a/include/m_db_int.h b/include/m_db_int.h index 81a6c3a433..1a0ee644ed 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -86,7 +86,7 @@ interface MIDatabase STDMETHOD_(LONG,GetBlobSize)(HANDLE hDbEvent) PURE; STDMETHOD_(BOOL,GetEvent)(HANDLE hDbEvent, DBEVENTINFO *dbe) PURE; STDMETHOD_(BOOL,MarkEventRead)(MCONTACT contactID, HANDLE hDbEvent) PURE; - STDMETHOD_(HANDLE,GetEventContact)(HANDLE hDbEvent) PURE; + STDMETHOD_(MCONTACT,GetEventContact)(HANDLE hDbEvent) PURE; STDMETHOD_(HANDLE,FindFirstEvent)(MCONTACT contactID) PURE; STDMETHOD_(HANDLE,FindFirstUnreadEvent)(MCONTACT contactID) PURE; STDMETHOD_(HANDLE,FindLastEvent)(MCONTACT contactID) PURE; diff --git a/include/m_extraicons.h b/include/m_extraicons.h index f6feb26397..e67eec4905 100644 --- a/include/m_extraicons.h +++ b/include/m_extraicons.h @@ -95,14 +95,14 @@ typedef struct { MIRANDAHOOK RebuildIcons; // Callback to set the icon to clist, calling MS_CLIST_EXTRA_SET_ICON or MS_EXTRAICON_SET_ICON - // wParam = HANDLE hContact + // wParam = HCONTACT hContact // lParam = 0 MIRANDAHOOK ApplyIcon; // Other optional callbacks // [Optional] Callback called when extra icon was clicked - // wParam = HANDLE hContact + // wParam = HCONTACT hContact // lParam = int slot // param = onClickParam MIRANDAHOOKPARAM OnClick; @@ -122,7 +122,7 @@ typedef struct { typedef struct { int cbSize; HANDLE hExtraIcon; // Value returned by MS_EXTRAICON_REGISTER - HANDLE hContact; // Contact to set the extra icon + HCONTACT hContact; // Contact to set the extra icon union { // The icon to be set. This depends on the type of the extra icon: HANDLE hImage; // Value returned by MS_CLIST_EXTRA_ADD_ICON (if EXTRAICON_TYPE_CALLBACK) // or the icolib icon handle (if EXTRAICON_TYPE_ICOLIB) @@ -185,7 +185,7 @@ static HANDLE ExtraIcon_Register( return (HANDLE) CallService(MS_EXTRAICON_REGISTER, (WPARAM) &ei, hLangpack); } -static int ExtraIcon_SetIcon(HANDLE hExtraIcon, HANDLE hContact, HANDLE hImage) +static int ExtraIcon_SetIcon(HANDLE hExtraIcon, HCONTACT hContact, HANDLE hImage) { EXTRAICON ei = { sizeof(ei) }; ei.hExtraIcon = hExtraIcon; @@ -195,7 +195,7 @@ static int ExtraIcon_SetIcon(HANDLE hExtraIcon, HANDLE hContact, HANDLE hImage) return CallService(MS_EXTRAICON_SET_ICON, (WPARAM) &ei, 0); } -static int ExtraIcon_SetIcon(HANDLE hExtraIcon, HANDLE hContact, const char *icoName) +static int ExtraIcon_SetIcon(HANDLE hExtraIcon, HCONTACT hContact, const char *icoName) { EXTRAICON ei = { sizeof(ei) }; ei.hExtraIcon = hExtraIcon; @@ -205,7 +205,7 @@ static int ExtraIcon_SetIcon(HANDLE hExtraIcon, HANDLE hContact, const char *ico return CallService(MS_EXTRAICON_SET_ICON_BY_NAME, (WPARAM) &ei, 0); } -static int ExtraIcon_Clear(HANDLE hExtraIcon, HANDLE hContact) +static int ExtraIcon_Clear(HANDLE hExtraIcon, HCONTACT hContact) { EXTRAICON ei = { sizeof(ei) }; ei.hExtraIcon = hExtraIcon; diff --git a/include/m_jabber.h b/include/m_jabber.h index 4484baa87e..97489b0d39 100644 --- a/include/m_jabber.h +++ b/include/m_jabber.h @@ -105,10 +105,10 @@ struct IJabberInterface virtual int STDMETHODCALLTYPE CompareJIDs(LPCTSTR jid1, LPCTSTR jid2) = 0; // Returns contact handle for given JID, or NULL on error. - virtual HANDLE STDMETHODCALLTYPE ContactFromJID(LPCTSTR jid) = 0; + virtual HCONTACT STDMETHODCALLTYPE ContactFromJID(LPCTSTR jid) = 0; // Returns JID of hContact, or NULL on error. You must free the result using mir_free(). - virtual LPTSTR STDMETHODCALLTYPE ContactToJID(HANDLE hContact) = 0; + virtual LPTSTR STDMETHODCALLTYPE ContactToJID(HCONTACT hContact) = 0; // Returns best resource name for given JID, or NULL on error. You must free the result using mir_free(). virtual LPTSTR STDMETHODCALLTYPE GetBestResourceName(LPCTSTR jid) = 0; diff --git a/include/m_message.h b/include/m_message.h index 3fd5188fce..277084e113 100644 --- a/include/m_message.h +++ b/include/m_message.h @@ -62,7 +62,7 @@ extern int hLangpack; typedef struct { int cbSize; - HANDLE hContact; + HCONTACT hContact; HWND hwndWindow; // top level window for the contact const char* szModule; // used to get plugin type (which means you could use local if needed) unsigned int uType; // see event types above @@ -90,7 +90,7 @@ typedef struct { typedef struct { int cbSize; - HANDLE hContact; + HCONTACT hContact; int uFlags; // see uflags above } MessageWindowInputData; @@ -101,7 +101,7 @@ typedef struct { typedef struct { int cbSize; - HANDLE hContact; + HCONTACT hContact; int uFlags; // should be same as input data unless 0, then it will be the actual type HWND hwndWindow; //top level window for the contact or NULL if no window exists int uState; // see window states @@ -121,7 +121,7 @@ typedef struct { typedef struct { int cbSize; int seq; // number returned by PSS_MESSAGE - HANDLE hContact; + HCONTACT hContact; DBEVENTINFO *dbei; // database event written on the basis of message sent } MessageWindowEvent; @@ -146,7 +146,7 @@ typedef struct { int cbSize; unsigned int uType; // see popup types above unsigned int uFlags; // used to indicate in which window the popup was requested - HANDLE hContact; + HCONTACT hContact; HWND hwnd; // window where the popup was requested HMENU hMenu; // The handle to the menu POINT pt; // The point, in screen coords @@ -213,7 +213,7 @@ __forceinline void Srmm_RemoveIcon(StatusIconData *sid) // if either hIcon, hIconDisabled or szTooltip is null, they will not be modified #define MS_MSG_MODIFYICON "MessageAPI/ModifyIcon" -__forceinline void Srmm_ModifyIcon(HANDLE hContact, StatusIconData *sid) +__forceinline void Srmm_ModifyIcon(HCONTACT hContact, StatusIconData *sid) { CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)sid); } @@ -222,7 +222,7 @@ __forceinline void Srmm_ModifyIcon(HANDLE hContact, StatusIconData *sid) // returns (StatusIconData*)icon description filled for the required contact // don't free this memory. -__forceinline StatusIconData* Srmm_GetNthIcon(HANDLE hContact, int index) +__forceinline StatusIconData* Srmm_GetNthIcon(HCONTACT hContact, int index) { return (StatusIconData*)CallService("MessageAPI/GetNthIcon", (WPARAM)hContact, index); } diff --git a/include/m_popup.h b/include/m_popup.h index 9109dd33bb..72f3d11b62 100644 --- a/include/m_popup.h +++ b/include/m_popup.h @@ -32,7 +32,7 @@ mi.position = 0; //You don't need it and it's better if you put it to zero. // Extended popup data typedef struct { - HANDLE lchContact; + HCONTACT lchContact; HICON lchIcon; union { @@ -55,7 +55,7 @@ typedef struct // Unicode version of POPUPDATA typedef struct { - HANDLE lchContact; + HCONTACT lchContact; HICON lchIcon; union { @@ -130,8 +130,9 @@ lParam = 0; Returns: the HANDLE of the contact. Can return NULL, meaning it's the main contact. -1 means failure. */ #define MS_POPUP_GETCONTACT "Popup/GetContact" -static HANDLE __inline PUGetContact(HWND hPopupWindow) { - return (HANDLE)CallService(MS_POPUP_GETCONTACT, (WPARAM)hPopupWindow, 0); +static HCONTACT __inline PUGetContact(HWND hPopupWindow) +{ + return (HCONTACT)CallService(MS_POPUP_GETCONTACT, (WPARAM)hPopupWindow, 0); } /* Popup/GetPluginData @@ -374,7 +375,7 @@ typedef struct { const TCHAR *ptszText; }; void *PluginData; - HANDLE hContact; + HCONTACT hContact; } POPUPDATACLASS; // wParam = 0 diff --git a/include/m_protocols.h b/include/m_protocols.h index b34b8d8f50..6907f5197e 100644 --- a/include/m_protocols.h +++ b/include/m_protocols.h @@ -37,7 +37,7 @@ struct PROTO_INTERFACE; //returns the value as documented in the PS_ definition (m_protosvc.h) typedef struct { - HANDLE hContact; + HCONTACT hContact; const char *szProtoService; //a PS_ constant WPARAM wParam; LPARAM lParam; @@ -54,7 +54,7 @@ typedef struct { typedef struct { int cbSize; const char *szModule; //the name of the protocol module which initiated this ack - HANDLE hContact; + HCONTACT hContact; int type; //an ACKTYPE_ constant int result; //an ACKRESULT_ constant HANDLE hProcess; //a caller-defined process code @@ -120,7 +120,7 @@ typedef struct { typedef struct tagPROTOFILETRANSFERSTATUS { size_t cbSize; - HANDLE hContact; + HCONTACT hContact; DWORD flags; // one of PFTS_* constants union { @@ -232,7 +232,7 @@ typedef struct { //contact. #define MS_PROTO_GETCONTACTBASEPROTO "Proto/GetContactBaseProto" -__forceinline char* GetContactProto(HANDLE hContact) +__forceinline char* GetContactProto(HCONTACT hContact) { return (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); } @@ -404,7 +404,7 @@ ProtoBroadcastAck(), listeners must hook ME_PROTO_ACK, note that lParam = ACKDAT typedef struct { 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_* char filename[MAX_PATH]; // full path to filename which contains the avatar } PROTO_AVATAR_INFORMATION; @@ -412,7 +412,7 @@ typedef struct { #ifdef _UNICODE typedef struct { 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_* WCHAR filename[MAX_PATH]; // full path to filename which contains the avatar } PROTO_AVATAR_INFORMATIONW; diff --git a/include/m_protoint.h b/include/m_protoint.h index 93103629fa..7f1230b06b 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -72,68 +72,68 @@ struct PROTO_INTERFACE : public MZeroedObject ProtoLogW(this, wszFormat, args); } - __forceinline INT_PTR ProtoBroadcastAck(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam) { + __forceinline INT_PTR ProtoBroadcastAck(HCONTACT hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam) { return ::ProtoBroadcastAck(m_szModuleName, hContact, type, hResult, hProcess, lParam); } __forceinline INT_PTR delSetting(const char *name) { return db_unset(NULL, m_szModuleName, name); } - __forceinline INT_PTR delSetting(HANDLE hContact, const char *name) { return db_unset(hContact, m_szModuleName, name); } + __forceinline INT_PTR delSetting(HCONTACT hContact, const char *name) { return db_unset(hContact, m_szModuleName, name); } __forceinline bool getBool(const char *name, bool defaultValue) { return db_get_b(NULL, m_szModuleName, name, defaultValue) != 0; } - __forceinline bool getBool(HANDLE hContact, const char *name, bool defaultValue) { + __forceinline bool getBool(HCONTACT hContact, const char *name, bool defaultValue) { return db_get_b(hContact, m_szModuleName, name, defaultValue) != 0; } - __forceinline bool isChatRoom(HANDLE hContact) { return getBool(hContact, "ChatRoom", false); } + __forceinline bool isChatRoom(HCONTACT hContact) { return getBool(hContact, "ChatRoom", false); } __forceinline int getByte(const char *name, BYTE defaultValue) { return db_get_b(NULL, m_szModuleName, name, defaultValue); } - __forceinline int getByte(HANDLE hContact, const char *name, BYTE defaultValue) { + __forceinline int getByte(HCONTACT hContact, const char *name, BYTE defaultValue) { return db_get_b(hContact, m_szModuleName, name, defaultValue); } __forceinline int getWord(const char *name, WORD defaultValue) { return db_get_w(NULL, m_szModuleName, name, defaultValue); } - __forceinline int getWord(HANDLE hContact, const char *name, WORD defaultValue) { + __forceinline int getWord(HCONTACT hContact, const char *name, WORD defaultValue) { return db_get_w(hContact, m_szModuleName, name, defaultValue); } __forceinline DWORD getDword(const char *name, DWORD defaultValue) { return db_get_dw(NULL, m_szModuleName, name, defaultValue); } - __forceinline DWORD getDword(HANDLE hContact, const char *name, DWORD defaultValue) { + __forceinline DWORD getDword(HCONTACT hContact, const char *name, DWORD defaultValue) { return db_get_dw(hContact, m_szModuleName, name, defaultValue); } __forceinline INT_PTR getString(const char *name, DBVARIANT *result) { return db_get_s(NULL, m_szModuleName, name, result); } - __forceinline INT_PTR getString(HANDLE hContact, const char *name, DBVARIANT *result) { + __forceinline INT_PTR getString(HCONTACT hContact, const char *name, DBVARIANT *result) { return db_get_s(hContact, m_szModuleName, name, result); } __forceinline INT_PTR getWString(const char *name, DBVARIANT *result) { return db_get_ws(NULL, m_szModuleName, name, result); } - __forceinline INT_PTR getWString(HANDLE hContact, const char *name, DBVARIANT *result) { + __forceinline INT_PTR getWString(HCONTACT hContact, const char *name, DBVARIANT *result) { return db_get_ws(hContact, m_szModuleName, name, result); } __forceinline char* getStringA(const char *name) { return db_get_sa(NULL, m_szModuleName, name); } - __forceinline char* getStringA(HANDLE hContact, const char *name) { + __forceinline char* getStringA(HCONTACT hContact, const char *name) { return db_get_sa(hContact, m_szModuleName, name); } __forceinline WCHAR* getWStringA(const char *name) { return db_get_wsa(NULL, m_szModuleName, name); } - __forceinline WCHAR* getWStringA(HANDLE hContact, const char *name) { + __forceinline WCHAR* getWStringA(HCONTACT hContact, const char *name) { return db_get_wsa(hContact, m_szModuleName, name); } __forceinline void setByte(const char *name, BYTE value) { db_set_b(NULL, m_szModuleName, name, value); } - __forceinline void setByte(HANDLE hContact, const char *name, BYTE value) { db_set_b(hContact, m_szModuleName, name, value); } + __forceinline void setByte(HCONTACT hContact, const char *name, BYTE value) { db_set_b(hContact, m_szModuleName, name, value); } __forceinline void setWord(const char *name, WORD value) { db_set_w(NULL, m_szModuleName, name, value); } - __forceinline void setWord(HANDLE hContact, const char *name, WORD value) { db_set_w(hContact, m_szModuleName, name, value); } + __forceinline void setWord(HCONTACT hContact, const char *name, WORD value) { db_set_w(hContact, m_szModuleName, name, value); } __forceinline void setDword(const char *name, DWORD value) { db_set_dw(NULL, m_szModuleName, name, value); } - __forceinline void setDword(HANDLE hContact, const char *name, DWORD value) { db_set_dw(hContact, m_szModuleName, name, value); } + __forceinline void setDword(HCONTACT hContact, const char *name, DWORD value) { db_set_dw(hContact, m_szModuleName, name, value); } __forceinline void setString(const char *name, const char* value) { db_set_s(NULL, m_szModuleName, name, value); } - __forceinline void setString(HANDLE hContact, const char *name, const char* value) { db_set_s(hContact, m_szModuleName, name, value); } + __forceinline void setString(HCONTACT hContact, const char *name, const char* value) { db_set_s(hContact, m_szModuleName, name, value); } __forceinline void setWString(const char *name, const WCHAR* value) { db_set_ws(NULL, m_szModuleName, name, value); } - __forceinline void setWString(HANDLE hContact, const char *name, const WCHAR* value) { db_set_ws(hContact, m_szModuleName, name, value); } + __forceinline void setWString(HCONTACT hContact, const char *name, const WCHAR* value) { db_set_ws(hContact, m_szModuleName, name, value); } #if defined(_UNICODE) #define debugLog debugLogW @@ -155,18 +155,18 @@ struct PROTO_INTERFACE : public MZeroedObject virtual int __cdecl Authorize(HANDLE hDbEvent) = 0; virtual int __cdecl AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason) = 0; - virtual int __cdecl AuthRecv(HANDLE hContact, PROTORECVEVENT*) = 0; - virtual int __cdecl AuthRequest(HANDLE hContact, const PROTOCHAR* szMessage) = 0; + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT*) = 0; + virtual int __cdecl AuthRequest(HCONTACT hContact, const PROTOCHAR* szMessage) = 0; virtual HANDLE __cdecl ChangeInfo(int iInfoType, void* pInfoData) = 0; - virtual HANDLE __cdecl FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath) = 0; - virtual int __cdecl FileCancel(HANDLE hContact, HANDLE hTransfer) = 0; - virtual int __cdecl FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason) = 0; + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath) = 0; + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer) = 0; + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason) = 0; virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** szFilename) = 0; - virtual DWORD_PTR __cdecl GetCaps(int type, HANDLE hContact = NULL) = 0; - virtual int __cdecl GetInfo(HANDLE hContact, int infoType) = 0; + virtual DWORD_PTR __cdecl GetCaps(int type, HCONTACT hContact = NULL) = 0; + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType) = 0; virtual HANDLE __cdecl SearchBasic(const PROTOCHAR* id) = 0; virtual HANDLE __cdecl SearchByEmail(const PROTOCHAR* email) = 0; @@ -174,24 +174,24 @@ struct PROTO_INTERFACE : public MZeroedObject virtual HWND __cdecl SearchAdvanced(HWND owner) = 0; virtual HWND __cdecl CreateExtendedSearchUI(HWND owner) = 0; - virtual int __cdecl RecvContacts(HANDLE hContact, PROTORECVEVENT*) = 0; - virtual int __cdecl RecvFile(HANDLE hContact, PROTOFILEEVENT*) = 0; - virtual int __cdecl RecvMsg(HANDLE hContact, PROTORECVEVENT*) = 0; - virtual int __cdecl RecvUrl(HANDLE hContact, PROTORECVEVENT*) = 0; + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT*) = 0; + virtual int __cdecl RecvFile(HCONTACT hContact, PROTOFILEEVENT*) = 0; + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT*) = 0; + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT*) = 0; - virtual int __cdecl SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList) = 0; - virtual HANDLE __cdecl SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) = 0; - virtual int __cdecl SendMsg(HANDLE hContact, int flags, const char* msg) = 0; - virtual int __cdecl SendUrl(HANDLE hContact, int flags, const char* url) = 0; + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) = 0; + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const PROTOCHAR *szDescription, PROTOCHAR **ppszFiles) = 0; + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char *msg) = 0; + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char *url) = 0; - virtual int __cdecl SetApparentMode(HANDLE hContact, int mode) = 0; + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode) = 0; virtual int __cdecl SetStatus(int iNewStatus) = 0; - virtual HANDLE __cdecl GetAwayMsg(HANDLE hContact) = 0; - virtual int __cdecl RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT* evt) = 0; + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact) = 0; + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt) = 0; virtual int __cdecl SetAwayMsg(int iStatus, const PROTOCHAR* msg) = 0; - virtual int __cdecl UserIsTyping(HANDLE hContact, int type) = 0; + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type) = 0; virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) = 0; }; diff --git a/include/m_protomod.h b/include/m_protomod.h index efa76d729f..cc10b2707a 100644 --- a/include/m_protomod.h +++ b/include/m_protomod.h @@ -101,17 +101,17 @@ __forceinline HANDLE CreateProtoServiceFunction(const char *szModule, const char //differences between threads the functions are in. #define MS_PROTO_CHAINRECV "Proto/ChainRecv" -__forceinline INT_PTR ProtoChainRecv(HANDLE hContact, char *szService, WPARAM wParam, LPARAM lParam) +__forceinline INT_PTR ProtoChainRecv(HCONTACT hContact, char *szService, WPARAM wParam, LPARAM lParam) { CCSDATA ccs = { hContact, szService, wParam, lParam }; return CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); } -__forceinline INT_PTR ProtoChainRecvMsg(HANDLE hContact, PROTORECVEVENT *pre) +__forceinline INT_PTR ProtoChainRecvMsg(HCONTACT hContact, PROTORECVEVENT *pre) { CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)pre }; return CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); } -__forceinline INT_PTR ProtoChainRecvFile(HANDLE hContact, PROTORECVFILET *pre) +__forceinline INT_PTR ProtoChainRecvFile(HCONTACT hContact, PROTORECVFILET *pre) { CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)pre }; return CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); } diff --git a/include/m_protosvc.h b/include/m_protosvc.h index 1d29112910..292be2be1e 100644 --- a/include/m_protosvc.h +++ b/include/m_protosvc.h @@ -740,7 +740,7 @@ Returns the result of db_event_add() #define MS_PROTO_RECVMSG "Proto/RecvMessage" -__forceinline INT_PTR Proto_RecvMessage(HANDLE hContact, PROTORECVEVENT *pcre) +__forceinline INT_PTR Proto_RecvMessage(HCONTACT hContact, PROTORECVEVENT *pcre) { CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)pcre }; return CallService(MS_PROTO_RECVMSG, 0, (LPARAM)&ccs ); @@ -777,7 +777,7 @@ typedef struct { #define MS_PROTO_RECVFILET "Proto/RecvFileT" -__forceinline INT_PTR Proto_RecvFile(HANDLE hContact, PROTORECVFILET *pcre) +__forceinline INT_PTR Proto_RecvFile(HCONTACT hContact, PROTORECVFILET *pcre) { CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)pcre }; return CallService(MS_PROTO_RECVFILET, 0, ( LPARAM )&ccs); diff --git a/include/m_timezones.h b/include/m_timezones.h index 3be1c57602..8bfb425a73 100644 --- a/include/m_timezones.h +++ b/include/m_timezones.h @@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __M_TIMEZONES_H #define __M_TIMEZONES_H +#include + #define MIM_TZ_NAMELEN 64 #define TZF_PLF_CB 1 // UI element is assumed to be a combo box @@ -42,15 +44,15 @@ typedef struct size_t cbSize; HANDLE (*createByName)(LPCTSTR tszName, DWORD dwFlags); - HANDLE (*createByContact)(HANDLE hContact, DWORD dwFlags); - void (*storeByContact)(HANDLE hContact, HANDLE hTZ); + HANDLE (*createByContact)(HCONTACT hContact, DWORD dwFlags); + void (*storeByContact)(HCONTACT hContact, HANDLE hTZ); int (*printDateTime)(HANDLE hTZ, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags); int (*printTimeStamp)(HANDLE hTZ, mir_time ts, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags); - int (*prepareList)(HANDLE hContact, HWND hWnd, DWORD dwFlags); - int (*selectListItem)(HANDLE hContact, HWND hWnd, DWORD dwFlags); - void (*storeListResults)(HANDLE hContact, HWND hWnd, DWORD dwFlags); + int (*prepareList)(HCONTACT hContact, HWND hWnd, DWORD dwFlags); + int (*selectListItem)(HCONTACT hContact, HWND hWnd, DWORD dwFlags); + void (*storeListResults)(HCONTACT hContact, HWND hWnd, DWORD dwFlags); int (*getTimeZoneTime)(HANDLE hTZ, SYSTEMTIME *st); mir_time (*timeStampToTimeZoneTimeStamp)(HANDLE hTZ, mir_time ts); @@ -60,19 +62,19 @@ typedef struct LPCTSTR (*getTzDescription)(LPCTSTR TZname); #ifdef __cplusplus - int printDateTimeByContact (HANDLE hContact, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags) + int printDateTimeByContact (HCONTACT hContact, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags) { return printDateTime(createByContact(hContact, dwFlags), szFormat, szDest, cbDest, dwFlags); } - int printTimeStampByContact(HANDLE hContact, mir_time ts, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags) + int printTimeStampByContact(HCONTACT hContact, mir_time ts, LPCTSTR szFormat, LPTSTR szDest, int cbDest, DWORD dwFlags) { return printTimeStamp(createByContact(hContact, dwFlags), ts, szFormat, szDest, cbDest, dwFlags); } - LPTIME_ZONE_INFORMATION getTziByContact(HANDLE hContact) + LPTIME_ZONE_INFORMATION getTziByContact(HCONTACT hContact) { return getTzi(createByContact(hContact, 0)); } - int getTimeZoneTimeByContact(HANDLE hContact, SYSTEMTIME *st) + int getTimeZoneTimeByContact(HCONTACT hContact, SYSTEMTIME *st) { return getTimeZoneTime(createByContact(hContact, 0), st); } - mir_time timeStampToTimeZoneTimeStampByContact(HANDLE hContact, mir_time ts) + mir_time timeStampToTimeZoneTimeStampByContact(HCONTACT hContact, mir_time ts) { return timeStampToTimeZoneTimeStamp(createByContact(hContact, 0), ts); } #endif diff --git a/include/m_utils.h b/include/m_utils.h index b23cd1cdf2..10f498609c 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -160,10 +160,10 @@ __forceinline HANDLE WindowList_Destroy(HANDLE hList) typedef struct { HANDLE hList; HWND hwnd; - HANDLE hContact; + HCONTACT hContact; } WINDOWLISTENTRY; #define MS_UTILS_ADDTOWINDOWLIST "Utils/AddToWindowList" -__forceinline INT_PTR WindowList_Add(HANDLE hList, HWND hwnd, HANDLE hContact) { +__forceinline INT_PTR WindowList_Add(HANDLE hList, HWND hwnd, HCONTACT hContact) { WINDOWLISTENTRY wle; wle.hList = hList; wle.hwnd = hwnd; wle.hContact = hContact; return CallService(MS_UTILS_ADDTOWINDOWLIST, 0, (LPARAM)&wle); @@ -183,7 +183,7 @@ __forceinline INT_PTR WindowList_Remove(HANDLE hList, HWND hwnd) { // lParam = (WPARAM)(HANDLE)hContact // returns the window handle on success, or NULL on failure #define MS_UTILS_FINDWINDOWINLIST "Utils/FindWindowInList" -__forceinline HWND WindowList_Find(HANDLE hList, HANDLE hContact) { +__forceinline HWND WindowList_Find(HANDLE hList, HCONTACT hContact) { return (HWND)CallService(MS_UTILS_FINDWINDOWINLIST, (WPARAM)hList, (LPARAM)hContact); } @@ -236,12 +236,12 @@ __forceinline INT_PTR WindowList_BroadcastAsync(HANDLE hList, UINT message, WPAR //returns 0 on success, nonzero on failure typedef struct { HWND hwnd; - HANDLE hContact; + HCONTACT hContact; const char *szModule; //module name to store the setting in const char *szNamePrefix; //text to prefix on "x", "width", etc, to form setting names } SAVEWINDOWPOS; #define MS_UTILS_SAVEWINDOWPOSITION "Utils/SaveWindowPos" -__forceinline INT_PTR Utils_SaveWindowPosition(HWND hwnd, HANDLE hContact, const char *szModule, const char *szNamePrefix) { +__forceinline INT_PTR Utils_SaveWindowPosition(HWND hwnd, HCONTACT hContact, const char *szModule, const char *szNamePrefix) { SAVEWINDOWPOS swp; swp.hwnd = hwnd; swp.hContact = hContact; swp.szModule = szModule; swp.szNamePrefix = szNamePrefix; return CallService(MS_UTILS_SAVEWINDOWPOSITION, 0, (LPARAM)&swp); @@ -260,18 +260,18 @@ __forceinline INT_PTR Utils_SaveWindowPosition(HWND hwnd, HANDLE hContact, const #define RWPF_NOACTIVATE 4 //show but don't activate v0.3.3.0+ #define RWPF_HIDDEN 8 //make it hidden #define MS_UTILS_RESTOREWINDOWPOSITION "Utils/RestoreWindowPos" -__forceinline INT_PTR Utils_RestoreWindowPositionEx(HWND hwnd, int flags, HANDLE hContact, const char *szModule, const char *szNamePrefix) { +__forceinline INT_PTR Utils_RestoreWindowPositionEx(HWND hwnd, int flags, HCONTACT hContact, const char *szModule, const char *szNamePrefix) { SAVEWINDOWPOS swp; swp.hwnd = hwnd; swp.hContact = hContact; swp.szModule = szModule; swp.szNamePrefix = szNamePrefix; return CallService(MS_UTILS_RESTOREWINDOWPOSITION, flags, (LPARAM)&swp); } -__forceinline INT_PTR Utils_RestoreWindowPosition(HWND hwnd, HANDLE hContact, const char *szModule, const char *szNamePrefix) { +__forceinline INT_PTR Utils_RestoreWindowPosition(HWND hwnd, HCONTACT hContact, const char *szModule, const char *szNamePrefix) { return Utils_RestoreWindowPositionEx(hwnd, 0, hContact, szModule, szNamePrefix); } -__forceinline INT_PTR Utils_RestoreWindowPositionNoSize(HWND hwnd, HANDLE hContact, const char *szModule, const char *szNamePrefix) { +__forceinline INT_PTR Utils_RestoreWindowPositionNoSize(HWND hwnd, HCONTACT hContact, const char *szModule, const char *szNamePrefix) { return Utils_RestoreWindowPositionEx(hwnd, RWPF_NOSIZE, hContact, szModule, szNamePrefix); } -__forceinline INT_PTR Utils_RestoreWindowPositionNoMove(HWND hwnd, HANDLE hContact, const char *szModule, const char *szNamePrefix) { +__forceinline INT_PTR Utils_RestoreWindowPositionNoMove(HWND hwnd, HCONTACT hContact, const char *szModule, const char *szNamePrefix) { return Utils_RestoreWindowPositionEx(hwnd, RWPF_NOMOVE, hContact, szModule, szNamePrefix); } @@ -409,7 +409,7 @@ typedef struct { int cbSize; DWORD dwFlags; - HANDLE hContact; + HCONTACT hContact; REPLACEVARSARRAY *variables; } REPLACEVARSDATA; diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp index cfdfd8ec4b..d664fd1995 100644 --- a/plugins/AVS/src/acc.cpp +++ b/plugins/AVS/src/acc.cpp @@ -34,7 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. typedef struct { - HANDLE hContact; + HCONTACT hContact; char proto[64]; HANDLE hHook; HANDLE hHookMy; @@ -556,7 +556,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l { DestroyAnimation(hwnd, data); - data->hContact = (HANDLE) lParam; + data->hContact = (HCONTACT)lParam; if (lParam == NULL) data->proto[0] = '\0'; else diff --git a/plugins/AVS/src/acc.h b/plugins/AVS/src/acc.h index 79f0d826a1..576215b1a4 100644 --- a/plugins/AVS/src/acc.h +++ b/plugins/AVS/src/acc.h @@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA. #ifndef __ACC_H__ # define __ACC_H__ -INT_PTR avSetAvatar( HANDLE hContact, TCHAR* tszPath ); +INT_PTR avSetAvatar(HCONTACT hContact, TCHAR* tszPath ); INT_PTR avSetMyAvatar( char* szProto, TCHAR* tszPath ); int LoadACC(); diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index 9ca7415ba9..c6155f3bef 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -88,7 +88,7 @@ static CacheNode* AddToList(CacheNode *node) return pCurrent; } -CacheNode *FindAvatarInCache(HANDLE hContact, BOOL add, BOOL findAny) +CacheNode *FindAvatarInCache(HCONTACT hContact, BOOL add, BOOL findAny) { if (g_shutDown) return NULL; @@ -143,7 +143,7 @@ CacheNode *FindAvatarInCache(HANDLE hContact, BOOL add, BOOL findAny) * popup plugin. */ -void NotifyMetaAware(HANDLE hContact, CacheNode *node = NULL, AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)-1) +void NotifyMetaAware(HCONTACT hContact, CacheNode *node = NULL, AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)-1) { if (g_shutDown) return; @@ -154,8 +154,8 @@ void NotifyMetaAware(HANDLE hContact, CacheNode *node = NULL, AVATARCACHEENTRY * NotifyEventHooks(hEventChanged, (WPARAM)hContact, (LPARAM)ace); if (g_MetaAvail && (node->dwFlags & MC_ISSUBCONTACT) && db_get_b(NULL, g_szMetaName, "Enabled", 0)) { - HANDLE hMasterContact = (HANDLE)db_get_dw(hContact, g_szMetaName, "Handle", 0); - if (hMasterContact && (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMasterContact, 0) == hContact && + HCONTACT hMasterContact = (HCONTACT)db_get_dw(hContact, g_szMetaName, "Handle", 0); + if (hMasterContact && (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMasterContact, 0) == hContact && !db_get_b(hMasterContact, "ContactPhoto", "Locked", 0)) NotifyEventHooks(hEventChanged, (WPARAM)hMasterContact, (LPARAM)ace); } @@ -200,7 +200,7 @@ void NotifyMetaAware(HANDLE hContact, CacheNode *node = NULL, AVATARCACHEENTRY * // Just delete an avatar from cache // An cache entry is never deleted. What is deleted is the image handle inside it // This is done this way to keep track of which avatars avs have to keep track -void DeleteAvatarFromCache(HANDLE hContact, BOOL forever) +void DeleteAvatarFromCache(HCONTACT hContact, BOOL forever) { if (g_shutDown) return; @@ -222,7 +222,7 @@ void DeleteAvatarFromCache(HANDLE hContact, BOOL forever) ///////////////////////////////////////////////////////////////////////////////////////// -int SetAvatarAttribute(HANDLE hContact, DWORD attrib, int mode) +int SetAvatarAttribute(HCONTACT hContact, DWORD attrib, int mode) { if (g_shutDown) return 0; @@ -305,7 +305,7 @@ void PicLoader(LPVOID param) mir_sleep(dwDelay); } else if (node->mustLoad < 0 && node->ace.hContact) { // delete this picture - HANDLE hContact = node->ace.hContact; + HCONTACT hContact = node->ace.hContact; EnterCriticalSection(&cachecs); node->mustLoad = 0; node->loaded = 0; diff --git a/plugins/AVS/src/commonheaders.h b/plugins/AVS/src/commonheaders.h index c5f91779c2..2b7b8d7877 100644 --- a/plugins/AVS/src/commonheaders.h +++ b/plugins/AVS/src/commonheaders.h @@ -123,24 +123,24 @@ extern HANDLE hEventChanged, hEventContactAvatarChanged, hMyAvatarChanged; int GetFileHash(TCHAR* filename); DWORD GetFileSize(TCHAR *szFilename); -void MakePathRelative(HANDLE hContact); -void MakePathRelative(HANDLE hContact, TCHAR *dest); +void MakePathRelative(HCONTACT hContact); +void MakePathRelative(HCONTACT hContact, TCHAR *dest); HBITMAP LoadPNG(struct avatarCacheEntry *ace, char *szFilename); void InitCache(void); void UnloadCache(void); -int CreateAvatarInCache(HANDLE hContact, avatarCacheEntry *ace, char *szProto); -void DeleteAvatarFromCache(HANDLE, BOOL); +int CreateAvatarInCache(HCONTACT hContact, avatarCacheEntry *ace, char *szProto); +void DeleteAvatarFromCache(HCONTACT hContact, BOOL); void PicLoader(LPVOID param); void InternalDrawAvatar(AVATARDRAWREQUEST *r, HBITMAP hbm, LONG bmWidth, LONG bmHeight, DWORD dwFlags); -int ChangeAvatar(HANDLE hContact, BOOL fLoad, BOOL fNotifyHist = FALSE, int pa_format = 0); +int ChangeAvatar(HCONTACT hContact, BOOL fLoad, BOOL fNotifyHist = FALSE, int pa_format = 0); void DeleteGlobalUserAvatar(); -int FetchAvatarFor(HANDLE hContact, char *szProto = NULL); -CacheNode* FindAvatarInCache(HANDLE hContact, BOOL add, BOOL findAny = FALSE); -int SetAvatarAttribute(HANDLE hContact, DWORD attrib, int mode); +int FetchAvatarFor(HCONTACT hContact, char *szProto = NULL); +CacheNode* FindAvatarInCache(HCONTACT hContact, BOOL add, BOOL findAny = FALSE); +int SetAvatarAttribute(HCONTACT hContact, DWORD attrib, int mode); void SetIgnoreNotify(char *protocol, BOOL ignore); INT_PTR DrawAvatarPicture(WPARAM wParam, LPARAM lParam); @@ -149,9 +149,9 @@ INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam); INT_PTR ProtectAvatar(WPARAM wParam, LPARAM lParam); INT_PTR ReportMyAvatarChanged(WPARAM wParam, LPARAM lParam); -HANDLE GetContactThatHaveTheAvatar(HANDLE hContact, int locked = -1); +HCONTACT GetContactThatHaveTheAvatar(HCONTACT hContact, int locked = -1); -void ProcessAvatarInfo(HANDLE hContact, int type, PROTO_AVATAR_INFORMATIONT *pai, const char *szProto); +void ProcessAvatarInfo(HCONTACT hContact, int type, PROTO_AVATAR_INFORMATIONT *pai, const char *szProto); int Proto_GetDelayAfterFail(const char *proto); BOOL Proto_NeedDelaysForAvatars(const char *proto); @@ -161,4 +161,4 @@ int Proto_AvatarImageProportion(const char *proto); void Proto_GetAvatarMaxSize(const char *proto, int *width, int *height); int Proto_GetAvatarMaxFileSize(const char *proto); -protoPicCacheEntry* GetProtoDefaultAvatar(HANDLE hContact); \ No newline at end of file +protoPicCacheEntry* GetProtoDefaultAvatar(HCONTACT hContact); \ No newline at end of file diff --git a/plugins/AVS/src/image_utils.cpp b/plugins/AVS/src/image_utils.cpp index f081908245..9e7be9b152 100644 --- a/plugins/AVS/src/image_utils.cpp +++ b/plugins/AVS/src/image_utils.cpp @@ -2,7 +2,7 @@ #include "image_utils.h" extern int _DebugTrace(const char *fmt, ...); -extern int _DebugTrace(HANDLE hContact, const char *fmt, ...); +extern int _DebugTrace(HCONTACT hContact, const char *fmt, ...); #define GET_PIXEL(__P__, __X__, __Y__) ( __P__ + width * 4 * (__Y__) + 4 * (__X__)) @@ -410,7 +410,7 @@ DWORD GetImgHash(HBITMAP hBitmap) /* * Changes the handle to a grayscale image */ -HBITMAP MakeGrayscale(HANDLE hContact, HBITMAP hBitmap) +HBITMAP MakeGrayscale(HCONTACT hContact, HBITMAP hBitmap) { if (hBitmap) { FIBITMAP *dib = fei->FI_CreateDIBFromHBITMAP(hBitmap); @@ -433,7 +433,7 @@ HBITMAP MakeGrayscale(HANDLE hContact, HBITMAP hBitmap) * See if finds a transparent background in image, and set its transparency * Return TRUE if found a transparent background */ -BOOL MakeTransparentBkg(HANDLE hContact, HBITMAP *hBitmap) +BOOL MakeTransparentBkg(HCONTACT hContact, HBITMAP *hBitmap) { BYTE *p = NULL; DWORD dwLen; diff --git a/plugins/AVS/src/image_utils.h b/plugins/AVS/src/image_utils.h index eadb2a3cfe..f22dc47c04 100644 --- a/plugins/AVS/src/image_utils.h +++ b/plugins/AVS/src/image_utils.h @@ -37,8 +37,8 @@ int BmpFilterSaveBitmapW(HBITMAP hBmp, wchar_t *wszFile, int flags); HBITMAP CopyBitmapTo32(HBITMAP hBitmap); BOOL PreMultiply(HBITMAP hBitmap); -BOOL MakeTransparentBkg(HANDLE hContact, HBITMAP *hBitmap); -HBITMAP MakeGrayscale(HANDLE hContact, HBITMAP hBitmap); +BOOL MakeTransparentBkg(HCONTACT hContact, HBITMAP *hBitmap); +HBITMAP MakeGrayscale(HCONTACT hContact, HBITMAP hBitmap); DWORD GetImgHash(HBITMAP hBitmap); int AVS_pathIsAbsolute(const TCHAR *path); diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 591ac7a693..a4422d83b4 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -134,8 +134,8 @@ static int MetaChanged(WPARAM wParam, LPARAM lParam) AVATARCACHEENTRY *ace; - HANDLE hContact = (HANDLE) wParam; - HANDLE hSubContact = GetContactThatHaveTheAvatar(hContact); + HCONTACT hContact = (HCONTACT)wParam; + HCONTACT hSubContact = GetContactThatHaveTheAvatar(hContact); // Get the node CacheNode *node = FindAvatarInCache(hSubContact, TRUE); @@ -190,7 +190,7 @@ static void LoadAccountInfo(PROTOACCOUNT *acc) g_ProtoPictures.insert(pce); pce = new protoPicCacheEntry; - CreateAvatarInCache((HANDLE)-1, pce, acc->szModuleName); + CreateAvatarInCache((HCONTACT)-1, pce, acc->szModuleName); pce->szProtoname = mir_strdup(acc->szModuleName); pce->tszAccName = mir_tstrdup(acc->tszAccountName); g_MyAvatars.insert(pce); @@ -242,7 +242,7 @@ static int ContactSettingChanged(WPARAM wParam, LPARAM lParam) static int ContactDeleted(WPARAM wParam, LPARAM lParam) { - DeleteAvatarFromCache((HANDLE)wParam, TRUE); + DeleteAvatarFromCache((HCONTACT)wParam, TRUE); return 0; } @@ -401,7 +401,7 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) // Load global avatar protoPicCacheEntry *pce = new protoPicCacheEntry; - CreateAvatarInCache((HANDLE)-1, pce, ""); + CreateAvatarInCache((HCONTACT)-1, pce, ""); pce->szProtoname = mir_strdup(""); g_MyAvatars.insert(pce); diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index fa15d767a3..ee1fc4007a 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DM_AVATARCHANGED (WM_USER + 12) #define DM_PROTOCOLCHANGED (WM_USER + 13) -extern int _DebugPopup(HANDLE hContact, const char *fmt, ...); +extern int _DebugPopup(HCONTACT hContact, const char *fmt, ...); extern INT_PTR SetAvatar(WPARAM wParam, LPARAM lParam); extern OBJLIST g_ProtoPictures; extern HANDLE hEventChanged; @@ -41,7 +41,7 @@ extern BOOL ScreenToClient(HWND hWnd, LPRECT lpRect); static BOOL dialoginit = TRUE; struct WindowData { - HANDLE hContact; + HCONTACT hContact; HANDLE hHook; }; @@ -423,7 +423,7 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar BOOL newVal = ListView_GetCheckState(hwndList, i); if (oldVal && !newVal) - for (HANDLE hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) + for (HCONTACT hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) DeleteAvatarFromCache(hContact, TRUE); if (newVal) @@ -440,7 +440,7 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar ///////////////////////////////////////////////////////////////////////////////////////// -static void LoadTransparentData(HWND hwndDlg, HANDLE hContact) +static void LoadTransparentData(HWND hwndDlg, HCONTACT hContact) { CheckDlgButton(hwndDlg, IDC_MAKETRANSPBKG, db_get_b(hContact, "ContactPhoto", "MakeTransparentBkg", db_get_b(0, AVS_MODULE, "MakeTransparentBkg", 0))); SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_SETPOS, 0, (LPARAM)db_get_w(hContact, "ContactPhoto", "TranspBkgNumPoints", db_get_w(0, AVS_MODULE, "TranspBkgNumPoints", 5))); @@ -455,7 +455,7 @@ static void LoadTransparentData(HWND hwndDlg, HANDLE hContact) EnableWindow(GetDlgItem(hwndDlg, IDC_BKG_COLOR_DIFFERENCE), transp_enabled); } -static void SaveTransparentData(HWND hwndDlg, HANDLE hContact) +static void SaveTransparentData(HWND hwndDlg, HCONTACT hContact) { BOOL transp = IsDlgButtonChecked(hwndDlg, IDC_MAKETRANSPBKG); if (db_get_b(0, AVS_MODULE, "MakeTransparentBkg", 0) == transp) @@ -476,18 +476,18 @@ static void SaveTransparentData(HWND hwndDlg, HANDLE hContact) db_set_w(hContact, "ContactPhoto", "TranspBkgColorDiff", tmp); } -static void SaveTransparentData(HWND hwndDlg, HANDLE hContact, BOOL locked) +static void SaveTransparentData(HWND hwndDlg, HCONTACT hContact, BOOL locked) { SaveTransparentData(hwndDlg, hContact); - HANDLE tmp = GetContactThatHaveTheAvatar(hContact, locked); + HCONTACT tmp = GetContactThatHaveTheAvatar(hContact, locked); if (tmp != hContact) SaveTransparentData(hwndDlg, tmp); } INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - HANDLE hContact; + HCONTACT hContact; struct WindowData *dat = (struct WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (dat) @@ -501,10 +501,10 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA struct WindowData *dat = (struct WindowData *)malloc(sizeof(struct WindowData)); if (dat) - dat->hContact = (HANDLE)lParam; + dat->hContact = (HCONTACT)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); - hContact = (HANDLE)lParam; + hContact = (HCONTACT)lParam; TranslateDialogDefault(hwndDlg); if (hContact) { szNick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); @@ -759,7 +759,7 @@ int OptInit(WPARAM wParam, LPARAM lParam) static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - HANDLE hContact; + HCONTACT hContact; struct WindowData *dat = (struct WindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (dat) @@ -771,7 +771,7 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa dat = (struct WindowData *) malloc(sizeof(struct WindowData)); if (dat == NULL) return FALSE; - dat->hContact = (HANDLE)lParam; + dat->hContact = (HCONTACT)lParam; HWND protopic = GetDlgItem(hwndDlg, IDC_PROTOPIC); SendMessage(protopic, AVATAR_SETCONTACT, 0, (LPARAM) dat->hContact); @@ -781,7 +781,7 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa SendMessage(protopic, AVATAR_SETRESIZEIFSMALLER, 0, (LPARAM) FALSE); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); - hContact = (HANDLE)lParam; + hContact = (HCONTACT)lParam; TranslateDialogDefault(hwndDlg); SendMessage(hwndDlg, DM_SETAVATARNAME, 0, 0); CheckDlgButton(hwndDlg, IDC_PROTECTAVATAR, db_get_b(hContact, "ContactPhoto", "Locked", 0) ? TRUE : FALSE); @@ -1148,7 +1148,7 @@ int OnDetailsInit(WPARAM wParam, LPARAM lParam) odp.hInstance = g_hInst; odp.pszTitle = LPGEN("Avatar"); - HANDLE hContact = (HANDLE)lParam; + HCONTACT hContact = (HCONTACT)lParam; if (hContact == NULL) { // User dialog odp.pfnDlgProc = DlgProcAvatarProtoInfo; diff --git a/plugins/AVS/src/poll.cpp b/plugins/AVS/src/poll.cpp index beefe4e8ee..9273720962 100644 --- a/plugins/AVS/src/poll.cpp +++ b/plugins/AVS/src/poll.cpp @@ -45,15 +45,15 @@ A queue to request items. One request is done at a time, REQUEST_WAIT_TIME milis static void RequestThread(void *vParam); extern HANDLE hShutdownEvent; -extern int DeleteAvatar(HANDLE hContact); -extern void MakePathRelative(HANDLE hContact, TCHAR *path); +extern int DeleteAvatar(HCONTACT hContact); +extern void MakePathRelative(HCONTACT hContact, TCHAR *path); int Proto_GetDelayAfterFail(const char *proto); BOOL Proto_IsFetchingWhenProtoNotVisibleAllowed(const char *proto); BOOL Proto_IsFetchingWhenContactOfflineAllowed(const char *proto); #ifdef _DEBUG int _DebugTrace(const char *fmt, ...); -int _DebugTrace(HANDLE hContact, const char *fmt, ...); +int _DebugTrace(HCONTACT hContact, const char *fmt, ...); #endif // Functions //////////////////////////////////////////////////////////////////////////// @@ -100,7 +100,7 @@ static BOOL PollCheckProtocol(const char *szProto) } // Return true if this contact can have avatar requested -static BOOL PollContactCanHaveAvatar(HANDLE hContact, const char *szProto) +static BOOL PollContactCanHaveAvatar(HCONTACT hContact, const char *szProto) { int status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); return (Proto_IsFetchingWhenContactOfflineAllowed(szProto) || status != ID_STATUS_OFFLINE) @@ -108,12 +108,12 @@ static BOOL PollContactCanHaveAvatar(HANDLE hContact, const char *szProto) } // Return true if this contact has to be checked -static BOOL PollCheckContact(HANDLE hContact, const char *szProto) +static BOOL PollCheckContact(HCONTACT hContact, const char *szProto) { return !db_get_b(hContact, "ContactPhoto", "Locked", 0) && FindAvatarInCache(hContact, FALSE, TRUE) != NULL; } -static void QueueRemove(HANDLE hContact) +static void QueueRemove(HCONTACT hContact) { mir_cslock lck(cs); @@ -124,7 +124,7 @@ static void QueueRemove(HANDLE hContact) } } -static void QueueAdd(HANDLE hContact, int waitTime) +static void QueueAdd(HCONTACT hContact, int waitTime) { if (fei == NULL || g_shutDown) return; @@ -143,12 +143,12 @@ static void QueueAdd(HANDLE hContact, int waitTime) } // Add an contact to a queue -void QueueAdd(HANDLE hContact) +void QueueAdd(HCONTACT hContact) { QueueAdd(hContact, waitTime); } -void ProcessAvatarInfo(HANDLE hContact, int type, PROTO_AVATAR_INFORMATIONT *pai, const char *szProto) +void ProcessAvatarInfo(HCONTACT hContact, int type, PROTO_AVATAR_INFORMATIONT *pai, const char *szProto) { QueueRemove(hContact); @@ -202,7 +202,7 @@ void ProcessAvatarInfo(HANDLE hContact, int type, PROTO_AVATAR_INFORMATIONT *pai } } -int FetchAvatarFor(HANDLE hContact, char *szProto) +int FetchAvatarFor(HCONTACT hContact, char *szProto) { int result = GAIR_NOAVATAR; @@ -258,7 +258,7 @@ static void RequestThread(void *vParam) } // Will request this item - HANDLE hContact = qi.hContact; + HCONTACT hContact = qi.hContact; queue.remove( queue.getCount()-1 ); QueueRemove(hContact); LeaveCriticalSection(&cs); diff --git a/plugins/AVS/src/poll.h b/plugins/AVS/src/poll.h index 99d15da999..7b7924a9cf 100644 --- a/plugins/AVS/src/poll.h +++ b/plugins/AVS/src/poll.h @@ -23,7 +23,7 @@ Boston, MA 02111-1307, USA. struct QueueItem { - HANDLE hContact; + HCONTACT hContact; DWORD check_time; }; @@ -31,6 +31,6 @@ void InitPolls(); void UninitPolls(); // Add an contact to a queue -void QueueAdd(HANDLE hContact); +void QueueAdd(HCONTACT hContact); #endif // __POLL_H__ diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index 8866404681..85218de38b 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -31,22 +31,22 @@ INT_PTR GetAvatarBitmap(WPARAM wParam, LPARAM lParam) if (wParam == 0 || g_shutDown || fei == NULL) return 0; - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT)wParam; hContact = GetContactThatHaveTheAvatar(hContact); // Get the node CacheNode *node = FindAvatarInCache(hContact, TRUE); if (node == NULL || !node->loaded) - return (INT_PTR) GetProtoDefaultAvatar(hContact); + return (INT_PTR)GetProtoDefaultAvatar(hContact); else - return (INT_PTR) &node->ace; + return (INT_PTR)&node->ace; } ///////////////////////////////////////////////////////////////////////////////////////// INT_PTR ProtectAvatar(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; BYTE was_locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); if (fei == NULL || was_locked == (BYTE)lParam) // no need for redundant lockings... @@ -118,7 +118,7 @@ UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return FALSE; } -static INT_PTR avSetAvatar(HANDLE hContact, TCHAR *tszPath) +static INT_PTR avSetAvatar(HCONTACT hContact, TCHAR *tszPath) { BYTE is_locked = 0; TCHAR FileName[MAX_PATH], szBackupName[MAX_PATH]; @@ -188,12 +188,12 @@ static INT_PTR avSetAvatar(HANDLE hContact, TCHAR *tszPath) INT_PTR SetAvatar(WPARAM wParam, LPARAM lParam) { - return avSetAvatar((HANDLE)wParam, _A2T((const char*)lParam )); + return avSetAvatar((HCONTACT)wParam, _A2T((const char*)lParam)); } INT_PTR SetAvatarW(WPARAM wParam, LPARAM lParam) { - return avSetAvatar((HANDLE)wParam, (TCHAR*)lParam ); + return avSetAvatar((HCONTACT)wParam, (TCHAR*)lParam); } /* @@ -932,7 +932,7 @@ static void ReloadMyAvatar(LPVOID lpParam) if (g_MyAvatars[i].hbmPic) DeleteObject(g_MyAvatars[i].hbmPic); - if (CreateAvatarInCache((HANDLE)-1, &g_MyAvatars[i], myAvatarProto) != -1) + if (CreateAvatarInCache((HCONTACT)-1, &g_MyAvatars[i], myAvatarProto) != -1) NotifyEventHooks(hMyAvatarChanged, (WPARAM)myAvatarProto, (LPARAM)&g_MyAvatars[i]); else NotifyEventHooks(hMyAvatarChanged, (WPARAM)myAvatarProto, 0); diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index e72921dc62..3c6a40c4e8 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -37,7 +37,7 @@ int _DebugTrace(const char *fmt, ...) return 0; } -int _DebugTrace(HANDLE hContact, const char *fmt, ...) +int _DebugTrace(HCONTACT hContact, const char *fmt, ...) { char text[1024]; size_t len; @@ -119,7 +119,7 @@ size_t AVS_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut) * convert the avatar image path to a relative one... * given: contact handle, path to image */ -void MakePathRelative(HANDLE hContact, TCHAR *path) +void MakePathRelative(HCONTACT hContact, TCHAR *path) { TCHAR szFinalPath[MAX_PATH]; szFinalPath[0] = '\0'; @@ -137,7 +137,7 @@ void MakePathRelative(HANDLE hContact, TCHAR *path) * given: contact handle */ -void MakePathRelative(HANDLE hContact) +void MakePathRelative(HCONTACT hContact) { DBVARIANT dbv; if ( !db_get_ts(hContact, "ContactPhoto", "File", &dbv)) { @@ -148,7 +148,7 @@ void MakePathRelative(HANDLE hContact) // create the avatar in cache // returns 0 if not created (no avatar), iIndex otherwise, -2 if has to request avatar, -3 if avatar too big -int CreateAvatarInCache(HANDLE hContact, avatarCacheEntry *ace, char *szProto) +int CreateAvatarInCache(HCONTACT hContact, avatarCacheEntry *ace, char *szProto) { DBVARIANT dbv = {0}; char *szExt = NULL; @@ -493,7 +493,7 @@ BOOL Proto_IsFetchingWhenContactOfflineAllowed(const char *proto) ///////////////////////////////////////////////////////////////////////////////////////// -protoPicCacheEntry *GetProtoDefaultAvatar(HANDLE hContact) +protoPicCacheEntry *GetProtoDefaultAvatar(HCONTACT hContact) { char *szProto = GetContactProto(hContact); if (szProto) { @@ -506,7 +506,7 @@ protoPicCacheEntry *GetProtoDefaultAvatar(HANDLE hContact) return NULL; } -HANDLE GetContactThatHaveTheAvatar(HANDLE hContact, int locked) +HCONTACT GetContactThatHaveTheAvatar(HCONTACT hContact, int locked) { if (g_MetaAvail && db_get_b(NULL, g_szMetaName, "Enabled", 0)) { if (db_get_dw(hContact, g_szMetaName, "NumContacts", 0) >= 1) { @@ -514,13 +514,13 @@ HANDLE GetContactThatHaveTheAvatar(HANDLE hContact, int locked) locked = db_get_b(hContact, "ContactPhoto", "Locked", 0); if (!locked) - hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); } } return hContact; } -int ChangeAvatar(HANDLE hContact, BOOL fLoad, BOOL fNotifyHist, int pa_format) +int ChangeAvatar(HCONTACT hContact, BOOL fLoad, BOOL fNotifyHist, int pa_format) { if (g_shutDown) return 0; diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index e543699041..009ada955c 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -267,7 +267,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp psr->id = mir_tstrdup(szUserId); acs->psr = psr; - HANDLE hContact = (HANDLE)CallProtoService(acs->proto, PS_ADDTOLIST, IsDlgButtonChecked(hdlg, IDC_ADDTEMP) ? PALF_TEMPORARY : 0, (LPARAM)acs->psr); + HCONTACT hContact = (HCONTACT)CallProtoService(acs->proto, PS_ADDTOLIST, IsDlgButtonChecked(hdlg, IDC_ADDTEMP) ? PALF_TEMPORARY : 0, (LPARAM)acs->psr); if (hContact == NULL) { MessageBox(NULL, TranslateT("The contact cannot be added to your contact list. If you are not logged into the selected account, please try to do so. Also, make sure the contact ID is entered correctly."), diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp index 98548ce133..5761003923 100644 --- a/plugins/Alarms/src/alarms.cpp +++ b/plugins/Alarms/src/alarms.cpp @@ -64,7 +64,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA return DefWindowProc(hWnd, message, wParam, lParam); } -void ShowPopup(HANDLE hContact, const TCHAR *msg) +void ShowPopup(HCONTACT hContact, const TCHAR *msg) { if (ServiceExists(MS_POPUP_ADDPOPUPT)) { TCHAR *lpzContactName = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); @@ -87,7 +87,7 @@ void ShowPopup(HANDLE hContact, const TCHAR *msg) static int PluginSendMessage(WPARAM wParam,LPARAM lParam) { - CallContactService((HANDLE)wParam,PSS_MESSAGE,0,lParam); + CallContactService((HCONTACT)wParam,PSS_MESSAGE,0,lParam); return 0; } diff --git a/plugins/AssocMgr/src/test.cpp b/plugins/AssocMgr/src/test.cpp index cedb7552fe..e48b15d779 100644 --- a/plugins/AssocMgr/src/test.cpp +++ b/plugins/AssocMgr/src/test.cpp @@ -126,7 +126,7 @@ static int ServiceParseAimLink(WPARAM wParam,LPARAM lParam) /* send a message to a contact */ else if (!_strnicmp(arg,"goim?",5)) { char *tok,*sn=NULL,*msg=NULL; - HANDLE hContact; + HCONTACT hContact; if (*(arg+=5)==0) return 1; /* parse failed */ tok=strtok(arg,"&"); /* first token */ while(tok!=NULL) { @@ -206,9 +206,9 @@ void aim_links_destroy() #define hInst GetModuleHandleA("ICQ") static __inline HANDLE HContactFromUIN(DWORD dwUIN,int *Added) { dwUIN; Added; return db_find_first(); } static __inline HANDLE ICQFindFirstContact(void) { return NULL; } -static __inline HANDLE ICQFindNextContact(HANDLE hContact) { hContact; return NULL; } -static __inline void AddToCache(HANDLE hContact,DWORD dwUin) { hContact; dwUin; } -static __inline DWORD ICQGetContactSettingUIN(HANDLE hContact) { hContact; return 0; } +static __inline HANDLE ICQFindNextContact(HCONTACT hContact) { hContact; return NULL; } +static __inline void AddToCache(HCONTACT hContact,DWORD dwUin) { hContact; dwUin; } +static __inline DWORD ICQGetContactSettingUIN(HCONTACT hContact) { hContact; return 0; } static __inline HANDLE HandleFromCacheByUin(DWORD dwUin) { dwUin; return NULL; } #include #include @@ -254,7 +254,7 @@ typedef struct { static HANDLE IsHContactFromUIN(DWORD uin) { - HANDLE hContact; + HCONTACT hContact; DWORD dwUin; hContact=HandleFromCacheByUin(uin); if(hContact!=NULL) return hContact; @@ -300,7 +300,7 @@ static void AddIcqUser(ICQFILEINFO *info) static void MessageIcqUser(ICQFILEINFO *info) { - HANDLE hContact; + HCONTACT hContact; if(ServiceExists(MS_MSG_SENDMESSAGE)) { hContact=HContactFromUIN(atoi(info->uin),NULL); /* adds the contact if needed */ if(hContact!=NULL) @@ -445,7 +445,7 @@ static int ServiceParseYmsgrLink(WPARAM wParam,LPARAM lParam) /* send a message to a contact */ else if (!_strnicmp(arg,"sendim?",7)) { char *tok,*id=NULL,*msg=NULL; - HANDLE hContact; + HCONTACT hContact; if (*(arg+=7)==0) return 1; /* parse failed */ tok=strtok(arg,"&"); /* first token */ if(tok!=NULL) id=tok; @@ -562,7 +562,7 @@ static int ServiceParseMsnimLink(WPARAM wParam,LPARAM lParam) /* "voice" and "video" not yet implemented, perform same action as "chat" */ else if (!_strnicmp(arg,"chat?",5) || !_strnicmp(arg,"voice?",6) || !_strnicmp(arg,"video?",6)) { char *tok,*email=NULL; - HANDLE hContact; + HCONTACT hContact; if (*(arg+=5)==0) return 1; /* parse failed */ if (*arg=='?' && *(++arg)==0) return 1; /* for "voice?" and "video?" */ tok=strtok(arg,"&"); /* first token */ @@ -637,7 +637,7 @@ static int ServiceParseLink(WPARAM wParam,LPARAM lParam) if(arg==NULL) return 1; /* parse failed */ for (++arg;*arg=='/';++arg); /* send a message to a contact */ - { HANDLE hContact; + { HCONTACT hContact; if(ServiceExists(MS_MSG_SENDMESSAGE)) { hContact=gg_getcontact(atoi(arg),TRUE,FALSE,arg); if(hContact!=NULL) @@ -714,7 +714,7 @@ static int ServiceParseXmppURI(WPARAM wParam,LPARAM lParam) /* send a message to a contact */ else if (*arg==0 || (!_strnicmp(arg,"message",7) && (*(arg+7)==';' || *(arg+7)==0))) { char *tok,*subj=NULL,*body=NULL; - HANDLE hContact; + HCONTACT hContact; char msg[1024]; arg+=7; while(*arg==';') ++arg; @@ -754,7 +754,7 @@ static int ServiceParseXmppURI(WPARAM wParam,LPARAM lParam) } /* remove user from contact list */ else if (!_strnicmp(arg,"remove",6) && (*(arg+6)==';' || *(arg+6)==0)) { - HANDLE hContact; + HCONTACT hContact; hContact=JabberHContactFromJID(jid); if(hContact==NULL) /* not yet implemented: show standard miranda dialog here */ CallService(MS_DB_CONTACT_DELETE,(WPARAM)hContact,0); diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index 4771928552..92a2fbeaca 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -61,7 +61,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfo; } -INT_PTR getIconToUse(HANDLE hContact, LPARAM lParam) +INT_PTR getIconToUse(HCONTACT hContact, LPARAM lParam) { char *proto = GetContactProto(hContact); // if (lParam == 1) return icon_none; @@ -94,7 +94,7 @@ int onExtraImageApplying(WPARAM wParam, LPARAM lParam) if (wParam == NULL) return 0; - int usedIcon = getIconToUse((HANDLE) wParam, lParam); + int usedIcon = getIconToUse((HCONTACT)wParam, lParam); const char *icon; switch (usedIcon) { @@ -103,14 +103,14 @@ int onExtraImageApplying(WPARAM wParam, LPARAM lParam) case icon_auth: icon = "auth_icon"; break; default: icon = NULL; break; } - ExtraIcon_SetIcon(hExtraIcon, (HANDLE)wParam, icon); + ExtraIcon_SetIcon(hExtraIcon, (HCONTACT)wParam, icon); return 0; } int onContactSettingChanged(WPARAM wParam,LPARAM lParam) { DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; - char *proto = GetContactProto((HANDLE)wParam); + char *proto = GetContactProto((HCONTACT)wParam); if (!proto) return 0; if (!lstrcmpA(cws->szModule,proto)) @@ -123,7 +123,7 @@ int onContactSettingChanged(WPARAM wParam,LPARAM lParam) int onDBContactAdded(WPARAM wParam, LPARAM lParam) { // A new contact added, mark it as recent - db_set_b((HANDLE)wParam, MODULENAME, "ShowIcons", 1); + db_set_b((HCONTACT)wParam, MODULENAME, "ShowIcons", 1); onExtraImageApplying(wParam, 0); return 0; @@ -131,8 +131,8 @@ int onDBContactAdded(WPARAM wParam, LPARAM lParam) INT_PTR onAuthMenuSelected(WPARAM wParam, LPARAM lParam) { - byte enabled = db_get_b((HANDLE)wParam,"AuthState","ShowIcons",1); - db_set_b((HANDLE)wParam, MODULENAME, "ShowIcons", !enabled); + byte enabled = db_get_b((HCONTACT)wParam,"AuthState","ShowIcons",1); + db_set_b((HCONTACT)wParam, MODULENAME, "ShowIcons", !enabled); onExtraImageApplying(wParam, 0); return 0; @@ -140,7 +140,7 @@ INT_PTR onAuthMenuSelected(WPARAM wParam, LPARAM lParam) int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; char *proto = GetContactProto(hContact); if (!proto) return 0; @@ -173,7 +173,7 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) hExtraIcon = ExtraIcon_Register("authstate", LPGEN("Auth State"), "authgrant_icon"); // Set initial value for all contacts - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) onExtraImageApplying((WPARAM)hContact, 1); hOptInitialise = HookEvent(ME_OPT_INITIALISE, onOptInitialise); diff --git a/plugins/AuthState/src/options.cpp b/plugins/AuthState/src/options.cpp index 5fe5635b92..48fb2add44 100644 --- a/plugins/AuthState/src/options.cpp +++ b/plugins/AuthState/src/options.cpp @@ -55,7 +55,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP bContactMenuItem = IsDlgButtonChecked(hwndDlg, IDC_ENABLEMENUITEM); bIconsForRecentContacts = IsDlgButtonChecked(hwndDlg, IDC_ICONSFORRECENT); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) onExtraImageApplying((WPARAM)hContact,0); //Store options values to DB diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp index a48161c85b..a51db88ff1 100644 --- a/plugins/AutoShutdown/src/watcher.cpp +++ b/plugins/AutoShutdown/src/watcher.cpp @@ -181,7 +181,7 @@ static BOOL CheckAllContactsOffline(void) { BOOL fSmartCheck,fAllOffline=TRUE; /* tentatively */ fSmartCheck=db_get_b(NULL,"AutoShutdown","SmartOfflineCheck",SETTING_SMARTOFFLINECHECK_DEFAULT); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *pszProto = GetContactProto(hContact); if (pszProto != NULL && CallProtoService(pszProto,PS_GETSTATUS,0,0) != ID_STATUS_OFFLINE) { if (db_get_b(hContact,pszProto,"ChatRoom",0)) continue; @@ -203,7 +203,7 @@ static int StatusSettingChanged(WPARAM wParam,LPARAM lParam) if (currentWatcherType&SDWTF_STATUS) { DBCONTACTWRITESETTING *dbcws=(DBCONTACTWRITESETTING*)lParam; if ((HANDLE)wParam != NULL && dbcws->value.wVal==ID_STATUS_OFFLINE && !lstrcmpA(dbcws->szSetting,"Status")) { - char *pszProto = GetContactProto((HANDLE)wParam); + char *pszProto = GetContactProto((HCONTACT)wParam); if (pszProto != NULL && !lstrcmpA(dbcws->szModule,pszProto)) if (CheckAllContactsOffline()) ShutdownAndStopWatcher(); @@ -239,7 +239,7 @@ static BOOL CALLBACK CpuUsageWatcherProc(BYTE nCpuUsage,LPARAM lParam) static int WeatherUpdated(WPARAM wParam,LPARAM lParam) { - char *pszProto = GetContactProto((HANDLE)wParam); + char *pszProto = GetContactProto((HCONTACT)wParam); if ((BOOL)lParam && pszProto != NULL && CallProtoService(pszProto,PS_GETSTATUS,0,0)==THUNDER) if (db_get_b(NULL,"AutoShutdown","WeatherShutdown",SETTING_WEATHERSHUTDOWN_DEFAULT)) ServiceShutdown(SDSDT_SHUTDOWN,TRUE); diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index 46c84d363d..82a987b0b5 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -23,22 +23,22 @@ Avatar History Plugin HGENMENU hMenu = NULL; DWORD WINAPI AvatarDialogThread(LPVOID param); static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam); -int ShowSaveDialog(HWND hwnd, TCHAR* fn,HANDLE hContact = NULL); +int ShowSaveDialog(HWND hwnd, TCHAR* fn,HCONTACT hContact = NULL); BOOL ProtocolEnabled(const char *proto); -int FillAvatarListFromDB(HWND list, HANDLE hContact); -int FillAvatarListFromFolder(HWND list, HANDLE hContact); -int FillAvatarListFromFiles(HWND list, HANDLE hContact); +int FillAvatarListFromDB(HWND list, HCONTACT hContact); +int FillAvatarListFromFolder(HWND list, HCONTACT hContact); +int FillAvatarListFromFiles(HWND list, HCONTACT hContact); int CleanupAvatarPic(HWND hwnd); bool UpdateAvatarPic(HWND hwnd); -TCHAR * GetContactFolder(TCHAR *fn, HANDLE hContact); +TCHAR * GetContactFolder(TCHAR *fn, HCONTACT hContact); BOOL ResolveShortcut(TCHAR *shortcut, TCHAR *file); static INT_PTR ShowDialogSvc(WPARAM wParam, LPARAM lParam); struct AvatarDialogData { - HANDLE hContact; + HCONTACT hContact; TCHAR fn[MAX_PATH]; HWND parent; }; @@ -65,7 +65,7 @@ public: TCHAR *filelink; }; -int OpenAvatarDialog(HANDLE hContact, char* fn) +int OpenAvatarDialog(HCONTACT hContact, char* fn) { HWND hAvatarWindow = WindowList_Find(hAvatarWindowsList, hContact); if (hAvatarWindow) @@ -222,7 +222,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM l DestroyMenu(menu); ListEntry *le = (ListEntry*) SendMessage(hwndList, LB_GETITEMDATA, pos, 0); - HANDLE hContact = (HANDLE) GetWindowLongPtr(hwnd, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT) GetWindowLongPtr(hwnd, GWLP_USERDATA); switch(ret) { case ID_AVATARLISTPOPUP_SAVEAS: ShowSaveDialog(hwnd, le->filename, hContact); @@ -302,7 +302,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM l switch(LOWORD(wParam)) { case IDOK: if (HIWORD(wParam) == BN_CLICKED) { - HANDLE hContact = (HANDLE) GetWindowLongPtr(hwnd, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT) GetWindowLongPtr(hwnd, GWLP_USERDATA); db_set_b(hContact, MODULE_NAME, "AvatarPopups", (BYTE) IsDlgButtonChecked(hwnd, IDC_POPUPUSER)); db_set_b(hContact, MODULE_NAME, "LogToDisk", (BYTE) IsDlgButtonChecked(hwnd, IDC_LOGUSER)); db_set_b(hContact, MODULE_NAME, "LogToHistory", (BYTE) IsDlgButtonChecked(hwnd, IDC_HISTORYUSER)); @@ -324,7 +324,7 @@ static INT_PTR CALLBACK AvatarDlgProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM l case IDC_OPENFOLDER: if (HIWORD(wParam) == BN_CLICKED && opts.log_per_contact_folders) { TCHAR avfolder[MAX_PATH]; - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); GetContactFolder(avfolder, hContact); ShellExecute(NULL, db_get_b(NULL, MODULE_NAME, "OpenFolderMethod", 0) ? _T("explore") : _T("open"), avfolder, NULL, NULL, SW_SHOWNORMAL); return TRUE; @@ -373,7 +373,7 @@ int AddFileToList(TCHAR *path,TCHAR *lnk,TCHAR *filename, HWND list) return max_pos; } -int FillAvatarListFromFiles(HWND list, HANDLE hContact) +int FillAvatarListFromFiles(HWND list, HCONTACT hContact) { int max_pos = 0; TCHAR dir[MAX_PATH], path[MAX_PATH]; @@ -400,7 +400,7 @@ int FillAvatarListFromFiles(HWND list, HANDLE hContact) return 0; } -int FillAvatarListFromFolder(HWND list, HANDLE hContact) +int FillAvatarListFromFolder(HWND list, HCONTACT hContact) { int max_pos = 0; TCHAR dir[MAX_PATH], path[MAX_PATH]; @@ -429,7 +429,7 @@ int FillAvatarListFromFolder(HWND list, HANDLE hContact) return 0; } -int FillAvatarListFromDB(HWND list, HANDLE hContact) +int FillAvatarListFromDB(HWND list, HCONTACT hContact) { int max_pos = 0; BYTE blob[2048]; @@ -513,7 +513,7 @@ int CleanupAvatarPic(HWND hwnd) int PreBuildContactMenu(WPARAM wParam,LPARAM lParam) { - char *proto = GetContactProto((HANDLE)wParam); + char *proto = GetContactProto((HCONTACT)wParam); Menu_ShowItem(hMenu, ProtocolEnabled(proto)); return 0; } @@ -534,12 +534,12 @@ void InitMenuItem() static INT_PTR ShowDialogSvc(WPARAM wParam, LPARAM lParam) { - OpenAvatarDialog((HANDLE)wParam, (char*)lParam); + OpenAvatarDialog((HCONTACT)wParam, (char*)lParam); return 0; } -int ShowSaveDialog(HWND hwnd, TCHAR* fn, HANDLE hContact) +int ShowSaveDialog(HWND hwnd, TCHAR* fn, HCONTACT hContact) { TCHAR filter[MAX_PATH]; TCHAR file[MAX_PATH]; diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index cc6b049e70..156134bea9 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -40,7 +40,7 @@ int OptInit(WPARAM wParam,LPARAM lParam); TCHAR* GetHistoryFolder(TCHAR *fn); TCHAR* GetProtocolFolder(TCHAR *fn, char *proto); -TCHAR* GetOldStyleAvatarName(TCHAR *fn, HANDLE hContact); +TCHAR* GetOldStyleAvatarName(TCHAR *fn, HCONTACT hContact); void InitMenuItem(); @@ -84,7 +84,7 @@ static INT_PTR GetCachedAvatar(WPARAM wParam, LPARAM lParam) static INT_PTR IsEnabled(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT) wParam; return ContactEnabled(hContact, "LogToDisk", AVH_DEF_LOGTODISK) || ContactEnabled(hContact, "AvatarPopups", AVH_DEF_AVPOPUPS) || ContactEnabled(hContact, "LogToHistory", AVH_DEF_LOGTOHISTORY); @@ -105,11 +105,11 @@ static INT_PTR IsEnabled(WPARAM wParam, LPARAM lParam) static int AvatarChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; - char *proto = GetContactProto((HANDLE)wParam); + char *proto = GetContactProto((HCONTACT)wParam); if (proto == NULL) return 0; @@ -158,7 +158,7 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam) ShowDebugPopup(hContact, TranslateT("AVH Debug: File copied successfully"), history_filename); if (ServiceExists(MS_MC_GETMETACONTACT)) { - HANDLE hMetaContact = (HANDLE) CallService(MS_MC_GETMETACONTACT, wParam, 0); + HCONTACT hMetaContact = (HCONTACT)CallService(MS_MC_GETMETACONTACT, wParam, 0); if (hMetaContact != NULL && ContactEnabled(hMetaContact, "LogToDisk", AVH_DEF_LOGTOHISTORY)) { TCHAR filename[MAX_PATH] = _T(""); @@ -203,8 +203,7 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam) CreateOldStyleShortcut(hContact, history_filename); if (ServiceExists(MS_MC_GETMETACONTACT)) { - HANDLE hMetaContact = (HANDLE) CallService(MS_MC_GETMETACONTACT, wParam, 0); - + HCONTACT hMetaContact = (HCONTACT)CallService(MS_MC_GETMETACONTACT, wParam, 0); if (hMetaContact != NULL && ContactEnabled(hMetaContact, "LogToDisk", AVH_DEF_LOGTOHISTORY)) CreateOldStyleShortcut(hMetaContact, history_filename); } diff --git a/plugins/AvatarHistory/src/AvatarHistory.h b/plugins/AvatarHistory/src/AvatarHistory.h index 20dcd8f518..334ef74109 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.h +++ b/plugins/AvatarHistory/src/AvatarHistory.h @@ -60,22 +60,22 @@ void LoadOptions(); void SetupIcoLib(); HICON createDefaultOverlayedIcon(BOOL big); -HICON createProtoOverlayedIcon(HANDLE hContact); +HICON createProtoOverlayedIcon(HCONTACT hContact); int PreBuildContactMenu(WPARAM wParam,LPARAM lParam); int IcoLibIconsChanged(WPARAM wParam,LPARAM lParam); -int OpenAvatarDialog(HANDLE hContact, char* fn); +int OpenAvatarDialog(HCONTACT hContact, char* fn); // utils TCHAR* GetCachedAvatar(char *proto, TCHAR *hash); BOOL ProtocolEnabled(const char *proto); -BOOL ContactEnabled(HANDLE hContact, char *setting, int def); +BOOL ContactEnabled(HCONTACT hContact, char *setting, int def); BOOL CopyImageFile(TCHAR *old_file, TCHAR *new_file); void ConvertToFilename(TCHAR *str, size_t size); -void CreateOldStyleShortcut(HANDLE hContact, TCHAR *history_filename); +void CreateOldStyleShortcut(HCONTACT hContact, TCHAR *history_filename); BOOL CreateShortcut(TCHAR *file, TCHAR *shortcut); #define POPUP_ACTION_DONOTHING 0 diff --git a/plugins/AvatarHistory/src/icolib.cpp b/plugins/AvatarHistory/src/icolib.cpp index 5ff2475db7..b3307b0a7b 100644 --- a/plugins/AvatarHistory/src/icolib.cpp +++ b/plugins/AvatarHistory/src/icolib.cpp @@ -74,7 +74,7 @@ HICON createDefaultOverlayedIcon(BOOL big) } -HICON createProtoOverlayedIcon(HANDLE hContact) +HICON createProtoOverlayedIcon(HCONTACT hContact) { HICON icon1 = LoadIconEx(I_OVERLAY); diff --git a/plugins/AvatarHistory/src/options.cpp b/plugins/AvatarHistory/src/options.cpp index d7fbcdca68..7044b2122f 100644 --- a/plugins/AvatarHistory/src/options.cpp +++ b/plugins/AvatarHistory/src/options.cpp @@ -133,7 +133,7 @@ static INT_PTR CALLBACK PopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA op.popup_use_win_colors = IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS) != 0; op.popup_use_default_colors = IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS) != 0; - HANDLE hContact = db_find_first(); + HCONTACT hContact = db_find_first(); ShowTestPopup(hContact,TranslateT("Test Contact"), TranslateT("Test description"), &op); break; } diff --git a/plugins/AvatarHistory/src/popup.cpp b/plugins/AvatarHistory/src/popup.cpp index dbdd6821ca..34a39ec6c7 100644 --- a/plugins/AvatarHistory/src/popup.cpp +++ b/plugins/AvatarHistory/src/popup.cpp @@ -62,18 +62,18 @@ void ShowErrPopup(const TCHAR *description, const TCHAR *title) } -void ShowTestPopup(HANDLE hContact,const TCHAR *title, const TCHAR *description, const Options *op) +void ShowTestPopup(HCONTACT hContact,const TCHAR *title, const TCHAR *description, const Options *op) { ShowPopupEx(hContact, title, description, NULL, POPUP_TYPE_TEST, op); } -void ShowPopup(HANDLE hContact, const TCHAR *title, const TCHAR *description) +void ShowPopup(HCONTACT hContact, const TCHAR *title, const TCHAR *description) { ShowPopupEx(hContact, title, description, hContact, POPUP_TYPE_NORMAL, &opts); } -void ShowDebugPopup(HANDLE hContact, const TCHAR *title, const TCHAR *description) +void ShowDebugPopup(HCONTACT hContact, const TCHAR *title, const TCHAR *description) { if (db_get_b(NULL,MODULE_NAME,"Debug",0)) { @@ -89,7 +89,7 @@ typedef struct PopupDataType; // Show an popup -void ShowPopupEx(HANDLE hContact, const TCHAR *title, const TCHAR *description, +void ShowPopupEx(HCONTACT hContact, const TCHAR *title, const TCHAR *description, void *plugin_data, int type, const Options *op) { if (ServiceExists(MS_POPUP_ADDPOPUPT)) diff --git a/plugins/AvatarHistory/src/popup.h b/plugins/AvatarHistory/src/popup.h index 706d5824e3..6738f7d577 100644 --- a/plugins/AvatarHistory/src/popup.h +++ b/plugins/AvatarHistory/src/popup.h @@ -54,16 +54,16 @@ void DeInitPopups(); #define POPUP_TYPE_ERROR 2 // Show an popup -void ShowPopup(HANDLE hContact, const TCHAR *title, const TCHAR *description); -void ShowDebugPopup(HANDLE hContact, const TCHAR *title, const TCHAR *description); +void ShowPopup(HCONTACT hContact, const TCHAR *title, const TCHAR *description); +void ShowDebugPopup(HCONTACT hContact, const TCHAR *title, const TCHAR *description); // Show an test -void ShowTestPopup(HANDLE hContact,const TCHAR *title, const TCHAR *description, const Options *op); +void ShowTestPopup(HCONTACT hContact,const TCHAR *title, const TCHAR *description, const Options *op); // Show an error popup void ShowErrPopup(const char *description, const char *title = NULL); -void ShowPopupEx(HANDLE hContact, const TCHAR *title, const TCHAR *description, +void ShowPopupEx(HCONTACT hContact, const TCHAR *title, const TCHAR *description, void *plugin_data, int type, const Options *op); diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp index 388a2e85d5..3d0bd65ec3 100644 --- a/plugins/AvatarHistory/src/utils.cpp +++ b/plugins/AvatarHistory/src/utils.cpp @@ -34,7 +34,7 @@ BOOL ProtocolEnabled(const char *proto) return (BOOL) db_get_b(NULL, MODULE_NAME, setting, TRUE); } -BOOL ContactEnabled(HANDLE hContact, char *setting, int def) +BOOL ContactEnabled(HCONTACT hContact, char *setting, int def) { if (hContact == NULL) return FALSE; @@ -77,7 +77,7 @@ void ConvertToFilename(TCHAR *str, size_t size) } } -int GetUIDFromHContact(HANDLE contact, TCHAR* uinout, int uinout_len) +int GetUIDFromHContact(HCONTACT contact, TCHAR* uinout, int uinout_len) { bool found = true; @@ -138,7 +138,7 @@ TCHAR* GetProtocolFolder(TCHAR *fn, char *proto) return fn; } -TCHAR* GetContactFolder(TCHAR *fn, HANDLE hContact) +TCHAR* GetContactFolder(TCHAR *fn, HCONTACT hContact) { char *proto = GetContactProto(hContact); GetProtocolFolder(fn, proto); @@ -158,7 +158,7 @@ TCHAR* GetContactFolder(TCHAR *fn, HANDLE hContact) return fn; } -TCHAR* GetOldStyleAvatarName(TCHAR *fn, HANDLE hContact) +TCHAR* GetOldStyleAvatarName(TCHAR *fn, HCONTACT hContact) { GetContactFolder(fn, hContact); @@ -172,7 +172,7 @@ TCHAR* GetOldStyleAvatarName(TCHAR *fn, HANDLE hContact) return fn; } -void CreateOldStyleShortcut(HANDLE hContact, TCHAR *history_filename) +void CreateOldStyleShortcut(HCONTACT hContact, TCHAR *history_filename) { TCHAR shortcut[MAX_PATH] = _T(""); diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index 2542a43364..c02fe931d7 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -76,7 +76,7 @@ INT_PTR ExecuteTaskService(WPARAM wParam, LPARAM lParam); int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { - int count = EventList::GetContactMessageNumber((HANDLE)wParam); + int count = EventList::GetContactMessageNumber((HCONTACT)wParam); bool isInList = HistoryWindow::IsInList(GetForegroundWindow()); Menu_ShowItem(hContactMenu, count != 0); @@ -196,7 +196,7 @@ HICON LoadIconEx(int iconId, int big) INT_PTR ShowContactHistory(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HistoryWindow::Open(hContact); return 0; } @@ -210,7 +210,7 @@ int PreShutdownHistoryModule(WPARAM, LPARAM) int HistoryContactDelete(WPARAM wParam, LPARAM) { - HistoryWindow::Close((HANDLE)wParam); + HistoryWindow::Close((HCONTACT)wParam); return 0; } diff --git a/plugins/BasicHistory/src/BinaryExport.cpp b/plugins/BasicHistory/src/BinaryExport.cpp index 0e1636af2f..5a506d9791 100644 --- a/plugins/BasicHistory/src/BinaryExport.cpp +++ b/plugins/BasicHistory/src/BinaryExport.cpp @@ -22,8 +22,8 @@ along with this program. If not, see . #define EXP_FILE (*((std::ofstream*)IExport::stream)) #define IMP_FILE (*((std::ifstream*)IImport::stream)) -std::wstring GetProtocolName(HANDLE hContact); -std::wstring GetContactId(HANDLE hContact); +std::wstring GetProtocolName(HCONTACT hContact); +std::wstring GetContactId(HCONTACT hContact); #pragma pack(push, 1) @@ -158,7 +158,7 @@ bool ReadHeader(BinaryFileHeader& header, std::istream* stream) return true; } -int BinaryExport::IsContactInFile(const std::vector& contacts) +int BinaryExport::IsContactInFile(const std::vector& contacts) { BinaryFileHeader header; if (!ReadHeader(header, IImport::stream)) diff --git a/plugins/BasicHistory/src/BinaryExport.h b/plugins/BasicHistory/src/BinaryExport.h index 386625226f..493e707088 100644 --- a/plugins/BasicHistory/src/BinaryExport.h +++ b/plugins/BasicHistory/src/BinaryExport.h @@ -34,7 +34,7 @@ public: virtual void WriteFooter(); virtual void WriteGroup(bool isMe, const std::wstring &time, const std::wstring &user, const std::wstring &eventText); virtual void WriteMessage(bool isMe, const std::wstring &longDate, const std::wstring &shortDate, const std::wstring &user, const std::wstring &message, const DBEVENTINFO& dbei); - virtual int IsContactInFile(const std::vector& contacts); + virtual int IsContactInFile(const std::vector& contacts); virtual bool GetEventList(std::vector& eventList); virtual ~BinaryExport(); diff --git a/plugins/BasicHistory/src/DatExport.cpp b/plugins/BasicHistory/src/DatExport.cpp index 491f446560..c0882ddc61 100644 --- a/plugins/BasicHistory/src/DatExport.cpp +++ b/plugins/BasicHistory/src/DatExport.cpp @@ -23,8 +23,8 @@ along with this program. If not, see . #define EXP_FILE (*((std::ofstream*)IExport::stream)) #define IMP_FILE (*((std::ifstream*)IImport::stream)) -std::wstring GetProtocolName(HANDLE hContact); -std::wstring GetContactId(HANDLE hContact); +std::wstring GetProtocolName(HCONTACT hContact); +std::wstring GetContactId(HCONTACT hContact); #pragma pack(push, 1) @@ -128,7 +128,7 @@ bool ReadHeader(MCHeader& header, std::istream* stream) return true; } -int DatExport::IsContactInFile(const std::vector& contacts) +int DatExport::IsContactInFile(const std::vector& contacts) { MCHeader header; if (!ReadHeader(header, IImport::stream)) diff --git a/plugins/BasicHistory/src/DatExport.h b/plugins/BasicHistory/src/DatExport.h index 980a12d148..9609a994f6 100644 --- a/plugins/BasicHistory/src/DatExport.h +++ b/plugins/BasicHistory/src/DatExport.h @@ -34,7 +34,7 @@ public: virtual void WriteFooter(); virtual void WriteGroup(bool isMe, const std::wstring &time, const std::wstring &user, const std::wstring &eventText); virtual void WriteMessage(bool isMe, const std::wstring &longDate, const std::wstring &shortDate, const std::wstring &user, const std::wstring &message, const DBEVENTINFO& dbei); - virtual int IsContactInFile(const std::vector& contacts); + virtual int IsContactInFile(const std::vector& contacts); virtual bool GetEventList(std::vector& eventList); DatExport() @@ -45,7 +45,7 @@ public: virtual ~DatExport(); private: int dataSize; - HANDLE hContact; + HCONTACT hContact; std::string memBuf; inline int WriteString(const std::wstring &str); //inline bool ReadString(std::wstring &str, int size); diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index 0ec5f8b5c0..044b32e3e5 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -40,7 +40,7 @@ EventList::EventList() goldBlobSize = 0; } -EventList::EventList(HANDLE _hContact, int filter) +EventList::EventList(HCONTACT _hContact, int filter) :hWnd(NULL), isWnd(false), hContact(_hContact), @@ -188,7 +188,7 @@ std::wstring EventList::GetFilterName() return filterName; } -void EventList::GetTempList(std::list& tempList, bool noFilter, bool noExt, HANDLE _hContact) +void EventList::GetTempList(std::list& tempList, bool noFilter, bool noExt, HCONTACT _hContact) { bool isWndLocal = isWnd; EventTempIndex ti; @@ -299,7 +299,7 @@ void EventList::RefreshEventList() } } -bool EventList::SearchInContact(HANDLE hContact, TCHAR *strFind, ComparatorInterface* compFun) +bool EventList::SearchInContact(HCONTACT hContact, TCHAR *strFind, ComparatorInterface* compFun) { InitFilters(); @@ -431,7 +431,7 @@ std::wstring EventList::GetMyName() return myName; } -inline std::wstring GetProtocolName(HANDLE hContact) +inline std::wstring GetProtocolName(HCONTACT hContact) { char* ac = (char *)CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM)hContact, 0); std::wstring proto1; @@ -471,7 +471,7 @@ std::wstring EventList::GetMyId() return myId; } -inline std::wstring GetContactId(HANDLE hContact) +inline std::wstring GetContactId(HCONTACT hContact) { std::wstring id; CONTACTINFO ci; @@ -643,7 +643,7 @@ CRITICAL_SECTION EventList::criticalSection; std::map EventList::contactFileMap; std::wstring EventList::contactFileDir; -void EventList::AddImporter(HANDLE hContact, IImport::ImportType type, const std::wstring& file) +void EventList::AddImporter(HCONTACT hContact, IImport::ImportType type, const std::wstring& file) { EnterCriticalSection(&criticalSection); TCHAR buf[32]; @@ -673,7 +673,7 @@ void EventList::Deinit() DeleteCriticalSection(&EventList::criticalSection); } -int EventList::GetContactMessageNumber(HANDLE hContact) +int EventList::GetContactMessageNumber(HCONTACT hContact) { int count = db_event_count(hContact); EnterCriticalSection(&criticalSection); @@ -685,7 +685,7 @@ int EventList::GetContactMessageNumber(HANDLE hContact) return count; } -bool EventList::IsImportedHistory(HANDLE hContact) +bool EventList::IsImportedHistory(HCONTACT hContact) { bool count = false; EnterCriticalSection(&criticalSection); @@ -697,7 +697,7 @@ bool EventList::IsImportedHistory(HANDLE hContact) return count; } -void EventList::DeleteImporter(HANDLE hContact) +void EventList::DeleteImporter(HCONTACT hContact) { EnterCriticalSection(&criticalSection); std::map::iterator it = contactFileMap.find(hContact); diff --git a/plugins/BasicHistory/src/EventList.h b/plugins/BasicHistory/src/EventList.h index a32ff92b9c..6a3327760c 100644 --- a/plugins/BasicHistory/src/EventList.h +++ b/plugins/BasicHistory/src/EventList.h @@ -80,7 +80,7 @@ private: void InitFilters(); void InitNames(); void AddGroup(const EventIndex& ev); - void GetTempList(std::list& tempList, bool noFilter, bool noExt, HANDLE _hContact); + void GetTempList(std::list& tempList, bool noFilter, bool noExt, HCONTACT _hContact); void ImportMessages(const std::vector& messages); protected: TCHAR contactName[256]; @@ -102,11 +102,11 @@ protected: void RebuildGroup(int selected); public: EventList(); - EventList(HANDLE _hContact, int filter); + EventList(HCONTACT _hContact, int filter); ~EventList(); HWND hWnd; - HANDLE hContact; + HCONTACT hContact; std::vector > eventList; bool useImportedMessages; @@ -116,7 +116,7 @@ public: int GetFilterNr(); std::wstring GetFilterName(); void RefreshEventList(); - bool SearchInContact(HANDLE hContact, TCHAR *strFind, ComparatorInterface* compFun); + bool SearchInContact(HCONTACT hContact, TCHAR *strFind, ComparatorInterface* compFun); std::wstring GetContactName(); std::wstring GetMyName(); std::wstring GetProtocolName(); @@ -124,10 +124,10 @@ public: std::wstring GetContactId(); std::string GetBaseProtocol(); void MargeMessages(const std::vector& messages); - static void AddImporter(HANDLE hContact, IImport::ImportType type, const std::wstring& file); - static int GetContactMessageNumber(HANDLE hContact); - static bool IsImportedHistory(HANDLE hContact); - static void DeleteImporter(HANDLE hContact); + static void AddImporter(HCONTACT hContact, IImport::ImportType type, const std::wstring& file); + static int GetContactMessageNumber(HCONTACT hContact); + static bool IsImportedHistory(HCONTACT hContact); + static void DeleteImporter(HCONTACT hContact); static void GetObjectDescription( DBEVENTINFO *dbei, TCHAR* str, int cbStr ); bool GetEventData(const EventIndex& ev, EventData& data); void GetExtEventDBei(const EventIndex& ev); diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp index 05edac8053..30453b10a9 100644 --- a/plugins/BasicHistory/src/ExportManager.cpp +++ b/plugins/BasicHistory/src/ExportManager.cpp @@ -26,8 +26,8 @@ along with this program. If not, see . #include "Options.h" #include "codecvt_CodePage.h" -ExportManager::ExportManager(HWND _hwnd, HANDLE _hContact, int filter) - :EventList(_hContact, filter), +ExportManager::ExportManager(HWND _hwnd, HCONTACT _hContact, int filter) : + EventList(_hContact, filter), hwnd(_hwnd), oldOnTop(false) { @@ -196,7 +196,7 @@ const TCHAR* ExportManager::GetExt(IImport::ImportType type) return ext; } -int ExportManager::Import(IImport::ImportType type, const std::vector& contacts) +int ExportManager::Import(IImport::ImportType type, const std::vector& contacts) { IImport* imp = NULL; switch(type) { @@ -233,7 +233,7 @@ int ExportManager::Import(IImport::ImportType type, const std::vector& c return t; } -bool ExportManager::Import(IImport::ImportType type, std::vector& eventList, std::wstring* err, bool* differentContact, std::vector* contacts) +bool ExportManager::Import(IImport::ImportType type, std::vector& eventList, std::wstring* err, bool* differentContact, std::vector* contacts) { IImport* imp = NULL; switch(type) { @@ -258,7 +258,7 @@ bool ExportManager::Import(IImport::ImportType type, std::vectorSetStream(stream); - std::vector v; + std::vector v; v.push_back(hContact); bool ret = true; int contInFile = imp->IsContactInFile(v); diff --git a/plugins/BasicHistory/src/ExportManager.h b/plugins/BasicHistory/src/ExportManager.h index 17ed0bb8ef..c0a3a8acf7 100644 --- a/plugins/BasicHistory/src/ExportManager.h +++ b/plugins/BasicHistory/src/ExportManager.h @@ -30,7 +30,7 @@ private: protected: virtual void AddGroup(bool isMe, const std::wstring &time, const std::wstring &user, const std::wstring &eventText, int ico); public: - ExportManager(HWND _hwnd, HANDLE _hContact, int filter); + ExportManager(HWND _hwnd, HCONTACT _hContact, int filter); void SetAutoExport(const std::wstring _file, int _deltaTime, DWORD _now) { @@ -52,8 +52,8 @@ public: bool Export(IExport::ExportType type); void SetDeleteWithoutExportEvents(int _deltaTime, DWORD _now); void DeleteExportedEvents(); - int Import(IImport::ImportType type, const std::vector& contacts); - bool Import(IImport::ImportType type, std::vector& eventList, std::wstring* err = NULL, bool* differentContact = NULL, std::vector* contacts = NULL); + int Import(IImport::ImportType type, const std::vector& contacts); + bool Import(IImport::ImportType type, std::vector& eventList, std::wstring* err = NULL, bool* differentContact = NULL, std::vector* contacts = NULL); static const TCHAR* GetExt(IImport::ImportType type); }; diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index 0e998322e7..766b8805d6 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -38,7 +38,7 @@ extern IconItem iconList[]; void ResetCList(HWND hWnd); -HistoryWindow::HistoryWindow(HANDLE _hContact) : +HistoryWindow::HistoryWindow(HCONTACT _hContact) : isDestroyed(true), splitterY(0), splitterOrgY(0), @@ -176,7 +176,7 @@ void HistoryWindow::Deinit() } } -void HistoryWindow::Open(HANDLE hContact) +void HistoryWindow::Open(HCONTACT hContact) { if (hContact == NULL) { @@ -199,7 +199,7 @@ void HistoryWindow::Open(HANDLE hContact) } } -void HistoryWindow::Close(HANDLE hContact) +void HistoryWindow::Close(HCONTACT hContact) { std::map::iterator it = windows.find(hContact); if (it != windows.end()) @@ -243,7 +243,7 @@ void HistoryWindow::Close(HistoryWindow* historyWindow) } } -void HistoryWindow::RebuildEvents(HANDLE hContact) +void HistoryWindow::RebuildEvents(HCONTACT hContact) { if (hContact != NULL) { @@ -427,7 +427,7 @@ void HistoryWindow::OptionsSearchingChanged() INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HWND hWnd = NULL; int start = 0; int end = 0; @@ -568,18 +568,18 @@ void OpenOptions(char* group, char* page, char* tab = NULL) class ShowMessageData { public: - ShowMessageData(HANDLE _hContact) + ShowMessageData(HCONTACT _hContact) :hContact(_hContact) { } - ShowMessageData(HANDLE _hContact, const std::wstring &_str) + ShowMessageData(HCONTACT _hContact, const std::wstring &_str) :hContact(_hContact), str(_str) { } - HANDLE hContact; + HCONTACT hContact; std::wstring str; }; @@ -1655,7 +1655,7 @@ void HistoryWindow::ReloadContacts() } } - for (HANDLE _hContact = db_find_first(); _hContact; _hContact = db_find_next(_hContact)) { + for (HCONTACT _hContact = db_find_first(); _hContact; _hContact = db_find_next(_hContact)) { if (EventList::GetContactMessageNumber(_hContact) && (metaContactProto == NULL || db_get_b(_hContact, metaContactProto, "IsSubcontact", 0) == 0)) { HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0); if (hItem == NULL) @@ -1779,7 +1779,7 @@ bool HistoryWindow::DoHotkey(UINT msg, LPARAM lParam, WPARAM wParam, int window) void HistoryWindow::RestorePos() { - HANDLE contactToLoad = hContact; + HCONTACT contactToLoad = hContact; if (hContact == NULL) { Utils_RestoreWindowPosition(hWnd,NULL,MODULE,"history_"); contactToLoad = NULL; @@ -1803,9 +1803,9 @@ void HistoryWindow::RestorePos() void HistoryWindow::SavePos(bool all) { - HANDLE contactToSave = hContact; + HCONTACT contactToSave = hContact; if (all) { - for (HANDLE _hContact = db_find_first(); _hContact; _hContact = db_find_next(_hContact)) { + for (HCONTACT _hContact = db_find_first(); _hContact; _hContact = db_find_next(_hContact)) { db_unset(_hContact, MODULE, "history_x"); db_unset(_hContact, MODULE, "history_y"); db_unset(_hContact, MODULE, "history_width"); @@ -2027,13 +2027,13 @@ void HistoryWindow::DoImport(IImport::ImportType type) ExportManager exp(hWnd, hContact, GetFilterNr()); std::vector messages; std::wstring err; - std::vector contacts; + std::vector contacts; - for (HANDLE _hContact = db_find_first(); _hContact != NULL; _hContact = db_find_next(_hContact)) + for (HCONTACT _hContact = db_find_first(); _hContact != NULL; _hContact = db_find_next(_hContact)) contacts.push_back(_hContact); bool changeContact = false; - HANDLE lastContact = hContact; + HCONTACT lastContact = hContact; int i = 1; do { @@ -2173,14 +2173,11 @@ bool HistoryWindow::ContactChanged(bool sync) { if (!isLoading) { - HANDLE hItem = (HANDLE)SendDlgItemMessage(hWnd, IDC_LIST_CONTACTS, CLM_GETSELECTION, 0, 0); - if (hItem != NULL) - { + HCONTACT hItem = (HCONTACT)SendDlgItemMessage(hWnd, IDC_LIST_CONTACTS, CLM_GETSELECTION, 0, 0); + if (hItem != NULL) { int typeOf = SendDlgItemMessage(hWnd, IDC_LIST_CONTACTS, CLM_GETITEMTYPE,(WPARAM)hItem,0); - if (typeOf == CLCIT_CONTACT) - { - if (hContact != hItem) - { + if (typeOf == CLCIT_CONTACT) { + if (hContact != hItem) { ChangeToFreeWindow(this); isLoading = true; hContact = hItem; @@ -2192,10 +2189,8 @@ bool HistoryWindow::ContactChanged(bool sync) return true; } } - else if (typeOf == CLCIT_INFO && hSystem == hItem) - { - if (hContact != NULL) - { + else if (typeOf == CLCIT_INFO && hSystem == hItem) { + if (hContact != NULL) { ChangeToFreeWindow(this); isLoading = true; hContact = NULL; @@ -2261,11 +2256,11 @@ void HistoryWindow::FormatQuote(std::wstring& quote, const MessageData& md, cons while(f > 0 && f < (int)msg.length()); } -HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder) +HCONTACT HistoryWindow::GetNextContact(HCONTACT hContact, int adder) { HWND contactList = GetDlgItem(hWnd,IDC_LIST_CONTACTS); bool find = false; - HANDLE _hContact; + HCONTACT _hContact; if (adder > 0) { if (hContact != NULL) { _hContact = db_find_next(hContact); @@ -2299,7 +2294,7 @@ HANDLE HistoryWindow::GetNextContact(HANDLE hContact, int adder) } } else { - HANDLE lastContact = NULL; + HCONTACT lastContact = NULL; _hContact = db_find_first(); while(_hContact && _hContact != hContact) { HANDLE hItem = (HANDLE)SendMessage(contactList, CLM_FINDCONTACT, (WPARAM)_hContact, 0); diff --git a/plugins/BasicHistory/src/HistoryWindow.h b/plugins/BasicHistory/src/HistoryWindow.h index 66202937b4..4bebe0e738 100644 --- a/plugins/BasicHistory/src/HistoryWindow.h +++ b/plugins/BasicHistory/src/HistoryWindow.h @@ -22,7 +22,7 @@ along with this program. If not, see . class HistoryWindow : public SearchContext { private: - HistoryWindow(HANDLE _hContact); + HistoryWindow(HCONTACT _hContact); void Initialise(); void Destroy(); void SplitterMoved(HWND splitter, LONG pos, bool screenPos); @@ -75,9 +75,9 @@ protected: public: ~HistoryWindow(); static void Deinit(); - static void Open(HANDLE hContact); - static void Close(HANDLE hContact); - static void RebuildEvents(HANDLE hContact); + static void Open(HCONTACT hContact); + static void Close(HCONTACT hContact); + static void RebuildEvents(HCONTACT hContact); static bool IsInList(HWND hWnd); static int FontsChanged(WPARAM wParam, LPARAM lParam); static INT_PTR DeleteAllUserHistory(WPARAM wParam, LPARAM lParam); @@ -89,7 +89,7 @@ public: // SearchContext interface virtual void SelectEventGroup(int sel); - virtual HANDLE GetNextContact(HANDLE hContact, int adder); + virtual HCONTACT GetNextContact(HCONTACT hContact, int adder); virtual void SelectContact(HANDLE _hContact); }; diff --git a/plugins/BasicHistory/src/IImport.h b/plugins/BasicHistory/src/IImport.h index aef3b35179..6fc3b6f340 100644 --- a/plugins/BasicHistory/src/IImport.h +++ b/plugins/BasicHistory/src/IImport.h @@ -43,7 +43,7 @@ public: } virtual const TCHAR* GetExt() = 0; - virtual int IsContactInFile(const std::vector& contacts) = 0; + virtual int IsContactInFile(const std::vector& contacts) = 0; virtual bool GetEventList(std::vector& eventList) = 0; virtual ~IImport() diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index a8db8de746..bd563ed046 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -562,7 +562,7 @@ void Options::SaveTasks(std::list* tasks) db_set_s(0, MODULE, buf, it->zipPassword.c_str()); mir_snprintf(buf, SIZEOF(buf), "IsInTask_%d", i); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) db_unset(hContact, MODULE, buf); for (size_t j = 0; j < it->contacts.size(); ++j) @@ -617,7 +617,7 @@ void Options::SaveTasks(std::list* tasks) db_unset(NULL, MODULE, buf); mir_snprintf(buf, SIZEOF(buf), "IsInTask_%d", i); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) db_unset(hContact, MODULE, buf); } @@ -705,7 +705,7 @@ void Options::LoadTasks() } mir_snprintf(buf, SIZEOF(buf), "IsInTask_%d", i); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if (db_get_b(hContact, MODULE, buf, 0) == 1) to.contacts.push_back(hContact); @@ -1587,7 +1587,7 @@ void SaveList(HWND hwnd, HANDLE hSystem, TaskOptions* to) if (hSystem) to->isSystem = SendMessage(hwnd, CLM_GETCHECKMARK, (WPARAM) hSystem, 0) != 0; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE) SendMessage(hwnd, CLM_FINDCONTACT, (WPARAM) hContact, 0); if (hItem && SendMessage(hwnd, CLM_GETCHECKMARK, (WPARAM) hItem, 0)) to->contacts.push_back(hContact); diff --git a/plugins/BasicHistory/src/Options.h b/plugins/BasicHistory/src/Options.h index 21a0976d9d..99da9d7908 100644 --- a/plugins/BasicHistory/src/Options.h +++ b/plugins/BasicHistory/src/Options.h @@ -92,7 +92,7 @@ struct TaskOptions std::wstring filePath; std::wstring taskName; std::string zipPassword; // char* because zip file using ANSI password - std::vector contacts; + std::vector contacts; TaskOptions() { forceExecute = false; diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 25d6e61053..9f52474d35 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -219,7 +219,7 @@ bool IsValidTask(TaskOptions& to, std::list* top, std::wstring* err static void CALLBACK DoRebuildEventsInMainAPCFunc(ULONG_PTR dwParam) { - HANDLE* contacts = (HANDLE*) dwParam; + HCONTACT *contacts = (HCONTACT*)dwParam; size_t size = (size_t)contacts[0]; for (size_t i = 1; i <= size; ++i) HistoryWindow::RebuildEvents(contacts[i]); @@ -277,7 +277,7 @@ bool DoTask(TaskOptions& to) std::wstring filePath = to.filePath; std::wstring dir; std::list files; - std::vector contacts; + std::vector contacts; if (to.useFtp || to.compress) { std::map existingContacts; TCHAR temp[MAX_PATH]; @@ -352,7 +352,7 @@ bool DoTask(TaskOptions& to) } if (!error) { - std::list contactList; + std::list contactList; for (std::list::iterator it = files.begin(); it != files.end(); ++it) { mExp.SetAutoImport(*it); int ret = mExp.Import(to.importType, contacts); @@ -377,7 +377,7 @@ bool DoTask(TaskOptions& to) } if (ret >= 0) { - mExp.hContact = contacts[ret]; + mExp.hContact = contacts[ret]; if (to.type == TaskOptions::Import) { EventList::AddImporter(mExp.hContact, to.importType, *it); contactList.push_back(mExp.hContact); @@ -413,7 +413,7 @@ bool DoTask(TaskOptions& to) HANDLE* contacts = new HANDLE[contactList.size() + 1]; contacts[0] = (HANDLE)contactList.size(); int i = 1; - for (std::list::iterator it = contactList.begin(); it != contactList.end(); ++it) + for (std::list::iterator it = contactList.begin(); it != contactList.end(); ++it) contacts[i++] = *it; QueueUserAPC(DoRebuildEventsInMainAPCFunc, g_hMainThread, (ULONG_PTR) contacts); diff --git a/plugins/BasicHistory/src/SearchContext.h b/plugins/BasicHistory/src/SearchContext.h index 6b1655d857..dd16d95d79 100644 --- a/plugins/BasicHistory/src/SearchContext.h +++ b/plugins/BasicHistory/src/SearchContext.h @@ -29,7 +29,7 @@ public: int selected; virtual void SelectEventGroup(int sel) = 0; - virtual HANDLE GetNextContact(HANDLE hContact, int adder) = 0; + virtual HCONTACT GetNextContact(HCONTACT hContact, int adder) = 0; virtual void SelectContact(HANDLE _hContact) = 0; struct MessageData diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp index 0c9091e4f6..4a1ed6dce1 100644 --- a/plugins/BasicHistory/src/Searcher.cpp +++ b/plugins/BasicHistory/src/Searcher.cpp @@ -223,7 +223,7 @@ void Searcher::Find() if (sel < 0) { isFindContactChanged = true; if (allUsers) { - HANDLE hNext = context->hContact; + HCONTACT hNext = context->hContact; do { hNext = context->GetNextContact(hNext, adder2); @@ -237,7 +237,7 @@ void Searcher::Find() else if (sel >= (int)context->eventList.size()) { isFindContactChanged = true; if (allUsers) { - HANDLE hNext = context->hContact; + HCONTACT hNext = context->hContact; do { hNext = context->GetNextContact(hNext, adder2); diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp index 3514ae994b..3f0fead59b 100644 --- a/plugins/Boltun/src/actionQueue.cpp +++ b/plugins/Boltun/src/actionQueue.cpp @@ -29,15 +29,15 @@ using namespace std; extern TalkBot* bot; -typedef void (*ActionHandler)(HANDLE hContact, const TalkBot::MessageInfo *inf); +typedef void (*ActionHandler)(HCONTACT hContact, const TalkBot::MessageInfo *inf); typedef struct _QueueElement { - HANDLE hContact; + HCONTACT hContact; const TalkBot::MessageInfo *inf; ActionHandler Handler; bool Sticky; int TimeOffset; - _QueueElement(HANDLE contact, ActionHandler handler, int timeOffset, const TalkBot::MessageInfo *info = NULL, bool sticky = false) + _QueueElement(HCONTACT contact, ActionHandler handler, int timeOffset, const TalkBot::MessageInfo *info = NULL, bool sticky = false) :hContact(contact), Handler(handler), TimeOffset(timeOffset), inf(info), Sticky(sticky) { } @@ -72,7 +72,7 @@ void UpdateTimer() timerID = 0; } -static bool NotifyTyping(HANDLE hContact) +static bool NotifyTyping(HCONTACT hContact) { int res = db_get_b(hContact, "SRMsg", "SupportTyping", 2); if (res == 2) @@ -80,7 +80,7 @@ static bool NotifyTyping(HANDLE hContact) return res != 0; } -static void TimerAnswer(HANDLE hContact, const TalkBot::MessageInfo* info) +static void TimerAnswer(HCONTACT hContact, const TalkBot::MessageInfo* info) { DBEVENTINFO ldbei; int size = (int)info->Answer.length() + 1; @@ -118,7 +118,7 @@ static void TimerAnswer(HANDLE hContact, const TalkBot::MessageInfo* info) typingContactsLock.Leave(); } -static void StartTyping(HANDLE hContact, const TalkBot::MessageInfo*) +static void StartTyping(HCONTACT hContact, const TalkBot::MessageInfo*) { CallService(MS_PROTO_SELFISTYPING, (WPARAM)hContact, (LPARAM)PROTOTYPE_SELFTYPING_ON); @@ -127,7 +127,7 @@ static void StartTyping(HANDLE hContact, const TalkBot::MessageInfo*) typingContactsLock.Leave(); } -void DoAnswer(HANDLE hContact, const TalkBot::MessageInfo *info, bool sticky = false) +void DoAnswer(HCONTACT hContact, const TalkBot::MessageInfo *info, bool sticky = false) { if (info->Answer[0] == _T('\0')) return; @@ -206,7 +206,7 @@ void DoAnswer(HANDLE hContact, const TalkBot::MessageInfo *info, bool sticky = f cs.Leave(); } -void AnswerToContact(HANDLE hContact, const TCHAR* messageToAnswer) +void AnswerToContact(HCONTACT hContact, const TCHAR* messageToAnswer) { if (Config.TalkWarnContacts && db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_WARNED, FALSE) == FALSE) @@ -218,7 +218,7 @@ void AnswerToContact(HANDLE hContact, const TCHAR* messageToAnswer) DoAnswer(hContact, bot->Reply(hContact, messageToAnswer, false)); } -void StartChatting(HANDLE hContact) +void StartChatting(HCONTACT hContact) { DoAnswer(hContact, new TalkBot::MessageInfo(bot->GetInitMessage(hContact)), true); } diff --git a/plugins/Boltun/src/actionQueue.h b/plugins/Boltun/src/actionQueue.h index 780bbde97a..e8d62b8f6b 100644 --- a/plugins/Boltun/src/actionQueue.h +++ b/plugins/Boltun/src/actionQueue.h @@ -21,8 +21,8 @@ #ifndef ACTIONQUEUE_H #define ACTIONQUEUE_H -void AnswerToContact(HANDLE hContact, const TCHAR* messageToAnswer); +void AnswerToContact(HCONTACT hContact, const TCHAR* messageToAnswer); -void StartChatting(HANDLE hContact); +void StartChatting(HCONTACT hContact); #endif /* ACTIONQUEUE_H */ \ No newline at end of file diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index 26a370b50e..709e5b3a9f 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -178,7 +178,7 @@ static bool LoadMind(const TCHAR* filename, int &line) return true; }*/ -static bool BoltunAutoChat(HANDLE hContact) +static bool BoltunAutoChat(HCONTACT hContact) { if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT , FALSE) == TRUE) @@ -212,7 +212,8 @@ static bool BoltunAutoChat(HANDLE hContact) static int MessageEventAdded(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam, hDbEvent = (HANDLE)lParam; + HCONTACT hContact = (HCONTACT)wParam; + HANDLE hDbEvent = (HANDLE)lParam; if (!BoltunAutoChat(hContact)) return 0; @@ -500,7 +501,7 @@ static int MessageOptInit(WPARAM wParam, LPARAM lParam) static int ContactClick(WPARAM wParam, LPARAM lParam, BOOL clickNotToChat) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; BOOL boltunautochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE); BOOL boltunnottochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE); @@ -544,7 +545,7 @@ static INT_PTR ContactClickNotToChat(WPARAM wParam, LPARAM lParam) static INT_PTR ContactClickStartChatting(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; StartChatting(hContact); return 0; } @@ -553,7 +554,7 @@ static int MessagePrebuild(WPARAM wParam, LPARAM lParam) { CLISTMENUITEM clmi = { sizeof(clmi) }; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!blInit || (db_get_b(hContact,"CList","NotOnList",0) == 1)) { clmi.flags = CMIM_FLAGS | CMIF_GRAYED; diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 59c00baeab..ecf709b150 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -67,19 +67,19 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } -time_t getLastSeen(HANDLE hContact) +time_t getLastSeen(HCONTACT hContact) { return db_get_dw(hContact, MODULE_NAME, "LastSeen", db_get_dw(hContact, MODULE_NAME, "CreationTime", (DWORD)-1)); } -void setLastSeen(HANDLE hContact) +void setLastSeen(HCONTACT hContact) { db_set_dw(hContact, MODULE_NAME, "LastSeen", (DWORD)time(NULL)); if (db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0)) db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0); } -time_t getLastInputMsg(HANDLE hContact) +time_t getLastInputMsg(HCONTACT hContact) { HANDLE hDbEvent = db_event_last(hContact); while (hDbEvent) { @@ -212,7 +212,7 @@ LRESULT CALLBACK PopupDlgProcNoSet(HWND hWnd, UINT message, WPARAM wParam, LPARA /** * Checks - whether user has been gone for specified number of days */ -bool isContactGoneFor(HANDLE hContact, int days) +bool isContactGoneFor(HCONTACT hContact, int days) { time_t lastSeen = getLastSeen(hContact); time_t lastInputMsg = getLastInputMsg(hContact); @@ -257,7 +257,7 @@ bool isContactGoneFor(HANDLE hContact, int days) return (daysSinceOnline >= days && (daysSinceMessage == -1 || daysSinceMessage >= days)); } -void ReturnNotify(HANDLE hContact, TCHAR *message) +void ReturnNotify(HCONTACT hContact, TCHAR *message) { if (db_get_b(hContact, "CList", "NotOnList", 0) == 1 || db_get_b(hContact, "CList", "Hidden", 0) == 1) return; @@ -297,7 +297,7 @@ void ReturnNotify(HANDLE hContact, TCHAR *message) } } -void GoneNotify(HANDLE hContact, TCHAR *message) +void GoneNotify(HCONTACT hContact, TCHAR *message) { if (db_get_b(hContact, "CList", "NotOnList", 0) == 1 || db_get_b(hContact, "CList", "Hidden", 0) == 1) return; @@ -343,12 +343,12 @@ void GoneNotify(HANDLE hContact, TCHAR *message) */ INT_PTR MissYouAction(WPARAM wParam, LPARAM lParam) { - HANDLE hContact; + HCONTACT hContact; if (lParam) { CLISTEVENT* cle = (CLISTEVENT*)lParam; hContact = cle->hContact; } - else hContact = (HANDLE)wParam; + else hContact = (HCONTACT)wParam; CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, 0); return 0; @@ -361,12 +361,12 @@ INT_PTR MissYouAction(WPARAM wParam, LPARAM lParam) */ INT_PTR ContactReturnedAction(WPARAM wParam, LPARAM lParam) { - HANDLE hContact; + HCONTACT hContact; if (lParam) { CLISTEVENT* cle = (CLISTEVENT*)lParam; hContact = cle->hContact; } - else hContact = (HANDLE)wParam; + else hContact = (HCONTACT)wParam; if (options.iShowMessageWindow>0) CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, 0); @@ -385,12 +385,12 @@ INT_PTR ContactReturnedAction(WPARAM wParam, LPARAM lParam) */ INT_PTR ContactStillAbsentAction(WPARAM wParam, LPARAM lParam) { - HANDLE hContact; + HCONTACT hContact; if (lParam) { CLISTEVENT* cle = (CLISTEVENT*)lParam; hContact = cle->hContact; } - else hContact = (HANDLE)wParam; + else hContact = (HCONTACT)wParam; switch (options.action2) { case GCA_DELETE: @@ -423,15 +423,15 @@ int onIconsChanged(WPARAM wParam, LPARAM lParam) */ INT_PTR MenuMissYouClick(WPARAM wParam, LPARAM lParam) { - if (db_get_b((HANDLE)wParam, MODULE_NAME, "MissYou", 0)) { - db_set_b((HANDLE)wParam, MODULE_NAME, "MissYou", 0); + if (db_get_b((HCONTACT)wParam, MODULE_NAME, "MissYou", 0)) { + db_set_b((HCONTACT)wParam, MODULE_NAME, "MissYou", 0); if (options.MissYouIcon) - ExtraIcon_Clear(hExtraIcon, (HANDLE)wParam); + ExtraIcon_Clear(hExtraIcon, (HCONTACT)wParam); } else { - db_set_b((HANDLE)wParam, MODULE_NAME, "MissYou", 1); + db_set_b((HCONTACT)wParam, MODULE_NAME, "MissYou", 1); if (options.MissYouIcon) - ExtraIcon_SetIcon(hExtraIcon, (HANDLE)wParam, "enabled_icon"); + ExtraIcon_SetIcon(hExtraIcon, (HCONTACT)wParam, "enabled_icon"); } return 0; @@ -442,13 +442,13 @@ INT_PTR MenuMissYouClick(WPARAM wParam, LPARAM lParam) */ int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam) { - char *proto = GetContactProto((HANDLE)wParam); + char *proto = GetContactProto((HCONTACT)wParam); if (!proto) return 0; CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ICON | CMIM_NAME | CMIF_TCHAR; - if (db_get_b((HANDLE)wParam, MODULE_NAME, "MissYou", 0)) { + if (db_get_b((HCONTACT)wParam, MODULE_NAME, "MissYou", 0)) { mi.ptszName = LPGENT("Disable Miss You"); mi.icolibItem = iconList[1].hIcolib; } @@ -457,14 +457,14 @@ int onPrebuildContactMenu(WPARAM wParam, LPARAM lParam) mi.icolibItem = iconList[2].hIcolib; } Menu_ModifyItem(hContactMenu, &mi); - Menu_ShowItem(hContactMenu, !db_get_b((HANDLE)wParam, proto, "ChatRoom", 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND)); + Menu_ShowItem(hContactMenu, !db_get_b((HCONTACT)wParam, proto, "ChatRoom", 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND)); return 0; } int onExtraImageApplying(WPARAM wParam, LPARAM lParam) { - if ( db_get_b((HANDLE)wParam, MODULE_NAME, "MissYou", 0)) - ExtraIcon_SetIcon(hExtraIcon, (HANDLE)wParam, "enabled_icon"); + if ( db_get_b((HCONTACT)wParam, MODULE_NAME, "MissYou", 0)) + ExtraIcon_SetIcon(hExtraIcon, (HCONTACT)wParam, "enabled_icon"); return 0; } @@ -474,7 +474,7 @@ int onExtraImageApplying(WPARAM wParam, LPARAM lParam) */ int SettingChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT) wParam; DBCONTACTWRITESETTING *inf = (DBCONTACTWRITESETTING *) lParam; if (hContact == NULL || inf->value.type == DBVT_DELETED || strcmp(inf->szSetting, "Status") != 0) @@ -565,7 +565,7 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *proto = GetContactProto(hContact); if (proto && (db_get_b(hContact, proto, "ChatRoom", 0) == 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) && isContactGoneFor(hContact, options.iAbsencePeriod2) && (db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0) == 0)) { @@ -671,7 +671,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda int ContactAdded(WPARAM wParam, LPARAM lParam) { - db_set_dw((HANDLE)wParam, MODULE_NAME, "CreationTime", (DWORD)time(0)); + db_set_dw((HCONTACT)wParam, MODULE_NAME, "CreationTime", (DWORD)time(0)); return 0; } @@ -709,7 +709,7 @@ extern "C" int __declspec(dllexport) Load(void) DBVARIANT dbv; DWORD current_time = (DWORD)time(0); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if ( !db_get(hContact, MODULE_NAME, "CreationTime", &dbv)) db_free(&dbv); else diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index f668e70a9b..7d710ce26c 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -25,9 +25,9 @@ #define DEF_COLOR_FORE 0x000000 extern HICON hIcon; -extern time_t getLastSeen(HANDLE); -extern time_t getLastInputMsg(HANDLE); -extern bool isContactGoneFor(HANDLE, int); +extern time_t getLastSeen(HCONTACT); +extern time_t getLastInputMsg(HCONTACT); +extern bool isContactGoneFor(HCONTACT, int); Options options; void LoadOptions() @@ -247,7 +247,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, SaveOptions(); // clear all notified settings - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if(db_get_b(hContact, MODULE_NAME, "StillAbsentNotified", 0)) db_set_b(hContact, MODULE_NAME, "StillAbsentNotified", 0); @@ -458,7 +458,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar { time_t tmpTime; TCHAR tmpBuf[51] = {0}; - tmpTime = getLastSeen((HANDLE)lparam); + tmpTime = getLastSeen((HCONTACT)lparam); if (tmpTime == -1) SetDlgItemText(hdlg, IDC_EDIT_LASTSEEN, TranslateT("not detected")); else { @@ -466,7 +466,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar SetDlgItemText(hdlg, IDC_EDIT_LASTSEEN, tmpBuf); } - tmpTime = getLastInputMsg((HANDLE)lparam); + tmpTime = getLastInputMsg((HCONTACT)lparam); if (tmpTime == -1) SetDlgItemText(hdlg, IDC_EDIT_LASTINPUT, TranslateT("not found")); else { @@ -474,19 +474,19 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar SetDlgItemText(hdlg, IDC_EDIT_LASTINPUT, tmpBuf); } - unsigned int AbsencePeriod = db_get_dw((HANDLE)lparam, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod); + unsigned int AbsencePeriod = db_get_dw((HCONTACT)lparam, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod); SendDlgItemMessage(hdlg, IDC_SPINABSENCE, UDM_SETRANGE, 0, MAKELONG(999, 1)); SetDlgItemInt(hdlg, IDC_EDITABSENCE, AbsencePeriod, FALSE); - if (isContactGoneFor((HANDLE)lparam, options.iAbsencePeriod2)) + if (isContactGoneFor((HCONTACT)lparam, options.iAbsencePeriod2)) SetDlgItemText(hdlg, IDC_EDIT_WILLNOTICE, TranslateT("This contact has been absent for an extended period of time.")); else SetDlgItemText(hdlg, IDC_EDIT_WILLNOTICE, _T("")); - SendMessage(GetDlgItem(hdlg, IDC_CHECK_MISSYOU), BM_SETCHECK, db_get_b((HANDLE)lparam, MODULE_NAME, "MissYou", 0) ? BST_CHECKED : BST_UNCHECKED, 0); - SendMessage(GetDlgItem(hdlg, IDC_CHECK_NOTIFYALWAYS), BM_SETCHECK, db_get_b((HANDLE)lparam, MODULE_NAME, "MissYouNotifyAlways", 0) ? BST_CHECKED : BST_UNCHECKED, 0); - SendMessage(GetDlgItem(hdlg, IDC_CHECK_NEVERHIDE), BM_SETCHECK, db_get_b((HANDLE)lparam, MODULE_NAME, "NeverHide", 0) ? BST_CHECKED : BST_UNCHECKED, 0); + SendMessage(GetDlgItem(hdlg, IDC_CHECK_MISSYOU), BM_SETCHECK, db_get_b((HCONTACT)lparam, MODULE_NAME, "MissYou", 0) ? BST_CHECKED : BST_UNCHECKED, 0); + SendMessage(GetDlgItem(hdlg, IDC_CHECK_NOTIFYALWAYS), BM_SETCHECK, db_get_b((HCONTACT)lparam, MODULE_NAME, "MissYouNotifyAlways", 0) ? BST_CHECKED : BST_UNCHECKED, 0); + SendMessage(GetDlgItem(hdlg, IDC_CHECK_NEVERHIDE), BM_SETCHECK, db_get_b((HCONTACT)lparam, MODULE_NAME, "NeverHide", 0) ? BST_CHECKED : BST_UNCHECKED, 0); TranslateDialogDefault(hdlg); return TRUE; @@ -500,7 +500,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lpar { case (PSN_APPLY): { - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lparam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lparam)->lParam; if (hContact) { db_set_dw(hContact, MODULE_NAME, "iAbsencePeriod", GetDlgItemInt(hdlg, IDC_EDITABSENCE, 0, FALSE)); diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index 9395887a5c..d47444d3bd 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -12,7 +12,7 @@ void populateSettingsList(HWND hwnd2List) void populateContacts(HANDLE BPhContact,HWND hwnd2CB) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *szProto = GetContactProto(hContact); if (szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM)) { TCHAR name[300]; @@ -25,7 +25,7 @@ void populateContacts(HANDLE BPhContact,HWND hwnd2CB) } } -void saveLastSetting(HANDLE hContact, HWND hwnd) +void saveLastSetting(HCONTACT hContact, HWND hwnd) { TCHAR number[8];//, string[1024];//for sending file name switch (db_get_b(hContact, modname, "LastSetting", 2)) { // nothing to do @@ -63,7 +63,7 @@ void hideAll(HWND hwnd) ShowWindow(GetDlgItem(hwnd, IDC_SPIN), SW_HIDE); } -void getDefaultMessage(HWND hwnd, UINT control, HANDLE hContact) +void getDefaultMessage(HWND hwnd, UINT control, HCONTACT hContact) { DBVARIANT dbv; if (!db_get_ts(hContact, modname, "PounceMsg", &dbv)) { @@ -178,7 +178,7 @@ void statusModes(windowInfo *wi, int myStatusMode) // myStatusMode=1 sendIfMySta CheckDlgButton(hwnd, IDC_CHECK10, (statusFlag&LUNCH)>>9); } -void deletePounce(HANDLE hContact) +void deletePounce(HCONTACT hContact) { db_unset(hContact,modname, "PounceMsg"); db_unset(hContact,modname, "SendIfMyStatusIsFLAG"); @@ -192,12 +192,12 @@ void deletePounce(HANDLE hContact) INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); switch(msg) { case WM_INITDIALOG: TranslateDialogDefault(hwnd); - hContact = (HANDLE)lParam; + hContact = (HCONTACT)lParam; SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)lParam); getDefaultMessage(hwnd, IDC_MESSAGE, hContact); @@ -259,7 +259,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l msg(TranslateT("error......"), TranslateT("Buddy Pounce")); DestroyWindow(hwnd); } - wi->hContact = (HANDLE)lParam; + wi->hContact = (HCONTACT)lParam; wi->SendIfMy = 0; wi->SendWhenThey = 0; SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)wi); @@ -290,7 +290,7 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case IDC_SIMPLE: case IDOK: { - HANDLE hContact = (HANDLE)SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETITEMDATA, SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETCURSEL,0,0),0); + HCONTACT hContact = (HCONTACT)SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETITEMDATA, SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETCURSEL,0,0),0); int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE))+1; if (length>1) { TCHAR *text = (TCHAR*)mir_alloc(length*sizeof(TCHAR)); @@ -416,7 +416,7 @@ INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA); - HANDLE hContact = ((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact; + HCONTACT hContact = ((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact; int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE))+1; if (length > 1) { TCHAR *text = (TCHAR*)mir_alloc(length*sizeof(TCHAR)); @@ -570,13 +570,13 @@ INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); switch(msg) { case WM_INITDIALOG: SetWindowLongPtr(hwnd, GWLP_USERDATA, (WPARAM)lParam); TranslateDialogDefault(hwnd); - hContact = (HANDLE)lParam; + hContact = (HCONTACT)lParam; { DBVARIANT dbv; if (db_get_ts(hContact, modname, "PounceMsg", &dbv)) @@ -608,7 +608,7 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return 0; } -void CreateMessageAcknowlegedWindow(HANDLE hContact, int SentSuccess) +void CreateMessageAcknowlegedWindow(HCONTACT hContact, int SentSuccess) { HWND hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMSEND), 0, PounceSentDlgProc, (LPARAM)hContact); TCHAR msg[256]; diff --git a/plugins/BuddyPounce/src/headers.h b/plugins/BuddyPounce/src/headers.h index 3a48a35375..48c499442c 100644 --- a/plugins/BuddyPounce/src/headers.h +++ b/plugins/BuddyPounce/src/headers.h @@ -47,14 +47,14 @@ struct windowInfo { - HANDLE hContact; + HCONTACT hContact; HWND SendIfMy; HWND SendWhenThey; }; struct SendPounceDlgProcStruct { - HANDLE hContact; + HCONTACT hContact; int timer; TCHAR *message; }; @@ -66,13 +66,13 @@ extern HINSTANCE hInst; //======================================================= // main.c -void SendPounce(TCHAR* text, HANDLE hContact); +void SendPounce(TCHAR* text, HCONTACT hContact); //dialog.c INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK BuddyPounceSimpleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK BuddyPounceOptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK SendPounceDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -void CreateMessageAcknowlegedWindow(HANDLE hContact, int SentSuccess); +void CreateMessageAcknowlegedWindow(HCONTACT hContact, int SentSuccess); #endif //_COMMONHEADERS_H \ No newline at end of file diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index cbca095e37..18e8a64c44 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -133,7 +133,7 @@ int statusCheck(int statusFlag, int status) } return 0; } -int CheckDate(HANDLE hContact) +int CheckDate(HCONTACT hContact) { time_t curtime = time (NULL); if(!db_get_b(hContact,modname,"GiveUpDays",0)) @@ -143,7 +143,7 @@ int CheckDate(HANDLE hContact) return 0; } -void SendPounce(TCHAR *text, HANDLE hContact) +void SendPounce(TCHAR *text, HCONTACT hContact) { char* pszUtf = mir_utf8encodeT(text); if (HANDLE hSendId = (HANDLE)CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)pszUtf)) @@ -153,14 +153,14 @@ void SendPounce(TCHAR *text, HANDLE hContact) int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; char *szProto = GetContactProto(hContact); if((HANDLE)wParam == NULL || strcmp(cws->szSetting,"Status")) return 0; if (szProto && (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM)) { int newStatus = cws->value.wVal; - int oldStatus = db_get_w((HANDLE)wParam,"UserOnline","OldStatus",ID_STATUS_OFFLINE); + int oldStatus = db_get_w((HCONTACT)wParam,"UserOnline","OldStatus",ID_STATUS_OFFLINE); if (newStatus != oldStatus && wParam != NULL && newStatus != ID_STATUS_OFFLINE) { DBVARIANT dbv; @@ -192,7 +192,7 @@ int UserOnlineSettingChanged(WPARAM wParam,LPARAM lParam) INT_PTR BuddyPounceMenuCommand(WPARAM wParam, LPARAM lParam) { - if (db_get_b(NULL, modname, "UseAdvanced", 0) || db_get_b((HANDLE)wParam, modname, "UseAdvanced", 0)) + if (db_get_b(NULL, modname, "UseAdvanced", 0) || db_get_b((HCONTACT)wParam, modname, "UseAdvanced", 0)) CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE),0,BuddyPounceDlgProc, wParam); else CreateDialogParam(hInst,MAKEINTRESOURCE(IDD_POUNCE_SIMPLE),0,BuddyPounceSimpleDlgProc, wParam); return 0; @@ -200,7 +200,7 @@ INT_PTR BuddyPounceMenuCommand(WPARAM wParam, LPARAM lParam) INT_PTR AddSimpleMessage(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; TCHAR* message = (TCHAR*)lParam; time_t today = time(NULL); db_set_ws(hContact, modname, "PounceMsg", message); @@ -214,7 +214,7 @@ INT_PTR AddSimpleMessage(WPARAM wParam, LPARAM lParam) INT_PTR AddToPounce(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; TCHAR* message = (TCHAR*)lParam; DBVARIANT dbv; if (!db_get_ts(hContact, modname, "PounceMsg",&dbv)) diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index cb41658ae4..22725f9e07 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -67,7 +67,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) static int OnDbChanged(WPARAM wparam, LPARAM lparam) { - HANDLE hContact = (HANDLE)wparam; + HCONTACT hContact = (HCONTACT)wparam; DBCONTACTWRITESETTING *cws = ( DBCONTACTWRITESETTING* )lparam; // if user changes his UIN or JID on any account diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index 4415e69a78..f52a7e44a4 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -83,7 +83,7 @@ static VOID NTAPI ShowContactMenu(ULONG_PTR wParam) void Popup_DoAction(HWND hWnd, BYTE Action, PLUGIN_DATA *pdata) { - HANDLE hContact = (HANDLE)CallService(MS_POPUP_GETCONTACT, (WPARAM)hWnd, 0); + HCONTACT hContact = (HCONTACT)CallService(MS_POPUP_GETCONTACT, (WPARAM)hWnd, 0); switch (Action) { case PCA_OPENMESSAGEWND: // open message window if (hContact && hContact != INVALID_HANDLE_VALUE) @@ -201,7 +201,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) if (lstrcmpA(cws->szSetting, DB_MIRVER)) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; SHOWPOPUP_DATA sd = {0}; char *szProto = GetContactProto(hContact); if (g_PreviewOptPage) @@ -231,7 +231,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) PopupOptPage.DBToMem(); } - HANDLE hContactOrMeta = (hContact && bMetaContactsExists) ? (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0) : hContact; + HCONTACT hContactOrMeta = (hContact && bMetaContactsExists) ? (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0) : hContact; if (!hContactOrMeta) hContactOrMeta = hContact; diff --git a/plugins/ClientChangeNotify/src/Common.h b/plugins/ClientChangeNotify/src/Common.h index 2869333d1c..f9ce032674 100644 --- a/plugins/ClientChangeNotify/src/Common.h +++ b/plugins/ClientChangeNotify/src/Common.h @@ -138,7 +138,7 @@ struct PLUGIN_DATA struct SHOWPOPUP_DATA { - HANDLE hContact; + HCONTACT hContact; TCString OldMirVer; TCString MirVer; COptPage *PopupOptPage; diff --git a/plugins/ClientChangeNotify/src/CommonLibs/CString.cpp b/plugins/ClientChangeNotify/src/CommonLibs/CString.cpp index de3e26d238..52e4f69295 100644 --- a/plugins/ClientChangeNotify/src/CommonLibs/CString.cpp +++ b/plugins/ClientChangeNotify/src/CommonLibs/CString.cpp @@ -272,19 +272,19 @@ template class TString; template class TString; template class TString; -CString db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, const char *szDefaultValue) +CString db_get_s(HCONTACT hContact, const char *szModule, const char *szSetting, const char *szDefaultValue) { ptrA p( db_get_sa(hContact, szModule, szSetting)); return CString(p == NULL ? szDefaultValue : p); } -TCString db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue) +TCString db_get_s(HCONTACT hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue) { ptrT p( db_get_tsa(hContact, szModule, szSetting)); return TCString(p == NULL ? szDefaultValue : p); } -TCString DBGetContactSettingAsString(HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue) +TCString DBGetContactSettingAsString(HCONTACT hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue) { // also converts numeric values to a string DBVARIANT dbv = {0}; int iRes = db_get_ws(hContact, szModule, szSetting, &dbv); diff --git a/plugins/ClientChangeNotify/src/CommonLibs/CString.h b/plugins/ClientChangeNotify/src/CommonLibs/CString.h index fc81efed22..c1f555c72a 100644 --- a/plugins/ClientChangeNotify/src/CommonLibs/CString.h +++ b/plugins/ClientChangeNotify/src/CommonLibs/CString.h @@ -163,10 +163,10 @@ __inline CHARARRAY WCHAR2UTF8(WCString Str) #undef db_get_s -CString db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, const char *szDefaultValue); -TCString db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue); -int db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); -TCString DBGetContactSettingAsString(HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue); // also converts numeric values to a string +CString db_get_s(HCONTACT hContact, const char *szModule, const char *szSetting, const char *szDefaultValue); +TCString db_get_s(HCONTACT hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue); +int db_get_s(HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); +TCString DBGetContactSettingAsString(HCONTACT hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue); // also converts numeric values to a string // various string helpers. their return values are valid only while the class is visible class UTF8Encode diff --git a/plugins/Clist_blind/src/clcopts.cpp b/plugins/Clist_blind/src/clcopts.cpp index 0aeba193a2..806b58c785 100644 --- a/plugins/Clist_blind/src/clcopts.cpp +++ b/plugins/Clist_blind/src/clcopts.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" -TCHAR* MyDBGetContactSettingTString(HANDLE hContact, char* module, char* setting, TCHAR* out, size_t len, TCHAR *def); +TCHAR* MyDBGetContactSettingTString(HCONTACT hContact, char* module, char* setting, TCHAR* out, size_t len, TCHAR *def); #define DBFONTF_BOLD 1 diff --git a/plugins/Clist_blind/src/clistopts.cpp b/plugins/Clist_blind/src/clistopts.cpp index a8e5220189..f709c123f0 100644 --- a/plugins/Clist_blind/src/clistopts.cpp +++ b/plugins/Clist_blind/src/clistopts.cpp @@ -28,7 +28,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) { case WM_USER + 1: { - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT) wParam; DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *) lParam; if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && lstrcmpiA(ws->szModule, "CList") == 0 && lstrcmpiA(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) { @@ -221,7 +221,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP pcli->pfnTrayIconIconsChanged(); pcli->pfnLoadContactTree(); /* this won't do job properly since it only really works when changes happen */ - pcli->pfnInvalidateDisplayNameCacheEntry( INVALID_HANDLE_VALUE ); /* force reshuffle */ + pcli->pfnInvalidateDisplayNameCacheEntry((HCONTACT)INVALID_HANDLE_VALUE); /* force reshuffle */ return TRUE; } break; diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index 90872edde0..593c331d66 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -185,7 +185,7 @@ extern "C" int __declspec(dllexport) Unload(void) ///////////////////////////////////////////////////////////////////////////////////////// -TCHAR* MyDBGetContactSettingTString(HANDLE hContact, char* module, char* setting, TCHAR* out, size_t len, TCHAR *def) +TCHAR* MyDBGetContactSettingTString(HCONTACT hContact, char* module, char* setting, TCHAR* out, size_t len, TCHAR *def) { DBVARIANT dbv; diff --git a/plugins/Clist_modern/src/hdr/modern_awaymsg.h b/plugins/Clist_modern/src/hdr/modern_awaymsg.h index ced79d077f..df40446f2c 100644 --- a/plugins/Clist_modern/src/hdr/modern_awaymsg.h +++ b/plugins/Clist_modern/src/hdr/modern_awaymsg.h @@ -34,4 +34,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void InitAwayMsgModule(); void UninitAwayMsgModule(); -void amRequestAwayMsg(HANDLE hContact); +void amRequestAwayMsg(HCONTACT hContact); diff --git a/plugins/Clist_modern/src/hdr/modern_cache_funcs.h b/plugins/Clist_modern/src/hdr/modern_cache_funcs.h index 8566333734..9b32eb6788 100644 --- a/plugins/Clist_modern/src/hdr/modern_cache_funcs.h +++ b/plugins/Clist_modern/src/hdr/modern_cache_funcs.h @@ -37,11 +37,11 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact); void Cache_GetSecondLineText(struct SHORTDATA *dat, ClcCacheEntry *pdnce); void Cache_GetThirdLineText(struct SHORTDATA *dat, ClcCacheEntry *pdnce); void Cache_GetAvatar(ClcData *dat, ClcContact *contact); -void Cache_GetTimezone(ClcData *dat, HANDLE hContact); +void Cache_GetTimezone(ClcData *dat, HCONTACT hContact); int Cache_GetLineText(ClcCacheEntry *pdnce, int type, LPTSTR text, int text_size, TCHAR *variable_text, BOOL xstatus_has_priority, BOOL show_status_if_no_away, BOOL show_listening_if_no_away, BOOL use_name_and_message_for_xstatus, BOOL pdnce_time_show_only_if_different); -void amRequestAwayMsg(HANDLE hContact); +void amRequestAwayMsg(HCONTACT hContact); #endif // __CACHE_FUNCS_H__ diff --git a/plugins/Clist_modern/src/hdr/modern_clc.h b/plugins/Clist_modern/src/hdr/modern_clc.h index af1838b8a5..2e8cfe1224 100644 --- a/plugins/Clist_modern/src/hdr/modern_clc.h +++ b/plugins/Clist_modern/src/hdr/modern_clc.h @@ -396,7 +396,7 @@ void ClcOptionsChanged(void); //clcidents.c int cliGetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex); -int FindItem(HWND hwnd,ClcData *dat,HANDLE hItem,ClcContact **contact,ClcGroup **subgroup,int *isVisible, BOOL isIgnoreSubcontacts ); +int FindItem(HWND hwnd, ClcData *dat, HCONTACT hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible, BOOL isIgnoreSubcontacts); int cliGetRowByIndex(ClcData *dat,int testindex,ClcContact **contact,ClcGroup **subgroup); HANDLE ContactToHItem(ClcContact *contact); HANDLE ContactToItemHandle(ClcContact *contact,DWORD *nmFlags); @@ -406,9 +406,9 @@ void ClearRowByIndexCache(); ClcGroup *cli_AddGroup(HWND hwnd,ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers); void cli_FreeGroup(ClcGroup *group); int cli_AddInfoItemToGroup(ClcGroup *group,int flags,const TCHAR *pszText); -void cliRebuildEntireList(HWND hwnd,ClcData *dat); -void cli_DeleteItemFromTree(HWND hwnd,HANDLE hItem); -void cli_AddContactToTree(HWND hwnd,ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline); +void cliRebuildEntireList(HWND hwnd, ClcData *dat); +void cli_DeleteItemFromTree(HWND hwnd, HCONTACT hItem); +void cli_AddContactToTree(HWND hwnd,ClcData *dat,HCONTACT hContact,int updateTotalCount,int checkHideOffline); void cli_SortCLC(HWND hwnd,ClcData *dat,int useInsertionSort); int GetNewSelection(ClcGroup *group,int selection, int direction); @@ -433,13 +433,13 @@ DWORD GetDefaultExStyle(void); void GetFontSetting(int i,LOGFONT *lf,COLORREF *colour,BYTE *effect, COLORREF *eColour1,COLORREF *eColour2); //clistsettings.c -TCHAR * GetContactDisplayNameW( HANDLE hContact, int mode ); +TCHAR * GetContactDisplayNameW(HCONTACT hContact, int mode ); //groups.c TCHAR* GetGroupNameTS( int idx, DWORD* pdwFlags ); int RenameGroupT(WPARAM groupID, LPARAM newName); -int GetContactCachedStatus(HANDLE hContact); -char *GetContactCachedProtocol(HANDLE hContact); +int GetContactCachedStatus(HCONTACT hContact); +char *GetContactCachedProtocol(HCONTACT hContact); #endif /* _CLC_H_ */ diff --git a/plugins/Clist_modern/src/hdr/modern_clist.h b/plugins/Clist_modern/src/hdr/modern_clist.h index ff9c776fd4..1c6c5923e8 100644 --- a/plugins/Clist_modern/src/hdr/modern_clist.h +++ b/plugins/Clist_modern/src/hdr/modern_clist.h @@ -28,9 +28,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define _CLIST_H_ void LoadContactTree(void); -HTREEITEM GetTreeItemByHContact(HANDLE hContact); -void cli_ChangeContactIcon(HANDLE hContact,int iIcon,int add); -int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status); +HTREEITEM GetTreeItemByHContact(HCONTACT hContact); +void cli_ChangeContactIcon(HCONTACT hContact,int iIcon,int add); +int GetContactInfosForSort(HCONTACT hContact,char **Proto,TCHAR **Name,int *Status); /////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index f9424cb810..636388c61a 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -241,14 +241,14 @@ int AniAva_InitModule(); // HAVE TO BE AFTER GDI+ INITIALIZED int AniAva_UnloadModule(); int AniAva_UpdateOptions(); //reload options, //hot enable/disable engine -int AniAva_AddAvatar(HANDLE hContact, TCHAR * szFilename, int width, int heigth); // adds avatars to be displayed -int AniAva_SetAvatarPos(HANDLE hContact, RECT *rc, int overlayIdx, BYTE bAlpha); // update avatars pos -int AniAva_InvalidateAvatarPositions(HANDLE hContact); // reset positions of avatars to be drawn (still be painted at same place) +int AniAva_AddAvatar(HCONTACT hContact, TCHAR * szFilename, int width, int heigth); // adds avatars to be displayed +int AniAva_SetAvatarPos(HCONTACT hContact, RECT *rc, int overlayIdx, BYTE bAlpha); // update avatars pos +int AniAva_InvalidateAvatarPositions(HCONTACT hContact); // reset positions of avatars to be drawn (still be painted at same place) int AniAva_RemoveInvalidatedAvatars(); // all avatars without validated position will be stop painted and probably removed -int AniAva_RemoveAvatar(HANDLE hContact); // remove avatar +int AniAva_RemoveAvatar(HCONTACT hContact); // remove avatar int AniAva_RedrawAllAvatars(BOOL updateZOrder); // request to repaint all void AniAva_UpdateParent(); -int AniAva_RenderAvatar( HANDLE hContact, HDC hdcMem, RECT *rc ); +int AniAva_RenderAvatar(HCONTACT hContact, HDC hdcMem, RECT *rc ); #define CCI_NAME 1 #define CCI_GROUP (1<<1) diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index 7d8eb47536..64409abab3 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -207,21 +207,21 @@ INT_PTR CALLBACK DlgSkinEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); //RowTemplate.c BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles * dat); //GenMenu.c BOOL MatchMask(char *name, char *mask); //mod_skin_selector.c -char* GetContactCachedProtocol(HANDLE hContact); //clistsettings.c +char* GetContactCachedProtocol(HCONTACT hContact); //clistsettings.c char* GetParamN(char *string, char *buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces); //mod_skin_selector.c WCHAR* GetParamN(WCHAR *string, WCHAR *buf, int buflen, BYTE paramN, WCHAR Delim, BOOL SkipSpaces); -DWORD CompareContacts2_getLMTime(HANDLE u); //contact.c +DWORD CompareContacts2_getLMTime(HCONTACT u); //contact.c DWORD mod_CalcHash(const char * a); //mod_skin_selector.c -HICON cliGetIconFromStatusMode(HANDLE hContact, const char *szProto,int status); //clistmod.c +HICON cliGetIconFromStatusMode(HCONTACT hContact, const char *szProto,int status); //clistmod.c HICON GetMainStatusOverlay(int STATUS); //clc.c -int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szStatus, ClcData *dat); //clcitems.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 ModernSkinButtonDeleteAll(); //modernbutton.c -int GetContactCachedStatus(HANDLE hContact); //clistsettings.c +int GetContactCachedStatus(HCONTACT hContact); //clistsettings.c int GetContactIconC(ClcCacheEntry *cacheEntry); //clistmod.c int GetContactIndex(ClcGroup *group,ClcContact *contact); //clcidents.c -int GetStatusForContact(HANDLE hContact,char *szProto); //clistsettings.c +int GetStatusForContact(HCONTACT hContact,char *szProto); //clistsettings.c int InitCustomMenus(void); //clistmenus.c int InitFramesMenus(void); //framesmenus.c int LoadMoveToGroup(); //movetogroup.c @@ -247,7 +247,7 @@ void Docking_GetMonitorRectFromWindow(HWND hWnd,RECT *rc); void DrawAvatarImageWithGDIp(HDC hDestDC,int x, int y, DWORD width, DWORD height, HBITMAP hbmp, int x1, int y1, DWORD width1, DWORD height1,DWORD flag,BYTE alpha); //gdiplus.cpp void FreeRowCell(); //RowHeight void InitGdiPlus(); //gdiplus.cpp -void InvalidateDNCEbyPointer(HANDLE hContact,ClcCacheEntry *pdnce,int SettingType); //clistsettings.c +void InvalidateDNCEbyPointer(HCONTACT hContact,ClcCacheEntry *pdnce,int SettingType); //clistsettings.c void ShutdownGdiPlus(); //gdiplus.cpp void UninitCustomMenus(); //clistmenus.c void UnloadAvatarOverlayIcon(); //clc.c @@ -255,7 +255,7 @@ void UnLoadContactListModule(); / void UpdateAllAvatars(ClcData *dat); //cache_func.c //cluiframes.c -void gtaRenewText(HANDLE hContact); +void gtaRenewText(HCONTACT hContact); int ExtraImage_ExtraIDToColumnNum(int extra); int LoadSkinButtonModule(); @@ -281,15 +281,15 @@ int cli_AddInfoItemToGroup(ClcGroup *group,int flags,const TCHAR *pszText); int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly); int cliFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk); int cliGetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex); -int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact); -int cli_GetContactIcon(HANDLE hContact); -int cli_RemoveEvent(HANDLE hContact, HANDLE hDbEvent); -void cli_AddContactToTree(HWND hwnd,ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline); -void cli_DeleteItemFromTree(HWND hwnd, HANDLE hItem); +int cli_IconFromStatusMode(const char *szProto,int nStatus, HCONTACT hContact); +int cli_GetContactIcon(HCONTACT hContact); +int cli_RemoveEvent(HCONTACT hContact, HANDLE hDbEvent); +void cli_AddContactToTree(HWND hwnd,ClcData *dat,HCONTACT hContact,int updateTotalCount,int checkHideOffline); +void cli_DeleteItemFromTree(HWND hwnd, HCONTACT hItem); void cli_FreeContact( ClcContact* ); void cli_FreeGroup( ClcGroup* ); char* cli_GetGroupCountsText(ClcData *dat, ClcContact *contact); -void cli_ChangeContactIcon(HANDLE hContact,int iIcon,int add); +void cli_ChangeContactIcon(HCONTACT hContact,int iIcon,int add); LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wParam,LPARAM lParam); struct CListEvent* cliCreateEvent( void ); struct CListEvent* cli_AddEvent(CLISTEVENT *cle); @@ -297,12 +297,12 @@ LRESULT CALLBACK cli_ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wPara int cliShowHide(WPARAM wParam,LPARAM lParam); BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase ); int cliCompareContacts(const ClcContact *contact1,const ClcContact *contact2); -int cliFindItem(HWND hwnd,ClcData *dat,HANDLE hItem,ClcContact **contact,ClcGroup **subgroup,int *isVisible); +int cliFindItem(HWND hwnd, ClcData *dat, HANDLE hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible); int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount); int cliTrayIconPauseAutoHide(WPARAM wParam,LPARAM lParam); void cliCluiProtocolStatusChanged(int status,const char * proto); HMENU cliBuildGroupPopupMenu(ClcGroup *group); -void cliInvalidateDisplayNameCacheEntry(HANDLE hContact); +void cliInvalidateDisplayNameCacheEntry(HCONTACT hContact); void cliCheckCacheItem(ClcCacheEntry *pdnce); void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat); void CLUI_cli_LoadCluiGlobalOpts(void); @@ -310,8 +310,8 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam,LPARAM lParam); BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase ); ClcContact* cliCreateClcContact( void ); -ClcCacheEntry* cliCreateCacheItem(HANDLE hContact); -ClcCacheEntry* cliGetCacheEntry(HANDLE hContact); +ClcCacheEntry* cliCreateCacheItem(HCONTACT hContact); +ClcCacheEntry* cliGetCacheEntry(HCONTACT hContact); #define WM_DWMCOMPOSITIONCHANGED 0x031E @@ -332,7 +332,7 @@ extern tPaintCallbackProc CLCPaint_PaintCallbackProc(HWND hWnd, HDC hDC, RECT *r /* SkinEngine.c */ -BYTE SkinDBGetContactSettingByte(HANDLE hContact, const char* szSection, const char*szKey, BYTE bDefault); +BYTE SkinDBGetContactSettingByte(HCONTACT hContact, const char* szSection, const char*szKey, BYTE bDefault); extern OVERLAYICONINFO g_pAvatarOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1]; extern OVERLAYICONINFO g_pStatusOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1]; diff --git a/plugins/Clist_modern/src/hdr/modern_gettextasync.h b/plugins/Clist_modern/src/hdr/modern_gettextasync.h index b0e08b64a2..4e8c7c6ed5 100644 --- a/plugins/Clist_modern/src/hdr/modern_gettextasync.h +++ b/plugins/Clist_modern/src/hdr/modern_gettextasync.h @@ -1,5 +1,5 @@ #pragma once void InitCacheAsync(); void UninitCacheAsync(); -void gtaRenewText(HANDLE hContact); -int gtaAddRequest(ClcData *dat,ClcContact *contact,HANDLE hContact); +void gtaRenewText(HCONTACT hContact); +int gtaAddRequest(ClcData *dat,ClcContact *contact,HCONTACT hContact); diff --git a/plugins/Clist_modern/src/hdr/modern_global_structure.h b/plugins/Clist_modern/src/hdr/modern_global_structure.h index 5ba424dde0..7be8dd2ff8 100644 --- a/plugins/Clist_modern/src/hdr/modern_global_structure.h +++ b/plugins/Clist_modern/src/hdr/modern_global_structure.h @@ -18,7 +18,7 @@ typedef struct tagCLUIDATA DWORD dwFlags; TCHAR *szNoEvents; int hIconNotify; - HANDLE hUpdateContact; + HCONTACT hUpdateContact; /* Contact List View Mode */ TCHAR groupFilter[2048]; diff --git a/plugins/Clist_modern/src/hdr/modern_skinned_profile.h b/plugins/Clist_modern/src/hdr/modern_skinned_profile.h index 78fdb1578d..0eebf53cba 100644 --- a/plugins/Clist_modern/src/hdr/modern_skinned_profile.h +++ b/plugins/Clist_modern/src/hdr/modern_skinned_profile.h @@ -233,10 +233,10 @@ public: HRESULT Init(); HRESULT Clear(); - static BYTE SpiGetSkinByte ( HANDLE hContact, const char * szSection, const char * szKey, const BYTE defValue ); - static WORD SpiGetSkinWord ( HANDLE hContact, const char * szSection, const char * szKey, const WORD defValue ); - static DWORD SpiGetSkinDword( HANDLE hContact, const char * szSection, const char * szKey, const DWORD defValue ); - static BOOL SpiCheckSkinned( HANDLE hContact, const char * szSection, const char * szKey ); + static BYTE SpiGetSkinByte (HCONTACT hContact, const char * szSection, const char * szKey, const BYTE defValue ); + static WORD SpiGetSkinWord (HCONTACT hContact, const char * szSection, const char * szKey, const WORD defValue ); + static DWORD SpiGetSkinDword(HCONTACT hContact, const char * szSection, const char * szKey, const DWORD defValue ); + static BOOL SpiCheckSkinned(HCONTACT hContact, const char * szSection, const char * szKey ); }; diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index 08415dda17..1a27ac5079 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -60,7 +60,7 @@ enum { struct ANIAVA_OBJECT { - HANDLE hContact; + HCONTACT hContact; HWND hWindow; BOOL bInvalidPos; BOOL bToBeDeleted; @@ -284,7 +284,7 @@ int AniAva_UpdateOptions() } // adds avatars to be displayed -int AniAva_AddAvatar(HANDLE hContact, TCHAR * szFilename, int width, int heigth) +int AniAva_AddAvatar(HCONTACT hContact, TCHAR * szFilename, int width, int heigth) { aacheck 0; if (!GDIPlus_IsAnimatedGif (szFilename)) @@ -344,7 +344,7 @@ void AniAva_UpdateParent() } } -ANIAVA_OBJECT * FindAvatarByContact( HANDLE hContact ) +ANIAVA_OBJECT * FindAvatarByContact(HCONTACT hContact ) { for ( int i=0; i < s_Objects.getCount(); i++) { ANIAVA_OBJECT *pai = ((ANIAVA_OBJECT *)s_Objects[i]); @@ -354,7 +354,7 @@ ANIAVA_OBJECT * FindAvatarByContact( HANDLE hContact ) return NULL; } -int AniAva_RenderAvatar( HANDLE hContact, HDC hdcMem, RECT *rc ) +int AniAva_RenderAvatar(HCONTACT hContact, HDC hdcMem, RECT *rc ) { aacheck 0; mir_cslock lck(s_CS); @@ -365,7 +365,7 @@ int AniAva_RenderAvatar( HANDLE hContact, HDC hdcMem, RECT *rc ) } // update avatars pos -int AniAva_SetAvatarPos(HANDLE hContact, RECT *rc, int overlayIdx, BYTE bAlpha) +int AniAva_SetAvatarPos(HCONTACT hContact, RECT *rc, int overlayIdx, BYTE bAlpha) { aacheck 0; mir_cslock lck(s_CS); @@ -404,7 +404,7 @@ int AniAva_SetAvatarPos(HANDLE hContact, RECT *rc, int overlayIdx, BYTE bAlpha) return 1; } // remove avatar -int AniAva_RemoveAvatar(HANDLE hContact) +int AniAva_RemoveAvatar(HCONTACT hContact) { aacheck 0; mir_cslock lck(s_CS); @@ -419,7 +419,7 @@ int AniAva_RemoveAvatar(HANDLE hContact) return 1; } // reset positions of avatars to be drawn (still be painted at same place) -int AniAva_InvalidateAvatarPositions(HANDLE hContact) +int AniAva_InvalidateAvatarPositions(HCONTACT hContact) { aacheck 0; mir_cslock lck(s_CS); diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp index 7953807781..b9b66caab0 100644 --- a/plugins/Clist_modern/src/modern_awaymsg.cpp +++ b/plugins/Clist_modern/src/modern_awaymsg.cpp @@ -42,13 +42,10 @@ static LIST amItems(10, PtrKeySortT); static HANDLE hamProcessEvent = NULL; static DWORD amRequestTick = 0; -static int amAddHandleToChain(HANDLE hContact); -static HANDLE amGetCurrentChain(); - /* * Add contact handle to requests queue */ -static int amAddHandleToChain(HANDLE hContact) +static int amAddHandleToChain(HCONTACT hContact) { mir_cslockfull lck(amCS); if (amItems.find(hContact) != NULL) @@ -63,13 +60,13 @@ static int amAddHandleToChain(HANDLE hContact) /* * Gets handle from queue for request */ -static HANDLE amGetCurrentChain() +static HCONTACT amGetCurrentChain() { mir_cslock lck(amCS); if (amItems.getCount() == 0) return NULL; - HANDLE res = amItems[0]; + HCONTACT res = (HCONTACT)amItems[0]; amItems.remove(0); return res; } @@ -85,7 +82,7 @@ static void amThreadProc(void *) memset(&dnce, 0, sizeof(dnce)); while (!MirandaExiting()) { - HANDLE hContact = amGetCurrentChain(); + HCONTACT hContact = amGetCurrentChain(); while (hContact) { DWORD time = GetTickCount(); if ((time-amRequestTick) < AMASKPERIOD) { @@ -94,7 +91,7 @@ static void amThreadProc(void *) return; } CListSettings_FreeCacheItemData(&dnce); - dnce.hContact = (HANDLE)hContact; + dnce.hContact = hContact; Sync(CLUI_SyncGetPDNCE, (WPARAM) 0, (LPARAM)&dnce); HANDLE ACK = 0; @@ -146,7 +143,7 @@ BOOL amWakeThread() /* * Sub to be called outside on status changing to retrieve away message */ -void amRequestAwayMsg(HANDLE hContact) +void amRequestAwayMsg(HCONTACT hContact) { if (!g_CluiData.bInternalAwayMsgDiscovery || !hContact) return; diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index f41b7c1db9..0066366f4c 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -54,7 +54,7 @@ void CListSettings_FreeCacheItemDataOption( ClcCacheEntry *pDst, DWORD flag ); /* * Get time zone for contact */ -void Cache_GetTimezone(ClcData *dat, HANDLE hContact) +void Cache_GetTimezone(ClcData *dat, HCONTACT hContact) { ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); if (dat == NULL && pcli->hwndContactTree) @@ -205,7 +205,7 @@ void CSmileyString::ReplaceSmileys(struct SHORTDATA *dat, ClcCacheEntry *pdnce, sp.Protocolname = pdnce->m_cache_cszProto; if ( db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_cache_cszProto != NULL && g_szMetaModuleName && strcmp(pdnce->m_cache_cszProto, g_szMetaModuleName) == 0) { - HANDLE hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (LPARAM)pdnce->hContact, 0); + HCONTACT hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (LPARAM)pdnce->hContact, 0); if (hContact != 0) sp.Protocolname = GetContactProto(hContact); } diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 7a364dd2bb..8aaad5eddf 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -258,7 +258,7 @@ static int clcHookSettingChanged(WPARAM wParam,LPARAM lParam) else if (!strcmp(cws->szSetting,"ListeningTo")) pcli->pfnClcBroadcast( INTM_STATUSMSGCHANGED,wParam,0); else if (!strcmp(cws->szSetting,"Transport") || !strcmp(cws->szSetting,"IsTransported")) { - pcli->pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam); + pcli->pfnInvalidateDisplayNameCacheEntry((HCONTACT)wParam); pcli->pfnClcBroadcast( CLM_AUTOREBUILD,wParam,0); } } @@ -273,8 +273,8 @@ static int clcHookDbEventAdded(WPARAM wParam,LPARAM lParam) DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get((HANDLE)lParam, &dbei); if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry((HANDLE)wParam); - db_set_dw((HANDLE)wParam, "CList", "mf_lastmsg", dbei.timestamp); + ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry((HCONTACT)wParam); + db_set_dw((HCONTACT)wParam, "CList", "mf_lastmsg", dbei.timestamp); if (pdnce) pdnce->dwLastMsgTime = dbei.timestamp; } @@ -1472,17 +1472,17 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM w BYTE flags = 0; ClcContact *contact; - if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) memset(iExtraImage, 0xFF, sizeof(iExtraImage)); else { memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); flags = contact->flags; } - pcli->pfnDeleteItemFromTree(hwnd, (HANDLE) wParam); - if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b((HANDLE) wParam, "CList", "Hidden", 0)) { + pcli->pfnDeleteItemFromTree(hwnd, (HCONTACT)wParam); + if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b((HCONTACT)wParam, "CList", "Hidden", 0)) { NMCLISTCONTROL nm; - pcli->pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, 1, 1); - if (pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL)) { + pcli->pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, 1, 1); + if (pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); if (flags & CONTACTF_CHECKED) contact->flags |= CONTACTF_CHECKED; @@ -1507,41 +1507,41 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP BOOL needRepaint = FALSE; WORD status; RECT iconRect = {0}; - int contacticon = corecli.pfnGetContactIcon((HANDLE)wParam); - HANDLE hSelItem = NULL; + int contacticon = corecli.pfnGetContactIcon((HCONTACT)wParam); + HCONTACT hSelItem = NULL; ClcContact *selcontact = NULL; - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto == NULL) status = ID_STATUS_OFFLINE; else - status = GetContactCachedStatus((HANDLE) wParam); + status = GetContactCachedStatus((HCONTACT)wParam); BOOL image_is_special = (LOWORD(contacticon) != (LOWORD(lParam))); //check only base icons - int nHiddenStatus = CLVM_GetContactHiddenStatus((HANDLE)wParam, szProto, dat); + int nHiddenStatus = CLVM_GetContactHiddenStatus((HCONTACT)wParam, szProto, dat); DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); - bool isVisiblebyFilter = (( ( style & CLS_SHOWHIDDEN ) && nHiddenStatus != -1 ) || !nHiddenStatus ); - bool ifVisibleByClui = !pcli->pfnIsHiddenMode( dat, status ); - bool isVisible = g_CluiData.bFilterEffective&CLVM_FILTER_STATUS ? TRUE : ifVisibleByClui; - bool isIconChanged = cli_GetContactIcon((HANDLE)wParam) != LOWORD(lParam); + bool isVisiblebyFilter = (( ( style & CLS_SHOWHIDDEN ) && nHiddenStatus != -1 ) || !nHiddenStatus ); + bool ifVisibleByClui = !pcli->pfnIsHiddenMode( dat, status ); + bool isVisible = g_CluiData.bFilterEffective&CLVM_FILTER_STATUS ? TRUE : ifVisibleByClui; + bool isIconChanged = cli_GetContactIcon((HCONTACT)wParam) != LOWORD(lParam); - shouldShow = isVisiblebyFilter && ( isVisible || isIconChanged ) ; + shouldShow = isVisiblebyFilter && ( isVisible || isIconChanged ) ; // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown - if (!pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, &group, NULL)) { + if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)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 = pcli->pfnContactToHItem(selcontact); - pcli->pfnAddContactToTree(hwnd, dat, (HANDLE) wParam, (style & CLS_CONTACTLIST) == 0, 0); + hSelItem = (HCONTACT)pcli->pfnContactToHItem(selcontact); + pcli->pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, (style & CLS_CONTACTLIST) == 0, 0); recalcScrollBar = 1; needRepaint = TRUE; - pcli->pfnFindItem(hwnd, dat, (HANDLE) wParam, &contact, NULL, NULL); + pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL); if (contact) { contact->iImage = lParam; contact->image_is_special = image_is_special; - pcli->pfnNotifyNewContact(hwnd, (HANDLE) wParam); + pcli->pfnNotifyNewContact(hwnd, (HCONTACT)wParam); dat->needsResort = 1; } } @@ -1555,7 +1555,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && ((style & CLS_HIDEOFFLINE) || group->hideOffline || g_CluiData.bFilterEffective)) { // CLVM changed if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) - hSelItem = pcli->pfnContactToHItem(selcontact); + hSelItem = (HCONTACT)pcli->pfnContactToHItem(selcontact); pcli->pfnRemoveItemFromGroup(hwnd, group, contact, (style & CLS_CONTACTLIST) == 0); needRepaint = TRUE; recalcScrollBar = 1; @@ -1603,7 +1603,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP static LRESULT clcOnIntmAvatarChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { ClcContact *contact; - if ( FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL,FALSE)) + if (FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL, FALSE)) Cache_GetAvatar(dat, contact); else if (dat->use_avatar_service && !wParam) UpdateAllAvatars(dat); @@ -1615,7 +1615,7 @@ static LRESULT clcOnIntmAvatarChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM static LRESULT clcOnIntmTimeZoneChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { ClcContact *contact; - if (!FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL,FALSE)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL, FALSE)) return corecli.pfnContactListControlWndProc(hwnd,msg,wParam,lParam); if (contact) { @@ -1630,13 +1630,13 @@ static LRESULT clcOnIntmNameChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP { int ret = corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); - pcli->pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam); + pcli->pfnInvalidateDisplayNameCacheEntry((HCONTACT)wParam); ClcContact *contact; - if (!FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL,FALSE)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL, FALSE)) return ret; - lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam,0),SIZEOF(contact->szText)); + lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HCONTACT)wParam, 0), SIZEOF(contact->szText)); if (contact) { Cache_GetText(dat,contact,1); cliRecalcScrollBar(hwnd,dat); @@ -1655,7 +1655,7 @@ static LRESULT clcOnIntmApparentModeChanged(ClcData *dat, HWND hwnd, UINT msg, W static LRESULT clcOnIntmStatusMsgChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { ClcContact *contact; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL || IsHContactInfo(hContact) || IsHContactGroup(hContact)) return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); if (!FindItem(hwnd,dat,hContact,&contact,NULL,NULL,FALSE)) @@ -1674,7 +1674,7 @@ static LRESULT clcOnIntmNotOnListChanged(ClcData *dat, HWND hwnd, UINT msg, WPAR DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING*)lParam; ClcContact *contact; - if (!FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL,TRUE)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL, TRUE)) return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); if (contact->type != CLCIT_CONTACT) @@ -1691,10 +1691,11 @@ static LRESULT clcOnIntmNotOnListChanged(ClcData *dat, HWND hwnd, UINT msg, WPAR static LRESULT clcOnIntmScrollBarChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CONTACTLIST) - { - if (dat->noVScrollbar) ShowScrollBar(hwnd, SB_VERT, FALSE); - else pcli->pfnRecalcScrollBar(hwnd, dat); + if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CONTACTLIST) { + if (dat->noVScrollbar) + ShowScrollBar(hwnd, SB_VERT, FALSE); + else + pcli->pfnRecalcScrollBar(hwnd, dat); } return 0; } @@ -1703,20 +1704,20 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM { int ret = corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); if (wParam != 0) { - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry((HANDLE)wParam); + ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry((HCONTACT)wParam); if (pdnce && pdnce->m_cache_cszProto) { pdnce___SetStatus( pdnce, GetStatusForContact(pdnce->hContact,pdnce->m_cache_cszProto)); if (!dat->force_in_dialog && (dat->second_line_show || dat->third_line_show)) gtaRenewText(pdnce->hContact); - SendMessage(hwnd,INTM_ICONCHANGED, wParam, corecli.pfnGetContactIcon((HANDLE)wParam)); + SendMessage(hwnd, INTM_ICONCHANGED, wParam, corecli.pfnGetContactIcon((HCONTACT)wParam)); ClcContact *contact; - if ( FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL,TRUE)) { + if (FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL, TRUE)) { if (contact && contact->type == CLCIT_CONTACT) { if (!contact->image_is_special && pdnce___GetStatus( pdnce ) > ID_STATUS_OFFLINE) - contact->iImage = corecli.pfnGetContactIcon((HANDLE)wParam); + contact->iImage = corecli.pfnGetContactIcon((HCONTACT)wParam); if (contact->isSubcontact && contact->subcontacts && contact->subcontacts->type == CLCIT_CONTACT) - pcli->pfnClcBroadcast( INTM_STATUSCHANGED,(WPARAM)contact->subcontacts->hContact,0); //forward status changing to host meta contact + pcli->pfnClcBroadcast(INTM_STATUSCHANGED, (WPARAM)contact->subcontacts->hContact, 0); //forward status changing to host meta contact } } } diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index 165a0ab00b..2bd079760f 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -104,12 +104,12 @@ int cliGetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex) return -1; } -int cliFindItem(HWND hwnd,ClcData *dat,HANDLE hItem,ClcContact **contact,ClcGroup **subgroup,int *isVisible) +int cliFindItem(HWND hwnd, ClcData *dat, HANDLE hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible) { - return FindItem(hwnd,dat, hItem,contact,subgroup,isVisible,FALSE); + return FindItem(hwnd, dat, (HCONTACT)hItem, contact, subgroup, isVisible, FALSE); } -int FindItem(HWND hwnd,ClcData *dat,HANDLE hItem,ClcContact **contact,ClcGroup **subgroup,int *isVisible, BOOL isIgnoreSubcontacts) +int FindItem(HWND hwnd, ClcData *dat, HCONTACT hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible, BOOL isIgnoreSubcontacts) { int index = 0, i; int nowVisible = 1; diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index bb65dcd753..b01e397d01 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -46,7 +46,7 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) cont->SubAllocated = subcount; int i=0; for (int j = 0; j < subcount; j++) { - HANDLE hsub = (HANDLE)CallService(MS_MC_GETSUBCONTACT,(WPARAM)cont->hContact,j); + HCONTACT hsub = (HCONTACT)CallService(MS_MC_GETSUBCONTACT, (WPARAM)cont->hContact, j); cacheEntry = pcli->pfnGetCacheEntry(hsub); WORD wStatus = pdnce___GetStatus(cacheEntry); if (showOfflineHereGroup || (!( db_get_b(NULL,"CLC","MetaHideOfflineSub",SETTING_METAHIDEOFFLINESUB_DEFAULT) && db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)) @@ -145,7 +145,7 @@ int cli_AddInfoItemToGroup(ClcGroup *group,int flags,const TCHAR *pszText) return i; } -static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, HANDLE hContact) +static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, HCONTACT hContact) { ClcCacheEntry *cacheEntry = NULL; WORD apparentMode; @@ -211,7 +211,7 @@ static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, static ClcContact *AddContactToGroup(ClcData *dat,ClcGroup *group, ClcCacheEntry *cacheEntry) { - HANDLE hContact; + HCONTACT hContact; int i; if (cacheEntry == NULL) return NULL; if (group == NULL) return NULL; @@ -259,7 +259,7 @@ void * AddTempGroup(HWND hwnd,ClcData *dat,const TCHAR *szName,DWORD flags,int g return NULL; } -void cli_AddContactToTree(HWND hwnd,ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline) +void cli_AddContactToTree(HWND hwnd,ClcData *dat,HCONTACT hContact,int updateTotalCount,int checkHideOffline) { ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hContact); if (dat->IsMetaContactsEnabled && cacheEntry && cacheEntry->m_cache_nHiddenSubcontact) @@ -277,7 +277,7 @@ void cli_AddContactToTree(HWND hwnd,ClcData *dat,HANDLE hContact,int updateTotal return; } -void cli_DeleteItemFromTree(HWND hwnd,HANDLE hItem) +void cli_DeleteItemFromTree(HWND hwnd, HCONTACT hItem) { ClcData *dat = (ClcData *) GetWindowLongPtr(hwnd, 0); ClearRowByIndexCache(); @@ -300,17 +300,16 @@ __inline BOOL CLCItems_IsShowOfflineGroup(ClcGroup* group) return (groupFlags&GROUPF_SHOWOFFLINE) != 0; } -HANDLE SaveSelection( ClcData *dat ) +HCONTACT SaveSelection(ClcData *dat) { ClcContact *selcontact = NULL; - - if ( pcli->pfnGetRowByIndex( dat, dat->selection, &selcontact, NULL ) == -1 ) + if (pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) == -1) return NULL; - else - return pcli->pfnContactToHItem( selcontact ); + + return (HCONTACT)pcli->pfnContactToHItem(selcontact); } -int RestoreSelection( ClcData *dat, HANDLE hSelected ) +int RestoreSelection(ClcData *dat, HCONTACT hSelected) { ClcContact *selcontact = NULL; ClcGroup *selgroup = NULL; @@ -336,7 +335,7 @@ int RestoreSelection( ClcData *dat, HANDLE hSelected ) } -void cliRebuildEntireList(HWND hwnd,ClcData *dat) +void cliRebuildEntireList(HWND hwnd, ClcData *dat) { DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE); ClcContact *cont; @@ -358,7 +357,7 @@ void cliRebuildEntireList(HWND hwnd,ClcData *dat) dat->list.cl.increment = 50; dat->needsResort = 1; - HANDLE hSelected = SaveSelection( dat ); + HCONTACT hSelected = SaveSelection(dat); dat->selection = -1; dat->HiLightMode = db_get_b(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT); { @@ -371,7 +370,7 @@ void cliRebuildEntireList(HWND hwnd,ClcData *dat) } } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ClcCacheEntry *cacheEntry = NULL; cont = NULL; cacheEntry = pcli->pfnGetCacheEntry(hContact); @@ -430,14 +429,14 @@ void cliRebuildEntireList(HWND hwnd,ClcData *dat) } } - pcli->pfnSortCLC(hwnd,dat,0); + pcli->pfnSortCLC(hwnd, dat, 0); - RestoreSelection( dat, hSelected ); + RestoreSelection(dat, hSelected); } -void cli_SortCLC( HWND hwnd, ClcData *dat, int useInsertionSort ) +void cli_SortCLC(HWND hwnd, ClcData *dat, int useInsertionSort) { - HANDLE hSelected = SaveSelection( dat ); + HCONTACT hSelected = SaveSelection(dat); corecli.pfnSortCLC(hwnd,dat,useInsertionSort); @@ -475,7 +474,7 @@ int GetNewSelection(ClcGroup *group, int selection, int direction) } struct SavedContactState_t { - HANDLE hContact; + HCONTACT hContact; WORD iExtraImage[EXTRA_ICON_COUNT]; int checked; }; @@ -584,7 +583,7 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) if (savedInfo[i].parentId == -1) group = &dat->list; else { - if (!pcli->pfnFindItem(hwnd, dat, (HANDLE) (savedInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)(savedInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL)) continue; group = contact->group; } @@ -624,7 +623,7 @@ ClcContact* cliCreateClcContact() return contact; } -ClcCacheEntry* cliCreateCacheItem( HANDLE hContact ) +ClcCacheEntry* cliCreateCacheItem(HCONTACT hContact ) { ClcCacheEntry *p = (ClcCacheEntry *)mir_calloc(sizeof( ClcCacheEntry )); if (p == NULL) @@ -639,10 +638,10 @@ ClcCacheEntry* cliCreateCacheItem( HANDLE hContact ) return p; } -void cliInvalidateDisplayNameCacheEntry(HANDLE hContact) +void cliInvalidateDisplayNameCacheEntry(HCONTACT hContact) { if (hContact == INVALID_HANDLE_VALUE) - corecli.pfnInvalidateDisplayNameCacheEntry(INVALID_HANDLE_VALUE); + corecli.pfnInvalidateDisplayNameCacheEntry((HCONTACT)INVALID_HANDLE_VALUE); else { ClcCacheEntry *p = pcli->pfnGetCacheEntry(hContact); if (p) @@ -690,7 +689,7 @@ int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly) * also cares about sub contacts (if meta is active) */ -int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, ClcData *dat) +int __fastcall CLVM_GetContactHiddenStatus(HCONTACT hContact, char *szProto, ClcData *dat) { int dbHidden = db_get_b(hContact, "CList", "Hidden", 0); // default hidden state, always respect it. int filterResult = 1; diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index 26e2e403ba..047b671172 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -35,7 +35,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara switch(msg) { case CLM_DELETEITEM: - pcli->pfnDeleteItemFromTree(hwnd, (HANDLE) wParam); + pcli->pfnDeleteItemFromTree(hwnd, (HCONTACT)wParam); clcSetDelayTimer( TIMERID_DELAYEDRESORTCLC, hwnd, 1 ); //pcli->pfnSortCLC(hwnd, dat, 1); clcSetDelayTimer( TIMERID_RECALCSCROLLBAR, hwnd, 2 ); //pcli->pfnRecalcScrollBar(hwnd, dat); return 0; @@ -108,24 +108,24 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara { int i; if (wParam != CLGN_ROOT) { - if (!pcli->pfnFindItem(hwnd, dat, (HANDLE) lParam, &contact, &group, NULL)) - return (LRESULT) (HANDLE) NULL; + if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)lParam, &contact, &group, NULL)) + return NULL; i = List_IndexOf((SortedList*)&group->cl,contact); if (i < 0) return 0; } switch (wParam) { case CLGN_ROOT: if (dat->list.cl.count) - return (LRESULT) pcli->pfnContactToHItem(dat->list.cl.items[0]); + return (LRESULT)pcli->pfnContactToHItem(dat->list.cl.items[0]); else - return (LRESULT) (HANDLE) NULL; + return NULL; case CLGN_CHILD: if (contact->type != CLCIT_GROUP) - return (LRESULT) (HANDLE) NULL; + return NULL; group = contact->group; if (group->cl.count == 0) - return (LRESULT) (HANDLE) NULL; - return (LRESULT) pcli->pfnContactToHItem(group->cl.items[0]); + return NULL; + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[0]); case CLGN_PARENT: return group->groupId | HCONTACT_ISGROUP; case CLGN_NEXT: @@ -133,49 +133,49 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara if (++i >= group->cl.count) return NULL; } - while (group->cl.items[i]->type == CLCIT_DIVIDER); - return (LRESULT) pcli->pfnContactToHItem(group->cl.items[i]); + while (group->cl.items[i]->type == CLCIT_DIVIDER); + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); case CLGN_PREVIOUS: do { if (--i < 0) return NULL; } - while (group->cl.items[i]->type == CLCIT_DIVIDER); - return (LRESULT) pcli->pfnContactToHItem(group->cl.items[i]); + while (group->cl.items[i]->type == CLCIT_DIVIDER); + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); case CLGN_NEXTCONTACT: for (i++; i < group->cl.count; i++) if (group->cl.items[i]->type == CLCIT_CONTACT) break; if (i >= group->cl.count) - return (LRESULT) (HANDLE) NULL; + return NULL; return (LRESULT) pcli->pfnContactToHItem(group->cl.items[i]); case CLGN_PREVIOUSCONTACT: if (i >= group->cl.count) - return (LRESULT) (HANDLE) NULL; + return NULL; for (i--; i >= 0; i--) if (group->cl.items[i]->type == CLCIT_CONTACT) break; if (i < 0) - return (LRESULT) (HANDLE) NULL; - return (LRESULT) pcli->pfnContactToHItem(group->cl.items[i]); + return NULL; + return (LRESULT)pcli->pfnContactToHItem(group->cl.items[i]); case CLGN_NEXTGROUP: for (i++; i < group->cl.count; i++) if (group->cl.items[i]->type == CLCIT_GROUP) break; if (i >= group->cl.count) - return (LRESULT) (HANDLE) NULL; + return NULL; return (LRESULT) pcli->pfnContactToHItem(group->cl.items[i]); case CLGN_PREVIOUSGROUP: if (i >= group->cl.count) - return (LRESULT) (HANDLE) NULL; + return NULL; for (i--; i >= 0; i--) if (group->cl.items[i]->type == CLCIT_GROUP) break; if (i < 0) - return (LRESULT) (HANDLE) NULL; + return NULL; return (LRESULT) pcli->pfnContactToHItem(group->cl.items[i]); } - return (LRESULT) (HANDLE) NULL; + return NULL; } return 0; case CLM_SELECTITEM: @@ -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, (HANDLE) wParam, &contact, &group, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)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, (HANDLE) wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) return 0; contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam); diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index 327d6e4d3f..bf19a6c5c2 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -75,7 +75,7 @@ static int iconsOn; struct NotifyMenuItemExData { - HANDLE hContact; + HCONTACT hContact; int iIcon; // icon index in the image list HICON hIcon; // corresponding icon handle HANDLE hDbEvent; @@ -176,7 +176,7 @@ struct CListEvent* cli_AddEvent(CLISTEVENT *cle) } -int cli_RemoveEvent(HANDLE hContact, HANDLE hDbEvent) +int cli_RemoveEvent(HCONTACT hContact, HANDLE hDbEvent) { int i; int res = 0; diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index b4c41cd20c..78d7b35238 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -94,7 +94,7 @@ static IconItem iconList[] = static int FAV_OnContactMenuBuild(WPARAM wParam,LPARAM lParam) { - BYTE bContactRate = db_get_b((HANDLE)wParam, "CList", "Rate",0); + BYTE bContactRate = db_get_b((HCONTACT)wParam, "CList", "Rate", 0); if ( bContactRate > SIZEOF(rates)-1) bContactRate = SIZEOF(rates)-1; @@ -149,7 +149,7 @@ static int FAV_OnContactMenuBuild(WPARAM wParam,LPARAM lParam) mi.hIcon = NULL; mi.ptszName = LPGENT("Show even if offline"); - mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR | ( db_get_b((HANDLE)wParam,"CList","noOffline",0)?CMIF_CHECKED:0); + mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR | (db_get_b((HCONTACT)wParam, "CList", "noOffline", 0) ? CMIF_CHECKED : 0); mi.pszService = CLUI_FAVTOGGLESHOWOFFLINE; mi.popupPosition = i+100000000; mi.position = -100000000; @@ -165,7 +165,7 @@ static int FAV_OnContactMenuBuild(WPARAM wParam,LPARAM lParam) INT_PTR FAV_SetRate(WPARAM hContact, LPARAM nRate) { if (hContact) - db_set_b((HANDLE)hContact, "CList", "Rate",(BYTE)nRate); + db_set_b((HCONTACT)hContact, "CList", "Rate", (BYTE)nRate); return 0; } @@ -173,7 +173,7 @@ INT_PTR FAV_SetRate(WPARAM hContact, LPARAM nRate) INT_PTR FAV_ToggleShowOffline(WPARAM hContact,LPARAM lParam) { if (hContact) - db_set_b((HANDLE)hContact,"CList","noOffline", !db_get_b((HANDLE)hContact, "CList", "noOffline", 0)); + db_set_b((HCONTACT)hContact, "CList", "noOffline", !db_get_b((HCONTACT)hContact, "CList", "noOffline", 0)); return 0; } diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index 610e801097..c8b4523352 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -42,7 +42,7 @@ int GetContactDisplayName(WPARAM wParam,LPARAM lParam); int CListOptInit(WPARAM wParam,LPARAM lParam); int SkinOptInit(WPARAM wParam,LPARAM lParam); int ModernSkinOptInit(WPARAM wParam,LPARAM lParam); -int EventsProcessContactDoubleClick(HANDLE hContact); +int EventsProcessContactDoubleClick(HCONTACT hContact); INT_PTR TrayIconPauseAutoHide(WPARAM wParam,LPARAM lParam); @@ -52,7 +52,7 @@ void UninitTrayMenu(); HIMAGELIST hCListImages = NULL; //returns normal icon or combined with status overlay. Needs to be destroyed. -HICON cliGetIconFromStatusMode(HANDLE hContact, const char *szProto,int status) +HICON cliGetIconFromStatusMode(HCONTACT hContact, const char *szProto,int status) { // check if options is turned on BYTE trayOption = db_get_b(NULL,"CLUI","XStatusTray",SETTING_TRAYOPTION_DEFAULT); @@ -81,7 +81,7 @@ HICON cliGetIconFromStatusMode(HANDLE hContact, const char *szProto,int status) return ske_ImageList_GetIcon(g_himlCListClc,pcli->pfnIconFromStatusMode(szProto,status,hContact),ILD_NORMAL); } -int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact) +int cli_IconFromStatusMode(const char *szProto,int nStatus, HCONTACT hContact) { if (hContact && szProto) { char *szActProto = (char*)szProto; @@ -89,7 +89,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact) HANDLE 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 - HANDLE hMostOnlineContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hActContact,0); + HCONTACT hMostOnlineContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hActContact, 0); if (hMostOnlineContact) { ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hMostOnlineContact); if (cacheEntry && cacheEntry->m_cache_cszProto) { @@ -118,7 +118,7 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact) return corecli.pfnIconFromStatusMode(szProto,nStatus,NULL); } -int cli_GetContactIcon(HANDLE hContact) +int cli_GetContactIcon(HCONTACT hContact) { int res = corecli.pfnGetContactIcon(hContact); if (res != -1) diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index a45d83705a..83c4edb7bd 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "hdr/modern_commonprototypes.h" #include "hdr/modern_awaymsg.h" -void InsertContactIntoTree(HANDLE hContact,int status); +void InsertContactIntoTree(HCONTACT hContact,int status); static ClcCacheEntry *displayNameCache; void CListSettings_FreeCacheItemDataOption( ClcCacheEntry *pDst, DWORD flag ); @@ -36,11 +36,11 @@ static int displayNameCacheSize; BOOL CLM_AUTOREBUILD_WAS_POSTED = FALSE; SortedList *clistCache = NULL; -char *GetProtoForContact(HANDLE hContact); -int GetStatusForContact(HANDLE hContact,char *szProto); +char *GetProtoForContact(HCONTACT hContact); +int GetStatusForContact(HCONTACT hContact,char *szProto); TCHAR *UnknownConctactTranslatedName = NULL; -void InvalidateDNCEbyPointer(HANDLE hContact,ClcCacheEntry *pdnce,int SettingType); +void InvalidateDNCEbyPointer(HCONTACT hContact,ClcCacheEntry *pdnce,int SettingType); static int handleCompare( void* c1, void* c2 ) { @@ -86,7 +86,7 @@ void FreeDisplayNameCache() } } -ClcCacheEntry* cliGetCacheEntry(HANDLE hContact) +ClcCacheEntry* cliGetCacheEntry(HCONTACT hContact) { if (!clistCache) return NULL; @@ -205,7 +205,7 @@ int CListSettings_SetToCache(ClcCacheEntry *pSrc, DWORD flag) void cliFreeCacheItem( ClcCacheEntry *p ) { - HANDLE hContact = p->hContact; + HCONTACT hContact = p->hContact; TRACEVAR("cliFreeCacheItem hContact = %d",hContact); p->freeName(); mir_free_and_nil(p->tszGroup); @@ -299,7 +299,7 @@ void IvalidateDisplayNameCache(DWORD mode) } } -void InvalidateDNCEbyPointer(HANDLE hContact, ClcCacheEntry *pdnce, int SettingType) +void InvalidateDNCEbyPointer(HCONTACT hContact, ClcCacheEntry *pdnce, int SettingType) { if (hContact == NULL || pdnce == NULL) return; @@ -344,7 +344,7 @@ void InvalidateDNCEbyPointer(HANDLE hContact, ClcCacheEntry *pdnce, int SettingT pdnce->IsExpanded = -1; } -char *GetContactCachedProtocol(HANDLE hContact) +char *GetContactCachedProtocol(HCONTACT hContact) { ClcCacheEntry *cacheEntry = NULL; cacheEntry = pcli->pfnGetCacheEntry(hContact); @@ -354,14 +354,14 @@ char *GetContactCachedProtocol(HANDLE hContact) return NULL; } -char* GetProtoForContact(HANDLE hContact) +char* GetProtoForContact(HCONTACT hContact) { return (char*)CallService(MS_PROTO_GETCONTACTBASEACCOUNT,(WPARAM)hContact,0); } -int GetStatusForContact(HANDLE hContact,char *szProto) +int GetStatusForContact(HCONTACT hContact,char *szProto) { - return (szProto) ? (int)(db_get_w((HANDLE)hContact,szProto,"Status",ID_STATUS_OFFLINE)) : ID_STATUS_OFFLINE; + return (szProto) ? (int)(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)) : ID_STATUS_OFFLINE; } void ClcCacheEntry::freeName() @@ -393,7 +393,7 @@ LBL_Unknown: isUnknown = false; } -int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status) +int GetContactInfosForSort(HCONTACT hContact,char **Proto,TCHAR **Name,int *Status) { ClcCacheEntry *cacheEntry = NULL; cacheEntry = pcli->pfnGetCacheEntry(hContact); @@ -407,7 +407,7 @@ int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status }; -int GetContactCachedStatus(HANDLE hContact) +int GetContactCachedStatus(HCONTACT hContact) { ClcCacheEntry *cacheEntry = NULL; cacheEntry = pcli->pfnGetCacheEntry(hContact); @@ -417,7 +417,7 @@ int GetContactCachedStatus(HANDLE hContact) int ContactAdded(WPARAM wParam,LPARAM lParam) { if (!MirandaExiting()) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; cli_ChangeContactIcon(hContact,pcli->pfnIconFromStatusMode((char*)GetContactCachedProtocol(hContact),ID_STATUS_OFFLINE,hContact),1); ///by FYR pcli->pfnSortContacts(); } @@ -426,7 +426,7 @@ int ContactAdded(WPARAM wParam,LPARAM lParam) int ContactSettingChanged(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (MirandaExiting() || !pcli || !clistCache || hContact == NULL) return 0; @@ -494,7 +494,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) else if (!strcmp(cws->szSetting,"Hidden")) { InvalidateDNCEbyPointer(hContact,pdnce,cws->value.type); if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) { - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); cli_ChangeContactIcon(hContact,pcli->pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE), hContact),1); //by FYR } diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 586db4e522..2ed245edd2 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -188,7 +188,7 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM wParam, LPARAM lParam) if ( lstrcmp( _T(CLISTCONTROL_CLASS), cls)) hwndClist = pcli->hwndContactList; - HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0); + HCONTACT hItem = (HCONTACT)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0); Menu_ShowItem(hRenameMenuItem, hItem != 0); if (!hItem || !IsHContactContact(hItem) || !db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT)) { @@ -240,7 +240,7 @@ INT_PTR CLUI::Service_ShowStatusMenu(WPARAM wParam,LPARAM lParam) INT_PTR CLUI::Service_Menu_ShowContactAvatar(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT)wParam; db_set_b(hContact, "CList", "HideContactAvatar", 0); @@ -250,7 +250,7 @@ INT_PTR CLUI::Service_Menu_ShowContactAvatar(WPARAM wParam,LPARAM lParam) INT_PTR CLUI::Service_Menu_HideContactAvatar(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT)wParam; db_set_b(hContact, "CList", "HideContactAvatar", 1); diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp index b1e297d58b..a4390b70d6 100644 --- a/plugins/Clist_modern/src/modern_contact.cpp +++ b/plugins/Clist_modern/src/modern_contact.cpp @@ -42,15 +42,15 @@ struct {ID_STATUS_ONTHEPHONE,150}, {ID_STATUS_OUTTOLUNCH,425}}; -static int GetContactStatus(HANDLE hContact) +static int GetContactStatus(HCONTACT hContact) { return (GetContactCachedStatus(hContact)); } -void cli_ChangeContactIcon(HANDLE hContact,int iIcon,int add) +void cli_ChangeContactIcon(HCONTACT hContact, int iIcon, int add) { - corecli.pfnChangeContactIcon((HANDLE) hContact,(int)iIcon,(int)add); + corecli.pfnChangeContactIcon(hContact, iIcon, add); } static int GetStatusModeOrdering(int statusMode) @@ -62,7 +62,7 @@ static int GetStatusModeOrdering(int statusMode) } -DWORD CompareContacts2_getLMTime(HANDLE hContact) +DWORD CompareContacts2_getLMTime(HCONTACT hContact) { HANDLE hDbEvent = db_event_last(hContact); while(hDbEvent) { @@ -95,16 +95,14 @@ int GetProtoIndex(char * szName) int CompareContacts2(const ClcContact *contact1,const ClcContact *contact2, int by) { - HANDLE a; - HANDLE b; TCHAR *namea, *nameb; int statusa,statusb; char *szProto1,*szProto2; if ((INT_PTR)contact1 < 100 || (INT_PTR)contact2 < 100) return 0; - a = contact1->hContact; - b = contact2->hContact; + HCONTACT a = contact1->hContact; + HCONTACT b = contact2->hContact; namea = (TCHAR *)contact1->szText; statusa = GetContactCachedStatus(contact1->hContact); @@ -118,39 +116,35 @@ int CompareContacts2(const ClcContact *contact1,const ClcContact *contact2, int int ordera,orderb; ordera = GetStatusModeOrdering(statusa); orderb = GetStatusModeOrdering(statusb); - if (ordera != orderb) return ordera-orderb; - else return 0; + return (ordera != orderb) ? ordera - orderb : 0; } - - if (g_CluiData.fSortNoOfflineBottom == 0 && (statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE)) { //one is offline: offline goes below online + //one is offline: offline goes below online + if (g_CluiData.fSortNoOfflineBottom == 0 && (statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE)) return 2*(statusa == ID_STATUS_OFFLINE)-1; - } - if (by == SORTBY_NAME) - { //name + if (by == SORTBY_NAME) //name return mir_tstrcmpi(namea,nameb); - } - if (by == SORTBY_NAME_LOCALE) - { //name + + if (by == SORTBY_NAME_LOCALE) { + //name static int LocaleId = -1; if (LocaleId == -1) LocaleId = CallService(MS_LANGPACK_GETLOCALE, 0, 0); return (CompareString(LocaleId,NORM_IGNORECASE,SAFETSTRING(namea),-1,SAFETSTRING(nameb),-1))-2; } - else if (by == SORTBY_LASTMSG) - { //last message + if (by == SORTBY_LASTMSG) { + //last message DWORD ta = CompareContacts2_getLMTime(a); DWORD tb = CompareContacts2_getLMTime(b); return tb-ta; } - else if (by == SORTBY_PROTO) - { + if (by == SORTBY_PROTO) { int rc = GetProtoIndex(szProto1)-GetProtoIndex(szProto2); - - if (rc != 0 && (szProto1 != NULL && szProto2 != NULL)) return rc; + if (rc != 0 && (szProto1 != NULL && szProto2 != NULL)) + return rc; } - else if (by == SORTBY_RATE) - return contact2->bContactRate-contact1->bContactRate; + else if (by == SORTBY_RATE) + return contact2->bContactRate - contact1->bContactRate; // else :o) return 0; } diff --git a/plugins/Clist_modern/src/modern_gettextasync.cpp b/plugins/Clist_modern/src/modern_gettextasync.cpp index 45dad063b6..6194bcb3c2 100644 --- a/plugins/Clist_modern/src/modern_gettextasync.cpp +++ b/plugins/Clist_modern/src/modern_gettextasync.cpp @@ -42,7 +42,7 @@ int CLUI_SyncGetShortData(WPARAM wParam, LPARAM lParam); #define gtaunlock LeaveCriticalSection( >aCS ) typedef struct _GetTextAsyncItem { - HANDLE hContact; + HCONTACT hContact; ClcData *dat; struct _GetTextAsyncItem *Next; } GTACHAINITEM; @@ -134,7 +134,7 @@ BOOL gtaWakeThread() return FALSE; } -int gtaAddRequest(ClcData *dat,ClcContact *contact,HANDLE hContact) +int gtaAddRequest(ClcData *dat,ClcContact *contact,HCONTACT hContact) { if (MirandaExiting()) return 0; gtalock; @@ -159,7 +159,7 @@ int gtaAddRequest(ClcData *dat,ClcContact *contact,HANDLE hContact) return FALSE; } -void gtaRenewText(HANDLE hContact) +void gtaRenewText(HCONTACT hContact) { gtaAddRequest(NULL,NULL, hContact); } diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index 66abdc832c..db2a5a4ae0 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -165,7 +165,7 @@ int mod_CalcRowHeight_worker(ClcData *dat, HWND hwnd, ClcContact *contact, int i case TC_TEXT2: { int tmp = 0; - HANDLE hContact = pdnce->hContact; + HCONTACT hContact = pdnce->hContact; if (dat->second_line_show && pdnce->szSecondLineText && pdnce->szSecondLineText[0] ) { tmp = dat->fontModernInfo[FONTID_SECONDLINE].fontHeight; @@ -192,7 +192,7 @@ int mod_CalcRowHeight_worker(ClcData *dat, HWND hwnd, ClcContact *contact, int i case TC_TEXT3: { - HANDLE hContact = pdnce->hContact; + HCONTACT hContact = pdnce->hContact; int tmp = 0; if (dat->third_line_show && pdnce->szThirdLineText && pdnce->szThirdLineText[0]) { tmp = dat->fontModernInfo[FONTID_THIRDLINE].fontHeight; diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 9a73e5188a..74159b8b68 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -4081,7 +4081,7 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha) #define SKINSETSECTION "SkinnedSettings" -BOOL SkinDBGetContactSetting(HANDLE hContact, const char* szSection, const char*szKey, DBVARIANT * retdbv, BOOL * bSkinned ) +BOOL SkinDBGetContactSetting(HCONTACT hContact, const char* szSection, const char*szKey, DBVARIANT * retdbv, BOOL * bSkinned ) { if (!hContact) { //only for not contact settings char *szSkinKey; @@ -4096,7 +4096,7 @@ BOOL SkinDBGetContactSetting(HANDLE hContact, const char* szSection, const char* return db_get(hContact, szSection, szKey, retdbv); } -BYTE SkinDBGetContactSettingByte(HANDLE hContact, const char* szSection, const char*szKey, BYTE bDefault) +BYTE SkinDBGetContactSettingByte(HCONTACT hContact, const char* szSection, const char*szKey, BYTE bDefault) { DBVARIANT dbv = { 0 }; BOOL bSkinned = FALSE; @@ -4115,7 +4115,7 @@ BYTE SkinDBGetContactSettingByte(HANDLE hContact, const char* szSection, const c return bDefault; } -WORD SkinDBGetContactSettingWord(HANDLE hContact, const char* szSection, const char*szKey, WORD wDefault) +WORD SkinDBGetContactSettingWord(HCONTACT hContact, const char* szSection, const char*szKey, WORD wDefault) { BOOL bSkinned = FALSE; DBVARIANT dbv = { 0 }; @@ -4132,7 +4132,7 @@ WORD SkinDBGetContactSettingWord(HANDLE hContact, const char* szSection, const c return wDefault; } -DWORD SkinDBGetContactSettingDword(HANDLE hContact, const char* szSection, const char*szKey, DWORD dwDefault) +DWORD SkinDBGetContactSettingDword(HCONTACT hContact, const char* szSection, const char*szKey, DWORD dwDefault) { DBVARIANT dbv = { 0 }; BOOL bSkinned = FALSE; diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index 7cc1989376..db1f1e8b62 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -164,7 +164,7 @@ static void ShowPage(HWND hwnd, int page) } } -static int UpdateClistItem(HANDLE hContact, DWORD mask) +static int UpdateClistItem(HCONTACT hContact, DWORD mask) { for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hContact, MAKELONG(i - ID_STATUS_OFFLINE, @@ -188,8 +188,8 @@ static void UpdateStickies() DWORD localMask; int i; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - HANDLE hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + HCONTACT hItem = (HCONTACT)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, (BYTE)db_get_dw(hContact, CLVM_MODULE, g_szModename, 0) ? 1 : 0); localMask = HIWORD(db_get_dw(hContact, CLVM_MODULE, g_szModename, 0)); @@ -450,7 +450,7 @@ void SaveState() ptrA szModeName(mir_utf8encodeT(szTempModeName)); DWORD dwGlobalMask = GetMaskForItem(hInfoItem); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem == NULL) continue; @@ -656,7 +656,7 @@ void DeleteViewMode( char * szName ) SetWindowText(hwndSelector, TranslateT("All contacts")); } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if (db_get_dw(hContact, CLVM_MODULE, szName, -1) != -1) db_set_dw(hContact, CLVM_MODULE, szName, 0); } @@ -844,7 +844,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP } case IDC_CLEARALL: { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 0); diff --git a/plugins/Clist_mw/src/clc.cpp b/plugins/Clist_mw/src/clc.cpp index e11b858931..b138a66c92 100644 --- a/plugins/Clist_mw/src/clc.cpp +++ b/plugins/Clist_mw/src/clc.cpp @@ -48,7 +48,7 @@ static int stopStatusUpdater = 0; void StatusUpdaterThread(void*) { int i,curdelay,lastcheck = 0; - HANDLE hContact = db_find_first(); + HCONTACT hContact = db_find_first(); SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_LOWEST); @@ -62,7 +62,7 @@ void StatusUpdaterThread(void*) if ( db_get_b(hContact,"CList","StatusMsgAuto",0)) { for (i = 0; i<5; i++) { if (hContact != NULL) { - ClcCacheEntry *pdnce = (ClcCacheEntry *)pcli->pfnGetCacheEntry((HANDLE)hContact); + ClcCacheEntry *pdnce = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hContact); if (pdnce && !pdnce->protoNotExists && pdnce->szProto) CallContactService(hContact, PSS_GETAWAYMSG, 0, 0); @@ -143,9 +143,9 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L case INTM_ICONCHANGED: { int recalcScrollBar = 0,shouldShow; - HANDLE hSelItem = NULL; + HCONTACT hSelItem = NULL; struct ClcContact *selcontact = NULL; - ClcCacheEntry *cacheEntry = GetContactFullCacheEntry((HANDLE)wParam); + ClcCacheEntry *cacheEntry = GetContactFullCacheEntry((HCONTACT)wParam); WORD status; int needsResort = 0; @@ -158,21 +158,21 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L // this means an offline msg is flashing, so the contact should be shown shouldShow = (GetWindowLongPtr(hwnd,GWL_STYLE) & CLS_SHOWHIDDEN || !cacheEntry->bIsHidden) && - (!pcli->pfnIsHiddenMode(dat,status) || cacheEntry->noHiddenOffline || pcli->pfnGetContactIcon((HANDLE)wParam) != LOWORD(lParam)); + (!pcli->pfnIsHiddenMode(dat, status) || cacheEntry->noHiddenOffline || pcli->pfnGetContactIcon((HCONTACT)wParam) != LOWORD(lParam)); ClcContact *contact; ClcGroup *group; - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) { + if (!FindItem(hwnd, dat, (HCONTACT)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 = pcli->pfnContactToHItem(selcontact); - AddContactToTree(hwnd,dat,(HANDLE)wParam,0,0); + hSelItem = (HCONTACT)pcli->pfnContactToHItem(selcontact); + AddContactToTree(hwnd, dat, (HCONTACT)wParam, 0, 0); needsResort = 1; recalcScrollBar = 1; - FindItem(hwnd,dat,(HANDLE)wParam,&contact,NULL,NULL); + FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL); if (contact) { contact->iImage = (WORD)lParam; - pcli->pfnNotifyNewContact(hwnd,(HANDLE)wParam); + pcli->pfnNotifyNewContact(hwnd, (HCONTACT)wParam); dat->needsResort = 1; } } @@ -185,7 +185,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L if ( !shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { if (dat->selection>=0 && GetRowByIndex(dat,dat->selection,&selcontact,NULL) != -1) - hSelItem = pcli->pfnContactToHItem(selcontact); + hSelItem = (HCONTACT)pcli->pfnContactToHItem(selcontact); RemoveItemFromGroup(hwnd,group,contact,0); recalcScrollBar = 1; dat->needsResort = 1; @@ -220,13 +220,13 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L ClcContact *contact; ClcGroup *group; - if ( FindItem(hwnd,dat,(HANDLE)wParam,&contact,&group,NULL) && contact != NULL) { + if (FindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL) && contact != NULL) { contact->flags &= ~CONTACTF_STATUSMSG; - if ( !db_get_ts((HANDLE)wParam, "CList", "StatusMsg", &dbv)) { + if (!db_get_ts((HCONTACT)wParam, "CList", "StatusMsg", &dbv)) { int j; - if (dbv.ptszVal == NULL||_tcslen(dbv.ptszVal) == 0) break; + if (dbv.ptszVal == NULL || _tcslen(dbv.ptszVal) == 0) break; lstrcpyn(contact->szStatusMsg, dbv.ptszVal, SIZEOF(contact->szStatusMsg)); - for (j = (int)_tcslen(contact->szStatusMsg)-1;j>=0;j--) { + for (j = (int)_tcslen(contact->szStatusMsg) - 1; j >= 0; j--) { if (contact->szStatusMsg[j] == '\r' || contact->szStatusMsg[j] == '\n' || contact->szStatusMsg[j] == '\t') { contact->szStatusMsg[j] = ' '; } diff --git a/plugins/Clist_mw/src/clc.h b/plugins/Clist_mw/src/clc.h index 09b2981ccc..a64b3e055b 100644 --- a/plugins/Clist_mw/src/clc.h +++ b/plugins/Clist_mw/src/clc.h @@ -81,7 +81,7 @@ struct ClcData : public ClcDataBase //clcidents.c int GetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex); -int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **contact,ClcGroup **subgroup,int *isVisible); +int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, ClcGroup **subgroup, int *isVisible); int GetRowByIndex(struct ClcData *dat,int testindex,struct ClcContact **contact,ClcGroup **subgroup); void ClearRowByIndexCache(); @@ -92,8 +92,8 @@ int AddInfoItemToGroup(ClcGroup *group,int flags,const TCHAR *pszText); void FreeContact(struct ClcContact *p); void RebuildEntireList(HWND hwnd,struct ClcData *dat); ClcGroup *RemoveItemFromGroup(HWND hwnd,ClcGroup *group,struct ClcContact *contact,int updateTotalCount); -void DeleteItemFromTree(HWND hwnd,HANDLE hItem); -void AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline); +void DeleteItemFromTree(HWND hwnd, HCONTACT hItem); +void AddContactToTree(HWND hwnd, struct ClcData *dat, HCONTACT hContact, int updateTotalCount, int checkHideOffline); void SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort); int GetGroupContentsCount(ClcGroup *group,int visibleOnly); int GetNewSelection(ClcGroup *group,int selection, int direction); @@ -124,8 +124,8 @@ void UnregisterFileDropping(HWND hwnd); //cluiservices.c void FreeProtocolData( void ); -int GetContactCachedStatus(HANDLE hContact); -char *GetContactCachedProtocol(HANDLE hContact); +int GetContactCachedStatus(HCONTACT hContact); +char *GetContactCachedProtocol(HCONTACT hContact); #define CLUI_SetDrawerService "CLUI/SETDRAWERSERVICE" typedef struct { diff --git a/plugins/Clist_mw/src/clcidents.cpp b/plugins/Clist_mw/src/clcidents.cpp index a5953b1046..803b7b9f6b 100644 --- a/plugins/Clist_mw/src/clcidents.cpp +++ b/plugins/Clist_mw/src/clcidents.cpp @@ -80,7 +80,7 @@ int GetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex) return -1; } -ClcCacheEntry *GetCLCFullCacheEntry(struct ClcData *dat,HANDLE hContact) +ClcCacheEntry *GetCLCFullCacheEntry(struct ClcData *dat,HCONTACT hContact) { if (hContact == 0) return NULL; @@ -107,7 +107,7 @@ ClcCacheEntry *GetCLCFullCacheEntry(struct ClcData *dat,HANDLE hContact) return (pdnce); } -void ClearClcContactCache(struct ClcData *dat,HANDLE hContact) +void ClearClcContactCache(struct ClcData *dat,HCONTACT hContact) { ClcCacheEntry *cacheEntry; @@ -133,7 +133,7 @@ void ClearClcContactCache(struct ClcData *dat,HANDLE hContact) } } -void SetClcContactCacheItem(struct ClcData *dat,HANDLE hContact,void *contact) +void SetClcContactCacheItem(struct ClcData *dat, HCONTACT hContact, void *contact) { ClcCacheEntry *cacheEntry; if ( !IsHContactGroup(hContact) && !IsHContactInfo(hContact)) { @@ -143,7 +143,7 @@ void SetClcContactCacheItem(struct ClcData *dat,HANDLE hContact,void *contact) } } -int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **contact,ClcGroup **subgroup,int *isVisible) +int FindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, ClcGroup **subgroup, int *isVisible) { int index = 0, i; int nowVisible = 1; @@ -153,8 +153,7 @@ int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **cont if (isVisible == NULL && hItem != NULL && subgroup == NULL && !IsHContactGroup(hItem) && !IsHContactInfo(hItem)) { //try use cache - ClcCacheEntry *cacheEntry; - cacheEntry = GetCLCFullCacheEntry(dat,hItem); + ClcCacheEntry *cacheEntry = GetCLCFullCacheEntry(dat, (HCONTACT)hItem); if (cacheEntry != NULL) { if (cacheEntry->ClcContact == NULL) { int *isv = {0}; diff --git a/plugins/Clist_mw/src/clcitems.cpp b/plugins/Clist_mw/src/clcitems.cpp index 16e09c18c0..57b4a43fad 100644 --- a/plugins/Clist_mw/src/clcitems.cpp +++ b/plugins/Clist_mw/src/clcitems.cpp @@ -36,12 +36,11 @@ extern void (*saveFreeGroup)(ClcGroup *p); //routines for managing adding/removal of items in the list, including sorting -extern void ClearClcContactCache(struct ClcData *dat,HANDLE hContact); +extern void ClearClcContactCache(struct ClcData *dat,HCONTACT hContact); void AddSubcontacts(struct ClcContact * cont) { int subcount,i,j; - HANDLE hsub; ClcCacheEntry *cacheEntry; cacheEntry = GetContactFullCacheEntry(cont->hContact); OutputDebugStringA("Proceed AddSubcontacts\r\n"); @@ -52,7 +51,7 @@ void AddSubcontacts(struct ClcContact * cont) cont->SubAllocated = subcount; i = 0; for (j = 0; jhContact,j); + HCONTACT hsub = (HCONTACT)CallService(MS_MC_GETSUBCONTACT, (WPARAM)cont->hContact, j); cacheEntry = GetContactFullCacheEntry(hsub); if ( !(db_get_b(NULL,"CLC","MetaHideOfflineSub",1) && db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) || cacheEntry->status != ID_STATUS_OFFLINE ) @@ -115,7 +114,7 @@ static struct ClcContact* AddContactToGroup(struct ClcData *dat,ClcGroup *group, char *szProto; WORD apparentMode; DWORD idleMode; - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; int i; int img = -1; @@ -183,7 +182,7 @@ static struct ClcContact* AddContactToGroup(struct ClcData *dat,ClcGroup *group, return group->cl.items[i]; } -void AddContactToTree(HWND hwnd, ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline) +void AddContactToTree(HWND hwnd, ClcData *dat, HCONTACT hContact, int updateTotalCount, int checkHideOffline) { if ( FindItem(hwnd,dat,hContact,NULL,NULL,NULL) == 1) return; @@ -275,7 +274,7 @@ ClcGroup *RemoveItemFromGroup(HWND hwnd,ClcGroup *group,struct ClcContact *conta return group; } -void DeleteItemFromTree(HWND hwnd,HANDLE hItem) +void DeleteItemFromTree(HWND hwnd, HCONTACT hItem) { struct ClcContact *contact; ClcGroup *group; @@ -327,7 +326,7 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat) int tick = GetTickCount(); ClearRowByIndexCache(); - ClearClcContactCache(dat,INVALID_HANDLE_VALUE); + ClearClcContactCache(dat, (HCONTACT)INVALID_HANDLE_VALUE); dat->list.expanded = 1; dat->list.hideOffline = db_get_b(NULL,"CLC","HideOfflineRoot",0); @@ -349,7 +348,7 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat) } } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ClcCacheEntry *cacheEntry; cont = NULL; cacheEntry = GetContactFullCacheEntry(hContact); @@ -417,7 +416,7 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat) mir_snprintf(buf, SIZEOF(buf), "RebuildEntireList %d \r\n", tick); OutputDebugStringA(buf); - db_set_dw((HANDLE)0,"CLUI","PF:Last RebuildEntireList Time:",tick); + db_set_dw(0,"CLUI","PF:Last RebuildEntireList Time:",tick); } } @@ -506,7 +505,7 @@ void SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort) if (tick > 5) { mir_snprintf(buf, SIZEOF(buf), "SortCLC %d \r\n", tick); OutputDebugStringA(buf); - db_set_dw((HANDLE)0,"CLUI","PF:Last SortCLC Time:",tick); + db_set_dw(0,"CLUI","PF:Last SortCLC Time:",tick); } } #endif @@ -514,7 +513,7 @@ void SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort) struct SavedContactState_t { - HANDLE hContact; + HCONTACT hContact; WORD iExtraImage[EXTRA_ICON_COUNT]; int checked; }; @@ -654,7 +653,7 @@ void SaveStateAndRebuildList(HWND hwnd,struct ClcData *dat) for (i = 0;ilist; else { - if ( !FindItem(hwnd,dat,(HANDLE)(savedInfo[i].parentId|HCONTACT_ISGROUP),&contact,NULL,NULL)) continue; + if (!FindItem(hwnd, dat, (HCONTACT)(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/clist.h b/plugins/Clist_mw/src/clist.h index e234bbdd10..7b7b2e1589 100644 --- a/plugins/Clist_mw/src/clist.h +++ b/plugins/Clist_mw/src/clist.h @@ -26,12 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define _CLIST_H_ void LoadContactTree(void); -int ExtIconFromStatusMode(HANDLE hContact, const char *szProto,int status); -HTREEITEM GetTreeItemByHContact(HANDLE hContact); +int ExtIconFromStatusMode(HCONTACT hContact, const char *szProto,int status); +HTREEITEM GetTreeItemByHContact(HCONTACT hContact); void TrayIconUpdateWithImageList(int iImage,const char *szNewTip,char *szPreferredProto); void SortContacts(void); -void ChangeContactIcon(HANDLE hContact,int iIcon,int add); -int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status); +void ChangeContactIcon(HCONTACT hContact,int iIcon,int add); +int GetContactInfosForSort(HCONTACT hContact,char **Proto,TCHAR **Name,int *Status); struct ClcCacheEntry : public ClcCacheEntryBase { @@ -50,6 +50,6 @@ struct ClcCacheEntry : public ClcCacheEntryBase boolean isUnknown; }; -ClcCacheEntry* GetContactFullCacheEntry(HANDLE hContact); +ClcCacheEntry* GetContactFullCacheEntry(HCONTACT hContact); #endif \ No newline at end of file diff --git a/plugins/Clist_mw/src/clistmod.cpp b/plugins/Clist_mw/src/clistmod.cpp index 9beb827e1d..aff0c241fe 100644 --- a/plugins/Clist_mw/src/clistmod.cpp +++ b/plugins/Clist_mw/src/clistmod.cpp @@ -42,19 +42,18 @@ extern BYTE nameOrder[]; static HANDLE hSettingChanged, hProtoAckHook; /////////// End by FYR //////// -int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact) +int cli_IconFromStatusMode(const char *szProto,int nStatus, HCONTACT hContact) { int result = -1; if (hContact && szProto) { char * szActProto = (char*)szProto; int nActStatus = nStatus; - HANDLE hActContact = hContact; + HCONTACT hActContact = hContact; if ( !db_get_b(NULL,"CLC","Meta",0) && !strcmp(szActProto,"MetaContacts")) { // substitute params by mostonline contact datas - HANDLE hMostOnlineContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hActContact,0); + HCONTACT hMostOnlineContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hActContact, 0); if (hMostOnlineContact && hMostOnlineContact != (HANDLE)CALLSERVICE_NOTFOUND) { - ClcCacheEntry *cacheEntry; - cacheEntry = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hMostOnlineContact); + ClcCacheEntry *cacheEntry = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hMostOnlineContact); if (cacheEntry && cacheEntry->szProto) { szActProto = cacheEntry->szProto; nActStatus = cacheEntry->status; @@ -76,14 +75,14 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact) ////////// By FYR///////////// -int ExtIconFromStatusMode(HANDLE hContact, const char *szProto,int status) +int ExtIconFromStatusMode(HCONTACT hContact, const char *szProto,int status) { /* if ( db_get_b( NULL, "CLC", "Meta", 0 ) == 1 ) return pcli->pfnIconFromStatusMode(szProto,status,hContact); if ( szProto != NULL ) { if (strcmp(szProto,"MetaContacts") == 0 ) { - hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(UINT)hContact,0); + hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT,(UINT)hContact,0); if ( hContact != 0 ) { szProto = GetContactProto((UINT)hContact,0); status = db_get_w(hContact,szProto,"Status",ID_STATUS_OFFLINE); @@ -129,7 +128,7 @@ static int ContactListShutdownProc(WPARAM wParam,LPARAM lParam) int LoadContactListModule(void) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) db_set_s(hContact, "CList", "StatusMsg", ""); hCListImages = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0); diff --git a/plugins/Clist_mw/src/clistopts.cpp b/plugins/Clist_mw/src/clistopts.cpp index bccc015bc2..c85b67c4f2 100644 --- a/plugins/Clist_mw/src/clistopts.cpp +++ b/plugins/Clist_mw/src/clistopts.cpp @@ -51,7 +51,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { case WM_USER+1: { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBCONTACTWRITESETTING * ws = (DBCONTACTWRITESETTING *)lParam; if ( hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && lstrcmpiA(ws->szModule,"CList") == 0 && lstrcmpiA(ws->szSetting,"UseGroups") == 0 diff --git a/plugins/Clist_mw/src/clistsettings.cpp b/plugins/Clist_mw/src/clistsettings.cpp index ed3573d6d7..29a14487cf 100644 --- a/plugins/Clist_mw/src/clistsettings.cpp +++ b/plugins/Clist_mw/src/clistsettings.cpp @@ -25,12 +25,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h" #include "clist.h" -TCHAR *GetNameForContact(HANDLE hContact,int flag,boolean *isUnknown); -char *GetProtoForContact(HANDLE hContact); -int GetStatusForContact(HANDLE hContact,char *szProto); +TCHAR *GetNameForContact(HCONTACT hContact,int flag,boolean *isUnknown); +char *GetProtoForContact(HCONTACT hContact); +int GetStatusForContact(HCONTACT hContact,char *szProto); TCHAR *UnknownConctactTranslatedName; extern boolean OnModulesLoadedCalled; -void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,ClcCacheEntry *pdnce,int SettingType); +void InvalidateDisplayNameCacheEntryByPDNE(HCONTACT hContact,ClcCacheEntry *pdnce,int SettingType); static int handleCompare( ClcCacheEntry* c1, ClcCacheEntry* c2 ) { @@ -46,7 +46,7 @@ void InitDisplayNameCache(SortedList *list) list->increment = CallService(MS_DB_CONTACT_GETCOUNT,0,0)+1; i = 0; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ClcCacheEntry *pdnce = (ClcCacheEntry *)mir_calloc(sizeof(ClcCacheEntry)); pdnce->hContact = hContact; InvalidateDisplayNameCacheEntryByPDNE(hContact,pdnce,0); @@ -143,7 +143,7 @@ void CheckPDNCE(ClcCacheEntry *_pdnce) pdnce->IsExpanded = db_get_b(pdnce->hContact,"CList","Expanded",0); } -void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,ClcCacheEntry *pdnce,int SettingType) +void InvalidateDisplayNameCacheEntryByPDNE(HCONTACT hContact,ClcCacheEntry *pdnce,int SettingType) { if ( hContact == NULL || pdnce == NULL ) return; @@ -192,7 +192,7 @@ void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,ClcCacheEntry *pdnce, pdnce->IsExpanded = -1; } -char *GetContactCachedProtocol(HANDLE hContact) +char *GetContactCachedProtocol(HCONTACT hContact) { ClcCacheEntry *cacheEntry = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hContact); if (cacheEntry&&cacheEntry->szProto) @@ -201,21 +201,21 @@ char *GetContactCachedProtocol(HANDLE hContact) return NULL; } -char *GetProtoForContact(HANDLE hContact) +char *GetProtoForContact(HCONTACT hContact) { return mir_strdup(GetContactProto(hContact)); } -int GetStatusForContact(HANDLE hContact,char *szProto) +int GetStatusForContact(HCONTACT hContact,char *szProto) { int status = ID_STATUS_OFFLINE; if (szProto) - status = db_get_w((HANDLE)hContact,szProto,"Status",ID_STATUS_OFFLINE); + status = db_get_w((HCONTACT)hContact, szProto, "Status", ID_STATUS_OFFLINE); return (status); } -TCHAR* GetNameForContact(HANDLE hContact,int flag,boolean *isUnknown) +TCHAR* GetNameForContact(HCONTACT hContact,int flag,boolean *isUnknown) { TCHAR* result = pcli->pfnGetContactDisplayName(hContact, flag | GCDNF_NOCACHE); @@ -229,7 +229,7 @@ TCHAR* GetNameForContact(HANDLE hContact,int flag,boolean *isUnknown) return result; } -ClcCacheEntry *GetContactFullCacheEntry(HANDLE hContact) +ClcCacheEntry *GetContactFullCacheEntry(HCONTACT hContact) { ClcCacheEntry *cacheEntry = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hContact); if (cacheEntry != NULL) @@ -238,7 +238,7 @@ ClcCacheEntry *GetContactFullCacheEntry(HANDLE hContact) return NULL; } -int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status) +int GetContactInfosForSort(HCONTACT hContact,char **Proto,TCHAR **Name,int *Status) { ClcCacheEntry *cacheEntry = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hContact); if (cacheEntry != NULL) @@ -250,7 +250,7 @@ int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status return 0; } -int GetContactCachedStatus(HANDLE hContact) +int GetContactCachedStatus(HCONTACT hContact) { ClcCacheEntry *cacheEntry = (ClcCacheEntry *)pcli->pfnGetCacheEntry(hContact); if (cacheEntry&&cacheEntry->status != 0) return cacheEntry->status; @@ -260,7 +260,7 @@ int GetContactCachedStatus(HANDLE hContact) int ContactSettingChanged(WPARAM wParam,LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; // Early exit if (hContact == NULL) @@ -281,7 +281,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) if (cws->value.type == DBVT_WORD && !strcmp(cws->szSetting, "Status")) { if ( !(pdnce->bIsHidden == 1)) { - if ( db_get_b((HANDLE)NULL,"CList","ShowStatusMsg",0)||db_get_b(hContact,"CList","StatusMsgAuto",0)) + if ( db_get_b(NULL,"CList","ShowStatusMsg",0)||db_get_b(hContact,"CList","StatusMsgAuto",0)) db_set_s(hContact, "CList", "StatusMsg", ""); if ( db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) { @@ -315,7 +315,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) if ( !strcmp(cws->szSetting,"Hidden")) { InvalidateDisplayNameCacheEntryByPDNE(hContact,pdnce,cws->value.type); if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) { - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); ChangeContactIcon(hContact,ExtIconFromStatusMode(hContact, szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)), 1); //by FYR } } diff --git a/plugins/Clist_mw/src/clui.cpp b/plugins/Clist_mw/src/clui.cpp index c87b62c6ae..1dffd90f71 100644 --- a/plugins/Clist_mw/src/clui.cpp +++ b/plugins/Clist_mw/src/clui.cpp @@ -93,7 +93,7 @@ static int CluiModulesLoaded(WPARAM wParam,LPARAM lParam) PostMessage(pcli->hwndContactList,M_CREATECLC,0,0); OnModulesLoadedCalled = TRUE; - pcli->pfnInvalidateDisplayNameCacheEntry(INVALID_HANDLE_VALUE); + pcli->pfnInvalidateDisplayNameCacheEntry((HCONTACT)INVALID_HANDLE_VALUE); InitGroupMenus(); RegisterProtoIconsForAllProtoIconLib(); return 0; diff --git a/plugins/Clist_mw/src/commonheaders.h b/plugins/Clist_mw/src/commonheaders.h index 2a52b421a5..70dffe6570 100644 --- a/plugins/Clist_mw/src/commonheaders.h +++ b/plugins/Clist_mw/src/commonheaders.h @@ -88,7 +88,7 @@ extern int __cdecl MyStrCmpiT(const TCHAR *a, const TCHAR *b); extern DWORD exceptFunction(LPEXCEPTION_POINTERS EP); -extern int (*saveIconFromStatusMode)(const char *szProto, int nStatus, HANDLE hContact); +extern int (*saveIconFromStatusMode)(const char *szProto, int nStatus, HCONTACT hContact); //from bkg options diff --git a/plugins/Clist_mw/src/contact.cpp b/plugins/Clist_mw/src/contact.cpp index 095998689e..a41cc99992 100644 --- a/plugins/Clist_mw/src/contact.cpp +++ b/plugins/Clist_mw/src/contact.cpp @@ -27,8 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "clist.h" extern HANDLE hContactIconChangedEvent; -extern int GetContactCachedStatus(HANDLE hContact); -extern char *GetContactCachedProtocol(HANDLE hContact); +extern int GetContactCachedStatus(HCONTACT hContact); +extern char *GetContactCachedProtocol(HCONTACT hContact); int sortByStatus; static int sortByProto; @@ -47,7 +47,7 @@ struct { {ID_STATUS_ONTHEPHONE,150}, {ID_STATUS_OUTTOLUNCH,425}}; -static int GetContactStatus(HANDLE hContact) +static int GetContactStatus(HCONTACT hContact) { /* @@ -60,7 +60,7 @@ static int GetContactStatus(HANDLE hContact) return (GetContactCachedStatus(hContact)); } -void ChangeContactIcon(HANDLE hContact,int iIcon,int add) +void ChangeContactIcon(HCONTACT hContact,int iIcon,int add) { //clui MS_CLUI_CONTACTADDED MS_CLUI_CONTACTSETICON this methods is null //CallService(add?MS_CLUI_CONTACTADDED:MS_CLUI_CONTACTSETICON,(WPARAM)hContact,iIcon); @@ -87,7 +87,7 @@ void LoadContactTree(void) int hideOffline = db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ClcCacheEntry *cacheEntry = GetContactFullCacheEntry(hContact); if (cacheEntry == NULL) { MessageBoxA(0,"Fail To Get CacheEntry for hContact","!!!!!",0); @@ -114,7 +114,7 @@ void LoadContactTree(void) int CompareContacts( const struct ClcContact *contact1, const struct ClcContact *contact2 ) { - HANDLE a = contact1->hContact, b = contact2->hContact; + HCONTACT a = contact1->hContact, b = contact2->hContact; TCHAR *namea,*nameb; int statusa,statusb; char *szProto1,*szProto2; @@ -167,12 +167,14 @@ void SortContacts(void) INT_PTR ContactChangeGroup(WPARAM wParam,LPARAM lParam) { + HCONTACT hContact = (HCONTACT)wParam; + CallService(MS_CLUI_CONTACTDELETED,wParam,0); if ((HANDLE)lParam == NULL) - db_unset((HANDLE)wParam,"CList","Group"); + db_unset(hContact, "CList", "Group"); else - db_set_s((HANDLE)wParam,"CList","Group",(char*)CallService(MS_CLIST_GROUPGETNAME2,lParam,(LPARAM)(int*)NULL)); + db_set_s(hContact, "CList", "Group", (char*)CallService(MS_CLIST_GROUPGETNAME2, lParam, (LPARAM)(int*)NULL)); - CallService(MS_CLUI_CONTACTADDED,wParam,ExtIconFromStatusMode((HANDLE)wParam, GetContactProto((HANDLE)wParam), GetContactStatus((HANDLE)wParam))); + CallService(MS_CLUI_CONTACTADDED, wParam, ExtIconFromStatusMode(hContact, GetContactProto(hContact), GetContactStatus(hContact))); return 0; } diff --git a/plugins/Clist_mw/src/init.cpp b/plugins/Clist_mw/src/init.cpp index 52581b9f03..940927a4b3 100644 --- a/plugins/Clist_mw/src/init.cpp +++ b/plugins/Clist_mw/src/init.cpp @@ -67,8 +67,8 @@ void SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort); INT_PTR ( *saveTrayIconProcessMessage )(WPARAM wParam,LPARAM lParam); INT_PTR TrayIconProcessMessage(WPARAM wParam,LPARAM lParam); -int (*saveIconFromStatusMode)(const char *szProto,int nStatus, HANDLE hContact); -int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact); +int (*saveIconFromStatusMode)(const char *szProto,int nStatus, HCONTACT hContact); +int cli_IconFromStatusMode(const char *szProto,int nStatus, HCONTACT hContact); //from clcfonts void RegisterCListFonts( void ); @@ -140,7 +140,7 @@ static struct ClcContact* fnCreateClcContact( void ) return (struct ClcContact*)mir_calloc( sizeof( struct ClcContact )); } -static ClcCacheEntry *fnCreateCacheItem( HANDLE hContact ) +static ClcCacheEntry *fnCreateCacheItem(HCONTACT hContact ) { ClcCacheEntry *p = (ClcCacheEntry *)mir_calloc( sizeof( ClcCacheEntry )); if ( p ) diff --git a/plugins/Clist_nicer/src/Include/clc.h b/plugins/Clist_nicer/src/Include/clc.h index 08a89895c9..afb5a7ece5 100644 --- a/plugins/Clist_nicer/src/Include/clc.h +++ b/plugins/Clist_nicer/src/Include/clc.h @@ -103,32 +103,32 @@ typedef struct _OrderTreeData struct TExtraCache { - HANDLE hContact; - HANDLE hTimeZone; - BYTE valid; - TCHAR *statusMsg; - BYTE bStatusMsgValid; - DWORD dwCFlags; - DWORD dwDFlags; // display flags for caching only + HCONTACT hContact; + HANDLE hTimeZone; + BYTE valid; + TCHAR *statusMsg; + BYTE bStatusMsgValid; + DWORD dwCFlags; + DWORD dwDFlags; // display flags for caching only StatusItems_t *status_item, *proto_status_item; - DWORD dwLastMsgTime; - DWORD msgFrequency; - BOOL isChatRoom; + DWORD dwLastMsgTime; + DWORD msgFrequency; + BOOL isChatRoom; }; struct ClcContact : public ClcContactBase { - BOOL bIsMeta; - BYTE xStatus; - int xStatusIcon; - HANDLE hSubContact; - char *metaProto; - DWORD codePage; - WORD wStatus; - int avatarLeft, extraIconRightBegin; - int isRtl; - DWORD cFlags; - BYTE bSecondLine; + BOOL bIsMeta; + BYTE xStatus; + int xStatusIcon; + HCONTACT hSubContact; + char *metaProto; + DWORD codePage; + WORD wStatus; + int avatarLeft, extraIconRightBegin; + int isRtl; + DWORD cFlags; + BYTE bSecondLine; avatarCacheEntry *ace; TExtraCache* pExtra; @@ -233,7 +233,7 @@ struct TCluiData { HMENU hMenuNotify; int iLastEventAdded; int wNextMenuID; - HANDLE hUpdateContact; + HCONTACT hUpdateContact; DWORD sortTimer; TCHAR *szNoEvents; BOOL forceResize; @@ -329,7 +329,7 @@ struct IconDesc { }; struct NotifyMenuItemExData { - HANDLE hContact; + HCONTACT hContact; int iIcon; // icon index in the image list HICON hIcon; // corresponding icon handle HANDLE hDbEvent; @@ -357,7 +357,7 @@ HANDLE ContactToItemHandle(ClcContact *contact, DWORD *nmFlags); //clcitems.c void RebuildEntireList(HWND hwnd, struct ClcData *dat); -DWORD INTSORT_GetLastMsgTime(HANDLE hContact); +DWORD INTSORT_GetLastMsgTime(HCONTACT hContact); //clcmsgs.c LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); @@ -409,10 +409,10 @@ void ConfigureEventArea(HWND hwnd); void ClearIcons(int mode); void SkinDrawBg(HWND hwnd, HDC hdc); int GetBasicFontID(ClcContact * contact); -extern int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szStatus, struct ClcData *dat); +extern int __fastcall CLVM_GetContactHiddenStatus(HCONTACT hContact, char *szStatus, struct ClcData *dat); void CreateViewModeFrame(); -int GetExtraCache(HANDLE hContact, char *szProto); -void ReloadExtraInfo(HANDLE hContact); +int GetExtraCache(HCONTACT hContact, char *szProto); +void ReloadExtraInfo(HCONTACT hContact); void LoadAvatarForContact(ClcContact *p); void ApplyViewMode(const char *name); @@ -425,7 +425,7 @@ void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int in void Reload3dBevelColors(); void ReloadThemedOptions(); void SetButtonToSkinned(); -void RTL_DetectAndSet(ClcContact *contact, HANDLE hContact); +void RTL_DetectAndSet(ClcContact *contact, HCONTACT hContact); void RTL_DetectGroupName(ClcContact *group); void CLN_LoadAllIcons(BOOL mode); void ReloadSkinItemsToCache(); diff --git a/plugins/Clist_nicer/src/Include/clist.h b/plugins/Clist_nicer/src/Include/clist.h index b60b0db108..51c769d031 100644 --- a/plugins/Clist_nicer/src/Include/clist.h +++ b/plugins/Clist_nicer/src/Include/clist.h @@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ void LoadContactTree(void); -int IconFromStatusMode(const char *szProto, int status, HANDLE hContact, HICON *phIcon); -HTREEITEM GetTreeItemByHContact(HANDLE hContact); +int IconFromStatusMode(const char *szProto, int status, HCONTACT hContact, HICON *phIcon); +HTREEITEM GetTreeItemByHContact(HCONTACT hContact); void SortContacts(void); #define CLUIINTM_REDRAW (WM_USER+100) diff --git a/plugins/Clist_nicer/src/Include/config.h b/plugins/Clist_nicer/src/Include/config.h index 2052232339..e40a92d36c 100644 --- a/plugins/Clist_nicer/src/Include/config.h +++ b/plugins/Clist_nicer/src/Include/config.h @@ -52,34 +52,34 @@ class cfg public: static void init(); - static DWORD getDword(const HANDLE hContact, const char *szModule, const char *szSetting, DWORD uDefault); + static DWORD getDword(const HCONTACT hContact, const char *szModule, const char *szSetting, DWORD uDefault); static DWORD getDword(const char *szModule, const char *szSetting, DWORD uDefault); static DWORD getDword(const char *szSetting, DWORD uDefault); - static WORD getWord(const HANDLE hContact, const char *szModule, const char *szSetting, WORD uDefault); + static WORD getWord(const HCONTACT hContact, const char *szModule, const char *szSetting, WORD uDefault); static WORD getWord(const char *szModule, const char *szSetting, WORD uDefault); static WORD getWord(const char *szSetting, WORD uDefault); - static int getByte(const HANDLE hContact, const char *szModule, const char *szSetting, int uDefault); + static int getByte(const HCONTACT hContact, const char *szModule, const char *szSetting, int uDefault); static int getByte(const char *szModule, const char *szSetting, int uDefault); static int getByte(const char *szSetting, int uDefault); - static INT_PTR getTString(const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); - static INT_PTR getString(const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); + static INT_PTR getTString(const HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); + static INT_PTR getString(const HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); - static INT_PTR writeDword(const HANDLE hContact, const char *szModule, const char *szSetting, DWORD value); + static INT_PTR writeDword(const HCONTACT hContact, const char *szModule, const char *szSetting, DWORD value); static INT_PTR writeDword(const char *szModule, const char *szSetting, DWORD value); - static INT_PTR writeWord(const HANDLE hContact, const char *szModule, const char *szSetting, WORD value); + static INT_PTR writeWord(const HCONTACT hContact, const char *szModule, const char *szSetting, WORD value); static INT_PTR writeWord(const char *szModule, const char *szSetting, WORD value); - static INT_PTR writeByte(const HANDLE hContact, const char *szModule, const char *szSetting, BYTE value); + static INT_PTR writeByte(const HCONTACT hContact, const char *szModule, const char *szSetting, BYTE value); static INT_PTR writeByte(const char *szModule, const char *szSetting, BYTE value); - static INT_PTR writeTString(const HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *st); - static INT_PTR writeString(const HANDLE hContact, const char *szModule, const char *szSetting, const char *st); + static INT_PTR writeTString(const HCONTACT hContact, const char *szModule, const char *szSetting, const TCHAR *st); + static INT_PTR writeString(const HCONTACT hContact, const char *szModule, const char *szSetting, const char *st); - static TExtraCache* getCache(const HANDLE hContact, const char *szProto); + static TExtraCache* getCache(const HCONTACT hContact, const char *szProto); public: static TCluiData dat; diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index e8187cd572..00d7be37d2 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -46,7 +46,7 @@ static HRESULT(WINAPI *MyCloseThemeData)(HANDLE); LONG g_cxsmIcon, g_cysmIcon; -void SetDBButtonStates(HANDLE hContact); +void SetDBButtonStates(HCONTACT hContact); HMENU BuildGroupPopupMenu(ClcGroup* group) { @@ -78,14 +78,14 @@ static int ClcEventAdded(WPARAM wParam, LPARAM lParam) DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get((HANDLE)lParam, &dbei); if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { - DWORD firstTime = cfg::getDword((HANDLE)wParam, "CList", "mf_firstEvent", 0); - DWORD count = cfg::getDword((HANDLE)wParam, "CList", "mf_count", 0); + DWORD firstTime = cfg::getDword((HCONTACT)wParam, "CList", "mf_firstEvent", 0); + DWORD count = cfg::getDword((HCONTACT)wParam, "CList", "mf_count", 0); count++; new_freq = count ? (dbei.timestamp - firstTime) / count : 0x7fffffff; - cfg::writeDword((HANDLE)wParam, "CList", "mf_freq", new_freq); - cfg::writeDword((HANDLE)wParam, "CList", "mf_count", count); + cfg::writeDword((HCONTACT)wParam, "CList", "mf_freq", new_freq); + cfg::writeDword((HCONTACT)wParam, "CList", "mf_count", count); - TExtraCache *p = cfg::getCache((HANDLE)wParam, NULL); + TExtraCache *p = cfg::getCache((HCONTACT)wParam, NULL); if (p) { p->dwLastMsgTime = dbei.timestamp; if (new_freq) @@ -111,9 +111,9 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) if ( !__strcmp(cws->szSetting, "ANSIcodepage")) pcli->pfnClcBroadcast(INTM_CODEPAGECHANGED, wParam, lParam); else if ( !__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) - ReloadExtraInfo((HANDLE)wParam); + ReloadExtraInfo((HCONTACT)wParam); } - else if (wParam != 0 && (szProto = GetContactProto((HANDLE)wParam)) != NULL) { + else if (wParam != 0 && (szProto = GetContactProto((HCONTACT)wParam)) != NULL) { char *id = NULL; if ( !__strcmp(cws->szModule, "Protocol") && !__strcmp(cws->szSetting, "p")) { char *szProto_s; @@ -122,24 +122,24 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) szProto_s = NULL; else szProto_s = cws->value.pszVal; - pcli->pfnChangeContactIcon((HANDLE)wParam, IconFromStatusMode(szProto_s, szProto_s == NULL ? ID_STATUS_OFFLINE : cfg::getWord((HANDLE)wParam, szProto_s, "Status", ID_STATUS_OFFLINE), (HANDLE)wParam, NULL), 0); + pcli->pfnChangeContactIcon((HCONTACT)wParam, IconFromStatusMode(szProto_s, szProto_s == NULL ? ID_STATUS_OFFLINE : cfg::getWord((HCONTACT)wParam, szProto_s, "Status", ID_STATUS_OFFLINE), (HCONTACT)wParam, NULL), 0); } // something is being written to a protocol module if ( !__strcmp(szProto, cws->szModule)) { // was a unique setting key written? - pcli->pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam); + pcli->pfnInvalidateDisplayNameCacheEntry((HCONTACT)wParam); if ( !__strcmp(cws->szSetting, "Status")) { - if ( !cfg::getByte((HANDLE)wParam, "CList", "Hidden", 0)) { + if (!cfg::getByte((HCONTACT)wParam, "CList", "Hidden", 0)) { if (cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) { // User's state is changing, and we are hideOffline-ing if (cws->value.wVal == ID_STATUS_OFFLINE) { - pcli->pfnChangeContactIcon((HANDLE)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HANDLE)wParam, NULL), 0); + pcli->pfnChangeContactIcon((HCONTACT)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HCONTACT)wParam, NULL), 0); CallService(MS_CLUI_CONTACTDELETED, wParam, 0); return 0; } - pcli->pfnChangeContactIcon((HANDLE)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HANDLE)wParam, NULL), 1); + pcli->pfnChangeContactIcon((HCONTACT)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HCONTACT)wParam, NULL), 1); } - pcli->pfnChangeContactIcon((HANDLE)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HANDLE)wParam, NULL), 0); + pcli->pfnChangeContactIcon((HCONTACT)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HCONTACT)wParam, NULL), 0); } SendMessage(pcli->hwndContactTree, INTM_STATUSCHANGED, wParam, lParam); return 0; @@ -149,7 +149,7 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) else if (strstr(cws->szSetting, "XStatus")) SendMessage(pcli->hwndContactTree, INTM_XSTATUSCHANGED, wParam, lParam); else if ( !__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) - ReloadExtraInfo((HANDLE)wParam); + ReloadExtraInfo((HCONTACT)wParam); if (cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS) && !__strcmp(szProto, cfg::dat.szMetaName)) { if ((lstrlenA(cws->szSetting) > 6 && !strncmp(cws->szSetting, "Status", 6)) || strstr("Default,ForceSend,Nick", cws->szSetting)) @@ -239,7 +239,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L case WM_CREATE: dat = (struct ClcData *)mir_alloc(sizeof(struct ClcData)); memset(dat, 0, sizeof(struct ClcData)); - SetWindowLongPtr(hwnd, 0, (LONG_PTR) dat); + SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat); RowHeight::Init(dat); dat->forceScroll = 0; @@ -255,7 +255,8 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L cfg::clcdat = dat; if (cfg::dat.bShowLocalTime) SetTimer(hwnd, TIMERID_REFRESH, 65000, NULL); - } else + } + else dat->bisEmbedded = TRUE; } break; @@ -278,116 +279,116 @@ LBL_Def: return FrameNCPaint(hwnd, DefWindowProc, wParam, lParam, frameHasTitlebar); case INTM_GROUPCHANGED: - { - WORD iExtraImage[EXTRA_ICON_COUNT]; - BYTE flags = 0; - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) - memset(iExtraImage, 0xFF, sizeof(iExtraImage)); - else { - memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); - flags = contact->flags; + { + WORD iExtraImage[EXTRA_ICON_COUNT]; + BYTE flags = 0; + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + memset(iExtraImage, 0xFF, sizeof(iExtraImage)); + else { + memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); + flags = contact->flags; + } + 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)) { + memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); + if (flags & CONTACTF_CHECKED) + contact->flags |= CONTACTF_CHECKED; } - pcli->pfnDeleteItemFromTree(hwnd, (HANDLE)wParam); - if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus((HANDLE)wParam, NULL, dat)) { - pcli->pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 1, 1); - if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { - memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); - if (flags & CONTACTF_CHECKED) - contact->flags |= CONTACTF_CHECKED; - } - NMCLISTCONTROL nm; - nm.hdr.code = CLN_CONTACTMOVED; - nm.hdr.hwndFrom = hwnd; - nm.hdr.idFrom = GetDlgCtrlID(hwnd); - nm.flags = 0; - nm.hItem = (HANDLE)wParam; - SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) &nm); - } - dat->needsResort = TRUE; - PostMessage(hwnd, INTM_SORTCLC, 0, 1); + NMCLISTCONTROL nm; + nm.hdr.code = CLN_CONTACTMOVED; + nm.hdr.hwndFrom = hwnd; + nm.hdr.idFrom = GetDlgCtrlID(hwnd); + nm.flags = 0; + nm.hItem = (HANDLE)wParam; + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); } + dat->needsResort = TRUE; + PostMessage(hwnd, INTM_SORTCLC, 0, 1); + } goto LBL_Def; case INTM_ICONCHANGED: - { - int recalcScrollBar = 0; - HANDLE hContact = (HANDLE)wParam; - WORD status = ID_STATUS_OFFLINE; - int contactRemoved = 0; - HANDLE hSelItem = NULL; - ClcContact *selcontact = NULL; - - char *szProto = GetContactProto(hContact); - if (szProto == NULL) - status = ID_STATUS_OFFLINE; - else - status = cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); - - int shouldShow = (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || - !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 (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { - if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) - hSelItem = pcli->pfnContactToHItem(selcontact); - pcli->pfnAddContactToTree(hwnd, dat, hContact, 0, 0); - recalcScrollBar = 1; - FindItem(hwnd, dat, hContact, &contact, NULL, NULL); - if (contact) { - contact->iImage = (WORD)lParam; - pcli->pfnNotifyNewContact(hwnd, hContact); - } - } - } - else { - //item in list already - DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); - if (contact->iImage == (WORD)lParam) - break; - if ( !shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed - if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) - hSelItem = pcli->pfnContactToHItem(selcontact); - pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0); - contactRemoved = TRUE; - recalcScrollBar = 1; - } - else { + { + int recalcScrollBar = 0; + HCONTACT hContact = (HCONTACT)wParam; + WORD status = ID_STATUS_OFFLINE; + int contactRemoved = 0; + HCONTACT hSelItem = NULL; + ClcContact *selcontact = NULL; + + char *szProto = GetContactProto(hContact); + if (szProto == NULL) + status = ID_STATUS_OFFLINE; + else + status = cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); + + int shouldShow = (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || + !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 (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); + if (contact) { contact->iImage = (WORD)lParam; - if ( !pcli->pfnIsHiddenMode(dat, status)) - contact->flags |= CONTACTF_ONLINE; - else - contact->flags &= ~CONTACTF_ONLINE; + pcli->pfnNotifyNewContact(hwnd, hContact); } } - if (hSelItem) { - ClcGroup *selgroup; - if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) - dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*) & selgroup->cl, selcontact)); + } + else { + //item in list already + DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); + if (contact->iImage == (WORD)lParam) + break; + if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed + if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) + hSelItem = (HCONTACT)pcli->pfnContactToHItem(selcontact); + pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0); + contactRemoved = TRUE; + recalcScrollBar = 1; + } + else { + contact->iImage = (WORD)lParam; + if (!pcli->pfnIsHiddenMode(dat, status)) + contact->flags |= CONTACTF_ONLINE; else - dat->selection = -1; + contact->flags &= ~CONTACTF_ONLINE; } - dat->needsResort = TRUE; - PostMessage(hwnd, INTM_SORTCLC, 0, recalcScrollBar); - PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contactRemoved ? 0 : wParam)); - if (recalcScrollBar) - pcli->pfnRecalcScrollBar(hwnd, dat); } + if (hSelItem) { + ClcGroup *selgroup; + if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) + dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)& selgroup->cl, selcontact)); + else + dat->selection = -1; + } + dat->needsResort = TRUE; + PostMessage(hwnd, INTM_SORTCLC, 0, recalcScrollBar); + PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contactRemoved ? 0 : wParam)); + if (recalcScrollBar) + pcli->pfnRecalcScrollBar(hwnd, dat); + } goto LBL_Def; case INTM_METACHANGED: - if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; if (contact->bIsMeta && cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { - contact->hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) contact->hContact, 0); + contact->hSubContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)contact->hContact, 0); contact->metaProto = GetContactProto(contact->hSubContact); contact->iImage = pcli->pfnGetContactIcon(contact->hSubContact); if (contact->pExtra) { TExtraCache *pSub = cfg::getCache(contact->hSubContact, contact->metaProto); ClcContact *subContact; - if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE)contact->hSubContact, &subContact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)contact->hSubContact, &subContact, NULL, NULL)) break; contact->pExtra->proto_status_item = GetProtocolStatusItem(contact->metaProto); @@ -401,7 +402,7 @@ LBL_Def: goto LBL_Def; case INTM_METACHANGEDEVENT: - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; if (lParam == 0) SendMessage(hwnd, CLM_AUTOREBUILD, 0, 0); @@ -409,9 +410,9 @@ LBL_Def: case INTM_NAMECHANGED: ClcContact *contact; - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; - lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText)); + lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HCONTACT)wParam, 0), SIZEOF(contact->szText)); RTL_DetectAndSet(contact, 0); @@ -420,65 +421,65 @@ LBL_Def: goto LBL_Def; case INTM_CODEPAGECHANGED: - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; - contact->codePage = cfg::getDword((HANDLE)wParam, "Tab_SRMsg", "ANSIcodepage", cfg::getDword((HANDLE)wParam, "UserInfo", "ANSIcodepage", CP_ACP)); + contact->codePage = cfg::getDword((HCONTACT)wParam, "Tab_SRMsg", "ANSIcodepage", cfg::getDword((HCONTACT)wParam, "UserInfo", "ANSIcodepage", CP_ACP)); PostMessage(hwnd, INTM_INVALIDATE, 0, 0); goto LBL_Def; case INTM_AVATARCHANGED: - { - avatarCacheEntry *cEntry = (struct avatarCacheEntry *)lParam; - contact = NULL; - - if (wParam == 0) { - //RemoveFromImgCache(0, cEntry); - cfg::dat.bForceRefetchOnPaint = TRUE; - RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); - cfg::dat.bForceRefetchOnPaint = FALSE; - goto LBL_Def; - } + { + avatarCacheEntry *cEntry = (struct avatarCacheEntry *)lParam; + contact = NULL; + + if (wParam == 0) { + //RemoveFromImgCache(0, cEntry); + cfg::dat.bForceRefetchOnPaint = TRUE; + RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); + cfg::dat.bForceRefetchOnPaint = FALSE; + goto LBL_Def; + } - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) - return 0; - contact->ace = cEntry; - if (cEntry == NULL) - contact->cFlags &= ~ECF_AVATAR; - else { - DWORD dwFlags; + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + return 0; + contact->ace = cEntry; + if (cEntry == NULL) + contact->cFlags &= ~ECF_AVATAR; + else { + DWORD dwFlags; - if (contact->pExtra) - dwFlags = contact->pExtra->dwDFlags; - else - dwFlags = cfg::getDword(contact->hContact, "CList", "CLN_Flags", 0); - if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS) - contact->cFlags = (dwFlags & ECF_HIDEAVATAR ? contact->cFlags & ~ECF_AVATAR : contact->cFlags | ECF_AVATAR); - else - contact->cFlags = (dwFlags & ECF_FORCEAVATAR ? contact->cFlags | ECF_AVATAR : contact->cFlags & ~ECF_AVATAR); - } - PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact); + if (contact->pExtra) + dwFlags = contact->pExtra->dwDFlags; + else + dwFlags = cfg::getDword(contact->hContact, "CList", "CLN_Flags", 0); + if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS) + contact->cFlags = (dwFlags & ECF_HIDEAVATAR ? contact->cFlags & ~ECF_AVATAR : contact->cFlags | ECF_AVATAR); + else + contact->cFlags = (dwFlags & ECF_FORCEAVATAR ? contact->cFlags | ECF_AVATAR : contact->cFlags & ~ECF_AVATAR); } + PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact); + } goto LBL_Def; case INTM_STATUSMSGCHANGED: - { - TExtraCache *p; - char *szProto = NULL; - - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) - p = cfg::getCache((HANDLE)wParam, NULL); - else { - p = contact->pExtra; - szProto = contact->proto; - } - GetCachedStatusMsg(p, szProto); - PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0)); + { + TExtraCache *p; + char *szProto = NULL; + + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + p = cfg::getCache((HCONTACT)wParam, NULL); + else { + p = contact->pExtra; + szProto = contact->proto; } + GetCachedStatusMsg(p, szProto); + PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0)); + } goto LBL_Def; case INTM_STATUSCHANGED: - if ( FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { - WORD wStatus = cfg::getWord((HANDLE)wParam, contact->proto, "Status", ID_STATUS_OFFLINE); + if (FindItem(hwnd, dat, (HCONTACT)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; if (cfg::dat.bAvatarServiceAvail && contact->ace == NULL) @@ -490,12 +491,12 @@ LBL_Def: break; case INTM_PROTOCHANGED: - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; - contact->proto = GetContactProto((HANDLE)wParam); + contact->proto = GetContactProto((HCONTACT)wParam); CallService(MS_CLIST_INVALIDATEDISPLAYNAME, wParam, 0); - lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText)); + lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HCONTACT)wParam, 0), SIZEOF(contact->szText)); RTL_DetectAndSet(contact, 0); @@ -504,7 +505,7 @@ LBL_Def: goto LBL_Def; case INTM_INVALIDATE: - if ( !dat->bNeedPaint) { + if (!dat->bNeedPaint) { KillTimer(hwnd, TIMERID_PAINT); SetTimer(hwnd, TIMERID_PAINT, 100, NULL); dat->bNeedPaint = TRUE; @@ -512,13 +513,12 @@ LBL_Def: goto LBL_Def; case INTM_INVALIDATECONTACT: - { - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) - break; - - if (contact == 0 || group == 0) - break; + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL)) + break; + if (contact == 0 || group == 0) + break; + { int iItem = pcli->pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*) & group->cl, contact)); pcli->pfnInvalidateItem(hwnd, dat, iItem); } @@ -538,14 +538,14 @@ LBL_Def: goto LBL_Def; case INTM_IDLECHANGED: - if ( FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { + if (FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; char *szProto = (char*)cws->szModule; if (szProto == NULL) break; contact->flags &= ~CONTACTF_IDLE; - if (cfg::getDword((HANDLE)wParam, szProto, "IdleTS", 0)) { + if (cfg::getDword((HCONTACT)wParam, szProto, "IdleTS", 0)) { contact->flags |= CONTACTF_IDLE; } PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact); @@ -557,14 +557,14 @@ LBL_Def: { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; char *szProto = (char *)cws->szModule; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; TExtraCache *p; if (!FindItem(hwnd, dat, 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)) { - HANDLE hMasterContact = (HANDLE)cfg::getDword(hContact, cfg::dat.szMetaName, "Handle", 0); + HCONTACT hMasterContact = (HCONTACT)cfg::getDword(hContact, cfg::dat.szMetaName, "Handle", 0); if (hMasterContact && hMasterContact != hContact) // avoid recursive call of settings handler cfg::writeByte(hMasterContact, cfg::dat.szMetaName, "XStatusId", (BYTE)cfg::getByte(hContact, szProto, "XStatusId", 0)); diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 7b26c3cefc..4f01d00972 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -24,12 +24,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -extern int ( *saveAddContactToGroup )(struct ClcData *dat, ClcGroup *group, HANDLE hContact); +extern int ( *saveAddContactToGroup )(struct ClcData *dat, ClcGroup *group, HCONTACT hContact); extern int ( *saveAddInfoItemToGroup )(ClcGroup *group, int flags, const TCHAR *pszText); extern ClcGroup* ( *saveRemoveItemFromGroup )(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount); extern ClcGroup* ( *saveAddGroup )(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers); -static void TZ_LoadTimeZone(HANDLE hContact, struct TExtraCache *c, const char *szProto); +static void TZ_LoadTimeZone(HCONTACT hContact, struct TExtraCache *c, const char *szProto); //routines for managing adding/removal of items in the list, including sorting @@ -92,7 +92,7 @@ void LoadAvatarForContact(ClcContact *p) p->cFlags &= ~ECF_AVATAR; } -int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact) +int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HCONTACT hContact) { int i = saveAddContactToGroup(dat, group, hContact); ClcContact* p = group->cl.items[i]; @@ -105,7 +105,7 @@ int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact) else p->bIsMeta = FALSE; if (p->bIsMeta && cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { - p->hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) hContact, 0); + p->hSubContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); p->metaProto = GetContactProto(p->hSubContact); p->iImage = pcli->pfnGetContactIcon(p->hSubContact); } @@ -163,7 +163,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) } } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (style & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus(hContact, NULL, dat)) { ZeroMemory((void *)&dbv, sizeof(dbv)); if (cfg::getTString(hContact, "CList", "Group", &dbv)) @@ -228,7 +228,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) return 0; p->bStatusMsgValid = STATUSMSG_NOTFOUND; - HANDLE hContact = p->hContact; + HCONTACT hContact = p->hContact; int result = cfg::getTString(hContact, "CList", "StatusMsg", &dbv); if ( !result && lstrlen(dbv.ptszVal) > 1) @@ -322,14 +322,14 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) * differences. */ -static void TZ_LoadTimeZone(HANDLE hContact, struct TExtraCache *c, const char *szProto) +static void TZ_LoadTimeZone(HCONTACT hContact, struct TExtraCache *c, const char *szProto) { DWORD flags = 0; if (cfg::dat.bShowLocalTimeSelective) flags |= TZF_DIFONLY; c->hTimeZone = tmi.createByContact(hContact, flags); } -void ReloadExtraInfo(HANDLE hContact) +void ReloadExtraInfo(HCONTACT hContact) { if (hContact && pcli->hwndContactTree) { TExtraCache *p = cfg::getCache(hContact, NULL); @@ -347,7 +347,7 @@ void ReloadExtraInfo(HANDLE hContact) */ -void RTL_DetectAndSet(ClcContact *contact, HANDLE hContact) +void RTL_DetectAndSet(ClcContact *contact, HCONTACT hContact) { WORD infoTypeC2[12]; int i; @@ -425,7 +425,7 @@ void GetExtendedInfo(ClcContact *contact, ClcData *dat) void LoadSkinItemToCache(TExtraCache *cEntry, const char *szProto) { - HANDLE hContact = cEntry->hContact; + HCONTACT hContact = cEntry->hContact; if (cfg::getByte(hContact, "EXTBK", "VALID", 0)) { if (cEntry->status_item == NULL) @@ -462,7 +462,7 @@ void LoadSkinItemToCache(TExtraCache *cEntry, const char *szProto) * also cares about sub contacts (if meta is active) */ -int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struct ClcData *dat) +int __fastcall CLVM_GetContactHiddenStatus(HCONTACT hContact, char *szProto, struct ClcData *dat) { int dbHidden = cfg::getByte(hContact, "CList", "Hidden", 0); // default hidden state, always respect it. int filterResult = 1; diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp index da02231308..def28802ac 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, (HANDLE)wParam, &contact, &group, NULL)) + if (wParam == 0 || !FindItem(hwnd, dat, (HCONTACT)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, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)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, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)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, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) return 0; diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index ef42eab6bd..dd9870e7e4 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -29,7 +29,7 @@ static HWND hwndEventFrame = 0; HFONT __fastcall ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHeight); extern struct CListEvent* ( *saveAddEvent )(CLISTEVENT *cle); -extern int ( *saveRemoveEvent )(HANDLE hContact, HANDLE hDbEvent); +extern int ( *saveRemoveEvent )(HCONTACT hContact, HANDLE hDbEvent); extern FRAMEWND *wndFrameEventArea; extern HPEN g_hPenCLUIFrames; @@ -333,7 +333,7 @@ struct CListEvent* AddEvent(CLISTEVENT *cle) // wParam=(WPARAM)(HANDLE)hContact // lParam=(LPARAM)(HANDLE)hDbEvent // Returns 0 if the event was successfully removed, or nonzero if the event was not found -int RemoveEvent(HANDLE hContact, HANDLE hDbEvent) +int RemoveEvent(HCONTACT hContact, HANDLE hDbEvent) { HANDLE hItem; int i; diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index 2e3c9a8f39..a5d2ca8255 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -68,7 +68,7 @@ static HANDLE hWindowListIGN = 0; static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hWnd, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hWnd, GWLP_USERDATA); switch(msg) { case WM_INITDIALOG: @@ -78,7 +78,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA int pCaps; HWND hwndAdd; - hContact = (HANDLE)lParam; + hContact = (HCONTACT)lParam; SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)hContact); dwMask = cfg::getDword(hContact, "Ignore", "Mask1", 0); SendMessage(hWnd, WM_USER + 100, (WPARAM)hContact, dwMask); @@ -367,7 +367,7 @@ static INT_PTR SetContactIgnore(WPARAM wParam, LPARAM lParam) if (hWindowListIGN == 0) hWindowListIGN = WindowList_Create(); - hWnd = WindowList_Find(hWindowListIGN, (HANDLE)wParam); + hWnd = WindowList_Find(hWindowListIGN, (HCONTACT)wParam); if ( wParam ) { if ( hWnd == 0 ) CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_QUICKIGNORE), 0, IgnoreDialogProc, (LPARAM)wParam); diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index 8b23d00f02..2514716017 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -30,7 +30,7 @@ extern int RemoveEvent(WPARAM wParam, LPARAM lParam); int InitCustomMenus(void); void UninitCustomMenus(void); INT_PTR GetContactStatusMessage(WPARAM wParam, LPARAM lParam); -int EventsProcessContactDoubleClick(HANDLE hContact); +int EventsProcessContactDoubleClick(HCONTACT hContact); int SetHideOffline(WPARAM wParam, LPARAM lParam); extern HIMAGELIST hCListImages; @@ -44,9 +44,9 @@ static INT_PTR GetStatusMode(WPARAM wParam, LPARAM lParam) return(g_maxStatus == ID_STATUS_OFFLINE ? pcli->currentDesiredStatusMode : g_maxStatus); } -extern int ( *saveIconFromStatusMode )( const char *szProto, int status, HANDLE hContact ); +extern int ( *saveIconFromStatusMode )( const char *szProto, int status, HCONTACT hContact ); -int IconFromStatusMode(const char *szProto, int status, HANDLE hContact, HICON *phIcon) +int IconFromStatusMode(const char *szProto, int status, HCONTACT hContact, HICON *phIcon) { if (phIcon != NULL) *phIcon = NULL; @@ -55,7 +55,7 @@ int IconFromStatusMode(const char *szProto, int status, HANDLE hContact, HICON * int finalStatus; if (szProto != NULL && !strcmp(szProto, cfg::dat.szMetaName) && cfg::dat.bMetaAvail && hContact != 0 && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { - HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + HCONTACT hSubContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); szFinalProto = GetContactProto(hSubContact); finalStatus = (status == 0) ? (WORD) cfg::getWord(hSubContact, szFinalProto, "Status", ID_STATUS_OFFLINE) : status; hContact = hSubContact; diff --git a/plugins/Clist_nicer/src/clistopts.cpp b/plugins/Clist_nicer/src/clistopts.cpp index 3dac5426da..5517524a5f 100644 --- a/plugins/Clist_nicer/src/clistopts.cpp +++ b/plugins/Clist_nicer/src/clistopts.cpp @@ -39,7 +39,7 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP switch (msg) { case WM_USER+1: { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *) lParam; if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && lstrcmpiA(ws->szModule, "CList") == 0 && lstrcmpiA(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0); diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 9a3f756193..72a579d453 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -400,10 +400,10 @@ void ConfigureCLUIGeometry(int mode) * set the states of defined database action buttons (only if button is a toggle) */ -void SetDBButtonStates(HANDLE hPassedContact) +void SetDBButtonStates(HCONTACT hPassedContact) { ButtonItem *buttonItem = g_ButtonItems; - HANDLE hContact = 0, hFinalContact = 0; + HCONTACT hContact = 0, hFinalContact = 0; char *szModule, *szSetting; int sel = cfg::clcdat ? cfg::clcdat->selection : -1; ClcContact *contact = 0; @@ -714,7 +714,7 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) extern LRESULT(CALLBACK *saveContactListWndProc)(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); -static int ServiceParamsOK(ButtonItem *item, WPARAM *wParam, LPARAM *lParam, HANDLE hContact) +static int ServiceParamsOK(ButtonItem *item, WPARAM *wParam, LPARAM *lParam, HCONTACT hContact) { if (item->dwFlags & BUTTON_PASSHCONTACTW || item->dwFlags & BUTTON_PASSHCONTACTL || item->dwFlags & BUTTON_ISCONTACTDBACTION) { if (hContact == 0) @@ -1344,7 +1344,7 @@ skipbg: ButtonItem *item = g_ButtonItems; WPARAM wwParam = 0; LPARAM llParam = 0; - HANDLE hContact = 0; + HCONTACT hContact = 0; ClcContact *contact = 0; int sel = cfg::clcdat ? cfg::clcdat->selection : -1; int serviceFailure = FALSE; @@ -1378,7 +1378,7 @@ skipbg: BYTE *pValue; char *szModule = item->szModule; char *szSetting = item->szSetting; - HANDLE finalhContact = 0; + HCONTACT finalhContact = 0; if (item->dwFlags & BUTTON_ISCONTACTDBACTION || item->dwFlags & BUTTON_DBACTIONONCONTACT) { contactOK = ServiceParamsOK(item, &wwParam, &llParam, hContact); @@ -1400,17 +1400,15 @@ skipbg: } else pValue = item->bValuePush; - if (fDelete) { - //_DebugTraceA("delete value: %s, %s ON %d", szModule, szSetting, finalhContact); + if (fDelete) db_unset(finalhContact, szModule, szSetting); - } else { + else { switch (item->type) { case DBVT_BYTE: cfg::writeByte(finalhContact, szModule, szSetting, pValue[0]); break; case DBVT_WORD: cfg::writeWord(finalhContact, szModule, szSetting, *((WORD *)&pValue[0])); - //_DebugTraceA("set WORD value: %s, %s, %d ON %d", szModule, item->szSetting, *((WORD *)&pValue[0]), finalhContact); break; case DBVT_DWORD: cfg::writeDword(finalhContact, szModule, szSetting, *((DWORD *)&pValue[0])); diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 8e5e232b26..189471c5e1 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -52,7 +52,7 @@ void cfg::init() InitializeCriticalSection(&cachecs); } -DWORD cfg::getDword(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, DWORD uDefault = 0) +DWORD cfg::getDword(const HCONTACT hContact = 0, const char *szModule = 0, const char *szSetting = 0, DWORD uDefault = 0) { return((DWORD)db_get_dw(hContact, szModule, szSetting, uDefault)); } @@ -76,7 +76,7 @@ DWORD cfg::getDword(const char *szModule, const char *szSetting, DWORD uDefault) } -WORD cfg::getWord(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, WORD uDefault = 0) +WORD cfg::getWord(const HCONTACT hContact = 0, const char *szModule = 0, const char *szSetting = 0, WORD uDefault = 0) { return((WORD)db_get_w(hContact, szModule, szSetting, uDefault)); } @@ -102,7 +102,7 @@ WORD cfg::getWord(const char *szModule, const char *szSetting, WORD uDefault) /* * same for bytes now */ -int cfg::getByte(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, int uDefault = 0) +int cfg::getByte(const HCONTACT hContact = 0, const char *szModule = 0, const char *szSetting = 0, int uDefault = 0) { return(db_get_b(hContact, szModule, szSetting, uDefault)); } @@ -117,12 +117,12 @@ int cfg::getByte(const char *szModule, const char *szSetting, int uDefault) return(db_get_b(0, szModule, szSetting, uDefault)); } -INT_PTR cfg::getTString(const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) +INT_PTR cfg::getTString(const HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { return(db_get_ts(hContact, szModule, szSetting, dbv)); } -INT_PTR cfg::getString(const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) +INT_PTR cfg::getString(const HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { return(db_get_s(hContact, szModule, szSetting, dbv)); } @@ -131,7 +131,7 @@ INT_PTR cfg::getString(const HANDLE hContact, const char *szModule, const char * * writer functions */ -INT_PTR cfg::writeDword(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, DWORD value = 0) +INT_PTR cfg::writeDword(const HCONTACT hContact = 0, const char *szModule = 0, const char *szSetting = 0, DWORD value = 0) { return(db_set_dw(hContact, szModule, szSetting, value)); } @@ -141,7 +141,7 @@ INT_PTR cfg::writeDword(const char *szModule = 0, const char *szSetting = 0, DWO return(db_set_dw(0, szModule, szSetting, value)); } -INT_PTR cfg::writeWord(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, WORD value = 0) +INT_PTR cfg::writeWord(const HCONTACT hContact = 0, const char *szModule = 0, const char *szSetting = 0, WORD value = 0) { return(db_set_w(hContact, szModule, szSetting, value)); } @@ -151,7 +151,7 @@ INT_PTR cfg::writeWord(const char *szModule = 0, const char *szSetting = 0, WORD return(db_set_w(0, szModule, szSetting, value)); } -INT_PTR cfg::writeByte(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, BYTE value = 0) +INT_PTR cfg::writeByte(const HCONTACT hContact = 0, const char *szModule = 0, const char *szSetting = 0, BYTE value = 0) { return(db_set_b(hContact, szModule, szSetting, value)); } @@ -161,17 +161,17 @@ INT_PTR cfg::writeByte(const char *szModule = 0, const char *szSetting = 0, BYTE return(db_set_b(0, szModule, szSetting, value)); } -INT_PTR cfg::writeTString(const HANDLE hContact, const char *szModule = 0, const char *szSetting = 0, const TCHAR *str = 0) +INT_PTR cfg::writeTString(const HCONTACT hContact, const char *szModule = 0, const char *szSetting = 0, const TCHAR *str = 0) { return(db_set_ts(hContact, szModule, szSetting, str)); } -INT_PTR cfg::writeString(const HANDLE hContact, const char *szModule = 0, const char *szSetting = 0, const char *str = 0) +INT_PTR cfg::writeString(const HCONTACT hContact, const char *szModule = 0, const char *szSetting = 0, const char *str = 0) { return(db_set_s(hContact, szModule, szSetting, str)); } -TExtraCache* cfg::getCache(const HANDLE hContact, const char *szProto) +TExtraCache* cfg::getCache(const HCONTACT hContact, const char *szProto) { int idx = cfg::arCache.getIndex((TExtraCache*)&hContact); if (idx != -1) diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index c379979a79..88d2defe08 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -39,7 +39,7 @@ struct { {ID_STATUS_OUTTOLUNCH,425} }; -static int GetContactStatus(HANDLE hContact) +static int GetContactStatus(HCONTACT hContact) { char *szProto; @@ -61,7 +61,7 @@ int __forceinline GetStatusModeOrdering(int statusMode) int mf_updatethread_running = TRUE; HANDLE hThreadMFUpdate = 0; -static void MF_CalcFrequency(HANDLE hContact, DWORD dwCutoffDays, int doSleep) +static void MF_CalcFrequency(HCONTACT hContact, DWORD dwCutoffDays, int doSleep) { DWORD curTime = time(NULL); DWORD frequency, eventCount; @@ -109,7 +109,7 @@ void MF_UpdateThread(LPVOID) ResetEvent(hEvent); while(mf_updatethread_running) { - for (HANDLE hContact = db_find_first(); hContact && mf_updatethread_running; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact && mf_updatethread_running; hContact = db_find_next(hContact)) { MF_CalcFrequency(hContact, 50, 1); if (mf_updatethread_running) WaitForSingleObject(hEvent, 5000); @@ -140,7 +140,7 @@ void LoadContactTree(void) hideOffline = cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { status = GetContactStatus(hContact); if ((!hideOffline || status != ID_STATUS_OFFLINE) && !CLVM_GetContactHiddenStatus(hContact, NULL, NULL)) pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(GetContactProto(hContact), status, hContact, NULL), 1); @@ -162,7 +162,7 @@ void LoadContactTree(void) CallService(MS_CLUI_LISTENDREBUILD, 0, 0); } -DWORD INTSORT_GetLastMsgTime(HANDLE hContact) +DWORD INTSORT_GetLastMsgTime(HCONTACT hContact) { HANDLE hDbEvent = db_event_last(hContact); while(hDbEvent) { diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index d72f0ec13d..0ed8a12036 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -1261,7 +1261,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) } if (items) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *szProto = GetContactProto(hContact); if (szProto == NULL) continue; diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index b657100533..683c2fd72f 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -57,8 +57,8 @@ int ClcShutdown(WPARAM wParam, LPARAM lParam); void (*saveLoadClcOptions)(HWND hwnd, struct ClcData *dat); void LoadClcOptions(HWND hwnd, struct ClcData *dat); -int (*saveAddContactToGroup)(struct ClcData *dat, ClcGroup *group, HANDLE hContact); -int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact); +int (*saveAddContactToGroup)(struct ClcData *dat, ClcGroup *group, HCONTACT hContact); +int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HCONTACT hContact); CListEvent* (*saveAddEvent)(CLISTEVENT *cle); CListEvent* AddEvent(CLISTEVENT *cle); @@ -75,13 +75,13 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT message, WPARAM wParam, LPAR LRESULT (CALLBACK *saveContactListControlWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -int (*saveIconFromStatusMode)(const char *szProto, int status, HANDLE hContact); +int (*saveIconFromStatusMode)(const char *szProto, int status, HCONTACT hContact); LRESULT(*saveProcessExternalMessages)(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); -int (*saveRemoveEvent)(HANDLE hContact, HANDLE hDbEvent); -int RemoveEvent(HANDLE hContact, HANDLE hDbEvent); +int (*saveRemoveEvent)(HCONTACT hContact, HANDLE hDbEvent); +int RemoveEvent(HCONTACT hContact, HANDLE hDbEvent); INT_PTR (*saveTrayIconProcessMessage)(WPARAM wParam, LPARAM lParam); INT_PTR TrayIconProcessMessage(WPARAM wParam, LPARAM lParam); @@ -194,7 +194,7 @@ static int systemModulesLoaded(WPARAM wParam, LPARAM lParam) return 0; } -static int fnIconFromStatusMode(const char* szProto, int status, HANDLE hContact) +static int fnIconFromStatusMode(const char* szProto, int status, HCONTACT hContact) { return IconFromStatusMode(szProto, status, hContact, NULL); } diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index db08996df5..c189db26bb 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -120,7 +120,7 @@ static void ShowPage(HWND hwnd, int page) } } -static int UpdateClistItem(HANDLE hContact, DWORD mask) +static int UpdateClistItem(HCONTACT hContact, DWORD mask) { for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hContact, MAKELONG(i - ID_STATUS_OFFLINE, @@ -141,24 +141,21 @@ static DWORD GetMaskForItem(HANDLE hItem) static void UpdateStickies() { - HANDLE hItem; - int i; - - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + HCONTACT hItem = (HCONTACT)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, cfg::getByte(hContact, "CLVM", g_szModename, 0) ? 1 : 0); DWORD localMask = HIWORD(cfg::getDword(hContact, "CLVM", g_szModename, 0)); UpdateClistItem(hItem, (localMask == 0 || localMask == stickyStatusMask) ? stickyStatusMask : localMask); } - for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) + for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hInfoItem, MAKELONG(i - ID_STATUS_OFFLINE, (1 << (i - ID_STATUS_OFFLINE)) & stickyStatusMask ? i - ID_STATUS_OFFLINE : ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1)); - hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETNEXTITEM,CLGN_ROOT,0); + HANDLE hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETNEXTITEM, CLGN_ROOT, 0); hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST,CLM_GETNEXTITEM,CLGN_NEXTGROUP, (LPARAM)hItem); while(hItem) { - for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) + for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELONG(i - ID_STATUS_OFFLINE, nullImage)); hItem=(HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem); } @@ -396,7 +393,7 @@ void SaveState() SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szModeName); dwGlobalMask = GetMaskForItem(hInfoItem); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) { if (SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) { @@ -675,7 +672,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); SetWindowTextA(hwndSelector, Translate("No view mode")); } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if (cfg::getDword(hContact, "CLVM", szBuf, -1) != -1) cfg::writeDword(hContact, "CLVM", szBuf, 0); @@ -721,7 +718,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP } case IDC_CLEARALL: { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 0); diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index cb9e8d17d8..c99ef5dc06 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -1066,13 +1066,13 @@ void HandleCallServiceCommand(PCommand command, TArgument *argv, int argc, PRepl } -HANDLE ParseContactParam(char *contact) +HCONTACT ParseContactParam(char *contact) { char name[512]; char account[128]; char protocol[128]; char *p = strrchr(contact, ':'); - HANDLE hContact = NULL; + HCONTACT hContact = NULL; if (p) { *p = 0; @@ -1099,7 +1099,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re int i; char *contact; char buffer[1024]; - HANDLE hContact; + HCONTACT hContact; HANDLE hProcess = NULL; ACKDATA *ack = NULL; for (i = 2; i < argc - 1; i++) @@ -1675,7 +1675,7 @@ void HandleProxyCommand(PCommand command, TArgument *argv, int argc, PReply repl } } -int ContactMatchSearch(HANDLE hContact, char *contact, char *id, char *account, TArgument *argv, int argc) +int ContactMatchSearch(HCONTACT hContact, char *contact, char *id, char *account, TArgument *argv, int argc) { int matches = 1; int i; @@ -1757,7 +1757,7 @@ int ContactMatchSearch(HANDLE hContact, char *contact, char *id, char *account, DWORD WINAPI OpenMessageWindowThread(void *data) { - HANDLE hContact = (HANDLE) data; + HCONTACT hContact = (HCONTACT) data; if (hContact) { CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM) hContact, 0); @@ -1780,7 +1780,7 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r int count = 0; reply->code = MIMRES_SUCCESS; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { GetContactProto(hContact, protocol, sizeof(protocol)); char *contact = GetContactName(hContact, protocol); @@ -1821,7 +1821,7 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r reply->code = MIMRES_SUCCESS; *reply->message = 0; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { GetContactProto(hContact, protocol, sizeof(protocol)); char *contact = GetContactName(hContact, protocol); @@ -1840,7 +1840,7 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r reply->code = MIMRES_SUCCESS; *reply->message = 0; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hUnreadEvent = db_event_firstUnread(hContact); if (hUnreadEvent != NULL) { DWORD threadID; @@ -1916,7 +1916,7 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re reply->code = MIMRES_SUCCESS; mir_snprintf(reply->message, reply->cMessage, Translate("No unread messages found.")); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hEvent = db_event_firstUnread(hContact); if (hEvent != NULL) { count = 0; @@ -1958,7 +1958,7 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re case 4: { char *contact = argv[3]; - HANDLE hContact = ParseContactParam(contact); + HCONTACT hContact = ParseContactParam(contact); if (hContact) { if (_stricmp(cmd, "unread") == 0) @@ -1993,7 +1993,7 @@ void HandleHistoryCommand(PCommand command, TArgument *argv, int argc, PReply re case 6: { char *contact = argv[3]; - HANDLE hContact = ParseContactParam(contact); + HCONTACT hContact = ParseContactParam(contact); if (hContact) { @@ -2139,7 +2139,7 @@ void HandleIgnoreCommand(PCommand command, TArgument *argv, int argc, PReply rep return; } - HANDLE hContact = NULL; + HCONTACT hContact = NULL; char *contact; for (int i = 3; i < argc; i++) diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp index f7f08be649..5376dfed3d 100644 --- a/plugins/CmdLine/src/utils.cpp +++ b/plugins/CmdLine/src/utils.cpp @@ -123,7 +123,7 @@ void HexToBin(char *inData, ULONG &size, LPBYTE &outData) i = size; } -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, char *szError, char *szResult, size_t size) +int GetStringFromDatabase(HCONTACT hContact, char *szModule, char *szSettingName, char *szError, char *szResult, size_t size) { DBVARIANT dbv = {0}; int res = 1; @@ -154,7 +154,7 @@ int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, return res; } -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count) +int GetStringFromDatabase(HCONTACT hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count) { DBVARIANT dbv = {0}; int res = 1; @@ -202,7 +202,7 @@ int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, } #pragma warning (disable: 4312) -TCHAR *GetContactName(HANDLE hContact, char *szProto) +TCHAR *GetContactName(HCONTACT hContact, char *szProto) { CONTACTINFO ctInfo; INT_PTR ret; @@ -244,14 +244,14 @@ TCHAR *GetContactName(HANDLE hContact, char *szProto) #pragma warning (default: 4312) #pragma warning (disable: 4312) -void GetContactProto(HANDLE hContact, char *szProto, size_t size) +void GetContactProto(HCONTACT hContact, char *szProto, size_t size) { GetStringFromDatabase(hContact, "Protocol", "p", NULL, szProto, size); } #pragma warning (default: 4312) #pragma warning (disable: 4312) -TCHAR *GetContactID(HANDLE hContact) +TCHAR *GetContactID(HCONTACT hContact) { char protocol[256]; GetContactProto(hContact, protocol, sizeof(protocol)); @@ -259,7 +259,7 @@ TCHAR *GetContactID(HANDLE hContact) return GetContactID(hContact, protocol); } -TCHAR *GetContactID(HANDLE hContact, char *szProto) +TCHAR *GetContactID(HCONTACT hContact, char *szProto) { CONTACTINFO ctInfo; INT_PTR ret; @@ -326,14 +326,14 @@ TCHAR *GetContactID(HANDLE hContact, char *szProto) #pragma warning (default: 4312) #pragma warning (disable: 4312) -HANDLE GetContactFromID(TCHAR *szID, char *szProto) +HCONTACT GetContactFromID(TCHAR *szID, char *szProto) { TCHAR dispName[1024]; char cProtocol[256]; char *tmp; int found = 0; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { GetContactProto(hContact, cProtocol, sizeof(cProtocol)); TCHAR *szHandle = GetContactID(hContact, cProtocol); @@ -353,7 +353,7 @@ HANDLE GetContactFromID(TCHAR *szID, char *szProto) #pragma warning (default: 4312) #pragma warning (disable: 4312) -HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto) +HCONTACT GetContactFromID(TCHAR *szID, wchar_t *szProto) { char protocol[1024]; WideCharToMultiByte(CP_ACP, 0, szProto, -1, protocol, sizeof(protocol), NULL, NULL); diff --git a/plugins/CmdLine/src/utils.h b/plugins/CmdLine/src/utils.h index 5729528f04..73d92eff93 100644 --- a/plugins/CmdLine/src/utils.h +++ b/plugins/CmdLine/src/utils.h @@ -43,17 +43,17 @@ void ScreenToClient(HWND hWnd, LPRECT rect); void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors); RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors); -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, char *szError, char *szResult, size_t size); -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count); +int GetStringFromDatabase(HCONTACT hContact, char *szModule, char *szSettingName, char *szError, char *szResult, size_t size); +int GetStringFromDatabase(HCONTACT hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count); int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, size_t size); int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, size_t count); -TCHAR *GetContactName(HANDLE hContact, char *szProto); -TCHAR *GetContactID(HANDLE hContact); -TCHAR *GetContactID(HANDLE hContact, char *szProto); -HANDLE GetContactFromID(TCHAR *szID, char *szProto); -HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto); -void GetContactProto(HANDLE hContact, char *szProto, size_t size); +TCHAR *GetContactName(HCONTACT hContact, char *szProto); +TCHAR *GetContactID(HCONTACT hContact); +TCHAR *GetContactID(HCONTACT hContact, char *szProto); +HCONTACT GetContactFromID(TCHAR *szID, char *szProto); +HCONTACT GetContactFromID(TCHAR *szID, wchar_t *szProto); +void GetContactProto(HCONTACT hContact, char *szProto, size_t size); int MyPUShowMessage(char *lpzText, BYTE kind); diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index 4fca1e528a..e412ac2200 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -893,7 +893,7 @@ extern "C" int __declspec(dllexport) Load(void) CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); //set all contacts to offline - for (HANDLE hContact = db_find_first(PLUGINNAME); hContact != NULL; hContact = db_find_next(hContact,PLUGINNAME)) + for (HCONTACT hContact = db_find_first(PLUGINNAME); hContact != NULL; hContact = db_find_next(hContact,PLUGINNAME)) db_set_w(hContact,PLUGINNAME,"status",ID_STATUS_OFFLINE); mir_snprintf(service,sizeof(service), "%s%s", PLUGINNAME, PS_GETCAPS); diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index 7b20a0ace1..5d42d3db9c 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -59,7 +59,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) static int HookDBEventAdded(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HANDLE hDbEvent = (HANDLE)lParam; //process the event DBEVENTINFO dbe = { sizeof(dbe) }; @@ -92,7 +92,7 @@ static int HookDBEventAdded(WPARAM wParam, LPARAM lParam) static void ProcessUnreadEvents(void) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hDbEvent = db_event_firstUnread(hContact); while (hDbEvent) { DBEVENTINFO dbei = { sizeof(dbei) }; @@ -117,7 +117,7 @@ static bool CheckContactsServiceSupport(const char* szProto) static int HookPreBuildContactMenu(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; char *szProto = GetContactProto(hContact); int bVisible = FALSE; @@ -156,7 +156,7 @@ static int HookModulesLoaded(WPARAM wParam, LPARAM lParam) static int HookContactSettingChanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (strcmpnull(cws->szModule, "CList") && strcmpnull(cws->szModule, szProto)) return 0; @@ -167,24 +167,21 @@ static int HookContactSettingChanged(WPARAM wParam, LPARAM lParam) static int HookContactDeleted(WPARAM wParam, LPARAM lParam) { // if our contact gets deleted close his window - HWND h = WindowList_Find(ghSendWindowList, (HANDLE)wParam); + HWND h = WindowList_Find(ghSendWindowList, (HCONTACT)wParam); if (h) - { SendMessage(h, WM_CLOSE, 0, 0); - } - while (h = WindowList_Find(ghRecvWindowList, (HANDLE)wParam)) - { // since we hack the window list - more windows for one contact, we need to close them all + // since we hack the window list - more windows for one contact, we need to close them all + while (h = WindowList_Find(ghRecvWindowList, (HCONTACT)wParam)) SendMessage(h, WM_CLOSE, 0, 0); - } return 0; } static INT_PTR ServiceSendCommand(WPARAM wParam, LPARAM lParam) { //find window for hContact - HWND hWnd = WindowList_Find(ghSendWindowList, (HANDLE)wParam); + HWND hWnd = WindowList_Find(ghSendWindowList, (HCONTACT)wParam); if (!hWnd) CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SEND), NULL, SendDlgProc, wParam); else { diff --git a/plugins/ContactsPlus/src/receive.cpp b/plugins/ContactsPlus/src/receive.cpp index 5e61067781..02c219edba 100644 --- a/plugins/ContactsPlus/src/receive.cpp +++ b/plugins/ContactsPlus/src/receive.cpp @@ -25,7 +25,7 @@ /* TRecvContactsData */ -TRecvContactsData::TRecvContactsData(HANDLE contact) +TRecvContactsData::TRecvContactsData(HCONTACT contact) { mhContact = contact; hHook = NULL; @@ -136,7 +136,7 @@ static void RebuildGroupCombo(HWND hwndDlg) } } -static HANDLE CreateTemporaryContactForItem(HWND hwndDlg, TRecvContactsData *wndData, int iItem) +static HCONTACT CreateTemporaryContactForItem(HWND hwndDlg, TRecvContactsData *wndData, int iItem) { TCHAR *caUIN = ListView_GetItemTextEx(GetDlgItem(hwndDlg, IDC_CONTACTS), iItem, 0); char *szProto = GetContactProto(wndData->mhContact); @@ -144,7 +144,7 @@ static HANDLE CreateTemporaryContactForItem(HWND hwndDlg, TRecvContactsData *wnd replaceStrT(wndData->haUin, caUIN); for (int j = 0; j < wndData->cbReceived; j++) if (!lstrcmp(wndData->maReceived[j]->mcaUIN, caUIN)) - return (HANDLE)CallProtoService(szProto, PS_ADDTOLISTBYEVENT, MAKEWPARAM(PALF_TEMPORARY, j), (LPARAM)wndData->mhDbEvent); + return (HCONTACT)CallProtoService(szProto, PS_ADDTOLISTBYEVENT, MAKEWPARAM(PALF_TEMPORARY, j), (LPARAM)wndData->mhDbEvent); return NULL; } @@ -162,7 +162,7 @@ void RecvListView_AddColumn(HWND hList, int nWidth, TCHAR *szTitle, int nItem) INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { TRecvContactsData *wndData = (TRecvContactsData*)GetWindowLongPtr(hwndDlg, DWLP_USER); - HANDLE hContact; + HCONTACT hContact; switch (msg) { case WM_INITDIALOG: @@ -317,7 +317,7 @@ INT_PTR CALLBACK RecvDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara for (int j = 0; j < wndData->cbReceived; j++) // determine item index in packet if (!lstrcmp(wndData->maReceived[j]->mcaUIN, caUIN)) { char *szProto =GetContactProto(wndData->mhContact); - hContact = (HANDLE)CallProtoService(szProto, PS_ADDTOLISTBYEVENT, MAKEWPARAM(0, j), (LPARAM)wndData->mhDbEvent); + hContact = (HCONTACT)CallProtoService(szProto, PS_ADDTOLISTBYEVENT, MAKEWPARAM(0, j), (LPARAM)wndData->mhDbEvent); if (hContact && caGroup) { // use newest group API if available if (ServiceExists(MS_CLIST_CONTACTCHANGEGROUP)) diff --git a/plugins/ContactsPlus/src/receive.h b/plugins/ContactsPlus/src/receive.h index dce1b023ac..1ad8eed542 100644 --- a/plugins/ContactsPlus/src/receive.h +++ b/plugins/ContactsPlus/src/receive.h @@ -43,21 +43,21 @@ struct TReceivedItem { struct TRecvContactsData { - TRecvContactsData(HANDLE contact); + TRecvContactsData(HCONTACT contact); ~TRecvContactsData(); - HANDLE mhDbEvent; // handle to recv DB event - HANDLE mhContact; // from whom we received this + HANDLE mhDbEvent; // handle to recv DB event + HCONTACT mhContact; // from whom we received this HIMAGELIST mhListIcon;// icons for listview - HMENU mhPopup; // popup menu for listview - HANDLE hHook; // hook to event - HANDLE rhSearch; // handle to uin-search - TCHAR* haUin; - int iPopupItem; + HMENU mhPopup; // popup menu for listview + HANDLE hHook; // hook to event + HANDLE rhSearch; // handle to uin-search + TCHAR* haUin; + int iPopupItem; TReceivedItem** maReceived;// received contacts - int cbReceived; + int cbReceived; TReceivedItem* AddReceivedItem(); - HICON hIcons[4]; // icons for dialog + HICON hIcons[4]; // icons for dialog }; extern HANDLE ghRecvWindowList; diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index beefc0aedf..d0a2c511a3 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -60,7 +60,7 @@ void TSendProcessList::Remove(HANDLE hProcc) /* TSendContactsData */ -TSendContactsData::TSendContactsData(HANDLE contact) : uacklist() +TSendContactsData::TSendContactsData(HCONTACT contact) : uacklist() { hContact = contact; hHook = NULL; @@ -107,14 +107,14 @@ void TSendContactsData::ClearContacts() nContacts = 0; } -void TSendContactsData::AddContact(HANDLE hContact) +void TSendContactsData::AddContact(HCONTACT hContact) { - aContacts = (HANDLE*)mir_realloc(aContacts, (nContacts + 1)*sizeof(HANDLE)); + aContacts = (HCONTACT*)mir_realloc(aContacts, (nContacts + 1)*sizeof(HCONTACT)); aContacts[nContacts] = hContact; nContacts++; } -int TSendContactsData::SendContactsPacket(HWND hwndDlg, HANDLE *phContacts, int nContacts) +int TSendContactsData::SendContactsPacket(HWND hwndDlg, HCONTACT *phContacts, int nContacts) { HANDLE hProcc = (HANDLE)CallContactService(hContact, PSS_CONTACTS, MAKEWPARAM(0, nContacts), (LPARAM)phContacts); if (!hProcc) { @@ -126,8 +126,8 @@ int TSendContactsData::SendContactsPacket(HWND hwndDlg, HANDLE *phContacts, int TAckData *ackData = gaAckData.Add(hProcc, new TAckData(hContact)); uacklist.Add(hProcc); ackData->nContacts = nContacts; - ackData->aContacts = (HANDLE*)mir_alloc(nContacts*sizeof(HANDLE)); - memmove(ackData->aContacts, phContacts, nContacts*sizeof(HANDLE)); // copy the array of hContact for ack array + ackData->aContacts = (HCONTACT*)mir_alloc(nContacts*sizeof(HCONTACT)); + memmove(ackData->aContacts, phContacts, nContacts*sizeof(HCONTACT)); // copy the array of hContact for ack array EnableDlgItem(hwndDlg, IDOK, FALSE); EnableDlgItem(hwndDlg, IDC_LIST, FALSE); return TRUE; // Success @@ -179,12 +179,12 @@ static void ResetListOptions(HWND hwndList) } } -static HANDLE FindNextClistContact(HWND hList, HANDLE hContact, HANDLE *phItem) +static HCONTACT FindNextClistContact(HWND hList, HCONTACT hContact, HCONTACT *phItem) { - HANDLE hNextContact = db_find_next(hContact); - HANDLE hNextItem = NULL; + HCONTACT hNextContact = db_find_next(hContact); + HCONTACT hNextItem = NULL; - while (hNextContact && !(hNextItem = (HANDLE)SendMessage(hList, CLM_FINDCONTACT, (WPARAM)hNextContact, 0))) + while (hNextContact && !(hNextItem = (HCONTACT)SendMessage(hList, CLM_FINDCONTACT, (WPARAM)hNextContact, 0))) hNextContact = db_find_next(hNextContact); if (phItem) @@ -194,10 +194,10 @@ static HANDLE FindNextClistContact(HWND hList, HANDLE hContact, HANDLE *phItem) } -static HANDLE FindFirstClistContact(HWND hList, HANDLE *phItem) +static HCONTACT FindFirstClistContact(HWND hList, HCONTACT *phItem) { - HANDLE hContact = db_find_first(); - HANDLE hItem = (HANDLE)SendMessage(hList, CLM_FINDCONTACT, (WPARAM)hContact, 0); + HCONTACT hContact = db_find_first(); + HCONTACT hItem = (HCONTACT)SendMessage(hList, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hContact && !hItem) return FindNextClistContact(hList, hContact, phItem); @@ -211,7 +211,7 @@ static HANDLE FindFirstClistContact(HWND hList, HANDLE *phItem) bool binListEvent = FALSE; -static void SetAllContactChecks(HWND hwndList, HANDLE hReceiver) // doubtful name +static void SetAllContactChecks(HWND hwndList, HCONTACT hReceiver) // doubtful name { if (binListEvent) return; @@ -226,7 +226,7 @@ static void SetAllContactChecks(HWND hwndList, HANDLE hReceiver) // doubtful nam else SendMessage(hwndList, CLM_SETHIDEEMPTYGROUPS, (WPARAM)FALSE, 0); - HANDLE hItem, hContact = FindFirstClistContact(hwndList, &hItem); + HCONTACT hItem, hContact = FindFirstClistContact(hwndList, &hItem); while (hContact) { char* szProto2 = GetContactProto(hContact); @@ -251,9 +251,9 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara TranslateDialogDefault(hwndDlg); SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_CONTACTS))); ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST)); - SetAllContactChecks(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)lParam); - WindowList_Add(ghSendWindowList, hwndDlg, (HANDLE)lParam); - wndData = new TSendContactsData((HANDLE)lParam); + SetAllContactChecks(GetDlgItem(hwndDlg, IDC_LIST), (HCONTACT)lParam); + WindowList_Add(ghSendWindowList, hwndDlg, (HCONTACT)lParam); + wndData = new TSendContactsData((HCONTACT)lParam); SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG)wndData); // new dlg init wndData->hIcons[0] = InitMButton(hwndDlg, IDC_ADD, MAKEINTRESOURCEA(IDI_ADDCONTACT), LPGEN("Add Contact Permanently to List")); @@ -342,7 +342,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara switch (LOWORD(wParam)) { case IDOK: if (IsWindowEnabled(GetDlgItem(hwndDlg, IDOK))) { - HANDLE hContact, hItem; + HCONTACT hContact, hItem; wndData->ClearContacts(); // do not include contacts twice HWND hList = GetDlgItem(hwndDlg, IDC_LIST); @@ -370,7 +370,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara { // select all contacts HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST); - HANDLE hItem, hContact = FindFirstClistContact(hwndList, &hItem); + HCONTACT hItem, hContact = FindFirstClistContact(hwndList, &hItem); while (hContact) { SendMessage(hwndList, CLM_SETCHECKMARK, (WPARAM)hItem, 1); hContact = FindNextClistContact(hwndList, hContact, &hItem); diff --git a/plugins/ContactsPlus/src/send.h b/plugins/ContactsPlus/src/send.h index 73908b4ecf..8a8c1250ed 100644 --- a/plugins/ContactsPlus/src/send.h +++ b/plugins/ContactsPlus/src/send.h @@ -53,27 +53,27 @@ struct TSendContactsData { // hope uack is released automaticly, static propert HANDLE hHook; // hook to event void HookProtoAck(HWND hwndDlg); void UnhookProtoAck(); - HANDLE* aContacts; // contacts to be sent + HCONTACT *aContacts; // contacts to be sent int nContacts; // now many UIDs shall we send? void ClearContacts(); - void AddContact(HANDLE hContact); - HANDLE hContact; // to whom shall we send? + void AddContact(HCONTACT hContact); + HCONTACT hContact; // to whom shall we send? TSendProcessList uacklist;// ackdata - necessary for errorbox HWND hError; // handle of error box, if any void ShowErrorDlg(HWND hwndDlg, char* szMsg, bool bAllowRetry); - int SendContactsPacket(HWND hwndDlg, HANDLE *phContacts, int nContacts); + int SendContactsPacket(HWND hwndDlg, HCONTACT *phContacts, int nContacts); int SendContacts(HWND hwndDlg); HICON hIcons[4]; // icons for dialog - TSendContactsData(HANDLE contact); + TSendContactsData(HCONTACT contact); ~TSendContactsData(); }; struct TAckData { - HANDLE hContact; // to whom was it sent - HANDLE* aContacts; // obj + HCONTACT hContact; // to whom was it sent + HCONTACT* aContacts; // obj int nContacts; // how many - TAckData(HANDLE contact) { hContact = contact; aContacts = NULL; nContacts = 0;}; + TAckData(HCONTACT contact) { hContact = contact; aContacts = NULL; nContacts = 0;}; ~TAckData() { mir_free(aContacts); } }; diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index b050c28f76..9b64ae65d5 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -55,7 +55,7 @@ char* __fastcall null_strdup(const char *string) return NULL; } -TCHAR* GetContactUID(HANDLE hContact) +TCHAR* GetContactUID(HCONTACT hContact) { char *szProto = GetContactProto(hContact); char *uid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); @@ -98,7 +98,7 @@ void DialogAddContactExecute(HWND hwndDlg, HANDLE hNewContact) } -void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, HANDLE hContact) +void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, HCONTACT hContact) { LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; @@ -114,7 +114,7 @@ void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, HANDLE hContact) } -void UpdateDialogTitle(HWND hwndDlg, HANDLE hContact, TCHAR *pszTitleStart) +void UpdateDialogTitle(HWND hwndDlg, HCONTACT hContact, TCHAR *pszTitleStart) { TCHAR newtitle[512]; lstrcpyn(newtitle, TranslateTS(pszTitleStart), SIZEOF(newtitle)); @@ -140,7 +140,7 @@ void UpdateDialogTitle(HWND hwndDlg, HANDLE hContact, TCHAR *pszTitleStart) } -void UpdateDialogAddButton(HWND hwndDlg, HANDLE hContact) +void UpdateDialogAddButton(HWND hwndDlg, HCONTACT hContact) { int bVisible = db_get_b(hContact, "CList", "NotOnList", 0); ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), bVisible ? SW_SHOW : SW_HIDE); @@ -159,7 +159,7 @@ HICON InitMButton(HWND hDlg, int idButton, LPCSTR szIcon, char *szTip) } -HICON LoadContactProtoIcon(HANDLE hContact) +HICON LoadContactProtoIcon(HCONTACT hContact) { char *szProto = GetContactProto(hContact); if (szProto) diff --git a/plugins/ContactsPlus/src/utils.h b/plugins/ContactsPlus/src/utils.h index ceffbe3502..4d633d0aa5 100644 --- a/plugins/ContactsPlus/src/utils.h +++ b/plugins/ContactsPlus/src/utils.h @@ -32,17 +32,17 @@ int __fastcall strcmpnull(const char *str1, const char *str2); void __fastcall strcpynull(char *str1, const char *str2); char* __fastcall null_strdup(const char *string); -TCHAR* GetContactUID(HANDLE hContact); +TCHAR* GetContactUID(HCONTACT hContact); -void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, HANDLE hContact); -void UpdateDialogTitle(HWND hwndDlg, HANDLE hContact, TCHAR *pszTitleStart); -void UpdateDialogAddButton(HWND hwndDlg, HANDLE hContact); +void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, HCONTACT hContact); +void UpdateDialogTitle(HWND hwndDlg, HCONTACT hContact, TCHAR *pszTitleStart); +void UpdateDialogAddButton(HWND hwndDlg, HCONTACT hContact); HICON InitMButton(HWND hDlg, int idButton, LPCSTR szIcon, char* szTip); void DialogAddContactExecute(HWND hwndDlg, HANDLE hNewContact); -HICON LoadContactProtoIcon(HANDLE hContact); +HICON LoadContactProtoIcon(HCONTACT hContact); void EnableDlgItem(HWND hwndDlg, UINT control, int state); diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp index b816872a73..141301a970 100644 --- a/plugins/CountryFlags/src/extraimg.cpp +++ b/plugins/CountryFlags/src/extraimg.cpp @@ -27,15 +27,15 @@ static HANDLE hServiceDetectContactOrigin; static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam) { int countryNumber = 0xFFFF; - char *pszProto = GetContactProto((HANDLE)wParam); + char *pszProto = GetContactProto((HCONTACT)wParam); /* ip detect */ if (bUseIpToCountry) - countryNumber = ServiceIpToCountry(db_get_dw((HANDLE)wParam,pszProto,"RealIP",0),0); + countryNumber = ServiceIpToCountry(db_get_dw((HCONTACT)wParam,pszProto,"RealIP",0),0); /* fallback */ if (countryNumber == 0xFFFF) - countryNumber = db_get_w((HANDLE)wParam,pszProto,"Country",0); + countryNumber = db_get_w((HCONTACT)wParam,pszProto,"Country",0); if (countryNumber == 0 || countryNumber == 0xFFFF) - countryNumber = db_get_w((HANDLE)wParam,pszProto,"CompanyCountry",0); + countryNumber = db_get_w((HCONTACT)wParam,pszProto,"CompanyCountry",0); return (countryNumber == 0) ? 0xFFFF : countryNumber; } @@ -45,7 +45,7 @@ static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam) static HANDLE hExtraIcon; -static void CALLBACK SetExtraImage(HANDLE hContact) +static void CALLBACK SetExtraImage(HCONTACT hContact) { if (!bShowExtraIcon) return; @@ -63,14 +63,14 @@ static void CALLBACK SetExtraImage(HANDLE hContact) // always call in context of main thread static void RemoveExtraImages(void) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) ExtraIcon_Clear(hExtraIcon, hContact); } // always call in context of main thread static void EnsureExtraImages(void) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) SetExtraImage(hContact); } @@ -87,7 +87,7 @@ void UpdateExtraImages() #define STATUSICON_REFRESHDELAY 100 /* time for which setting changes are buffered */ // always call in context of main thread -static void __fastcall SetStatusIcon(HANDLE hContact,int countryNumber) +static void __fastcall SetStatusIcon(HCONTACT hContact,int countryNumber) { StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULENAME; @@ -106,7 +106,7 @@ static void __fastcall SetStatusIcon(HANDLE hContact,int countryNumber) } // always call in context of main thread -static void __fastcall UnsetStatusIcon(HANDLE hContact) +static void __fastcall UnsetStatusIcon(HCONTACT hContact) { StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULENAME; @@ -167,7 +167,7 @@ static int ExtraImgSettingChanged(WPARAM wParam,LPARAM lParam) /* user details update */ if (!lstrcmpA(dbcws->szSetting,"RealIP") || !lstrcmpA(dbcws->szSetting,"Country") || !lstrcmpA(dbcws->szSetting,"CompanyCountry")) { /* Extra Image */ - SetExtraImage((HANDLE)wParam); + SetExtraImage((HCONTACT)wParam); /* Status Icon */ if (ServiceExists(MS_MSG_REMOVEICON)) CallFunctionBuffered(UpdateStatusIcons,0,FALSE,STATUSICON_REFRESHDELAY); diff --git a/plugins/CyrTranslit/src/MirandaContact.cpp b/plugins/CyrTranslit/src/MirandaContact.cpp index ca5b6532fd..ff6da97add 100644 --- a/plugins/CyrTranslit/src/MirandaContact.cpp +++ b/plugins/CyrTranslit/src/MirandaContact.cpp @@ -47,14 +47,14 @@ void MirandaContact::initialize() //------------------------------------------------------------------------------ -bool MirandaContact::bIsActive(HANDLE hContact) +bool MirandaContact::bIsActive(HCONTACT hContact) { return db_get_b(hContact, SETTINGS_MODULE, SETTING_SHOULD_TRANSLITERATE, 0) != 0; } //------------------------------------------------------------------------------ -void MirandaContact::save(HANDLE hContact, bool bValue) +void MirandaContact::save(HCONTACT hContact, bool bValue) { db_set_b(hContact, SETTINGS_MODULE, SETTING_SHOULD_TRANSLITERATE, bValue); } @@ -80,7 +80,7 @@ void MirandaContact::addMenuItem() INT_PTR MirandaContact::onMenuCommandTransliterate(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(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; - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(wParam); if (!CallService(MS_DB_CONTACT_IS, wParam, 0)) return 0; CLISTMENUITEM mi = { sizeof(mi) }; diff --git a/plugins/CyrTranslit/src/MirandaContact.h b/plugins/CyrTranslit/src/MirandaContact.h index f6e3d558e0..cad1b7f516 100644 --- a/plugins/CyrTranslit/src/MirandaContact.h +++ b/plugins/CyrTranslit/src/MirandaContact.h @@ -42,14 +42,14 @@ public: * @param hContact The handle of the contact object to be instantiated. * @return The Miranda IM contact having the passed handle. */ - static bool bIsActive(HANDLE hContact); + static bool bIsActive(HCONTACT hContact); /** * Saves this object's data to the persistent storage -- the Miranda * database. This information may be retreived later on by means of * getContact() factory method invocation. */ - static void save(HANDLE hContact, bool bValue); + static void save(HCONTACT hContact, bool bValue); private: static const char* SETTINGS_MODULE; diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp index 6afab80691..472ebcdd82 100644 --- a/plugins/Db3x_mmap/src/dbevents.cpp +++ b/plugins/Db3x_mmap/src/dbevents.cpp @@ -305,17 +305,17 @@ STDMETHODIMP_(BOOL) CDb3Mmap::MarkEventRead(MCONTACT contactID, HANDLE hDbEvent) return ret; } -STDMETHODIMP_(HANDLE) CDb3Mmap::GetEventContact(HANDLE hDbEvent) +STDMETHODIMP_(MCONTACT) CDb3Mmap::GetEventContact(HANDLE hDbEvent) { mir_cslock lck(m_csDbAccess); DBEvent *dbe = (DBEvent*)DBRead((DWORD)hDbEvent, sizeof(DBEvent), NULL); if (dbe->signature != DBEVENT_SIGNATURE) - return (HANDLE)-1; + return INVALID_CONTACT_ID; while (!(dbe->flags & DBEF_FIRST)) dbe = (DBEvent*)DBRead(dbe->ofsPrev, sizeof(DBEvent), NULL); - return (HANDLE)dbe->ofsPrev; + return dbe->ofsPrev; } STDMETHODIMP_(HANDLE) CDb3Mmap::FindFirstEvent(MCONTACT contactID) diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h index 629b2972f8..633c7aa7f5 100644 --- a/plugins/Db3x_mmap/src/dbintf.h +++ b/plugins/Db3x_mmap/src/dbintf.h @@ -184,43 +184,43 @@ struct CDb3Mmap : public MIDatabase, public MIDatabaseChecker, public MZeroedObj public: STDMETHODIMP_(void) SetCacheSafetyMode(BOOL); - STDMETHODIMP_(LONG) GetContactCount(void); + STDMETHODIMP_(LONG) GetContactCount(void); STDMETHODIMP_(MCONTACT) FindFirstContact(const char* szProto = NULL); STDMETHODIMP_(MCONTACT) FindNextContact(MCONTACT contactID, const char* szProto = NULL); - STDMETHODIMP_(LONG) DeleteContact(MCONTACT contactID); - STDMETHODIMP_(HANDLE) AddContact(void); - STDMETHODIMP_(BOOL) IsDbContact(MCONTACT contactID); - - STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID); - STDMETHODIMP_(HANDLE) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe); - STDMETHODIMP_(BOOL) DeleteEvent(MCONTACT contactID, HANDLE hDbEvent); - STDMETHODIMP_(LONG) GetBlobSize(HANDLE hDbEvent); - STDMETHODIMP_(BOOL) GetEvent(HANDLE hDbEvent, DBEVENTINFO *dbe); - STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT contactID, HANDLE hDbEvent); - STDMETHODIMP_(HANDLE) GetEventContact(HANDLE hDbEvent); - STDMETHODIMP_(HANDLE) FindFirstEvent(MCONTACT contactID); - STDMETHODIMP_(HANDLE) FindFirstUnreadEvent(MCONTACT contactID); - STDMETHODIMP_(HANDLE) FindLastEvent(MCONTACT contactID); - STDMETHODIMP_(HANDLE) FindNextEvent(HANDLE hDbEvent); - STDMETHODIMP_(HANDLE) FindPrevEvent(HANDLE hDbEvent); - - STDMETHODIMP_(BOOL) EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam); - - STDMETHODIMP_(BOOL) GetContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); - STDMETHODIMP_(BOOL) GetContactSettingStr(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); - STDMETHODIMP_(BOOL) GetContactSettingStatic(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); - STDMETHODIMP_(BOOL) FreeVariant(DBVARIANT *dbv); - STDMETHODIMP_(BOOL) WriteContactSetting(MCONTACT contactID, DBCONTACTWRITESETTING *dbcws); - STDMETHODIMP_(BOOL) DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting); - STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT contactID, DBCONTACTENUMSETTINGS* dbces); - STDMETHODIMP_(BOOL) SetSettingResident(BOOL bIsResident, const char *pszSettingName); - STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam); - STDMETHODIMP_(BOOL) IsSettingEncrypted(LPCSTR szModule, LPCSTR szSetting); + STDMETHODIMP_(LONG) DeleteContact(MCONTACT contactID); + STDMETHODIMP_(HANDLE) AddContact(void); + STDMETHODIMP_(BOOL) IsDbContact(MCONTACT contactID); + + STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID); + STDMETHODIMP_(HANDLE) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe); + STDMETHODIMP_(BOOL) DeleteEvent(MCONTACT contactID, HANDLE hDbEvent); + STDMETHODIMP_(LONG) GetBlobSize(HANDLE hDbEvent); + STDMETHODIMP_(BOOL) GetEvent(HANDLE hDbEvent, DBEVENTINFO *dbe); + STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT contactID, HANDLE hDbEvent); + STDMETHODIMP_(MCONTACT) GetEventContact(HANDLE hDbEvent); + STDMETHODIMP_(HANDLE) FindFirstEvent(MCONTACT contactID); + STDMETHODIMP_(HANDLE) FindFirstUnreadEvent(MCONTACT contactID); + STDMETHODIMP_(HANDLE) FindLastEvent(MCONTACT contactID); + STDMETHODIMP_(HANDLE) FindNextEvent(HANDLE hDbEvent); + STDMETHODIMP_(HANDLE) FindPrevEvent(HANDLE hDbEvent); + + STDMETHODIMP_(BOOL) EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam); + + STDMETHODIMP_(BOOL) GetContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); + STDMETHODIMP_(BOOL) GetContactSettingStr(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); + STDMETHODIMP_(BOOL) GetContactSettingStatic(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); + STDMETHODIMP_(BOOL) FreeVariant(DBVARIANT *dbv); + STDMETHODIMP_(BOOL) WriteContactSetting(MCONTACT contactID, DBCONTACTWRITESETTING *dbcws); + STDMETHODIMP_(BOOL) DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting); + STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT contactID, DBCONTACTENUMSETTINGS* dbces); + STDMETHODIMP_(BOOL) SetSettingResident(BOOL bIsResident, const char *pszSettingName); + STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam); + STDMETHODIMP_(BOOL) IsSettingEncrypted(LPCSTR szModule, LPCSTR szSetting); protected: - STDMETHODIMP_(BOOL) Start(DBCHeckCallback *callback); - STDMETHODIMP_(BOOL) CheckDb(int phase, int firstTime); - STDMETHODIMP_(VOID) Destroy(); + STDMETHODIMP_(BOOL) Start(DBCHeckCallback *callback); + STDMETHODIMP_(BOOL) CheckDb(int phase, int firstTime); + STDMETHODIMP_(VOID) Destroy(); protected: DWORD GetSettingsGroupOfsByModuleNameOfs(DBContact *dbc, DWORD ofsContact, DWORD ofsModuleName); diff --git a/plugins/DbEditorPP/src/addeditsettingsdlg.cpp b/plugins/DbEditorPP/src/addeditsettingsdlg.cpp index cf8587611e..0a28996127 100644 --- a/plugins/DbEditorPP/src/addeditsettingsdlg.cpp +++ b/plugins/DbEditorPP/src/addeditsettingsdlg.cpp @@ -1,6 +1,6 @@ #include "headers.h" -static BOOL Convert(HANDLE hContact, char* module, char* setting, int value, int toType) // 0 = byte, 1 = word, 2 = dword, 3 = string +static BOOL Convert(HCONTACT hContact, char* module, char* setting, int value, int toType) // 0 = byte, 1 = word, 2 = dword, 3 = string { int Result = 1; char temp[64]; @@ -30,7 +30,7 @@ static BOOL Convert(HANDLE hContact, char* module, char* setting, int value, int } -BOOL convertSetting(HANDLE hContact, char* module, char* setting, int toType) // 0 = byte, 1 = word, 2 = dword, 3 = string, 4 = unicode +BOOL convertSetting(HCONTACT hContact, char* module, char* setting, int toType) // 0 = byte, 1 = word, 2 = dword, 3 = string, 4 = unicode { DBVARIANT dbv = {0}; BOOL Result = 0; @@ -419,7 +419,7 @@ INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l return 0; } -void editSetting(HANDLE hContact, char* module, char* setting) +void editSetting(HCONTACT hContact, char* module, char* setting) { DBVARIANT dbv = {0}; // freed in the dialog if (!GetSetting(hContact,module, setting, &dbv)) diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index e3884fb123..db23d4ab21 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -1,6 +1,6 @@ #include "headers.h" -void copyModule(char* module, HANDLE hContactFrom, HANDLE hContactTo) +void copyModule(char* module, HCONTACT hContactFrom, HCONTACT hContactTo) { ModuleSettingLL msll; @@ -44,7 +44,7 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara { int index, loaded; char szProto[256]; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (GetValue(hContact,"Protocol","p",szProto,SIZEOF(szProto))) loaded = IsProtocolLoaded(szProto); else @@ -100,12 +100,12 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara case IDOK: if (!IsDlgButtonChecked(hwnd,CHK_COPY2ALL)) { - HANDLE hContact = (HANDLE)SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETITEMDATA, SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETCURSEL, 0, 0), 0); + HCONTACT hContact = (HCONTACT)SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETITEMDATA, SendMessage(GetDlgItem(hwnd, IDC_CONTACTS), CB_GETCURSEL, 0, 0), 0); copyModule(mac->module, mac->hContact, hContact); } else { SetCursor(LoadCursor(NULL,IDC_WAIT)); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) copyModule(mac->module, mac->hContact, hContact); SetCursor(LoadCursor(NULL,IDC_ARROW)); @@ -124,7 +124,7 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara return 0; } -void copyModuleMenuItem(char* module, HANDLE hContact) +void copyModuleMenuItem(char* module, HCONTACT hContact) { ModuleAndContact *mac = (ModuleAndContact *)mir_calloc(sizeof(ModuleAndContact)); mac->hContact = hContact; diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index 188f96460d..73d277e100 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -3,7 +3,7 @@ static int working; static HWND hwnd2Delete = NULL; -int deleteModule(char* module, HANDLE hContact, int fromMenu) +int deleteModule(char* module, HCONTACT hContact, int fromMenu) { char msg[1024]; ModuleSettingLL settinglist; @@ -47,7 +47,7 @@ void __cdecl PopulateModuleDropListThreadFunc(LPVOID di) module = module->next; continue; } - for (HANDLE hContact = db_find_first();moduleEmpty && hContact;hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first();moduleEmpty && hContact;hContact = db_find_next(hContact)) { if (!IsModuleEmpty(hContact,module->name)) { SendDlgItemMessage(hwnd,IDC_CONTACTS,CB_ADDSTRING,0,(LPARAM)module->name); moduleEmpty = 0; @@ -94,7 +94,7 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM char text[128]; GetDlgItemText(hwnd,IDC_CONTACTS,text,128); SetCursor(LoadCursor(NULL,IDC_WAIT)); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) deleteModule(text,hContact,1); // do the null diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 4a438546d2..aaae21dcd1 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -81,7 +81,7 @@ char* StrReplace (char* Search, char* Replace, char* Resource) return Resource; } -void exportModule(HANDLE hContact, char* module, FILE* file) +void exportModule(HCONTACT hContact, char* module, FILE* file) { char tmp[32]; ModuleSettingLL settinglist; @@ -152,7 +152,7 @@ void exportModule(HANDLE hContact, char* module, FILE* file) FreeModuleSettingLL(&settinglist); } -char *NickFromHContact(HANDLE hContact) +char *NickFromHContact(HCONTACT hContact) { static char nick[512] = ""; @@ -193,7 +193,7 @@ char *NickFromHContact(HANDLE hContact) return nick; } -void exportDB(HANDLE hContact, char* module) // hContact == -1 export entire db. module == NULL export entire contact. +void exportDB(HCONTACT hContact, char* module) // hContact == -1 export entire db. module == NULL export entire contact. { // hContact == -1, module == "" - all contacts FILE* file = NULL; char fileName[MAX_PATH]; @@ -326,20 +326,20 @@ void exportDB(HANDLE hContact, char* module) // hContact == -1 export entire db. FreeModuleSettingLL(&modlist); } -HANDLE CheckNewContact(char *myProto, char *uid, char *myName) +HCONTACT CheckNewContact(char *myProto, char *uid, char *myName) { char szProto[256], szName[256]; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if (DBGetContactSettingStringStatic(hContact, "Protocol", "p", szProto, 256)) if (!mir_strcmp(szProto, myProto)) if (GetValue(hContact, szProto, uid, szName, SIZEOF(szName)) && !mir_strcmp(szName, myName)) return hContact; - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; } -void importSettings(HANDLE hContact, char *importstring ) +void importSettings(HCONTACT hContact, char *importstring ) { char module[256] = "", setting[256] = "", *end; int i=0, value, type; @@ -364,7 +364,7 @@ void importSettings(HANDLE hContact, char *importstring ) else if (!strncmp(&importstring[i],"CONTACT:", strlen("CONTACT:"))) { int len, add = 1; - hContact = INVALID_HANDLE_VALUE; + hContact = (HCONTACT)INVALID_HANDLE_VALUE; i = i + (int)strlen("CONTACT:"); len = (int)strlen(&importstring[i]); @@ -405,7 +405,7 @@ void importSettings(HANDLE hContact, char *importstring ) if (hContact == INVALID_HANDLE_VALUE) { - HANDLE temp = (HANDLE)CallService(MS_DB_CONTACT_ADD,0,0); + HCONTACT temp = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if (temp) hContact = temp; } @@ -566,7 +566,7 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam case IDOK: { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd,GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_TEXT)); char *string; if (length) @@ -591,7 +591,7 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam return 0; } -void ImportSettingsMenuItem(HANDLE hContact) +void ImportSettingsMenuItem(HCONTACT hContact) { if (hwnd2importWindow) DestroyWindow(hwnd2importWindow); @@ -625,7 +625,7 @@ BOOL Exists(LPCTSTR strName) return GetFileAttributes(strName) != INVALID_FILE_ATTRIBUTES; } -void ImportSettingsFromFileMenuItem(HANDLE hContact, char* FilePath) +void ImportSettingsFromFileMenuItem(HCONTACT hContact, char* FilePath) { char szFileNames[MAX_PATH*10] = {0}; char szPath[MAX_PATH] = ""; diff --git a/plugins/DbEditorPP/src/findwindow.cpp b/plugins/DbEditorPP/src/findwindow.cpp index 6ac376233d..2f0f27e33a 100644 --- a/plugins/DbEditorPP/src/findwindow.cpp +++ b/plugins/DbEditorPP/src/findwindow.cpp @@ -178,7 +178,7 @@ INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return 0; } -void ItemFound(HWND hwnd, HANDLE hContact,const char *module,const char *setting,const char* value,int type) +void ItemFound(HWND hwnd, HCONTACT hContact,const char *module,const char *setting,const char* value,int type) { ItemInfo *ii = (ItemInfo*)mir_calloc(sizeof(ItemInfo)); if (!ii) return; @@ -262,7 +262,7 @@ char* multiReplace(const char* value, const char *find, const char *replace, int return mir_tstrdup(value); } -int replaceValue(HWND hwnd, HANDLE hContact, const char *module, const char *setting, DBVARIANT *dbv, const char *find, const char *replace, int mode) +int replaceValue(HWND hwnd, HCONTACT hContact, const char *module, const char *setting, DBVARIANT *dbv, const char *find, const char *replace, int mode) { int count = 0; DWORD num = 0; @@ -334,7 +334,7 @@ int replaceValue(HWND hwnd, HANDLE hContact, const char *module, const char *set return count; } -int replaceSetting(HWND hwnd, HANDLE hContact, const char *module, const char *setting, DBVARIANT *dbv, const char *find, const char *replace, int mode) +int replaceSetting(HWND hwnd, HCONTACT hContact, const char *module, const char *setting, DBVARIANT *dbv, const char *find, const char *replace, int mode) { char *szSetting; ptrA myreplace; @@ -370,7 +370,7 @@ int replaceSetting(HWND hwnd, HANDLE hContact, const char *module, const char *s } -int replaceModule(HWND hwnd, HANDLE hContact, const char *module, const char *find, const char *replace, int mode) +int replaceModule(HWND hwnd, HCONTACT hContact, const char *module, const char *find, const char *replace, int mode) { ModuleSettingLL msll; ModSetLinkLinkItem *setting; @@ -468,7 +468,7 @@ void __cdecl FindSettings(LPVOID di) int options = ((FindInfo*)di)->options; ModuleSettingLL ModuleList, SettingList; ModSetLinkLinkItem *module, *setting; - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv = { 0 }; int caseSensitive = options & FW_CASE; int exactMatch = options & FW_EXACT; diff --git a/plugins/DbEditorPP/src/headers.h b/plugins/DbEditorPP/src/headers.h index d5bf500565..4e3a2f8b9f 100644 --- a/plugins/DbEditorPP/src/headers.h +++ b/plugins/DbEditorPP/src/headers.h @@ -57,7 +57,7 @@ HICON LoadSkinnedDBEIcon(int icon); int AddIconToList(HIMAGELIST hil, HICON hIcon); void AddProtoIconsToList(HIMAGELIST hil, int newshift); int GetProtoIcon(char *szProto); -extern HANDLE hRestore; +extern HCONTACT hRestore; extern HGENMENU hUserMenu; ///////////////////// @@ -109,11 +109,11 @@ extern HGENMENU hUserMenu; typedef struct { int type; // from above types - HANDLE hContact; + HCONTACT hContact; } ModuleTreeInfoStruct; typedef struct { - HANDLE hContact; + HCONTACT hContact; char* module; HWND hwnd2Edit; int selectedItem; // item that is currently selected @@ -125,7 +125,7 @@ typedef struct { struct DBsetting { DBVARIANT dbv; - HANDLE hContact; + HCONTACT hContact; char *module; char *setting; int WatchModule; // above defines @@ -133,7 +133,7 @@ struct DBsetting { typedef struct { char module[256]; - HANDLE hContact; + HCONTACT hContact; } ModuleAndContact; // find window @@ -143,7 +143,7 @@ typedef struct { typedef struct { int type; // above types - HANDLE hContact; + HCONTACT hContact; char module[256]; char setting[256]; } ItemInfo; @@ -182,67 +182,67 @@ extern BOOL usePopups; #define HEX_DWORD 4 //main.c -int DBGetContactSettingStringStatic(HANDLE hContact, char* szModule, char* szSetting, char* value, int maxLength); -int WriteBlobFromString(HANDLE hContact,const char *szModule,const char *szSetting, const char *Value, int len); -int GetSetting(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); -int GetValue(HANDLE hContact, const char* szModule, const char* szSetting, char* Value, int length); -int GetValueW(HANDLE hContact, const char* szModule, const char* szSetting, WCHAR* Value, int length); +int DBGetContactSettingStringStatic(HCONTACT hContact, char* szModule, char* szSetting, char* value, int maxLength); +int WriteBlobFromString(HCONTACT hContact,const char *szModule,const char *szSetting, const char *Value, int len); +int GetSetting(HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); +int GetValue(HCONTACT hContact, const char* szModule, const char* szSetting, char* Value, int length); +int GetValueW(HCONTACT hContact, const char* szModule, const char* szSetting, WCHAR* Value, int length); char* u2a( wchar_t* src ); wchar_t *a2u( char* src , wchar_t *buffer, int len ); -WCHAR *GetContactName(HANDLE hContact, const char *szProto, int unicode); +WCHAR *GetContactName(HCONTACT hContact, const char *szProto, int unicode); BOOL IsProtocolLoaded(char* pszProtocolName); // main_window.c INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); // modules.c -int deleteModule(char* module, HANDLE hContact, int fromMenu); +int deleteModule(char* module, HCONTACT hContact, int fromMenu); void deleteModuleGui(); -void renameModule(char* oldName, char* newName, HANDLE hContact); +void renameModule(char* oldName, char* newName, HCONTACT hContact); INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -int CloneContact(HANDLE hContact); +int CloneContact(HCONTACT hContact); // moduletree.c -void replaceTreeItem(HWND hwnd, HANDLE hContact, const char *module, const char *newModule); +void replaceTreeItem(HWND hwnd, HCONTACT hContact, const char *module, const char *newModule); void refreshTree(BOOL restore); void __cdecl PopulateModuleTreeThreadFunc(LPVOID di); -void freeTree(HWND hwnd2Tree, HANDLE hContact); -int findItemInTree(HWND hwnd2Tree, HANDLE hContact, char* module); +void freeTree(HWND hwnd2Tree, HCONTACT hContact); +int findItemInTree(HWND hwnd2Tree, HCONTACT hContact, char* module); // settinglist.c void setupSettingsList(HWND hwnd2List); void saveListSettings(HWND hwnd2List); void ClearListview(HWND hwnd2Settings); -void DeleteSettingsFromList(HWND hSettings, HANDLE hContact, char *module, char *setting); -void PopulateSettings(HWND hwnd2Settings, HANDLE hContact, char* module); +void DeleteSettingsFromList(HWND hSettings, HCONTACT hContact, char *module, char *setting); +void PopulateSettings(HWND hwnd2Settings, HCONTACT hContact, char* module); void SelectSetting(char* setting); // addeditsettingsdlg.c INT_PTR CALLBACK EditSettingDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -void editSetting(HANDLE hContact, char* module, char* setting); -BOOL convertSetting(HANDLE hContact, char* module, char* setting, int toType); // 0 = byte, 1 = word, 2 = dword, 3 = string +void editSetting(HCONTACT hContact, char* module, char* setting); +BOOL convertSetting(HCONTACT hContact, char* module, char* setting, int toType); // 0 = byte, 1 = word, 2 = dword, 3 = string // exportimport.c -void exportDB(HANDLE hContact, char* module); // hContact == -1 export entire db. module == NULL export entire contact -void ImportSettingsMenuItem(HANDLE hContact); -void ImportSettingsFromFileMenuItem(HANDLE hContact, char* FilePath); +void exportDB(HCONTACT hContact, char* module); // hContact == -1 export entire db. module == NULL export entire contact +void ImportSettingsMenuItem(HCONTACT hContact); +void ImportSettingsFromFileMenuItem(HCONTACT hContact, char* FilePath); // find window.c INT_PTR CALLBACK FindWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); // copymodule.c -void copyModuleMenuItem(char* module, HANDLE hContact); -void copyModule(char* module, HANDLE hContactFrom, HANDLE hContactTo); +void copyModuleMenuItem(char* module, HCONTACT hContact); +void copyModule(char* module, HCONTACT hContactFrom, HCONTACT hContactTo); // options.c int OptInit(WPARAM wParam,LPARAM lParam); // watchlist -int addSettingToWatchList(HANDLE hContact, char* module, char* setting); +int addSettingToWatchList(HCONTACT hContact, char* module, char* setting); void freeWatchListItem(int item); void PopulateWatchedWindow(HWND hwnd); void freeAllWatches(); INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -void popupWatchedVar(HANDLE hContact,const char* module,const char* setting); +void popupWatchedVar(HCONTACT hContact,const char* module,const char* setting); #endif //_COMMONHEADERS_H \ No newline at end of file diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 642f73bb4d..0c621f7169 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -11,7 +11,7 @@ int hLangpack; BYTE nameOrder[NAMEORDERCOUNT]; HGENMENU hUserMenu; WatchListArrayStruct WatchListArray; -HANDLE hRestore; +HCONTACT hRestore; HANDLE sMenuCommand, sImport, sServicemodeLaunch; HANDLE hModulesLoadedHook = NULL, hSettingsChangedHook=NULL, hOptInitHook=NULL, hPreShutdownHook=NULL; @@ -51,12 +51,12 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } -void settingChanged(HWND hwnd2Settings, HANDLE hContact, char* module, char* setting); +void settingChanged(HWND hwnd2Settings, HCONTACT hContact, char* module, char* setting); int DBSettingChanged(WPARAM wParam,LPARAM lParam) { DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; char *setting; SettingListInfo* info; @@ -106,7 +106,7 @@ int DBSettingChanged(WPARAM wParam,LPARAM lParam) INT_PTR DBEditorppMenuCommand(WPARAM wParam, LPARAM lParam) { if (!hwnd2mainWindow) { // so only opens 1 at a time - hRestore = (HANDLE)wParam; + hRestore = (HCONTACT)wParam; SetCursor(LoadCursor(NULL,IDC_WAIT)); CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), 0, MainDlgProc); } @@ -114,7 +114,7 @@ INT_PTR DBEditorppMenuCommand(WPARAM wParam, LPARAM lParam) ShowWindow(hwnd2mainWindow, SW_RESTORE); SetForegroundWindow(hwnd2mainWindow); if (!hRestore && wParam) { - hRestore = (HANDLE)wParam; + hRestore = (HCONTACT)wParam; refreshTree(4); } } @@ -225,7 +225,7 @@ INT_PTR ServiceMode(WPARAM wParam, LPARAM lParam) INT_PTR ImportFromFile(WPARAM wParam, LPARAM lParam) { - ImportSettingsFromFileMenuItem((HANDLE)wParam, (char*)lParam); + ImportSettingsFromFileMenuItem((HCONTACT)wParam, (char*)lParam); return 0; } @@ -267,7 +267,7 @@ extern "C" __declspec(dllexport) int Unload(void) // db_get_s (prob shouldnt use this unless u know how big the string is gonna be..) //======================================================= -int DBGetContactSettingStringStatic(HANDLE hContact, char* szModule, char* szSetting, char* value, int maxLength) +int DBGetContactSettingStringStatic(HCONTACT hContact, char* szModule, char* szSetting, char* value, int maxLength) { DBVARIANT dbv; if (!db_get(hContact, szModule, szSetting, &dbv)) { @@ -283,7 +283,7 @@ int DBGetContactSettingStringStatic(HANDLE hContact, char* szModule, char* szSet return 0; } -int WriteBlobFromString(HANDLE hContact,const char *szModule,const char *szSetting, const char *szValue, int len) +int WriteBlobFromString(HCONTACT hContact,const char *szModule,const char *szSetting, const char *szValue, int len) { int j=0, i = 0; BYTE *data = NULL; @@ -316,12 +316,12 @@ int WriteBlobFromString(HANDLE hContact,const char *szModule,const char *szSetti return 0; } -int GetSetting(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) +int GetSetting(HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { return db_get_s(hContact, szModule, szSetting, dbv, 0); } -int GetValue(HANDLE hContact, const char* szModule, const char* szSetting, char* Value, int length) +int GetValue(HCONTACT hContact, const char* szModule, const char* szSetting, char* Value, int length) { DBVARIANT dbv = {0}; @@ -361,7 +361,7 @@ int GetValue(HANDLE hContact, const char* szModule, const char* szSetting, char* return 0; } -int GetValueW(HANDLE hContact, const char* szModule, const char* szSetting, WCHAR* Value, int length) +int GetValueW(HCONTACT hContact, const char* szModule, const char* szSetting, WCHAR* Value, int length) { DBVARIANT dbv = { 0 }; WCHAR *wc; @@ -435,7 +435,7 @@ wchar_t* a2u(char* src, wchar_t *buffer, int len) return result; } -int GetDatabaseString(HANDLE hContact, const char *szModule, const char* szSetting, WCHAR *Value, int length, BOOL unicode) +int GetDatabaseString(HCONTACT hContact, const char *szModule, const char* szSetting, WCHAR *Value, int length, BOOL unicode) { if (unicode) return GetValueW(hContact, szModule, szSetting, Value, length); @@ -443,7 +443,7 @@ int GetDatabaseString(HANDLE hContact, const char *szModule, const char* szSetti return GetValue(hContact, szModule, szSetting, (char*)Value, length); } -WCHAR* GetContactName(HANDLE hContact, const char *szProto, int unicode) +WCHAR* GetContactName(HCONTACT hContact, const char *szProto, int unicode) { int i, r = 0; static WCHAR res[512]; diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index 087fd2405b..714a5cfed2 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -113,7 +113,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM tvi.cchTextMax = 255; if (TreeView_GetItem(hwnd,&tvi) && tvi.lParam) { ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct*)tvi.lParam; - HANDLE hContact = mtis->hContact; + HCONTACT hContact = mtis->hContact; if (wParam == VK_DELETE) { if ((mtis->type) & MODULE) { if (deleteModule(module, hContact,0)) { @@ -161,7 +161,7 @@ static LRESULT CALLBACK SettingListSubclassProc(HWND hwnd,UINT msg,WPARAM wParam case WM_KEYDOWN: if (wParam == VK_DELETE || wParam == VK_F5 || (wParam == VK_F2 && ListView_GetSelectedCount(hwnd) == 1)) { char *module, setting[256]; - HANDLE hContact; + HCONTACT hContact; SettingListInfo* sli = (SettingListInfo*)GetWindowLongPtr(hwnd,GWLP_USERDATA); if (!sli) break; hContact = sli->hContact; @@ -369,7 +369,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (item = TreeView_GetSelection(hwnd2Tree)) { int type = MODULE; TVITEM tvi = {0}; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT; tvi.pszText = module; tvi.cchTextMax = 255; @@ -470,10 +470,10 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) freeAllWatches(); break; case MENU_EXPORTDB: // all db - exportDB(INVALID_HANDLE_VALUE,0); + exportDB((HCONTACT)INVALID_HANDLE_VALUE, 0); break; case MENU_EXPORTCONTACT: // all contacts - exportDB(INVALID_HANDLE_VALUE, ""); + exportDB((HCONTACT)INVALID_HANDLE_VALUE, ""); break; case MENU_EXPORTMODULE: // all settings exportDB(NULL, 0); diff --git a/plugins/DbEditorPP/src/modsettingenum.cpp b/plugins/DbEditorPP/src/modsettingenum.cpp index 96d198b682..dfc4c82a51 100644 --- a/plugins/DbEditorPP/src/modsettingenum.cpp +++ b/plugins/DbEditorPP/src/modsettingenum.cpp @@ -56,7 +56,7 @@ int enumSettingsProc(const char *szSetting, LPARAM lParam) return enumModulesSettingsProc(szSetting, 0, lParam); } -int EnumSettings(HANDLE hContact, char* module, ModuleSettingLL *msll) +int EnumSettings(HCONTACT hContact, char* module, ModuleSettingLL *msll) { DBCONTACTENUMSETTINGS dbces; // enum all setting the contact has for the module @@ -73,7 +73,7 @@ int CheckIfModuleIsEmptyProc(const char *szSetting, LPARAM lParam) return 1; } -int IsModuleEmpty(HANDLE hContact, char* szModule) +int IsModuleEmpty(HCONTACT hContact, char* szModule) { DBCONTACTENUMSETTINGS dbces; dbces.pfnEnumProc = CheckIfModuleIsEmptyProc; diff --git a/plugins/DbEditorPP/src/modsettingenum.h b/plugins/DbEditorPP/src/modsettingenum.h index 633d2d1470..145202575f 100644 --- a/plugins/DbEditorPP/src/modsettingenum.h +++ b/plugins/DbEditorPP/src/modsettingenum.h @@ -11,8 +11,8 @@ struct ModuleSettingLL }; int EnumModules(ModuleSettingLL *msll); -int EnumSettings(HANDLE hContact, char *module, ModuleSettingLL *msll); +int EnumSettings(HCONTACT hContact, char *module, ModuleSettingLL *msll); void FreeModuleSettingLL(ModuleSettingLL *msll); -int IsModuleEmpty(HANDLE hContact, char *szModule); +int IsModuleEmpty(HCONTACT hContact, char *szModule); diff --git a/plugins/DbEditorPP/src/modules.cpp b/plugins/DbEditorPP/src/modules.cpp index 603b601307..b0765bd9b0 100644 --- a/plugins/DbEditorPP/src/modules.cpp +++ b/plugins/DbEditorPP/src/modules.cpp @@ -1,6 +1,6 @@ #include "headers.h" -void renameModule(char* oldName, char* newName, HANDLE hContact) +void renameModule(char* oldName, char* newName, HCONTACT hContact) { DBVARIANT dbv; ModuleSettingLL settinglist; @@ -56,10 +56,10 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam if (IsDlgButtonChecked(hwnd, CHK_ADD2ALL)) { // null contact db_set_b(NULL, modulename, "(Default)", 0); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) db_set_b(hContact, modulename, "(Default)", 0); } - else db_set_b((HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA), modulename, "(Default)", 0); + else db_set_b((HCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), modulename, "(Default)", 0); refreshTree(1); } @@ -72,9 +72,9 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam return 0; } -int CloneContact(HANDLE hContact) +int CloneContact(HCONTACT hContact) { - HANDLE newContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + HCONTACT newContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if (!newContact) return 0; diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp index bcbc1ac109..2f3c1d13f4 100644 --- a/plugins/DbEditorPP/src/moduletree.cpp +++ b/plugins/DbEditorPP/src/moduletree.cpp @@ -6,7 +6,7 @@ static ModuleTreeInfoStruct contacts_mtis = {CONTACT_ROOT_ITEM, 0}; static ModuleTreeInfoStruct settings_mtis = {CONTACT, 0}; -int doContacts(HWND hwnd2Tree,HTREEITEM contactsRoot,ModuleSettingLL *modlist, HANDLE hSelectedContact, char *SelectedModule, char *SelectedSetting) +int doContacts(HWND hwnd2Tree, HTREEITEM contactsRoot, ModuleSettingLL *modlist, HCONTACT hSelectedContact, char *SelectedModule, char *SelectedSetting) { TVINSERTSTRUCT tvi; HTREEITEM contact; @@ -23,7 +23,7 @@ int doContacts(HWND hwnd2Tree,HTREEITEM contactsRoot,ModuleSettingLL *modlist, H tvi.hInsertAfter = TVI_SORT; tvi.item.cChildren = 1; - for (HANDLE hContact = db_find_first(); hContact && hwnd2mainWindow; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact && hwnd2mainWindow; hContact = db_find_next(hContact)) { char szProto[100]; if (DBGetContactSettingStringStatic(hContact, "Protocol", "p", szProto, SIZEOF(szProto))) { icon = GetProtoIcon(szProto); @@ -61,8 +61,7 @@ int doContacts(HWND hwnd2Tree,HTREEITEM contactsRoot,ModuleSettingLL *modlist, H else protoW[0] = 0; - if (!szProto || !loaded) - { + if (!szProto || !loaded) { tvi.item.iSelectedImage = (tvi.item.iImage = 4); if (protoW) { @@ -125,7 +124,7 @@ void doItems(HWND hwnd2Tree,ModuleSettingLL *modlist, int count) { TVINSERTSTRUCT tvi; TVITEM item ={0}; - HANDLE hContact; + HCONTACT hContact; ModuleTreeInfoStruct *lParam; ModSetLinkLinkItem *module; char percent[96], title[64]; @@ -184,7 +183,7 @@ void doItems(HWND hwnd2Tree,ModuleSettingLL *modlist, int count) SetWindowText(hwnd, TranslateT("Database Editor++")); } -int findItemInTree(HWND hwnd2Tree, HANDLE hContact, char* module) +int findItemInTree(HWND hwnd2Tree, HCONTACT hContact, char* module) /* the following code to go through the whole tree is nicked from codeguru.. http://www.codeguru.com/Cpp/controls/treeview/treetraversal/comments.php/c683/?thread=7680 */ { @@ -219,7 +218,7 @@ int findItemInTree(HWND hwnd2Tree, HANDLE hContact, char* module) return -1; } -void freeTree(HWND hwnd2Tree, HANDLE hContact) +void freeTree(HWND hwnd2Tree, HCONTACT hContact) /* the following code to go through the whole tree is nicked from codeguru.. http://www.codeguru.com/Cpp/controls/treeview/treetraversal/comments.php/c683/?thread=7680 */ { @@ -257,7 +256,7 @@ void freeTree(HWND hwnd2Tree, HANDLE hContact) while (item.hItem); } -BOOL findAndRemoveDuplicates(HWND hwnd2Tree, HANDLE hContact, char* module) +BOOL findAndRemoveDuplicates(HWND hwnd2Tree, HCONTACT hContact, char* module) /* the following code to go through the whole tree is nicked from codeguru.. http://www.codeguru.com/Cpp/controls/treeview/treetraversal/comments.php/c683/?thread=7680 */ { @@ -307,7 +306,7 @@ BOOL findAndRemoveDuplicates(HWND hwnd2Tree, HANDLE hContact, char* module) } -void replaceTreeItem(HWND hwnd, HANDLE hContact, const char *module, const char *newModule) +void replaceTreeItem(HWND hwnd, HCONTACT hContact, const char *module, const char *newModule) { int hItem = findItemInTree(hwnd, hContact, (char*)module); HTREEITEM hParent; @@ -361,8 +360,8 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) HWND hwnd2Tree = GetDlgItem(hwnd2mainWindow,IDC_MODULES); char SelectedModule[256] = {0}; char SelectedSetting[256] = {0}; - HANDLE hSelectedContact = hRestore; - HANDLE hContact; + HCONTACT hSelectedContact = hRestore; + HCONTACT hContact; HTREEITEM contact, contactsRoot; int count; @@ -403,7 +402,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di) } case 2: // restore saved if (GetValue(NULL,modname,"LastModule",SelectedModule,SIZEOF(SelectedModule))) { - hSelectedContact = (HANDLE)db_get_dw(NULL,modname,"LastContact",(DWORD)INVALID_HANDLE_VALUE); + hSelectedContact = (HCONTACT)db_get_dw(NULL, modname, "LastContact", (DWORD)INVALID_HANDLE_VALUE); if (hSelectedContact != INVALID_HANDLE_VALUE) Select = 1; GetValue(NULL,modname,"LastSetting",SelectedSetting,SIZEOF(SelectedSetting)); @@ -558,7 +557,7 @@ void moduleListWM_NOTIFY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)// hwnd HWND hwnd2Tree = GetDlgItem(hwnd2mainWindow,IDC_MODULES); ModSetLinkLinkItem *module; ModuleSettingLL modlist; - HANDLE hContact = mtis->hContact; + HCONTACT hContact = mtis->hContact; mtis->type = CONTACT; @@ -599,7 +598,7 @@ void moduleListWM_NOTIFY(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)// hwnd LPNMTREEVIEW pnmtv = (LPNMTREEVIEW)lParam; TVITEM tvi = {0}; char text[264]; - HANDLE hContact; + HCONTACT hContact; HWND hwnd2Settings = GetDlgItem(hwnd, IDC_SETTINGS); tvi.mask = TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT; tvi.hItem = pnmtv->itemNew.hItem; @@ -768,7 +767,7 @@ void moduleListRightClick(HWND hwnd, WPARAM wParam,LPARAM lParam) // hwnd here i TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom,&tvi); if (tvi.lParam) { ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam; - HANDLE hContact = mtis->hContact; + HCONTACT hContact = mtis->hContact; GetCursorPos(&(hti.pt)); hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXTMENU)); TranslateMenu(hMenu); @@ -830,7 +829,7 @@ void moduleListRightClick(HWND hwnd, WPARAM wParam,LPARAM lParam) // hwnd here i break; case MENU_EXPORTDB: - exportDB(INVALID_HANDLE_VALUE, module); + exportDB((HCONTACT)INVALID_HANDLE_VALUE, module); break; } } @@ -908,7 +907,7 @@ void moduleListRightClick(HWND hwnd, WPARAM wParam,LPARAM lParam) // hwnd here i case 4: // Contacts root switch ( TrackPopupMenu(hSubMenu, TPM_RETURNCMD, hti.pt.x, hti.pt.y, 0, hwnd, NULL)) { case MENU_EXPORTCONTACT: - exportDB(INVALID_HANDLE_VALUE, ""); + exportDB((HCONTACT)INVALID_HANDLE_VALUE, ""); break; case MENU_IMPORTFROMTEXT: ImportSettingsMenuItem(NULL); diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index fee9442032..d98f8a0144 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -53,7 +53,7 @@ void ClearListview(HWND hwnd2Settings) ListView_DeleteAllItems(hwnd2Settings); } -void DeleteSettingsFromList(HWND hSettings, HANDLE hContact, char *module, char *setting) +void DeleteSettingsFromList(HWND hSettings, HCONTACT hContact, char *module, char *setting) { int count = ListView_GetSelectedCount(hSettings); @@ -93,7 +93,7 @@ void DeleteSettingsFromList(HWND hSettings, HANDLE hContact, char *module, char } } -void additem(HWND hwnd2Settings,HANDLE hContact, char* module, char* setting, int index) +void additem(HWND hwnd2Settings,HCONTACT hContact, char* module, char* setting, int index) { char *data = NULL; LVITEM lvi; @@ -213,7 +213,7 @@ void additem(HWND hwnd2Settings,HANDLE hContact, char* module, char* setting, in mir_free(data); } -void PopulateSettings(HWND hwnd2Settings, HANDLE hContact, char* module) +void PopulateSettings(HWND hwnd2Settings, HCONTACT hContact, char* module) { SettingListInfo* info = (SettingListInfo*)mir_calloc(sizeof(SettingListInfo)); LVITEM lvItem; @@ -270,7 +270,7 @@ void SelectSetting(char *setting) } } -void settingChanged(HWND hwnd2Settings, HANDLE hContact, char* module, char* setting) +void settingChanged(HWND hwnd2Settings, HCONTACT hContact, char* module, char* setting) { LVITEM lvItem; LVFINDINFO lvfi; @@ -296,7 +296,7 @@ static WNDPROC SettingLabelEditSubClass; struct EditLabelInfoStruct { - HANDLE hContact; + HCONTACT hContact; char module[256]; char setting[256]; int item; @@ -762,7 +762,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM wParam, LPARAM lParam) // hwnd her return; char setting[256], *module; - HANDLE hContact; + HCONTACT hContact; LVHITTESTINFO hti; POINT pt; HMENU hMenu, hSubMenu; diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index 40d5404229..f4dc64f79e 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -1,6 +1,6 @@ #include "headers.h" -int addSettingToWatchList(HANDLE hContact, char* module, char* setting) +int addSettingToWatchList(HCONTACT hContact, char* module, char* setting) { if (WatchListArray.count == WatchListArray.size) { @@ -36,7 +36,7 @@ void addwatchtolist(HWND hwnd2list, struct DBsetting *lParam) int index; char data[32], tmp[32]; DBVARIANT *dbv = &(lParam->dbv); - HANDLE hContact = lParam->hContact; + HCONTACT hContact = lParam->hContact; char *module = lParam->module; char *setting = lParam->setting; if (!module) return; @@ -263,7 +263,7 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (ListView_GetItem(GetDlgItem(hwnd,IDC_VARS),&lvi)) { ItemInfo ii; - ii.hContact = (HANDLE)lvi.lParam; + ii.hContact = (HCONTACT)lvi.lParam; ListView_GetItemText(GetDlgItem(hwnd,IDC_VARS),hti.iItem,1,ii.module,128); ListView_GetItemText(GetDlgItem(hwnd,IDC_VARS),hti.iItem,2,ii.setting,128); ii.type = FW_SETTINGNAME; @@ -282,7 +282,7 @@ INT_PTR CALLBACK WatchDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } -void popupWatchedVar(HANDLE hContact,const char* module,const char* setting) +void popupWatchedVar(HCONTACT hContact,const char* module,const char* setting) { HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(ICO_REGEDIT)); char lpzContactName[MAX_CONTACTNAME]; @@ -329,7 +329,7 @@ void popupWatchedVar(HANDLE hContact,const char* module,const char* setting) db_free(&dbv); POPUPDATA ppd = { 0 }; - ppd.lchContact = (HANDLE)hContact; + ppd.lchContact = (HCONTACT)hContact; ppd.lchIcon = hIcon; lstrcpyn(ppd.lpzContactName, lpzContactName,MAX_CONTACTNAME); lstrcpyn(ppd.lpzText, lpzText,MAX_SECONDLINE); diff --git a/plugins/Dbx_tree/src/Compatibility.cpp b/plugins/Dbx_tree/src/Compatibility.cpp index 18b9b6571e..bc42386664 100644 --- a/plugins/Dbx_tree/src/Compatibility.cpp +++ b/plugins/Dbx_tree/src/Compatibility.cpp @@ -774,13 +774,13 @@ STDMETHODIMP_(BOOL) CDataBase::MarkEventRead(MCONTACT contactID, HANDLE hDbEvent return res; } -STDMETHODIMP_(HANDLE) CDataBase::GetEventContact(HANDLE hDbEvent) +STDMETHODIMP_(MCONTACT) CDataBase::GetEventContact(HANDLE hDbEvent) { TDBTEntityHandle res = DBEventGetEntity((WPARAM)hDbEvent, 0); if (res == getEntities().getRootEntity()) res = 0; - return (HANDLE)res; + return res; } STDMETHODIMP_(HANDLE) CDataBase::FindFirstEvent(MCONTACT contactID) diff --git a/plugins/Dbx_tree/src/DataBase.h b/plugins/Dbx_tree/src/DataBase.h index b19ceebb1c..6f3cc07b6e 100644 --- a/plugins/Dbx_tree/src/DataBase.h +++ b/plugins/Dbx_tree/src/DataBase.h @@ -193,40 +193,40 @@ public: // services void CreateDbService(const char *szServiceName, DbServiceFunc pFunc); protected: // to be compatible with the standard Miranda databases - STDMETHODIMP_(void) SetCacheSafetyMode(BOOL); + STDMETHODIMP_(void) SetCacheSafetyMode(BOOL); - STDMETHODIMP_(LONG) GetContactCount(void); + STDMETHODIMP_(LONG) GetContactCount(void); STDMETHODIMP_(MCONTACT) FindFirstContact(const char* szProto = NULL); STDMETHODIMP_(MCONTACT) FindNextContact(MCONTACT contactID, const char* szProto = NULL); - STDMETHODIMP_(LONG) DeleteContact(MCONTACT contactID); - STDMETHODIMP_(HANDLE) AddContact(void); - STDMETHODIMP_(BOOL) IsDbContact(MCONTACT contactID); - - STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID); - STDMETHODIMP_(HANDLE) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe); - STDMETHODIMP_(BOOL) DeleteEvent(MCONTACT contactID, HANDLE hDbEvent); - STDMETHODIMP_(LONG) GetBlobSize(HANDLE hDbEvent); - STDMETHODIMP_(BOOL) GetEvent(HANDLE hDbEvent, DBEVENTINFO *dbe); - STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT contactID, HANDLE hDbEvent); - STDMETHODIMP_(HANDLE) GetEventContact(HANDLE hDbEvent); - STDMETHODIMP_(HANDLE) FindFirstEvent(MCONTACT contactID); - STDMETHODIMP_(HANDLE) FindFirstUnreadEvent(MCONTACT contactID); - STDMETHODIMP_(HANDLE) FindLastEvent(MCONTACT contactID); - STDMETHODIMP_(HANDLE) FindNextEvent(HANDLE hDbEvent); - STDMETHODIMP_(HANDLE) FindPrevEvent(HANDLE hDbEvent); - - STDMETHODIMP_(BOOL) EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam); - - STDMETHODIMP_(BOOL) GetContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); - STDMETHODIMP_(BOOL) GetContactSettingStr(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); - STDMETHODIMP_(BOOL) GetContactSettingStatic(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); - STDMETHODIMP_(BOOL) FreeVariant(DBVARIANT *dbv); - STDMETHODIMP_(BOOL) WriteContactSetting(MCONTACT contactID, DBCONTACTWRITESETTING *dbcws); - STDMETHODIMP_(BOOL) DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting); - STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT contactID, DBCONTACTENUMSETTINGS* dbces); - STDMETHODIMP_(BOOL) SetSettingResident(BOOL bIsResident, const char *pszSettingName); - STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam); - STDMETHODIMP_(BOOL) IsSettingEncrypted(LPCSTR szModule, LPCSTR szSetting); + STDMETHODIMP_(LONG) DeleteContact(MCONTACT contactID); + STDMETHODIMP_(HANDLE) AddContact(void); + STDMETHODIMP_(BOOL) IsDbContact(MCONTACT contactID); + + STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID); + STDMETHODIMP_(HANDLE) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe); + STDMETHODIMP_(BOOL) DeleteEvent(MCONTACT contactID, HANDLE hDbEvent); + STDMETHODIMP_(LONG) GetBlobSize(HANDLE hDbEvent); + STDMETHODIMP_(BOOL) GetEvent(HANDLE hDbEvent, DBEVENTINFO *dbe); + STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT contactID, HANDLE hDbEvent); + STDMETHODIMP_(MCONTACT) GetEventContact(HANDLE hDbEvent); + STDMETHODIMP_(HANDLE) FindFirstEvent(MCONTACT contactID); + STDMETHODIMP_(HANDLE) FindFirstUnreadEvent(MCONTACT contactID); + STDMETHODIMP_(HANDLE) FindLastEvent(MCONTACT contactID); + STDMETHODIMP_(HANDLE) FindNextEvent(HANDLE hDbEvent); + STDMETHODIMP_(HANDLE) FindPrevEvent(HANDLE hDbEvent); + + STDMETHODIMP_(BOOL) EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam); + + STDMETHODIMP_(BOOL) GetContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); + STDMETHODIMP_(BOOL) GetContactSettingStr(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); + STDMETHODIMP_(BOOL) GetContactSettingStatic(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv); + STDMETHODIMP_(BOOL) FreeVariant(DBVARIANT *dbv); + STDMETHODIMP_(BOOL) WriteContactSetting(MCONTACT contactID, DBCONTACTWRITESETTING *dbcws); + STDMETHODIMP_(BOOL) DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting); + STDMETHODIMP_(BOOL) EnumContactSettings(MCONTACT contactID, DBCONTACTENUMSETTINGS* dbces); + STDMETHODIMP_(BOOL) SetSettingResident(BOOL bIsResident, const char *pszSettingName); + STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam); + STDMETHODIMP_(BOOL) IsSettingEncrypted(LPCSTR szModule, LPCSTR szSetting); int CheckProto(DBCachedContact *cc, const char *proto); }; diff --git a/plugins/ExternalAPI/m_ContactSettings.h b/plugins/ExternalAPI/m_ContactSettings.h index 3f58d4cd39..9118a97a0f 100644 --- a/plugins/ExternalAPI/m_ContactSettings.h +++ b/plugins/ExternalAPI/m_ContactSettings.h @@ -26,7 +26,7 @@ typedef struct { int Type; // one of CSIT_ constants; value of this field depends on what settings dialog was opened: contact settings or group settings union { - HANDLE hContact; // used when Type == CSIT_CONTACT + HCONTACT hContact; // used when Type == CSIT_CONTACT int groupID; // used when Type == CSIT_GROUP }; } CONTACTSETTINGSINIT; diff --git a/plugins/ExternalAPI/m_account.h b/plugins/ExternalAPI/m_account.h index d8441578eb..88ad067239 100644 --- a/plugins/ExternalAPI/m_account.h +++ b/plugins/ExternalAPI/m_account.h @@ -187,7 +187,7 @@ typedef struct CAccount PSWMRG MessagesAccessSO; //For clist contact notification - HANDLE hContact; + HCONTACT hContact; BOOL isCounting; struct CAccount *Next; diff --git a/plugins/ExternalAPI/m_flash.h b/plugins/ExternalAPI/m_flash.h index 2718e1982a..868a6cda07 100644 --- a/plugins/ExternalAPI/m_flash.h +++ b/plugins/ExternalAPI/m_flash.h @@ -79,7 +79,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // FLASHAVATAR structure typedef struct { - HANDLE hContact; // contact who flash avatar belongs to + HCONTACT hContact; // contact who flash avatar belongs to HWND hWindow; // handle of flash avatar object HWND hParentWindow; // handle of flash avatar's parent object TCHAR* cUrl; // url of .swf file diff --git a/plugins/ExternalAPI/m_ftpfile.h b/plugins/ExternalAPI/m_ftpfile.h index b5e49a0766..6bf82bb469 100644 --- a/plugins/ExternalAPI/m_ftpfile.h +++ b/plugins/ExternalAPI/m_ftpfile.h @@ -43,11 +43,11 @@ Boston, MA 02111-1307, USA. typedef struct { - int cbSize; // size of the structure - HANDLE hContact; // contact handle, can be NULL - BYTE ftpNum; // number of the FTP server which will be used for upload, can be one of FNUM_* values - BYTE mode; // upload mode, can be one of FMODE_* values - DWORD flags; // bitwise OR of the FUPL_* flags above + int cbSize; // size of the structure + HCONTACT hContact; // contact handle, can be NULL + BYTE ftpNum; // number of the FTP server which will be used for upload, can be one of FNUM_* values + BYTE mode; // upload mode, can be one of FMODE_* values + DWORD flags; // bitwise OR of the FUPL_* flags above union { TCHAR **pstzObjects; // pointer to the array of the object(s) to upload, content is determined by MODE value @@ -66,7 +66,7 @@ typedef struct // #define MS_FTPFILE_UPLOAD "FTPFile/Upload" -__inline static INT_PTR FTPFileUploadA(HANDLE hContact, BYTE ftpNum, BYTE mode, char **pszObjects, int objCount) +__inline static INT_PTR FTPFileUploadA(HCONTACT hContact, BYTE ftpNum, BYTE mode, char **pszObjects, int objCount) { FTPUPLOAD ftpu = {0}; ftpu.cbSize = sizeof(ftpu); @@ -78,7 +78,7 @@ __inline static INT_PTR FTPFileUploadA(HANDLE hContact, BYTE ftpNum, BYTE mode, return CallService(MS_FTPFILE_UPLOAD, 0, (LPARAM)&ftpu); } -__inline static INT_PTR FTPFileUploadW(HANDLE hContact, BYTE ftpNum, BYTE mode, wchar_t **pswzObjects, int objCount) +__inline static INT_PTR FTPFileUploadW(HCONTACT hContact, BYTE ftpNum, BYTE mode, wchar_t **pswzObjects, int objCount) { FTPUPLOAD ftpu = {0}; ftpu.cbSize = sizeof(ftpu); diff --git a/plugins/ExternalAPI/m_ieview.h b/plugins/ExternalAPI/m_ieview.h index e8fa237900..44b8d5201d 100644 --- a/plugins/ExternalAPI/m_ieview.h +++ b/plugins/ExternalAPI/m_ieview.h @@ -161,19 +161,19 @@ typedef struct tagIEVIEWEVENTDATA { #define IEVIEWEVENT_SIZE_V3 36 typedef struct { - int cbSize; // size of the strusture - int iType; // one of IEE_* values - DWORD dwFlags; // one of IEEF_* values - HWND hwnd; // HWND returned by IEW_CREATE - HANDLE hContact; // contact + int cbSize; // size of the strusture + int iType; // one of IEE_* values + DWORD dwFlags; // one of IEEF_* values + HWND hwnd; // HWND returned by IEW_CREATE + HCONTACT hContact; // contact union { - HANDLE hDbEventFirst; // first event to log, when IEE_LOG_EVENTS returns it will contain + HANDLE hDbEventFirst; // first event to log, when IEE_LOG_EVENTS returns it will contain // the last event actually logged or NULL if no event was logged (IEE_LOG_EVENTS) - IEVIEWEVENTDATA *eventData; // the pointer to an array of IEVIEWEVENTDATA objects (IEE_LOG_IEV_EVENTS) + IEVIEWEVENTDATA *eventData; // the pointer to an array of IEVIEWEVENTDATA objects (IEE_LOG_IEV_EVENTS) }; - int count; // number of events to log - int codepage; // ANSI codepage - const char *pszProto; // Name of the protocol + int count; // number of events to log + int codepage; // ANSI codepage + const char *pszProto; // Name of the protocol } IEVIEWEVENT; #define IEN_NAVIGATE 1 // navigate to the given destination diff --git a/plugins/ExternalAPI/m_msg_buttonsbar.h b/plugins/ExternalAPI/m_msg_buttonsbar.h index 31d75e84e9..e56bcafd81 100644 --- a/plugins/ExternalAPI/m_msg_buttonsbar.h +++ b/plugins/ExternalAPI/m_msg_buttonsbar.h @@ -79,13 +79,13 @@ typedef struct { int cbSize; - POINT pt; // screen coordinates for menus - char* pszModule; // button owners name - DWORD dwButtonId; // registered button ID - HWND hwndFrom; // button parents HWND - HANDLE hContact; // - DWORD flags; // BBCF_ flags - } CustomButtonClickData; + POINT pt; // screen coordinates for menus + char* pszModule; // button owners name + DWORD dwButtonId; // registered button ID + HWND hwndFrom; // button parents HWND + HCONTACT hContact; + DWORD flags; // BBCF_ flags +} CustomButtonClickData; //button flags diff --git a/plugins/ExternalAPI/m_popup2.h b/plugins/ExternalAPI/m_popup2.h index 3ddd798454..c28a94cded 100644 --- a/plugins/ExternalAPI/m_popup2.h +++ b/plugins/ExternalAPI/m_popup2.h @@ -70,7 +70,7 @@ typedef struct DWORD flags; // miranda bindings - HANDLE lchContact; + HCONTACT lchContact; HANDLE lchEvent; // style @@ -123,7 +123,7 @@ typedef struct // Unicode version of POPUPDATAEX_V2 typedef struct { - HANDLE lchContact; + HCONTACT lchContact; HICON lchIcon; union { diff --git a/plugins/ExternalAPI/m_smileyadd.h b/plugins/ExternalAPI/m_smileyadd.h index 1575502817..c0d9aacaa7 100644 --- a/plugins/ExternalAPI/m_smileyadd.h +++ b/plugins/ExternalAPI/m_smileyadd.h @@ -37,7 +37,7 @@ typedef struct //If not found or NULL, "Standard" will be used unsigned flags; //Flags (SAFLRE_*) that define the behaivior BOOL disableRedraw; //Parameter have been depricated, have no effect on operation - HANDLE hContact; //Contact handle + HCONTACT hContact; //Contact handle } SMADD_RICHEDIT3; //Replace smileys in a rich edit control... @@ -65,7 +65,7 @@ typedef struct LPARAM targetWParam; //Target WParam to be sent (LParam will be char* to select smiley) //see the example file. HWND hwndParent; //Parent window for smiley dialog - HANDLE hContact; //Contact handle + HCONTACT hContact; //Contact handle } SMADD_SHOWSEL3; //Show smiley selection window @@ -85,7 +85,7 @@ typedef struct //NULL if the buttonicon is not defined... int NumberOfVisibleSmileys; //Number of visible smileys defined. int NumberOfSmileys; //Number of total smileys defined - HANDLE hContact; //Contact handle + HCONTACT hContact; //Contact handle } SMADD_INFO2; //get button smiley icon @@ -131,7 +131,7 @@ typedef struct unsigned numSmileys; //Number of Smileys found, this parameter filled by SmileyAdd unsigned oflag; //One of the SAFL_ flags specifies content of the parse results //this parameter filled by SmileyAdd - HANDLE hContact; //Contact handle + HCONTACT hContact; //Contact handle } SMADD_BATCHPARSE2; typedef struct @@ -237,7 +237,7 @@ typedef struct typedef struct { unsigned cbSize; // size of the structure - HANDLE hContact; + HCONTACT hContact; int type; // 0 - directory, 1 - file; TCHAR* path; // smiley category name for reference } SMADD_CONT; diff --git a/plugins/ExternalAPI/m_spellchecker.h b/plugins/ExternalAPI/m_spellchecker.h index 15386af5dd..d3d4378872 100644 --- a/plugins/ExternalAPI/m_spellchecker.h +++ b/plugins/ExternalAPI/m_spellchecker.h @@ -23,7 +23,7 @@ Boston, MA 02111-1307, USA. typedef struct { int cbSize; - HANDLE hContact; // The contact to get the settings from, or NULL + HCONTACT hContact; // The contact to get the settings from, or NULL HWND hwnd; // The hwnd of the richedit char *window_name; // A name for this richedit } SPELLCHECKER_ITEM; diff --git a/plugins/ExternalAPI/m_text.h b/plugins/ExternalAPI/m_text.h index a87b7d36f0..3f8007b26d 100644 --- a/plugins/ExternalAPI/m_text.h +++ b/plugins/ExternalAPI/m_text.h @@ -47,7 +47,7 @@ typedef struct _tagMTEXT_interface { #else HANDLE (DLL_CALLCONV *CreateT) (HANDLE userHandle, char *text); #endif - HANDLE (DLL_CALLCONV *CreateEx) (HANDLE userHandle, HANDLE hContact, void *text, DWORD flags); + HANDLE (DLL_CALLCONV *CreateEx) (HANDLE userHandle, HCONTACT hContact, void *text, DWORD flags); int (DLL_CALLCONV *Measure) (HDC dc, SIZE *sz, HANDLE text); int (DLL_CALLCONV *Display) (HDC dc, POINT pos, SIZE sz, HANDLE text); int (DLL_CALLCONV *SetParent) (HANDLE text, HWND hwnd, RECT rect); @@ -109,7 +109,7 @@ enum typedef struct tagMTEXTCREATE { DWORD cbSize; - HANDLE hContact; + HCONTACT hContact; void *text; // this is 'char *' or 'WCHAR *' DWORD flags; diff --git a/plugins/ExternalAPI/m_tipper.h b/plugins/ExternalAPI/m_tipper.h index 21b6df7cef..eceb4cc573 100644 --- a/plugins/ExternalAPI/m_tipper.h +++ b/plugins/ExternalAPI/m_tipper.h @@ -26,7 +26,7 @@ Boston, MA 02111-1307, USA. // translation function type // use hContact, module and setting to read your db value(s) and put the resulting string into buff // return buff if the translation was successful, or return 0 for failure -typedef TCHAR *(TranslateFunc)(HANDLE hContact, const char *module, const char *setting_or_prefix, TCHAR *buff, int bufflen); +typedef TCHAR *(TranslateFunc)(HCONTACT hContact, const char *module, const char *setting_or_prefix, TCHAR *buff, int bufflen); typedef struct { TranslateFunc *transFunc; // address of your translation function (see typedef above) diff --git a/plugins/ExternalAPI/m_userinfoex.h b/plugins/ExternalAPI/m_userinfoex.h index cc7b1dc572..9e244309bf 100644 --- a/plugins/ExternalAPI/m_userinfoex.h +++ b/plugins/ExternalAPI/m_userinfoex.h @@ -335,7 +335,7 @@ This service returns one of the results of MS_DB_CONTACT_GETSETTING_STR! static FORCEINLINE INT_PTR DBGetContactSettingEx_Helper( - HANDLE hContact, + HCONTACT hContact, const char* pszProto, const char* pszSetting, DBVARIANT *dbv, diff --git a/plugins/ExternalAPI/m_variables.h b/plugins/ExternalAPI/m_variables.h index 701ad423f7..2fc1d22c78 100644 --- a/plugins/ExternalAPI/m_variables.h +++ b/plugins/ExternalAPI/m_variables.h @@ -77,7 +77,7 @@ typedef struct { WCHAR *wszExtraText; TCHAR *tszExtraText; }; - HANDLE hContact; // Handle to contact (can be NULL) -> The field "subject" + HCONTACT hContact; // Handle to contact (can be NULL) -> The field "subject" // represents this contact. int pCount; // (output) Number of succesful parsed tokens, needs to be set // to 0 before the call @@ -110,37 +110,33 @@ typedef struct { // The returned string needs to be freed using mir_free. #ifndef VARIABLES_NOHELPER -__inline static TCHAR *variables_parse(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact) { - - FORMATINFO fi; - - ZeroMemory(&fi, sizeof(fi)); - fi.cbSize = sizeof(fi); - fi.tszFormat = tszFormat; - fi.tszExtraText = tszExtraText; - fi.hContact = hContact; - fi.flags = FIF_TCHAR; - - return (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0); +__inline static TCHAR *variables_parse(TCHAR *tszFormat, TCHAR *tszExtraText, HCONTACT hContact) +{ + FORMATINFO fi = { sizeof(fi) }; + fi.tszFormat = tszFormat; + fi.tszExtraText = tszExtraText; + fi.hContact = hContact; + fi.flags = FIF_TCHAR; + return (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0); } #endif -__inline static TCHAR *variables_parse_ex(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact, +__inline static TCHAR *variables_parse_ex(TCHAR *tszFormat, TCHAR *tszExtraText, HCONTACT hContact, TCHAR **tszaTemporaryVars, int cbTemporaryVarsSize) { - FORMATINFO fi; - - ZeroMemory(&fi, sizeof(fi)); - fi.cbSize = sizeof(fi); - fi.tszFormat = tszFormat; - fi.tszExtraText = tszExtraText; - fi.hContact = hContact; - fi.flags = FIF_TCHAR; - fi.tszaTemporaryVars = tszaTemporaryVars; - fi.cbTemporaryVarsSize = cbTemporaryVarsSize; - - return (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0); + FORMATINFO fi = { 0 }; + + ZeroMemory(&fi, sizeof(fi)); + fi.cbSize = sizeof(fi); + fi.tszFormat = tszFormat; + fi.tszExtraText = tszExtraText; + fi.hContact = hContact; + fi.flags = FIF_TCHAR; + fi.tszaTemporaryVars = tszaTemporaryVars; + fi.cbTemporaryVarsSize = cbTemporaryVarsSize; + return (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0); } + // Helper #2: variables_parsedup // ------------------------ // Returns a _strdup()'ed copy of the unparsed string when Variables is not @@ -149,9 +145,9 @@ __inline static TCHAR *variables_parse_ex(TCHAR *tszFormat, TCHAR *tszExtraText, // Note: The returned pointer needs to be released using your own free(). #ifndef VARIABLES_NOHELPER -__inline static TCHAR *variables_parsedup(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact) +__inline static TCHAR *variables_parsedup(TCHAR *tszFormat, TCHAR *tszExtraText, HCONTACT hContact) { - if ( ServiceExists(MS_VARS_FORMATSTRING)) { + if (ServiceExists(MS_VARS_FORMATSTRING)) { FORMATINFO fi = { sizeof(fi) }; fi.tszFormat = tszFormat; fi.tszExtraText = tszExtraText; @@ -164,10 +160,10 @@ __inline static TCHAR *variables_parsedup(TCHAR *tszFormat, TCHAR *tszExtraText, return tszFormat ? mir_tstrdup(tszFormat) : tszFormat; } -__inline static TCHAR *variables_parsedup_ex(TCHAR *tszFormat, TCHAR *tszExtraText, HANDLE hContact, +__inline static TCHAR *variables_parsedup_ex(TCHAR *tszFormat, TCHAR *tszExtraText, HCONTACT hContact, TCHAR **tszaTemporaryVars, int cbTemporaryVarsSize) { - if ( ServiceExists(MS_VARS_FORMATSTRING)) { + if (ServiceExists(MS_VARS_FORMATSTRING)) { FORMATINFO fi = { sizeof(fi) }; fi.tszFormat = tszFormat; fi.tszExtraText = tszExtraText; diff --git a/plugins/ExternalAPI/m_weather.h b/plugins/ExternalAPI/m_weather.h index f76ab88db1..5a290b838d 100644 --- a/plugins/ExternalAPI/m_weather.h +++ b/plugins/ExternalAPI/m_weather.h @@ -47,7 +47,7 @@ along with this program. If not, see . // weather conditions (added in v0.1.2.0) typedef struct { - HANDLE hContact; + HCONTACT hContact; TCHAR id[128]; TCHAR city[128]; TCHAR update[64]; diff --git a/plugins/FTPFileYM/src/dialog.cpp b/plugins/FTPFileYM/src/dialog.cpp index 8c8236b09b..fa6a1f6dbd 100644 --- a/plugins/FTPFileYM/src/dialog.cpp +++ b/plugins/FTPFileYM/src/dialog.cpp @@ -229,7 +229,7 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar } case WM_COMMAND: { - HANDLE hContact = uDlg->tabs[uDlg->activeTab]->job->hContact; + HCONTACT hContact = uDlg->tabs[uDlg->activeTab]->job->hContact; if (hContact != NULL) { if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam),MPCF_CONTACTMENU), (LPARAM)hContact)) diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index 7f44b271e4..8e91fba3fa 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -35,7 +35,7 @@ extern Options &opt; int PrebuildContactMenu(WPARAM wParam, LPARAM lParam); void PrebuildMainMenu(); int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam); -int UploadFile(HANDLE hContact, int iFtpNum, UploadJob::EMode mode); +int UploadFile(HCONTACT hContact, int iFtpNum, UploadJob::EMode mode); static PLUGININFOEX pluginInfoEx = { @@ -210,7 +210,7 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { bool bIsContact = false; - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto) bIsContact = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) ? true : false; bool bHideRoot = opt.bHideInactive; @@ -236,7 +236,7 @@ void PrebuildMainMenu() int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam) { CustomButtonClickData *cbc = (CustomButtonClickData *)lParam; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == 1 && hContact) { @@ -292,7 +292,7 @@ int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam) return 0; } -int UploadFile(HANDLE hContact, int iFtpNum, GenericJob::EMode mode, void **objects, int objCount, DWORD flags) +int UploadFile(HCONTACT hContact, int iFtpNum, GenericJob::EMode mode, void **objects, int objCount, DWORD flags) { if (!ftpList[iFtpNum]->isValid()) { @@ -334,7 +334,7 @@ int UploadFile(HANDLE hContact, int iFtpNum, GenericJob::EMode mode, void **obje return 0; } -int UploadFile(HANDLE hContact, int iFtpNum, GenericJob::EMode mode) +int UploadFile(HCONTACT hContact, int iFtpNum, GenericJob::EMode mode) { return UploadFile(hContact, iFtpNum, mode, NULL, 0, 0); } @@ -363,7 +363,7 @@ INT_PTR ShowManagerService(WPARAM wParam, LPARAM lParam) INT_PTR ContactMenuService(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; int ftpNum = lParam & (1|2|4); int mode = lParam & (UploadJob::FTP_RAWFILE | UploadJob::FTP_ZIPFILE | UploadJob::FTP_ZIPFOLDER); return UploadFile(hContact, ftpNum, (UploadJob::EMode)mode); diff --git a/plugins/FTPFileYM/src/job_generic.cpp b/plugins/FTPFileYM/src/job_generic.cpp index a723c45931..bfac7ccf79 100644 --- a/plugins/FTPFileYM/src/job_generic.cpp +++ b/plugins/FTPFileYM/src/job_generic.cpp @@ -21,8 +21,8 @@ along with this program. If not, see . extern UploadDialog *uDlg; extern ServerList &ftpList; -GenericJob::GenericJob(HANDLE _hContact, int _iFtpNum, EMode _mode) -:hContact(_hContact),iFtpNum(_iFtpNum),mode(_mode),status(STATUS_CREATED),ftp(ftpList[iFtpNum]) +GenericJob::GenericJob(HCONTACT _hContact, int _iFtpNum, EMode _mode) : + hContact(_hContact),iFtpNum(_iFtpNum),mode(_mode),status(STATUS_CREATED),ftp(ftpList[iFtpNum]) { this->stzFilePath[0] = 0; this->stzFileName[0] = 0; diff --git a/plugins/FTPFileYM/src/job_generic.h b/plugins/FTPFileYM/src/job_generic.h index 618d891a82..0003045300 100644 --- a/plugins/FTPFileYM/src/job_generic.h +++ b/plugins/FTPFileYM/src/job_generic.h @@ -66,7 +66,7 @@ public: STATUS_COMPLETED }; - HANDLE hContact; + HCONTACT hContact; int iFtpNum, fileID; ServerList::FTP *ftp; TCHAR stzFilePath[1024]; @@ -79,7 +79,7 @@ public: vector files; TCHAR * operator[] (int i) const { return files[i];} - GenericJob(HANDLE hContact, int iFtpNum, EMode mode); + GenericJob(HCONTACT hContact, int iFtpNum, EMode mode); GenericJob(GenericJob *job); virtual ~GenericJob(); diff --git a/plugins/FTPFileYM/src/job_packer.cpp b/plugins/FTPFileYM/src/job_packer.cpp index 8002d2b0ed..a57d9dc402 100644 --- a/plugins/FTPFileYM/src/job_packer.cpp +++ b/plugins/FTPFileYM/src/job_packer.cpp @@ -25,8 +25,8 @@ int PackerJob::iRunningJobCount = 0; extern UploadDialog *uDlg; extern Options &opt; -PackerJob::PackerJob(HANDLE _hContact, int _iFtpNum, EMode _mode) -:GenericJob(_hContact, _iFtpNum, _mode),uiFileSize(0),uiReaded(0),lastUpdateTick(0) +PackerJob::PackerJob(HCONTACT _hContact, int _iFtpNum, EMode _mode) : + GenericJob(_hContact, _iFtpNum, _mode),uiFileSize(0),uiReaded(0),lastUpdateTick(0) { } void PackerJob::getZipFilePath() diff --git a/plugins/FTPFileYM/src/job_packer.h b/plugins/FTPFileYM/src/job_packer.h index 2c2c22ddc6..37c7edc055 100644 --- a/plugins/FTPFileYM/src/job_packer.h +++ b/plugins/FTPFileYM/src/job_packer.h @@ -46,7 +46,7 @@ private: bool isCanceled(); public: - PackerJob(HANDLE hContact, int iFtpNum, EMode mode); + PackerJob(HCONTACT hContact, int iFtpNum, EMode mode); virtual ~PackerJob() {}; virtual void start(); diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp index df01b5e1aa..2d0a596da9 100644 --- a/plugins/FTPFileYM/src/job_upload.cpp +++ b/plugins/FTPFileYM/src/job_upload.cpp @@ -25,7 +25,7 @@ int UploadJob::iRunningJobCount = 0; extern UploadDialog *uDlg; extern ServerList &ftpList; -UploadJob::UploadJob(HANDLE _hContact, int _iFtpNum, EMode _mode) : +UploadJob::UploadJob(HCONTACT _hContact, int _iFtpNum, EMode _mode) : GenericJob(_hContact, _iFtpNum, _mode),fp(NULL) { this->szFileLink[0] = 0; diff --git a/plugins/FTPFileYM/src/job_upload.h b/plugins/FTPFileYM/src/job_upload.h index fa29e3c640..0679773cfd 100644 --- a/plugins/FTPFileYM/src/job_upload.h +++ b/plugins/FTPFileYM/src/job_upload.h @@ -65,7 +65,7 @@ public: char szFileLink[256]; static Event jobDone; - UploadJob(HANDLE _hContact, int _iFtpNum, EMode _mode); + UploadJob(HCONTACT _hContact, int _iFtpNum, EMode _mode); UploadJob(UploadJob *job); UploadJob(PackerJob *job); virtual ~UploadJob(); diff --git a/plugins/FTPFileYM/src/mir_db.cpp b/plugins/FTPFileYM/src/mir_db.cpp index 13d1d645a7..bf21c1f472 100644 --- a/plugins/FTPFileYM/src/mir_db.cpp +++ b/plugins/FTPFileYM/src/mir_db.cpp @@ -18,63 +18,63 @@ along with this program. If not, see . #include "common.h" -int DB::setByteF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue) +int DB::setByteF(HCONTACT hContact, char *szModule, char *szSetting, int id, int iValue) { char formSet[256]; mir_snprintf(formSet, sizeof(formSet), szSetting, id); return db_set_b(hContact, szModule, formSet, iValue); } -int DB::setWordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue) +int DB::setWordF(HCONTACT hContact, char *szModule, char *szSetting, int id, int iValue) { char formSet[256]; mir_snprintf(formSet, sizeof(formSet), szSetting, id); return db_set_w(hContact, szModule, formSet, iValue); } -int DB::setDwordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue) +int DB::setDwordF(HCONTACT hContact, char *szModule, char *szSetting, int id, int iValue) { char formSet[256]; mir_snprintf(formSet, sizeof(formSet), szSetting, id); return db_set_dw(hContact, szModule, formSet, iValue); } -int DB::setAStringF(HANDLE hContact, char *szModule, char *szSetting, int id, char *szValue) +int DB::setAStringF(HCONTACT hContact, char *szModule, char *szSetting, int id, char *szValue) { char formSet[256]; mir_snprintf(formSet, sizeof(formSet), szSetting, id); return db_set_s(hContact, szModule, formSet, szValue); } -int DB::setStringF(HANDLE hContact, char *szModule, char *szSetting, int id, TCHAR *stzValue) +int DB::setStringF(HCONTACT hContact, char *szModule, char *szSetting, int id, TCHAR *stzValue) { char formSet[256]; mir_snprintf(formSet, sizeof(formSet), szSetting, id); return db_set_ts(hContact, szModule, formSet, stzValue); } -int DB::getByteF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue) +int DB::getByteF(HCONTACT hContact, char *szModule, char *szSetting, int id, int iErrorValue) { char formSet[256]; mir_snprintf(formSet, sizeof(formSet), szSetting, id); return db_get_b(hContact, szModule, formSet, iErrorValue); } -int DB::getWordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue) +int DB::getWordF(HCONTACT hContact, char *szModule, char *szSetting, int id, int iErrorValue) { char formSet[256]; mir_snprintf(formSet, sizeof(formSet), szSetting, id); return db_get_w(hContact, szModule, formSet, iErrorValue); } -int DB::getDwordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue) +int DB::getDwordF(HCONTACT hContact, char *szModule, char *szSetting, int id, int iErrorValue) { char formSet[256]; mir_snprintf(formSet, sizeof(formSet), szSetting, id); return db_get_dw(hContact, szModule, formSet, iErrorValue); } -int DB::getAString(HANDLE hContact, char *szModule, char *szSetting, char *buff) +int DB::getAString(HCONTACT hContact, char *szModule, char *szSetting, char *buff) { DBVARIANT dbv; if (!db_get_s(hContact, szModule, szSetting, &dbv)) @@ -88,14 +88,14 @@ int DB::getAString(HANDLE hContact, char *szModule, char *szSetting, char *buff) return 1; } -int DB::getAStringF(HANDLE hContact, char *szModule, char *szSetting, int id, char *buff) +int DB::getAStringF(HCONTACT hContact, char *szModule, char *szSetting, int id, char *buff) { char formSet[256]; mir_snprintf(formSet, sizeof(formSet), szSetting, id); return getAString(hContact, szModule, formSet, buff); } -int DB::getString(HANDLE hContact, char *szModule, char *szSetting, TCHAR *buff) +int DB::getString(HCONTACT hContact, char *szModule, char *szSetting, TCHAR *buff) { DBVARIANT dbv; if (!db_get_ts(hContact, szModule, szSetting, &dbv)) @@ -109,14 +109,14 @@ int DB::getString(HANDLE hContact, char *szModule, char *szSetting, TCHAR *buff) return 1; } -int DB::getStringF(HANDLE hContact, char *szModule, char *szSetting, int id, TCHAR *buff) +int DB::getStringF(HCONTACT hContact, char *szModule, char *szSetting, int id, TCHAR *buff) { char formSet[256]; mir_snprintf(formSet, sizeof(formSet), szSetting, id); return getString(hContact, szModule, formSet, buff); } -int DB::deleteSettingF(HANDLE hContact, char *szModule, char *szSetting, int id) +int DB::deleteSettingF(HCONTACT hContact, char *szModule, char *szSetting, int id) { char formSet[256]; mir_snprintf(formSet, sizeof(formSet), szSetting, id); diff --git a/plugins/FTPFileYM/src/mir_db.h b/plugins/FTPFileYM/src/mir_db.h index d46b16fb06..e5175fdc0a 100644 --- a/plugins/FTPFileYM/src/mir_db.h +++ b/plugins/FTPFileYM/src/mir_db.h @@ -23,22 +23,22 @@ along with this program. If not, see . class DB { public: - static int setByteF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue); - static int setWordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue); - static int setDwordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iValue); + static int setByteF(HCONTACT hContact, char *szModule, char *szSetting, int id, int iValue); + static int setWordF(HCONTACT hContact, char *szModule, char *szSetting, int id, int iValue); + static int setDwordF(HCONTACT hContact, char *szModule, char *szSetting, int id, int iValue); - static int setAStringF(HANDLE hContact, char *szModule, char *szSetting, int id, char *szValue); - static int setStringF(HANDLE hContact, char *szModule, char *szSetting, int id, TCHAR *stzValue); + static int setAStringF(HCONTACT hContact, char *szModule, char *szSetting, int id, char *szValue); + static int setStringF(HCONTACT hContact, char *szModule, char *szSetting, int id, TCHAR *stzValue); - static int getByteF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue = -1); - static int getWordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue = -1); - static int getDwordF(HANDLE hContact, char *szModule, char *szSetting, int id, int iErrorValue = -1); + static int getByteF(HCONTACT hContact, char *szModule, char *szSetting, int id, int iErrorValue = -1); + static int getWordF(HCONTACT hContact, char *szModule, char *szSetting, int id, int iErrorValue = -1); + static int getDwordF(HCONTACT hContact, char *szModule, char *szSetting, int id, int iErrorValue = -1); // !!!!!!!!!!!!!!!!!!! dangerous as hell - static int getAString(HANDLE hContact, char *szModule, char *szSetting, char *buff); - static int getAStringF(HANDLE hContact, char *szModule, char *szSetting, int id, char *buff); - static int getString(HANDLE hContact, char *szModule, char *szSetting, TCHAR *buff); - static int getStringF(HANDLE hContact, char *szModule, char *szSetting, int id, TCHAR *buff); + static int getAString(HCONTACT hContact, char *szModule, char *szSetting, char *buff); + static int getAStringF(HCONTACT hContact, char *szModule, char *szSetting, int id, char *buff); + static int getString(HCONTACT hContact, char *szModule, char *szSetting, TCHAR *buff); + static int getStringF(HCONTACT hContact, char *szModule, char *szSetting, int id, TCHAR *buff); - static int deleteSettingF(HANDLE hContact, char *szModule, char *szSetting, int id); + static int deleteSettingF(HCONTACT hContact, char *szModule, char *szSetting, int id); }; diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp index 0cfc3b4757..b61fc00f95 100644 --- a/plugins/FavContacts/src/contact_cache.cpp +++ b/plugins/FavContacts/src/contact_cache.cpp @@ -2,7 +2,7 @@ int __cdecl CContactCache::OnDbEventAdded(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HANDLE hEvent = (HANDLE)lParam; DBEVENTINFO dbei = {0}; @@ -81,7 +81,7 @@ void CContactCache::Rebuild() unsigned long timestamp = time(NULL); m_lastUpdate = time(NULL); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { TContactInfo *info = new TContactInfo; info->hContact = hContact; info->rate = 0; @@ -102,7 +102,7 @@ void CContactCache::Rebuild() } } -HANDLE CContactCache::get(int rate) +HCONTACT CContactCache::get(int rate) { if (rate >= 0 && rate < m_cache.getCount()) return m_cache[rate].hContact; @@ -116,7 +116,7 @@ float CContactCache::getWeight(int rate) return -1; } -static bool AppendInfo(TCHAR *buf, int size, HANDLE hContact, int info) +static bool AppendInfo(TCHAR *buf, int size, HCONTACT hContact, int info) { CONTACTINFO ci = {0}; ci.cbSize = sizeof(ci); diff --git a/plugins/FavContacts/src/contact_cache.h b/plugins/FavContacts/src/contact_cache.h index d4a47ba477..15c3b2c81a 100644 --- a/plugins/FavContacts/src/contact_cache.h +++ b/plugins/FavContacts/src/contact_cache.h @@ -10,7 +10,7 @@ private: struct TContactInfo { - HANDLE hContact; + HCONTACT hContact; float rate; TCHAR info[INFOSIZE]; bool infoLoaded; @@ -52,7 +52,7 @@ public: void Unlock() { LeaveCriticalSection(&m_cs); } void Rebuild(); - HANDLE get(int rate); + HCONTACT get(int rate); float getWeight(int rate); bool filter(int rate, TCHAR *str); }; diff --git a/plugins/FavContacts/src/favlist.h b/plugins/FavContacts/src/favlist.h index 04ed0d20e2..c0ebd6e2d0 100644 --- a/plugins/FavContacts/src/favlist.h +++ b/plugins/FavContacts/src/favlist.h @@ -4,7 +4,7 @@ struct TContactInfo { private: - HANDLE hContact; + HCONTACT hContact; DWORD status; TCHAR *name; TCHAR *group; @@ -12,7 +12,7 @@ private: float fRate; public: - TContactInfo(HANDLE hContact, bool bManual, float fRate = 0) + TContactInfo(HCONTACT hContact, bool bManual, float fRate = 0) { DBVARIANT dbv = {0}; @@ -41,7 +41,7 @@ public: mir_free(group); } - HANDLE getHandle() const + HCONTACT getHandle() const { return hContact; } @@ -89,7 +89,7 @@ public: return nGroups; } - TContactInfo *addContact(HANDLE hContact, bool bManual) + TContactInfo *addContact(HCONTACT hContact, bool bManual) { TContactInfo *info = new TContactInfo(hContact, bManual); this->insert(info); @@ -102,7 +102,7 @@ public: nGroups = 1; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if (db_get_b(hContact, "FavContacts", "IsFavourite", 0)) { TCHAR *group = addContact(hContact, true)->getGroup(); @@ -113,7 +113,7 @@ public: int nRecent = 0; for (int i = 0; nRecent < g_Options.wMaxRecent; ++i) { - HANDLE hContact = g_contactCache->get(i); + HCONTACT hContact = g_contactCache->get(i); if (!hContact) break; if (!db_get_b(hContact, "FavContacts", "IsFavourite", 0)) { diff --git a/plugins/FavContacts/src/http_api.cpp b/plugins/FavContacts/src/http_api.cpp index da0f9ee01c..bce57b0a7a 100644 --- a/plugins/FavContacts/src/http_api.cpp +++ b/plugins/FavContacts/src/http_api.cpp @@ -67,7 +67,7 @@ public: for (int i = 0; i < favList.getCount(); ++i) { - HANDLE hContact = favList[i]->getHandle(); + HCONTACT hContact = favList[i]->getHandle(); TCHAR *name = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); AVATARCACHEENTRY *avatar = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0); int status = db_get_w(hContact, GetContactProto(hContact), "Status", ID_STATUS_OFFLINE); diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index 5bb306246c..b83dc2aeba 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -248,7 +248,7 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) Hotkey_Register(&hotkey); if (ServiceExists(MS_AV_GETAVATARBITMAP)) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if (db_get_b(hContact, "FavContacts", "IsFavourite", 0)) CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0); } @@ -387,7 +387,7 @@ static BOOL sttMeasureItem_Group(LPMEASUREITEMSTRUCT lpmis, Options *options) static BOOL sttMeasureItem_Contact(LPMEASUREITEMSTRUCT lpmis, Options *options) { - HANDLE hContact = (HANDLE)lpmis->itemData; + HCONTACT hContact = (HCONTACT)lpmis->itemData; lpmis->itemHeight = 4; lpmis->itemWidth = 8+10; @@ -525,7 +525,7 @@ void ImageList_DrawDimmed(HIMAGELIST himl, int i, HDC hdc, int left, int top, UI static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) { - HANDLE hContact = (HANDLE)lpdis->itemData; + HCONTACT hContact = (HCONTACT)lpdis->itemData; HDC hdcTemp = CreateCompatibleDC(lpdis->hDC); HBITMAP hbmTemp = CreateCompatibleBitmap(lpdis->hDC, lpdis->rcItem.right-lpdis->rcItem.left, lpdis->rcItem.bottom-lpdis->rcItem.top); @@ -703,7 +703,7 @@ static BOOL sttDrawItem(LPDRAWITEMSTRUCT lpdis, Options *options=NULL) static LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static HANDLE hContact = NULL; + static HCONTACT hContact = NULL; switch (message) { case WM_MEASUREITEM: @@ -749,7 +749,7 @@ static LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, int nRecent = 0; int maxRecent = g_Options.wMaxRecent ? g_Options.wMaxRecent : 10; for (int i = 0; nRecent < maxRecent; ++i) { - HANDLE hContact = g_contactCache->get(i); + HCONTACT hContact = g_contactCache->get(i); if (!hContact) break; if (!g_contactCache->filter(i, g_filter)) continue; @@ -764,7 +764,7 @@ static LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, MENUITEMINFO mii = { sizeof(mii) }; mii.fMask = MIIM_DATA; GetMenuItemInfo((HMENU)lParam, wParam, TRUE, &mii); - HANDLE hContact = (HANDLE)mii.dwItemData; + HCONTACT hContact = (HCONTACT)mii.dwItemData; if (!CallService(MS_DB_CONTACT_IS, mii.dwItemData, 0)) return FALSE; HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)hContact, 0); @@ -793,7 +793,7 @@ int sttShowMenu(bool centered) SIZE szColumn = {0}; TCHAR *prevGroup = NULL; int i, idItem = 100; - HANDLE hContact; + HCONTACT hContact; favList.build(); @@ -867,7 +867,7 @@ int sttShowMenu(bool centered) mii.cbSize = sizeof(mii); mii.fMask = MIIM_DATA; GetMenuItemInfo(hMenu, res, FALSE, &mii); - hContact = (HANDLE)mii.dwItemData; + hContact = (HCONTACT)mii.dwItemData; } SetForegroundWindow(hwndSave); DestroyMenu(hMenu); @@ -940,7 +940,7 @@ int ProcessSrmmIconClick( WPARAM wParam, LPARAM lParam ) StatusIconClickData *sicd = (StatusIconClickData *)lParam; if (lstrcmpA(sicd->szModule, "FavContacts")) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!hContact) return 0; @@ -1005,7 +1005,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA hSelectedContact = db_find_first(); { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) SendDlgItemMessage(hwnd, IDC_CLIST, CLM_SETCHECKMARK, SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0), db_get_b(hContact, "FavContacts", "IsFavourite", 0)); @@ -1127,7 +1127,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA sttSaveOptions(); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { BYTE fav = SendDlgItemMessage(hwnd, IDC_CLIST, CLM_GETCHECKMARK, SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0), 0); if (fav != db_get_b(hContact, "FavContacts", "IsFavourite", 0)) @@ -1145,7 +1145,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case CLN_NEWCONTACT: iSelection = (int)((NMCLISTCONTROL *)lParam)->hItem; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0) == iSelection) { SendDlgItemMessage(hwnd, IDC_CLIST, CLM_SETCHECKMARK, iSelection, db_get_b(hContact, "FavContacts", "IsFavourite", 0)); @@ -1156,7 +1156,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA case CLN_CHECKCHANGED: iSelection = (int)((NMCLISTCONTROL *)lParam)->hItem; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (SendDlgItemMessage(hwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0) == iSelection) { hSelectedContact = hContact; RedrawWindow(GetDlgItem(hwnd, IDC_CANVAS), NULL, NULL, RDW_INVALIDATE); diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index ba9e2ec7c2..de324848ae 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -64,7 +64,7 @@ char cCmdList[CMD_COUNT] = static int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - HANDLE hContact = PUGetContact(hWnd); + HCONTACT hContact = PUGetContact(hWnd); HWND hDlg = (HWND)PUGetPluginData(hWnd); /* if(hContact) @@ -112,7 +112,7 @@ static int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM // // Just create simple Popup for specified contact // -void MakePopupMsg(HWND hDlg, HANDLE hContact, char *msg) +void MakePopupMsg(HWND hDlg, HCONTACT hContact, char *msg) { HWND hFocused = GetForegroundWindow(); if(hDlg == hFocused || hDlg == GetParent(hFocused)) return; @@ -121,7 +121,7 @@ void MakePopupMsg(HWND hDlg, HANDLE hContact, char *msg) //The text for the second line. You could even make something like: char lpzText[128]; lstrcpy(lpzText, "Hello world!"); It's your choice. // POPUPDATA ppd = { 0 }; - ppd.lchContact = (HANDLE)hContact; + ppd.lchContact = hContact; ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SMALLICON)); lstrcpy(ppd.lpzContactName, (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0)); lstrcpy(ppd.lpzText, msg); @@ -156,7 +156,7 @@ int RetrieveFileSize(char *filename) return handle; } -FILEECHO::FILEECHO(HANDLE Contact) +FILEECHO::FILEECHO(HCONTACT Contact) { hContact = Contact; dwSendInterval = db_get_dw(NULL, SERVICE_NAME, "SendDelay", 6000); @@ -469,7 +469,7 @@ void FILEECHO::incomeRequest(char *param) SkinPlaySound("RecvFile"); int AutoMin = db_get_b(NULL,"SRFile","AutoMin",0); - if(db_get_b(NULL,"SRFile","AutoAccept",0) && !db_get_b((HANDLE)hContact,"CList","NotOnList",0)) + if(db_get_b(NULL,"SRFile","AutoAccept",0) && !db_get_b(hContact,"CList","NotOnList",0)) { PostMessage(hDlg, WM_COMMAND, IDC_PLAY, 0); if(AutoMin) diff --git a/plugins/FileAsMessage/src/dialog.h b/plugins/FileAsMessage/src/dialog.h index 49099703de..e8914ef5b5 100644 --- a/plugins/FileAsMessage/src/dialog.h +++ b/plugins/FileAsMessage/src/dialog.h @@ -54,7 +54,7 @@ extern char cFECmd[CMD_COUNT]; struct FILEECHO { public: - HANDLE hContact; + HCONTACT hContact; HWND hDlg; bool inSend; @@ -90,7 +90,7 @@ public: uint overhead; #endif - FILEECHO(HANDLE Contact); + FILEECHO(HCONTACT Contact); void setState(DWORD state); void updateProgress(); diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp index 247072897c..66362e9cdb 100644 --- a/plugins/FileAsMessage/src/main.cpp +++ b/plugins/FileAsMessage/src/main.cpp @@ -54,7 +54,7 @@ int OnSettingChanged(WPARAM wParam,LPARAM lParam) { DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; - HWND hwnd = WindowList_Find(hFileList,(HANDLE)wParam); + HWND hwnd = WindowList_Find(hFileList,(HCONTACT)wParam); PostMessage(hwnd, WM_FE_STATUSCHANGE, 0,0); //OnSkinIconsChanged(0,0); //PostMessage(hwnd, WM_FE_SKINCHANGE, 0,0); @@ -66,7 +66,7 @@ INT_PTR OnRecvFile(WPARAM wParam, LPARAM lParam) { CLISTEVENT *clev = (CLISTEVENT*)lParam; - HWND hwnd = WindowList_Find(hFileList,(HANDLE)clev->hContact); + HWND hwnd = WindowList_Find(hFileList, clev->hContact); if(IsWindow(hwnd)) { ShowWindow(hwnd, SW_SHOWNORMAL); @@ -94,7 +94,7 @@ INT_PTR OnRecvFile(WPARAM wParam, LPARAM lParam) INT_PTR OnSendFile(WPARAM wParam, LPARAM lParam) { - HWND hwnd = WindowList_Find(hFileList,(HANDLE)wParam); + HWND hwnd = WindowList_Find(hFileList, (HCONTACT)wParam); if(IsWindow(hwnd)) { SetForegroundWindow(hwnd); @@ -103,7 +103,7 @@ INT_PTR OnSendFile(WPARAM wParam, LPARAM lParam) else { if(hwnd != 0) WindowList_Remove(hFileList, hwnd); - FILEECHO *fe = new FILEECHO((HANDLE)wParam); + FILEECHO *fe = new FILEECHO((HCONTACT)wParam); fe->inSend = TRUE; hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, DialogProc, (LPARAM)fe); if(hwnd == NULL) @@ -125,11 +125,11 @@ INT_PTR OnRecvMessage(WPARAM wParam, LPARAM lParam) if(strncmp(ppre->szMessage, szServicePrefix, strlen(szServicePrefix))) return CallService(MS_PROTO_CHAINRECV, wParam, lParam); - HWND hwnd = WindowList_Find(hFileList, (HANDLE)pccsd->hContact); + HWND hwnd = WindowList_Find(hFileList, pccsd->hContact); if(!IsWindow(hwnd)) { if(hwnd != 0) WindowList_Remove(hFileList, hwnd); - FILEECHO *fe = new FILEECHO((HANDLE)pccsd->hContact); + FILEECHO *fe = new FILEECHO(pccsd->hContact); fe->inSend = FALSE; hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, DialogProc, (LPARAM)fe); if(hwnd == NULL) diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 63683d92d0..cf778443a1 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -140,7 +140,7 @@ void RegisterIcons() * 3)Set ExtraImage for contact */ -static void SetSrmmIcon(HANDLE hContact, LPTSTR ptszMirver) +static void SetSrmmIcon(HCONTACT hContact, LPTSTR ptszMirver) { StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULENAME; @@ -156,7 +156,7 @@ static void SetSrmmIcon(HANDLE hContact, LPTSTR ptszMirver) Srmm_ModifyIcon(hContact, &sid); } -int __fastcall ApplyFingerprintImage(HANDLE hContact, LPTSTR szMirVer) +int __fastcall ApplyFingerprintImage(HCONTACT hContact, LPTSTR szMirVer) { if (hContact == NULL) return 0; @@ -838,7 +838,7 @@ static int OnIconsChanged(WPARAM wParam, LPARAM lParam) int OnExtraImageApply(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; @@ -862,7 +862,7 @@ int OnExtraImageApply(WPARAM wParam, LPARAM lParam) static int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; diff --git a/plugins/FingerprintNG/src/options.cpp b/plugins/FingerprintNG/src/options.cpp index f584d20d95..13614c5a19 100644 --- a/plugins/FingerprintNG/src/options.cpp +++ b/plugins/FingerprintNG/src/options.cpp @@ -103,7 +103,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP ClearFI(); RegisterIcons(); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) OnExtraImageApply((WPARAM)hContact, 0); } break; diff --git a/plugins/FlashAvatars/src/cflash.cpp b/plugins/FlashAvatars/src/cflash.cpp index 5d8c0a70e8..b6fca56704 100644 --- a/plugins/FlashAvatars/src/cflash.cpp +++ b/plugins/FlashAvatars/src/cflash.cpp @@ -31,13 +31,13 @@ int __fastcall strcmpnull(const char *str1, const char *str2) { struct flash_avatar_item : public MZeroedObject { - HANDLE hContact; + HCONTACT hContact; FLASHAVATAR hFA; IShockwaveFlash* pFlash; char* getProto() { return (hFA.cProto) ? hFA.cProto : GetContactProto(hFA.hContact); } - flash_avatar_item(HANDLE contact, FLASHAVATAR& fa, IShockwaveFlash *flash) { hContact = contact; hFA = fa; pFlash = flash; } + flash_avatar_item(HCONTACT contact, FLASHAVATAR& fa, IShockwaveFlash *flash) { hContact = contact; hFA = fa; pFlash = flash; } }; static int CompareFlashItems(const flash_avatar_item* p1, const flash_avatar_item* p2) { @@ -542,7 +542,7 @@ static int eventAdded(WPARAM wParam, LPARAM lParam) face = AV_NORMAL; } - HANDLE hContact = (dbei.flags & DBEF_SENT) ? 0 : (HANDLE)wParam; + HCONTACT hContact = (dbei.flags & DBEF_SENT) ? 0 : (HCONTACT)wParam; for(int i=0; ihContact == hContact && !strcmpnull(dbei.szModule, item->getProto())) { diff --git a/plugins/FloatingContacts/src/fltcont.h b/plugins/FloatingContacts/src/fltcont.h index c4e98ab498..d7d1a12bb6 100644 --- a/plugins/FloatingContacts/src/fltcont.h +++ b/plugins/FloatingContacts/src/fltcont.h @@ -140,7 +140,7 @@ static __forceinline BOOL ImageList_GetIconSize_my(HIMAGELIST himl, SIZE &sz) return res; } -void RegHotkey ( HANDLE hContact, HWND hwnd ); +void RegHotkey ( HCONTACT hContact, HWND hwnd ); BOOL IsStatusVisible ( int status ); BOOL HideOnFullScreen (); void SendMsgDialog ( HWND hwnd, TCHAR *pText ); diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 9e2892a204..17e2cb089e 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -22,18 +22,18 @@ No warranty for any misbehaviour. // TODO: move to some more approriate place, probably part of Thumbs manager static void LoadContacts(void); -static void LoadContact(HANDLE hContact); +static void LoadContact(HCONTACT hContact); // Internal funcs static void RepaintWindow(HWND hwnd, HDC hdc); static void LoadMenus(); -static void CreateThumbWnd(TCHAR *ptszName, HANDLE hContact, int nX, int nY); +static void CreateThumbWnd(TCHAR *ptszName, HCONTACT hContact, int nX, int nY); static void RegisterWindowClass(void); static void UnregisterWindowClass(void); static void LoadDBSettings(void); static void CreateThumbsFont(void); static void CreateBackgroundBrush(void); -static int GetContactStatus(HANDLE hContact); +static int GetContactStatus(HCONTACT hContact); static void GetScreenRect(void); extern void SetThumbsOpacity(BYTE btAlpha); static int ClcStatusToPf2(int status); @@ -136,7 +136,7 @@ static LPCTSTR s_fonts[FLT_FONTIDS] = static int OnContactDeleted(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); if (pThumb) { pThumb->DeleteContactPos(); @@ -147,7 +147,7 @@ static int OnContactDeleted(WPARAM wParam, LPARAM lParam) static int OnContactIconChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); if (pThumb) { pThumb->RefreshContactIcon((int)lParam); @@ -163,7 +163,7 @@ static int OnContactDrag(WPARAM wParam, LPARAM lParam) POINT pt; GetCursorPos(&pt); - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); if (pThumb == NULL) { int idStatus = GetContactStatus(hContact); @@ -188,7 +188,7 @@ static int OnContactDrop(WPARAM wParam, LPARAM lParam) RECT rcMiranda; RECT rcThumb; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); if (hNewContact == hContact && pThumb != NULL) { @@ -204,7 +204,7 @@ static int OnContactDrop(WPARAM wParam, LPARAM lParam) static int OnContactDragStop(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); if (pThumb != NULL && hNewContact == hContact) { thumbList.RemoveThumb(pThumb); @@ -228,7 +228,7 @@ static int OnSkinIconsChanged(WPARAM wParam, LPARAM lParam) static int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); int idStatus = ID_STATUS_OFFLINE; BOOL bRefresh = TRUE; @@ -292,7 +292,7 @@ static int OnStatusModeChange(WPARAM wParam, LPARAM lParam) static int OnPrebuildContactMenu(WPARAM wParam, LPARAM lParam) { - ThumbInfo *pThumb = thumbList.FindThumbByContact((HANDLE) wParam ); + ThumbInfo *pThumb = thumbList.FindThumbByContact((HCONTACT)wParam); Menu_ShowItem(hMenuItemRemove, pThumb != NULL); Menu_ShowItem(hMenuItemHideAll, !fcOpt.bHideAll); @@ -516,7 +516,7 @@ static void UnregisterWindowClass() UnregisterClass(WND_CLASS, hInst); } -static void CreateThumbWnd(TCHAR *ptszName, HANDLE hContact, int nX, int nY) +static void CreateThumbWnd(TCHAR *ptszName, HCONTACT hContact, int nX, int nY) { ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); if (pThumb != NULL) @@ -609,7 +609,7 @@ static void CreateBackgroundBrush() SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)hBkBrush); } -static int GetContactStatus(HANDLE hContact) +static int GetContactStatus(HCONTACT hContact) { if (hContact == NULL) { assert( !"Contact is NULL" ); @@ -646,7 +646,7 @@ BOOL IsStatusVisible(int status) return (0 == (dwOfflineModes & ClcStatusToPf2(status))); } -void RegHotkey(HANDLE hContact, HWND hwnd) +void RegHotkey(HCONTACT hContact, HWND hwnd) { char szBuf[MAX_PATH] = {0}; @@ -696,7 +696,7 @@ void SaveContactsPos() static void LoadContacts() { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) LoadContact(hContact); } @@ -719,7 +719,7 @@ static INT_PTR OnMainMenu_HideAll(WPARAM wParam, LPARAM lParam) static INT_PTR OnContactMenu_Remove(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); if (pThumb) { pThumb->DeleteContactPos(); @@ -777,7 +777,7 @@ static void LoadMenus() ///////////////////////////////////////////////////////////////////////////////////////// -static void LoadContact( HANDLE hContact ) +static void LoadContact( HCONTACT hContact ) { ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); if (hContact == NULL) diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index ecbe70c6bb..4e0d991496 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -768,7 +768,7 @@ ThumbList::~ThumbList() { } -ThumbInfo *ThumbList::AddThumb(HWND hwnd, TCHAR *ptszName, HANDLE hContact) +ThumbInfo *ThumbList::AddThumb(HWND hwnd, TCHAR *ptszName, HCONTACT hContact) { if (ptszName == NULL || hContact == NULL || hwnd == NULL) return NULL; @@ -813,7 +813,7 @@ ThumbInfo* ThumbList::FindThumb(HWND hwnd) return NULL; } -ThumbInfo *ThumbList::FindThumbByContact(HANDLE hContact) +ThumbInfo *ThumbList::FindThumbByContact(HCONTACT hContact) { if (!hContact) return NULL; diff --git a/plugins/FloatingContacts/src/thumbs.h b/plugins/FloatingContacts/src/thumbs.h index 083f2bb4b3..f13251e22a 100644 --- a/plugins/FloatingContacts/src/thumbs.h +++ b/plugins/FloatingContacts/src/thumbs.h @@ -12,7 +12,7 @@ DockOpt; struct ThumbInfo { - HANDLE hContact; + HCONTACT hContact; HWND hwnd; TCHAR ptszName[USERNAME_LEN]; int iIcon; @@ -60,11 +60,11 @@ public: ThumbList(); ~ThumbList(); - ThumbInfo* AddThumb(HWND hwnd, TCHAR *ptszName, HANDLE hContact); + ThumbInfo* AddThumb(HWND hwnd, TCHAR *ptszName, HCONTACT hContact); void RemoveThumb(ThumbInfo *pThumb); ThumbInfo* FindThumb(HWND hwnd); - ThumbInfo* FindThumbByContact(HANDLE hContact); + ThumbInfo* FindThumbByContact(HCONTACT hContact); }; extern ThumbList thumbList; diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 3da5724ff3..1bb124b2d2 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -92,7 +92,7 @@ void ReplaceAll(string &sSrc, const char * pszReplace, const char * pszNew) { // Developer : KN ///////////////////////////////////////////////////////////////////// -string DBGetString(HANDLE hContact, const char *szModule, const char *szSetting, const char * pszError) { +string DBGetString(HCONTACT hContact, const char *szModule, const char *szSetting, const char * pszError) { string ret; DBVARIANT dbv = {0}; if (! db_get(hContact, szModule, szSetting, &dbv)) { @@ -1014,7 +1014,7 @@ void SendLinkToUser(WPARAM wParam, char *pszSrvPath) { ///////////////////////////////////////////////////////////////////// static INT_PTR nShareNewFile(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; // used to be _MAX_PATH // changed it since selecting multiple files requires a bigger buffer diff --git a/plugins/HistoryLinkListPlus/src/linklist.cpp b/plugins/HistoryLinkListPlus/src/linklist.cpp index c9f96d3a29..76d3e2df02 100644 --- a/plugins/HistoryLinkListPlus/src/linklist.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist.cpp @@ -123,7 +123,7 @@ int InitOptionsDlg(WPARAM wParam, LPARAM) static INT_PTR LinkList_Main(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HWND hWnd = WindowList_Find(hWindowList, hContact); if ( hWnd != NULL ) { int len; diff --git a/plugins/HistoryLinkListPlus/src/linklist.h b/plugins/HistoryLinkListPlus/src/linklist.h index 10fd507975..9806f72204 100644 --- a/plugins/HistoryLinkListPlus/src/linklist.h +++ b/plugins/HistoryLinkListPlus/src/linklist.h @@ -137,7 +137,7 @@ typedef struct LISTELEMENT LISTELEMENT; // Dialogbox Parameter typedef struct{ - HANDLE hContact; + HCONTACT hContact; LISTELEMENT *listStart; UINT findMessage; CHARRANGE chrg; diff --git a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp index 17ebfa7af0..e9986938b6 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp @@ -38,7 +38,7 @@ INT_PTR WINAPI MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) { case WM_INITDIALOG: { - HANDLE hContact; + HCONTACT hContact; TCHAR title[256]; TCHAR filter[FILTERTEXT]; RECT rc; @@ -441,7 +441,7 @@ INT_PTR WINAPI MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam ) case WM_DESTROY: { - HANDLE hContact; + HCONTACT hContact; if ( db_get_b(NULL, LINKLIST_MODULE, LINKLIST_SAVESPECIAL, 0x00) == 0x00 ) hContact = NULL; else diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp index 3e12ced1ef..a875c3fdd8 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp @@ -1202,7 +1202,7 @@ This function is derived from his Wordlookup Plugin int DBUpdate(WPARAM wParam, LPARAM lParam) { HANDLE hEvent=(HANDLE)lParam; - HWND hDlg = WindowList_Find(hWindowList, (HANDLE)wParam); + HWND hDlg = WindowList_Find(hWindowList, (HCONTACT)wParam); DIALOGPARAM *DlgParam; HMENU listMenu = GetMenu(hDlg); int linkNum = 0; diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index d39293a87a..5c44ba7852 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -93,7 +93,7 @@ static int CompareBookmarks( const void* p1, const void* p2 ) return (BYTE*)((BEventData*)p1)->hDBEvent - (BYTE*)((BEventData*)p2)->hDBEvent; } -static void GetBookmarks(HANDLE hContact, BEventData** books, size_t* bookcnt ) +static void GetBookmarks(HCONTACT hContact, BEventData** books, size_t* bookcnt ) { *books = NULL; *bookcnt = 0; @@ -132,7 +132,7 @@ static void GetBookmarks(HANDLE hContact, BEventData** books, size_t* bookcnt ) } //Sweep history from specified contact -void SweepHistoryFromContact(HANDLE hContact, CriteriaStruct Criteria, BOOL keepUnread) +void SweepHistoryFromContact(HCONTACT hContact, CriteriaStruct Criteria, BOOL keepUnread) { int lPolicy; if (hContact == NULL) // for system history @@ -209,7 +209,7 @@ void ShutdownAction(void) SweepHistoryFromContact(NULL, Criteria, FALSE); // sweep system history, keepunread==0 - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) SweepHistoryFromContact(hContact, Criteria, TRUE); // sweep contact history, keepunread==1 } diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp index 3f3bfa84a1..438d09c5f7 100644 --- a/plugins/HistorySweeperLight/src/main.cpp +++ b/plugins/HistorySweeperLight/src/main.cpp @@ -53,7 +53,7 @@ int OnIconPressed(WPARAM wParam, LPARAM lParam) if ( !(sicd->flags & MBCF_RIGHTBUTTON) && !lstrcmpA(sicd->szModule, ModuleName) && db_get_b(NULL, ModuleName, "ChangeInMW", 0)) { - int nh = sicd->dwId; HANDLE hContact = (HANDLE)wParam; + int nh = sicd->dwId; HCONTACT hContact = (HCONTACT)wParam; StatusIconData sid = { sizeof(sid) }; sid.szModule = ModuleName; @@ -62,7 +62,7 @@ int OnIconPressed(WPARAM wParam, LPARAM lParam) Srmm_ModifyIcon(hContact, &sid); nh = (nh + 1) % 4; - db_set_b((HANDLE)wParam, ModuleName, "SweepHistory", (BYTE)nh); + db_set_b((HCONTACT)wParam, ModuleName, "SweepHistory", (BYTE)nh); sid.dwId = nh; sid.flags = 0; @@ -111,7 +111,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) Srmm_AddIcon(&sid); // for new contacts - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ZeroMemory(&sid,sizeof(sid)); sweep = db_get_b(hContact, ModuleName, "SweepHistory", 0); diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index 45541bbfa7..1d8cc4d4f0 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -107,7 +107,7 @@ static void ShowAllContactIcons(HWND hwndList) SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hSystemHistory, MAKELPARAM(0, db_get_b(NULL, ModuleName, "SweepSHistory", 0))); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(0, db_get_b(hContact, ModuleName, "SweepHistory", 0))); @@ -174,7 +174,7 @@ void SaveSettings(HWND hwndDlg) db_set_b(NULL, ModuleName, "SweepSHistory", (BYTE)SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hSystemHistory, 0)); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); st = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, 0); diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index d26272f9c2..d8ae83bc32 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -41,7 +41,7 @@ HTMLBuilder::~HTMLBuilder() mir_free((void*)lastIEViewEvent.pszProto); } -bool HTMLBuilder::encode(HANDLE hContact, const char *proto, const wchar_t *text, wchar_t **output, int *outputSize, int level, int flags, bool isSent) +bool HTMLBuilder::encode(HCONTACT hContact, const char *proto, const wchar_t *text, wchar_t **output, int *outputSize, int level, int flags, bool isSent) { TextToken *token = NULL, *token2; switch (level) { @@ -86,7 +86,7 @@ bool HTMLBuilder::encode(HANDLE hContact, const char *proto, const wchar_t *text return false; } -wchar_t* HTMLBuilder::encode(HANDLE hContact, const char *proto, const wchar_t *text, int flags, bool isSent) +wchar_t* HTMLBuilder::encode(HCONTACT hContact, const char *proto, const wchar_t *text, int flags, bool isSent) { int outputSize; wchar_t *output = NULL; @@ -95,7 +95,7 @@ wchar_t* HTMLBuilder::encode(HANDLE hContact, const char *proto, const wchar_t * return output; } -char* HTMLBuilder::encodeUTF8(HANDLE hContact, const char *proto, const wchar_t *wtext, int flags, bool isSent) +char* HTMLBuilder::encodeUTF8(HCONTACT hContact, const char *proto, const wchar_t *wtext, int flags, bool isSent) { char *outputStr = NULL; if (wtext != NULL) { @@ -107,7 +107,7 @@ char* HTMLBuilder::encodeUTF8(HANDLE hContact, const char *proto, const wchar_t return outputStr; } -char* HTMLBuilder::encodeUTF8(HANDLE hContact, const char *proto, const char *text, int flags, bool isSent) +char* HTMLBuilder::encodeUTF8(HCONTACT hContact, const char *proto, const char *text, int flags, bool isSent) { char *outputStr = NULL; if (text != NULL) { @@ -118,7 +118,7 @@ char* HTMLBuilder::encodeUTF8(HANDLE hContact, const char *proto, const char *te return outputStr; } -char* HTMLBuilder::encodeUTF8(HANDLE hContact, const char *proto, const char *text, int cp, int flags, bool isSent) +char* HTMLBuilder::encodeUTF8(HCONTACT hContact, const char *proto, const char *text, int cp, int flags, bool isSent) { char *outputStr = NULL; if (text != NULL) { @@ -129,12 +129,12 @@ char* HTMLBuilder::encodeUTF8(HANDLE hContact, const char *proto, const char *te return outputStr; } -char* HTMLBuilder::getProto(HANDLE hContact) +char* HTMLBuilder::getProto(HCONTACT hContact) { return mir_strdup(GetContactProto(hContact)); } -char* HTMLBuilder::getProto(const char *proto, HANDLE hContact) +char* HTMLBuilder::getProto(const char *proto, HCONTACT hContact) { if (proto != NULL) return mir_strdup(proto); @@ -142,14 +142,14 @@ char* HTMLBuilder::getProto(const char *proto, HANDLE hContact) return mir_strdup(GetContactProto(hContact)); } -char* HTMLBuilder::getRealProto(HANDLE hContact) +char* HTMLBuilder::getRealProto(HCONTACT hContact) { if (hContact == NULL) return NULL; char *szProto = mir_strdup(GetContactProto(hContact)); if (szProto != NULL && !strcmp(szProto, "MetaContacts")) { - hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) hContact, 0); + hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); if (hContact != NULL) { mir_free(szProto); szProto = mir_strdup(GetContactProto(hContact)); @@ -158,21 +158,21 @@ char* HTMLBuilder::getRealProto(HANDLE hContact) return szProto; } -char *HTMLBuilder::getRealProto(HANDLE hContact, const char *szProto) +char *HTMLBuilder::getRealProto(HCONTACT hContact, const char *szProto) { if (szProto != NULL && !strcmp(szProto, "MetaContacts")) { - hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) hContact, 0); + hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); if (hContact != NULL) return mir_strdup(GetContactProto(hContact)); } return mir_strdup(szProto); } -HANDLE HTMLBuilder::getRealContact(HANDLE hContact) +HCONTACT HTMLBuilder::getRealContact(HCONTACT hContact) { char *szProto = GetContactProto(hContact); if (szProto != NULL && !strcmp(szProto,"MetaContacts")) - hContact = (HANDLE) CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) hContact, 0); + hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); return hContact; } @@ -208,7 +208,7 @@ bool HTMLBuilder::isSameDate(time_t time1, time_t time2) return false; } -void HTMLBuilder::getUINs(HANDLE hContact, char *&uinIn, char *&uinOut) +void HTMLBuilder::getUINs(HCONTACT hContact, char *&uinIn, char *&uinOut) { CONTACTINFO ci; char buf[128]; @@ -250,7 +250,7 @@ void HTMLBuilder::getUINs(HANDLE hContact, char *&uinIn, char *&uinOut) mir_free(szProto); } -wchar_t *HTMLBuilder::getContactName(HANDLE hContact, const char *szProto) +wchar_t *HTMLBuilder::getContactName(HCONTACT hContact, const char *szProto) { CONTACTINFO ci = {0}; wchar_t *szName = NULL; @@ -287,7 +287,7 @@ wchar_t *HTMLBuilder::getContactName(HANDLE hContact, const char *szProto) return mir_tstrdup(TranslateT("(Unknown Contact)")); } -char *HTMLBuilder::getEncodedContactName(HANDLE hContact, const char* szProto, const char* szSmileyProto) +char *HTMLBuilder::getEncodedContactName(HCONTACT hContact, const char* szProto, const char* szSmileyProto) { char *szName = NULL; wchar_t *name = getContactName(hContact, szProto); @@ -432,7 +432,7 @@ ProtocolSettings* HTMLBuilder::getSRMMProtocolSettings(const char *protocolName) return protoSettings; } -ProtocolSettings* HTMLBuilder::getSRMMProtocolSettings(HANDLE hContact) +ProtocolSettings* HTMLBuilder::getSRMMProtocolSettings(HCONTACT hContact) { return getSRMMProtocolSettings( ptrA(getRealProto(hContact))); } @@ -446,7 +446,7 @@ ProtocolSettings* HTMLBuilder::getHistoryProtocolSettings(const char *protocolNa return protoSettings; } -ProtocolSettings* HTMLBuilder::getHistoryProtocolSettings(HANDLE hContact) +ProtocolSettings* HTMLBuilder::getHistoryProtocolSettings(HCONTACT hContact) { if (hContact != NULL) return getHistoryProtocolSettings( ptrA(getRealProto(hContact))); @@ -463,7 +463,7 @@ ProtocolSettings* HTMLBuilder::getChatProtocolSettings(const char *protocolName) return protoSettings; } -ProtocolSettings* HTMLBuilder::getChatProtocolSettings(HANDLE hContact) +ProtocolSettings* HTMLBuilder::getChatProtocolSettings(HCONTACT hContact) { return getChatProtocolSettings( ptrA(getRealProto(hContact))); } diff --git a/plugins/IEView/src/HTMLBuilder.h b/plugins/IEView/src/HTMLBuilder.h index a5bdf24329..4c082c0f47 100644 --- a/plugins/IEView/src/HTMLBuilder.h +++ b/plugins/IEView/src/HTMLBuilder.h @@ -50,19 +50,19 @@ protected: ENF_CHAT_FORMATTING = 256 }; // virtual char *encode(const char *text, const char *proto, bool replaceSmiley); - virtual char *encodeUTF8(HANDLE hContact, const char *proto, const wchar_t *text, int flags, bool isSent); - virtual char *encodeUTF8(HANDLE hContact, const char *proto, const char *text, int flags, bool isSent); - virtual char *encodeUTF8(HANDLE hContact, const char *proto, const char *text, int cp, int flags, bool isSent); - virtual wchar_t *encode(HANDLE hContact, const char *proto, const wchar_t *text, int flags, bool isSent); - virtual bool encode(HANDLE hContact, const char *proto, const wchar_t *text, wchar_t **output, int *outputSize, int level, int flags, bool isSent); - virtual char* getProto(HANDLE hContact); - virtual char* getProto(const char *proto, HANDLE hContact); - virtual char* getRealProto(HANDLE hContact); - virtual char* getRealProto(HANDLE hContact, const char *proto); - virtual wchar_t *getContactName(HANDLE hContact, const char* szProto); - virtual char *getEncodedContactName(HANDLE hContact, const char *szProto, const char *szSmileyProto); - virtual void getUINs(HANDLE hContact, char *&uinIn, char *&uinOut); - virtual HANDLE getRealContact(HANDLE hContact); + virtual char *encodeUTF8(HCONTACT hContact, const char *proto, const wchar_t *text, int flags, bool isSent); + virtual char *encodeUTF8(HCONTACT hContact, const char *proto, const char *text, int flags, bool isSent); + virtual char *encodeUTF8(HCONTACT hContact, const char *proto, const char *text, int cp, int flags, bool isSent); + virtual wchar_t *encode(HCONTACT hContact, const char *proto, const wchar_t *text, int flags, bool isSent); + virtual bool encode(HCONTACT hContact, const char *proto, const wchar_t *text, wchar_t **output, int *outputSize, int level, int flags, bool isSent); + virtual char* getProto(HCONTACT hContact); + virtual char* getProto(const char *proto, HCONTACT hContact); + virtual char* getRealProto(HCONTACT hContact); + virtual char* getRealProto(HCONTACT hContact, const char *proto); + virtual wchar_t *getContactName(HCONTACT hContact, const char* szProto); + virtual char *getEncodedContactName(HCONTACT hContact, const char *szProto, const char *szSmileyProto); + virtual void getUINs(HCONTACT hContact, char *&uinIn, char *&uinOut); + virtual HCONTACT getRealContact(HCONTACT hContact); virtual DWORD getLastEventTime(); virtual void setLastEventTime(DWORD); virtual int getLastEventType(); @@ -70,11 +70,11 @@ protected: virtual bool isSameDate(time_t time1, time_t time2); virtual bool isDbEventShown(DBEVENTINFO * dbei)=0; virtual ProtocolSettings *getSRMMProtocolSettings(const char *protocolName); - virtual ProtocolSettings *getSRMMProtocolSettings(HANDLE hContact); + virtual ProtocolSettings *getSRMMProtocolSettings(HCONTACT hContact); virtual ProtocolSettings *getHistoryProtocolSettings(const char *protocolName); - virtual ProtocolSettings *getHistoryProtocolSettings(HANDLE hContact); + virtual ProtocolSettings *getHistoryProtocolSettings(HCONTACT hContact); virtual ProtocolSettings *getChatProtocolSettings(const char *protocolName); - virtual ProtocolSettings *getChatProtocolSettings(HANDLE hContact); + virtual ProtocolSettings *getChatProtocolSettings(HCONTACT hContact); void setLastIEViewEvent(IEVIEWEVENT *event); virtual void buildHead(IEView *, IEVIEWEVENT *event)=0; public: diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp index 1925a59f98..8e2212c6cb 100644 --- a/plugins/IEView/src/IEView.cpp +++ b/plugins/IEView/src/IEView.cpp @@ -1016,7 +1016,7 @@ HWND IEView::getHWND() return hwnd; } -void IEView::setContact(HANDLE hContact) +void IEView::setContact(HCONTACT hContact) { this->hContact = hContact; isContactSet = true; diff --git a/plugins/IEView/src/IEView.h b/plugins/IEView/src/IEView.h index 156affb2c4..c552525c84 100644 --- a/plugins/IEView/src/IEView.h +++ b/plugins/IEView/src/IEView.h @@ -551,7 +551,7 @@ public: void navigate(IEVIEWNAVIGATE * nav); void saveDocument(); - void setContact(HANDLE hContact); + void setContact(HCONTACT hContact); static IEView* get(HWND); static void init(); diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index 2a090a77d0..7ab1ee59af 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -40,7 +40,7 @@ TemplateHTMLBuilder::~TemplateHTMLBuilder() mir_free(flashAvatars[i]); } -char *TemplateHTMLBuilder::getAvatar(HANDLE hContact, const char* szProto) +char *TemplateHTMLBuilder::getAvatar(HCONTACT hContact, const char* szProto) { DBVARIANT dbv; TCHAR tmpPath[MAX_PATH]; @@ -159,7 +159,6 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr CONTACTINFO ci; char tempBase[1024]; char tempStr[1024]; - HANDLE hRealContact; char *szRealProto = NULL; char *szBase=NULL; char *szNoAvatar=NULL; @@ -177,7 +176,7 @@ void TemplateHTMLBuilder::buildHeadTemplate(IEView *view, IEVIEWEVENT *event, Pr char *output; output = NULL; - hRealContact = getRealContact(event->hContact); + HCONTACT hRealContact = getRealContact(event->hContact); szRealProto = getProto(hRealContact); szProto = getProto(event->pszProto, event->hContact); tempBase[0]='\0'; @@ -327,7 +326,6 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, { DBVARIANT dbv; CONTACTINFO ci; - HANDLE hRealContact; char *szRealProto = NULL; char tempBase[1024]; char *szBase=NULL; @@ -354,7 +352,7 @@ void TemplateHTMLBuilder::appendEventTemplate(IEView *view, IEVIEWEVENT *event, if (protoSettings == NULL) return; - hRealContact = getRealContact(event->hContact); + HCONTACT hRealContact = getRealContact(event->hContact); szRealProto = getProto(hRealContact); szProto = getProto(event->pszProto, event->hContact); tempBase[0]='\0'; diff --git a/plugins/IEView/src/TemplateHTMLBuilder.h b/plugins/IEView/src/TemplateHTMLBuilder.h index a6193db6e1..3bde284df3 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.h +++ b/plugins/IEView/src/TemplateHTMLBuilder.h @@ -36,7 +36,7 @@ protected: time_t flashAvatarsTime[2]; char * flashAvatars[2]; const char *getFlashAvatar(const TCHAR *file, int index); - char *getAvatar(HANDLE hContact, const char *szProto); + char *getAvatar(HCONTACT hContact, const char *szProto); void buildHeadTemplate(IEView *, IEVIEWEVENT *event, ProtocolSettings* protoSettings); void appendEventTemplate(IEView *, IEVIEWEVENT *event, ProtocolSettings* protoSettings); virtual TemplateMap *getTemplateMap(ProtocolSettings *); diff --git a/plugins/IEView/src/TextToken.cpp b/plugins/IEView/src/TextToken.cpp index 103fcc629c..9c69b927b1 100644 --- a/plugins/IEView/src/TextToken.cpp +++ b/plugins/IEView/src/TextToken.cpp @@ -425,7 +425,7 @@ TextToken* TextToken::tokenizeLinks(const wchar_t *text) { return firstToken; } -TextToken* TextToken::tokenizeSmileys(HANDLE hContact, const char *proto, const wchar_t *text, bool isSent) { +TextToken* TextToken::tokenizeSmileys(HCONTACT hContact, const char *proto, const wchar_t *text, bool isSent) { TextToken *firstToken = NULL, *lastToken = NULL; SMADD_BATCHPARSE2 sp; SMADD_BATCHPARSERES *spRes; diff --git a/plugins/IEView/src/TextToken.h b/plugins/IEView/src/TextToken.h index ad6c46d711..1085fb75f9 100644 --- a/plugins/IEView/src/TextToken.h +++ b/plugins/IEView/src/TextToken.h @@ -82,7 +82,7 @@ public: // UNICODE wchar_t * htmlEncode(const wchar_t *str); static TextToken* tokenizeLinks(const wchar_t *wtext); - static TextToken* tokenizeSmileys(HANDLE hContact, const char *proto, const wchar_t *wtext, bool isSent); + static TextToken* tokenizeSmileys(HCONTACT hContact, const char *proto, const wchar_t *wtext, bool isSent); static TextToken* tokenizeBBCodes(const wchar_t *text); static TextToken* tokenizeMath(const wchar_t *text); static TextToken* tokenizeChatFormatting(const wchar_t *text); diff --git a/plugins/IgnoreState/src/commonheaders.h b/plugins/IgnoreState/src/commonheaders.h index 8b019ab20d..52fa5d27e2 100644 --- a/plugins/IgnoreState/src/commonheaders.h +++ b/plugins/IgnoreState/src/commonheaders.h @@ -60,7 +60,7 @@ static byte bUseMirandaSettings; extern HINSTANCE g_hInst; -void applyExtraImage(HANDLE hContact); +void applyExtraImage(HCONTACT hContact); int onOptInitialise(WPARAM wParam, LPARAM lParam); BOOL checkState(int type); diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp index bff3520324..2c18b18563 100644 --- a/plugins/IgnoreState/src/main.cpp +++ b/plugins/IgnoreState/src/main.cpp @@ -79,7 +79,7 @@ inline BOOL checkState(int type) return ((currentFilter>>(type-1))&1); } -INT_PTR isIgnored(HANDLE hContact, int type) +INT_PTR isIgnored(HCONTACT hContact, int type) { int all = 0, filtered = 0; @@ -93,7 +93,7 @@ INT_PTR isIgnored(HANDLE hContact, int type) return (all+filtered == SIZEOF(ii)-1) ? 1 : (all > 0 ? -1 : 0) ; } -void applyExtraImage(HANDLE hContact) +void applyExtraImage(HCONTACT hContact) { int ignore = isIgnored(hContact, IGNOREEVENT_ALL); if (ignore == 1) @@ -141,7 +141,7 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) hExtraIcon = ExtraIcon_Register("ignore", LPGEN("Ignore State"), "ignore_full"); // Set initial value for all contacts - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) applyExtraImage(hContact); return 0; @@ -150,7 +150,7 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) int onContactSettingChanged(WPARAM wParam,LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if ( !lstrcmpA(cws->szModule, "Ignore") && !lstrcmpA(cws->szSetting, "Mask1")) applyExtraImage(hContact); diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index dbb6e5a02b..5a8b873fb9 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -65,8 +65,8 @@ static MCONTACT HContactFromNumericID(char *pszProtoName, char *pszSetting, DWOR { MCONTACT hContact = dstDb->FindFirstContact(); while (hContact != NULL) { - if ( db_get_dw((HANDLE)hContact, pszProtoName, pszSetting, 0) == dwID) { - char* szProto = GetContactProto((HANDLE)hContact); + if ( db_get_dw((HCONTACT)hContact, pszProtoName, pszSetting, 0) == dwID) { + char* szProto = GetContactProto((HCONTACT)hContact); if (szProto != NULL && !lstrcmpA(szProto, pszProtoName)) return hContact; } @@ -79,9 +79,9 @@ static MCONTACT HContactFromID(char *pszProtoName, char *pszSetting, TCHAR *pwsz { MCONTACT hContact = dstDb->FindFirstContact(); while (hContact != NULL) { - char* szProto = GetContactProto((HANDLE)hContact); + char* szProto = GetContactProto((HCONTACT)hContact); if ( !lstrcmpA(szProto, pszProtoName)) { - ptrW id(db_get_tsa((HANDLE)hContact, pszProtoName, pszSetting)); + ptrW id(db_get_tsa((HCONTACT)hContact, pszProtoName, pszSetting)); if ( !lstrcmp(pwszID, id)) return hContact; } @@ -107,7 +107,7 @@ static MCONTACT HistoryImportFindContact(HWND hdlgProgress, char* szModuleName, hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)szModuleName); - db_set_dw((HANDLE)hContact, szModuleName, "UIN", uin); + db_set_dw((HCONTACT)hContact, szModuleName, "UIN", uin); AddMessage( LPGENT("Added contact %u (found in history)"), uin ); return hContact; } @@ -125,10 +125,10 @@ static MCONTACT AddContact(HWND hdlgProgress, char* szProto, char* pszUniqueSett mySet(hContact, szProto, pszUniqueSetting, id); - CreateGroup(group, (HANDLE)hContact); + CreateGroup(group, (HCONTACT)hContact); if (nick && *nick) { - db_set_ws((HANDLE)hContact, "CList", "MyHandle", nick); + db_set_ws((HCONTACT)hContact, "CList", "MyHandle", nick); AddMessage(LPGENT("Added %S contact %s, '%s'"), szProto, pszUserID, nick); } else AddMessage(LPGENT("Added %S contact %s"), szProto, pszUserID); @@ -404,7 +404,7 @@ static void ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int protoC if (!skip) { // Check for duplicate entries - if (!IsDuplicateEvent((HANDLE)hDst, dbei)) { + if (!IsDuplicateEvent((HCONTACT)hDst, dbei)) { // Add dbevent if (!bIsVoidContact) dbei.flags &= ~DBEF_FIRST; diff --git a/plugins/Import/src/import.h b/plugins/Import/src/import.h index eb8bfe696f..02fffe59d6 100644 --- a/plugins/Import/src/import.h +++ b/plugins/Import/src/import.h @@ -94,7 +94,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void AddMessage( const TCHAR* fmt, ... ); -void mySet( HANDLE hContact, const char* module, const char* var, DBVARIANT* dbv ); +void mySet(HCONTACT hContact, const char* module, const char* var, DBVARIANT* dbv ); INT_PTR CALLBACK WizardIntroPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK ProgressPageProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam); @@ -104,9 +104,9 @@ INT_PTR CALLBACK MirandaAdvOptionsPageProc(HWND hdlg,UINT message,WPARAM wParam, INT_PTR CALLBACK FinishedPageProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam); BOOL IsProtocolLoaded(char* pszProtocolName); -BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO dbei); +BOOL IsDuplicateEvent(HCONTACT hContact, DBEVENTINFO dbei); -int CreateGroup(const TCHAR* name, HANDLE hContact); +int CreateGroup(const TCHAR* name, HCONTACT hContact); extern HINSTANCE hInst; extern HANDLE hIcoHandle; diff --git a/plugins/Import/src/utils.cpp b/plugins/Import/src/utils.cpp index 58bad9efc9..c5660133ba 100644 --- a/plugins/Import/src/utils.cpp +++ b/plugins/Import/src/utils.cpp @@ -35,7 +35,7 @@ BOOL IsProtocolLoaded(char* pszProtocolName) // If contact is specified adds it to group // ------------------------------------------------ // Returns 1 if successful and 0 when it fails. -int CreateGroup(const TCHAR* group, HANDLE hContact) +int CreateGroup(const TCHAR* group, HCONTACT hContact) { if (group == NULL) return 0; @@ -55,9 +55,9 @@ int CreateGroup(const TCHAR* group, HANDLE hContact) if ( !lstrcmp(dbv.ptszVal + 1, tszGrpName + 1 )) { if (hContact) - db_set_ts( hContact, "CList", "Group", tszGrpName+1 ); + db_set_ts(hContact, "CList", "Group", tszGrpName + 1); else - AddMessage( LPGENT("Skipping duplicate group %s."), tszGrpName + 1); + AddMessage(LPGENT("Skipping duplicate group %s."), tszGrpName + 1); db_free(&dbv); return 0; @@ -75,7 +75,7 @@ int CreateGroup(const TCHAR* group, HANDLE hContact) } // Returns TRUE if the event already exist in the database -BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO dbei) +BOOL IsDuplicateEvent(HCONTACT hContact, DBEVENTINFO dbei) { static DWORD dwPreviousTimeStamp = -1; static HANDLE hPreviousContact = INVALID_HANDLE_VALUE; diff --git a/plugins/KeyboardNotify/src/ignore.cpp b/plugins/KeyboardNotify/src/ignore.cpp index 6ce81f49cb..d32e9af102 100644 --- a/plugins/KeyboardNotify/src/ignore.cpp +++ b/plugins/KeyboardNotify/src/ignore.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static const DWORD ignoreIdToPf1[IGNOREEVENT_MAX] = {PF1_IMRECV, PF1_URLRECV, PF1_FILERECV, 0xFFFFFFFF}; -static DWORD GetMask(HANDLE hContact) +static DWORD GetMask(HCONTACT hContact) { DWORD mask = db_get_dw(hContact, KEYBDMODULE, "Mask1", (DWORD)(-1)); if(mask == (DWORD)(-1)) { @@ -156,7 +156,7 @@ static void SetIconsForColumn(HWND hwndList, HANDLE hItem, HANDLE hItemAll, int } } -static void InitialiseItem(HWND hwndList, HANDLE hContact, HANDLE hItem, DWORD protoCaps) +static void InitialiseItem(HWND hwndList, HCONTACT hContact, HANDLE hItem, DWORD protoCaps) { DWORD mask; int i; @@ -169,7 +169,7 @@ static void InitialiseItem(HWND hwndList, HANDLE hContact, HANDLE hItem, DWORD p SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(IGNOREEVENT_MAX+1, 2)); } -static void SaveItemMask(HWND hwndList, HANDLE hContact, HANDLE hItem, const char *pszSetting) +static void SaveItemMask(HWND hwndList, HCONTACT hContact, HANDLE hItem, const char *pszSetting) { DWORD mask; int i, iImage; @@ -186,7 +186,7 @@ static void SetAllContactIcons(HWND hwndList) { DWORD protoCaps; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); if(hItem && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(IGNOREEVENT_MAX, 0)) == EMPTY_EXTRA_ICON) { char *szProto = GetContactProto(hContact); @@ -310,7 +310,7 @@ INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA { case PSN_APPLY: { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if(hItem) SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), hContact, hItem, "Mask1"); @@ -336,7 +336,7 @@ INT_PTR CALLBACK DlgProcIgnoreOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA return FALSE; } -BOOL IsIgnored(HANDLE hContact, WORD eventType) +BOOL IsIgnored(HCONTACT hContact, WORD eventType) { WORD ignoreID = 0; DWORD mask = GetMask(hContact); diff --git a/plugins/KeyboardNotify/src/ignore.h b/plugins/KeyboardNotify/src/ignore.h index a72df7b6f6..56c738e4da 100644 --- a/plugins/KeyboardNotify/src/ignore.h +++ b/plugins/KeyboardNotify/src/ignore.h @@ -16,5 +16,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -BOOL IsIgnored(HANDLE, WORD); +BOOL IsIgnored(HCONTACT, WORD); INT_PTR CALLBACK DlgProcIgnoreOptions(HWND, UINT, WPARAM, LPARAM); diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 4e47de9f8c..98dda0467d 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -121,9 +121,9 @@ static LRESULT CALLBACK KeyBoardHookFunction(int, WPARAM, LPARAM); static LRESULT CALLBACK MirandaMouseHookFunction(int, WPARAM, LPARAM); static LRESULT CALLBACK MirandaKeyBoardHookFunction(int, WPARAM, LPARAM); static LRESULT CALLBACK MirandaWndProcHookFunction(int, WPARAM, LPARAM); -BOOL CheckMsgWnd(HANDLE, BOOL *); +BOOL CheckMsgWnd(HCONTACT, BOOL *); -BOOL isMetaContactsSubContact(HANDLE hMetaContact, HANDLE hContact) +BOOL isMetaContactsSubContact(HCONTACT hMetaContact, HCONTACT hContact) { char *szProto = GetContactProto(hMetaContact); if (szProto && !strcmp(szMetaProto, szProto)) { // Safety check @@ -134,7 +134,7 @@ BOOL isMetaContactsSubContact(HANDLE hMetaContact, HANDLE hContact) return FALSE; } -BOOL checkOpenWindow(HANDLE hContact) +BOOL checkOpenWindow(HCONTACT hContact) { BOOL found, focus; @@ -143,7 +143,7 @@ BOOL checkOpenWindow(HANDLE hContact) found = CheckMsgWnd(hContact, &focus); if (!found && szMetaProto && bMetaProtoEnabled) { - HANDLE hMetaContact = (HANDLE)db_get_dw(hContact, szMetaProto, "Handle", 0); + HCONTACT hMetaContact = (HCONTACT)db_get_dw(hContact, szMetaProto, "Handle", 0); if (hMetaContact && isMetaContactsSubContact(hMetaContact, hContact)) found = CheckMsgWnd(hMetaContact, &focus); } @@ -221,7 +221,7 @@ BOOL checkGlobalXstatus() return protosSupporting == 0; } -DBEVENTINFO createMsgEventInfo(HANDLE hContact) +DBEVENTINFO createMsgEventInfo(HCONTACT hContact) { DBEVENTINFO einfo = { sizeof(einfo) }; einfo.eventType = EVENTTYPE_MESSAGE; @@ -229,7 +229,7 @@ DBEVENTINFO createMsgEventInfo(HANDLE hContact) return einfo; } -DBEVENTINFO readEventInfo(HANDLE hDbEvent, HANDLE hContact) +DBEVENTINFO readEventInfo(HANDLE hDbEvent, HCONTACT hContact) { if (hDbEvent == NCONVERS_BLINKID) // we need to handle nconvers' blink event return createMsgEventInfo(hContact); @@ -239,7 +239,7 @@ DBEVENTINFO readEventInfo(HANDLE hDbEvent, HANDLE hContact) return einfo; } -BOOL checkIgnore(HANDLE hContact, WORD eventType) +BOOL checkIgnore(HCONTACT hContact, WORD eventType) { return !IsIgnored(hContact, eventType); } @@ -256,12 +256,12 @@ BOOL checkProtocol(char *szProto) return FALSE; } -BOOL metaCheckProtocol(char *szProto, HANDLE hContact, WORD eventType) +BOOL metaCheckProtocol(char *szProto, HCONTACT hContact, WORD eventType) { - HANDLE hSubContact=NULL; + HCONTACT hSubContact=NULL; if (szMetaProto && bMetaProtoEnabled && szProto && !strcmp(szMetaProto, szProto)) - if (hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) + if (hSubContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) szProto = GetContactProto(hSubContact); return checkProtocol(szProto) && checkIgnore(hSubContact?hSubContact:hContact, eventType); @@ -379,10 +379,10 @@ BOOL checkMsgTimestamp(HANDLE hEventCurrent, DWORD timestampCurrent) } -BOOL contactCheckProtocol(char *szProto, HANDLE hContact, WORD eventType) +BOOL contactCheckProtocol(char *szProto, HCONTACT hContact, WORD eventType) { if (szMetaProto && bMetaProtoEnabled && hContact) { - HANDLE hMetaContact = (HANDLE)db_get_dw(hContact, szMetaProto, "Handle", 0); + HCONTACT hMetaContact = (HCONTACT)db_get_dw(hContact, szMetaProto, "Handle", 0); if (hMetaContact && isMetaContactsSubContact(hMetaContact, hContact)) return FALSE; } @@ -427,7 +427,7 @@ BOOL checkXstatus(char *szProto) // 'Pings' the FlashThread to keep the LEDs flashing. static int PluginMessageEventHook(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HANDLE hEvent = (HANDLE)lParam; //get DBEVENTINFO without pBlob @@ -986,7 +986,7 @@ static LRESULT CALLBACK MirandaWndProcHookFunction(int code, WPARAM wParam, LPAR return CallNextHookEx(hMirandaWndProcHook, code, wParam, lParam); } -BOOL CheckMsgWnd(HANDLE hContact, BOOL *focus) +BOOL CheckMsgWnd(HCONTACT hContact, BOOL *focus) { if (ServiceExists(MS_MSG_GETWINDOWDATA)) { // use the new message API MessageWindowData mwd = { sizeof(MessageWindowData) }; diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index 7a3e844450..6817b374bd 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -67,7 +67,7 @@ INT_PTR GetParsedFormat(WPARAM wParam,LPARAM lParam); INT_PTR GetOverrideContactOption(WPARAM wParam,LPARAM lParam); INT_PTR GetUnknownText(WPARAM wParam,LPARAM lParam); INT_PTR SetNewSong(WPARAM wParam,LPARAM lParam); -void SetExtraIcon(HANDLE hContact, BOOL set); +void SetExtraIcon(HCONTACT hContact, BOOL set); void SetListeningInfos(LISTENINGTOINFO *lti = NULL); INT_PTR HotkeysEnable(WPARAM wParam,LPARAM lParam); INT_PTR HotkeysDisable(WPARAM wParam,LPARAM lParam); @@ -288,7 +288,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) // Extra icon support hExtraIcon = ExtraIcon_Register(MODULE_NAME, LPGEN("Listening to music"), "listening_to_icon"); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *proto = GetContactProto(hContact); if (proto != NULL) { DBVARIANT dbv; @@ -947,14 +947,14 @@ void HasNewListeningInfo() } -void SetExtraIcon(HANDLE hContact, BOOL set) +void SetExtraIcon(HCONTACT hContact, BOOL set) { ExtraIcon_SetIcon(hExtraIcon, hContact, set ? "listening_to_icon" : NULL); } int SettingChanged(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT) wParam; if (hContact == NULL) return 0; diff --git a/plugins/ListeningTo/src/players/mradio.cpp b/plugins/ListeningTo/src/players/mradio.cpp index d8e23508a3..c0132d1de5 100644 --- a/plugins/ListeningTo/src/players/mradio.cpp +++ b/plugins/ListeningTo/src/players/mradio.cpp @@ -34,7 +34,7 @@ void MRadio::EnableDisable() int MRadio::GetData() { - for (HANDLE hContact = db_find_first("mRadio"); hContact; hContact = db_find_next(hContact, "mRadio")) { + for (HCONTACT hContact = db_find_first("mRadio"); hContact; hContact = db_find_next(hContact, "mRadio")) { WORD status = db_get_w(hContact, "mRadio", "Status", ID_STATUS_OFFLINE); if (status != ID_STATUS_ONLINE) continue; diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index c349d8243e..6f9792b6ca 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -1634,7 +1634,7 @@ extern "C" int __declspec(dllexport) Load(void) CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); //set all contacts to offline ///TODO: are that contacts exists ? - for(HANDLE hContact = db_find_first(PLUGINNAME); hContact; hContact = db_find_next(hContact, PLUGINNAME)){ + for(HCONTACT hContact = db_find_first(PLUGINNAME); hContact; hContact = db_find_next(hContact, PLUGINNAME)){ db_set_w(hContact, PLUGINNAME, "status", ID_STATUS_OFFLINE); } diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index bbed4dd6db..d2f6888f4f 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -99,7 +99,7 @@ typedef struct { struct ModSetLinkLinkItem *last; } ModuleSettingLL; -int GetSetting(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) +int GetSetting(HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { return db_get_s(hContact, szModule, szSetting, dbv, 0); } @@ -155,7 +155,7 @@ void FreeModuleSettingLL(ModuleSettingLL* msll) } } -void RenameDbProto(HANDLE hContact, HANDLE hContactNew, char* oldName, char* newName, int delOld) +void RenameDbProto(HCONTACT hContact, HCONTACT hContactNew, char* oldName, char* newName, int delOld) { DBVARIANT dbv; ModuleSettingLL settinglist; @@ -202,7 +202,7 @@ void RenameDbProto(HANDLE hContact, HANDLE hContactNew, char* oldName, char* new FreeModuleSettingLL(&settinglist); } // end code from dbe++ -void ShowPopup(char* szText, TCHAR* tszText, HANDLE hContact) +void ShowPopup(char* szText, TCHAR* tszText, HCONTACT hContact) { POPUPDATAT ppd = {0}; TCHAR* text = 0; @@ -223,7 +223,7 @@ void ShowPopup(char* szText, TCHAR* tszText, HANDLE hContact) mir_free(text); } -BOOL DirectoryExists(HANDLE hContact) +BOOL DirectoryExists(HCONTACT hContact) { int attr; char path[MAX_PATH]; @@ -259,7 +259,7 @@ void CopyToClipboard(HWND hwnd,LPSTR pszMsg, LPTSTR ptszMsg) CloseClipboard(); } -BOOL isMetaContact(HANDLE hContact) +BOOL isMetaContact(HCONTACT hContact) { char *proto; if (bMetaContacts) { @@ -271,30 +271,30 @@ BOOL isMetaContact(HANDLE hContact) return FALSE; } -HANDLE getDefaultContact(HANDLE hContact) +HCONTACT getDefaultContact(HCONTACT hContact) { if (bMetaContacts) - return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT, (WPARAM)hContact, 0); + return (HCONTACT)CallService(MS_MC_GETDEFAULTCONTACT, (WPARAM)hContact, 0); return 0; } -HANDLE getMostOnline(HANDLE hContact) +HCONTACT getMostOnline(HCONTACT hContact) { if (bMetaContacts) - return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + return (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); return 0; } -void GetID(HANDLE hContact,LPSTR szProto,LPSTR szID) +void GetID(HCONTACT hContact, LPSTR szProto, LPSTR szID) { DBVARIANT dbv_uniqueid; - LPSTR uID = (LPSTR) CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if ( uID == (LPSTR)CALLSERVICE_NOTFOUND ) + LPSTR uID = (LPSTR)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); + if (uID == (LPSTR)CALLSERVICE_NOTFOUND) uID = NULL; *szID = '\0'; - if ( uID && db_get(hContact, szProto, uID ,&dbv_uniqueid) == 0 ) { + if (uID && db_get(hContact, szProto, uID, &dbv_uniqueid) == 0) { if (dbv_uniqueid.type == DBVT_DWORD) wsprintfA(szID, "%u", dbv_uniqueid.dVal); //!!!!!!!!! else if (dbv_uniqueid.type == DBVT_WORD) @@ -308,7 +308,7 @@ void GetID(HANDLE hContact,LPSTR szProto,LPSTR szID) } } -int StatusMsgExists(HANDLE hContact) +int StatusMsgExists(HCONTACT hContact) { char par[32]; BOOL ret = 0; @@ -332,7 +332,7 @@ int StatusMsgExists(HANDLE hContact) return ret; } -BOOL IPExists(HANDLE hContact) +BOOL IPExists(HCONTACT hContact) { LPSTR szProto; DWORD mIP,rIP; @@ -346,7 +346,7 @@ BOOL IPExists(HANDLE hContact) return (mIP != 0 || rIP != 0); } -BOOL MirVerExists(HANDLE hContact) +BOOL MirVerExists(HCONTACT hContact) { LPSTR szProto, msg; BOOL ret = 0; @@ -363,7 +363,7 @@ BOOL MirVerExists(HANDLE hContact) return ret; } -void getIP(HANDLE hContact,LPSTR szProto,LPSTR szIP) +void getIP(HCONTACT hContact,LPSTR szProto,LPSTR szIP) { char szmIP[64] = {0}; char szrIP[64] = {0}; @@ -377,7 +377,7 @@ void getIP(HANDLE hContact,LPSTR szProto,LPSTR szIP) strcat(szIP, szmIP); } -LPTSTR getMirVer(HANDLE hContact) +LPTSTR getMirVer(HCONTACT hContact) { LPSTR szProto = GetContactProto(hContact); if (!szProto) return NULL; @@ -414,7 +414,7 @@ static LRESULT CALLBACK AuthReqEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam INT_PTR CALLBACK AuthReqWndProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) { - static HANDLE hcontact; + static HCONTACT hcontact; switch(msg){ case WM_INITDIALOG: @@ -422,7 +422,7 @@ INT_PTR CALLBACK AuthReqWndProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) mir_subclassWindow( GetDlgItem(hdlg, IDC_REASON), AuthReqEditSubclassProc); SendDlgItemMessage(hdlg, IDC_REASON, EM_LIMITTEXT, (WPARAM)255, 0); SetDlgItemText(hdlg, IDC_REASON, TranslateT("Please authorize me to add you to my contact list.")); - hcontact = (HANDLE)lparam; + hcontact = (HCONTACT)lparam; break; case WM_COMMAND: @@ -458,11 +458,11 @@ BOOL isProtoOnline(char *szProto) INT_PTR onSendAuthRequest(WPARAM wparam,LPARAM lparam) { DWORD flags; - char *szProto = GetContactProto((HANDLE)wparam); + char *szProto = GetContactProto((HCONTACT)wparam); flags = CallProtoService(szProto,PS_GETCAPS,PFLAGNUM_4,0); if (flags&PF4_NOCUSTOMAUTH) - CallContactService((HANDLE)wparam,PSS_AUTHREQUEST,0, (LPARAM)""); + CallContactService((HCONTACT)wparam, PSS_AUTHREQUEST, 0, (LPARAM)""); else CreateDialogParam(hinstance,MAKEINTRESOURCE(IDD_AUTHREQ),(HWND)CallService(MS_CLUI_GETHWND,0,0),AuthReqWndProc,(LPARAM)wparam); @@ -471,27 +471,27 @@ INT_PTR onSendAuthRequest(WPARAM wparam,LPARAM lparam) INT_PTR onSendAdded(WPARAM wparam,LPARAM lparam) { - CallContactService((HANDLE)wparam,PSS_ADDED,0,0); + CallContactService((HCONTACT)wparam, PSS_ADDED, 0, 0); return 0; } // set the invisible-flag in db INT_PTR onSetInvis(WPARAM wparam,LPARAM lparam) { - CallContactService((HANDLE)wparam,PSS_SETAPPARENTMODE,(db_get_w((HANDLE)wparam, GetContactProto((HANDLE)wparam),"ApparentMode",0) == ID_STATUS_OFFLINE)?0:ID_STATUS_OFFLINE,0); + CallContactService((HCONTACT)wparam, PSS_SETAPPARENTMODE, (db_get_w((HCONTACT)wparam, GetContactProto((HCONTACT)wparam), "ApparentMode", 0) == ID_STATUS_OFFLINE) ? 0 : ID_STATUS_OFFLINE, 0); return 0; } // set visible-flag in db INT_PTR onSetVis(WPARAM wparam,LPARAM lparam) { - CallContactService((HANDLE)wparam,PSS_SETAPPARENTMODE,(db_get_w((HANDLE)wparam, GetContactProto((HANDLE)wparam),"ApparentMode",0) == ID_STATUS_ONLINE)?0:ID_STATUS_ONLINE,0); + CallContactService((HCONTACT)wparam, PSS_SETAPPARENTMODE, (db_get_w((HCONTACT)wparam, GetContactProto((HCONTACT)wparam), "ApparentMode", 0) == ID_STATUS_ONLINE) ? 0 : ID_STATUS_ONLINE, 0); return 0; } INT_PTR onHide(WPARAM wparam,LPARAM lparam) { - db_set_b((HANDLE)wparam,"CList","Hidden",(byte)!db_get_b((HANDLE)wparam,"CList","Hidden",0)); + db_set_b((HCONTACT)wparam, "CList", "Hidden", (BYTE)!db_get_b((HCONTACT)wparam, "CList", "Hidden", 0)); return 0; } @@ -504,7 +504,7 @@ void ModifyVisibleSet(int mode, BOOL alpha) Menu_ModifyItem(hmenuVis, &mi); } -void ModifyInvisSet(int mode,BOOL alpha) +void ModifyInvisSet(int mode, BOOL alpha) { CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ICON; @@ -512,14 +512,14 @@ void ModifyInvisSet(int mode,BOOL alpha) Menu_ModifyItem(hmenuOff, &mi); } -void ModifyCopyID(HANDLE hContact, BOOL bShowID, BOOL bTrimID) +void ModifyCopyID(HCONTACT hContact, BOOL bShowID, BOOL bTrimID) { CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ICON | CMIM_NAME | CMIF_UNICODE; if (isMetaContact(hContact)) { - HANDLE hC = getMostOnline(hContact); - if ( !hContact ) hC = getDefaultContact(hContact); + HCONTACT hC = getMostOnline(hContact); + if (!hContact) hC = getDefaultContact(hContact); hContact = hC; } @@ -528,8 +528,8 @@ void ModifyCopyID(HANDLE hContact, BOOL bShowID, BOOL bTrimID) Menu_ShowItem(hmenuCopyID, false); return; } - - HICON hIconCID = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0); + + HICON hIconCID = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); mi.hIcon = BindOverlayIcon(hIconCID, "miex_copyid"); DestroyIcon(hIconCID); hIconCID = mi.hIcon; @@ -555,7 +555,7 @@ void ModifyCopyID(HANDLE hContact, BOOL bShowID, BOOL bTrimID) DestroyIcon(hIconCID); } -void ModifyStatusMsg(HANDLE hContact) +void ModifyStatusMsg(HCONTACT hContact) { LPSTR szProto = GetContactProto(hContact); if (!szProto) { @@ -566,8 +566,8 @@ void ModifyStatusMsg(HANDLE hContact) CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ICON; - HICON hIconSMsg = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0); - mi.hIcon = BindOverlayIcon(hIconSMsg, (StatusMsgExists(hContact)&2) ? "miex_copysm2" : "miex_copysm1"); + HICON hIconSMsg = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); + mi.hIcon = BindOverlayIcon(hIconSMsg, (StatusMsgExists(hContact) & 2) ? "miex_copysm2" : "miex_copysm1"); DestroyIcon(hIconSMsg); hIconSMsg = mi.hIcon; @@ -575,7 +575,7 @@ void ModifyStatusMsg(HANDLE hContact) DestroyIcon(hIconSMsg); } -void ModifyCopyIP(HANDLE hContact) +void ModifyCopyIP(HCONTACT hContact) { LPSTR szProto = GetContactProto(hContact); if (!szProto) { @@ -586,7 +586,7 @@ void ModifyCopyIP(HANDLE hContact) CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ICON; - HICON hIconCIP = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0); + HICON hIconCIP = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0); mi.hIcon = BindOverlayIcon(hIconCIP, "miex_copyip"); DestroyIcon(hIconCIP); hIconCIP = mi.hIcon; @@ -595,12 +595,12 @@ void ModifyCopyIP(HANDLE hContact) DestroyIcon(hIconCIP); } -void ModifyCopyMirVer(HANDLE hContact) +void ModifyCopyMirVer(HCONTACT hContact) { CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_ICON; - if ( ServiceExists(MS_FP_GETCLIENTICONT)) { + if (ServiceExists(MS_FP_GETCLIENTICONT)) { LPTSTR msg = getMirVer(hContact); if (msg) { mi.hIcon = Finger_GetClientIcon(msg, 1); @@ -611,13 +611,13 @@ void ModifyCopyMirVer(HANDLE hContact) Menu_ModifyItem(hmenuCopyMirVer, &mi); } -INT_PTR onCopyID(WPARAM wparam,LPARAM lparam) +INT_PTR onCopyID(WPARAM wparam, LPARAM lparam) { - char szID[128] = {0}, buffer[256] = {0}; + char szID[128] = { 0 }, buffer[256] = { 0 }; - HANDLE hContact = (HANDLE)wparam; + HCONTACT hContact = (HCONTACT)wparam; if (isMetaContact(hContact)) { - HANDLE hC = getMostOnline(hContact); + HCONTACT hC = getMostOnline(hContact); if (!hContact) hC = getDefaultContact(hContact); hContact = hC; @@ -631,8 +631,8 @@ INT_PTR onCopyID(WPARAM wparam,LPARAM lparam) if (db_get_dw(NULL, MODULENAME, "flags", vf_default) & VF_CIDN) { PROTOACCOUNT *pa = ProtoGetAccount(szProto); - - if (!pa->bOldProto) + + if (!pa->bOldProto) mir_snprintf(buffer, SIZEOF(buffer), "%s: %s", pa->szProtoName, szID); else mir_snprintf(buffer, SIZEOF(buffer), "%s: %s", szProto, szID); @@ -646,31 +646,31 @@ INT_PTR onCopyID(WPARAM wparam,LPARAM lparam) return 0; } -INT_PTR onCopyStatusMsg(WPARAM wparam,LPARAM lparam) +INT_PTR onCopyStatusMsg(WPARAM wparam, LPARAM lparam) { - LPSTR module; + LPSTR module; char par[32]; TCHAR buffer[2048]; int i; DWORD flags = db_get_dw(NULL, MODULENAME, "flags", vf_default); - module = GetContactProto((HANDLE)wparam); + module = GetContactProto((HCONTACT)wparam); if (!module) return 0; buffer[0] = 0; - for(i = 0; i < SIZEOF(statusMsg); i++) { + for (i = 0; i < SIZEOF(statusMsg); i++) { if (statusMsg[i].flag & 8) mir_snprintf(par, SIZEOF(par), "%s/%s", module, statusMsg[i].name); else strcpy(par, statusMsg[i].name); - LPTSTR msg = db_get_tsa((HANDLE)wparam, (statusMsg[i].module) ? statusMsg[i].module : module, par); + LPTSTR msg = db_get_tsa((HCONTACT)wparam, (statusMsg[i].module) ? statusMsg[i].module : module, par); if (msg) { if (_tcsclen(msg)) { if (flags & VF_SMNAME) { - _tcsncat (buffer, TranslateTS(statusMsg[i].fullName), (SIZEOF(buffer) - _tcsclen(buffer) - 1)); - _tcsncat (buffer, _T(": "), (SIZEOF(buffer) - _tcsclen(buffer) - 1)); + _tcsncat(buffer, TranslateTS(statusMsg[i].fullName), (SIZEOF(buffer) - _tcsclen(buffer) - 1)); + _tcsncat(buffer, _T(": "), (SIZEOF(buffer) - _tcsclen(buffer) - 1)); } _tcsncat(buffer, msg, (SIZEOF(buffer) - _tcsclen(buffer) - 1)); _tcsncat(buffer, _T("\r\n"), (SIZEOF(buffer) - _tcsclen(buffer) - 1)); @@ -681,39 +681,39 @@ INT_PTR onCopyStatusMsg(WPARAM wparam,LPARAM lparam) CopyToClipboard((HWND)lparam, 0, buffer); if (CTRL_IS_PRESSED && bPopupService) - ShowPopup(0, buffer, (HANDLE)wparam); + ShowPopup(0, buffer, (HCONTACT)wparam); return 0; } -INT_PTR onCopyIP(WPARAM wparam,LPARAM lparam) +INT_PTR onCopyIP(WPARAM wparam, LPARAM lparam) { - char *szProto = GetContactProto((HANDLE)wparam); + char *szProto = GetContactProto((HCONTACT)wparam); char szIP[128]; - getIP((HANDLE)wparam,szProto,(LPSTR)&szIP); + getIP((HCONTACT)wparam, szProto, (LPSTR)&szIP); CopyToClipboard((HWND)lparam, szIP, 0); if (CTRL_IS_PRESSED && bPopupService) - ShowPopup(szIP, 0, (HANDLE)wparam); + ShowPopup(szIP, 0, (HCONTACT)wparam); return 0; } -INT_PTR onCopyMirVer(WPARAM wparam,LPARAM lparam) +INT_PTR onCopyMirVer(WPARAM wparam, LPARAM lparam) { - LPTSTR msg = getMirVer((HANDLE)wparam); + LPTSTR msg = getMirVer((HCONTACT)wparam); if (msg) { CopyToClipboard((HWND)lparam, _T2A(msg), 0); if (CTRL_IS_PRESSED && bPopupService) - ShowPopup( _T2A(msg), 0, (HANDLE)wparam); + ShowPopup(_T2A(msg), 0, (HCONTACT)wparam); mir_free(msg); } return 0; } -INT_PTR onRecvFiles(WPARAM wparam,LPARAM lparam) +INT_PTR onRecvFiles(WPARAM wparam, LPARAM lparam) { char path[MAX_PATH]; CallService(MS_FILE_GETRECEIVEDFILESFOLDER, wparam, (LPARAM)&path); @@ -721,11 +721,11 @@ INT_PTR onRecvFiles(WPARAM wparam,LPARAM lparam) return 0; } -INT_PTR onChangeProto(WPARAM wparam,LPARAM lparam) +INT_PTR onChangeProto(WPARAM wparam, LPARAM lparam) { - HANDLE hContact = (HANDLE)wparam, hContactNew; + HCONTACT hContact = (HCONTACT)wparam, hContactNew; char* szProto = GetContactProto(hContact); - if ( !strcmp(szProto, (char*)lparam)) + if (!strcmp(szProto, (char*)lparam)) return 0; if (CTRL_IS_PRESSED) { @@ -735,7 +735,7 @@ INT_PTR onChangeProto(WPARAM wparam,LPARAM lparam) CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContactNew, lparam); } else { - hContactNew = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContactNew = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if (hContactNew) { CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContactNew, lparam); RenameDbProto(hContact, hContactNew, GetContactProto(hContact), (char*)lparam, 0); @@ -744,7 +744,7 @@ INT_PTR onChangeProto(WPARAM wparam,LPARAM lparam) else return 0; } - if (MessageBox(NULL,(LPCTSTR)TranslateT("Do you want to send authorization request\nto new contact?"), + if (MessageBox(NULL, (LPCTSTR)TranslateT("Do you want to send authorization request\nto new contact?"), TranslateT("Miranda NG"), MB_OKCANCEL | MB_SETFOREGROUND | MB_TOPMOST) == IDOK) onSendAuthRequest((WPARAM)hContactNew, 0); @@ -765,25 +765,25 @@ int isIgnored(HANDLE hContact, int type) return (all == SIZEOF(ii) - 1) ? 1 : 0; // ignoring all or not } -INT_PTR onIgnore(WPARAM wparam,LPARAM lparam) +INT_PTR onIgnore(WPARAM wparam, LPARAM lparam) { if (db_get_b(NULL, MODULENAME, "ignorehide", 0) && (lparam == IGNOREEVENT_ALL)) - db_set_b((HANDLE)wparam, "CList", "Hidden", (isIgnored((HANDLE)wparam, lparam) ? (byte)0 : (byte)1)); + db_set_b((HCONTACT)wparam, "CList", "Hidden", (isIgnored((HANDLE)wparam, lparam) ? (byte)0 : (byte)1)); - CallService(isIgnored((HANDLE)wparam, lparam) ? MS_IGNORE_UNIGNORE : MS_IGNORE_IGNORE, wparam, lparam); + CallService(isIgnored((HANDLE)wparam, lparam) ? MS_IGNORE_UNIGNORE : MS_IGNORE_IGNORE, wparam, lparam); return 0; } static HGENMENU AddSubmenuItem(HGENMENU hRoot, TCHAR* name, HICON icon, DWORD flag, char* service, int pos, int param) { CLISTMENUITEM mi = { sizeof(mi) }; - mi.hParentMenu = hRoot; - mi.popupPosition = param; - mi.position = pos; - mi.ptszName = name; - mi.hIcon = icon; - mi.flags = CMIF_UNICODE | CMIF_CHILDPOPUP | flag; - mi.pszService = service; + mi.hParentMenu = hRoot; + mi.popupPosition = param; + mi.position = pos; + mi.ptszName = name; + mi.hIcon = icon; + mi.flags = CMIF_UNICODE | CMIF_CHILDPOPUP | flag; + mi.pszService = service; return Menu_AddContactMenuItem(&mi); } @@ -800,12 +800,12 @@ static void ModifySubmenuItem(HGENMENU hItem, TCHAR *name, int checked, int hidd } // called when the contact-menu is built -int BuildMenu(WPARAM wparam,LPARAM lparam) +int BuildMenu(WPARAM wparam, LPARAM lparam) { DWORD flags = db_get_dw(NULL, MODULENAME, "flags", vf_default); int j = 0, all = 0, hide = 0; BOOL bIsOnline = FALSE, bShowAll = CTRL_IS_PRESSED; - HANDLE hContact = (HANDLE)wparam; + HCONTACT hContact = (HCONTACT)wparam; char* pszProto = GetContactProto(hContact); PROTOACCOUNT *pa = ProtoGetAccount(pszProto); @@ -818,7 +818,7 @@ int BuildMenu(WPARAM wparam,LPARAM lparam) bEnabled = bShowAll || (flags & VF_HFL); Menu_ShowItem(hmenuHide, bEnabled); if (bEnabled) { - BYTE bHidden = db_get_b((HANDLE)wparam,"CList","Hidden",0); + BYTE bHidden = db_get_b((HCONTACT)wparam, "CList", "Hidden", 0); CLISTMENUITEM mi = { sizeof(mi) }; mi.flags |= CMIM_ICON | CMIM_NAME | CMIF_UNICODE; mi.hIcon = Skin_GetIcon(bHidden ? "miex_showil" : "miex_hidefl"); @@ -829,9 +829,9 @@ int BuildMenu(WPARAM wparam,LPARAM lparam) bEnabled = bShowAll || (flags & VF_IGN); Menu_ShowItem(hmenuIgnore, bEnabled); if (bEnabled) { - for (int i=1; i < SIZEOF(ii); i++) { + for (int i = 1; i < SIZEOF(ii); i++) { int check = isIgnored(hContact, ii[i].type); - if (check) + if (check) all++; ModifySubmenuItem(hIgnoreItem[i], ii[i].name, check, 0); @@ -845,7 +845,7 @@ int BuildMenu(WPARAM wparam,LPARAM lparam) } if (pa && (bShowAll || (flags & VF_PROTO))) { - for (int i=0; i < protoCount; i++) { + for (int i = 0; i < protoCount; i++) { if ((!accs[i]->bIsEnabled) || (strcmp(pa->szProtoName, accs[i]->szProtoName))) hide = 1; else { @@ -887,12 +887,12 @@ int BuildMenu(WPARAM wparam,LPARAM lparam) if ((bShowAll || (flags & VF_VS)) && pszProto) { INT_PTR caps = CallProtoService(pszProto, PS_GETCAPS, PFLAGNUM_1, 0); - int apparent = db_get_w(hContact, GetContactProto(hContact),"ApparentMode", 0); - + int apparent = db_get_w(hContact, GetContactProto(hContact), "ApparentMode", 0); + Menu_ShowItem(hmenuVis, caps & PF1_VISLIST); if (caps & PF1_VISLIST) ModifyVisibleSet(apparent == ID_STATUS_ONLINE, flags & VF_SAI); - + Menu_ShowItem(hmenuOff, caps & PF1_INVISLIST); if (caps & PF1_INVISLIST) ModifyInvisSet(apparent == ID_STATUS_OFFLINE, flags & VF_SAI); @@ -906,7 +906,7 @@ int EnumProtoSubmenu(WPARAM wparam, LPARAM lparam) int pos = 1000; if (protoCount) // remove old items { - for (i = 0; i < protoCount; i++) + for (i = 0; i < protoCount; i++) { if (hProtoItem[i]) { @@ -915,13 +915,13 @@ int EnumProtoSubmenu(WPARAM wparam, LPARAM lparam) } } } - ProtoEnumAccounts(&protoCount,&accs); + ProtoEnumAccounts(&protoCount, &accs); if (protoCount > MAX_PROTOS) protoCount = MAX_PROTOS; - for (i = 0; i < protoCount; i++) + for (i = 0; i < protoCount; i++) { - hProtoItem[i] = AddSubmenuItem(hmenuProto, accs[i]->tszAccountName, - LoadSkinnedProtoIcon(accs[i]->szModuleName, ID_STATUS_ONLINE), CMIF_KEEPUNTRANSLATED, + hProtoItem[i] = AddSubmenuItem(hmenuProto, accs[i]->tszAccountName, + LoadSkinnedProtoIcon(accs[i]->szModuleName, ID_STATUS_ONLINE), CMIF_KEEPUNTRANSLATED, MS_PROTO, pos++, (int)accs[i]->szModuleName); } return 0; @@ -940,8 +940,8 @@ static int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam) static int TabsrmmButtonsInit(WPARAM wParam, LPARAM lParam) { - BBButton bbd = {0}; - + BBButton bbd = { 0 }; + bbd.cbSize = sizeof(BBButton); bbd.pszModuleName = MODULENAME; bbd.dwButtonID = 0; @@ -949,33 +949,32 @@ static int TabsrmmButtonsInit(WPARAM wParam, LPARAM lParam) bbd.ptszTooltip = LPGENT("Browse Received Files"); bbd.bbbFlags = BBBF_ISLSIDEBUTTON | BBBF_CANBEHIDDEN; bbd.hIcon = Skin_GetIconHandle("miex_recfiles"); - CallService (MS_BB_ADDBUTTON, 0, (LPARAM)&bbd); + CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd); return 0; -} +} -static void TabsrmmButtonsModify(HANDLE hContact) -{ - if (!DirectoryExists(hContact)) +static void TabsrmmButtonsModify(HCONTACT hContact) +{ + if (!DirectoryExists(hContact)) { - BBButton bbd = {0}; - bbd.cbSize = sizeof(BBButton); + BBButton bbd = { 0 }; + bbd.cbSize = sizeof(BBButton); bbd.dwButtonID = 0; bbd.pszModuleName = MODULENAME; bbd.bbbFlags = BBSF_DISABLED | BBSF_HIDDEN; - CallService(MS_BB_SETBUTTONSTATE, (WPARAM)hContact, (LPARAM)&bbd); - } -} + CallService(MS_BB_SETBUTTONSTATE, (WPARAM)hContact, (LPARAM)&bbd); + } +} -static int ContactWindowOpen(WPARAM wparam,LPARAM lParam) -{ +static int ContactWindowOpen(WPARAM wparam, LPARAM lParam) +{ MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam; - if (MWeventdata->uType == MSG_WINDOW_EVT_OPENING && MWeventdata->hContact) - { - TabsrmmButtonsModify(MWeventdata->hContact); - } - return 0; + if (MWeventdata->uType == MSG_WINDOW_EVT_OPENING && MWeventdata->hContact) + TabsrmmButtonsModify(MWeventdata->hContact); + + return 0; } static int ModuleLoad(WPARAM wParam, LPARAM lParam) @@ -986,7 +985,7 @@ static int ModuleLoad(WPARAM wParam, LPARAM lParam) } // called when all modules are loaded -static int PluginInit(WPARAM wparam,LPARAM lparam) +static int PluginInit(WPARAM wparam, LPARAM lparam) { int pos = 1000, i = 0; @@ -1036,16 +1035,16 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) mi.hIcon = Skin_GetIcon("miex_ignore"); hmenuIgnore = Menu_AddContactMenuItem(&mi); - hIgnoreItem[0] = AddSubmenuItem(hmenuIgnore, ii[0].name, LoadSkinnedIcon(ii[0].icon), 0, MS_IGNORE, pos, ii[0].type ); + hIgnoreItem[0] = AddSubmenuItem(hmenuIgnore, ii[0].name, LoadSkinnedIcon(ii[0].icon), 0, MS_IGNORE, pos, ii[0].type); pos += 100000; // insert separator for (i = 1; i < SIZEOF(ii); i++) - hIgnoreItem[i] = AddSubmenuItem(hmenuIgnore, ii[i].name, LoadSkinnedIcon(ii[i].icon), 0, MS_IGNORE, pos++, ii[i].type ); + hIgnoreItem[i] = AddSubmenuItem(hmenuIgnore, ii[i].name, LoadSkinnedIcon(ii[i].icon), 0, MS_IGNORE, pos++, ii[i].type); pos += 100000; // insert separator ood.cbSize = sizeof(ood); ood.pszGroup = "Contacts"; ood.pszPage = "Ignore"; - AddSubmenuItem(hmenuIgnore, LPGENT("Open ignore settings"), Skin_GetIcon("miex_ignore"), 0, "Opt/OpenOptions", pos, (int)&ood ); + AddSubmenuItem(hmenuIgnore, LPGENT("Open ignore settings"), Skin_GetIcon("miex_ignore"), 0, "Opt/OpenOptions", pos, (int)&ood); mi.pszPopupName = 0; mi.position++; @@ -1069,7 +1068,7 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) mi.pszService = MS_AUTHREQ; mi.hIcon = LoadSkinnedIcon(SKINICON_AUTH_REQUEST); hmenuAuthReq = Menu_AddContactMenuItem(&mi); - + mi.position++; mi.ptszName = LPGENT("Copy ID"); mi.pszService = MS_COPYID; @@ -1103,12 +1102,12 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) hIcon[3] = MakeHalfAlphaIcon(hIcon[1]); hIcon[4] = MakeHalfAlphaIcon(hIcon[2]); - HookEvent(ME_CLIST_PREBUILDCONTACTMENU,BuildMenu); - HookEvent(ME_OPT_INITIALISE,OptionsInit); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, BuildMenu); + HookEvent(ME_OPT_INITIALISE, OptionsInit); HookEvent(ME_PROTO_ACCLISTCHANGED, EnumProtoSubmenu); if (HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit)) { HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); - HookEvent(ME_MSG_WINDOWEVENT,ContactWindowOpen); + HookEvent(ME_MSG_WINDOWEVENT, ContactWindowOpen); } return 0; @@ -1135,7 +1134,7 @@ extern "C" __declspec(dllexport) int Unload(void) return 0; } -BOOL WINAPI DllMain(HINSTANCE hinst,DWORD fdwReason,LPVOID lpvReserved) +BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID lpvReserved) { hinstance = hinst; return 1; diff --git a/plugins/MetaContacts/src/addto.cpp b/plugins/MetaContacts/src/addto.cpp index cd68607d51..40d3c30b86 100644 --- a/plugins/MetaContacts/src/addto.cpp +++ b/plugins/MetaContacts/src/addto.cpp @@ -56,7 +56,7 @@ int FillList(HWND list, BOOL sort) int i=0; // The DB is searched through, to get all the metacontacts - for (HANDLE hMetaUser = db_find_first(); hMetaUser; hMetaUser = db_find_next(hMetaUser)) { + for (HCONTACT hMetaUser = db_find_first(); hMetaUser; hMetaUser = db_find_next(hMetaUser)) { // if it's not a MetaContact, go to the next if ( db_get_dw(hMetaUser, META_PROTO, META_ID, (DWORD)-1) == (DWORD)-1) continue; @@ -124,7 +124,7 @@ INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_INITDIALOG: TranslateDialogDefault( hwndDlg ); - if ( db_get_dw((HANDLE)lParam, META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1) { + if ( db_get_dw((HCONTACT)lParam, META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1) { MessageBox(hwndDlg, TranslateT("This contact is a MetaContact.\nYou can't add a MetaContact to another MetaContact.\n\nPlease choose another."), TranslateT("MetaContact Conflict"),MB_ICONERROR); @@ -132,7 +132,7 @@ INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE; } - if ( db_get_dw((HANDLE)lParam, META_PROTO, META_LINK, (DWORD)-1) != (DWORD)-1) { + if ( db_get_dw((HCONTACT)lParam, META_PROTO, META_LINK, (DWORD)-1) != (DWORD)-1) { MessageBox(hwndDlg, TranslateT("This contact is already associated to a MetaContact.\nYou cannot add a contact to multiple MetaContacts."), TranslateT("Multiple MetaContacts"),MB_ICONERROR); @@ -155,7 +155,7 @@ INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP } else { // get contact display name from clist - TCHAR *ptszCDN = pcli->pfnGetContactDisplayName((HANDLE)lParam, GCDNF_TCHAR); + TCHAR *ptszCDN = pcli->pfnGetContactDisplayName((HCONTACT)lParam, GCDNF_TCHAR); if (!ptszCDN) ptszCDN = TranslateT("a contact"); @@ -178,9 +178,9 @@ INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (item == -1) return IDOK == MessageBox(hwndDlg, TranslateT("Please select a MetaContact"), TranslateT("No MetaContact selected"), MB_ICONHAND); - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - HANDLE hMeta = (HANDLE)SendMessage(GetDlgItem(hwndDlg, IDC_METALIST), LB_GETITEMDATA, (WPARAM)item, 0); - if ( !Meta_Assign(hContact,hMeta, FALSE)) + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hMeta = (HCONTACT)SendMessage(GetDlgItem(hwndDlg, IDC_METALIST), LB_GETITEMDATA, (WPARAM)item, 0); + if (!Meta_Assign(hContact, hMeta, FALSE)) MessageBox(hwndDlg, TranslateT("Assignment to the MetaContact failed."), TranslateT("Assignment failure"),MB_ICONERROR); } case IDCANCEL: diff --git a/plugins/MetaContacts/src/edit.cpp b/plugins/MetaContacts/src/edit.cpp index f5977e27c2..859ad8aafd 100644 --- a/plugins/MetaContacts/src/edit.cpp +++ b/plugins/MetaContacts/src/edit.cpp @@ -29,13 +29,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //! Holds the differents changes that have to made typedef struct tag_CHANGES { - HANDLE hMeta; //!< \c HANDLE of the MetaContact that is edited. - HANDLE hDefaultContact; //!< \c HANDLE of the new default contact - HANDLE hOfflineContact; + HCONTACT hMeta; //!< \c HANDLE of the MetaContact that is edited. + HCONTACT hDefaultContact; //!< \c HANDLE of the new default contact + HCONTACT hOfflineContact; int num_deleted, //!< \c DWORD number of deleted contacts num_contacts; //!< \c DWORD number of contacts - HANDLE hDeletedContacts[MAX_CONTACTS]; //!< \c HANDLEs of the subcontacts to be removed from this metacontact - HANDLE hContact[MAX_CONTACTS]; //!< \c HANDLEs of the subcontacts, in the order they should be in + HCONTACT hDeletedContacts[MAX_CONTACTS]; //!< \c HANDLEs of the subcontacts to be removed from this metacontact + HCONTACT hContact[MAX_CONTACTS]; //!< \c HANDLEs of the subcontacts, in the order they should be in int force_default; } CHANGES; @@ -134,7 +134,6 @@ void SetListSelection(HWND hList, int sel) void ApplyChanges(CHANGES *chg) { - HANDLE most_online; int i; // remove removed contacts @@ -168,7 +167,7 @@ void ApplyChanges(CHANGES *chg) db_set_dw(chg->hMeta, META_PROTO, "OfflineSend", (DWORD)-1); // fix nick - most_online = Meta_GetMostOnline(chg->hMeta); + HCONTACT most_online = Meta_GetMostOnline(chg->hMeta); Meta_CopyContactNick(chg->hMeta, most_online); // fix status @@ -271,17 +270,17 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UP), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_DOWN), FALSE); - int nb_contacts = db_get_dw((HANDLE)lParam, META_PROTO, "NumContacts", 0); - int default_contact_number = db_get_dw((HANDLE)lParam, META_PROTO, "Default", (DWORD)-1); - int offline_contact_number = db_get_dw((HANDLE)lParam, META_PROTO, "OfflineSend", (DWORD)-1); + int nb_contacts = db_get_dw((HCONTACT)lParam, META_PROTO, "NumContacts", 0); + int default_contact_number = db_get_dw((HCONTACT)lParam, META_PROTO, "Default", (DWORD)-1); + int offline_contact_number = db_get_dw((HCONTACT)lParam, META_PROTO, "OfflineSend", (DWORD)-1); - changes.hMeta = (HANDLE)lParam; + changes.hMeta = (HCONTACT)lParam; changes.num_contacts = nb_contacts; changes.num_deleted = 0; - changes.hDefaultContact = Meta_GetContactHandle((HANDLE)lParam, default_contact_number); - changes.hOfflineContact = Meta_GetContactHandle((HANDLE)lParam, offline_contact_number); + changes.hDefaultContact = Meta_GetContactHandle((HCONTACT)lParam, default_contact_number); + changes.hOfflineContact = Meta_GetContactHandle((HCONTACT)lParam, offline_contact_number); for (i = 0; i < nb_contacts; i++) - changes.hContact[i] = Meta_GetContactHandle((HANDLE)lParam, i); + changes.hContact[i] = Meta_GetContactHandle((HCONTACT)lParam, i); changes.force_default = MetaAPI_GetForceState((WPARAM)lParam, 0); SendMessage(hwndDlg, WMU_SETTITLE, 0, lParam); @@ -294,7 +293,7 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WMU_SETTITLE: { - TCHAR *ptszCDN = pcli->pfnGetContactDisplayName((HANDLE)lParam, GCDNF_TCHAR); + TCHAR *ptszCDN = pcli->pfnGetContactDisplayName((HCONTACT)lParam, GCDNF_TCHAR); if (ptszCDN == NULL) ptszCDN = TranslateT("(Unknown Contact)"); @@ -414,9 +413,9 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel = ListView_GetNextItem(hwnd, -1, LVNI_FOCUSED | LVNI_SELECTED); { - HANDLE temp = changes.hContact[sel]; + HCONTACT temp = changes.hContact[sel]; changes.hContact[sel] = changes.hContact[sel - 1]; - changes.hContact[sel - 1] = temp; + changes.hContact[sel-1] = temp; } FillContactList(hwndDlg, &changes); sel--; @@ -431,7 +430,7 @@ INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR hwnd = GetDlgItem(hwndDlg, IDC_LST_CONTACTS); sel = ListView_GetNextItem(hwnd, -1, LVNI_FOCUSED | LVNI_SELECTED); { - HANDLE temp = changes.hContact[sel]; + HCONTACT temp = changes.hContact[sel]; changes.hContact[sel] = changes.hContact[sel + 1]; changes.hContact[sel + 1] = temp; } diff --git a/plugins/MetaContacts/src/meta_api.cpp b/plugins/MetaContacts/src/meta_api.cpp index 8835733c15..77a09a6a4a 100644 --- a/plugins/MetaContacts/src/meta_api.cpp +++ b/plugins/MetaContacts/src/meta_api.cpp @@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //lParam=0 //returns a handle to the parent metacontact, or null if this contact is not a subcontact INT_PTR MetaAPI_GetMeta(WPARAM wParam, LPARAM lParam) { - return (INT_PTR)(HANDLE)db_get_dw((HANDLE)wParam, META_PROTO, "Handle", 0); + return (INT_PTR)(HANDLE)db_get_dw((HCONTACT)wParam, META_PROTO, "Handle", 0); } //gets the handle for the default contact @@ -40,9 +40,9 @@ INT_PTR MetaAPI_GetMeta(WPARAM wParam, LPARAM lParam) { //lParam=0 //returns a handle to the default contact, or null on failure INT_PTR MetaAPI_GetDefault(WPARAM wParam, LPARAM lParam) { - DWORD default_contact_number = db_get_dw((HANDLE)wParam, META_PROTO, "Default", -1); + DWORD default_contact_number = db_get_dw((HCONTACT)wParam, META_PROTO, "Default", -1); if (default_contact_number != -1) { - return (INT_PTR)Meta_GetContactHandle((HANDLE)wParam, default_contact_number); + return (INT_PTR)Meta_GetContactHandle((HCONTACT)wParam, default_contact_number); } return 0; } @@ -52,7 +52,7 @@ INT_PTR MetaAPI_GetDefault(WPARAM wParam, LPARAM lParam) { //lParam=0 //returns a DWORD contact number, or -1 on failure INT_PTR MetaAPI_GetDefaultNum(WPARAM wParam, LPARAM lParam) { - return db_get_dw((HANDLE)wParam, META_PROTO, "Default", -1); + return db_get_dw((HCONTACT)wParam, META_PROTO, "Default", -1); } //gets the handle for the 'most online' contact @@ -60,7 +60,7 @@ INT_PTR MetaAPI_GetDefaultNum(WPARAM wParam, LPARAM lParam) { //lParam=0 //returns a handle to the 'most online' contact INT_PTR MetaAPI_GetMostOnline(WPARAM wParam, LPARAM lParam) { - return (INT_PTR)Meta_GetMostOnline((HANDLE)wParam); + return (INT_PTR)Meta_GetMostOnline((HCONTACT)wParam); } //gets the number of subcontacts for a metacontact @@ -68,7 +68,7 @@ INT_PTR MetaAPI_GetMostOnline(WPARAM wParam, LPARAM lParam) { //lParam=0 //returns a DWORD representing the number of subcontacts for the given metacontact INT_PTR MetaAPI_GetNumContacts(WPARAM wParam, LPARAM lParam) { - DWORD num_contacts = db_get_dw((HANDLE)wParam, META_PROTO, "NumContacts", -1); + DWORD num_contacts = db_get_dw((HCONTACT)wParam, META_PROTO, "NumContacts", -1); return num_contacts; } @@ -77,7 +77,7 @@ INT_PTR MetaAPI_GetNumContacts(WPARAM wParam, LPARAM lParam) { //lParam=(DWORD)contact number //returns a handle to the specified subcontact INT_PTR MetaAPI_GetContact(WPARAM wParam, LPARAM lParam) { - return (INT_PTR)Meta_GetContactHandle((HANDLE)wParam, (DWORD)lParam); + return (INT_PTR)Meta_GetContactHandle((HCONTACT)wParam, (DWORD)lParam); } //sets the default contact, using the subcontact's contact number @@ -85,15 +85,15 @@ INT_PTR MetaAPI_GetContact(WPARAM wParam, LPARAM lParam) { //lParam=(DWORD)contact number //returns 0 on success INT_PTR MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam) { - DWORD num_contacts = db_get_dw((HANDLE)wParam, META_PROTO, "NumContacts", -1); + DWORD num_contacts = db_get_dw((HCONTACT)wParam, META_PROTO, "NumContacts", -1); if (num_contacts == -1) return 1; if ((DWORD)lParam >= num_contacts || (DWORD)lParam < 0) return 1; - if (db_set_dw((HANDLE)wParam, META_PROTO, "Default", (DWORD)lParam)) + if (db_set_dw((HCONTACT)wParam, META_PROTO, "Default", (DWORD)lParam)) return 1; - NotifyEventHooks(hEventDefaultChanged, wParam, (LPARAM)Meta_GetContactHandle((HANDLE)wParam, (int)lParam)); + NotifyEventHooks(hEventDefaultChanged, wParam, (LPARAM)Meta_GetContactHandle((HCONTACT)wParam, (int)lParam)); return 0; } @@ -102,8 +102,8 @@ INT_PTR MetaAPI_SetDefaultContactNum(WPARAM wParam, LPARAM lParam) { //lParam=(HANDLE)hSubcontact //returns 0 on success INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam) { - HANDLE hMeta = (HANDLE)db_get_dw((HANDLE)lParam, META_PROTO, "Handle", 0); - DWORD contact_number = Meta_GetContactNumber((HANDLE)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) return 1; if (db_set_dw(hMeta, META_PROTO, "Default", contact_number)) @@ -118,9 +118,9 @@ INT_PTR MetaAPI_SetDefaultContact(WPARAM wParam, LPARAM lParam) { //lParam=(DWORD)contact number //returns 0 on success INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = Meta_GetContactHandle((HANDLE)wParam, (int)lParam); - HANDLE hMeta = (HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0); - if ( !hContact || !hMeta || hMeta != (HANDLE)wParam || db_get_b(hMeta, META_PROTO, "ForceDefault", 0)) + 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)) return 1; db_set_dw(hMeta, META_PROTO, "ForceSend", (DWORD)hContact); @@ -134,8 +134,8 @@ INT_PTR MetaAPI_ForceSendContactNum(WPARAM wParam, LPARAM lParam) { //lParam=(HANDLE)hSubcontact //returns 0 on success (will fail if 'force default' is in effect) INT_PTR MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)lParam; - HANDLE hMeta = (HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0); + 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)) return 1; @@ -150,10 +150,10 @@ INT_PTR MetaAPI_ForceSendContact(WPARAM wParam, LPARAM lParam) { //lParam=0 //returns 0 on success (will fail if 'force default' is in effect) INT_PTR MetaAPI_UnforceSendContact(WPARAM wParam, LPARAM lParam) { - if (db_get_b((HANDLE)wParam, META_PROTO, "ForceDefault", 0)) + if (db_get_b((HCONTACT)wParam, META_PROTO, "ForceDefault", 0)) return 1; - db_set_dw((HANDLE)wParam, META_PROTO, "ForceSend", 0); + db_set_dw((HCONTACT)wParam, META_PROTO, "ForceSend", 0); NotifyEventHooks(hEventUnforceSend, wParam, lParam); return 0; @@ -169,7 +169,7 @@ INT_PTR MetaAPI_UnforceSendContact(WPARAM wParam, LPARAM lParam) { INT_PTR MetaAPI_ForceDefault(WPARAM wParam, LPARAM lParam) { // forward to menu function Meta_ForceDefault(wParam, lParam); - return db_get_b((HANDLE)wParam, META_PROTO, "ForceDefault", 0); + return db_get_b((HCONTACT)wParam, META_PROTO, "ForceDefault", 0); } // method to get state of 'force' for a metacontact @@ -179,18 +179,15 @@ INT_PTR MetaAPI_ForceDefault(WPARAM wParam, LPARAM lParam) { // or if none is in force, the value (DWORD)-1 will be copied // (v0.8.0.8+ returns 1 if 'force default' is true with *lParam == default contact number, else returns 0 with *lParam as above) INT_PTR MetaAPI_GetForceState(WPARAM wParam, LPARAM lParam) { - HANDLE hMeta = (HANDLE)wParam; - HANDLE hContact; - + HCONTACT hMeta = (HCONTACT)wParam; if ( !hMeta) return 0; if (db_get_b(hMeta, META_PROTO, "ForceDefault", 0)) { - if (lParam) *(DWORD *)lParam = db_get_dw((HANDLE)wParam, META_PROTO, "Default", -1); + if (lParam) *(DWORD *)lParam = db_get_dw((HCONTACT)wParam, META_PROTO, "Default", -1); return 1; } - hContact = (HANDLE)db_get_dw(hMeta, META_PROTO, "ForceSend", 0); - + HCONTACT hContact = (HCONTACT)db_get_dw(hMeta, META_PROTO, "ForceSend", 0); if ( !hContact) { if (lParam) *(DWORD *)lParam = -1; } else { @@ -219,7 +216,7 @@ INT_PTR MetaAPI_ConvertToMeta(WPARAM wParam, LPARAM lParam) { // lParam=(HANDLE)hMeta // add an existing contact to a metacontact INT_PTR MetaAPI_AddToMeta(WPARAM wParam, LPARAM lParam) { - return Meta_Assign((HANDLE)wParam, (HANDLE)lParam, FALSE); + return Meta_Assign((HCONTACT)wParam, (HCONTACT)lParam, FALSE); } // added 0.9.5.0 (22/3/05) diff --git a/plugins/MetaContacts/src/meta_main.cpp b/plugins/MetaContacts/src/meta_main.cpp index cdd2b6f20f..f251c1020d 100644 --- a/plugins/MetaContacts/src/meta_main.cpp +++ b/plugins/MetaContacts/src/meta_main.cpp @@ -151,7 +151,7 @@ extern "C" __declspec(dllexport) int Load(void) db_set_resident(META_PROTO, "WindowOpen"); //set all contacts to 'offline', and initialize subcontact counter for db consistency check - for (HANDLE hContact = db_find_first(META_PROTO); hContact; hContact = db_find_next(hContact, META_PROTO)) { + for (HCONTACT hContact = db_find_first(META_PROTO); hContact; hContact = db_find_next(hContact, META_PROTO)) { db_set_w(hContact, META_PROTO, "Status", ID_STATUS_OFFLINE); db_set_dw(hContact, META_PROTO, "IdleTS", 0); db_set_b(hContact, META_PROTO, "ContactCountCheck", 0); diff --git a/plugins/MetaContacts/src/meta_menu.cpp b/plugins/MetaContacts/src/meta_menu.cpp index fecb0520fe..53ed386ff6 100644 --- a/plugins/MetaContacts/src/meta_menu.cpp +++ b/plugins/MetaContacts/src/meta_menu.cpp @@ -42,13 +42,13 @@ INT_PTR Meta_Convert(WPARAM wParam, LPARAM lParam) char *group = 0; // Get some information about the selected contact. - if ( !db_get_utf((HANDLE)wParam, "CList", "Group", &dbv)) { + if ( !db_get_utf((HCONTACT)wParam, "CList", "Group", &dbv)) { group = _strdup(dbv.pszVal); db_free(&dbv); } // Create a new metacontact - HANDLE hMetaContact = (HANDLE)CallService(MS_DB_CONTACT_ADD,0,0); + HCONTACT hMetaContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD,0,0); if (hMetaContact) { db_set_dw(hMetaContact, META_PROTO, META_ID,nextMetaID); db_set_dw(hMetaContact, META_PROTO, "NumContacts",0); @@ -61,7 +61,7 @@ INT_PTR Meta_Convert(WPARAM wParam, LPARAM lParam) db_set_utf(hMetaContact, "CList", "Group", group); // Assign the contact to the MetaContact just created (and make default). - if ( !Meta_Assign((HANDLE)wParam, hMetaContact, TRUE)) { + if ( !Meta_Assign((HCONTACT)wParam, hMetaContact, TRUE)) { MessageBox(0, TranslateT("There was a problem in assigning the contact to the MetaContact"), TranslateT("Error"), MB_ICONEXCLAMATION); CallService(MS_DB_CONTACT_DELETE, (WPARAM)hMetaContact, 0); return 0; @@ -106,7 +106,7 @@ INT_PTR Meta_Edit(WPARAM wParam,LPARAM lParam) return 0; } -void Meta_RemoveContactNumber(HANDLE hMeta, int number) +void Meta_RemoveContactNumber(HCONTACT hMeta, int number) { int num_contacts = db_get_dw(hMeta, META_PROTO, "NumContacts", 0); int default_contact = db_get_dw(hMeta, META_PROTO, "Default", -1); @@ -114,7 +114,7 @@ void Meta_RemoveContactNumber(HANDLE hMeta, int number) return; // get the handle - HANDLE hContact = Meta_GetContactHandle(hMeta, 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) { @@ -207,7 +207,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) DWORD metaID; // The wParam is a metacontact - if ((metaID = db_get_dw((HANDLE)wParam, META_PROTO, META_ID, (DWORD)-1)) != (DWORD)-1) { + if ((metaID = db_get_dw((HCONTACT)wParam, META_PROTO, META_ID, (DWORD)-1)) != (DWORD)-1) { if ( !lParam) { // check from recursion - see second half of this function if ( MessageBox((HWND)CallService(MS_CLUI_GETHWND,0,0), TranslateT("This will remove the MetaContact permanently.\n\nProceed Anyway?"), @@ -215,7 +215,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) return 0; } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { // This contact is assigned to the MetaContact that will be deleted, clear the "MetaContacts" information if ( db_get_dw(hContact, META_PROTO, META_LINK,(DWORD)-1) == metaID) { db_unset(hContact, META_PROTO, "IsSubcontact"); @@ -237,7 +237,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) CallService(MS_DB_CONTACT_DELETE,wParam,0); } else { - HANDLE hMeta = (HANDLE)db_get_dw((HANDLE)wParam, META_PROTO, "Handle", 0); + HCONTACT hMeta = (HCONTACT)db_get_dw((HCONTACT)wParam, META_PROTO, "Handle", 0); DWORD num_contacts = db_get_dw(hMeta, META_PROTO, "NumContacts", -1); if (num_contacts == 1) { @@ -247,7 +247,7 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) return 0; } - Meta_RemoveContactNumber(hMeta, db_get_dw((HANDLE)wParam, META_PROTO, "ContactNumber", -1)); + Meta_RemoveContactNumber(hMeta, db_get_dw((HCONTACT)wParam, META_PROTO, "ContactNumber", -1)); } return 0; } @@ -262,12 +262,12 @@ INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam) */ INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam) { - HANDLE hMeta; + HCONTACT hMeta; // the wParam is a subcontact - if ((hMeta = (HANDLE)db_get_dw((HANDLE)wParam, META_PROTO, "Handle",0)) != 0) { - db_set_dw(hMeta, META_PROTO, "Default", (DWORD)Meta_GetContactNumber((HANDLE)wParam)); - NotifyEventHooks(hEventDefaultChanged, (WPARAM)hMeta, (LPARAM)(HANDLE)wParam); + if ((hMeta = (HCONTACT)db_get_dw((HCONTACT)wParam, META_PROTO, "Handle",0)) != 0) { + db_set_dw(hMeta, META_PROTO, "Default", (DWORD)Meta_GetContactNumber((HCONTACT)wParam)); + NotifyEventHooks(hEventDefaultChanged, (WPARAM)hMeta, (LPARAM)wParam); } return 0; } @@ -284,15 +284,15 @@ INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam) INT_PTR Meta_ForceDefault(WPARAM wParam,LPARAM lParam) { // the wParam is a MetaContact - if (db_get_dw((HANDLE)wParam, META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1) { - BOOL current = db_get_b((HANDLE)wParam, META_PROTO, "ForceDefault", 0); + if (db_get_dw((HCONTACT)wParam, META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1) { + BOOL current = db_get_b((HCONTACT)wParam, META_PROTO, "ForceDefault", 0); current = !current; - db_set_b((HANDLE)wParam, META_PROTO, "ForceDefault", (BYTE)current); + db_set_b((HCONTACT)wParam, META_PROTO, "ForceDefault", (BYTE)current); - db_set_dw((HANDLE)wParam, META_PROTO, "ForceSend", 0); + db_set_dw((HCONTACT)wParam, META_PROTO, "ForceSend", 0); if (current) - NotifyEventHooks(hEventForceSend, wParam, (LPARAM)Meta_GetContactHandle((HANDLE)wParam, db_get_dw((HANDLE)wParam, META_PROTO, "Default", -1))); + NotifyEventHooks(hEventForceSend, wParam, (LPARAM)Meta_GetContactHandle((HCONTACT)wParam, db_get_dw((HCONTACT)wParam, META_PROTO, "Default", -1))); else NotifyEventHooks(hEventUnforceSend, wParam, 0); } @@ -317,7 +317,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) WORD status; CLISTMENUITEM mi = { sizeof(mi) }; - if (db_get_dw((HANDLE)wParam, META_PROTO, META_ID,-1) != (DWORD)-1) { + if (db_get_dw((HCONTACT)wParam, META_PROTO, META_ID,-1) != (DWORD)-1) { // save the mouse pos in case they open a subcontact menu GetCursorPos(&menuMousePoint); @@ -333,14 +333,14 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) Menu_ModifyItem(hMenuDelete, &mi); //show subcontact menu items - int num_contacts = db_get_dw((HANDLE)wParam, META_PROTO, "NumContacts", 0); + int num_contacts = db_get_dw((HCONTACT)wParam, META_PROTO, "NumContacts", 0); for (int i = 0; i < MAX_CONTACTS; i++) { if (i >= num_contacts) { Menu_ShowItem(hMenuContact[i], false); continue; } - HANDLE hContact = Meta_GetContactHandle((HANDLE)wParam, i); + HCONTACT hContact = Meta_GetContactHandle((HCONTACT)wParam, i); char *szProto = GetContactProto(hContact); if ( !szProto) status = ID_STATUS_OFFLINE; @@ -351,7 +351,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) strcpy(buf, "Login"); strcat(buf, _itoa(i, idStr, 10)); - db_get((HANDLE)wParam, META_PROTO, buf, &dbv); + db_get((HCONTACT)wParam, META_PROTO, buf, &dbv); switch(dbv.type) { case DBVT_ASCIIZ: mir_snprintf(buf,512,"%s",dbv.pszVal); @@ -391,7 +391,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) // wParam = char *szProto // lParam = BOOL show char serviceFunc[256]; - mir_snprintf(serviceFunc, 256, "%s%s", GetContactProto( Meta_GetMostOnline((HANDLE)wParam)), PS_SEND_NUDGE); + mir_snprintf(serviceFunc, 256, "%s%s", GetContactProto( Meta_GetMostOnline((HCONTACT)wParam)), PS_SEND_NUDGE); CallService(MS_NUDGE_SHOWMENU, (WPARAM)META_PROTO, (LPARAM)ServiceExists(serviceFunc)); } else { // This is a simple contact @@ -403,7 +403,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) Menu_ShowItem(hMenuConvert, false); Menu_ShowItem(hMenuEdit, false); } - else if (db_get_dw((HANDLE)wParam, META_PROTO, META_LINK,(DWORD)-1)!=(DWORD)-1) { + else if (db_get_dw((HCONTACT)wParam, META_PROTO, META_LINK,(DWORD)-1)!=(DWORD)-1) { // The contact is affected to a metacontact. Menu_ShowItem(hMenuDefault, true); diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp index 2f5aad2654..f829412474 100755 --- a/plugins/MetaContacts/src/meta_services.cpp +++ b/plugins/MetaContacts/src/meta_services.cpp @@ -190,10 +190,10 @@ INT_PTR Meta_GetStatus(WPARAM wParam,LPARAM lParam) struct TFakeAckParams { - HANDLE hEvent; - HANDLE hContact; - LONG id; - char msg[512]; + HANDLE hEvent; + HCONTACT hContact; + LONG id; + char msg[512]; }; static DWORD CALLBACK sttFakeAckFail( LPVOID param ) @@ -202,7 +202,7 @@ static DWORD CALLBACK sttFakeAckFail( LPVOID param ) WaitForSingleObject( tParam->hEvent, INFINITE ); Sleep( 100 ); - ProtoBroadcastAck(META_PROTO, tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, ( HANDLE )tParam->id, (WPARAM)tParam->msg ); + ProtoBroadcastAck(META_PROTO, tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)tParam->id, (WPARAM)tParam->msg ); CloseHandle( tParam->hEvent ); mir_free(tParam); @@ -222,9 +222,9 @@ static DWORD CALLBACK sttFakeAckFail( LPVOID param ) INT_PTR MetaFilter_SendMessage(WPARAM wParam,LPARAM lParam) { CCSDATA *ccs = (CCSDATA*)lParam; - HANDLE hMeta; + HCONTACT hMeta; - if ((hMeta = (HANDLE)db_get_dw(ccs->hContact, META_PROTO, "Handle", 0)) == 0) + if ((hMeta = (HCONTACT)db_get_dw(ccs->hContact, META_PROTO, "Handle", 0)) == 0) return CallService(MS_PROTO_CHAINSEND, wParam, lParam); // Can't find the MetaID of the metacontact linked to // if subcontact sending, add db event to keep metacontact history correct @@ -261,7 +261,7 @@ INT_PTR MetaFilter_SendMessage(WPARAM wParam,LPARAM lParam) INT_PTR Meta_SendNudge(WPARAM wParam,LPARAM lParam) { - HANDLE hSubContact = Meta_GetMostOnline((HANDLE)wParam); + HCONTACT hSubContact = Meta_GetMostOnline((HCONTACT)wParam); return ProtoCallService(GetContactProto(hSubContact), PS_SEND_NUDGE, (WPARAM)hSubContact, lParam); } @@ -289,7 +289,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam) return CallService(MS_PROTO_CHAINSEND, wParam, lParam); } - HANDLE most_online = Meta_GetMostOnline(ccs->hContact); + HCONTACT most_online = Meta_GetMostOnline(ccs->hContact); if ( !most_online) { DWORD dwThreadId; @@ -359,10 +359,10 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) DBEVENTINFO dbei; CCSDATA *ccs = (CCSDATA*)lParam; PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam; - HANDLE hMeta; + HCONTACT hMeta; // Can't find the MetaID of the metacontact linked to this contact, let through the protocol chain - if ((hMeta = (HANDLE)db_get_dw(ccs->hContact, META_PROTO, "Handle", 0)) == 0) + if ((hMeta = (HCONTACT)db_get_dw(ccs->hContact, META_PROTO, "Handle", 0)) == 0) return CallService(MS_PROTO_CHAINRECV, wParam, (LPARAM)ccs); if (options.set_default_on_recv) { @@ -404,7 +404,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) // use the subcontact's protocol 'recv' service to add the meta's history (AIMOSCAR removes HTML here!) if possible char *proto = GetContactProto(ccs->hContact); if (proto) { - HANDLE hSub = ccs->hContact; + HCONTACT hSub = ccs->hContact; DWORD flags = pre->flags; ccs->hContact = hMeta; pre->flags |= (db_get_b(hMeta, META_PROTO, "WindowOpen", 0) ? 0 : PREF_CREATEREAD); @@ -437,7 +437,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) return CallService(MS_PROTO_CHAINRECV, wParam, (LPARAM)ccs); } - HANDLE hSub = ccs->hContact; + HCONTACT hSub = ccs->hContact; ccs->hContact = hMeta; // Forward to the associated MetaContact. CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)ccs); ccs->hContact = hSub; @@ -467,7 +467,7 @@ INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam) if (options.use_proto_recv) { // use the subcontact's protocol to add the db if possible (AIMOSCAR removes HTML here!) - HANDLE most_online = Meta_GetMostOnline(ccs->hContact); + HCONTACT most_online = Meta_GetMostOnline(ccs->hContact); if (char *subProto = GetContactProto(most_online)) if ( ProtoCallService(subProto, PSR_MESSAGE, wParam, lParam) != CALLSERVICE_NOTFOUND) return 0; @@ -503,9 +503,9 @@ information about the ACK. int Meta_HandleACK(WPARAM wParam, LPARAM lParam) { ACKDATA *ack = (ACKDATA*) lParam; - HANDLE hUser; + HCONTACT hUser; - if (ack->hContact == 0 || (hUser = (HANDLE)db_get_dw(ack->hContact, META_PROTO, "Handle",0)) == 0) + if (ack->hContact == 0 || (hUser = (HCONTACT)db_get_dw(ack->hContact, META_PROTO, "Handle",0)) == 0) return 0; // Can't find the MetaID, let through the protocol chain @@ -524,11 +524,10 @@ int Meta_HandleACK(WPARAM wParam, LPARAM lParam) // change the hContact in the avatar info struct, if it's the avatar we're using - else drop it if (ack->type == ACKTYPE_AVATAR) { if (ack->result == ACKRESULT_SUCCESS || ack->result == ACKRESULT_FAILED || ack->result == ACKRESULT_STATUS) { - HANDLE most_online; DBVARIANT dbv; // change avatar if the most online supporting avatars changes, or if we don't have one - most_online = Meta_GetMostOnlineSupporting(hUser, PFLAGNUM_4, PF4_AVATARS); + HCONTACT most_online = Meta_GetMostOnlineSupporting(hUser, PFLAGNUM_4, PF4_AVATARS); //if (AI.hContact == 0 || AI.hContact != most_online) { if (ack->hContact == 0 || ack->hContact != most_online) { return 0; @@ -572,7 +571,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) DBCONTACTWRITESETTING *dcws = (DBCONTACTWRITESETTING *)lParam; char buffer[512], szId[40]; int contact_number; - HANDLE hMeta, most_online; + HCONTACT hMeta, most_online; // hide metacontacts when groups disabled if (wParam == 0 @@ -589,7 +588,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) // import process has just been run...call startup routines... Meta_SetHandles(); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { int meta_id; if ((meta_id = db_get_dw(hContact, META_PROTO, META_ID,(DWORD)-1)) != (DWORD)-1) Meta_CopyData(hContact); @@ -602,22 +601,22 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) // from here on, we're just interested in contact settings if (wParam == 0) return 0; - if ((hMeta=(HANDLE)db_get_dw((HANDLE)wParam, META_PROTO, "Handle",0))!=0 && CallService(MS_DB_CONTACT_IS, (WPARAM)hMeta, 0)) // just to be safe + if ((hMeta=(HCONTACT)db_get_dw((HCONTACT)wParam, META_PROTO, "Handle",0))!=0 && CallService(MS_DB_CONTACT_IS, (WPARAM)hMeta, 0)) // just to be safe { // This contact is attached to a MetaContact. - contact_number = Meta_GetContactNumber((HANDLE)wParam); + contact_number = Meta_GetContactNumber((HCONTACT)wParam); if (contact_number == -1) return 0; // exit - db corruption if ( !meta_group_hack_disabled && !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "Group") && - Meta_IsEnabled() && db_get_b((HANDLE)wParam, META_PROTO, "Hidden", 0) == 0 && !Miranda_Terminated()) { + Meta_IsEnabled() && db_get_b((HCONTACT)wParam, META_PROTO, "Hidden", 0) == 0 && !Miranda_Terminated()) { if ((dcws->value.type == DBVT_ASCIIZ || dcws->value.type == DBVT_UTF8) && !Meta_IsHiddenGroup(dcws->value.pszVal)) { // subcontact group reassigned - copy to saved group - db_set((HANDLE)wParam, META_PROTO, "OldCListGroup", &dcws->value); - db_set_s((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP); + db_set((HCONTACT)wParam, META_PROTO, "OldCListGroup", &dcws->value); + db_set_s((HCONTACT)wParam, "CList", "Group", META_HIDDEN_GROUP); } else if (dcws->value.type == DBVT_DELETED) { - db_unset((HANDLE)wParam, META_PROTO, "OldCListGroup"); - db_set_s((HANDLE)wParam, "CList", "Group", META_HIDDEN_GROUP); + db_unset((HCONTACT)wParam, META_PROTO, "OldCListGroup"); + db_set_s((HCONTACT)wParam, "CList", "Group", META_HIDDEN_GROUP); } } else if ( !strcmp(dcws->szSetting, "IP")) { @@ -650,15 +649,13 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) } } else if ( !strcmp(dcws->szSetting, "Nick") && !dcws->value.type == DBVT_DELETED) { - HANDLE most_online; - // subcontact nick has changed - update metacontact strcpy(buffer, "Nick"); strcat(buffer, _itoa(contact_number, szId, 10)); db_set(hMeta, META_PROTO, buffer, &dcws->value); DBVARIANT dbv; - if (Mydb_get((HANDLE)wParam, "CList", "MyHandle", &dbv)) { + if (Mydb_get((HCONTACT)wParam, "CList", "MyHandle", &dbv)) { strcpy(buffer, "CListName"); strcat(buffer, _itoa(contact_number, szId, 10)); db_set(hMeta, META_PROTO, buffer, &dcws->value); @@ -666,7 +663,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) else db_free(&dbv); // copy nick to metacontact, if it's the most online - most_online = Meta_GetMostOnline(hMeta); + HCONTACT most_online = Meta_GetMostOnline(hMeta); Meta_CopyContactNick(hMeta, most_online); return 0; @@ -684,15 +681,13 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) db_set_dw(hMeta, META_PROTO, "LogonTS", 0); } else if ( !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "MyHandle")) { - HANDLE most_online; - if (dcws->value.type == DBVT_DELETED) { - char *proto = GetContactProto((HANDLE)wParam); + char *proto = GetContactProto((HCONTACT)wParam); strcpy(buffer, "CListName"); strcat(buffer, _itoa(contact_number, szId, 10)); DBVARIANT dbv; - if (proto && !Mydb_get((HANDLE)wParam, proto, "Nick", &dbv)) { + if (proto && !Mydb_get((HCONTACT)wParam, proto, "Nick", &dbv)) { db_set(hMeta, META_PROTO, buffer, &dbv); db_free(&dbv); } else { @@ -707,7 +702,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) } // copy nick to metacontact, if it's the most online - most_online = Meta_GetMostOnline(hMeta); + HCONTACT most_online = Meta_GetMostOnline(hMeta); Meta_CopyContactNick(hMeta, most_online); return 0; @@ -757,11 +752,11 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) Meta_CopyData(hMeta); } else if ( !meta_group_hack_disabled && !strcmp(dcws->szModule, "CList") && !strcmp(dcws->szSetting, "Hidden")) { - if ((dcws->value.type == DBVT_DELETED || db_get_b((HANDLE)wParam, "CList", "Hidden", 0) == 0) - && db_get_b((HANDLE)wParam, META_PROTO, "Hidden", 0) == 1) + if ((dcws->value.type == DBVT_DELETED || db_get_b((HCONTACT)wParam, "CList", "Hidden", 0) == 0) + && db_get_b((HCONTACT)wParam, META_PROTO, "Hidden", 0) == 1) { // a subcontact we hid (e.g. jabber) has been unhidden - hide it again :( - db_set_b((HANDLE)wParam, "CList", "Hidden", 1); + db_set_b((HCONTACT)wParam, "CList", "Hidden", 1); } } } @@ -772,21 +767,21 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) int Meta_ContactDeleted(WPARAM wParam, LPARAM lParam) { // is a subcontact - update meta contact - HANDLE hMeta = (HANDLE)db_get_dw((HANDLE)wParam, META_PROTO, "Handle", 0); + HCONTACT hMeta = (HCONTACT)db_get_dw((HCONTACT)wParam, META_PROTO, "Handle", 0); if (hMeta) { - Meta_RemoveContactNumber(hMeta, db_get_dw((HANDLE)wParam, META_PROTO, "ContactNumber", -1)); + Meta_RemoveContactNumber(hMeta, db_get_dw((HCONTACT)wParam, META_PROTO, "ContactNumber", -1)); NotifyEventHooks(hSubcontactsChanged, (WPARAM)hMeta, 0); return 0; } // not a subcontact - is it a metacontact? - int num_contacts = db_get_dw((HANDLE)wParam, META_PROTO, "NumContacts", 0); + int num_contacts = db_get_dw((HCONTACT)wParam, META_PROTO, "NumContacts", 0); if (num_contacts) NotifyEventHooks(hSubcontactsChanged, (WPARAM)wParam, 0); // remove & restore all subcontacts for (int i = 0; i < num_contacts; i++) { - HANDLE hContact = Meta_GetContactHandle((HANDLE)wParam, i); + HCONTACT hContact = Meta_GetContactHandle((HCONTACT)wParam, i); if (hContact && (HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0) == (HANDLE)wParam) { if (db_get_b(hContact, META_PROTO, "IsSubcontact", 0) == 1) db_unset(hContact, META_PROTO, "IsSubcontact"); @@ -812,13 +807,13 @@ int Meta_ContactDeleted(WPARAM wParam, LPARAM lParam) INT_PTR Meta_UserIsTyping(WPARAM wParam, LPARAM lParam) { // This is a simple contact, let through the stack of protocols - if (db_get_dw((HANDLE)wParam, META_PROTO, META_ID,(DWORD)-1) == (DWORD)-1) + if (db_get_dw((HCONTACT)wParam, META_PROTO, META_ID,(DWORD)-1) == (DWORD)-1) return 0; // forward to sending protocol, if supported - HANDLE most_online = Meta_GetMostOnline((HANDLE)wParam); - Meta_CopyContactNick((HANDLE)wParam, most_online); + HCONTACT most_online = Meta_GetMostOnline((HCONTACT)wParam); + Meta_CopyContactNick((HCONTACT)wParam, most_online); if ( !most_online) return 0; @@ -837,8 +832,8 @@ INT_PTR Meta_UserIsTyping(WPARAM wParam, LPARAM lParam) */ int Meta_ContactIsTyping(WPARAM wParam, LPARAM lParam) { - HANDLE hMeta; - if ((hMeta = (HANDLE)db_get_dw((HANDLE)wParam, META_PROTO, "Handle",0)) != 0 && Meta_IsEnabled()) { + HCONTACT hMeta; + if ((hMeta = (HCONTACT)db_get_dw((HCONTACT)wParam, META_PROTO, "Handle",0)) != 0 && Meta_IsEnabled()) { // This contact is attached to a MetaContact. if ( !options.subcontact_windows) { // we don't want clicking on the clist notification icon to open the metacontact message window // try to remove any clist events we added for subcontact @@ -860,12 +855,12 @@ int Meta_ContactIsTyping(WPARAM wParam, LPARAM lParam) int Meta_UserInfo(WPARAM wParam, LPARAM lParam) { - DWORD default_contact_number = db_get_dw((HANDLE)lParam, META_PROTO, "Default", (DWORD)-1); + DWORD default_contact_number = db_get_dw((HCONTACT)lParam, META_PROTO, "Default", (DWORD)-1); if (default_contact_number == -1) // not a meta contact return 0; - CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)Meta_GetContactHandle((HANDLE)lParam, default_contact_number), 0); + CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)Meta_GetContactHandle((HCONTACT)lParam, default_contact_number), 0); return 1; } @@ -873,11 +868,11 @@ int Meta_UserInfo(WPARAM wParam, LPARAM lParam) // let received messages through and add db history to metacontact, or vice versa int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam) { MessageWindowEventData *mwed = (MessageWindowEventData *)lParam; - HANDLE hMeta = 0; + HCONTACT hMeta = 0; message_window_api_enabled = TRUE; - if ((hMeta = (HANDLE)db_get_dw(mwed->hContact, META_PROTO, "Handle", 0)) != 0 + if ((hMeta = (HCONTACT)db_get_dw(mwed->hContact, META_PROTO, "Handle", 0)) != 0 || db_get_dw(mwed->hContact, META_PROTO, META_ID, (DWORD)-1) != (DWORD)-1) { // contact is subcontact of metacontact, or an actual metacontact - record whether window is open or closed @@ -912,11 +907,11 @@ int Meta_MessageWindowEvent(WPARAM wParam, LPARAM lParam) { int Meta_ClistDoubleClicked(WPARAM wParam, LPARAM lParam) { - if (db_get_dw((HANDLE)wParam, META_PROTO, "Default",(WORD)-1) == (WORD)-1) + if (db_get_dw((HCONTACT)wParam, META_PROTO, "Default",(WORD)-1) == (WORD)-1) return 0; // -1 indicates no specific capability but respect 'ForceDefault' - HANDLE most_online = Meta_GetMostOnlineSupporting((HANDLE)wParam, PFLAGNUM_1, -1); + HCONTACT most_online = Meta_GetMostOnlineSupporting((HCONTACT)wParam, PFLAGNUM_1, -1); if ( !most_online) return 0; @@ -949,7 +944,7 @@ int Meta_ClistDoubleClicked(WPARAM wParam, LPARAM lParam) INT_PTR Meta_ClistMessageEventClicked(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = ((CLISTEVENT *)lParam)->hContact; + HCONTACT hContact = ((CLISTEVENT *)lParam)->hContact; return Meta_ClistDoubleClicked((WPARAM)hContact, (LPARAM)((CLISTEVENT *)lParam)->hDbEvent); } @@ -1046,7 +1041,7 @@ int Meta_ModulesLoaded(WPARAM wParam, LPARAM lParam) // loop and copy data from subcontacts if (options.copydata) { int meta_id; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if ((meta_id = db_get_dw(hContact, META_PROTO, META_ID,(DWORD)-1))!=(DWORD)-1) Meta_CopyData(hContact); } @@ -1098,7 +1093,7 @@ static VOID CALLBACK sttMenuThread( PVOID param ) INT_PTR Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = Meta_GetContactHandle((HANDLE)wParam, (int)lParam); + HCONTACT hContact = Meta_GetContactHandle((HCONTACT)wParam, (int)lParam); if (options.menu_function == FT_MSG) { // open message window if protocol supports message sending or chat, else simulate double click @@ -1117,7 +1112,7 @@ INT_PTR Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam) if ((caps & PF1_IMSEND) || (caps & PF1_CHAT) || (proto && strcmp(proto, "IRC") == 0)) { // set default contact for sending/status and open message window - db_set_dw((HANDLE)wParam, META_PROTO, "Default", (DWORD)(int)lParam); + db_set_dw((HCONTACT)wParam, META_PROTO, "Default", (DWORD)(int)lParam); NotifyEventHooks(hEventDefaultChanged, wParam, (LPARAM)hContact); CallService(MS_MSG_SENDMESSAGE, wParam, 0); } else @@ -1157,12 +1152,7 @@ INT_PTR Meta_FileSend(WPARAM wParam, LPARAM lParam) } else { - HANDLE most_online; - //DBEVENTINFO dbei; - //char szServiceName[100]; - - most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILESEND); - + HCONTACT most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_FILESEND); if ( !most_online) { //PUShowMessage("no most online for ft", SM_NOTIFY); return 0; @@ -1189,10 +1179,7 @@ INT_PTR Meta_GetAwayMsg(WPARAM wParam, LPARAM lParam) } else { - HANDLE most_online; - - most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_MODEMSGRECV); - + HCONTACT most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_1, PF1_MODEMSGRECV); if ( !most_online) return 0; @@ -1221,8 +1208,8 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) { } else { - HANDLE hMeta = AI->hContact; - HANDLE hSub = Meta_GetMostOnlineSupporting(AI->hContact, PFLAGNUM_4, PF4_AVATARS); + HCONTACT hMeta = AI->hContact; + HCONTACT hSub = Meta_GetMostOnlineSupporting(AI->hContact, PFLAGNUM_4, PF4_AVATARS); if ( !hSub) return GAIR_NOAVATAR; @@ -1249,7 +1236,7 @@ INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam) if ((default_contact_number = db_get_dw(ccs->hContact, META_PROTO, "Default",(DWORD)-1)) == (DWORD)-1) return 0; - HANDLE most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_4, PF4_AVATARS); + HCONTACT most_online = Meta_GetMostOnlineSupporting(ccs->hContact, PFLAGNUM_4, PF4_AVATARS); if ( !most_online) return 0; @@ -1305,16 +1292,16 @@ int Meta_OptInit(WPARAM wParam, LPARAM lParam) int Meta_CallMostOnline(WPARAM wParam, LPARAM lParam) { - HANDLE most_online_im = Meta_GetMostOnline((HANDLE)wParam); + HCONTACT most_online_im = Meta_GetMostOnline((HCONTACT)wParam); // fix nick - Meta_CopyContactNick((HANDLE)wParam, most_online_im); + Meta_CopyContactNick((HCONTACT)wParam, most_online_im); // fix status - Meta_FixStatus((HANDLE)wParam); + Meta_FixStatus((HCONTACT)wParam); // copy all other data - Meta_CopyData((HANDLE) wParam); + Meta_CopyData((HCONTACT) wParam); return 0; } diff --git a/plugins/MetaContacts/src/meta_utils.cpp b/plugins/MetaContacts/src/meta_utils.cpp index 5a9130b585..cc2b70ce98 100644 --- a/plugins/MetaContacts/src/meta_utils.cpp +++ b/plugins/MetaContacts/src/meta_utils.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HANDLE invisiGroup; POINT menuMousePoint; -INT_PTR Mydb_get(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) +INT_PTR Mydb_get(HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { memset(dbv, 0, sizeof(DBVARIANT)); return db_get_s(hContact, szModule, szSetting, dbv, 0); @@ -86,7 +86,7 @@ int Meta_EqualDBV(DBVARIANT *dbv, DBVARIANT *id) { * @return a \c HANDLE to the specified contact or \c NULL if no contact has been found. */ -HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id) +HCONTACT Meta_GetHandle(const char *protocol, DBVARIANT *id) { char *field; DBVARIANT dbv; @@ -98,7 +98,7 @@ HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id) field = (char *)CallProtoService(protocol,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { // Scan the database and retrieve the field for each contact if ( !db_get(hContact, protocol, field, &dbv)) { if (dbv.type == id->type) { @@ -209,12 +209,12 @@ int Meta_SetNick(char *szProto) * * @return TRUE on success, FALSE otherwise */ -BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) +BOOL Meta_Assign(HCONTACT src, HCONTACT dest, BOOL set_as_default) { DWORD metaID, num_contacts; char buffer[512], szId[40]; WORD status; - HANDLE most_online; + HCONTACT most_online; if ((metaID = db_get_dw(dest, META_PROTO, META_ID,(DWORD)-1))==-1) { MessageBox(0, TranslateT("Could not get MetaContact ID"), TranslateT("Assignment error"), MB_OK | MB_ICONWARNING); @@ -377,7 +377,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) * Convenience method - get most online contact supporting messaging * */ -HANDLE Meta_GetMostOnline(HANDLE hMeta) { +HCONTACT Meta_GetMostOnline(HCONTACT hMeta) { return Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_1, PF1_IM); } /** Get the 'most online' contact for a meta contact (according to above order) which supports the specified @@ -388,9 +388,9 @@ HANDLE Meta_GetMostOnline(HANDLE hMeta) { * @return \c HANDLE to a contact */ -HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long capability) { +HCONTACT Meta_GetMostOnlineSupporting(HCONTACT hMeta, int pflagnum, unsigned long capability) { int most_online_status = ID_STATUS_OFFLINE; - HANDLE most_online_contact = NULL, hContact; + HCONTACT most_online_contact = NULL, hContact; int i, status, default_contact_number, num_contacts; unsigned long caps = 0; char *szProto, *most_online_proto; @@ -416,7 +416,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca return most_online_contact; // a subcontact is being temporarily 'forced' to do sending - if ((most_online_contact = (HANDLE)db_get_dw(hMeta, META_PROTO, "ForceSend", 0))) { + if ((most_online_contact = (HCONTACT)db_get_dw(hMeta, META_PROTO, "ForceSend", 0))) { caps = szProto ? CallProtoService(szProto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0; if (szProto && strcmp(szProto, "IRC") == 0) caps |= PF1_IM; if (szProto && (caps & capability) == capability && capability != 0) // capability is 0 when we're working out status @@ -477,7 +477,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca // no online contacts? if we're trying to message, use 'send offline' contact if (most_online_status == ID_STATUS_OFFLINE && capability == PF1_IM) { - HANDLE hOffline = Meta_GetContactHandle(hMeta, db_get_dw(hMeta, META_PROTO, "OfflineSend", (DWORD)-1)); + HCONTACT hOffline = Meta_GetContactHandle(hMeta, db_get_dw(hMeta, META_PROTO, "OfflineSend", (DWORD)-1)); if (hOffline) most_online_contact = hOffline; } @@ -485,7 +485,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca return most_online_contact; } -int Meta_GetContactNumber(HANDLE hContact) { +int Meta_GetContactNumber(HCONTACT hContact) { return db_get_dw(hContact, META_PROTO, "ContactNumber", -1); } @@ -509,12 +509,12 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) { } } - void copy_settings_array(HANDLE hMeta, char *module, const char *settings[], int num_settings) { + void copy_settings_array(HCONTACT hMeta, char *module, const char *settings[], int num_settings) { int num_contacts = db_get_dw(hMeta, META_PROTO, "NumContacts", (DWORD)-1), default_contact = db_get_dw(hMeta, META_PROTO, "Default", (DWORD)-1), most_online = Meta_GetContactNumber(Meta_GetMostOnline(hMeta)); - HANDLE hContact; + HCONTACT hContact; int i, j; char *used_mod; @@ -613,12 +613,12 @@ const char *MBirthdaySettings[3] = // szProto: // clist: "StatusMsg" -void CopyStatusData(HANDLE hMeta) +void CopyStatusData(HCONTACT hMeta) { int num_contacts = db_get_dw(hMeta, META_PROTO, "NumContacts", (DWORD)-1), most_online = Meta_GetContactNumber(Meta_GetMostOnline(hMeta)); WORD status = db_get_w(hMeta, META_PROTO, "Status", ID_STATUS_OFFLINE); - HANDLE hContact; + HCONTACT hContact; BOOL bDoneStatus = FALSE, bDoneXStatus = FALSE; for (int i = 0; i < num_contacts; i++) { @@ -667,7 +667,7 @@ void CopyStatusData(HANDLE hMeta) } } -void Meta_CopyData(HANDLE hMeta) +void Meta_CopyData(HCONTACT hMeta) { if (options.copydata) { CopyStatusData(hMeta); @@ -682,7 +682,7 @@ void Meta_CopyData(HANDLE hMeta) } -HANDLE Meta_GetContactHandle(HANDLE hMeta, int contact_number) +HCONTACT Meta_GetContactHandle(HCONTACT hMeta, int contact_number) { char buffer[512], buffer2[512]; int num_contacts = db_get_dw(hMeta, META_PROTO, "NumContacts", 0); @@ -691,13 +691,13 @@ HANDLE Meta_GetContactHandle(HANDLE hMeta, int contact_number) strcpy(buffer, "Handle"); strcat(buffer, _itoa(contact_number, buffer2, 10)); - return (HANDLE)db_get_dw(hMeta, META_PROTO, buffer, 0); + return (HCONTACT)db_get_dw(hMeta, META_PROTO, buffer, 0); } int Meta_SetHandles(void) { DWORD meta_id, num_contacts, contact_number; - HANDLE hContact2, hContact = db_find_first(), hNextContact; + HCONTACT hContact2, hContact = db_find_first(), hNextContact; char buffer[512]; TCHAR nick_buffer[128], buffer2[40]; BOOL found; @@ -875,7 +875,7 @@ int Meta_HideLinkedContacts(void) { char *szProto, *group_name; int hGroup = 1; - HANDLE hContact2, hContact = db_find_first(); + HCONTACT hContact2, hContact = db_find_first(); // ensure the hidden group does not exist (how this occurs i wonder but there have been reports!) // (sometimes protocol server side groups are to blame - msn and icq) @@ -890,7 +890,7 @@ int Meta_HideLinkedContacts(void) { hGroup++; } while(group_name); - while ( hContact != NULL ) { + while (hContact != NULL) { if ((meta_id = db_get_dw(hContact, META_PROTO, META_LINK,(DWORD)-1))!=(DWORD)-1) { // get contact number contact_number = db_get_dw(hContact, META_PROTO, "ContactNumber", (DWORD)-1); @@ -961,7 +961,7 @@ int Meta_HideLinkedContacts(void) { while ( hContact != NULL ) { if (db_get_dw(hContact, META_PROTO, META_ID,(DWORD)-1)!=(DWORD)-1) { // is a meta contact - HANDLE hMostOnline = Meta_GetMostOnline(hContact); // set nick + HCONTACT hMostOnline = Meta_GetMostOnline(hContact); // set nick Meta_CopyContactNick(hContact, hMostOnline); Meta_FixStatus(hContact); @@ -979,7 +979,7 @@ int Meta_HideLinkedContacts(void) { */ int Meta_UnhideLinkedContacts(void) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (db_get_dw(hContact, META_PROTO, META_LINK,(DWORD)-1)!=(DWORD)-1) { // has a link - unhide it // restore old group @@ -996,7 +996,7 @@ int Meta_HideMetaContacts(int hide) if (hide) Meta_SuppressStatus(FALSE); else Meta_SuppressStatus(options.suppress_status); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (db_get_dw(hContact, META_PROTO, META_ID,(DWORD)-1)!=(DWORD)-1) { // is a meta contact if (hide) @@ -1016,7 +1016,7 @@ int Meta_HideMetaContacts(int hide) return 0; } -void Meta_RestoreGroup(HANDLE hContact) { +void Meta_RestoreGroup(HCONTACT hContact) { if (meta_group_hack_disabled) return; // clist has called api function to disable group hack - yay! @@ -1057,7 +1057,7 @@ void Meta_RestoreGroup(HANDLE hContact) { else { // put back into metacontact's group DBVARIANT dbv; - HANDLE hMeta = (HANDLE)db_get_dw(hContact, META_PROTO, "Handle", 0); + HCONTACT hMeta = (HCONTACT)db_get_dw(hContact, META_PROTO, "Handle", 0); if (hMeta && !Mydb_get(hMeta, "CList", "Group", &dbv)) { db_set(hContact, "CList", "Group", &dbv); db_free(&dbv); @@ -1082,7 +1082,7 @@ void Meta_RestoreGroup(HANDLE hContact) { db_unset(hContact, "CList", "Hidden"); } -void Meta_SetGroup(HANDLE hContact) { +void Meta_SetGroup(HCONTACT hContact) { char *szProto, *uid; if (meta_group_hack_disabled) return; // clist has called api function to disable group hack - yay! @@ -1118,7 +1118,7 @@ void Meta_SetGroup(HANDLE hContact) { int Meta_SuppressStatus(BOOL suppress) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (db_get_dw(hContact, META_PROTO, META_LINK,(DWORD)-1)!=(DWORD)-1) { // is a subcontact if (suppress) @@ -1131,7 +1131,7 @@ int Meta_SuppressStatus(BOOL suppress) return 0; } -int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact) { +int Meta_CopyContactNick(HCONTACT hMeta, HCONTACT hContact) { DBVARIANT dbv, dbv_proto; char *szProto; @@ -1170,9 +1170,9 @@ int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact) { int Meta_SetAllNicks() { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (db_get_dw(hContact, META_PROTO, META_ID,(DWORD)-1)!=(DWORD)-1) { - HANDLE most_online = Meta_GetMostOnline(hContact); + HCONTACT most_online = Meta_GetMostOnline(hContact); Meta_CopyContactNick(hContact, most_online); Meta_FixStatus(hContact); Meta_CopyData(hContact); @@ -1190,10 +1190,10 @@ int Meta_IsHiddenGroup(const char *group_name) return 0; } -int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2) { +int Meta_SwapContacts(HCONTACT hMeta, DWORD contact_number1, DWORD contact_number2) { DBVARIANT dbv1, dbv2; - HANDLE hContact1 = Meta_GetContactHandle(hMeta, contact_number1), + HCONTACT hContact1 = Meta_GetContactHandle(hMeta, contact_number1), hContact2 = Meta_GetContactHandle(hMeta, contact_number2); char buff1[512], buff12[512], buff2[512], buff22[512]; BOOL ok1, ok2; @@ -1348,7 +1348,7 @@ INT_PTR CALLBACK DlgProcNull(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara } // function to copy history from one contact to another - courtesy JdGordon (thx) -void copyHistory(HANDLE hContactFrom,HANDLE hContactTo) +void copyHistory(HCONTACT hContactFrom, HCONTACT hContactTo) { HANDLE hDbEvent; DBEVENTINFO dbei; @@ -1409,8 +1409,9 @@ void copyHistory(HANDLE hContactFrom,HANDLE hContactTo) //mir_free(id); } -void Meta_FixStatus(HANDLE hMeta) { - HANDLE most_online = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_1, 0); +void Meta_FixStatus(HCONTACT hMeta) +{ + HCONTACT most_online = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_1, 0); if (most_online) { char *szProto = GetContactProto(most_online); if (szProto) { diff --git a/plugins/MetaContacts/src/metacontacts.h b/plugins/MetaContacts/src/metacontacts.h index a7fb25823c..637db357d5 100644 --- a/plugins/MetaContacts/src/metacontacts.h +++ b/plugins/MetaContacts/src/metacontacts.h @@ -63,7 +63,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // I can't think of a way around this - mental block -INT_PTR TranslateMenuFunc(HANDLE hContact, int i); +INT_PTR TranslateMenuFunc(HCONTACT hContact, int i); extern HGENMENU hMenuContact[MAX_CONTACTS]; extern HINSTANCE hInstance; @@ -78,7 +78,7 @@ extern int mcStatus; INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam); INT_PTR Meta_AddTo(WPARAM wParam,LPARAM lParam); INT_PTR Meta_Edit(WPARAM wParam,LPARAM lParam); -void Meta_RemoveContactNumber(HANDLE hMeta, int number); +void Meta_RemoveContactNumber(HCONTACT hMeta, int number); INT_PTR Meta_Delete(WPARAM wParam,LPARAM lParam); INT_PTR Meta_Default(WPARAM wParam,LPARAM lParam); INT_PTR Meta_ForceDefault(WPARAM wParam,LPARAM lParam); @@ -87,32 +87,32 @@ INT_PTR Meta_IsEnabled(); int Meta_EqualDBV(DBVARIANT *dbv, DBVARIANT *id); int Meta_ModifyMenu(WPARAM wParam,LPARAM lParam); -BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default); -HANDLE Meta_GetHandle(const char *protocol, DBVARIANT *id); +BOOL Meta_Assign(HCONTACT src, HCONTACT dest, BOOL set_as_default); +HCONTACT Meta_GetHandle(const char *protocol, DBVARIANT *id); int Meta_SetNick(char *proto); -HANDLE Meta_GetMostOnline(HANDLE hMeta); -HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long capability); +HCONTACT Meta_GetMostOnline(HCONTACT hMeta); +HCONTACT Meta_GetMostOnlineSupporting(HCONTACT hMeta, int pflagnum, unsigned long capability); int Meta_HideLinkedContacts(void); int Meta_SetHandles(void); int Meta_UnhideLinkedContacts(void); -int Meta_GetContactNumber(HANDLE hContact); -HANDLE Meta_GetContactHandle(HANDLE hMeta, int contact_number); -void Meta_RestoreGroup(HANDLE hContact); -void Meta_SetGroup(HANDLE hContact); +int Meta_GetContactNumber(HCONTACT hContact); +HCONTACT Meta_GetContactHandle(HCONTACT hMeta, int contact_number); +void Meta_RestoreGroup(HCONTACT hContact); +void Meta_SetGroup(HCONTACT hContact); int Meta_HideMetaContacts(int hide); int Meta_SuppressStatus(int suppress); -int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact); -void Meta_CopyData(HANDLE hMeta); +int Meta_CopyContactNick(HCONTACT hMeta, HCONTACT hContact); +void Meta_CopyData(HCONTACT hMeta); int Meta_SetAllNicks(); int Meta_IsHiddenGroup(const char *group_name); -int Meta_SwapContacts(HANDLE hMeta, DWORD contact_number1, DWORD contact_number2); +int Meta_SwapContacts(HCONTACT hMeta, DWORD contact_number1, DWORD contact_number2); // function to copy history from one contact to another - courtesy JdGordon with mods (thx) -void copyHistory(HANDLE hContactFrom,HANDLE hContactTo); +void copyHistory(HCONTACT hContactFrom, HCONTACT hContactTo); // inverse //void Meta_RemoveHistory(HANDLE hContactRemoveFrom, HANDLE hContactSource); -void Meta_FixStatus(HANDLE hMeta); +void Meta_FixStatus(HCONTACT hMeta); -char *Meta_GetUniqueIdentifier(HANDLE hContact, DWORD *pused); +char *Meta_GetUniqueIdentifier(HCONTACT hContact, DWORD *pused); INT_PTR Meta_GetCaps(WPARAM wParam,LPARAM lParam); INT_PTR Meta_GetName(WPARAM wParam,LPARAM lParam); @@ -187,7 +187,7 @@ INT_PTR MetaAPI_RemoveFromMeta(WPARAM wParam, LPARAM lParam); INT_PTR MetaAPI_DisableHiddenGroup(WPARAM wParam, LPARAM lParam); // extended db get/write setting functions, that handle unicode -INT_PTR Mydb_get(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); +INT_PTR Mydb_get(HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); // IcoLib support void InitIcons(void); diff --git a/plugins/MirFox/src/MirandaOptions.cpp b/plugins/MirFox/src/MirandaOptions.cpp index ea79b85297..ec6f20e952 100644 --- a/plugins/MirFox/src/MirandaOptions.cpp +++ b/plugins/MirFox/src/MirandaOptions.cpp @@ -169,7 +169,7 @@ static void setListContactIcons(HWND hwndList){ boost::ptr_list::iterator mirandaContactsIter; for (mirandaContactsIter = mirandaContactsPtr->begin(); mirandaContactsIter != mirandaContactsPtr->end(); mirandaContactsIter++){ - HANDLE hContact = mirandaContactsIter->contactHandle; + HCONTACT hContact = mirandaContactsIter->contactHandle; HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); if(hItem) { //if icon on 0th extracolumn is not set @@ -484,7 +484,7 @@ INT_PTR CALLBACK DlgProcOpts_Tab2(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case PSN_APPLY: { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)){ + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)){ HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC2_CONTACTS_LIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if(hItem) { diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index c2374ab166..2fefc5b8ec 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -181,7 +181,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ } logger->log_p(L"SMTC: mirandaSendModeFlag = [%d] bufSize = [%d]", mirandaSendModeFlag, bufSize); - HANDLE hProcess = sendMessageMiranda(args->targetHandle, mirandaSendModeFlag, msgBuffer); + HANDLE hProcess = sendMessageMiranda((HCONTACT)args->targetHandle, mirandaSendModeFlag, msgBuffer); logger->log_p(L"SMTC: hProcess = [" SCNuPTR L"]", hProcess); MIRFOXACKDATA* myMfAck = NULL; @@ -227,7 +227,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ if(myMfAck != NULL && myMfAck->result == ACKRESULT_SUCCESS){ - addMessageToDB(args->targetHandle, mirandaSendModeFlag, msgBuffer, bufSize, targetHandleSzProto); + addMessageToDB((HCONTACT)args->targetHandle, mirandaSendModeFlag, msgBuffer, bufSize, targetHandleSzProto); if (mode == MFENUM_SMM_ONLY_SEND){ @@ -347,12 +347,12 @@ int MirandaUtils::getMirandaSendModeFlag(char* targetHandleSzProto) } -HANDLE MirandaUtils::sendMessageMiranda(HANDLE hContact, int mirandaSendModeFlag, char* msgBuffer) +HANDLE MirandaUtils::sendMessageMiranda(HCONTACT hContact, int mirandaSendModeFlag, char* msgBuffer) { return (HANDLE)CallContactService(hContact, PSS_MESSAGE, (WPARAM)mirandaSendModeFlag, (LPARAM)msgBuffer); } -void MirandaUtils::addMessageToDB(HANDLE hContact, int mirandaSendModeFlag, char* msgBuffer, std::size_t bufSize, char* targetHandleSzProto) +void MirandaUtils::addMessageToDB(HCONTACT hContact, int mirandaSendModeFlag, char* msgBuffer, std::size_t bufSize, char* targetHandleSzProto) { DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(dbei); @@ -406,12 +406,12 @@ int MirandaUtils::on_hook_OpenMW(WPARAM wParam, LPARAM lParam) MessageWindowData mwd; mwd.cbSize = sizeof(MessageWindowData); - mwd.hContact = param->targetHandle; + mwd.hContact = (HCONTACT)param->targetHandle; mwd.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; MessageWindowInputData mwid; mwid.cbSize = sizeof(MessageWindowInputData); - mwid.hContact = param->targetHandle; + mwid.hContact = (HCONTACT)param->targetHandle; mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; delete param; @@ -581,7 +581,7 @@ void MirandaUtils::translateOldDBNames() { } //contacts "state" - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)){ + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)){ logger->log_p(L"TranslateOldDBNames: found CONTACT: [" SCNuPTR L"]", hContact); diff --git a/plugins/MirFox/src/MirandaUtils.h b/plugins/MirFox/src/MirandaUtils.h index b0a05fce6f..2c6e04afcc 100644 --- a/plugins/MirFox/src/MirandaUtils.h +++ b/plugins/MirFox/src/MirandaUtils.h @@ -80,9 +80,9 @@ private: int getMirandaSendModeFlag(char* targetHandleSzProto); - HANDLE sendMessageMiranda(HANDLE hContact, int mirandaSendModeFlag, char* msgBuffer); + HANDLE sendMessageMiranda(HCONTACT hContact, int mirandaSendModeFlag, char* msgBuffer); - void addMessageToDB(HANDLE hContact, int mirandaSendModeFlag, char* msgBuffer, std::size_t bufSize, char* targetHandleSzProto); + void addMessageToDB(HCONTACT hContact, int mirandaSendModeFlag, char* msgBuffer, std::size_t bufSize, char* targetHandleSzProto); void setStatusOnAccount(ActionThreadArgStruct* args); @@ -100,7 +100,7 @@ private: typedef struct { const char* szModule; - HANDLE hContact; + HCONTACT hContact; int result; const char* errorDesc; } MIRFOXACKDATA; diff --git a/plugins/MirFox/src/MirfoxData.cpp b/plugins/MirFox/src/MirfoxData.cpp index bef57abf04..ddb6ebdc8e 100644 --- a/plugins/MirFox/src/MirfoxData.cpp +++ b/plugins/MirFox/src/MirfoxData.cpp @@ -257,35 +257,26 @@ MirfoxData::getAccountDefaultState(MirandaAccount* account) int MirfoxData::getContactDefaultState(MirandaContact* contact) { - MFLogger* logger = MFLogger::getInstance(); - if (contact == NULL){ + if (contact == NULL) return 2; - } - if (contact->mirandaAccountPtr == NULL){ + if (contact->mirandaAccountPtr == NULL) return 2; - } - if (contact->mirandaAccountPtr->szProtoName == NULL){ + if (contact->mirandaAccountPtr->szProtoName == NULL) return 2; - } - if (!shouldProtoBeActiveByName(contact->mirandaAccountPtr->szProtoName)){ + if (!shouldProtoBeActiveByName(contact->mirandaAccountPtr->szProtoName)) return 2; - } - if (db_get_b(contact->contactHandle, "CList", "Hidden", 0) == 1 || - db_get_b(contact->contactHandle, "CList", "NotOnList", 0) == 1 ){ + if (db_get_b(contact->contactHandle, "CList", "Hidden", 0) == 1 || db_get_b(contact->contactHandle, "CList", "NotOnList", 0) == 1 ) return 2; - } return 1; - } - void MirfoxData::initializeMirandaAccounts() { @@ -364,7 +355,7 @@ void MirfoxData::initializeMirandaContacts() //get contects from miranda - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)){ + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)){ //add to list MirandaContact* mirandaContactItemPtr = new MirandaContact( hContact //handle to contact in miranda @@ -583,7 +574,7 @@ MirandaAccount::getObjectPtr() * class functions implementation */ -MirandaContact::MirandaContact(HANDLE contactHandleL) +MirandaContact::MirandaContact(HCONTACT contactHandleL) { contactState = MFENUM_MIRANDACONTACT_STATE_UNKNOWN; contactHandle = contactHandleL; diff --git a/plugins/MirFox/src/MirfoxData.h b/plugins/MirFox/src/MirfoxData.h index 3623fd2d1d..fe98ff31b4 100644 --- a/plugins/MirFox/src/MirfoxData.h +++ b/plugins/MirFox/src/MirfoxData.h @@ -256,11 +256,11 @@ class MirandaContact { public: - MirandaContact(HANDLE contactHandleL); + MirandaContact(HCONTACT contactHandleL); ~MirandaContact(void); MirandaContact* getObjectPtr(); - HANDLE contactHandle; //HANDLE to contact in miranda (unikalne) + HCONTACT contactHandle; //HANDLE to contact in miranda (unikalne) std::wstring contactNameW; //presented name MFENUM_MIRANDACONTACT_STATE contactState; //state in options MirandaAccount* mirandaAccountPtr; //account of hContact diff --git a/plugins/MirOTR/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/MirOTR/src/dbfilter.cpp index e3d992817a..443c009574 100644 --- a/plugins/MirOTR/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/MirOTR/src/dbfilter.cpp @@ -5,10 +5,10 @@ static CRITICAL_SECTION RemoveChainCS={0}, *lpRemoveChainCS = &RemoveChainCS; static UINT_PTR timerId = 0; struct DeleteEventNode { - DeleteEventNode *next; - time_t timestamp; - HANDLE hContact; - HANDLE hDbEvent; + DeleteEventNode *next; + time_t timestamp; + HCONTACT hContact; + HANDLE hDbEvent; }; struct DeleteEventHead { DeleteEventNode *first; @@ -45,7 +45,7 @@ VOID CALLBACK DeleteTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTi // add prefix to sent messages int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { if (!options.prefix_messages || !lParam) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBEVENTINFO *dbei = (DBEVENTINFO *)lParam; if ((dbei->eventType != EVENTTYPE_MESSAGE) || !(dbei->flags & DBEF_SENT) || (dbei->flags & DBEF_OTR_PREFIXED)) return 0; @@ -58,7 +58,7 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { return 0; if(g_metaproto && strcmp(proto, g_metaproto) == 0) { - hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); if (!hContact) return 0; proto = contact_get_proto(hContact); if (!proto ) return 0; @@ -74,9 +74,9 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { char *msg = (char *)dbei->pBlob; char *newmsg = 0; DWORD alloclen = 0; - DWORD msglen = strlen(msg); + DWORD msglen = (DWORD)strlen(msg); if (dbei->flags & DBEF_UTF) { - int prefixlen = strnlen(options.prefix, 64); + int prefixlen = (int)strnlen(options.prefix, 64); if (strncmp(msg, options.prefix, prefixlen) == 0) return 0; alloclen = (msglen+prefixlen+1)*sizeof(char); @@ -108,15 +108,15 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { // yes, unicode wchar_t* msgw = (wchar_t *)&msg[msglen]; wchar_t *prefixw = mir_utf8decodeW(options.prefix); - int prefixlenw = wcslen(prefixw); + int prefixlenw = (int)wcslen(prefixw); if (wcsncmp(msgw, prefixw, prefixlenw) == 0) { mir_free(prefixw); return 0; } - int msglenw = wcslen(msgw); + int msglenw = (int)wcslen(msgw); char *prefix = mir_utf8decodeA(options.prefix); - int prefixlen = strlen(prefix); + int prefixlen = (int)strlen(prefix); alloclen = (msglen+prefixlen+1)* sizeof(char) + (msglenw + prefixlenw +1) * sizeof(wchar_t); // get additional data @@ -141,7 +141,7 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { } else { char *prefix = mir_utf8decodeA(options.prefix); - int prefixlen = strlen(prefix); + int prefixlen = (int)strlen(prefix); if (strncmp(msg, prefix, prefixlen) == 0) { mir_free(prefix); return 0; @@ -183,16 +183,16 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { static char* prefixutf = mir_utf8encodeT(TranslateT(LANG_INLINE_PREFIX)); static char* prefix = Translate(LANG_INLINE_PREFIX); - static DWORD lenutf = strlen(prefixutf); - static DWORD len = strlen(prefix); + static DWORD lenutf = (DWORD)strlen(prefixutf); + static DWORD len = (DWORD)strlen(prefix); DBEVENTINFO info = { sizeof(info) }; info.cbBlob = lenutf*2; info.pBlob = (PBYTE)mir_alloc(info.cbBlob); if (!db_event_get((HANDLE)lParam, &info)) { if(info.eventType == EVENTTYPE_MESSAGE) { - HANDLE hContact = (HANDLE)wParam, hSub; - if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) + HCONTACT hContact = (HCONTACT)wParam, hSub; + if(options.bHaveMetaContacts && (hSub = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) hContact = hSub; ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact); @@ -223,7 +223,7 @@ int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) { return 0; } -void FinishSession(HANDLE hContact) { +void FinishSession(HCONTACT hContact) { if (!hContact) return; ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact); TrustLevel level = otr_context_get_trust(context); @@ -247,8 +247,8 @@ int WindowEvent(WPARAM wParam, LPARAM lParam) { if(mwd->uType != MSG_WINDOW_EVT_OPEN) return 0; - HANDLE hContact = mwd->hContact, hTemp; - if(options.bHaveMetaContacts && (hTemp = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) + HCONTACT hContact = mwd->hContact, hTemp; + if(options.bHaveMetaContacts && (hTemp = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) hContact = hTemp; if (!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)MODULENAME)) @@ -271,14 +271,14 @@ int StatusModeChange(WPARAM wParam, LPARAM lParam) { if(status != ID_STATUS_OFFLINE ) return 0; const char *proto = (char *)lParam; - HANDLE hContact; + HCONTACT hContact; lib_cs_lock(); ConnContext *context = otr_user_state->context_root; while(context) { if(context->msgstate == OTRL_MSGSTATE_ENCRYPTED && (proto == 0 || strcmp(proto, context->protocol) == 0)) { - hContact = context->app_data; + hContact = (HCONTACT)context->app_data; if(hContact) { otrl_message_disconnect(otr_user_state, &ops, hContact, context->accountname, context->protocol, context->username); @@ -296,7 +296,7 @@ int StatusModeChange(WPARAM wParam, LPARAM lParam) { int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; if (!lParam || strcmp(cws->szSetting, "Status") != 0) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; int status=0; switch (cws->value.type){ case DBVT_WORD: diff --git a/plugins/MirOTR/MirOTR/src/dialogs.cpp b/plugins/MirOTR/MirOTR/src/dialogs.cpp index 0f16292577..b248ec0102 100644 --- a/plugins/MirOTR/MirOTR/src/dialogs.cpp +++ b/plugins/MirOTR/MirOTR/src/dialogs.cpp @@ -33,8 +33,8 @@ INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM smp_for_contact[context->app_data].responder = data->responder; mir_free(data); - TCHAR title[512], *proto = mir_a2t(contact_get_proto((HANDLE)context->app_data)); - const TCHAR *name =contact_get_nameT((HANDLE)context->app_data); + TCHAR title[512], *proto = mir_a2t(contact_get_proto((HCONTACT)context->app_data)); + const TCHAR *name =contact_get_nameT((HCONTACT)context->app_data); mir_sntprintf(title, 512, TranslateT(LANG_SMP_PROGRESS_TITLE), name, proto); SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)title); mir_sntprintf(title, 512, TranslateT(LANG_SMP_PROGRESS_DESC), name, proto); @@ -168,15 +168,15 @@ INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA smp_for_contact[context->app_data].oldlevel = data->oldlevel; smp_for_contact[context->app_data].responder = data->responder; - TCHAR buff[512], *proto=mir_a2t(contact_get_proto(context->app_data)); - mir_sntprintf(buff, 512, TranslateT(LANG_SMP_VERIFY_TITLE), contact_get_nameT(context->app_data), proto); + TCHAR buff[512], *proto = mir_a2t(contact_get_proto((HCONTACT)context->app_data)); + mir_sntprintf(buff, 512, TranslateT(LANG_SMP_VERIFY_TITLE), contact_get_nameT((HCONTACT)context->app_data), proto); mir_free(proto); SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)buff); SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, buff); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)context); if (data->question) { - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_RESPOND_DESC), contact_get_nameT(context->app_data)); + mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_RESPOND_DESC), contact_get_nameT((HCONTACT)context->app_data)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -195,7 +195,7 @@ INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA mir_free(data->question); } else { - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPPASSWORD_RESPOND_DESC), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPPASSWORD_RESPOND_DESC), contact_get_nameT((HCONTACT)context->app_data)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -315,8 +315,8 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA return FALSE; } - TCHAR title[512], *proto = mir_a2t(contact_get_proto((HANDLE)context->app_data)); - mir_sntprintf(title, 512, TranslateT(LANG_SMP_VERIFY_TITLE), contact_get_nameT((HANDLE)context->app_data), proto); + TCHAR title[512], *proto = mir_a2t(contact_get_proto((HCONTACT)context->app_data)); + mir_sntprintf(title, 512, TranslateT(LANG_SMP_VERIFY_TITLE), contact_get_nameT((HCONTACT)context->app_data), proto); mir_free(proto); SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)title); SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, title); @@ -370,9 +370,9 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } TCHAR buff[1024]; if (!fp->trust || fp->trust[0] == '\0') - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT((HCONTACT)context->app_data)); else - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT((HCONTACT)context->app_data)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -408,7 +408,7 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (_tcsncmp(msg, TranslateT(LANG_SMPTYPE_QUESTION), 255)==0) { if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) { TCHAR msg[512]; - mir_sntprintf(msg, 512, TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(msg, 512, TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT((HCONTACT)context->app_data)); ShowError(msg); }else { int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, WM_GETTEXTLENGTH, 0, 0); @@ -432,7 +432,7 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA }else if (_tcsncmp(msg, TranslateT(LANG_SMPTYPE_PASSWORD), 255)==0) { if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) { TCHAR msg[512]; - mir_sntprintf(msg, 512, TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(msg, 512, TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT((HCONTACT)context->app_data)); ShowError(msg); }else { int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0); @@ -477,9 +477,9 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA GetDlgItemText(hwndDlg, IDC_CBO_SMP_CHOOSE, buff, 255); if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_QUESTION), 255)==0) { if (trusted) - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT((HCONTACT)context->app_data)); else - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT((HCONTACT)context->app_data)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -497,9 +497,9 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_HIDE); } else if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_PASSWORD), 255)==0) { if (trusted) - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPPASSWORD_VERIFIED_DESC), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPPASSWORD_VERIFIED_DESC), contact_get_nameT((HCONTACT)context->app_data)); else - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPPASSWORD_VERIFY_DESC), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPPASSWORD_VERIFY_DESC), contact_get_nameT((HCONTACT)context->app_data)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -517,9 +517,9 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_HIDE); } else if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_FINGERPRINT), 255)==0) { if (trusted) - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(buff, 512, TranslateT(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT((HCONTACT)context->app_data)); else - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_FPVERIFY_DESC), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(buff, 512, TranslateT(LANG_OTR_FPVERIFY_DESC), contact_get_nameT((HCONTACT)context->app_data)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -662,9 +662,9 @@ INT_PTR CALLBACK DlgProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM wParam, LPA } TCHAR buff[512]; if (!fp->trust || fp->trust[0] == '\0') - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_FPVERIFY_DESC), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(buff, 512, TranslateT(LANG_OTR_FPVERIFY_DESC), contact_get_nameT((HCONTACT)context->app_data)); else - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(buff, 512, TranslateT(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT((HCONTACT)context->app_data)); SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff); @@ -729,20 +729,20 @@ unsigned int CALLBACK verify_context_thread(void *param) otrl_context_set_trust(context->active_fingerprint, "verified"); otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename); lib_cs_unlock(); - mir_sntprintf(msg, 1024, TranslateT(LANG_FINGERPRINT_VERIFIED), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(msg, 1024, TranslateT(LANG_FINGERPRINT_VERIFIED), contact_get_nameT((HCONTACT)context->app_data)); msg[1023] = '\0'; - ShowMessage((HANDLE)context->app_data, msg); - SetEncryptionStatus(context->app_data, otr_context_get_trust(context)); + ShowMessage((HCONTACT)context->app_data, msg); + SetEncryptionStatus((HCONTACT)context->app_data, otr_context_get_trust(context)); break; case IDNO: lib_cs_lock(); otrl_context_set_trust(context->active_fingerprint, NULL); otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename); lib_cs_unlock(); - mir_sntprintf(msg, 1024, TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(msg, 1024, TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT((HCONTACT)context->app_data)); msg[1023] = '\0'; - ShowMessage((HANDLE)context->app_data, msg); - SetEncryptionStatus(context->app_data, otr_context_get_trust(context)); + ShowMessage((HCONTACT)context->app_data, msg); + SetEncryptionStatus((HCONTACT)context->app_data, otr_context_get_trust(context)); break; } } diff --git a/plugins/MirOTR/MirOTR/src/dllmain.cpp b/plugins/MirOTR/MirOTR/src/dllmain.cpp index e38f2ff076..1c275c4e92 100644 --- a/plugins/MirOTR/MirOTR/src/dllmain.cpp +++ b/plugins/MirOTR/MirOTR/src/dllmain.cpp @@ -88,7 +88,7 @@ extern "C" __declspec(dllexport) int Load(void) // remove us as a filter to all contacts - fix filter type problem if(db_get_b(0, MODULENAME, "FilterOrderFix", 0) != 2) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) CallService(MS_PROTO_REMOVEFROMCONTACT, (WPARAM)hContact, (LPARAM)MODULENAME); db_set_b(0, MODULENAME, "FilterOrderFix", 2); } diff --git a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp index f886cd14e6..78fd4bf165 100644 --- a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp @@ -49,9 +49,7 @@ static INT_PTR AddMirOTRMenuItem(WPARAM, LPARAM lParam) static INT_PTR BuildMirOTRMenu(WPARAM wParam, LPARAM) { - HANDLE hContact = ( HANDLE )wParam; - //NotifyEventHooks(hPreBuildMirOTRMenuEvent,(WPARAM)hMirOTR,0); - + HCONTACT hContact = (HCONTACT)wParam; ListParam param = { 0 }; param.MenuObjectHandle = hMirOTRMenuObject; @@ -89,10 +87,9 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam,LPARAM) if ( cmep == NULL ) //this is rootsection...build it return TRUE; - HANDLE hContact = (HANDLE)pcpp->wParam, hSub; - if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) { + HCONTACT hContact = (HCONTACT)pcpp->wParam, hSub; + if(options.bHaveMetaContacts && (hSub = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) hContact = hSub; - } TrustLevel level = ( TrustLevel )otr_context_get_trust(otrl_context_find_miranda(otr_user_state, hContact)); @@ -181,7 +178,7 @@ LRESULT CALLBACK PopupMenuWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM return DefWindowProc(hwnd, message, wParam, lParam); } -void ShowOTRMenu(HANDLE hContact, POINT pt){ +void ShowOTRMenu(HCONTACT hContact, POINT pt){ HMENU menu = (HMENU) CallService(MS_MIROTR_MENUBUILDMIROTR, (WPARAM)hContact, 0); SetWindowLongPtr(hDummyPaintWin, GWLP_USERDATA, (LONG_PTR)hContact); TrackPopupMenu(menu, 0, pt.x, pt.y, 0, hDummyPaintWin, 0); diff --git a/plugins/MirOTR/MirOTR/src/mirotrmenu.h b/plugins/MirOTR/MirOTR/src/mirotrmenu.h index fe070f0ba8..c92adab7fb 100644 --- a/plugins/MirOTR/MirOTR/src/mirotrmenu.h +++ b/plugins/MirOTR/MirOTR/src/mirotrmenu.h @@ -42,4 +42,4 @@ typedef struct { void InitMirOTRMenu(void); void UninitMirOTRMenu(void); -void ShowOTRMenu(HANDLE hContact, POINT pt); \ No newline at end of file +void ShowOTRMenu(HCONTACT hContact, POINT pt); diff --git a/plugins/MirOTR/MirOTR/src/options.cpp b/plugins/MirOTR/MirOTR/src/options.cpp index 04a985eccc..7ecb6051c7 100644 --- a/plugins/MirOTR/MirOTR/src/options.cpp +++ b/plugins/MirOTR/MirOTR/src/options.cpp @@ -156,10 +156,11 @@ void SaveOptions() { db_set_b(0, MODULENAME, "EndWindowClose", options.end_window_close ? 1 : 0); } -extern "C" void set_context_contact(void *data, ConnContext *context) { - HANDLE hContact = find_contact(context->username, context->protocol); - context->app_data = hContact; - } +extern "C" void set_context_contact(void *data, ConnContext *context) +{ + HCONTACT hContact = find_contact(context->username, context->protocol); + context->app_data = hContact; +} void ReadPrivkeyFiles() { DEBUGOUT_T("READ privkey"); @@ -556,7 +557,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM const char *proto; TCHAR *proto_t; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { proto = contact_get_proto(hContact); if(proto && db_get_b(hContact, proto, "ChatRoom", 0) == 0 && CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)MODULENAME) // ignore chatrooms && (g_metaproto == 0 || strcmp(proto, g_metaproto) != 0)) // and MetaContacts @@ -585,7 +586,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM switch ( LOWORD( wParam )) { case IDC_CMB_CONT_POLICY: { - HANDLE hContact = 0; + HCONTACT hContact = 0; int iUser = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS)); if (iUser == -1) break; int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_CONT_POLICY, CB_GETCURSEL, 0, 0); @@ -603,7 +604,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM lvi.iSubItem = 0; ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS), &lvi); ContactPolicyMap* cpm = (ContactPolicyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - hContact = (HANDLE)lvi.lParam; + hContact = (HCONTACT)lvi.lParam; (*cpm)[hContact].policy = policy; SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); }break; @@ -649,7 +650,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM lvi.iSubItem = 0; SendDlgItemMessage(hwndDlg, IDC_LV_CONT_CONTACTS, LVM_GETITEM, 0, (LPARAM)&lvi); - HANDLE hContact = (HANDLE)lvi.lParam; + HCONTACT hContact = (HCONTACT)lvi.lParam; ContactPolicyMap *cp = (ContactPolicyMap *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); TCHAR buff[50]; ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, buff, 50); @@ -742,7 +743,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w Fingerprint *fp; while (context) { if (context->app_data) { - user = (TCHAR*)contact_get_nameT((HANDLE)context->app_data); + user = (TCHAR*)contact_get_nameT((HCONTACT)context->app_data); if (user) { proto = mir_a2t(context->protocol); fp = context->fingerprint_root.next; @@ -818,7 +819,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w if (fp->context->active_fingerprint == fp) { TCHAR buff[1024], hash[45]; otrl_privkey_hash_to_humanT(hash, fp->fingerprint); - mir_sntprintf(buff, 1024, TranslateT(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT((HANDLE)fp->context->app_data)); + mir_sntprintf(buff, 1024, TranslateT(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT((HCONTACT)fp->context->app_data)); ShowError(buff); } else { FPModifyMap* fpm = (FPModifyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); @@ -847,7 +848,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w if (it->first->context->active_fingerprint == it->first) { TCHAR buff[1024], hash[45]; otrl_privkey_hash_to_humanT(hash, it->first->fingerprint); - mir_sntprintf(buff, 1024, TranslateT(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT((HANDLE)it->first->context->app_data)); + mir_sntprintf(buff, 1024, TranslateT(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT((HCONTACT)it->first->context->app_data)); ShowError(buff); } else { otrl_context_forget_fingerprint(it->first, 1); diff --git a/plugins/MirOTR/MirOTR/src/options.h b/plugins/MirOTR/MirOTR/src/options.h index 7625eef247..a2c39a5e93 100644 --- a/plugins/MirOTR/MirOTR/src/options.h +++ b/plugins/MirOTR/MirOTR/src/options.h @@ -51,7 +51,7 @@ struct CONTACT_DATA { OtrlPolicy policy; int htmlconv; }; -typedef std::map ContactPolicyMap; +typedef std::map ContactPolicyMap; typedef enum {FPM_VERIFY, FPM_NOTRUST, FPM_DELETE } FPModify; typedef std::map FPModifyMap; diff --git a/plugins/MirOTR/MirOTR/src/otr.cpp b/plugins/MirOTR/MirOTR/src/otr.cpp index e22f7adb18..dfc22f5e70 100644 --- a/plugins/MirOTR/MirOTR/src/otr.cpp +++ b/plugins/MirOTR/MirOTR/src/otr.cpp @@ -76,7 +76,7 @@ extern "C" { /* Return the OTR policy for the given context. */ OtrlPolicy otr_gui_policy(void *opdata, ConnContext *context) { DEBUGOUT_T("OTR_GUI_POLICY") - HANDLE hContact = (HANDLE)opdata; + HCONTACT hContact = (HCONTACT)opdata; DWORD pol; if(hContact) { pol = db_get_dw(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY); @@ -110,7 +110,7 @@ extern "C" { //DWORD tid; //CloseHandle(CreateThread(0, 0, newKeyThread, (VOID *)nkd, 0, &tid)); //QueueUserAPC(newKeyAPC, Global::mainThread, (DWORD)nkd); - if (opdata) protocol = contact_get_proto((HANDLE)opdata); + if (opdata) protocol = contact_get_proto((HCONTACT)opdata); if (!protocol) return; DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GENKEYNOTIFY), 0, GenKeyDlgFunc, (LPARAM)protocol ); @@ -124,7 +124,7 @@ extern "C" { * logged in" errors if you're wrong. */ int otr_gui_is_logged_in(void *opdata, const char *accountname, const char *protocol, const char *recipient) { DEBUGOUT_T("OTR_GUI_IS_LOGGED_IN") - HANDLE hContact = (HANDLE)opdata; + HCONTACT hContact = (HCONTACT)opdata; if(hContact) { WORD status = db_get_w(hContact, contact_get_proto(hContact), "Status", ID_STATUS_OFFLINE); if(status == ID_STATUS_OFFLINE) return 0; @@ -139,7 +139,7 @@ extern "C" { void otr_gui_inject_message(void *opdata, const char *accountname, const char *protocol, const char *recipient, const char *message) { DEBUGOUT_T("OTR_GUI_INJECT_MESSAGE") //MessageBox(0, message, "OTR Inject", MB_OK); - HANDLE hContact = (HANDLE)opdata; + HCONTACT hContact = (HCONTACT)opdata; if(protocol && db_get_w(hContact, protocol, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) CallContactService(hContact, PSS_MESSAGE, PREF_UTF|PREF_BYPASS_OTR, (LPARAM)message); @@ -149,7 +149,7 @@ extern "C" { * protocol / username conversation. */ void otr_gui_notify(void *opdata, OtrlNotifyLevel level, const char *accountname, const char *protocol, const char *username, const char *title, const char *primary, const char *secondary) { DEBUGOUT_T("OTR_GUI_NOTIFY") - const TCHAR* uname = contact_get_nameT((HANDLE)opdata); + const TCHAR* uname = contact_get_nameT((HCONTACT)opdata); TCHAR* title_t = mir_utf8decodeT(title); TCHAR *notify = TranslateT(LANG_OTR_NOTIFY); @@ -180,11 +180,11 @@ extern "C" { int otr_gui_display_otr_message(void *opdata, const char *accountname, const char *protocol, const char *username, const char *msg) { DEBUGOUT_T("OTR_GUI_DISPLAY_OTR_MESSAGE") if(options.msg_inline) - ShowMessageInlineUtf((HANDLE)opdata, Translate(msg)); + ShowMessageInlineUtf((HCONTACT)opdata, Translate(msg)); if(options.msg_popup) { TCHAR buff[512]; TCHAR* proto = mir_a2t(protocol); - mir_sntprintf(buff, 512, TranslateT(LANG_OTR_USERMESSAGE), contact_get_nameT((HANDLE)opdata), proto); + mir_sntprintf(buff, 512, TranslateT(LANG_OTR_USERMESSAGE), contact_get_nameT((HCONTACT)opdata), proto); mir_free(proto); TCHAR *msg_t = mir_utf8decodeT(msg); ShowPopup(buff, TranslateTS(msg_t), 0); @@ -237,18 +237,18 @@ extern "C" { DEBUGOUT_T("OTR_GUI_GONE_SECURE") TrustLevel trusted = otr_context_get_trust(context); // opdata is hContact - SetEncryptionStatus((HANDLE)opdata, trusted); + SetEncryptionStatus((HCONTACT)opdata, trusted); TCHAR buff[1024]; if(trusted == TRUST_PRIVATE) { - mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_START_OTR), contact_get_nameT((HANDLE)opdata)); + mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_START_OTR), contact_get_nameT((HCONTACT)opdata)); } else if (trusted == TRUST_UNVERIFIED) { if (options.autoshow_verify) SMPInitDialog(context); //VerifyContextDialog(context); - mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_START_OTR_VERIFY), contact_get_nameT((HANDLE)opdata)); + mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_START_OTR_VERIFY), contact_get_nameT((HCONTACT)opdata)); } else { // should never happen - mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT((HANDLE)opdata)); + mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT((HCONTACT)opdata)); } // opdata is hContact - ShowMessage((HANDLE)opdata, buff); + ShowMessage((HCONTACT)opdata, buff); } @@ -256,14 +256,14 @@ extern "C" { void otr_gui_gone_insecure(void *opdata, ConnContext *context) { DEBUGOUT_T("OTR_GUI_GONE_INSECURE") TCHAR buff[512]; - mir_sntprintf(buff, 512, TranslateT(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT((HANDLE)opdata)); + mir_sntprintf(buff, 512, TranslateT(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT((HCONTACT)opdata)); //MessageBox(0, buff, Translate("OTR Information"), MB_OK); if (!Miranda_Terminated()) { - ShowMessage((HANDLE)opdata, buff); + ShowMessage((HCONTACT)opdata, buff); } // opdata is hContact - SetEncryptionStatus((HANDLE)opdata, otr_context_get_trust(context)); + SetEncryptionStatus((HCONTACT)opdata, otr_context_get_trust(context)); } /* We have completed an authentication, using the D-H keys we @@ -271,36 +271,36 @@ extern "C" { void otr_gui_still_secure(void *opdata, ConnContext *context, int is_reply) { DEBUGOUT_T("OTR_GUI_STILL_SECURE") TrustLevel trusted = otr_context_get_trust(context); - SetEncryptionStatus((HANDLE)opdata, trusted); + SetEncryptionStatus((HCONTACT)opdata, trusted); TCHAR buff[1024]; if (!is_reply) { if(trusted == TRUST_PRIVATE) { - mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_CONTINUE_OTR), contact_get_nameT((HANDLE)opdata)); + mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_CONTINUE_OTR), contact_get_nameT((HCONTACT)opdata)); } else if (trusted == TRUST_UNVERIFIED) { if (options.autoshow_verify) SMPInitDialog(context); //VerifyContextDialog(context); - mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_CONTINUE_OTR_VERIFY), contact_get_nameT((HANDLE)opdata)); + mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_CONTINUE_OTR_VERIFY), contact_get_nameT((HCONTACT)opdata)); } else { // should never happen - mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT((HANDLE)opdata)); + mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT((HCONTACT)opdata)); } // opdata is hContact - ShowMessage((HANDLE)opdata, buff); + ShowMessage((HCONTACT)opdata, buff); } else { if(trusted == TRUST_PRIVATE) { - mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_HAS_CONTINUE_OTR), contact_get_nameT((HANDLE)opdata)); + mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_HAS_CONTINUE_OTR), contact_get_nameT((HCONTACT)opdata)); } else if (trusted == TRUST_UNVERIFIED) { - mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_HAS_CONTINUE_OTR_VERIFY), contact_get_nameT((HANDLE)opdata)); + mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_HAS_CONTINUE_OTR_VERIFY), contact_get_nameT((HCONTACT)opdata)); } else { // should never happen - mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT((HANDLE)opdata)); + mir_sntprintf(buff, 1024, TranslateT(LANG_SESSION_NOT_STARTED_OTR), contact_get_nameT((HCONTACT)opdata)); } } - SetEncryptionStatus((HANDLE)opdata, trusted); + SetEncryptionStatus((HCONTACT)opdata, trusted); } /* Log a message. The passed message will end in "\n". */ void otr_gui_log_message(void *opdata, const char *message) { //MessageBox(0, message, Translate("OTR Log Message"), MB_OK); - //ShowMessageInline((HANDLE)opdata, message); + //ShowMessageInline((HCONTACT)opdata, message); #ifdef _DEBUG char* msg = strcpy((char*)mir_alloc(strlen(message)+15), "OTR message: "); strcat(msg, message); @@ -314,7 +314,7 @@ extern "C" { if (context && context->protocol) proto = context->protocol; else - proto = contact_get_proto(opdata); + proto = contact_get_proto((HCONTACT)opdata); // ugly wokaround for ICQ. ICQ protocol reports more than 7k, but in SMP this is too long. // possibly ICQ doesn't allow single words without spaces to become longer than ~2340? if (strcmp("ICQ", proto)==0 || strncmp("ICQ_", proto, 4)==0) diff --git a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp index 9a7e4a7488..762ee5adf2 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_menu.cpp @@ -5,7 +5,7 @@ static HGENMENU hStopItem, hStartItem; //////////////////////////////// ///////// Menu Services //////// /////////////////////////////// -int StartOTR(HANDLE hContact) { +int StartOTR(HCONTACT hContact) { const char *proto = contact_get_proto(hContact); if (!proto) return 1; // error @@ -24,8 +24,8 @@ int StartOTR(HANDLE hContact) { } INT_PTR SVC_StartOTR(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam, hSub; - if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) { + HCONTACT hContact = (HCONTACT)wParam, hSub; + if(options.bHaveMetaContacts && (hSub = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) { hContact = hSub; } @@ -47,8 +47,8 @@ INT_PTR SVC_StartOTR(WPARAM wParam, LPARAM lParam) { } INT_PTR SVC_RefreshOTR(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam, hSub; - if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) { + HCONTACT hContact = (HCONTACT)wParam, hSub; + if(options.bHaveMetaContacts && (hSub = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) { hContact = hSub; } @@ -68,11 +68,12 @@ INT_PTR SVC_RefreshOTR(WPARAM wParam, LPARAM lParam) { return 0; } -int otr_disconnect_contact(HANDLE hContact) { - HANDLE hSub; - if(ServiceExists(MS_MC_GETMOSTONLINECONTACT) && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) { + +int otr_disconnect_contact(HCONTACT hContact) +{ + HCONTACT hSub; + if(ServiceExists(MS_MC_GETMOSTONLINECONTACT) && (hSub = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) hContact = hSub; - } const char *proto = contact_get_proto(hContact); if (!proto) return 1; // error @@ -86,8 +87,9 @@ int otr_disconnect_contact(HANDLE hContact) { return 0; } -INT_PTR SVC_StopOTR(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; +INT_PTR SVC_StopOTR(WPARAM wParam, LPARAM lParam) +{ + HCONTACT hContact = (HCONTACT)wParam; // prevent this filter from acting on injeceted messages for metas, when they are passed though the subcontact's proto send chain if (otr_disconnect_contact(hContact)) return 0; @@ -102,11 +104,11 @@ INT_PTR SVC_StopOTR(WPARAM wParam, LPARAM lParam) { } INT_PTR SVC_VerifyOTR(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam, hSub; - if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) { - hContact = hSub; - } - ConnContext *context = otrl_context_find_miranda(otr_user_state, (HANDLE)wParam); + HCONTACT hContact = (HCONTACT)wParam, hSub; + if(options.bHaveMetaContacts && (hSub = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) + hContact = hSub; + + ConnContext *context = otrl_context_find_miranda(otr_user_state, (HCONTACT)wParam); if (!context) return 1; //VerifyContextDialog(context); SMPInitDialog(context); @@ -114,7 +116,7 @@ INT_PTR SVC_VerifyOTR(WPARAM wParam, LPARAM lParam) { } INT_PTR SVC_ToggleHTMLOTR(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (db_get_b(hContact, MODULENAME, "HTMLConv", 0)) db_set_b(hContact, MODULENAME, "HTMLConv", 0); else @@ -152,7 +154,7 @@ void InitMenu() int SVC_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_TCHAR; @@ -169,7 +171,7 @@ hide_all: if(proto && g_metaproto && strcmp(proto, g_metaproto) == 0) { // make menu act as per most online subcontact - hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); if (!hContact) goto hide_all; proto = contact_get_proto(hContact); diff --git a/plugins/MirOTR/MirOTR/src/svcs_proto.cpp b/plugins/MirOTR/MirOTR/src/svcs_proto.cpp index 2f814087e2..a9841f3e6d 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_proto.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_proto.cpp @@ -43,7 +43,7 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ } char *tmpencode = NULL; - ConnContext *context = otrl_context_find_miranda(otr_user_state, (void*)ccs->hContact); + ConnContext *context = otrl_context_find_miranda(otr_user_state, ccs->hContact); if (db_get_b(ccs->hContact, MODULENAME, "HTMLConv", 0) && otr_context_get_trust(context) >= TRUST_UNVERIFIED) { char *tmpencode = encode_html_entities_utf8(oldmessage_utf); if (tmpencode != NULL) { @@ -196,7 +196,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){ TCHAR buff[256]; mir_sntprintf(buff, 256, TranslateT(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT(ccs->hContact)); //MessageBox(0, buff, Translate("OTR Information"), MB_OK); - ShowMessage((HANDLE)ccs->hContact, buff); + ShowMessage(ccs->hContact, buff); //if(options.timeout_finished) ResetFinishedTimer(); } diff --git a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp index 7f7987b7b4..6c8f36e85e 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp @@ -5,7 +5,7 @@ BBButton OTRButton; int SVC_IconPressed(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; StatusIconClickData *sicd = (StatusIconClickData *)lParam; if(sicd->cbSize < (int)sizeof(StatusIconClickData)) return 0; @@ -21,7 +21,7 @@ int SVC_IconPressed(WPARAM wParam, LPARAM lParam) } // set SRMM icon status, if applicable -void SetEncryptionStatus(HANDLE hContact, TrustLevel level) +void SetEncryptionStatus(HCONTACT hContact, TrustLevel level) { char *proto = GetContactProto(hContact); bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0)); @@ -71,8 +71,8 @@ void SetEncryptionStatus(HANDLE hContact, TrustLevel level) db_set_dw(hContact, MODULENAME, "TrustLevel", level); if (!chat_room && options.bHaveMetaContacts) { - HANDLE hMeta = (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); - HANDLE hMostOnline = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMeta, 0); + HCONTACT hMeta = (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); + HCONTACT hMostOnline = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hMeta, 0); if(hMeta && hContact == hMostOnline) SetEncryptionStatus(hMeta, level); else if(hMeta) { @@ -95,7 +95,7 @@ int SVC_ButtonsBarPressed(WPARAM w, LPARAM l) { CustomButtonClickData* cbcd = (CustomButtonClickData *)l; if (cbcd->cbSize == (int)sizeof(CustomButtonClickData) && cbcd->dwButtonId == 0 && strcmp(cbcd->pszModule, MODULENAME)==0) { - HANDLE hContact = (HANDLE)w; + HCONTACT hContact = (HCONTACT)w; char *proto = GetContactProto(hContact); if(proto && db_get_b(hContact, proto, "ChatRoom", 0)) diff --git a/plugins/MirOTR/MirOTR/src/svcs_srmm.h b/plugins/MirOTR/MirOTR/src/svcs_srmm.h index 4bc204656d..7c8842edc3 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_srmm.h +++ b/plugins/MirOTR/MirOTR/src/svcs_srmm.h @@ -2,6 +2,6 @@ int WindowEvent(WPARAM wParam, LPARAM lParam); int SVC_IconPressed(WPARAM wParam, LPARAM lParam); -void SetEncryptionStatus(HANDLE hContact, TrustLevel level); +void SetEncryptionStatus(HCONTACT hContact, TrustLevel level); void InitSRMM(); void DeinitSRMM(); \ No newline at end of file diff --git a/plugins/MirOTR/MirOTR/src/utils.cpp b/plugins/MirOTR/MirOTR/src/utils.cpp index d6daabb294..3142c0852e 100644 --- a/plugins/MirOTR/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/MirOTR/src/utils.cpp @@ -2,23 +2,29 @@ CRITICAL_SECTION lib_cs; -void InitUtils() { +void InitUtils() +{ InitializeCriticalSection(&lib_cs); } -void DeinitUtils() { + +void DeinitUtils() +{ DeleteCriticalSection(&lib_cs); } -void lib_cs_lock() { +void lib_cs_lock() +{ EnterCriticalSection(&lib_cs); } -void lib_cs_unlock() { +void lib_cs_unlock() +{ LeaveCriticalSection(&lib_cs); } -HANDLE find_contact(const char* userid, const char* protocol) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { +HCONTACT find_contact(const char* userid, const char* protocol) +{ + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { const char *proto = contact_get_proto(hContact); if(proto && strcmp(proto, protocol) == 0) { char *name = contact_get_id(hContact); @@ -38,7 +44,7 @@ HANDLE find_contact(const char* userid, const char* protocol) { * context if one does not currently exist. In that event, call * add_app_data(data, context) so that app_data and app_data_free can be * filled in by the application, and set *addedp to 1. */ -ConnContext * otrl_context_find_miranda(OtrlUserState us, HANDLE hContact) +ConnContext * otrl_context_find_miranda(OtrlUserState us, HCONTACT hContact) { ConnContext ** curp; if (!hContact) return NULL; @@ -78,10 +84,10 @@ void VerifyFingerprint(ConnContext *context, bool verify) { void VerifyFingerprintMessage(ConnContext *context, bool verify) { TCHAR msg[1024]; - mir_sntprintf(msg, 1024, (verify)?TranslateT(LANG_FINGERPRINT_VERIFIED):TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT((HANDLE)context->app_data)); + mir_sntprintf(msg, 1024, (verify)?TranslateT(LANG_FINGERPRINT_VERIFIED):TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT((HCONTACT)context->app_data)); msg[1023] = '\0'; - ShowMessage((HANDLE)context->app_data, msg); - SetEncryptionStatus(context->app_data, otr_context_get_trust(context)); + ShowMessage((HCONTACT)context->app_data, msg); + SetEncryptionStatus((HCONTACT)context->app_data, otr_context_get_trust(context)); } /* Convert a 20-byte hash value to a 45-byte human-readable value */ @@ -102,7 +108,7 @@ void otrl_privkey_hash_to_humanT(TCHAR human[45], const unsigned char hash[20]) *p = '\0'; } -char* contact_get_id(HANDLE hContact, bool bNameOnError) { +char* contact_get_id(HCONTACT hContact, bool bNameOnError) { char* pszUniqueID = NULL; CONTACTINFO ci; ZeroMemory(&ci, sizeof(ci)); @@ -135,21 +141,21 @@ char* contact_get_id(HANDLE hContact, bool bNameOnError) { return pszUniqueID; } -__inline const TCHAR* contact_get_nameT(HANDLE hContact) { +__inline const TCHAR* contact_get_nameT(HCONTACT hContact) { return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); } -__inline const char* contact_get_proto(HANDLE hContact) { +__inline const char* contact_get_proto(HCONTACT hContact) { char *uproto = GetContactProto(hContact); return uproto; } -__inline const char* contact_get_account(HANDLE hContact) { +__inline const char* contact_get_account(HCONTACT hContact) { char *uacc = (char *)CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM)hContact, 0); return uacc; } -void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const HANDLE hContact) { +void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const HCONTACT hContact) { if(CallService(MS_SYSTEM_TERMINATED, 0, 0)) return; if ( !options.bHavePopups) { @@ -157,7 +163,7 @@ void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const HANDLE mir_sntprintf(title, SIZEOF(title), _T("%s Message"), _T(MODULENAME)); if(line1 && line2) { - int size = _tcslen(line1) + _tcslen(line2) + 3; + int size = int(_tcslen(line1) + _tcslen(line2) + 3); TCHAR *message = new TCHAR[size]; // newline and null terminator mir_sntprintf(message, size, _T("%s\r\n%s"), line1, line2); MessageBox( NULL, message, title, MB_OK | MB_ICONINFORMATION ); @@ -214,7 +220,7 @@ void ShowWarning(TCHAR *msg) { switch(disp) { case ED_POP: { - int size = _tcslen(msg) + 515; + int size = int(_tcslen(msg) + 515); message = new TCHAR[size]; // newline and null terminator mir_sntprintf(message, size, _T("%s\r\n%s"), buffer, msg); PUShowMessageT(message, SM_WARNING); @@ -261,7 +267,7 @@ void ShowError(TCHAR *msg) { switch(disp) { case ED_POP: { - int size = _tcslen(msg) + 515; + int size = int(_tcslen(msg) + 515); message = new TCHAR[size]; // newline and null terminator mir_sntprintf(message, size, _T("%s\r\n%s"), buffer, msg); PUShowMessageT(message, SM_WARNING); @@ -291,7 +297,7 @@ void ShowError(TCHAR *msg) { } -void ShowPopupUtf(const char* line1, const char* line2, int timeout, const HANDLE hContact) { +void ShowPopupUtf(const char* line1, const char* line2, int timeout, const HCONTACT hContact) { TCHAR* l1 = (line1) ? mir_utf8decodeT(line1) : NULL; TCHAR* l2 = (line2) ? mir_utf8decodeT(line2) : NULL; ShowPopup(l1, l2, timeout, hContact); @@ -310,7 +316,7 @@ void ShowErrorUtf(char* msg) { if (m) mir_free(m); } -void ShowMessageInline(const HANDLE hContact, const TCHAR *msg) { +void ShowMessageInline(const HCONTACT hContact, const TCHAR *msg) { TCHAR buff[1024]; mir_sntprintf(buff, 1024, _T("%s%s"), TranslateT(LANG_INLINE_PREFIX), msg); @@ -324,7 +330,7 @@ void ShowMessageInline(const HANDLE hContact, const TCHAR *msg) { mir_free(utf); } -void ShowMessageInlineUtf(const HANDLE hContact, const char *msg) { +void ShowMessageInlineUtf(const HCONTACT hContact, const char *msg) { char buff[1024]; mir_snprintf(buff, 1024, "%s%s", Translate(LANG_INLINE_PREFIX), msg); @@ -335,14 +341,14 @@ void ShowMessageInlineUtf(const HANDLE hContact, const char *msg) { ProtoChainRecvMsg(hContact, &pre); } -void ShowMessageUtf(const HANDLE hContact, const char *msg) { +void ShowMessageUtf(const HCONTACT hContact, const char *msg) { if(options.msg_inline) ShowMessageInlineUtf(hContact, msg); if(options.msg_popup) ShowPopupUtf(Translate(LANG_OTR_INFO), msg, 0, hContact); } -void ShowMessage(const HANDLE hContact, const TCHAR *msg) { +void ShowMessage(const HCONTACT hContact, const TCHAR *msg) { if(options.msg_inline) ShowMessageInline(hContact, msg); if(options.msg_popup) @@ -351,7 +357,7 @@ void ShowMessage(const HANDLE hContact, const TCHAR *msg) { /* -bool GetEncryptionStatus(HANDLE hContact) { +bool GetEncryptionStatus(HCONTACT hContact) { char *proto = GetContactProto(hContact); bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0)); diff --git a/plugins/MirOTR/MirOTR/src/utils.h b/plugins/MirOTR/MirOTR/src/utils.h index 01c1b44f69..1e2a05c9f3 100644 --- a/plugins/MirOTR/MirOTR/src/utils.h +++ b/plugins/MirOTR/MirOTR/src/utils.h @@ -7,8 +7,8 @@ void lib_cs_lock(); void lib_cs_unlock(); -HANDLE find_contact(const char* userid, const char* protocol); -ConnContext * otrl_context_find_miranda(OtrlUserState us, HANDLE hContact); +HCONTACT find_contact(const char* userid, const char* protocol); +ConnContext * otrl_context_find_miranda(OtrlUserState us, HCONTACT hContact); typedef enum { TRUST_NOT_PRIVATE, @@ -22,23 +22,23 @@ void VerifyFingerprintMessage(ConnContext *context, bool verify); void otrl_privkey_hash_to_humanT(TCHAR human[45], const unsigned char hash[20]); -char* contact_get_id(HANDLE hContact, bool bNameOnError=true); -__inline const char* contact_get_proto(HANDLE hContact); -__inline const char* contact_get_account(HANDLE hContact); -extern __inline const TCHAR* contact_get_nameT(HANDLE hContact); +char* contact_get_id(HCONTACT hContact, bool bNameOnError=true); +__inline const char* contact_get_proto(HCONTACT hContact); +__inline const char* contact_get_account(HCONTACT hContact); +extern __inline const TCHAR* contact_get_nameT(HCONTACT hContact); -void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const HANDLE hContact = NULL); +void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const HCONTACT hContact = NULL); void ShowWarning(TCHAR* msg); void ShowError(TCHAR* msg); -void ShowPopupUtf(const char* line1, const char* line2, int timeout, const HANDLE hContact = NULL); +void ShowPopupUtf(const char* line1, const char* line2, int timeout, const HCONTACT hContact = NULL); void ShowWarningUtf(char* msg); void ShowErrorUtf(char* msg); -void ShowMessageInline(const HANDLE hContact, const TCHAR *msg); -void ShowMessageInlineUtf(const HANDLE hContact, const char *msg); +void ShowMessageInline(const HCONTACT hContact, const TCHAR *msg); +void ShowMessageInlineUtf(const HCONTACT hContact, const char *msg); -void ShowMessage(const HANDLE hContact, const TCHAR *msg); -void ShowMessageUtf(const HANDLE hContact, const char *msg); +void ShowMessage(const HCONTACT hContact, const TCHAR *msg); +void ShowMessageUtf(const HCONTACT hContact, const char *msg); void InitUtils(); void DeinitUtils(); diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 48f861b2c9..17399ad465 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -445,7 +445,7 @@ void CAppletManager::ActivateCListScreen() //************************************************************************ // activates the chat screen //************************************************************************ -bool CAppletManager::ActivateChatScreen(HANDLE hContact) +bool CAppletManager::ActivateChatScreen(HCONTACT hContact) { if(!m_ChatScreen.SetContact(hContact)) return false; @@ -461,7 +461,7 @@ bool CAppletManager::ActivateChatScreen(HANDLE hContact) //************************************************************************ // returns the contacts displayname //************************************************************************ -tstring CAppletManager::GetContactDisplayname(HANDLE hContact,bool bShortened) +tstring CAppletManager::GetContactDisplayname(HCONTACT hContact,bool bShortened) { if(!bShortened || !CConfig::GetBoolSetting(NOTIFY_NICKCUTOFF)) return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); @@ -476,7 +476,7 @@ tstring CAppletManager::GetContactDisplayname(HANDLE hContact,bool bShortened) //************************************************************************ // returns the contacts group //************************************************************************ -tstring CAppletManager::GetContactGroup(HANDLE hContact) +tstring CAppletManager::GetContactGroup(HCONTACT hContact) { DBVARIANT dbv; int res = db_get_ts(hContact, "CList", "Group", &dbv); @@ -649,7 +649,7 @@ void CAppletManager::HandleEvent(CEvent *pEvent) } } -bool CAppletManager::IsUtfSendAvailable(HANDLE hContact) { +bool CAppletManager::IsUtfSendAvailable(HCONTACT hContact) { char* szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); if ( szProto == NULL ) return FALSE; @@ -660,7 +660,7 @@ bool CAppletManager::IsUtfSendAvailable(HANDLE hContact) { //************************************************************************ // returns the contacts message service name //************************************************************************ -char *CAppletManager::GetMessageServiceName(HANDLE hContact,bool bIsUnicode) +char *CAppletManager::GetMessageServiceName(HCONTACT hContact,bool bIsUnicode) { char szServiceName[100]; char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); @@ -785,7 +785,7 @@ void CAppletManager::CancelMessageJob(SMessageJob *pJob) //************************************************************************ // returns wether or not a contact is a subcontact //************************************************************************ -bool CAppletManager::IsSubContact(HANDLE hContact) +bool CAppletManager::IsSubContact(HCONTACT hContact) { if(!db_get_b(0, "MetaContacts", "Enabled", 1)) return false; @@ -798,7 +798,7 @@ bool CAppletManager::IsSubContact(HANDLE hContact) //************************************************************************ // sends typing notifications to the specified contact //************************************************************************ -void CAppletManager::SendTypingNotification(HANDLE hContact,bool bEnable) +void CAppletManager::SendTypingNotification(HCONTACT hContact,bool bEnable) { DWORD protoStatus; DWORD protoCaps; @@ -841,7 +841,7 @@ void CAppletManager::SendTypingNotification(HANDLE hContact,bool bEnable) //************************************************************************ // sends a message to the specified contact //************************************************************************ -HANDLE CAppletManager::SendMessageToContact(HANDLE hContact,tstring strMessage) +HANDLE CAppletManager::SendMessageToContact(HCONTACT hContact,tstring strMessage) { tstring strAscii = _A2T(toNarrowString(strMessage).c_str()); int bufSize = lstrlen(strAscii.c_str())+1; @@ -859,7 +859,7 @@ HANDLE CAppletManager::SendMessageToContact(HANDLE hContact,tstring strMessage) GCDEST gcd = { szProto, 0, GC_EVENT_SENDMESSAGE }; DBVARIANT dbv; - if (!db_get_ts((HANDLE)hContact, szProto, "Nick", &dbv)) + if (!db_get_ts(hContact, szProto, "Nick", &dbv)) gcd.ptszID = dbv.ptszVal; else return NULL; @@ -924,7 +924,7 @@ HANDLE CAppletManager::SendMessageToContact(HANDLE hContact,tstring strMessage) //************************************************************************ // check if a contacts message window is opened //************************************************************************ -bool CAppletManager::IsMessageWindowOpen(HANDLE hContact) +bool CAppletManager::IsMessageWindowOpen(HCONTACT hContact) { MessageWindowInputData mwid; mwid.cbSize = sizeof(MessageWindowInputData); @@ -942,7 +942,7 @@ bool CAppletManager::IsMessageWindowOpen(HANDLE hContact) //************************************************************************ // marks the given message as read //************************************************************************ -void CAppletManager::MarkMessageAsRead(HANDLE hContact,HANDLE hEvent) +void CAppletManager::MarkMessageAsRead(HCONTACT hContact,HANDLE hEvent) { db_event_markRead(hContact, hEvent); CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM)hEvent); @@ -953,7 +953,7 @@ void CAppletManager::MarkMessageAsRead(HANDLE hContact,HANDLE hEvent) //************************************************************************ bool CAppletManager::TranslateDBEvent(CEvent *pEvent,WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HANDLE hdbevent = (HANDLE)lParam; @@ -1163,7 +1163,7 @@ CIRCConnection *CAppletManager::CreateIRCConnection(tstring strProtocol) //************************************************************************ // returns the history class for the specified IRC channel //************************************************************************ -CIRCHistory *CAppletManager::GetIRCHistory(HANDLE hContact) +CIRCHistory *CAppletManager::GetIRCHistory(HCONTACT hContact) { list::iterator iter = m_LIRCHistorys.begin(); while(iter != m_LIRCHistorys.end()) @@ -1190,7 +1190,7 @@ CIRCHistory *CAppletManager::GetIRCHistoryByName(tstring strProtocol,tstring str //************************************************************************ // deletes the history class for the specified IRC channel //************************************************************************ -void CAppletManager::DeleteIRCHistory(HANDLE hContact) +void CAppletManager::DeleteIRCHistory(HCONTACT hContact) { list::iterator iter = m_LIRCHistorys.begin(); while(iter != m_LIRCHistorys.end()) @@ -1214,7 +1214,7 @@ void CAppletManager::DeleteIRCHistory(HANDLE hContact) //************************************************************************ // creates a history class for the specified IRC channel //************************************************************************ -CIRCHistory *CAppletManager::CreateIRCHistory(HANDLE hContact,tstring strChannel) +CIRCHistory *CAppletManager::CreateIRCHistory(HCONTACT hContact,tstring strChannel) { char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if(!szProto) @@ -1582,7 +1582,7 @@ int CAppletManager::HookMessageWindowEvent(WPARAM wParam, LPARAM lParam) //************************************************************************ int CAppletManager::HookContactIsTyping(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; int iState = (int)lParam; CEvent Event; @@ -1621,7 +1621,7 @@ int CAppletManager::HookStatusChanged(WPARAM wParam, LPARAM lParam) // Prepare message and append to queue CEvent Event; - Event.hContact = (HANDLE)wParam; + Event.hContact = (HCONTACT)wParam; int iStatus = cws->value.wVal; Event.iValue = iStatus; @@ -1821,7 +1821,7 @@ int CAppletManager::HookContactAdded(WPARAM wParam, LPARAM lParam) { CEvent Event; Event.eType = EVENT_CONTACT_ADDED; - Event.hContact = (HANDLE)wParam; + Event.hContact = (HCONTACT)wParam; CAppletManager::GetInstance()->HandleEvent(&Event); return 0; @@ -1834,7 +1834,7 @@ int CAppletManager::HookContactDeleted(WPARAM wParam, LPARAM lParam) { CEvent Event; Event.eType = EVENT_CONTACT_DELETED; - Event.hContact = (HANDLE)wParam; + Event.hContact = (HCONTACT)wParam; Event.bNotification = CConfig::GetBoolSetting(NOTIFY_CONTACTS); Event.bLog = Event.bNotification; @@ -1854,7 +1854,7 @@ int CAppletManager::HookSettingChanged(WPARAM wParam,LPARAM lParam) DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING*)lParam; CEvent Event; - Event.hContact = (HANDLE)wParam; + Event.hContact = (HCONTACT)wParam; if(!lstrcmpA(dbcws->szModule,"MetaContacts")) { @@ -1865,7 +1865,7 @@ int CAppletManager::HookSettingChanged(WPARAM wParam,LPARAM lParam) if(!lstrcmpA(dbcws->szSetting,"IsSubcontact")) { Event.eType = EVENT_CONTACT_GROUP; DBVARIANT dbv; - int res = db_get_ts((HANDLE)wParam, "CList", "Group", &dbv); + int res = db_get_ts((HCONTACT)wParam, "CList", "Group", &dbv); if(!res) Event.strValue = dbv.ptszVal; db_free(&dbv); @@ -1910,13 +1910,13 @@ int CAppletManager::HookSettingChanged(WPARAM wParam,LPARAM lParam) if(!lstrcmpA(dbcws->szSetting,"Hidden")) { Event.eType = EVENT_CONTACT_HIDDEN; - Event.iValue = db_get_b((HANDLE)wParam,"CList","Hidden",0); + Event.iValue = db_get_b((HCONTACT)wParam,"CList","Hidden",0); } else if(!lstrcmpA(dbcws->szSetting,"Group")) { Event.eType = EVENT_CONTACT_GROUP; DBVARIANT dbv; - int res = db_get_ts((HANDLE)wParam, "CList", "Group", &dbv); + int res = db_get_ts((HCONTACT)wParam, "CList", "Group", &dbv); if(!res) Event.strValue = dbv.ptszVal; db_free(&dbv); diff --git a/plugins/MirandaG15/src/CAppletManager.h b/plugins/MirandaG15/src/CAppletManager.h index dee9b96a9e..f3551b41fe 100644 --- a/plugins/MirandaG15/src/CAppletManager.h +++ b/plugins/MirandaG15/src/CAppletManager.h @@ -19,7 +19,7 @@ struct SMessageJob { HANDLE hEvent; - HANDLE hContact; + HCONTACT hContact; DWORD dwFlags; char *pcBuffer; int iBufferSize; @@ -59,7 +59,7 @@ public: void ActivateCreditsScreen(); void ActivateEventScreen(); void ActivateCListScreen(); - bool ActivateChatScreen(HANDLE hContact); + bool ActivateChatScreen(HCONTACT hContact); // hook functions static int HookMessageWindowEvent(WPARAM wParam, LPARAM lParam); @@ -73,31 +73,31 @@ public: static int HookChatInbound(WPARAM wParam,LPARAM lParam); // check if a contacts message window is opened - static bool IsMessageWindowOpen(HANDLE hContact); + static bool IsMessageWindowOpen(HCONTACT hContact); // marks the given event as read - static void MarkMessageAsRead(HANDLE hContact,HANDLE hEvent); + static void MarkMessageAsRead(HCONTACT hContact,HANDLE hEvent); // translates the given database event static bool TranslateDBEvent(CEvent *pEvent,WPARAM wParam, LPARAM lParam); // sends a message to the specified contact - static HANDLE SendMessageToContact(HANDLE hContact,tstring strMessage); + static HANDLE SendMessageToContact(HCONTACT hContact,tstring strMessage); // sends typing notifications to the specified contact - static void SendTypingNotification(HANDLE hContact,bool bEnable); + static void SendTypingNotification(HCONTACT hContact,bool bEnable); // returns the contacts message service name - static char *GetMessageServiceName(HANDLE hContact,bool bIsUnicode); - static bool IsUtfSendAvailable(HANDLE hContact); + static char *GetMessageServiceName(HCONTACT hContact,bool bIsUnicode); + static bool IsUtfSendAvailable(HCONTACT hContact); // returns a formatted timestamp string static tstring GetFormattedTimestamp(tm *time); // returns wether or not a contact is a subcontact - static bool IsSubContact(HANDLE hContact); + static bool IsSubContact(HCONTACT hContact); // returns the contacts group - static tstring GetContactGroup(HANDLE hContact); + static tstring GetContactGroup(HCONTACT hContact); // returns the contacts displayname - static tstring GetContactDisplayname(HANDLE hContact,bool bShortened=false); + static tstring GetContactDisplayname(HCONTACT hContact,bool bShortened=false); // returns the history class for the specified IRC channel - CIRCHistory *GetIRCHistory(HANDLE hContact); + CIRCHistory *GetIRCHistory(HCONTACT hContact); CIRCHistory *GetIRCHistoryByName(tstring strProtocol,tstring strChannel); // returns the IRC connection class for the specified protocol @@ -118,9 +118,9 @@ public: private: list m_LIRCHistorys; // deletes the history class for the specified IRC channel - void DeleteIRCHistory(HANDLE hContact); + void DeleteIRCHistory(HCONTACT hContact); // creates a history class for the specified IRC channel - CIRCHistory *CreateIRCHistory(HANDLE hContact,tstring strChannel); + CIRCHistory *CreateIRCHistory(HCONTACT hContact,tstring strChannel); CIRCHistory *CreateIRCHistoryByName(tstring strProtocol,tstring strChannel); // activate a screen diff --git a/plugins/MirandaG15/src/CChatScreen.cpp b/plugins/MirandaG15/src/CChatScreen.cpp index dc87294e26..9fb9acb88b 100644 --- a/plugins/MirandaG15/src/CChatScreen.cpp +++ b/plugins/MirandaG15/src/CChatScreen.cpp @@ -224,7 +224,7 @@ HANDLE CChatScreen::GetContact() //************************************************************************ // sets the screen's chat contact //************************************************************************ -bool CChatScreen::SetContact(HANDLE hContact) +bool CChatScreen::SetContact(HCONTACT hContact) { if(hContact == NULL) { diff --git a/plugins/MirandaG15/src/CChatScreen.h b/plugins/MirandaG15/src/CChatScreen.h index 7af002e46c..6a29dea079 100644 --- a/plugins/MirandaG15/src/CChatScreen.h +++ b/plugins/MirandaG15/src/CChatScreen.h @@ -44,7 +44,7 @@ public: void OnSizeChanged(); // Set's the chat contact - bool SetContact(HANDLE hContact); + bool SetContact(HCONTACT hContact); // returns the chat contact HANDLE GetContact(); @@ -92,10 +92,10 @@ protected: DWORD m_dwMaximizedTimer; DWORD m_dwMaximizedDuration; - HANDLE m_hContact; - HANDLE m_hMessage; + HCONTACT m_hContact; + HANDLE m_hMessage; - int m_iStatus; + int m_iStatus; CLCDLabel m_UserProto; CLCDLabel m_UserName; diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index e22f1a868d..bf3469ed95 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -78,12 +78,12 @@ CContactListEntry *CContactList::GetContactData(CListEntry *pGroup = NULL; @@ -151,15 +151,16 @@ void CContactList::AddContact(HANDLE hContact) // check that all subcontacts exist int numContacts = CallService(MS_MC_GETNUMCONTACTS,(WPARAM)hContact,0); - HANDLE hSubContact = NULL; + HCONTACT hSubContact = NULL; for(int i=0;iiStatus == ID_STATUS_OFFLINE) { DWORD dwNumContacts = (DWORD)CallService(MS_MC_GETNUMCONTACTS,(WPARAM)pEntry->hHandle,0); - HANDLE hSubContact = NULL; - char *szProto; for(DWORD i = 0; i < dwNumContacts; i++) { - hSubContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT,(WPARAM)pEntry->hHandle,i); - szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(UINT)hSubContact,0); + HCONTACT hSubContact = (HCONTACT)CallService(MS_MC_GETSUBCONTACT,(WPARAM)pEntry->hHandle,i); + char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(UINT)hSubContact,0); if(db_get_w(hSubContact,szProto,"Status",ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) { return true; } @@ -223,10 +222,9 @@ bool CContactList::IsVisible(CContactListEntry *pEntry) { if(db_get_b(pEntry->hHandle,"CList","Hidden",0)) return false; else if(CAppletManager::IsSubContact(pEntry->hHandle)) { - HANDLE hMetaContact = (HANDLE) CallService(MS_MC_GETMETACONTACT, (WPARAM)pEntry->hHandle, 0); - if(db_get_b(hMetaContact,"CList","Hidden",0)) { + HCONTACT hMetaContact = (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)pEntry->hHandle, 0); + if(db_get_b(hMetaContact,"CList","Hidden",0)) return false; - } } } @@ -243,7 +241,7 @@ bool CContactList::IsVisible(CContactListEntry *pEntry) { //************************************************************************ // removes a contact from the list //************************************************************************ -void CContactList::RemoveContact(HANDLE hContact) { +void CContactList::RemoveContact(HCONTACT hContact) { CListContainer *pGroup = NULL; ///tstring strGroup = GetContactGroupPath(hContact); @@ -282,12 +280,10 @@ void CContactList::RemoveContact(HANDLE hContact) { pGroup->RemoveGroup(((CListContainer*)pContactEntry)->GetGroupData()); // Reenumerate all subcontacts (maybe MetaContacts was disabled int numContacts = CallService(MS_MC_GETNUMCONTACTS,(WPARAM)hContact,0); - HANDLE hSubContact = NULL; for(int i=0;i *CContactList::AddGroupByS //************************************************************************ // returns the contact's status //************************************************************************ -int CContactList::GetContactStatus(HANDLE hContact) +int CContactList::GetContactStatus(HCONTACT hContact) { CListEntry *pContactEntry = FindContact(hContact); if(!pContactEntry) @@ -554,7 +550,7 @@ void CContactList::RefreshList() m_bUseMetaContacts = db_get_b(NULL,"MetaContacts","Enabled",1); CListEntry *pContactEntry = NULL; - HANDLE hContact = db_find_first(); + HCONTACT hContact = db_find_first(); while(hContact != NULL) { pContactEntry = FindContact(hContact); @@ -623,7 +619,7 @@ CListContainer *CContactList::FindGroupIn //************************************************************************ // returns the entry for the specified handle //************************************************************************ -CListEntry *CContactList::FindContact(HANDLE hContact) +CListEntry *CContactList::FindContact(HCONTACT hContact) { if(hContact == NULL) return NULL; @@ -634,7 +630,7 @@ CListEntry *CContactList::FindContact(HAN //************************************************************************ // returns the entry for the specified handle //************************************************************************ -CListEntry *CContactList::FindContactInGroup(HANDLE hContact,CListContainer *pGroup) +CListEntry *CContactList::FindContactInGroup(HCONTACT hContact,CListContainer *pGroup) { if(hContact == NULL) return NULL; @@ -670,7 +666,7 @@ CListEntry *CContactList::FindContactInGr //************************************************************************ // called when a contacts hidden flag has changed //************************************************************************ -void CContactList::OnContactHiddenChanged(HANDLE hContact, bool bHidden) +void CContactList::OnContactHiddenChanged(HCONTACT hContact, bool bHidden) { CListEntry *pContactEntry = FindContact(hContact); @@ -689,7 +685,7 @@ void CContactList::OnContactHiddenChanged(HANDLE hContact, bool bHidden) //************************************************************************ // called when a contacts nickname has changed //************************************************************************ -void CContactList::OnContactNickChanged(HANDLE hContact, tstring strNick) +void CContactList::OnContactNickChanged(HCONTACT hContact, tstring strNick) { CListEntry *pContactEntry = FindContact(hContact); if(!pContactEntry) @@ -715,7 +711,7 @@ void CContactList::OnContactNickChanged(HANDLE hContact, tstring strNick) //************************************************************************ // called when a contacts status has changed //************************************************************************ -void CContactList::OnStatusChange(HANDLE hContact,int iStatus) +void CContactList::OnStatusChange(HCONTACT hContact,int iStatus) { // find the entry in the list CListEntry *pContactEntry = FindContact(hContact); @@ -768,7 +764,7 @@ void CContactList::OnStatusChange(HANDLE hContact,int iStatus) //************************************************************************ // called when the contacts message count has changed //************************************************************************ -void CContactList::OnMessageCountChanged(HANDLE hContact) +void CContactList::OnMessageCountChanged(HCONTACT hContact) { CListEntry *pContactEntry = FindContact(hContact); if(!pContactEntry) @@ -788,7 +784,7 @@ void CContactList::OnMessageCountChanged(HANDLE hContact) //************************************************************************ // called when a contact has been added //************************************************************************ -void CContactList::OnContactAdded(HANDLE hContact) +void CContactList::OnContactAdded(HCONTACT hContact) { // Update the list AddContact(hContact); @@ -809,7 +805,7 @@ void CContactList::OnContactAdded(HANDLE hContact) //************************************************************************ // called when a contact has been deleted //************************************************************************ -void CContactList::OnContactDeleted(HANDLE hContact) +void CContactList::OnContactDeleted(HCONTACT hContact) { // Update the list RemoveContact(hContact); @@ -833,7 +829,7 @@ void CContactList::OnContactDeleted(HANDLE hContact) //************************************************************************ // called when a contacts group has changed //************************************************************************ -void CContactList::OnContactGroupChanged(HANDLE hContact,tstring strGroup) +void CContactList::OnContactGroupChanged(HCONTACT hContact,tstring strGroup) { bool bMetaContact = false; @@ -1017,7 +1013,7 @@ void CContactList::InitializeGroupObjects() int res = 0; CContactListGroup *pGroup = NULL; - HANDLE hContact = db_find_first(); + HCONTACT hContact = db_find_first(); HANDLE hMetaContact = NULL; char *szProto = NULL; while(hContact != NULL) diff --git a/plugins/MirandaG15/src/CContactList.h b/plugins/MirandaG15/src/CContactList.h index 75b129f8fc..a86d61852f 100644 --- a/plugins/MirandaG15/src/CContactList.h +++ b/plugins/MirandaG15/src/CContactList.h @@ -8,7 +8,7 @@ class CContactListEntry public: int iMessages; tstring strMessages; - HANDLE hHandle; + HCONTACT hHandle; tstring strName; tstring strProto; tstring strStatus; @@ -25,7 +25,7 @@ public: int iOnline; int iEvents; - HANDLE hMetaContact; + HCONTACT hMetaContact; CContactListEntry *pContactListEntry; }; @@ -43,23 +43,23 @@ public: bool Shutdown(); // called when a contact has been added - void OnContactAdded(HANDLE hContact); + void OnContactAdded(HCONTACT hContact); // called when a contact has been deleted - void OnContactDeleted(HANDLE hContact); + void OnContactDeleted(HCONTACT hContact); // called when the configuration has changed void OnConfigChanged(); // called when a contacts group has changed - void OnContactGroupChanged(HANDLE hContact,tstring strGroup); + void OnContactGroupChanged(HCONTACT hContact,tstring strGroup); // called when a contacts hidden flag has changed - void OnContactHiddenChanged(HANDLE hContact, bool bVisibility); + void OnContactHiddenChanged(HCONTACT hContact, bool bVisibility); // called when a contacts nickname has changed - void OnContactNickChanged(HANDLE hContact, tstring strNick); + void OnContactNickChanged(HCONTACT hContact, tstring strNick); // called when a contacts status has changed - void OnStatusChange(HANDLE hContact,int iStatus); + void OnStatusChange(HCONTACT hContact,int iStatus); // called when the contacts message count has changed - void OnMessageCountChanged(HANDLE hContact); + void OnMessageCountChanged(HCONTACT hContact); // returns the contact's status - int GetContactStatus(HANDLE hContact); + int GetContactStatus(HCONTACT hContact); // Called to compare two entrys static bool CompareEntries(CListEntry *pLeft,CListEntry *pRight); @@ -72,12 +72,12 @@ public: bool SetFont(LOGFONT &lf); protected: // returns the contacts group path - tstring GetContactGroupPath(HANDLE hContact); + tstring GetContactGroupPath(HCONTACT hContact); // adds a contact to the list - void AddContact(HANDLE hContact); + void AddContact(HCONTACT hContact); // removes a contact from the list - void RemoveContact(HANDLE hContact); + void RemoveContact(HCONTACT hContact); // uninitializes the group objects void UninitializeGroupObjects(); @@ -101,7 +101,7 @@ protected: void SortGroup(CListContainer *pGroup); // tries to find a contact in the specified group - CListEntry *FindContactInGroup(HANDLE hContact,CListContainer *pGroup); + CListEntry *FindContactInGroup(HCONTACT hContact,CListContainer *pGroup); // tries to find a group in the specified group CListContainer *FindGroupInGroup(tstring strGroup,CListContainer *pGroup); @@ -117,7 +117,7 @@ protected: void RefreshList(); // returns the entry for the specified handle - CListEntry *FindContact(HANDLE hContact); + CListEntry *FindContact(HCONTACT hContact); // returns the entry for the specified group name CListContainer *FindGroup(tstring strGroup); diff --git a/plugins/MirandaG15/src/CContactlistScreen.cpp b/plugins/MirandaG15/src/CContactlistScreen.cpp index b9cbebf5b2..d6e733f651 100644 --- a/plugins/MirandaG15/src/CContactlistScreen.cpp +++ b/plugins/MirandaG15/src/CContactlistScreen.cpp @@ -85,7 +85,7 @@ bool CContactlistScreen::Draw(CLCDGfx *pGfx) //************************************************************************ // returns the online status of the specified contact //************************************************************************ -int CContactlistScreen::GetContactStatus(HANDLE hContact) +int CContactlistScreen::GetContactStatus(HCONTACT hContact) { return m_ContactList.GetContactStatus(hContact); } @@ -182,7 +182,7 @@ void CContactlistScreen::OnEventReceived(CEvent *pEvent) //************************************************************************ // Called when a chat session was opened //************************************************************************ -void CContactlistScreen::OnSessionOpened(HANDLE hContact) +void CContactlistScreen::OnSessionOpened(HCONTACT hContact) { m_ContactList.OnMessageCountChanged(hContact); } @@ -253,11 +253,10 @@ void CContactlistScreen::OnLCDButtonUp(int iButton) if(pEntry->GetType() == CONTAINER) { CListContainer *pContainer = (CListContainer*)pEntry; if(pContainer->GetGroupData()->hMetaContact != NULL) { - if(m_bLongPress) { + if(m_bLongPress) pContainer->ToggleOpen(); - } else { + else CAppletManager::GetInstance()->ActivateChatScreen(pContainer->GetGroupData()->hMetaContact); - } } } } diff --git a/plugins/MirandaG15/src/CContactlistScreen.h b/plugins/MirandaG15/src/CContactlistScreen.h index 3b9a5f6f95..f3ce140267 100644 --- a/plugins/MirandaG15/src/CContactlistScreen.h +++ b/plugins/MirandaG15/src/CContactlistScreen.h @@ -26,10 +26,10 @@ public: void ResetPosition(); // returns the online status of the specified contact - int GetContactStatus(HANDLE hContact); + int GetContactStatus(HCONTACT hContact); // Called when a chat session was opened - void OnSessionOpened(HANDLE hContact); + void OnSessionOpened(HCONTACT hContact); // Called when the configuration has changed void OnConfigChanged(); diff --git a/plugins/MirandaG15/src/CEvent.h b/plugins/MirandaG15/src/CEvent.h index cf23af037e..81d3b40833 100644 --- a/plugins/MirandaG15/src/CEvent.h +++ b/plugins/MirandaG15/src/CEvent.h @@ -53,7 +53,7 @@ public: enum EventType eType; DWORD dwFlags; - HANDLE hContact; + HCONTACT hContact; tm Time; bool bTime; diff --git a/plugins/MirandaG15/src/CEventLog.h b/plugins/MirandaG15/src/CEventLog.h index e5953f92c7..e70d3f6a43 100644 --- a/plugins/MirandaG15/src/CEventLog.h +++ b/plugins/MirandaG15/src/CEventLog.h @@ -6,7 +6,7 @@ class CEventLogEntry { public: - HANDLE hContact; + HCONTACT hContact; tstring strValue; tstring strTimestamp; tm Time; diff --git a/plugins/MirandaG15/src/CEventScreen.cpp b/plugins/MirandaG15/src/CEventScreen.cpp index cda38b07b4..b5656a3188 100644 --- a/plugins/MirandaG15/src/CEventScreen.cpp +++ b/plugins/MirandaG15/src/CEventScreen.cpp @@ -187,7 +187,7 @@ void CEventScreen::OnLCDButtonDown(int iButton) CIRCConnection *pIRCCon = CAppletManager::GetInstance()->GetIRCConnection(toTstring(szProto)); if(pIRCCon && db_get_b(pEntry->hContact, szProto, "ChatRoom", 0) != 0 && - db_get_b((HANDLE)pEntry->hContact,"CList","Hidden",0)) + db_get_b(pEntry->hContact,"CList","Hidden",0)) return; CAppletManager::GetInstance()->ActivateChatScreen(pEntry->hContact); diff --git a/plugins/MirandaG15/src/CIRCHistory.h b/plugins/MirandaG15/src/CIRCHistory.h index 299a80544b..bba2c40fb4 100644 --- a/plugins/MirandaG15/src/CIRCHistory.h +++ b/plugins/MirandaG15/src/CIRCHistory.h @@ -14,7 +14,7 @@ class CIRCHistory public: tstring strChannel; tstring strProtocol; - HANDLE hContact; + HCONTACT hContact; list LMessages; list LUsers; }; diff --git a/plugins/MirandaG15/src/CNotificationScreen.h b/plugins/MirandaG15/src/CNotificationScreen.h index 837398238a..7404832205 100644 --- a/plugins/MirandaG15/src/CNotificationScreen.h +++ b/plugins/MirandaG15/src/CNotificationScreen.h @@ -14,7 +14,7 @@ public: tm Time; tstring strText; tstring strTitle; - HANDLE hContact; + HCONTACT hContact; EventType eType; }; diff --git a/plugins/MirandaG15/src/Miranda.h b/plugins/MirandaG15/src/Miranda.h index 5b35db47cd..f11db5f7b8 100644 --- a/plugins/MirandaG15/src/Miranda.h +++ b/plugins/MirandaG15/src/Miranda.h @@ -1,3 +1,3 @@ extern HINSTANCE hInstance; -extern char *MsgServiceName(HANDLE hContact,bool bIsUnicode); +extern char *MsgServiceName(HCONTACT hContact,bool bIsUnicode); diff --git a/plugins/MobileState/src/main.cpp b/plugins/MobileState/src/main.cpp index 17de9672af..745622593a 100644 --- a/plugins/MobileState/src/main.cpp +++ b/plugins/MobileState/src/main.cpp @@ -50,7 +50,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfo; } -bool hasMobileClient(HANDLE hContact, LPARAM lParam) +bool hasMobileClient(HCONTACT hContact, LPARAM lParam) { char *proto = GetContactProto(hContact); @@ -71,10 +71,10 @@ int ExtraIconsApply(WPARAM wParam, LPARAM lParam) if (wParam == NULL) return 0; - if (hasMobileClient((HANDLE)wParam, lParam)) - ExtraIcon_SetIcon(hExtraIcon, (HANDLE)wParam, "mobile_icon"); + if (hasMobileClient((HCONTACT)wParam, lParam)) + ExtraIcon_SetIcon(hExtraIcon, (HCONTACT)wParam, "mobile_icon"); else - ExtraIcon_Clear(hExtraIcon, (HANDLE)wParam); + ExtraIcon_Clear(hExtraIcon, (HCONTACT)wParam); return 0; } @@ -82,7 +82,7 @@ int ExtraIconsApply(WPARAM wParam, LPARAM lParam) int onContactSettingChanged(WPARAM wParam,LPARAM lParam) { DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; - char *proto = GetContactProto((HANDLE)wParam); + char *proto = GetContactProto((HCONTACT)wParam); if (!proto) return 0; @@ -102,7 +102,7 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) hExtraIcon = ExtraIcon_Register("mobilestate", LPGEN("Mobile State"), "mobile_icon"); // Set initial value for all contacts - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) ExtraIconsApply((WPARAM)hContact, 1); return 0; diff --git a/plugins/ModernOpt/src/mopt_ignore.cpp b/plugins/ModernOpt/src/mopt_ignore.cpp index 19d6df1a7b..fadd516b7e 100644 --- a/plugins/ModernOpt/src/mopt_ignore.cpp +++ b/plugins/ModernOpt/src/mopt_ignore.cpp @@ -49,7 +49,7 @@ static void ResetListOptions(HWND hwndList) static void SetAllContactIcons(HWND hwndList, int count) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { DWORD hItem = SendMessage(hwndList,CLM_FINDCONTACT,(WPARAM)hContact,0); for (int i = 0; i < count; ++i) SendMessage(hwndList,CLM_SETEXTRAIMAGE,hItem,MAKELPARAM(i, i+1)); diff --git a/plugins/MsgPopup/src/options.cpp b/plugins/MsgPopup/src/options.cpp index e9b5eca13d..8920eb4bbe 100644 --- a/plugins/MsgPopup/src/options.cpp +++ b/plugins/MsgPopup/src/options.cpp @@ -28,7 +28,7 @@ int idOptionControls[4][3] = { IDC_QUESTION_FG,IDC_QUESTION_BG,IDC_TIMEOUT4 }; -static int __inline DBWriteContactSettingDwordDef(HANDLE hContact,const char *szModule,const char *szSetting,DWORD val, DWORD defValue) +static int __inline DBWriteContactSettingDwordDef(HCONTACT hContact,const char *szModule,const char *szSetting,DWORD val, DWORD defValue) { if(val == db_get_dw(hContact, szModule, szSetting, defValue)) return 0; diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index c993b3299e..4c42c78ba3 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -103,7 +103,7 @@ class CLHistoryDlg public: HWND hWnd; - HANDLE hContact; + HCONTACT hContact; tstring sPath; HWND hFindDlg; @@ -113,7 +113,7 @@ class CLHistoryDlg bool bFirstLoad; bool bUtf8File; - CLHistoryDlg( HANDLE hContact) : hContact( hContact ) + CLHistoryDlg( HCONTACT hContact) : hContact( hContact ) { hFindDlg = NULL; acFindStr[0] = 0; @@ -489,7 +489,7 @@ void UpdateFileViews( const TCHAR *pszFile ) // Developer : KN ///////////////////////////////////////////////////////////////////// -bool bOpenExternaly( HANDLE hContact ) +bool bOpenExternaly( HCONTACT hContact ) { tstring sPath = GetFilePathFromUser( hContact); @@ -1232,7 +1232,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, // Developer : KN ///////////////////////////////////////////////////////////////////// -bool bShowFileViewer(HANDLE hContact) +bool bShowFileViewer(HCONTACT hContact) { HWND hInternalWindow = WindowList_Find(hInternalWindowList,hContact); if(hInternalWindow) { diff --git a/plugins/Msg_Export/src/FileViewer.h b/plugins/Msg_Export/src/FileViewer.h index d76509e4de..fb060a2c50 100755 --- a/plugins/Msg_Export/src/FileViewer.h +++ b/plugins/Msg_Export/src/FileViewer.h @@ -24,8 +24,8 @@ void Uninitilize(); void UpdateFileViews( const TCHAR *pszFile); -bool bOpenExternaly( HANDLE hContact); -bool bShowFileViewer( HANDLE hContact); +bool bOpenExternaly( HCONTACT hContact); +bool bShowFileViewer( HCONTACT hContact); bool bUseInternalViewer( bool bNew); bool bUseInternalViewer(); diff --git a/plugins/Msg_Export/src/main.cpp b/plugins/Msg_Export/src/main.cpp index 898eb2c5c6..1aafecbf02 100755 --- a/plugins/Msg_Export/src/main.cpp +++ b/plugins/Msg_Export/src/main.cpp @@ -62,10 +62,10 @@ static INT_PTR ShowExportHistory(WPARAM wParam, LPARAM /*lParam*/) { if (bUseInternalViewer()) { - bShowFileViewer((HANDLE)wParam); + bShowFileViewer((HCONTACT)wParam); return 0; } - bOpenExternaly((HANDLE)wParam); + bOpenExternaly((HCONTACT)wParam); return 0; } diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 4f6cd64214..30b37937d8 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -92,29 +92,15 @@ class CLDBEvent int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { if (lParamSort == 1 ) - { - return _tcsicmp( NickFromHandle((HANDLE)lParam1), NickFromHandle((HANDLE)lParam2)); - } + return _tcsicmp( NickFromHandle((HCONTACT)lParam1), NickFromHandle((HCONTACT)lParam2)); if (lParamSort == 2 ) - { - return _DBGetString( (HANDLE)lParam1, "Protocol", "p", _T("")).compare( - _DBGetString( (HANDLE)lParam2, "Protocol", "p", _T("")) - ); - } + return _DBGetString((HCONTACT)lParam1, "Protocol", "p", _T("")).compare(_DBGetString((HCONTACT)lParam2, "Protocol", "p", _T(""))); + if (lParamSort == 3 ) { - DWORD dwUin1 = db_get_dw( - (HANDLE)lParam1, - _DBGetStringA( (HANDLE)lParam1, "Protocol", "p", "" ).c_str(), - "UIN", - 0); - DWORD dwUin2 = db_get_dw( - (HANDLE)lParam2, - _DBGetStringA( (HANDLE)lParam2, "Protocol", "p", "" ).c_str(), - "UIN", - 0); - + DWORD dwUin1 = db_get_dw((HCONTACT)lParam1, _DBGetStringA((HCONTACT)lParam1, "Protocol", "p", "" ).c_str(), "UIN", 0); + DWORD dwUin2 = db_get_dw((HCONTACT)lParam2, _DBGetStringA((HCONTACT)lParam2, "Protocol", "p", "" ).c_str(), "UIN", 0); if (dwUin1 == dwUin2 ) return 0; if (dwUin1 > dwUin2 ) @@ -235,7 +221,7 @@ int nExportCompleatList(HWND hParent, bool bOnlySelected ) continue; } - HANDLE hContact = (HANDLE)sItem.lParam; + HCONTACT hContact = (HCONTACT)sItem.lParam; list< CLDBEvent > & rclCurList = AllEvents[ GetFilePathFromUser( hContact) ]; @@ -329,7 +315,7 @@ void SetToDefault( HWND hParent ) continue; tstring sFileName = szTemp; - ReplaceDefines( (HANDLE)sItem.lParam, sFileName); + ReplaceDefines((HCONTACT)sItem.lParam, sFileName); ReplaceTimeVariables( sFileName); sItem.mask = LVIF_TEXT; @@ -414,16 +400,16 @@ BOOL bApplyChanges( HWND hwndDlg ) if (ListView_GetItem( hMapUser, &sItem)) { - HANDLE hUser = (HANDLE)sItem.lParam; + HCONTACT hUser = (HCONTACT)sItem.lParam; if (_tcslen( szTemp) > 0 ) - db_set_ts( hUser, MODULE, "FileName", szTemp); + db_set_ts(hUser, MODULE, "FileName", szTemp); else - db_unset( hUser, MODULE, "FileName"); + db_unset(hUser, MODULE, "FileName"); if (sItem.iImage ) - db_unset( hUser, MODULE, "EnableLog"); // default is Enabled !! + db_unset(hUser, MODULE, "EnableLog"); // default is Enabled !! else - db_set_b( hUser, MODULE, "EnableLog",0); + db_set_b(hUser, MODULE, "EnableLog",0); } } UpdateFileToColWidth(); @@ -507,7 +493,7 @@ void AutoFindeFileNames(HWND hwndDlg) } int nShortestMatch = 0xFFFF; - HANDLE hStortest = 0; + HCONTACT hStortest = 0; int nStortestIndex = -1; for (int nSubCur = 0 ; nSubCur < nCount ; nSubCur++ ) { @@ -528,7 +514,7 @@ void AutoFindeFileNames(HWND hwndDlg) { nShortestMatch = (int)nLen; nStortestIndex = nSubCur; - hStortest = (HANDLE)sItem.lParam; + hStortest = (HCONTACT)sItem.lParam; } } } @@ -551,7 +537,7 @@ void AutoFindeFileNames(HWND hwndDlg) if (sFileName.empty()) { sFileName = szDefaultFile; - ReplaceDefines( hStortest, sFileName); + ReplaceDefines(hStortest, sFileName); ReplaceTimeVariables( sFileName); } @@ -692,7 +678,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar { tstring sTmp; LVITEM sItem = { 0 }; - HANDLE hContact = db_find_first(); + HCONTACT hContact = db_find_first(); for (int nUser = 0; /*hContact*/ ; nUser++ ) { sItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE; diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 64fbf69bb9..c7b03b5e3b 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -255,7 +255,7 @@ void DisplayLastError(const TCHAR *pszError) // Developer : KN ///////////////////////////////////////////////////////////////////// -const TCHAR* NickFromHandle(HANDLE hContact) +const TCHAR* NickFromHandle(HCONTACT hContact) { const TCHAR *psz = (const TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); if (psz ) @@ -279,7 +279,7 @@ const TCHAR* NickFromHandle(HANDLE hContact) // Developer : KN ///////////////////////////////////////////////////////////////////// -tstring _DBGetStringW(HANDLE hContact,const char *szModule,const char *szSetting, const TCHAR *pszError ) +tstring _DBGetStringW(HCONTACT hContact,const char *szModule,const char *szSetting, const TCHAR *pszError ) { tstring ret; DBVARIANT dbv = {0}; @@ -302,7 +302,7 @@ tstring _DBGetStringW(HANDLE hContact,const char *szModule,const char *szSetting return ret; } -string _DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting, const char *pszError ) +string _DBGetStringA(HCONTACT hContact,const char *szModule,const char *szSetting, const char *pszError ) { string ret; DBVARIANT dbv = {0}; @@ -596,7 +596,7 @@ void ReplaceDBPath( tstring &sRet ) // Developer : KN ///////////////////////////////////////////////////////////////////// -tstring GetFilePathFromUser( HANDLE hContact ) +tstring GetFilePathFromUser( HCONTACT hContact ) { tstring sFilePath = sExportDir + _DBGetString( hContact, MODULE, "FileName", sDefaultFile.c_str()); @@ -707,7 +707,7 @@ tstring GetFilePathFromUser( HANDLE hContact ) // Developer : KN ///////////////////////////////////////////////////////////////////// -tstring FileNickFromHandle( HANDLE hContact) +tstring FileNickFromHandle( HCONTACT hContact) { tstring ret = NickFromHandle( hContact); string::size_type nCur = 0; @@ -754,7 +754,7 @@ void ReplaceAllNoColon( tstring &sSrc, const TCHAR *pszReplace, tstring &sNew) // Developer : KN ///////////////////////////////////////////////////////////////////// -void ReplaceDefines( HANDLE hContact, tstring & sTarget ) +void ReplaceDefines( HCONTACT hContact, tstring & sTarget ) { if (sTarget.find( _T("%nick%")) != string::npos ) { @@ -899,7 +899,7 @@ void UpdateFileToColWidth() { clFileTo1ColWidth.clear(); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { tstring sNick = NickFromHandle( hContact); string::size_type &rnValue = clFileTo1ColWidth[ GetFilePathFromUser( hContact) ]; if (rnValue < sNick.size()) @@ -997,7 +997,7 @@ void DisplayErrorDialog( const TCHAR *pszError, tstring& sFilePath, DBEVENTINFO // Developer : KN ///////////////////////////////////////////////////////////////////// -void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) +void ExportDBEventInfo(HCONTACT hContact, DBEVENTINFO &dbei ) { TCHAR szTemp[500]; tstring sFilePath = GetFilePathFromUser( hContact); @@ -1410,7 +1410,8 @@ void ExportDBEventInfo(HANDLE hContact, DBEVENTINFO &dbei ) int nExportEvent(WPARAM wparam,LPARAM lparam) { - HANDLE hContact = (HANDLE)wparam, hDbEvent = (HANDLE)lparam; + HCONTACT hContact = (HCONTACT)wparam; + HANDLE hDbEvent = (HANDLE)lparam; if ( !db_get_b(hContact,MODULE,"EnableLog",1)) return 0; @@ -1582,7 +1583,7 @@ SuperBreak: int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/) { - HANDLE hContact = (HANDLE)wparam; + HCONTACT hContact = (HCONTACT)wparam; HWND hInternalWindow = WindowList_Find(hInternalWindowList,hContact); if(hInternalWindow) @@ -1594,7 +1595,7 @@ int nContactDeleted(WPARAM wparam,LPARAM /*lparam*/) tstring sFilePath = GetFilePathFromUser( hContact); // Test if there is another user using this file - for(HANDLE hOtherContact = db_find_first();hOtherContact;hOtherContact = db_find_next(hOtherContact)) + for(HCONTACT hOtherContact = db_find_first();hOtherContact;hOtherContact = db_find_next(hOtherContact)) if (hContact != hOtherContact && sFilePath == GetFilePathFromUser( hOtherContact)) return 0; // we found another contact abort mission :-) diff --git a/plugins/Msg_Export/src/utils.h b/plugins/Msg_Export/src/utils.h index ffb67d2ea0..023e32cce4 100755 --- a/plugins/Msg_Export/src/utils.h +++ b/plugins/Msg_Export/src/utils.h @@ -57,10 +57,10 @@ void ShowDebugInfo(); int nExportEvent(WPARAM wparam,LPARAM lparam); int nContactDeleted(WPARAM wparam,LPARAM lparam); -const TCHAR *NickFromHandle(HANDLE hContact); +const TCHAR *NickFromHandle(HCONTACT hContact); -tstring __inline _DBGetStringW(HANDLE hContact,const char *szModule,const char *szSetting, const TCHAR *pszError); -string __inline _DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting, const char *pszError); +tstring __inline _DBGetStringW(HCONTACT hContact,const char *szModule,const char *szSetting, const TCHAR *pszError); +string __inline _DBGetStringA(HCONTACT hContact,const char *szModule,const char *szSetting, const char *pszError); void ReplaceAll( tstring &sSrc, const TCHAR *pszReplace, const tstring &sNew); void ReplaceAll( tstring &sSrc, const TCHAR *pszReplace, const TCHAR *pszNew); @@ -68,9 +68,9 @@ void ReplaceAll( tstring &sSrc, const TCHAR *pszReplace, const TCHAR *pszNew); void UpdateFileToColWidth(); bool bReadMirandaDirAndPath(); -tstring GetFilePathFromUser( HANDLE hContact); +tstring GetFilePathFromUser( HCONTACT hContact); -void ReplaceDefines( HANDLE hContact, tstring & sTarget); +void ReplaceDefines( HCONTACT hContact, tstring & sTarget); void ReplaceTimeVariables( tstring &sRet); bool bCreatePathToFile( tstring sFilePath); diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index e6ccc52c73..c1d12aee4e 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -62,7 +62,7 @@ HANDLE hHookedDeletedEvent; int HookedNewEvent(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; PLUGIN_DATA* pdata; //are popups currently enabled? @@ -181,7 +181,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) // 1 - Split-mode window found // 2 - Single-mode window found -int CheckMsgWnd(HANDLE hContact) +int CheckMsgWnd(HCONTACT hContact) { if (g_IsSrmmWindowAPI) { MessageWindowData mwd; diff --git a/plugins/NewEventNotify/src/neweventnotify.h b/plugins/NewEventNotify/src/neweventnotify.h index 0a32d8652f..1cc9baf2e3 100644 --- a/plugins/NewEventNotify/src/neweventnotify.h +++ b/plugins/NewEventNotify/src/neweventnotify.h @@ -193,7 +193,7 @@ struct EVENT_DATA_EX struct PLUGIN_DATA { UINT eventType; - HANDLE hContact; + HCONTACT hContact; PLUGIN_OPTIONS* pluginOptions; HWND hWnd; struct EVENT_DATA_EX* firstEventData; @@ -207,8 +207,8 @@ struct PLUGIN_DATA //--------------------------- //---External Procedure Definitions -int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UINT eventType); -int PopupUpdate(HANDLE hContact, HANDLE hEvent); +int PopupShow(PLUGIN_OPTIONS* pluginOptions, HCONTACT hContact, HANDLE hEvent, UINT eventType); +int PopupUpdate(HCONTACT hContact, HANDLE hEvent); int PopupPreview(PLUGIN_OPTIONS* pluginOptions); int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA* pdata); int OptionsInit(PLUGIN_OPTIONS* pluginOptions); @@ -216,7 +216,7 @@ int OptionsAdd(HINSTANCE hInst, WPARAM addInfo); int Opt_DisableNEN(BOOL Status); int MenuitemInit(BOOL bStatus); int MenuitemUpdate(BOOL bStatus); -int NumberPopupData(HANDLE hContact, int eventType); -int CheckMsgWnd(HANDLE hContact); +int NumberPopupData(HCONTACT hContact, int eventType); +int CheckMsgWnd(HCONTACT hContact); extern HINSTANCE hInst; diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index 026ce4897c..7ab6e944ee 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -30,7 +30,7 @@ static int PopupCount = 0; PLUGIN_DATA* PopupList[MAX_POPUPS]; -int NumberPopupData(HANDLE hContact, int eventType) +int NumberPopupData(HCONTACT hContact, int eventType) { for (int n=0; n < MAX_POPUPS; n++) { if (!PopupList[n] && !hContact && eventType == -1) @@ -369,7 +369,7 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) return TranslateTS( mir_a2t(commentFix)); } -int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UINT eventType) +int PopupShow(PLUGIN_OPTIONS* pluginOptions, HCONTACT hContact, HANDLE hEvent, UINT eventType) { TCHAR* sampleEvent; long iSeconds; @@ -486,7 +486,7 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, HANDLE hContact, HANDLE hEvent, UIN } -int PopupUpdate(HANDLE hContact, HANDLE hEvent) +int PopupUpdate(HCONTACT hContact, HANDLE hEvent) { // merge only message popups PLUGIN_DATA *pdata = (PLUGIN_DATA*)PopupList[NumberPopupData(hContact, EVENTTYPE_MESSAGE)]; diff --git a/plugins/NewXstatusNotify/src/common.h b/plugins/NewXstatusNotify/src/common.h index a779892e40..3e56ed0fb0 100644 --- a/plugins/NewXstatusNotify/src/common.h +++ b/plugins/NewXstatusNotify/src/common.h @@ -122,7 +122,7 @@ typedef struct tagPLUGINDATA } PLUGINDATA; typedef struct { - HANDLE hContact; + HCONTACT hContact; TCHAR *cust; TCHAR *oldstatusmsg; TCHAR *newstatusmsg; @@ -131,7 +131,7 @@ typedef struct { } STATUSMSGINFO; /* -HANDLE hContact = (HANDLE)wParam; +HCONTACT hContact = (HCONTACT)wParam; WORD oldStatus = LOWORD(lParam); WORD newStatus = HIWORD(lParam); oldStatus is the status the contact was before the change. diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp index 88754c3a99..c21bb6f940 100644 --- a/plugins/NewXstatusNotify/src/indsnd.cpp +++ b/plugins/NewXstatusNotify/src/indsnd.cpp @@ -107,24 +107,23 @@ HIMAGELIST GetStatusIconsImgList(char *szProto) INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - static HANDLE hContact = NULL; - switch (msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); + static HCONTACT hContact = NULL; + HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST); - hContact = (HANDLE)lParam; + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + { + hContact = (HCONTACT)lParam; char *szProto = GetContactProto(hContact); - HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST); - + ListView_SetImageList(hList, GetStatusIconsImgList(szProto), LVSIL_SMALL); ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP, LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP); - RECT rc = {0}; + RECT rc = { 0 }; GetClientRect(hList, &rc); - LV_COLUMN lvc = {0}; + LV_COLUMN lvc = { 0 }; lvc.mask = LVCF_WIDTH | LVCF_TEXT; lvc.cx = STATUS_COLUMN; lvc.pszText = TranslateT("Status"); @@ -134,20 +133,17 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA lvc.pszText = TranslateT("Sound for the status"); ListView_InsertColumn(hList, 1, &lvc); - if (szProto) - { + if (szProto) { DBVARIANT dbv; TCHAR buff[MAX_PATH]; - for (int i = ID_STATUS_MAX; i >= ID_STATUS_MIN; i--) - { + for (int i = ID_STATUS_MAX; i >= ID_STATUS_MIN; i--) { int flags = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0); - if (flags == 0) - flags = PF2_ONLINE|PF2_INVISIBLE|PF2_SHORTAWAY|PF2_LONGAWAY|PF2_LIGHTDND|PF2_HEAVYDND|PF2_FREECHAT|PF2_OUTTOLUNCH|PF2_ONTHEPHONE; - - if ((flags & Proto_Status2Flag(i)) || i == ID_STATUS_OFFLINE) - { - LV_ITEM lvi = {0}; + if (flags == 0) + flags = PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE; + + if ((flags & Proto_Status2Flag(i)) || i == ID_STATUS_OFFLINE) { + LV_ITEM lvi = { 0 }; lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE; lvi.iItem = 0; lvi.iSubItem = 0; @@ -156,8 +152,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA lvi.pszText = TranslateTS(StatusList[Index(i)].lpzStandardText); lvi.iItem = ListView_InsertItem(hList, &lvi); - if (!db_get_ts(hContact, MODULE, StatusList[Index(i)].lpzSkinSoundName, &dbv)) - { + if (!db_get_ts(hContact, MODULE, StatusList[Index(i)].lpzSkinSoundName, &dbv)) { _tcscpy(buff, dbv.ptszVal); db_free(&dbv); } @@ -168,7 +163,7 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } } - LV_ITEM lvi = {0}; + LV_ITEM lvi = { 0 }; lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE; lvi.iItem = 0; lvi.iSubItem = 0; @@ -177,148 +172,119 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA lvi.pszText = TranslateT("From offline"); lvi.iItem = ListView_InsertItem(hList, &lvi); - if (!db_get_ts(hContact, MODULE, "UserFromOffline", &dbv)) - { + if (!db_get_ts(hContact, MODULE, "UserFromOffline", &dbv)) { _tcscpy(buff, dbv.ptszVal); db_free(&dbv); } - else - _tcscpy(buff, TranslateT(DEFAULT_SOUND)); + else _tcscpy(buff, TranslateT(DEFAULT_SOUND)); ListView_SetItemText(hList, lvi.iItem, 1, buff); } CheckDlgButton(hwndDlg, IDC_CHECK_NOTIFYSOUNDS, db_get_b(hContact, MODULE, "EnableSounds", 1)); - CheckDlgButton(hwndDlg, IDC_CHECK_NOTIFYPOPUPS, db_get_b(hContact, MODULE, "EnablePopups", 1)); - + CheckDlgButton(hwndDlg, IDC_CHECK_NOTIFYPOPUPS, db_get_b(hContact, MODULE, "EnablePopups", 1)); + ShowWindow(GetDlgItem(hwndDlg, IDC_INDSNDLIST), opt.UseIndSnd ? SW_SHOW : SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_TEXT_ENABLE_IS), opt.UseIndSnd ? SW_HIDE : SW_SHOW); ShowWindow(GetDlgItem(hwndDlg, IDC_CHANGE), opt.UseIndSnd ? SW_SHOW : SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_PREVIEW), opt.UseIndSnd ? SW_SHOW : SW_HIDE); ShowWindow(GetDlgItem(hwndDlg, IDC_DELETE), opt.UseIndSnd ? SW_SHOW : SW_HIDE); - - return TRUE; } - case WM_COMMAND: - { - switch (LOWORD(wParam)) + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_PREVIEW: + if (ListView_GetSelectionMark(hList) != -1) + PreviewSound(hList); + break; + + case IDC_CHANGE: { - case IDC_PREVIEW: - { - HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST); - if (ListView_GetSelectionMark(hList) != -1) - PreviewSound(hList); - break; - } - case IDC_CHANGE: - { - HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST); - int iSel = ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_INDSNDLIST), -1, LVNI_SELECTED); - if (iSel != -1) - { - TCHAR stzFilePath[MAX_PATH]; - if (SelectSound(hwndDlg, stzFilePath) != NULL) - { - iSel = -1; - while ((iSel = ListView_GetNextItem(hList, iSel, LVNI_SELECTED)) != -1) - ListView_SetItemText(hList, iSel, 1, stzFilePath); + int iSel = ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_INDSNDLIST), -1, LVNI_SELECTED); + if (iSel != -1) { + TCHAR stzFilePath[MAX_PATH]; + if (SelectSound(hwndDlg, stzFilePath) != NULL) { + iSel = -1; + while ((iSel = ListView_GetNextItem(hList, iSel, LVNI_SELECTED)) != -1) + ListView_SetItemText(hList, iSel, 1, stzFilePath); - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - } - break; - } - case IDC_DELETE: - { - HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST); - if (ListView_GetSelectionMark(hList) != -1) - { - if (RemoveSoundFromList(GetDlgItem(hwndDlg, IDC_INDSNDLIST))) - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } - break; - } - case IDC_CHECK_NOTIFYSOUNDS: - { - db_set_b(hContact, MODULE, "EnableSounds", IsDlgButtonChecked(hwndDlg, IDC_CHECK_NOTIFYSOUNDS) ? 1 : 0); - break; } - case IDC_CHECK_NOTIFYPOPUPS: - { - db_set_b(hContact, MODULE, "EnablePopups", IsDlgButtonChecked(hwndDlg, IDC_CHECK_NOTIFYPOPUPS) ? 1 : 0); - break; - } - } + } + break; + case IDC_DELETE: + if (ListView_GetSelectionMark(hList) != -1) + if (RemoveSoundFromList(GetDlgItem(hwndDlg, IDC_INDSNDLIST))) + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + + case IDC_CHECK_NOTIFYSOUNDS: + db_set_b(hContact, MODULE, "EnableSounds", IsDlgButtonChecked(hwndDlg, IDC_CHECK_NOTIFYSOUNDS) ? 1 : 0); + break; + + case IDC_CHECK_NOTIFYPOPUPS: + db_set_b(hContact, MODULE, "EnablePopups", IsDlgButtonChecked(hwndDlg, IDC_CHECK_NOTIFYPOPUPS) ? 1 : 0); break; } - case WM_NOTIFY: - { - LPNMHDR pParam = (LPNMHDR)lParam; - if (pParam->code == PSN_APPLY) - { - TCHAR buff[MAX_PATH]; - HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST); + break; - LVITEM lvi = {0}; - lvi.mask = LVIF_PARAM; - //Cycle through the list reading the text associated to each status. - for (lvi.iItem = ListView_GetItemCount(hList) - 1; lvi.iItem >= 0; lvi.iItem--) - { - ListView_GetItem(hList, &lvi); - ListView_GetItemText(hList, lvi.iItem, 1, buff, SIZEOF(buff)); + case WM_NOTIFY: + if (((LPNMHDR)lParam)->code == PSN_APPLY) { + TCHAR buff[MAX_PATH]; + HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST); - if (!_tcscmp(buff, TranslateT(DEFAULT_SOUND))) - { - if (lvi.lParam == ID_STATUS_FROMOFFLINE) - db_unset(hContact, MODULE, "UserFromOffline"); - else - db_unset(hContact, MODULE, StatusList[Index(lvi.lParam)].lpzSkinSoundName); - } - else - { - TCHAR stzSoundPath[MAX_PATH] = { 0 }; - PathToRelativeT(buff, stzSoundPath); - if (lvi.lParam == ID_STATUS_FROMOFFLINE) - db_set_ws(hContact, MODULE, "UserFromOffline", stzSoundPath); - else - db_set_ws(hContact, MODULE, StatusList[Index(lvi.lParam)].lpzSkinSoundName, stzSoundPath); - } + LVITEM lvi = { 0 }; + lvi.mask = LVIF_PARAM; + //Cycle through the list reading the text associated to each status. + for (lvi.iItem = ListView_GetItemCount(hList) - 1; lvi.iItem >= 0; lvi.iItem--) { + ListView_GetItem(hList, &lvi); + ListView_GetItemText(hList, lvi.iItem, 1, buff, SIZEOF(buff)); + + if (!_tcscmp(buff, TranslateT(DEFAULT_SOUND))) { + if (lvi.lParam == ID_STATUS_FROMOFFLINE) + db_unset(hContact, MODULE, "UserFromOffline"); + else + db_unset(hContact, MODULE, StatusList[Index(lvi.lParam)].lpzSkinSoundName); + } + else { + TCHAR stzSoundPath[MAX_PATH] = { 0 }; + PathToRelativeT(buff, stzSoundPath); + if (lvi.lParam == ID_STATUS_FROMOFFLINE) + db_set_ws(hContact, MODULE, "UserFromOffline", stzSoundPath); + else + db_set_ws(hContact, MODULE, StatusList[Index(lvi.lParam)].lpzSkinSoundName, stzSoundPath); } - - return TRUE; } - int hlpControlID = (int)wParam; - switch (hlpControlID) - { - case IDC_INDSNDLIST: - { - if (pParam->code == NM_DBLCLK) - { - TCHAR stzFilePath[MAX_PATH]; - if (SelectSound(hwndDlg, stzFilePath) != NULL) - { - int iSel = -1; - HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST); - while ((iSel = ListView_GetNextItem(hList, iSel, LVNI_SELECTED)) != -1) - ListView_SetItemText(hList, iSel, 1, stzFilePath); + return TRUE; + } - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - return TRUE; - } - else if (pParam->code == LVN_KEYDOWN) - { - LPNMLVKEYDOWN pnkd = (LPNMLVKEYDOWN)lParam; - if (pnkd->wVKey == VK_DELETE) - RemoveSoundFromList(GetDlgItem(hwndDlg, IDC_INDSNDLIST)); - } + int hlpControlID = (int)wParam; + switch (hlpControlID) { + case IDC_INDSNDLIST: + if (((LPNMHDR)lParam)->code == NM_DBLCLK) { + TCHAR stzFilePath[MAX_PATH]; + if (SelectSound(hwndDlg, stzFilePath) != NULL) { + int iSel = -1; + HWND hList = GetDlgItem(hwndDlg, IDC_INDSNDLIST); + while ((iSel = ListView_GetNextItem(hList, iSel, LVNI_SELECTED)) != -1) + ListView_SetItemText(hList, iSel, 1, stzFilePath); - break; + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } + return TRUE; + } + else if (((LPNMHDR)lParam)->code == LVN_KEYDOWN) { + LPNMLVKEYDOWN pnkd = (LPNMLVKEYDOWN)lParam; + if (pnkd->wVKey == VK_DELETE) + RemoveSoundFromList(GetDlgItem(hwndDlg, IDC_INDSNDLIST)); } + break; } + break; } return FALSE; } @@ -365,7 +331,7 @@ void SetAllContactsIcons(HWND hwndList) { BYTE EnableSounds, EnablePopups, EnableXStatus, EnableLogging; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) { char *szProto = GetContactProto(hContact); @@ -604,7 +570,7 @@ INT_PTR CALLBACK DlgProcFiltering(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hList, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) { if (GetExtraImage(hList, hItem, EXTRA_IMAGE_SOUND) == EXTRA_IMAGE_SOUND) diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 3c01e6802a..5616832ce7 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -60,7 +60,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_USERONLINE, MIID_LAST}; -BYTE GetGender(HANDLE hContact) +BYTE GetGender(HCONTACT hContact) { char *szProto =GetContactProto(hContact); if (szProto) { @@ -84,7 +84,7 @@ HANDLE GetIconHandle(char *szIcon) return Skin_GetIconHandle(szSettingName); } -bool IsNewExtraStatus(HANDLE hContact, char *szSetting, TCHAR *newStatusTitle) +bool IsNewExtraStatus(HCONTACT hContact, char *szSetting, TCHAR *newStatusTitle) { DBVARIANT dbv; bool result = true; @@ -97,7 +97,7 @@ bool IsNewExtraStatus(HANDLE hContact, char *szSetting, TCHAR *newStatusTitle) return result; } -int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) +int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, HCONTACT hContact) { XSTATUSCHANGE *xsc; char *szProto = GetContactProto(hContact); @@ -408,12 +408,12 @@ TCHAR* GetStr(STATUSMSGINFO *n, const TCHAR *tmplt) return str; } -bool SkipHiddenContact(HANDLE hContact) +bool SkipHiddenContact(HCONTACT hContact) { return (!opt.HiddenContactsToo && (db_get_b(hContact, "CList", "Hidden", 0) == 1)); } -int ProcessStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) +int ProcessStatus(DBCONTACTWRITESETTING *cws, HCONTACT hContact) { if ( !strcmp(cws->szSetting, "Status")) { WORD newStatus = cws->value.wVal; @@ -543,7 +543,7 @@ int ProcessStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact) int ContactSettingChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; @@ -612,7 +612,7 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam) return 0; } -void ShowStatusChangePopup(HANDLE hContact, char *szProto, WORD oldStatus, WORD newStatus) +void ShowStatusChangePopup(HCONTACT hContact, char *szProto, WORD oldStatus, WORD newStatus) { TCHAR stzStatusText[MAX_SECONDLINE] = {0}; WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0); @@ -686,7 +686,7 @@ void ShowStatusChangePopup(HANDLE hContact, char *szProto, WORD oldStatus, WORD PUAddPopupT(&ppd); } -void BlinkIcon(HANDLE hContact, char* szProto, WORD status) +void BlinkIcon(HCONTACT hContact, char* szProto, WORD status) { CLISTEVENT cle = {0}; TCHAR stzTooltip[256]; @@ -704,7 +704,7 @@ void BlinkIcon(HANDLE hContact, char* szProto, WORD status) CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); } -void PlayChangeSound(HANDLE hContact, WORD oldStatus, WORD newStatus) +void PlayChangeSound(HCONTACT hContact, WORD oldStatus, WORD newStatus) { DBVARIANT dbv; if (opt.UseIndSnd) { @@ -751,7 +751,7 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) { WORD oldStatus = LOWORD(lParam); WORD newStatus = HIWORD(lParam); - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; bool bEnablePopup = true, bEnableSound = true; char *hlpProto = GetContactProto(hContact); @@ -777,7 +777,7 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) } if (strcmp(szProto, szMetaModuleName) == 0) { //this contact is Meta - HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + HCONTACT hSubContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); hlpProto = GetContactProto(hSubContact); if (hlpProto == NULL) return 0; diff --git a/plugins/NewXstatusNotify/src/popup.cpp b/plugins/NewXstatusNotify/src/popup.cpp index 211b4f6956..2a35c7f8ed 100644 --- a/plugins/NewXstatusNotify/src/popup.cpp +++ b/plugins/NewXstatusNotify/src/popup.cpp @@ -38,7 +38,7 @@ static int AwayMsgHook(WPARAM wParam, LPARAM lParam, LPARAM pObj) if (ack->result != ACKRESULT_SUCCESS) return 0; - HANDLE hContact = PUGetContact(pdp->hWnd); + HCONTACT hContact = PUGetContact(pdp->hWnd); ptrT pstzLast( db_get_tsa(hContact, MODULE, "LastPopupText")); TCHAR *tszStatus = (TCHAR*)ack->lParam; @@ -58,7 +58,7 @@ static int AwayMsgHook(WPARAM wParam, LPARAM lParam, LPARAM pObj) void QueryAwayMessage(HWND hWnd, PLUGINDATA *pdp) { - HANDLE hContact = PUGetContact(hWnd); + HCONTACT hContact = PUGetContact(hWnd); char *szProto = GetContactProto(hContact); if (szProto) { @@ -76,7 +76,7 @@ void QueryAwayMessage(HWND hWnd, PLUGINDATA *pdp) void PopupAction(HWND hWnd, BYTE action) { - HANDLE hContact = PUGetContact(hWnd); + HCONTACT hContact = PUGetContact(hWnd); if (hContact && hContact != INVALID_HANDLE_VALUE) { switch (action) { case PCA_OPENMESSAGEWND: diff --git a/plugins/NewXstatusNotify/src/utils.cpp b/plugins/NewXstatusNotify/src/utils.cpp index ecbcb36a79..7e1f988ab1 100644 --- a/plugins/NewXstatusNotify/src/utils.cpp +++ b/plugins/NewXstatusNotify/src/utils.cpp @@ -39,7 +39,7 @@ TCHAR *db2t(DBVARIANT *dbv) return buff; } -int DBGetStringDefault(HANDLE hContact, const char *szModule, const char *szSetting, TCHAR *setting, int size, const TCHAR *defaultValue) +int DBGetStringDefault(HCONTACT hContact, const char *szModule, const char *szSetting, TCHAR *setting, int size, const TCHAR *defaultValue) { DBVARIANT dbv; if ( !db_get_ts(hContact, szModule, szSetting, &dbv)) { diff --git a/plugins/NewXstatusNotify/src/utils.h b/plugins/NewXstatusNotify/src/utils.h index 384b01c511..55e97a0ddc 100644 --- a/plugins/NewXstatusNotify/src/utils.h +++ b/plugins/NewXstatusNotify/src/utils.h @@ -23,7 +23,7 @@ #define UTILS_H TCHAR *db2t(DBVARIANT *dbv); -int DBGetStringDefault(HANDLE hContact, const char *szModule, const char *szSetting, TCHAR *setting, int size, const TCHAR *defaultValue); +int DBGetStringDefault(HCONTACT hContact, const char *szModule, const char *szSetting, TCHAR *setting, int size, const TCHAR *defaultValue); void HigherLower(int maxValue, int minValue); void ShowLog(TCHAR *file); BOOL StatusHasAwayMessage(char *szProto, int status); diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 1ca031ac7a..e1d6313bb1 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -19,7 +19,7 @@ #include "common.h" -XSTATUSCHANGE *NewXSC(HANDLE hContact, char *szProto, int xstatusType, int action, TCHAR *stzTitle, TCHAR *stzText) +XSTATUSCHANGE *NewXSC(HCONTACT hContact, char *szProto, int xstatusType, int action, TCHAR *stzTitle, TCHAR *stzText) { XSTATUSCHANGE *xsc = (XSTATUSCHANGE *)mir_alloc(sizeof(XSTATUSCHANGE)); xsc->hContact = hContact; @@ -41,7 +41,7 @@ void FreeXSC(XSTATUSCHANGE *xsc) } } -void RemoveLoggedEvents(HANDLE hContact) +void RemoveLoggedEvents(HCONTACT hContact) { for (int i = eventList.getCount()-1; i >= 0; i--) { DBEVENT *dbevent = eventList[i]; @@ -351,7 +351,7 @@ TCHAR *GetDefaultXstatusName(int statusID, char *szProto, TCHAR *buff, int buffl return buff; } -TCHAR *GetIcqXStatus(HANDLE hContact, char *szProto, char *szValue, TCHAR *buff, int bufflen) +TCHAR *GetIcqXStatus(HCONTACT hContact, char *szProto, char *szValue, TCHAR *buff, int bufflen) { DBVARIANT dbv; buff[0] = 0; @@ -372,7 +372,7 @@ TCHAR *GetIcqXStatus(HANDLE hContact, char *szProto, char *szValue, TCHAR *buff, return buff; } -TCHAR *GetJabberAdvStatusText(HANDLE hContact, char *szProto, char *szSlot, char *szValue, TCHAR *buff, int bufflen) +TCHAR *GetJabberAdvStatusText(HCONTACT hContact, char *szProto, char *szSlot, char *szValue, TCHAR *buff, int bufflen) { DBVARIANT dbv; char szSetting[128]; @@ -388,7 +388,7 @@ TCHAR *GetJabberAdvStatusText(HANDLE hContact, char *szProto, char *szSlot, char return buff; } -void LogXstatusChange(HANDLE hContact, char *szProto, int xstatusType, TCHAR *stzTitle, TCHAR *stzText) +void LogXstatusChange(HCONTACT hContact, char *szProto, int xstatusType, TCHAR *stzTitle, TCHAR *stzText) { XSTATUSCHANGE *xsc = NewXSC( @@ -406,7 +406,7 @@ void LogXstatusChange(HANDLE hContact, char *szProto, int xstatusType, TCHAR *st void AddEventThread(void *arg) { - HANDLE hContact = (HANDLE)arg; + HCONTACT hContact = (HCONTACT)arg; TCHAR stzTitle[MAX_TITLE_LEN], stzText[MAX_TEXT_LEN]; char *szProto = GetContactProto(hContact); diff --git a/plugins/NewXstatusNotify/src/xstatus.h b/plugins/NewXstatusNotify/src/xstatus.h index 5468d2c5ff..b5ba28e71f 100644 --- a/plugins/NewXstatusNotify/src/xstatus.h +++ b/plugins/NewXstatusNotify/src/xstatus.h @@ -75,7 +75,7 @@ typedef struct tagXSTATUSCHANGE { - HANDLE hContact; + HCONTACT hContact; char *szProto; int type; int action; @@ -85,7 +85,7 @@ typedef struct tagXSTATUSCHANGE typedef struct tagDBEVENT { - HANDLE hContact; + HCONTACT hContact; HANDLE hDBEvent; } DBEVENT; @@ -96,7 +96,7 @@ typedef struct tagPROTOTEMPLATE } PROTOTEMPLATE; TCHAR *GetDefaultXstatusName(int statusID, char *szProto, TCHAR *buff, int bufflen); -XSTATUSCHANGE *NewXSC(HANDLE hContact, char *szProto, int xstatusType, int action, TCHAR *stzTitle, TCHAR *stzText); +XSTATUSCHANGE *NewXSC(HCONTACT hContact, char *szProto, int xstatusType, int action, TCHAR *stzTitle, TCHAR *stzText); void ExtraStatusChanged(XSTATUSCHANGE *xsc); void FreeXSC(XSTATUSCHANGE *xsc); int OnWindowEvent(WPARAM wParam, LPARAM lParam); diff --git a/plugins/New_GPG/src/clist.cpp b/plugins/New_GPG/src/clist.cpp index 4533a464c2..9a2322023d 100644 --- a/plugins/New_GPG/src/clist.cpp +++ b/plugins/New_GPG/src/clist.cpp @@ -17,7 +17,6 @@ #include "commonheaders.h" void RefreshContactListIcons(void); -void setClistIcon(HANDLE); int onExtraImageListRebuilding(WPARAM, LPARAM) { @@ -27,6 +26,6 @@ int onExtraImageListRebuilding(WPARAM, LPARAM) int onExtraImageApplying(WPARAM wParam, LPARAM) { - setClistIcon((HANDLE)wParam); + setClistIcon((HCONTACT)wParam); return 0; } diff --git a/plugins/New_GPG/src/globals.h b/plugins/New_GPG/src/globals.h index 9942e16e96..744bcad389 100644 --- a/plugins/New_GPG/src/globals.h +++ b/plugins/New_GPG/src/globals.h @@ -19,4 +19,12 @@ extern bool bAppendTags, bPresenceSigning, bStripTags, gpg_valid, gpg_keyexist, tabsrmm_used, bSameAction, bFileTransfers, bDebugLog; extern TCHAR *inopentag, *inclosetag, *outopentag, *outclosetag; extern logtofile debuglog; + +extern map user_data; +extern int item_num; + +extern bool _terminate; +extern wstring new_key; +extern HCONTACT new_key_hcnt; +extern boost::mutex new_key_hcnt_mutex; #endif diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp index 4c7b100023..65ddc26b0a 100644 --- a/plugins/New_GPG/src/icons.cpp +++ b/plugins/New_GPG/src/icons.cpp @@ -44,11 +44,11 @@ HANDLE IconLibHookIconsChanged(MIRANDAHOOK hook) return HookEvent(ME_SKIN2_ICONSCHANGED, hook); } -void setClistIcon(HANDLE hContact) +void setClistIcon(HCONTACT hContact) { bool enabled = isContactSecured(hContact); extern HANDLE g_hCLIcon; - HANDLE hMC = hContact; + HCONTACT hMC = hContact; if(metaIsSubcontact(hContact)) hMC = metaGetContact(hContact); else if(metaIsProtoMetaContacts(hContact)) @@ -59,11 +59,11 @@ void setClistIcon(HANDLE hContact) ExtraIcon_SetIcon(g_hCLIcon, hMC, szIconId); } -void setSrmmIcon(HANDLE h) +void setSrmmIcon(HCONTACT h) { - HANDLE hContact = metaIsProtoMetaContacts(h)?metaGetMostOnline(h):h; + HCONTACT hContact = metaIsProtoMetaContacts(h) ? metaGetMostOnline(h) : h; bool enabled = isContactSecured(hContact); - HANDLE hMC = NULL; + HCONTACT hMC = NULL; if(metaIsSubcontact(hContact)) hMC = metaGetContact(hContact); else if(metaIsProtoMetaContacts(hContact)) @@ -91,7 +91,7 @@ void RefreshContactListIcons() { CallService(MS_CLUI_LISTBEGINREBUILD,0,0); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) setClistIcon(hContact); CallService(MS_CLUI_LISTENDREBUILD,0,0); diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 5f1b61f782..2230a26ebd 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -362,7 +362,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } delete [] name; } - bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange"); + bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange") != 0; gpg_valid = isGPGValid(); gpg_keyexist = isGPGKeyExist(); DestroyWindow(hwndDlg); @@ -370,8 +370,6 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR case IDC_OTHER: { void ShowLoadPublicKeyDialog(); - extern map user_data; - extern int item_num; item_num = 0; //black magic here user_data[1] = 0; ShowLoadPublicKeyDialog(); @@ -1247,7 +1245,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, SetWindowText(hwndCurKey_p, path.c_str()); } } - bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange"); + bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange") != 0; gpg_valid = true; db_set_b(NULL, szGPGModuleName, "FirstRun", 0); DestroyWindow(hwndDlg); @@ -1283,84 +1281,68 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - extern HANDLE new_key_hcnt; - extern boost::mutex new_key_hcnt_mutex; - static HANDLE hContact = INVALID_HANDLE_VALUE; + static HCONTACT hContact = (HCONTACT)INVALID_HANDLE_VALUE; void ImportKey(); TCHAR *tmp = NULL; - switch (msg) - { - case WM_INITDIALOG: - { - hContact = new_key_hcnt; - //new_key_hcnt_mutex.unlock(); - SetWindowPos(hwndDlg, 0, new_key_rect.left, new_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); - TranslateDialogDefault(hwndDlg); - TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); - SetDlgItemText(hwndDlg, IDC_MESSAGE, tmp[0]?TranslateT("There is existing key for contact, would you like to replace it with new key?"):TranslateT("New public key was received, do you want to import it?")); - EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT_AND_USE), db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0)?0:1); - SetDlgItemText(hwndDlg, ID_IMPORT, tmp[0]?TranslateT("Replace"):TranslateT("Accept")); - mir_free(tmp); - tmp = new TCHAR [256]; - _tcscpy(tmp, TranslateT("Received key from ")); - _tcscat(tmp, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, (LPARAM)GCDNF_TCHAR)); - SetDlgItemText(hwndDlg, IDC_KEY_FROM, tmp); - delete [] tmp; - return TRUE; - } - - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case ID_IMPORT: - ImportKey(); - DestroyWindow(hwndDlg); - break; - case IDC_IMPORT_AND_USE: - ImportKey(); - db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1); - void setSrmmIcon(HANDLE hContact); - void setClistIcon(HANDLE hContact); - setSrmmIcon(hContact); - setClistIcon(hContact); - DestroyWindow(hwndDlg); - break; - case IDC_IGNORE_KEY: - DestroyWindow(hwndDlg); - break; - default: + switch (msg) + { + case WM_INITDIALOG: + { + hContact = new_key_hcnt; + //new_key_hcnt_mutex.unlock(); + SetWindowPos(hwndDlg, 0, new_key_rect.left, new_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); + TranslateDialogDefault(hwndDlg); + TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); + SetDlgItemText(hwndDlg, IDC_MESSAGE, tmp[0]?TranslateT("There is existing key for contact, would you like to replace it with new key?"):TranslateT("New public key was received, do you want to import it?")); + EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT_AND_USE), db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0)?0:1); + SetDlgItemText(hwndDlg, ID_IMPORT, tmp[0]?TranslateT("Replace"):TranslateT("Accept")); + mir_free(tmp); + tmp = new TCHAR [256]; + _tcscpy(tmp, TranslateT("Received key from ")); + _tcscat(tmp, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, (LPARAM)GCDNF_TCHAR)); + SetDlgItemText(hwndDlg, IDC_KEY_FROM, tmp); + delete [] tmp; + } + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case ID_IMPORT: + ImportKey(); + DestroyWindow(hwndDlg); + break; + case IDC_IMPORT_AND_USE: + ImportKey(); + db_set_b(hContact, szGPGModuleName, "GPGEncryption", 1); + void setSrmmIcon(HCONTACT hContact); + void setClistIcon(HCONTACT hContact); + setSrmmIcon(hContact); + setClistIcon(hContact); + DestroyWindow(hwndDlg); + break; + case IDC_IGNORE_KEY: + DestroyWindow(hwndDlg); + break; + } break; - } - - break; - } - - case WM_NOTIFY: - { -/* switch (((LPNMHDR)lParam)->code) - { - default: - break; - }*/ - } - break; - case WM_CLOSE: - DestroyWindow(hwndDlg); - break; - case WM_DESTROY: - { - GetWindowRect(hwndDlg, &new_key_rect); - db_set_dw(NULL, szGPGModuleName, "NewKeyWindowX", new_key_rect.left); - db_set_dw(NULL, szGPGModuleName, "NewKeyWindowY", new_key_rect.top); - } - hwndNewKey = NULL; - break; - } - return FALSE; + case WM_CLOSE: + DestroyWindow(hwndDlg); + break; + + case WM_DESTROY: + { + GetWindowRect(hwndDlg, &new_key_rect); + db_set_dw(NULL, szGPGModuleName, "NewKeyWindowX", new_key_rect.left); + db_set_dw(NULL, szGPGModuleName, "NewKeyWindowY", new_key_rect.top); + } + hwndNewKey = NULL; + break; + + } + return FALSE; } + static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) @@ -1914,84 +1896,61 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wPar return FALSE; } + static INT_PTR CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - extern HANDLE new_key_hcnt; - extern boost::mutex new_key_hcnt_mutex; - HANDLE hContact = INVALID_HANDLE_VALUE; - switch (msg) - { - case WM_INITDIALOG: - { - hContact = new_key_hcnt; - new_key_hcnt_mutex.unlock(); - SetWindowPos(hwndDlg, 0 , import_key_rect.left, import_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); - TranslateDialogDefault(hwndDlg); - ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), _T("subkeys.pgp.net"), 0); - ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), _T("keys.gnupg.net"), 0); - return TRUE; - } - - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_IMPORT: - { - string out; - DWORD code; - std::vector cmd; - cmd.push_back(L"--keyserver"); - TCHAR *server= new TCHAR [128]; - GetDlgItemText(hwndDlg, IDC_KEYSERVER, server, 128); - cmd.push_back(server); - delete [] server; - cmd.push_back(L"--recv-keys"); -// char *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID_Prescense", ""); -// TCHAR *tmp2 = mir_a2t(tmp); -// mir_free(tmp); - cmd.push_back(toUTF16(hcontact_data[hContact].key_in_prescense)); -// mir_free(tmp2); - gpg_execution_params params(cmd); - pxResult result; - params.out = &out; - params.code = &code; - params.result = &result; - gpg_launcher(params); - MessageBoxA(0, out.c_str(), "GPG output", MB_OK); - } - break; - default: + HCONTACT hContact = (HCONTACT)INVALID_HANDLE_VALUE; + + switch (msg) { + case WM_INITDIALOG: + { + hContact = new_key_hcnt; + new_key_hcnt_mutex.unlock(); + SetWindowPos(hwndDlg, 0 , import_key_rect.left, import_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); + TranslateDialogDefault(hwndDlg); + ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), _T("subkeys.pgp.net"), 0); + ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), _T("keys.gnupg.net"), 0); + } + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_IMPORT: + { + string out; + DWORD code; + std::vector cmd; + cmd.push_back(L"--keyserver"); + TCHAR *server= new TCHAR [128]; + GetDlgItemText(hwndDlg, IDC_KEYSERVER, server, 128); + cmd.push_back(server); + delete [] server; + cmd.push_back(L"--recv-keys"); + cmd.push_back(toUTF16(hcontact_data[hContact].key_in_prescense)); + gpg_execution_params params(cmd); + pxResult result; + params.out = &out; + params.code = &code; + params.result = &result; + gpg_launcher(params); + MessageBoxA(0, out.c_str(), "GPG output", MB_OK); + } + break; + } break; - } - break; - } - - case WM_NOTIFY: - { -/* switch (((LPNMHDR)lParam)->code) - { - default: - break; - } */ - } - break; - case WM_CLOSE: - DestroyWindow(hwndDlg); - break; - case WM_DESTROY: - { - GetWindowRect(hwndDlg, &import_key_rect); - db_set_dw(NULL, szGPGModuleName, "ImportKeyWindowX", import_key_rect.left); - db_set_dw(NULL, szGPGModuleName, "ImportKeyWindowY", import_key_rect.top); - } - break; - } - return FALSE; -} + case WM_CLOSE: + DestroyWindow(hwndDlg); + break; + case WM_DESTROY: + GetWindowRect(hwndDlg, &import_key_rect); + db_set_dw(NULL, szGPGModuleName, "ImportKeyWindowX", import_key_rect.left); + db_set_dw(NULL, szGPGModuleName, "ImportKeyWindowY", import_key_rect.top); + break; + } + return FALSE; +} extern HINSTANCE hInst; @@ -2315,10 +2274,7 @@ void InitCheck() void ImportKey() { - extern wstring new_key; - extern HANDLE new_key_hcnt; - extern boost::mutex new_key_hcnt_mutex; - HANDLE hContact = new_key_hcnt; + HCONTACT hContact = new_key_hcnt; new_key_hcnt_mutex.unlock(); bool for_all_sub = false; if(metaIsProtoMetaContacts(hContact)) @@ -2326,13 +2282,12 @@ void ImportKey() for_all_sub = true; if(metaIsProtoMetaContacts(hContact)) { - HANDLE hcnt = NULL; if(for_all_sub) { int count = metaGetContactsNum(hContact); for(int i = 0; i < count; i++) { - hcnt = metaGetSubcontact(hContact, i); + HCONTACT hcnt = metaGetSubcontact(hContact, i); if(hcnt) db_set_ts(hcnt, szGPGModuleName, "GPGPubKey", new_key.c_str()); } @@ -2381,13 +2336,12 @@ void ImportKey() { if(metaIsProtoMetaContacts(hContact)) { - HANDLE hcnt = NULL; if(for_all_sub) { int count = metaGetContactsNum(hContact); for(int i = 0; i < count; i++) { - hcnt = metaGetSubcontact(hContact, i); + HCONTACT hcnt = metaGetSubcontact(hContact, i); if(hcnt) { char *tmp = NULL; diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index cff898dae5..b9deb63655 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -18,14 +18,14 @@ wstring new_key; -HANDLE new_key_hcnt = NULL; +HCONTACT new_key_hcnt = NULL; boost::mutex new_key_hcnt_mutex; bool _terminate = false; -int returnNoError(HANDLE hContact); +int returnNoError(HCONTACT hContact); std::list sent_msgs; -void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, DWORD timestamp) +void RecvMsgSvc_func(HCONTACT hContact, std::wstring str, char *msg, DWORD flags, DWORD timestamp) { DWORD dbflags = DBEF_UTF; { //check for gpg related data @@ -35,9 +35,6 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, s2 = str.find(_T("-----END PGP MESSAGE-----")); if((s2 != wstring::npos) && (s1 != wstring::npos)) { //this is generic encrypted data block - void setSrmmIcon(HANDLE); - void setClistIcon(HANDLE); - bool isContactHaveKey(HANDLE hContact); if(!isContactSecured(hContact)) { if(bDebugLog) @@ -47,8 +44,6 @@ void RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, if(!isContactHaveKey(hContact)) { void ShowLoadPublicKeyDialog(); - extern map user_data; - extern int item_num; item_num = 0; //black magic here user_data[1] = hContact; ShowLoadPublicKeyDialog(); @@ -601,11 +596,11 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) } if(!strstr(msg, "-----BEGIN PGP MESSAGE-----")) return CallService(MS_PROTO_CHAINRECV, w, l); - boost::thread *thr = new boost::thread(boost::bind(RecvMsgSvc_func, ccs->hContact, str, msg, ccs->wParam, pre->timestamp)); + boost::thread *thr = new boost::thread(boost::bind(RecvMsgSvc_func, ccs->hContact, str, msg, (DWORD)ccs->wParam, pre->timestamp)); return 0; } -void SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) +void SendMsgSvc_func(HCONTACT hContact, char *msg, DWORD flags) { bool isansi = false; DWORD dbflags = 0; @@ -845,7 +840,7 @@ int HookSendMsg(WPARAM w, LPARAM l) DBEVENTINFO * dbei = (DBEVENTINFO*)l; if(dbei->eventType != EVENTTYPE_MESSAGE) return 0; - HANDLE hContact = (HANDLE)w; + HCONTACT hContact = (HCONTACT)w; if(dbei->flags & DBEF_SENT) { if(isContactSecured(hContact) && strstr((char*)dbei->pBlob, "-----BEGIN PGP MESSAGE-----")) //our service data, can be double added by metacontacts e.t.c. @@ -872,7 +867,6 @@ int HookSendMsg(WPARAM w, LPARAM l) { if(bDebugLog) debuglog<pBlob+"\" passed event filter, contact "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR))+" is unsecured"); return 0; } - if(!(dbei->flags & DBEF_SENT) && metaIsProtoMetaContacts((HANDLE)w)) + if(!(dbei->flags & DBEF_SENT) && metaIsProtoMetaContacts((HCONTACT)w)) { char tmp[29]; strncpy(tmp, (char*)dbei->pBlob, 27); @@ -1013,94 +1007,77 @@ int HookSendMsg(WPARAM w, LPARAM l) static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { char *inkeyid = NULL; - switch (msg) - { - case WM_INITDIALOG: - { - inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", ""); - new_key_hcnt_mutex.unlock(); - TCHAR *tmp = NULL; + switch (msg) + { + case WM_INITDIALOG: + { + inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", ""); + new_key_hcnt_mutex.unlock(); + TCHAR *tmp = NULL; - SetWindowPos(hwndDlg, 0, key_password_rect.left, key_password_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); - TranslateDialogDefault(hwndDlg); - string questionstr = "Please enter password for key with ID: "; - questionstr += inkeyid; - mir_free(inkeyid); - SetDlgItemTextA(hwndDlg, IDC_KEYID, questionstr.c_str()); - EnableWindow(GetDlgItem(hwndDlg, IDC_DEFAULT_PASSWORD), 0); - return TRUE; - } - - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDOK: - { - TCHAR tmp[64]; - GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, tmp, 64); - if(tmp[0]) + SetWindowPos(hwndDlg, 0, key_password_rect.left, key_password_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); + TranslateDialogDefault(hwndDlg); + string questionstr = "Please enter password for key with ID: "; + questionstr += inkeyid; + mir_free(inkeyid); + SetDlgItemTextA(hwndDlg, IDC_KEYID, questionstr.c_str()); + EnableWindow(GetDlgItem(hwndDlg, IDC_DEFAULT_PASSWORD), 0); + return TRUE; + } + + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDOK: { - extern TCHAR *password; - if(IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)) + TCHAR tmp[64]; + GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, tmp, 64); + if(tmp[0]) { - if(inkeyid && inkeyid[0] && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULT_PASSWORD)) + extern TCHAR *password; + if(IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)) { - string dbsetting = "szKey_"; - dbsetting += inkeyid; - dbsetting += "_Password"; - db_set_ts(NULL, szGPGModuleName, dbsetting.c_str(), tmp); + if(inkeyid && inkeyid[0] && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULT_PASSWORD)) + { + string dbsetting = "szKey_"; + dbsetting += inkeyid; + dbsetting += "_Password"; + db_set_ts(NULL, szGPGModuleName, dbsetting.c_str(), tmp); + } + else + db_set_ts(NULL, szGPGModuleName, "szKeyPassword", tmp); } - else - db_set_ts(NULL, szGPGModuleName, "szKeyPassword", tmp); + if(password) + mir_free(password); + password = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(tmp)+1)); + _tcscpy(password, tmp); } - if(password) - mir_free(password); - password = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(tmp)+1)); - _tcscpy(password, tmp); + mir_free(tmp); + mir_free(inkeyid); + DestroyWindow(hwndDlg); } - mir_free(tmp); + break; + + case IDCANCEL: mir_free(inkeyid); + _terminate = true; DestroyWindow(hwndDlg); - break; - } - case IDCANCEL: - mir_free(inkeyid); - _terminate = true; - DestroyWindow(hwndDlg); - break; - default: + break; + } break; - } - - break; - } - - case WM_NOTIFY: - { -/* switch (((LPNMHDR)lParam)->code) - { - default: - EnableWindow(GetDlgItem(hwndDlg, IDC_DEFAULT_PASSWORD), IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)?1:0); - break; - }*/ - } - break; - case WM_CLOSE: - mir_free(inkeyid); - DestroyWindow(hwndDlg); - break; - case WM_DESTROY: - { - GetWindowRect(hwndDlg, &key_password_rect); - db_set_dw(NULL, szGPGModuleName, "PasswordWindowX", key_password_rect.left); - db_set_dw(NULL, szGPGModuleName, "PasswordWindowY", key_password_rect.top); - } - break; - } - return FALSE; + case WM_CLOSE: + mir_free(inkeyid); + DestroyWindow(hwndDlg); + break; + + case WM_DESTROY: + GetWindowRect(hwndDlg, &key_password_rect); + db_set_dw(NULL, szGPGModuleName, "PasswordWindowX", key_password_rect.left); + db_set_dw(NULL, szGPGModuleName, "PasswordWindowY", key_password_rect.top); + break; + } + return FALSE; } void ShowLoadKeyPasswordWindow() diff --git a/plugins/New_GPG/src/metacontacts.cpp b/plugins/New_GPG/src/metacontacts.cpp index b466cc65f0..dcf7667f4f 100644 --- a/plugins/New_GPG/src/metacontacts.cpp +++ b/plugins/New_GPG/src/metacontacts.cpp @@ -18,69 +18,65 @@ extern bool bMetaContacts; -bool metaIsProtoMetaContacts(HANDLE hContact) +bool metaIsProtoMetaContacts(HCONTACT hContact) { - if(bMetaContacts) { - LPSTR proto = GetContactProto(hContact); - if( proto && strcmp(proto,"MetaContacts")==0 ) { - return true; - } - } - return false; + if(bMetaContacts) { + LPSTR proto = GetContactProto(hContact); + if( proto && strcmp(proto,"MetaContacts")==0 ) { + return true; + } + } + return false; } -bool metaIsDefaultSubContact(HANDLE hContact) +bool metaIsDefaultSubContact(HCONTACT hContact) { - if(bMetaContacts) + if(bMetaContacts) return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0),0)==hContact; - return false; + return false; } -HANDLE metaGetContact(HANDLE hContact) +HCONTACT metaGetContact(HCONTACT hContact) { - if(bMetaContacts) + if(bMetaContacts) if(metaIsSubcontact(hContact)) - return (HANDLE)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0); - return NULL; + return (HCONTACT)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0); + return NULL; } -bool metaIsSubcontact(HANDLE hContact) +bool metaIsSubcontact(HCONTACT hContact) { if(bMetaContacts) return CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0) != 0; - return false; + return false; } -HANDLE metaGetMostOnline(HANDLE hContact) +HCONTACT metaGetMostOnline(HCONTACT hContact) { - - if(bMetaContacts) + if(bMetaContacts) if(metaIsProtoMetaContacts(hContact)) - return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact,0); - return NULL; + return (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact,0); + return NULL; } -HANDLE metaGetDefault(HANDLE hContact) +HCONTACT metaGetDefault(HCONTACT hContact) { - - if(bMetaContacts) + if(bMetaContacts) if(metaIsProtoMetaContacts(hContact)) - return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)hContact,0); - return NULL; + return (HCONTACT)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)hContact,0); + return NULL; } -DWORD metaGetContactsNum(HANDLE hContact) +DWORD metaGetContactsNum(HCONTACT hContact) { if(bMetaContacts) return CallService(MS_MC_GETNUMCONTACTS, (WPARAM)hContact, 0); return 0; } -HANDLE metaGetSubcontact(HANDLE hContact, int num) +HCONTACT metaGetSubcontact(HCONTACT hContact, int num) { if(bMetaContacts) - return (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, (LPARAM)num); + return (HCONTACT)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, (LPARAM)num); return 0; } - - diff --git a/plugins/New_GPG/src/metacontacts.h b/plugins/New_GPG/src/metacontacts.h index 8b8873edcc..9dba2943c0 100644 --- a/plugins/New_GPG/src/metacontacts.h +++ b/plugins/New_GPG/src/metacontacts.h @@ -14,11 +14,11 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -bool metaIsProtoMetaContacts(HANDLE hContact); -bool metaIsDefaultSubContact(HANDLE hContact) ; -HANDLE metaGetContact(HANDLE hContact); -bool metaIsSubcontact(HANDLE hContact); -HANDLE metaGetMostOnline(HANDLE hContact); -HANDLE metaGetDefault(HANDLE hContact); -DWORD metaGetContactsNum(HANDLE hContact); -HANDLE metaGetSubcontact(HANDLE hContact, int num); \ No newline at end of file +bool metaIsProtoMetaContacts(HCONTACT hContact); +bool metaIsDefaultSubContact(HCONTACT hContact) ; +HCONTACT metaGetContact(HCONTACT hContact); +bool metaIsSubcontact(HCONTACT hContact); +HCONTACT metaGetMostOnline(HCONTACT hContact); +HCONTACT metaGetDefault(HCONTACT hContact); +DWORD metaGetContactsNum(HCONTACT hContact); +HCONTACT metaGetSubcontact(HCONTACT hContact, int num); diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index 8418e49bf9..75279c7e96 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -66,7 +66,7 @@ int GpgOptInit(WPARAM wParam,LPARAM lParam) return 0; } -map user_data; +map user_data; int item_num = 0; HWND hwndList_p = NULL; @@ -120,8 +120,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP ListView_InsertColumn(hwndList, 4, &col); ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT); int i = 1, iRow = 0; - bool isContactHaveKey(HANDLE); - for(HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { + for(HCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { if(isContactHaveKey(hContact)) { TCHAR *name = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); item.mask = LVIF_TEXT; @@ -193,16 +192,16 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (LOWORD(wParam)) { case IDC_DELETE_KEY_BUTTON: - void setClistIcon(HANDLE hContact); - void setSrmmIcon(HANDLE hContact); + void setClistIcon(HCONTACT hContact); + void setSrmmIcon(HCONTACT hContact); { //gpg execute block TCHAR tmp2[MAX_PATH] = {0}; TCHAR *ptmp; char *tmp; bool keep = false; bool ismetacontact = false; - HANDLE meta = NULL; - HANDLE hContact = user_data[item_num+1]; + HCONTACT meta = NULL; + HCONTACT hContact = user_data[item_num+1]; if(metaIsProtoMetaContacts(hContact)) { meta = hContact; @@ -215,7 +214,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP ismetacontact = true; } tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", ""); - for(HANDLE hcnttmp = db_find_first(); hcnttmp != NULL; hcnttmp = db_find_next(hcnttmp)) { + for(HCONTACT hcnttmp = db_find_first(); hcnttmp != NULL; hcnttmp = db_find_next(hcnttmp)) { if(hcnttmp != hContact) { char *tmp2 = UniGetContactSettingUtf(hcnttmp, szGPGModuleName, "KeyID", ""); if(!strcmp(tmp, tmp2)) { @@ -263,7 +262,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { if(MessageBox(0, TranslateT("Do you want to remove key from entire metacontact (all subcontacts)?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) { - HANDLE hcnt = NULL; + HCONTACT hcnt = NULL; int count = metaGetContactsNum(meta); for(int i = 0; i < count; i++) { @@ -408,8 +407,8 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP } else if(hdr->hdr.code == LVN_ITEMCHANGED) { - void setClistIcon(HANDLE hContact); - void setSrmmIcon(HANDLE hContact); + void setClistIcon(HCONTACT hContact); + void setSrmmIcon(HCONTACT hContact); if(ListView_GetCheckState(hwndList, item_num)) db_set_b(user_data[item_num+1], szGPGModuleName, "GPGEncryption", 1); else @@ -424,18 +423,18 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case PSN_APPLY: { extern bool bJabberAPI, bFileTransfers; - bDebugLog = CheckStateStoreDB(hwndDlg, IDC_DEBUG_LOG, "bDebugLog"); + bDebugLog = CheckStateStoreDB(hwndDlg, IDC_DEBUG_LOG, "bDebugLog") != 0; if(bDebugLog) debuglog.init(); - bJabberAPI = CheckStateStoreDB(hwndDlg, IDC_JABBER_API, "bJabberAPI"); - bool old_bFileTransfers = db_get_b(NULL, szGPGModuleName, "bFileTransfers", 0); - bFileTransfers = CheckStateStoreDB(hwndDlg, IDC_FILE_TRANSFERS, "bFileTransfers"); + bJabberAPI = CheckStateStoreDB(hwndDlg, IDC_JABBER_API, "bJabberAPI") != 0; + bool old_bFileTransfers = db_get_b(NULL, szGPGModuleName, "bFileTransfers", 0) != 0; + bFileTransfers = CheckStateStoreDB(hwndDlg, IDC_FILE_TRANSFERS, "bFileTransfers") != 0; if(bFileTransfers != old_bFileTransfers) { db_set_b(NULL, szGPGModuleName, "bSameAction", 0); bSameAction = false; } - bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange"); + bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange") != 0; { TCHAR tmp[512]; GetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp, 512); @@ -630,8 +629,8 @@ static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case PSN_APPLY: { - bAppendTags = CheckStateStoreDB(hwndDlg, IDC_APPEND_TAGS, "bAppendTags"); - bStripTags = CheckStateStoreDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags"); + bAppendTags = CheckStateStoreDB(hwndDlg, IDC_APPEND_TAGS, "bAppendTags") != 0; + bStripTags = CheckStateStoreDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags") != 0; { TCHAR tmp[128]; GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, 128); @@ -666,58 +665,43 @@ static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, static INT_PTR CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - switch (msg) - { - case WM_INITDIALOG: - { + switch (msg) { + case WM_INITDIALOG: extern bool bJabberAPI; TranslateDialogDefault(hwndDlg); CheckStateLoadDB(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION, "bPresenceSigning", 0); EnableWindow(GetDlgItem(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION), bJabberAPI); - return TRUE; - } - - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_EXPORT: - { - INT_PTR ExportGpGKeys(WPARAM w, LPARAM l); - ExportGpGKeys(NULL, NULL); - } - break; - case IDC_IMPORT: - { - INT_PTR ImportGpGKeys(WPARAM w, LPARAM l); - ImportGpGKeys(NULL, NULL); - } - break; - default: + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_EXPORT: + { + INT_PTR ExportGpGKeys(WPARAM w, LPARAM l); + ExportGpGKeys(NULL, NULL); + } + break; + case IDC_IMPORT: + { + INT_PTR ImportGpGKeys(WPARAM w, LPARAM l); + ImportGpGKeys(NULL, NULL); + } + break; + } + + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; - } - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - break; - } - - case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->code) - { - - case PSN_APPLY: - { - bPresenceSigning = CheckStateStoreDB(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION, "bPresenceSigning"); - return TRUE; - } - } + case WM_NOTIFY: + switch (((LPNMHDR)lParam)->code) { + case PSN_APPLY: + bPresenceSigning = CheckStateStoreDB(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION, "bPresenceSigning") != 0; + return TRUE; + } + break; } - break; - } - return FALSE; + return FALSE; } HWND hPubKeyEdit = NULL; @@ -735,7 +719,7 @@ static LRESULT CALLBACK editctrl_ctrl_a(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) { - static HANDLE hContact; + static HCONTACT hContact; TCHAR *tmp = NULL; wstring key_buf; wstring::size_type ws1 = 0, ws2 = 0; @@ -745,7 +729,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam hContact = user_data[1]; SetWindowPos(hwndDlg, 0, load_key_rect.left, load_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); mir_subclassWindow(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), editctrl_ctrl_a); - HANDLE hcnt = hContact; + HCONTACT hcnt = hContact; if(metaIsProtoMetaContacts(hcnt)) hcnt = metaGetMostOnline(hcnt); TranslateDialogDefault(hwndDlg); @@ -894,14 +878,13 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { if(metaIsProtoMetaContacts(hContact)) { - HANDLE hcnt = NULL; if(MessageBox(0, TranslateT("Do you want to load key for all subcontacts?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) { allsubcontacts = true; int count = metaGetContactsNum(hContact); for(int i = 0; i < count; i++) { - hcnt = metaGetSubcontact(hContact, i); + HCONTACT hcnt = metaGetSubcontact(hContact, i); if(hcnt) db_set_ts(hcnt, szGPGModuleName, "GPGPubKey", key_buf.substr(ws1,ws2-ws1).c_str()); } @@ -921,7 +904,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam string output; DWORD exitcode; { - HANDLE hcnt = hContact; + HCONTACT hcnt = hContact; if(metaIsProtoMetaContacts(hcnt)) hcnt = metaGetMostOnline(hcnt); ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); @@ -960,22 +943,19 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { if(metaIsProtoMetaContacts(hContact)) { - HANDLE hcnt = NULL; if(allsubcontacts) { int count = metaGetContactsNum(hContact); for(int i = 0; i < count; i++) { - hcnt = metaGetSubcontact(hContact, i); + HCONTACT hcnt = metaGetSubcontact(hContact, i); if(hcnt) db_unset(hcnt, szGPGModuleName, "bAlwatsTrust"); } } - else - db_unset(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust"); + else db_unset(metaGetMostOnline(hContact), szGPGModuleName, "bAlwatsTrust"); } - else - db_unset(hContact, szGPGModuleName, "bAlwatsTrust"); + else db_unset(hContact, szGPGModuleName, "bAlwatsTrust"); } { TCHAR *tmp; @@ -994,13 +974,12 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { if(metaIsProtoMetaContacts(hContact)) { - HANDLE hcnt = NULL; if(allsubcontacts) { int count = metaGetContactsNum(hContact); for(int i = 0; i < count; i++) { - hcnt = metaGetSubcontact(hContact, i); + HCONTACT hcnt = metaGetSubcontact(hContact, i); if(hcnt) db_set_s(hcnt, szGPGModuleName, "KeyID", tmp2); } @@ -1044,13 +1023,12 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { if(metaIsProtoMetaContacts(hContact)) { - HANDLE hcnt = NULL; if(allsubcontacts) { int count = metaGetContactsNum(hContact); for(int i = 0; i < count; i++) { - hcnt = metaGetSubcontact(hContact, i); + HCONTACT hcnt = metaGetSubcontact(hContact, i); if(hcnt) db_set_s(hcnt, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); } @@ -1082,13 +1060,12 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { if(metaIsProtoMetaContacts(hContact)) { - HANDLE hcnt = NULL; if(allsubcontacts) { int count = metaGetContactsNum(hContact); for(int i = 0; i < count; i++) { - hcnt = metaGetSubcontact(hContact, i); + HCONTACT hcnt = metaGetSubcontact(hContact, i); if(hcnt) db_set_s(hcnt, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); } @@ -1109,22 +1086,19 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { if(metaIsProtoMetaContacts(hContact)) { - HANDLE hcnt = NULL; if(allsubcontacts) { int count = metaGetContactsNum(hContact); for(int i = 0; i < count; i++) { - hcnt = metaGetSubcontact(hContact, i); + HCONTACT hcnt = metaGetSubcontact(hContact, i); if(hcnt) db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); } } - else - db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + else db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); } - else - db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + else db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); } mir_free(tmp2); tmp = mir_wstrdup(toUTF16(output.substr(s,s2-s)).c_str()); @@ -1141,22 +1115,19 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { if(metaIsProtoMetaContacts(hContact)) { - HANDLE hcnt = NULL; if(allsubcontacts) { int count = metaGetContactsNum(hContact); for(int i = 0; i < count; i++) { - hcnt = metaGetSubcontact(hContact, i); + HCONTACT hcnt = metaGetSubcontact(hContact, i); if(hcnt) db_set_s(hcnt, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); } } - else - db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + else db_set_s(metaGetMostOnline(hContact), szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); } - else - db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + else db_set_s(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); } mir_free(tmp2); tmp = mir_wstrdup(toUTF16(output.substr(s2,s-s2)).c_str()); @@ -1217,13 +1188,12 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { if(metaIsProtoMetaContacts(hContact)) { - HANDLE hcnt = NULL; if(allsubcontacts) { int count = metaGetContactsNum(hContact); for(int i = 0; i < count; i++) { - hcnt = metaGetSubcontact(hContact, i); + HCONTACT hcnt = metaGetSubcontact(hContact, i); if(hcnt) { if(!isContactSecured(hcnt)) @@ -1299,8 +1269,6 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam } break; case IDC_IMPORT: - extern HANDLE new_key_hcnt; - extern boost::mutex new_key_hcnt_mutex; new_key_hcnt_mutex.lock(); new_key_hcnt = hContact; void ShowImportKeyDialog(); diff --git a/plugins/New_GPG/src/srmm.cpp b/plugins/New_GPG/src/srmm.cpp index 85e149214e..542312213d 100644 --- a/plugins/New_GPG/src/srmm.cpp +++ b/plugins/New_GPG/src/srmm.cpp @@ -18,8 +18,8 @@ #include "commonheaders.h" -void ShowStatusIcon(HANDLE hContact); -void setSrmmIcon(HANDLE hContact); +void ShowStatusIcon(HCONTACT hContact); +void setSrmmIcon(HCONTACT hContact); int __cdecl onWindowEvent(WPARAM wParam, LPARAM lParam) { @@ -32,9 +32,10 @@ int __cdecl onWindowEvent(WPARAM wParam, LPARAM lParam) { } -int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; - HANDLE hMeta = NULL; +int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) +{ + HCONTACT hContact = (HCONTACT)wParam; + HCONTACT hMeta = NULL; if(metaIsProtoMetaContacts(hContact)) { hMeta = hContact; @@ -46,9 +47,6 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { if(strcmp(sicd->szModule, szGPGModuleName)) return 0; // not our event - void setSrmmIcon(HANDLE); - void setClistIcon(HANDLE); - bool isContactHaveKey(HANDLE hContact); BYTE enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); if(enc) { @@ -62,8 +60,6 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { if(!isContactHaveKey(hContact)) { void ShowLoadPublicKeyDialog(); - extern map user_data; - extern int item_num; item_num = 0; //black magic here user_data[1] = hContact; ShowLoadPublicKeyDialog(); diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index bd2e4ec45e..d1122dca94 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -18,7 +18,7 @@ #include "commonheaders.h" -TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef) +TCHAR* __stdcall UniGetContactSettingUtf(HCONTACT hContact, const char *szModule,const char* szSetting, TCHAR* szDef) { DBVARIANT dbv = {DBVT_DELETED}; TCHAR* szRes = NULL; @@ -33,7 +33,7 @@ TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,c return szRes; } -char* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, char* szDef) +char* __stdcall UniGetContactSettingUtf(HCONTACT hContact, const char *szModule,const char* szSetting, char* szDef) { DBVARIANT dbv = {DBVT_DELETED}; char* szRes = NULL; @@ -138,15 +138,14 @@ void GetFolderPath(TCHAR *WindowTittle, char *szSetting) INT_PTR LoadKey(WPARAM w, LPARAM l) { void ShowLoadPublicKeyDialog(); - extern map user_data; - user_data[1] = (HANDLE)w; + user_data[1] = (HCONTACT)w; ShowLoadPublicKeyDialog(); return 0; } INT_PTR SendKey(WPARAM w, LPARAM l) { - HANDLE hContact = (HANDLE)w; + HCONTACT hContact = (HCONTACT)w; if(metaIsProtoMetaContacts(hContact)) hContact = metaGetMostOnline(hContact); char *szMessage; @@ -202,7 +201,7 @@ extern HGENMENU hToggleEncryption, hSendKey; INT_PTR ToggleEncryption(WPARAM w, LPARAM l) { - HANDLE hContact = (HANDLE)w; + HCONTACT hContact = (HCONTACT)w; BYTE enc = 0; if(metaIsProtoMetaContacts(hContact)) enc = db_get_b(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0); @@ -210,13 +209,12 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l) enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); if(metaIsProtoMetaContacts(hContact)) { - HANDLE hcnt = NULL; if(MessageBox(0, TranslateT("Do you want to toggle encryption for all subcontacts?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) { int count = metaGetContactsNum(hContact); for(int i = 0; i < count; i++) { - hcnt = metaGetSubcontact(hContact, i); + HCONTACT hcnt = metaGetSubcontact(hContact, i); if(hcnt) db_set_b(hcnt, szGPGModuleName, "GPGEncryption", enc?0:1); } @@ -225,8 +223,8 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l) } else db_set_b(hContact, szGPGModuleName, "GPGEncryption", enc?0:1); - void setSrmmIcon(HANDLE hContact); - void setClistIcon(HANDLE hContact); + void setSrmmIcon(HCONTACT hContact); + void setClistIcon(HCONTACT hContact); setSrmmIcon(hContact); setClistIcon(hContact); enc = enc?0:1; @@ -239,7 +237,7 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l) int OnPreBuildContactMenu(WPARAM w, LPARAM l) { - HANDLE hContact = (HANDLE)w; + HCONTACT hContact = (HCONTACT)w; if(metaIsProtoMetaContacts(hContact)) hContact = metaGetMostOnline(hContact); @@ -396,9 +394,6 @@ int onProtoAck(WPARAM w, LPARAM l) return 0; while(out.find("public key decryption failed: bad passphrase") != string::npos) { - extern bool _terminate; - extern HANDLE new_key_hcnt; - extern boost::mutex new_key_hcnt_mutex; if(bDebugLog) debuglog<hContact, GCDNF_TCHAR))+" password needed, trying to get one"); if(_terminate) @@ -478,12 +473,12 @@ int onProtoAck(WPARAM w, LPARAM l) return 0; } -std::wstring encrypt_file(HANDLE hContact, TCHAR *filename) +std::wstring encrypt_file(HCONTACT hContact, TCHAR *filename) { string out; DWORD code; pxResult result; - HANDLE hcnt = metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact; + HCONTACT hcnt = metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact; std::vector cmd; cmd.push_back(L"--batch"); cmd.push_back(L"--tes"); @@ -643,7 +638,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) } -void HistoryLog(HANDLE hContact, db_event evt) +void HistoryLog(HCONTACT hContact, db_event evt) { DBEVENTINFO Event = { sizeof(Event) }; Event.szModule = szGPGModuleName; @@ -724,7 +719,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU LPCTSTR attr = xi.getAttrValue(local_node, _T("to")); if(attr) { - HANDLE hContact = ji->ContactFromJID(attr); + HCONTACT hContact = ji->ContactFromJID(attr); if(hContact) if(!isContactSecured(hContact)) return FALSE; @@ -1014,7 +1009,7 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi string::size_type p2 = out.find("\n", p1); if(p1 != string::npos && p2 != string::npos) { - HANDLE hContact = NULL; + HCONTACT hContact = NULL; { extern list Accounts; list ::iterator p = Accounts.begin(); @@ -1075,7 +1070,7 @@ void AddHandlers() } } -bool isContactSecured(HANDLE hContact) +bool isContactSecured(HCONTACT hContact) { BYTE gpg_enc = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0); if(!gpg_enc) @@ -1101,7 +1096,7 @@ bool isContactSecured(HANDLE hContact) return true; } -bool isContactHaveKey(HANDLE hContact) +bool isContactHaveKey(HCONTACT hContact) { TCHAR *key = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); if(_tcslen(key) > 0) @@ -1220,7 +1215,7 @@ const bool StriStr(const char *str, const char *substr) return i; } -bool IsOnline(HANDLE hContact) +bool IsOnline(HCONTACT hContact) { if(db_get_b(hContact, szGPGModuleName, "Status", 0) == ID_STATUS_OFFLINE) return false; @@ -1231,34 +1226,34 @@ bool IsOnline(HANDLE hContact) #include struct TFakeAckParams { - inline TFakeAckParams( HANDLE p1, HANDLE p2, LONG p3, LPCSTR p4 ) : + inline TFakeAckParams( HANDLE p1, HCONTACT p2, LONG p3, LPCSTR p4 ) : hEvent( p1 ), hContact( p2 ), id( p3 ), msg( p4 ) {} - HANDLE hEvent; - HANDLE hContact; - LONG id; - LPCSTR msg; + HANDLE hEvent; + HCONTACT hContact; + LONG id; + LPCSTR msg; }; -__forceinline int SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam) +__forceinline int SendBroadcast(HCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam) { return ProtoBroadcastAck( GetContactProto(hContact), hContact, type, result, hProcess, lParam); } -unsigned __stdcall sttFakeAck( LPVOID param ) { - +unsigned __stdcall sttFakeAck( LPVOID param ) +{ TFakeAckParams* tParam = ( TFakeAckParams* )param; WaitForSingleObject( tParam->hEvent, INFINITE ); Sleep( 100 ); if ( tParam->msg == NULL ) - SendBroadcast( tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, ( HANDLE )tParam->id, 0 ); + SendBroadcast(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)tParam->id, 0 ); else - SendBroadcast( tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, ( HANDLE )tParam->id, LPARAM( tParam->msg )); + SendBroadcast(tParam->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)tParam->id, LPARAM(tParam->msg)); CloseHandle( tParam->hEvent ); delete tParam; @@ -1267,7 +1262,7 @@ unsigned __stdcall sttFakeAck( LPVOID param ) { } -int returnNoError(HANDLE hContact) { +int returnNoError(HCONTACT hContact) { HANDLE hEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); unsigned int tID; CloseHandle( (HANDLE) _beginthreadex(NULL, 0, sttFakeAck, new TFakeAckParams(hEvent,hContact,777,0), 0, &tID) ); @@ -1323,8 +1318,9 @@ string get_random(int length) return data; } -void send_encrypted_msgs_thread(HANDLE hContact) +void send_encrypted_msgs_thread(void *param) { + HCONTACT hContact = (HCONTACT)param; while(true) { //char *key = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", ""); @@ -1398,7 +1394,7 @@ void ExportGpGKeysFunc(int type) if(!file.is_open()) return; //TODO: handle error if(!type || type == 2) { - for(HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for(HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *k = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", ""); std::string key; if(!k[0]) @@ -1685,7 +1681,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) if(acc.length()) { const char * uid = (const char*)CallProtoService(acc.c_str(), PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0); - for(HANDLE hContact = db_find_first(acc.c_str()); hContact; hContact = db_find_next(hContact, acc.c_str())) { + for(HCONTACT hContact = db_find_first(acc.c_str()); hContact; hContact = db_find_next(hContact, acc.c_str())) { DBVARIANT dbv = {0}; db_get(hContact, acc.c_str(), uid, &dbv); std::string id; diff --git a/plugins/New_GPG/src/utilities.h b/plugins/New_GPG/src/utilities.h index ef3fbced23..3b884a3846 100644 --- a/plugins/New_GPG/src/utilities.h +++ b/plugins/New_GPG/src/utilities.h @@ -16,17 +16,22 @@ #ifndef UTILITIES_H #define UTILITIES_H -TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef); -char* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, char* szDef); +TCHAR* __stdcall UniGetContactSettingUtf(HCONTACT hContact, const char *szModule,const char* szSetting, TCHAR* szDef); +char* __stdcall UniGetContactSettingUtf(HCONTACT hContact, const char *szModule,const char* szSetting, char* szDef); void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szExtDesc); TCHAR *GetFilePath(TCHAR *WindowTittle, TCHAR *szExt, TCHAR *szExtDesc, bool save_file = false); void GetFolderPath(TCHAR *WindowTittle, char *szSetting); void storeOutput(HANDLE ahandle, string *output); +void setSrmmIcon(HCONTACT); +void setClistIcon(HCONTACT); + +void send_encrypted_msgs_thread(void*); + int ComboBoxAddStringUtf(HWND hCombo, const TCHAR *szString, DWORD data); -bool isContactSecured(HANDLE hContact); -bool isContactHaveKey(HANDLE hContact); +bool isContactSecured(HCONTACT hContact); +bool isContactHaveKey(HCONTACT hContact); bool isTabsrmmUsed(); bool isGPGKeyExist(); bool isGPGValid(); @@ -99,7 +104,7 @@ public: cbSize = 0; } }; -void HistoryLog(HANDLE, db_event); +void HistoryLog(HCONTACT, db_event); void fix_line_term(std::string &s); void fix_line_term(std::wstring &s); void strip_line_term(std::wstring &s); diff --git a/plugins/NewsAggregator/Src/Authentication.cpp b/plugins/NewsAggregator/Src/Authentication.cpp index ce45f95cff..baacf5ac69 100644 --- a/plugins/NewsAggregator/Src/Authentication.cpp +++ b/plugins/NewsAggregator/Src/Authentication.cpp @@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA. #include "common.h" -void CreateAuthString(char *auth, HANDLE hContact, HWND hwndDlg) +void CreateAuthString(char *auth, HCONTACT hContact, HWND hwndDlg) { DBVARIANT dbv; char *user = NULL, *pass = NULL; diff --git a/plugins/NewsAggregator/Src/CheckFeed.cpp b/plugins/NewsAggregator/Src/CheckFeed.cpp index eef9ba2b79..18a42881ef 100644 --- a/plugins/NewsAggregator/Src/CheckFeed.cpp +++ b/plugins/NewsAggregator/Src/CheckFeed.cpp @@ -77,7 +77,7 @@ TCHAR * CheckFeed(TCHAR *tszURL, HWND hwndDlg) return NULL; } -VOID CheckCurrentFeed(HANDLE hContact) +VOID CheckCurrentFeed(HCONTACT hContact) { char *szData = NULL; DBVARIANT dbURL = {0}; @@ -599,7 +599,7 @@ VOID CheckCurrentFeed(HANDLE hContact) } } -VOID CheckCurrentFeedAvatar(HANDLE hContact) +VOID CheckCurrentFeedAvatar(HCONTACT hContact) { char *szData = NULL; DBVARIANT dbURL = {0}; diff --git a/plugins/NewsAggregator/Src/Common.h b/plugins/NewsAggregator/Src/Common.h index ed19e6b132..50241d3234 100644 --- a/plugins/NewsAggregator/Src/Common.h +++ b/plugins/NewsAggregator/Src/Common.h @@ -62,7 +62,7 @@ extern TCHAR tszRoot[MAX_PATH]; struct ItemInfo { HWND hwndList; - HANDLE hContact; + HCONTACT hContact; int SelNumber; TCHAR nick[MAX_PATH]; TCHAR url[MAX_PATH]; @@ -71,7 +71,7 @@ struct ItemInfo //============ STRUCT USED TO MAKE AN UPDATE LIST ============ struct NEWSCONTACTLIST { - HANDLE hContact; + HCONTACT hContact; struct NEWSCONTACTLIST *next; }; @@ -80,7 +80,7 @@ typedef struct NEWSCONTACTLIST UPDATELIST; extern UPDATELIST *UpdateListHead; extern UPDATELIST *UpdateListTail; -void UpdateListAdd(HANDLE hContact); +void UpdateListAdd(HCONTACT hContact); void UpdateThreadProc(LPVOID AvatarCheck); void DestroyUpdateList(void); @@ -119,26 +119,26 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP VOID CALLBACK timerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); VOID CALLBACK timerProc2(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); -BOOL IsMyContact(HANDLE hContact); -VOID GetNewsData(TCHAR *szUrl, char** szData, HANDLE hContact, HWND hwndDlg); +BOOL IsMyContact(HCONTACT hContact); +VOID GetNewsData(TCHAR *szUrl, char** szData, HCONTACT hContact, HWND hwndDlg); VOID CreateList(HWND hwndList); VOID UpdateList(HWND hwndList); VOID DeleteAllItems(HWND hwndList); time_t __stdcall DateToUnixTime(TCHAR *stamp, BOOL FeedType); -VOID CheckCurrentFeed(HANDLE hContact); -VOID CheckCurrentFeedAvatar(HANDLE hContact); +VOID CheckCurrentFeed(HCONTACT hContact); +VOID CheckCurrentFeedAvatar(HCONTACT hContact); TCHAR* CheckFeed(TCHAR* tszURL, HWND hwndDlg); void UpdateMenu(BOOL State); int ImportFeedsDialog(); VOID ClearText(TCHAR *&message); BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal); int StrReplace(TCHAR *lpszOld, TCHAR *lpszNew, TCHAR *&lpszStr); -void CreateAuthString(char *auth, HANDLE hContact, HWND hwndDlg); +void CreateAuthString(char *auth, HCONTACT hContact, HWND hwndDlg); INT_PTR CALLBACK AuthenticationProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -HANDLE GetContactByNick(const TCHAR *nick); -HANDLE GetContactByURL(const TCHAR *url); +HCONTACT GetContactByNick(const TCHAR *nick); +HCONTACT GetContactByURL(const TCHAR *url); // =============== NewsAggregator SERVICES ================ // Check all Feeds info diff --git a/plugins/NewsAggregator/Src/ExportImport.cpp b/plugins/NewsAggregator/Src/ExportImport.cpp index 17d16bdee0..02c84365e0 100644 --- a/plugins/NewsAggregator/Src/ExportImport.cpp +++ b/plugins/NewsAggregator/Src/ExportImport.cpp @@ -148,7 +148,7 @@ INT_PTR CALLBACK DlgProcImportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM isGroupUTF = 1; } - HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + HCONTACT hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)MODULE); db_set_ts(hContact, MODULE, "Nick", title); db_set_ts(hContact, MODULE, "URL", url); @@ -468,7 +468,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); Utils_RestoreWindowPositionNoSize(hwndDlg, NULL, MODULE, "ExportDlg"); - for (HANDLE hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { + for (HCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { DBVARIANT dbVar = {0}; if (!db_get_ts(hContact, MODULE, "Nick", &dbVar)) { SendMessage(FeedsList, LB_ADDSTRING, 0, (LPARAM)dbVar.ptszVal); @@ -516,7 +516,7 @@ INT_PTR CALLBACK DlgProcExportOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM for (int i = 0; i < count; i++) { TCHAR item[MAX_PATH]; SendMessage(FeedsExportList, LB_GETTEXT, i, (LPARAM)item); - HANDLE hContact = GetContactByNick(item); + HCONTACT hContact = GetContactByNick(item); TCHAR *title = NULL, *url = NULL, *siteurl = NULL, *group = NULL; DBVARIANT dbv = {0}; if (!db_get_ts(hContact, MODULE, "Nick", &dbv)) { diff --git a/plugins/NewsAggregator/Src/Options.cpp b/plugins/NewsAggregator/Src/Options.cpp index db787541dd..52dc11f066 100644 --- a/plugins/NewsAggregator/Src/Options.cpp +++ b/plugins/NewsAggregator/Src/Options.cpp @@ -57,7 +57,7 @@ INT_PTR CALLBACK DlgProcAddFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; } - HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + HCONTACT hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)MODULE); GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str)); db_set_ts(hContact, MODULE, "Nick", str); @@ -154,7 +154,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_CHECKTIME, EM_LIMITTEXT, 3, 0); SendDlgItemMessage(hwndDlg, IDC_TIMEOUT_VALUE_SPIN, UDM_SETRANGE32, 0, 999); - HANDLE hContact; + HCONTACT hContact; for (hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { ptrT dbNick( db_get_tsa(hContact, MODULE, "Nick")); if (dbNick == NULL) @@ -305,7 +305,7 @@ INT_PTR CALLBACK DlgProcChangeFeedOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case WM_DESTROY: - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); Utils_SaveWindowPosition(hwndDlg, hContact, MODULE, "ChangeDlg"); WindowList_Remove(hChangeFeedDlgList, hwndDlg); ItemInfo *SelItem = (ItemInfo *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); @@ -325,7 +325,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetWindowText(hwndDlg, TranslateT("Change Feed")); SendDlgItemMessage(hwndDlg, IDC_CHECKTIME, UDM_SETRANGE32, 0, 999); - HANDLE hContact = (HANDLE)lParam; + HCONTACT hContact = (HCONTACT)lParam; WindowList_Add(hChangeFeedDlgList, hwndDlg, hContact); Utils_RestoreWindowPositionNoSize(hwndDlg, hContact, MODULE, "ChangeDlg"); DBVARIANT dbv; @@ -361,7 +361,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (LOWORD(wParam)) { case IDOK: { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); TCHAR str[MAX_PATH]; char passw[MAX_PATH]; if (!GetDlgItemText(hwndDlg, IDC_FEEDTITLE, str, SIZEOF(str))) { @@ -460,7 +460,7 @@ INT_PTR CALLBACK DlgProcChangeFeedMenu(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case WM_DESTROY: - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); Utils_SaveWindowPosition(hwndDlg, hContact, MODULE, "ChangeDlg"); WindowList_Remove(hChangeFeedDlgList, hwndDlg); } @@ -505,7 +505,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA ListView_GetItemText(hwndList, sel, 0, nick, MAX_PATH); ListView_GetItemText(hwndList, sel, 1, url, MAX_PATH); - for (HANDLE hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { + for (HCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { ptrT dbNick( db_get_tsa(hContact, MODULE, "Nick")); if (dbNick == NULL) break; @@ -547,7 +547,7 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA { db_set_b(NULL, MODULE, "StartupRetrieve", IsDlgButtonChecked(hwndDlg, IDC_STARTUPRETRIEVE)); int i = 0; - for (HANDLE hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { + for (HCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { db_set_b(hContact, MODULE, "CheckState", ListView_GetCheckState(hwndList, i)); if (!ListView_GetCheckState(hwndList, i)) db_set_b(hContact, "CList", "Hidden", 1); diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index 7e18296860..ee03c41900 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -23,7 +23,7 @@ int g_nStatus = ID_STATUS_ONLINE; UINT_PTR timerId = 0; HANDLE hTBButton = NULL, hNewsAggregatorFolder = NULL; -void SetContactStatus(HANDLE hContact, int nNewStatus) +void SetContactStatus(HCONTACT hContact, int nNewStatus) { if(db_get_w(hContact, MODULE, "Status", ID_STATUS_ONLINE) != nNewStatus) db_set_w(hContact, MODULE, "Status", nNewStatus); @@ -33,7 +33,7 @@ static void __cdecl WorkingThread(void* param) { int nStatus = (int)param; - for (HANDLE hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) + for (HCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) SetContactStatus(hContact, nStatus); } @@ -51,7 +51,7 @@ int NewsAggrInit(WPARAM wParam, LPARAM lParam) else lstrcpyn(tszRoot, VARST( _T("%miranda_userdata%\\Avatars\\"_T(DEFAULT_AVATARS_FOLDER))), SIZEOF(tszRoot)); - for (HANDLE hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { + for (HCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { if (!db_get_b(NULL, MODULE, "StartupRetrieve", 1)) db_set_dw(hContact, MODULE, "LastCheck", time(NULL)); SetContactStatus(hContact, ID_STATUS_ONLINE); @@ -136,10 +136,10 @@ INT_PTR NewsAggrLoadIcon(WPARAM wParam, LPARAM lParam) return (LOWORD(wParam) == PLI_PROTOCOL) ? (INT_PTR)CopyIcon(LoadIconEx("main", FALSE)) : 0; } -static void __cdecl AckThreadProc(HANDLE param) +static void __cdecl AckThreadProc(void *param) { Sleep(100); - ProtoBroadcastAck(MODULE, param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0); + ProtoBroadcastAck(MODULE, (HCONTACT)param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0); } INT_PTR NewsAggrGetInfo(WPARAM wParam, LPARAM lParam) @@ -151,7 +151,7 @@ INT_PTR NewsAggrGetInfo(WPARAM wParam, LPARAM lParam) INT_PTR CheckAllFeeds(WPARAM wParam, LPARAM lParam) { - for (HANDLE hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { + for (HCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { if (lParam && db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME)) UpdateListAdd(hContact); else if (!lParam) @@ -172,7 +172,7 @@ INT_PTR AddFeed(WPARAM wParam, LPARAM lParam) INT_PTR ChangeFeed(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HWND hChangeFeedDlg = WindowList_Find(hChangeFeedDlgList, hContact); if (!hChangeFeedDlg) { hChangeFeedDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADDFEED), NULL, DlgProcChangeFeedMenu, (LPARAM)hContact); @@ -198,7 +198,7 @@ INT_PTR ExportFeeds(WPARAM wParam, LPARAM lParam) INT_PTR CheckFeed(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if(IsMyContact(hContact)) UpdateListAdd(hContact); if ( !ThreadRunning) diff --git a/plugins/NewsAggregator/Src/Update.cpp b/plugins/NewsAggregator/Src/Update.cpp index c104a7d949..be1d71be92 100644 --- a/plugins/NewsAggregator/Src/Update.cpp +++ b/plugins/NewsAggregator/Src/Update.cpp @@ -30,7 +30,7 @@ VOID CALLBACK timerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) // only run if it is not current updating and the auto update option is enabled if (!ThreadRunning && !Miranda_Terminated()) { BOOL HaveUpdates = FALSE; - for (HANDLE hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { + for (HCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { if (db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME)) { double diff = difftime(time(NULL), db_get_dw(hContact, MODULE, "LastCheck", 0)); if (db_get_b(NULL, MODULE, "AutoUpdate", 1) != 0 && diff >= db_get_dw(hContact, MODULE, "UpdateTime", DEFAULT_UPDATE_TIME) * 60) { @@ -58,7 +58,7 @@ VOID CALLBACK timerProc2(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) } } -void UpdateListAdd(HANDLE hContact) +void UpdateListAdd(HCONTACT hContact) { UPDATELIST *newItem = (UPDATELIST*)mir_alloc(sizeof(UPDATELIST)); newItem->hContact = hContact; @@ -74,9 +74,9 @@ void UpdateListAdd(HANDLE hContact) ReleaseMutex(hUpdateMutex); } -HANDLE UpdateGetFirst() +HCONTACT UpdateGetFirst() { - HANDLE hContact = NULL; + HCONTACT hContact = NULL; WaitForSingleObject(hUpdateMutex, INFINITE); @@ -123,11 +123,12 @@ void UpdateThreadProc(LPVOID AvatarCheck) ReleaseMutex(hUpdateMutex); // update news by getting the first station from the queue until the queue is empty - while (UpdateListHead != NULL && !Miranda_Terminated()) + while (UpdateListHead != NULL && !Miranda_Terminated()) { if ((BOOL)AvatarCheck) CheckCurrentFeedAvatar(UpdateGetFirst()); else CheckCurrentFeed(UpdateGetFirst()); + } // exit the update thread ThreadRunning = FALSE; diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index ff794bd369..c361b08485 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -22,7 +22,7 @@ Boston, MA 02111-1307, USA. HANDLE hNetlibUser = NULL, hNetlibHttp; BOOL UpdateListFlag = FALSE; -BOOL IsMyContact(HANDLE hContact) +BOOL IsMyContact(HCONTACT hContact) { const char *szProto = GetContactProto(hContact); return szProto != NULL && strcmp(MODULE, szProto) == 0; @@ -58,7 +58,7 @@ static void arrayToHex(BYTE *data, size_t datasz, char *res) *resptr = '\0'; } -VOID GetNewsData(TCHAR *tszUrl, char **szData, HANDLE hContact, HWND hwndDlg) +VOID GetNewsData(TCHAR *tszUrl, char **szData, HCONTACT hContact, HWND hwndDlg) { NETLIBHTTPREQUEST nlhr = {0}; @@ -155,7 +155,7 @@ VOID UpdateList(HWND hwndList) // Initialize LVITEM members that are common to all // items. int i = 0; - for (HANDLE hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { + for (HCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { UpdateListFlag = TRUE; lvI.mask = LVIF_TEXT; lvI.iSubItem = 0; @@ -562,9 +562,9 @@ VOID ClearText(TCHAR *&message) CoUninitialize(); } -HANDLE GetContactByNick(const TCHAR *nick) +HCONTACT GetContactByNick(const TCHAR *nick) { - HANDLE hContact = NULL; + HCONTACT hContact = NULL; for (hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { ptrW contactNick(::db_get_wsa(hContact, MODULE, "Nick")); @@ -574,9 +574,9 @@ HANDLE GetContactByNick(const TCHAR *nick) return hContact; } -HANDLE GetContactByURL(const TCHAR *url) +HCONTACT GetContactByURL(const TCHAR *url) { - HANDLE hContact = NULL; + HCONTACT hContact = NULL; for (hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) { ptrW contactURL(::db_get_wsa(hContact, MODULE, "URL")); diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index 22c6dde6e6..49c30e0f5a 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -4,7 +4,7 @@ HINSTANCE hInst; int hLangpack = 0; // add icon to srmm status icons -static void SrmmMenu_UpdateIcon(HANDLE hContact); +static void SrmmMenu_UpdateIcon(HCONTACT hContact); static int SrmmMenu_ProcessEvent(WPARAM wParam, LPARAM lParam); static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam); @@ -20,7 +20,8 @@ CRITICAL_SECTION list_cs; // a list of db events - we'll check them for the 'read' flag periodically and delete them whwen marked as read struct EventListNode { - HANDLE hContact, hDBEvent; + HCONTACT hContact; + HANDLE hDBEvent; EventListNode *next; }; @@ -53,7 +54,7 @@ extern "C" __declspec (dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirand return &pluginInfo; } -void RemoveReadEvents(HANDLE hContact = 0) +void RemoveReadEvents(HCONTACT hContact = 0) { DBEVENTINFO info = { sizeof(info) }; bool remove; @@ -96,7 +97,7 @@ void RemoveReadEvents(HANDLE hContact = 0) LeaveCriticalSection(&list_cs); } -void RemoveAllEvents(HANDLE hContact) +void RemoveAllEvents(HCONTACT hContact) { HANDLE hDBEvent = db_event_first(hContact); while(hDBEvent) { @@ -113,7 +114,8 @@ void CALLBACK TimerProc(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) int OnDatabaseEventAdd(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam, hDBEvent = (HANDLE)lParam; + HCONTACT hContact = (HCONTACT)wParam; + HANDLE hDBEvent = (HANDLE)lParam; // history not disabled for this contact if (db_get_b(hContact, MODULE, DBSETTING_REMOVE, 0) == 0) @@ -139,7 +141,7 @@ int OnDatabaseEventAdd(WPARAM wParam, LPARAM lParam) INT_PTR ServiceClear(WPARAM wParam, LPARAM lParam) { if (MessageBox(0, TranslateT("This operation will PERMANENTLY REMOVE all history for this contact.\nAre you sure you want to do this?"), TranslateT("Clear History"), MB_YESNO | MB_ICONWARNING) == IDYES) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; RemoveAllEvents(hContact); } @@ -148,7 +150,7 @@ INT_PTR ServiceClear(WPARAM wParam, LPARAM lParam) int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; bool remove = db_get_b(hContact, MODULE, DBSETTING_REMOVE, 0) != 0; char *proto = GetContactProto(hContact); @@ -170,7 +172,7 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) INT_PTR ServiceToggle(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; int remove = db_get_b(hContact, MODULE, DBSETTING_REMOVE, 0) != 0; remove = !remove; @@ -190,7 +192,7 @@ INT_PTR ServiceToggle(WPARAM wParam, LPARAM lParam) int WindowEvent(WPARAM wParam, LPARAM lParam) { MessageWindowEventData *mwd = (MessageWindowEventData *)lParam; - HANDLE hContact = mwd->hContact; + HCONTACT hContact = mwd->hContact; switch(mwd->uType) { case MSG_WINDOW_EVT_CLOSE: @@ -216,7 +218,7 @@ int WindowEvent(WPARAM wParam, LPARAM lParam) int IconPressed(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; StatusIconClickData *sicd = (StatusIconClickData *)lParam; if (sicd->cbSize < (int)sizeof(StatusIconClickData)) return 0; diff --git a/plugins/NoHistory/src/options.cpp b/plugins/NoHistory/src/options.cpp index ea790bd978..14fa6d0d10 100644 --- a/plugins/NoHistory/src/options.cpp +++ b/plugins/NoHistory/src/options.cpp @@ -84,7 +84,7 @@ static void ResetListOptions(HWND hwndList) static void SetAllContactIcons(HWND hwndList) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *proto = GetContactProto(hContact); bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0) != 0); @@ -198,7 +198,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *proto = GetContactProto(hContact); bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0) != 0); diff --git a/plugins/Non-IM Contact/src/commonheaders.h b/plugins/Non-IM Contact/src/commonheaders.h index ca593df8ab..f40bdb8649 100644 --- a/plugins/Non-IM Contact/src/commonheaders.h +++ b/plugins/Non-IM Contact/src/commonheaders.h @@ -101,13 +101,13 @@ INT_PTR exportContacts(WPARAM wParam,LPARAM lParam) ; INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -void ExportContact(HANDLE hContact); +void ExportContact(HCONTACT hContact); INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam); // stringreplacer.c -int stringReplacer(const char* oldString, char* newString, HANDLE hContact); -void replaceAllStrings(HANDLE hContact); -void WriteSetting(HANDLE hContact, char* module1, char* setting1 , char* module12, char* setting2); +int stringReplacer(const char* oldString, char* newString, HCONTACT hContact); +void replaceAllStrings(HCONTACT hContact); +void WriteSetting(HCONTACT hContact, char* module1, char* setting1 , char* module12, char* setting2); //timer.c extern UINT_PTR timerId; @@ -122,7 +122,7 @@ extern char *szInfo; extern char *szData; extern HANDLE hNetlibUser; -int db_get_static(HANDLE hContact, const char *moduleName, const char *fn, char *buf); +int db_get_static(HCONTACT hContact, const char *moduleName, const char *fn, char *buf); #endif diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index abb04ea98b..19f58a58d6 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -5,7 +5,7 @@ INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l switch(msg) { case WM_INITDIALOG: { - HANDLE hContact = (HANDLE)((PROPSHEETPAGE*)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((PROPSHEETPAGE*)lParam)->lParam; char name[2048]; TranslateDialogDefault(hwnd); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)(HANDLE)hContact); @@ -26,7 +26,7 @@ INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (GetWindowTextLength(GetDlgItem(hwnd,IDC_DISPLAY_NAME))) { char text[512]; GetDlgItemTextA(hwnd,IDC_DISPLAY_NAME,text,sizeof(text)); @@ -112,7 +112,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP switch(msg) { case WM_INITDIALOG: { - HANDLE hContact = (HANDLE)((PROPSHEETPAGE*)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((PROPSHEETPAGE*)lParam)->lParam; TranslateDialogDefault(hwnd); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)hContact); if (!hContact) @@ -180,7 +180,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP switch(LOWORD(wParam)) { case IDC_ALWAYS_VISIBLE: if (IsDlgButtonChecked(hwnd, IDC_ALWAYS_VISIBLE)) { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); EnableWindow(GetDlgItem(hwnd, IDC_VISIBLE_UNLESS_OFFLINE),1); CheckDlgButton(hwnd, IDC_VISIBLE_UNLESS_OFFLINE, db_get_b(hContact, MODNAME ,"VisibleUnlessOffline", 1)); } @@ -189,7 +189,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case CHK_USE_TIMER: if (IsDlgButtonChecked(hwnd, CHK_USE_TIMER)) { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); char string[4]; EnableWindow(GetDlgItem(hwnd, IDC_TIMER), 1); SetDlgItemTextA(hwnd, IDC_TIMER, _itoa(db_get_w(hContact, MODNAME ,"Timer", 15), string, 10)); @@ -223,7 +223,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: int status = GetLCStatus(0,0); - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (GetWindowTextLength(GetDlgItem(hwnd,IDC_LINK))) { char text[512]; @@ -304,9 +304,9 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) switch(msg) { case WM_INITDIALOG: { - HANDLE hContact = (HANDLE)((PROPSHEETPAGE*)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((PROPSHEETPAGE*)lParam)->lParam; TranslateDialogDefault(hwnd); - SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)(HANDLE)hContact); + SetWindowLongPtr(hwnd, GWLP_USERDATA, (LPARAM)hContact); } return TRUE; @@ -314,7 +314,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); switch(LOWORD(wParam)) { case IDC_EXPORT: - ExportContact((HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA)); + ExportContact((HCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA)); break; case IDC_DOIT: @@ -324,7 +324,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) char dbVar1[2000], dbVar2[2000]; int i=0,j=0, k=0; char *string = oldString[k]; - HANDLE hContact1 = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA), hContact2; + HCONTACT hContact1 = (HCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), hContact2; GetDlgItemTextA(hwnd, IDC_STRING_REPLACE, replace, GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) +1); if (db_get_static(hContact1, MODNAME, "Name", dbVar1)) { // get the list of replace strings @@ -347,7 +347,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } i++; } - hContact2 =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact2 =(HCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact2,(LPARAM)MODNAME); CallService(MS_IGNORE_IGNORE, (WPARAM)hContact2, IGNOREEVENT_USERONLINE); db_set_s(hContact2, MODNAME, "Nick", Translate("New Non-IM Contact")); @@ -401,9 +401,9 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } else { char dbVar1[2000]; - HANDLE hContact1 = (HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA), hContact2; + HCONTACT hContact1 = (HCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), hContact2; if (db_get_static(hContact1, MODNAME, "Name", dbVar1)) { - if (!(hContact2 =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0))) { + if (!(hContact2 = (HCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0))) { msg("contact did not get created",""); return 0; } @@ -452,7 +452,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return FALSE; } -void ExportContact(HANDLE hContact) +void ExportContact(HCONTACT hContact) { char szFileName[MAX_PATH]; char DBVar[1024]; @@ -495,7 +495,7 @@ void ExportContact(HANDLE hContact) INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) { - HANDLE hContact; + HCONTACT hContact; char name[256] = "", program[256] = "", programparam[256] = "", group[256] = "", tooltip[3000] = "", line[2001] = ""; int icon = 40072, usetimer = 0, minutes = 1, timer = 0; char fn[MAX_PATH]; @@ -631,7 +631,7 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam) } if (MessageBoxA(0,msg,modFullname,MB_YESNO) == IDYES) { - if (!(hContact =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0))) { + if (!(hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0))) { msg("contact did get created",""); continue; } diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp index eea83fd93c..6e12327403 100644 --- a/plugins/Non-IM Contact/src/dialog.cpp +++ b/plugins/Non-IM Contact/src/dialog.cpp @@ -239,7 +239,7 @@ static int CALLBACK PropSheetProc(HWND hwnd, UINT uMsg, LPARAM lParam) return 0; } -void DoPropertySheet(HANDLE hContact, HINSTANCE hInst) +void DoPropertySheet(HCONTACT hContact, HINSTANCE hInst) { char title[256], nick[256]; PROPSHEETPAGEA psp[4] = { 0 }; @@ -307,7 +307,7 @@ void DoPropertySheet(HANDLE hContact, HINSTANCE hInst) INT_PTR addContact(WPARAM wParam,LPARAM lParam) { char tmp[256]; - HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); + HCONTACT hContact = (HCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)MODNAME); CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, IGNOREEVENT_USERONLINE); db_set_ts(hContact, MODNAME, "Nick", TranslateT("New Non-IM Contact")); @@ -320,10 +320,10 @@ INT_PTR addContact(WPARAM wParam,LPARAM lParam) INT_PTR editContact(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; char tmp[256]; if (!hContact) { - hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)MODNAME); CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, IGNOREEVENT_USERONLINE); db_set_s(hContact, MODNAME, "Nick", Translate("New Non-IM Contact")); diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp index 70db1be310..81f4dc3ca6 100644 --- a/plugins/Non-IM Contact/src/files.cpp +++ b/plugins/Non-IM Contact/src/files.cpp @@ -14,7 +14,7 @@ INT_PTR exportContacts(WPARAM wParam,LPARAM lParam) if (!file) return 0; - for (HANDLE hContact = db_find_first(MODNAME); hContact; hContact = db_find_next(hContact, MODNAME)) { + for (HCONTACT hContact = db_find_first(MODNAME); hContact; hContact = db_find_next(hContact, MODNAME)) { int tmp; char DBVar[1024]; if (db_get_static(hContact, MODNAME, "Name", DBVar)) { diff --git a/plugins/Non-IM Contact/src/main.cpp b/plugins/Non-IM Contact/src/main.cpp index 912f9c08ab..3aecdbb073 100644 --- a/plugins/Non-IM Contact/src/main.cpp +++ b/plugins/Non-IM Contact/src/main.cpp @@ -28,13 +28,13 @@ INT_PTR doubleClick(WPARAM wParam,LPARAM lParam) { char program[MAX_PATH], params[MAX_PATH]; int shellEXEerror = 0; - char* proto = GetContactProto((HANDLE)wParam); + char* proto = GetContactProto((HCONTACT)wParam); if (proto && !strcmp(proto, MODNAME)) { if (GetKeyState(VK_CONTROL)&0x8000) // ctrl is pressed editContact((WPARAM)(HANDLE)wParam, (LPARAM)NULL); // for later when i add a second double click setting - else if (db_get_static((HANDLE)wParam, MODNAME, "Program", program) && strcmp(program, "")) + else if (db_get_static((HCONTACT)wParam, MODNAME, "Program", program) && strcmp(program, "")) { - if (!db_get_static((HANDLE)wParam, MODNAME, "ProgramParams", params) ) + if (!db_get_static((HCONTACT)wParam, MODNAME, "ProgramParams", params) ) strcpy(params, ""); if (strstr(program, "http://") || strstr(program, "https://")) CallService(MS_UTILS_OPENURL,1,(LPARAM)program); diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp index ad0748ffbe..428e4a912b 100644 --- a/plugins/Non-IM Contact/src/namereplacing.cpp +++ b/plugins/Non-IM Contact/src/namereplacing.cpp @@ -232,7 +232,7 @@ void checkStringForcompare(char *str) } // do save("A","B") A is DBVar name, B is value -void checkStringForSave(HANDLE hContact, char* str) +void checkStringForSave(HCONTACT hContact, char* str) { char *A,*B,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str); unsigned int i, j=0, s = (int)strlen(str); @@ -258,7 +258,7 @@ void checkStringForSave(HANDLE hContact, char* str) } // do load("A") A is DBVar name -void checkStringForLoad(HANDLE hContact, char* str) +void checkStringForLoad(HCONTACT hContact, char* str) { char *A,*newStr = (char*)malloc(strlen(str)),*copyOfStr = _strdup(str); unsigned int i, j=0, s = (int)strlen(str); @@ -432,7 +432,7 @@ int lastChecked(char *newStr, const char *str) // do icon(x) 0=offline, 1=online, 10=lunch -void checkIcon(HANDLE hContact, char* string) +void checkIcon(HCONTACT hContact, char* string) { char* str = strstr(string,"icon("); if (str) { @@ -442,7 +442,7 @@ void checkIcon(HANDLE hContact, char* string) } } -int stringReplacer(const char* oldString, char* newString, HANDLE hContact) +int stringReplacer(const char* oldString, char* newString, HCONTACT hContact) { char var_file[8]; int tempInt; @@ -602,7 +602,7 @@ void stripWhiteSpace(char* string) i++; } } -void WriteSetting(HANDLE hContact, char* module1, char* setting1 , char* module2, char* setting2) +void WriteSetting(HCONTACT hContact, char* module1, char* setting1 , char* module2, char* setting2) { char text[MAX_STRING_LENGTH], newString[MAX_STRING_LENGTH]; int error = 0, status = GetLCStatus(0,0); @@ -641,7 +641,7 @@ void WriteSetting(HANDLE hContact, char* module1, char* setting1 , char* module2 else db_set_w(hContact, MODNAME, "Status", ID_STATUS_OFFLINE); } -void replaceAllStrings(HANDLE hContact) +void replaceAllStrings(HCONTACT hContact) { char tmp1[256], tmp2[256], tmp3[256]; WriteSetting(hContact, MODNAME, "Name", MODNAME, "Nick"); diff --git a/plugins/Non-IM Contact/src/services.cpp b/plugins/Non-IM Contact/src/services.cpp index b81372adb9..4cfb8138df 100644 --- a/plugins/Non-IM Contact/src/services.cpp +++ b/plugins/Non-IM Contact/src/services.cpp @@ -3,7 +3,7 @@ //======================================================= //db_get_static //======================================================= -int db_get_static(HANDLE hContact, const char *szModule, const char *szSetting, char *value) +int db_get_static(HCONTACT hContact, const char *szModule, const char *szSetting, char *value) { DBVARIANT dbv; if (!db_get(hContact, szModule, szSetting, &dbv)) @@ -79,7 +79,7 @@ int SetLCStatus(WPARAM wParam,LPARAM lParam) else if (db_get_w(NULL, MODNAME, "Timer",1)) startTimer(TIMER); - for (HANDLE hContact = db_find_first(MODNAME); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(MODNAME); hContact; hContact = db_find_next(hContact)) { char *proto = GetContactProto(hContact); if (proto == NULL || strcmp(proto, MODNAME)) continue; diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp index 68d91c7c3d..5b2af5798b 100644 --- a/plugins/Non-IM Contact/src/timer.cpp +++ b/plugins/Non-IM Contact/src/timer.cpp @@ -40,7 +40,7 @@ void timerFunc(LPVOID di) } /* update all the contacts */ - for (HANDLE hContact = db_find_first(MODNAME); hContact; hContact = db_find_next(hContact, MODNAME)) { + for (HCONTACT hContact = db_find_first(MODNAME); hContact; hContact = db_find_next(hContact, MODNAME)) { int timer = db_get_w(hContact, MODNAME, "Timer", 15); if (timer && !(timerCount % timer)) if (db_get_static(hContact, MODNAME, "Name", text)) diff --git a/plugins/NotesAndReminders/src/miscutils.cpp b/plugins/NotesAndReminders/src/miscutils.cpp index 71dc3644dd..3212495f2f 100644 --- a/plugins/NotesAndReminders/src/miscutils.cpp +++ b/plugins/NotesAndReminders/src/miscutils.cpp @@ -27,7 +27,7 @@ void FreeSettingBlob(WORD pSize,void *pbBlob) db_free(&dbv); } -void ReadSettingBlob(HANDLE hContact, char *ModuleName, char *SettingName, WORD *pSize, void **pbBlob) +void ReadSettingBlob(HCONTACT hContact, char *ModuleName, char *SettingName, WORD *pSize, void **pbBlob) { DBVARIANT dbv = {0}; dbv.type = DBVT_BLOB; @@ -41,12 +41,12 @@ void ReadSettingBlob(HANDLE hContact, char *ModuleName, char *SettingName, WORD } } -void WriteSettingIntArray(HANDLE hContact,char *ModuleName,char *SettingName,const int *Value, int Size) +void WriteSettingIntArray(HCONTACT hContact,char *ModuleName,char *SettingName,const int *Value, int Size) { db_set_blob(hContact, ModuleName, SettingName, (void*)Value, sizeof(int)*Size); } -bool ReadSettingIntArray(HANDLE hContact,char *ModuleName,char *SettingName,int *Value, int Size) +bool ReadSettingIntArray(HCONTACT hContact,char *ModuleName,char *SettingName,int *Value, int Size) { WORD sz = 4096; int *pData; diff --git a/plugins/NotesAndReminders/src/miscutils.h b/plugins/NotesAndReminders/src/miscutils.h index 2b7c779b9e..e1fb803c0e 100644 --- a/plugins/NotesAndReminders/src/miscutils.h +++ b/plugins/NotesAndReminders/src/miscutils.h @@ -1,13 +1,13 @@ -void ReadSettingBlob(HANDLE hContact, char *ModuleName, +void ReadSettingBlob(HCONTACT hContact, char *ModuleName, char *SettingName, WORD *pSize, void **pbBlob); void FreeSettingBlob(WORD pSize,void * pbBlob); -BOOL ReadSettingBool(HANDLE hContact,char *ModuleName, +BOOL ReadSettingBool(HCONTACT hContact,char *ModuleName, char *SettingName,BOOL Default); -void WriteSettingBool(HANDLE hContact,char *ModuleName, +void WriteSettingBool(HCONTACT hContact,char *ModuleName, char *SettingName,BOOL Value); -void WriteSettingIntArray(HANDLE hContact,char *ModuleName, +void WriteSettingIntArray(HCONTACT hContact,char *ModuleName, char *SettingName,const int *Value, int Size); -bool ReadSettingIntArray(HANDLE hContact,char *ModuleName, +bool ReadSettingIntArray(HCONTACT hContact,char *ModuleName, char *SettingName,int *Value, int Size); WORD ConvertHotKeyToControl(WORD HK); diff --git a/plugins/Nudge/src/headers.h b/plugins/Nudge/src/headers.h index 451afb77f5..a481e613b4 100644 --- a/plugins/Nudge/src/headers.h +++ b/plugins/Nudge/src/headers.h @@ -66,22 +66,22 @@ int Preview(); /* * ****************************/ -HANDLE Nudge_GethContact(HANDLE); +HCONTACT Nudge_GethContact(HCONTACT); /* * ****************************/ -void Nudge_ShowPopup(CNudgeElement, HANDLE, TCHAR *); +void Nudge_ShowPopup(CNudgeElement, HCONTACT, TCHAR *); /* * ****************************/ -void Nudge_ShowStatus(CNudgeElement, HANDLE, DWORD timestamp); +void Nudge_ShowStatus(CNudgeElement, HCONTACT, DWORD timestamp); /* * ****************************/ -void Nudge_SentStatus(CNudgeElement, HANDLE); +void Nudge_SentStatus(CNudgeElement, HCONTACT); /* * diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index d8cefa3bd2..2dffab3d52 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -41,31 +41,32 @@ INT_PTR NudgeShowMenu(WPARAM wParam,LPARAM lParam) INT_PTR NudgeSend(WPARAM wParam, LPARAM lParam) { - char *protoName = GetContactProto((HANDLE)wParam); - int diff = time(NULL) - db_get_dw((HANDLE)wParam, "Nudge", "LastSent", time(NULL) - 30); + HCONTACT hContact = (HCONTACT)wParam; + char *protoName = GetContactProto(hContact); + int diff = time(NULL) - db_get_dw(hContact, "Nudge", "LastSent", time(NULL) - 30); if (diff < GlobalNudge.sendTimeSec) { TCHAR msg[500]; mir_sntprintf(msg, 500, TranslateT("You are not allowed to send too much nudge (only 1 each %d sec, %d sec left)"), GlobalNudge.sendTimeSec, 30 - diff); if (GlobalNudge.useByProtocol) { for (NudgeElementList *n = NudgeList; n != NULL; n = n->next) if (!strcmp(protoName, n->item.ProtocolName)) - Nudge_ShowPopup(n->item, (HANDLE)wParam, msg); + Nudge_ShowPopup(n->item, hContact, msg); } - else Nudge_ShowPopup(DefaultNudge, (HANDLE)wParam, msg); + else Nudge_ShowPopup(DefaultNudge, hContact, msg); return 0; } - db_set_dw((HANDLE)wParam, "Nudge", "LastSent", time(NULL)); + db_set_dw(hContact, "Nudge", "LastSent", time(NULL)); if (GlobalNudge.useByProtocol) { for (NudgeElementList *n = NudgeList; n != NULL; n = n->next) if (!strcmp(protoName, n->item.ProtocolName)) if (n->item.showStatus) - Nudge_SentStatus(n->item, (HANDLE)wParam); + Nudge_SentStatus(n->item, hContact); } else if (DefaultNudge.showStatus) - Nudge_SentStatus(DefaultNudge, (HANDLE)wParam); + Nudge_SentStatus(DefaultNudge, hContact); CallProtoService(protoName, PS_SEND_NUDGE, wParam, lParam); return 0; @@ -80,18 +81,19 @@ void OpenContactList() int NudgeReceived(WPARAM wParam, LPARAM lParam) { - char *protoName = GetContactProto((HANDLE)wParam); + HCONTACT hContact = (HCONTACT)wParam; + char *protoName = GetContactProto(hContact); DWORD currentTimestamp = time(NULL); DWORD nudgeSentTimestamp = lParam ? (DWORD)lParam : currentTimestamp; - int diff = currentTimestamp - db_get_dw((HANDLE)wParam, "Nudge", "LastReceived", currentTimestamp - 30); - int diff2 = nudgeSentTimestamp - db_get_dw((HANDLE)wParam, "Nudge", "LastReceived2", nudgeSentTimestamp - 30); + int diff = currentTimestamp - db_get_dw(hContact, "Nudge", "LastReceived", currentTimestamp - 30); + int diff2 = nudgeSentTimestamp - db_get_dw(hContact, "Nudge", "LastReceived2", nudgeSentTimestamp - 30); if (diff >= GlobalNudge.recvTimeSec) - db_set_dw((HANDLE)wParam, "Nudge", "LastReceived", currentTimestamp); + db_set_dw(hContact, "Nudge", "LastReceived", currentTimestamp); if (diff2 >= GlobalNudge.recvTimeSec) - db_set_dw((HANDLE)wParam, "Nudge", "LastReceived2", nudgeSentTimestamp); + db_set_dw(hContact, "Nudge", "LastReceived2", nudgeSentTimestamp); if (GlobalNudge.useByProtocol) { for (NudgeElementList *n = NudgeList; n != NULL; n = n->next) { @@ -116,7 +118,7 @@ int NudgeReceived(WPARAM wParam, LPARAM lParam) { if (diff >= GlobalNudge.recvTimeSec) { if (n->item.showPopup) - Nudge_ShowPopup(n->item, (HANDLE)wParam, n->item.recText); + Nudge_ShowPopup(n->item, hContact, n->item.recText); if (n->item.openContactList) OpenContactList(); if (n->item.shakeClist) @@ -134,7 +136,7 @@ int NudgeReceived(WPARAM wParam, LPARAM lParam) if (diff2 >= GlobalNudge.recvTimeSec) if (n->item.showStatus) - Nudge_ShowStatus(n->item, (HANDLE)wParam, nudgeSentTimestamp); + Nudge_ShowStatus(n->item, hContact, nudgeSentTimestamp); } break; } @@ -159,7 +161,7 @@ int NudgeReceived(WPARAM wParam, LPARAM lParam) { if (diff >= GlobalNudge.recvTimeSec) { if (DefaultNudge.showPopup) - Nudge_ShowPopup(DefaultNudge, (HANDLE)wParam, DefaultNudge.recText); + Nudge_ShowPopup(DefaultNudge, hContact, DefaultNudge.recText); if (DefaultNudge.openContactList) OpenContactList(); if (DefaultNudge.shakeClist) @@ -177,7 +179,7 @@ int NudgeReceived(WPARAM wParam, LPARAM lParam) if (diff2 >= GlobalNudge.recvTimeSec) if (DefaultNudge.showStatus) - Nudge_ShowStatus(DefaultNudge, (HANDLE)wParam, nudgeSentTimestamp); + Nudge_ShowStatus(DefaultNudge, hContact, nudgeSentTimestamp); } } return 0; @@ -251,7 +253,7 @@ static int TabsrmmButtonInit(WPARAM wParam, LPARAM lParam) return 0; } -void HideNudgeButton(HANDLE hContact) +void HideNudgeButton(HCONTACT hContact) { char *szProto = GetContactProto(hContact); if (!ProtoServiceExists(szProto, PS_SEND_NUDGE)) { @@ -377,7 +379,7 @@ void LoadPopupClass() int Preview() { - HANDLE hContact = db_find_first(); + HCONTACT hContact = db_find_first(); if (GlobalNudge.useByProtocol) { for (NudgeElementList *n = NudgeList; n != NULL; n = n->next) { if (n->item.enabled) { @@ -413,7 +415,7 @@ int Preview() return 0; } -void Nudge_ShowPopup(CNudgeElement n, HANDLE hContact, TCHAR * Message) +void Nudge_ShowPopup(CNudgeElement n, HCONTACT hContact, TCHAR * Message) { hContact = Nudge_GethContact(hContact); TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR); @@ -447,7 +449,7 @@ void Nudge_ShowPopup(CNudgeElement n, HANDLE hContact, TCHAR * Message) else MessageBox(NULL, Message, lpzContactName, 0); } -void Nudge_SentStatus(CNudgeElement n, HANDLE hContact) +void Nudge_SentStatus(CNudgeElement n, HCONTACT hContact) { char *buff = mir_utf8encodeT(n.senText); @@ -461,7 +463,7 @@ void Nudge_SentStatus(CNudgeElement n, HANDLE hContact) INT_PTR res = CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); //try to retrieve the metacontact if some if (res != CALLSERVICE_NOTFOUND) { - HANDLE hMetaContact = (HANDLE)res; + HCONTACT hMetaContact = (HCONTACT)res; if (hMetaContact != NULL) // metacontact db_event_add(hMetaContact, &dbei); } @@ -470,7 +472,7 @@ void Nudge_SentStatus(CNudgeElement n, HANDLE hContact) mir_free(buff); } -void Nudge_ShowStatus(CNudgeElement n, HANDLE hContact, DWORD timestamp) +void Nudge_ShowStatus(CNudgeElement n, HCONTACT hContact, DWORD timestamp) { char *buff = mir_utf8encodeT(n.recText); @@ -484,7 +486,7 @@ void Nudge_ShowStatus(CNudgeElement n, HANDLE hContact, DWORD timestamp) INT_PTR res = CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); //try to retrieve the metacontact if some if (res != CALLSERVICE_NOTFOUND) { - HANDLE hMetaContact = (HANDLE)res; + HCONTACT hMetaContact = (HCONTACT)res; if (hMetaContact != NULL) { //metacontact db_event_add(hMetaContact, &dbei); dbei.flags |= DBEF_READ; @@ -495,11 +497,11 @@ void Nudge_ShowStatus(CNudgeElement n, HANDLE hContact, DWORD timestamp) mir_free(buff); } -HANDLE Nudge_GethContact(HANDLE hContact) +HCONTACT Nudge_GethContact(HCONTACT hContact) { INT_PTR res = CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); if (res != CALLSERVICE_NOTFOUND) { - HANDLE hMetaContact = (HANDLE)res; + HCONTACT hMetaContact = (HCONTACT)res; if (hMetaContact != NULL) return hMetaContact; } diff --git a/plugins/Nudge/src/shake.cpp b/plugins/Nudge/src/shake.cpp index 3998327e89..f42d028aba 100644 --- a/plugins/Nudge/src/shake.cpp +++ b/plugins/Nudge/src/shake.cpp @@ -50,7 +50,7 @@ INT_PTR ShakeChat(WPARAM wParam, LPARAM lParam) MessageWindowInputData mwid; mwd.cbSize = sizeof(MessageWindowData); - mwd.hContact = Nudge_GethContact((HANDLE)wParam); + mwd.hContact = Nudge_GethContact((HCONTACT)wParam); mwd.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; mwid.cbSize = sizeof(MessageWindowInputData); diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 50f87f2319..10fba85cac 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -94,7 +94,7 @@ std::wstring GetFile() return L""; } -void PasteIt(HANDLE hContact, int mode) +void PasteIt(HCONTACT hContact, int mode) { PasteToWeb* pasteToWeb = pasteToWebs[Options::instance->defWeb]; if(mode == FROM_CLIPBOARD) @@ -152,7 +152,7 @@ void PasteIt(HANDLE hContact, int mode) { gci.iItem = i; gci.pszModule = szProto; - gci.Flags = BYINDEX | HCONTACT | ID; + gci.Flags = GCF_BYINDEX | GCF_HCONTACT | GCF_ID; CallService(MS_GC_GETINFO, 0, (LPARAM)&gci); if (gci.hContact == hContact) { @@ -212,7 +212,7 @@ void PasteIt(HANDLE hContact, int mode) int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam) { CustomButtonClickData *cbc = (CustomButtonClickData *)lParam; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == 1 && hContact) { @@ -274,7 +274,7 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { bool bIsContact = false; - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND) bIsContact = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) != 0; @@ -287,7 +287,7 @@ INT_PTR ContactMenuService(WPARAM wParam, LPARAM lParam) if(lParam >= DEF_PAGES_START) Options::instance->SetDefWeb(lParam - DEF_PAGES_START); else { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; PasteIt(hContact, lParam); } return 0; diff --git a/plugins/Popup/src/avatars.cpp b/plugins/Popup/src/avatars.cpp index e7d90a396f..79dd9d2b38 100644 --- a/plugins/Popup/src/avatars.cpp +++ b/plugins/Popup/src/avatars.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "headers.h" -PopupAvatar *PopupAvatar::create(HANDLE hContact) +PopupAvatar *PopupAvatar::create(HCONTACT hContact) { if (hContact) { diff --git a/plugins/Popup/src/avatars.h b/plugins/Popup/src/avatars.h index 3b44fab739..369940611f 100644 --- a/plugins/Popup/src/avatars.h +++ b/plugins/Popup/src/avatars.h @@ -31,7 +31,7 @@ protected: bool bIsAnimated, bIsValid; public: - PopupAvatar(HANDLE hContact) {} + PopupAvatar(HANDLE h) {} virtual ~PopupAvatar() {} virtual int activeFrameDelay() = 0; virtual void draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *options) = 0; @@ -42,7 +42,7 @@ public: inline int getWidth() { return width; } inline int getHeight() { return height; } - static PopupAvatar *create(HANDLE hContact); + static PopupAvatar *create(HCONTACT hContact); }; #endif // __avatars_h__ diff --git a/plugins/Popup/src/avatars_flash.h b/plugins/Popup/src/avatars_flash.h index cc9d49c707..a01919f242 100644 --- a/plugins/Popup/src/avatars_flash.h +++ b/plugins/Popup/src/avatars_flash.h @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class FlashAvatar: public PopupAvatar { public: - FlashAvatar(HANDLE hContact); + FlashAvatar(HCONTACT hContact); virtual ~FlashAvatar(); virtual int activeFrameDelay() = 0; virtual void draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *options) = 0; diff --git a/plugins/Popup/src/avatars_gif.cpp b/plugins/Popup/src/avatars_gif.cpp index 0641c94a57..5526f9cef3 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(HANDLE hContact): PopupAvatar(hContact) +GifAvatar::GifAvatar(HCONTACT hContact): PopupAvatar(hContact) { av = (avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0); bIsAnimated = true; diff --git a/plugins/Popup/src/avatars_gif.h b/plugins/Popup/src/avatars_gif.h index 14bf35b45e..51d6a6a7a0 100644 --- a/plugins/Popup/src/avatars_gif.h +++ b/plugins/Popup/src/avatars_gif.h @@ -37,7 +37,7 @@ protected: SIZE frameSize; public: - GifAvatar(HANDLE hContact); + GifAvatar(HCONTACT hContact); virtual ~GifAvatar(); virtual int activeFrameDelay(); virtual void draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *options); diff --git a/plugins/Popup/src/avatars_simple.cpp b/plugins/Popup/src/avatars_simple.cpp index 8852d008cf..86c9b6dd15 100644 --- a/plugins/Popup/src/avatars_simple.cpp +++ b/plugins/Popup/src/avatars_simple.cpp @@ -23,7 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "headers.h" -SimpleAvatar::SimpleAvatar(HANDLE hContact, bool bUseBitmap): PopupAvatar(bUseBitmap ? 0 : hContact) +SimpleAvatar::SimpleAvatar(HANDLE h, bool bUseBitmap) : + PopupAvatar((bUseBitmap) ? 0 : h) { bIsAnimated = false; bIsValid = true; @@ -31,7 +32,7 @@ SimpleAvatar::SimpleAvatar(HANDLE hContact, bool bUseBitmap): PopupAvatar(bUseBi if (bUseBitmap) { BITMAP bmp; - GetObject((HBITMAP)hContact, sizeof(bmp), &bmp); + GetObject((HBITMAP)h, sizeof(bmp), &bmp); width = abs(bmp.bmWidth); height = abs(bmp.bmHeight); @@ -39,15 +40,15 @@ SimpleAvatar::SimpleAvatar(HANDLE hContact, bool bUseBitmap): PopupAvatar(bUseBi av = new avatarCacheEntry; av->bmHeight = abs(bmp.bmHeight); av->bmWidth = abs(bmp.bmWidth); - av->hbmPic = (HBITMAP)hContact; + av->hbmPic = (HBITMAP)h; av->dwFlags = AVS_BITMAP_VALID; return; } - if (hContact && ServiceExists(MS_AV_GETAVATARBITMAP)) + if (h && ServiceExists(MS_AV_GETAVATARBITMAP)) { avNeedFree = false; - av = (avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0); + av = (avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)h, 0); if (av) { if (av->hbmPic && (av->dwFlags&AVS_BITMAP_VALID) && !(av->dwFlags&AVS_HIDEONCLIST) && !(av->dwFlags&AVS_NOTREADY)) diff --git a/plugins/Popup/src/avatars_simple.h b/plugins/Popup/src/avatars_simple.h index a919d168d9..25ae0e702a 100644 --- a/plugins/Popup/src/avatars_simple.h +++ b/plugins/Popup/src/avatars_simple.h @@ -31,7 +31,7 @@ private: bool avNeedFree; public: - SimpleAvatar(HANDLE hContact, bool bUseBitmap = false); + SimpleAvatar(HANDLE h, bool bUseBitmap = false); virtual ~SimpleAvatar(); virtual int activeFrameDelay(); virtual void draw(MyBitmap *bmp, int x, int y, int w, int h, POPUPOPTIONS *options); diff --git a/plugins/Popup/src/common.h b/plugins/Popup/src/common.h index 5700f7f55f..11bf939fd4 100644 --- a/plugins/Popup/src/common.h +++ b/plugins/Popup/src/common.h @@ -51,7 +51,7 @@ inline int Byte2Percentile(int vByte) { return (vByte*100)/255; } inline int Percentile2Byte(int vPerc) { return (vPerc*255)/100; } //===== Strings & MirandaDB ================== -inline char *db_get_s(HANDLE hContact, const char *ModuleName, const char *SettingName, const char *Default) +inline char *db_get_s(HCONTACT hContact, const char *ModuleName, const char *SettingName, const char *Default) { DBVARIANT dbv; db_get(hContact, ModuleName, SettingName, &dbv); @@ -66,7 +66,7 @@ inline char *db_get_s(HANDLE hContact, const char *ModuleName, const char *Setti return result; } -inline INT_PTR DBGetContactSettingStringX(HANDLE hContact, const char *ModuleName, const char *SettingName, const char *Default, const int retType) +inline INT_PTR DBGetContactSettingStringX(HCONTACT hContact, const char *ModuleName, const char *SettingName, const char *Default, const int retType) { INT_PTR ret = NULL; diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp index da4b535f21..5e7f3494e7 100644 --- a/plugins/Popup/src/opt_contacts.cpp +++ b/plugins/Popup/src/opt_contacts.cpp @@ -85,7 +85,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: HWND hwndList = GetDlgItem(hwnd, IDC_LIST); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); for (int i=0; i < 4 /*SIZEOF(sttIcons)*/; ++i) { if (SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(i,0))) { @@ -117,7 +117,7 @@ static void sttResetListOptions(HWND hwndList) static void sttSetAllContactIcons(HWND hwndList) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); DWORD dwMode = db_get_b(hContact, MODULNAME, "ShowMode", 0); for (int i=0; i < 4 /*SIZEOF(sttIcons)*/; ++i) diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index f6d493138d..5f0f2e65f3 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -744,7 +744,7 @@ void PopupWnd2::setIcon(HICON hNewIcon) void PopupWnd2::updateData(POPUPDATAW_V2 *ppd) { - m_hContact = ppd->lchContact; + m_hContact = ppd->lchContact; m_clBack = ppd->colorBack; m_clClock = m_clTitle = m_clText = ppd->colorText; @@ -774,11 +774,11 @@ void PopupWnd2::updateData(POPUPDATAW_V2 *ppd) void PopupWnd2::updateData(POPUPDATA2 *ppd) { - m_hContact = ppd->lchContact; + m_hContact = ppd->lchContact; m_clBack = ppd->colorBack; - m_clClock = m_clTitle = m_clText = ppd->colorText; - m_iTimeout = ppd->iSeconds; + m_clClock = m_clTitle = m_clText = ppd->colorText; + m_iTimeout = ppd->iSeconds; mir_free(m_lpzText); mir_free(m_lpzTitle); mir_free(m_lpwzText); mir_free(m_lpwzTitle); @@ -930,27 +930,28 @@ LRESULT CALLBACK NullWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l return DefWindowProc(hwnd, message, wParam, lParam); } -struct ReplyEditData +struct ReplyEditData { - HWND hwndPopup; - HANDLE hContact; - WNDPROC oldWndProc; + HWND hwndPopup; + HCONTACT hContact; + WNDPROC oldWndProc; }; -BOOL IsUtfSendAvailable(HANDLE hContact) +BOOL IsUtfSendAvailable(HCONTACT hContact) { char* szProto = GetContactProto(hContact); if (szProto == NULL) return FALSE; //check for MetaContact and get szProto from subcontact if (strcmp(szProto, gszMetaProto)==0) { - HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT, (WPARAM)hContact, 0); - if (!hSubContact) return FALSE; + HCONTACT hSubContact = (HCONTACT)CallService(MS_MC_GETDEFAULTCONTACT, (WPARAM)hContact, 0); + if (!hSubContact) + return FALSE; szProto = GetContactProto(hSubContact); } return(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDUTF) ? TRUE : FALSE; } -void AddMessageToDB(HANDLE hContact, char *msg, int flag/*bool utf*/) +void AddMessageToDB(HCONTACT hContact, char *msg, int flag/*bool utf*/) { DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(dbei); @@ -1491,13 +1492,13 @@ void WindowThread(void *arg) // Menu Host LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static HANDLE hContact = NULL; + static HCONTACT hContact = NULL; switch (message) { case UM_SHOWMENU: { - hContact = (HANDLE)lParam; + hContact = (HCONTACT)lParam; POINT pt = {0}; HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT,(WPARAM)hContact,0); GetCursorPos(&pt); diff --git a/plugins/Popup/src/popup_wnd2.h b/plugins/Popup/src/popup_wnd2.h index ef4760d496..4c851275d9 100644 --- a/plugins/Popup/src/popup_wnd2.h +++ b/plugins/Popup/src/popup_wnd2.h @@ -68,7 +68,7 @@ private: // other data Formula::Args m_args; - HANDLE m_hContact, m_hContactPassed; + HCONTACT m_hContact, m_hContactPassed; WNDPROC m_PluginWindowProc; void *m_PluginData; diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index ae757444a3..655ab46604 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static HANDLE hDialogsList = NULL; -static void SrmmMenu_UpdateIcon(HANDLE hContact) +static void SrmmMenu_UpdateIcon(HCONTACT hContact) { if (!hContact) return; @@ -73,7 +73,7 @@ static int SrmmMenu_ProcessIconClick(WPARAM wParam, LPARAM lParam) if (lstrcmpA(sicd->szModule, MODULNAME)) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!hContact) return 0; diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 98683402c5..6d35216f40 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -238,7 +238,7 @@ int EventAdded(WPARAM wparam, LPARAM lparam) struct c_struct { TCHAR szname[120]; TCHAR szgroup[50]; - HANDLE hcontact; + HCONTACT hcontact; TCHAR proto[20]; c_struct() @@ -321,7 +321,7 @@ void SortArray(void) } -int GetStatus(HANDLE hContact, char *proto = NULL) +int GetStatus(HCONTACT hContact, char *proto = NULL) { if (proto == NULL) proto = GetContactProto(hContact); @@ -356,17 +356,17 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) // item data of listbox-strings is the array position FreeContacts(); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *pszProto = GetContactProto(hContact); if(pszProto == NULL) continue; // Get meta - HANDLE hMeta = NULL; + HCONTACT hMeta = NULL; if (metacontactsEnabled) { if ((!show_all && opts.hide_subcontacts) || opts.group_append) - hMeta = (HANDLE) CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); + hMeta = (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); } else { @@ -457,7 +457,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) // Enable buttons for the selected contact -void EnableButtons(HWND hwndDlg, HANDLE hContact) +void EnableButtons(HWND hwndDlg, HCONTACT hContact) { if (hContact == NULL) { @@ -476,7 +476,7 @@ void EnableButtons(HWND hwndDlg, HANDLE hContact) // Is a meta? if (ServiceExists(MS_MC_GETMOSTONLINECONTACT)) { - HANDLE hSub = (HANDLE) CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) hContact, 0); + HCONTACT hSub = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) hContact, 0); if (hSub != NULL) hContact = hSub; } @@ -544,7 +544,7 @@ int CheckText(HWND hdlg, TCHAR *sztext, BOOL only_enable = FALSE) return 0; } -HANDLE GetSelectedContact(HWND hwndDlg) +HCONTACT GetSelectedContact(HWND hwndDlg) { // First try selection int sel = SendDlgItemMessage(hwndDlg, IDC_USERNAME, CB_GETCURSEL, 0, 0); @@ -846,7 +846,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_ENTER: { - HANDLE hContact = GetSelectedContact(hwndDlg); + HCONTACT hContact = GetSelectedContact(hwndDlg); if (hContact == NULL) break; @@ -858,7 +858,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case IDC_MESSAGE: { - HANDLE hContact = GetSelectedContact(hwndDlg); + HCONTACT hContact = GetSelectedContact(hwndDlg); if (hContact == NULL) { SetDlgItemText(hwndDlg, IDC_USERNAME, _T("")); @@ -879,7 +879,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case HOTKEY_VOICE: case IDC_VOICE: { - HANDLE hContact = GetSelectedContact(hwndDlg); + HCONTACT hContact = GetSelectedContact(hwndDlg); if (hContact == NULL) { SetDlgItemText(hwndDlg, IDC_USERNAME, _T("")); @@ -903,7 +903,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case HOTKEY_FILE: case IDC_FILE: { - HANDLE hContact = GetSelectedContact(hwndDlg); + HCONTACT hContact = GetSelectedContact(hwndDlg); if (hContact == NULL) { SetDlgItemText(hwndDlg, IDC_USERNAME, _T("")); @@ -924,7 +924,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case HOTKEY_URL: case IDC_URL: { - HANDLE hContact = GetSelectedContact(hwndDlg); + HCONTACT hContact = GetSelectedContact(hwndDlg); if (hContact == NULL) { SetDlgItemText(hwndDlg, IDC_USERNAME, _T("")); @@ -945,7 +945,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case HOTKEY_INFO: case IDC_USERINFO: { - HANDLE hContact = GetSelectedContact(hwndDlg); + HCONTACT hContact = GetSelectedContact(hwndDlg); if (hContact == NULL) { SetDlgItemText(hwndDlg, IDC_USERNAME, _T("")); @@ -966,7 +966,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case HOTKEY_HISTORY: case IDC_HISTORY: { - HANDLE hContact = GetSelectedContact(hwndDlg); + HCONTACT hContact = GetSelectedContact(hwndDlg); if (hContact == NULL) { SetDlgItemText(hwndDlg, IDC_USERNAME, _T("")); @@ -987,7 +987,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case HOTKEY_MENU: case IDC_MENU: { - HANDLE hContact = GetSelectedContact(hwndDlg); + HCONTACT hContact = GetSelectedContact(hwndDlg); if (hContact == NULL) { SetDlgItemText(hwndDlg, IDC_USERNAME, _T("")); diff --git a/plugins/QuickMessages/src/Utils.cpp b/plugins/QuickMessages/src/Utils.cpp index b0c40e1f7b..66c4af7657 100644 --- a/plugins/QuickMessages/src/Utils.cpp +++ b/plugins/QuickMessages/src/Utils.cpp @@ -396,7 +396,7 @@ int RegisterCustomButton(WPARAM wParam,LPARAM lParam) return 0; } -TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptszClip,int QVSize,int TextSize ,int ClipSize) +TCHAR* ParseString(HCONTACT hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptszClip,int QVSize,int TextSize ,int ClipSize) { int i=0,iOffset=0,iCount=0; TCHAR* tempPointer=NULL; diff --git a/plugins/QuickMessages/src/Utils.h b/plugins/QuickMessages/src/Utils.h index c136459239..61faf79b31 100644 --- a/plugins/QuickMessages/src/Utils.h +++ b/plugins/QuickMessages/src/Utils.h @@ -75,4 +75,4 @@ void DestroyButton(int listnum); void SaveModuleSettings(int buttonnum,ButtonData* bd); void CleanSettings(int buttonnum,int from); DWORD BalanceButtons(int buttonsWas,int buttonsNow); -TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValueIn,TCHAR* ptszText,TCHAR* ptszClip,int QVSize,int TextSize ,int ClipSize); \ No newline at end of file +TCHAR* ParseString(HCONTACT hContact,TCHAR* ptszQValueIn,TCHAR* ptszText,TCHAR* ptszClip,int QVSize,int TextSize ,int ClipSize); diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp index 8162c110d5..a98de39b1e 100644 --- a/plugins/QuickReplies/src/events.cpp +++ b/plugins/QuickReplies/src/events.cpp @@ -117,7 +117,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam) if (dbv.ptszVal == NULL) replyList.push_back(_T("")); else - replyList.push_back((TCHAR*)variables_parsedup(dbv.ptszVal, 0, (HANDLE)wParam)); + replyList.push_back((TCHAR*)variables_parsedup(dbv.ptszVal, 0, (HCONTACT)wParam)); if (_tcscmp(dbv.ptszVal, _T("---"))) AppendMenu((HMENU)hMenu, MF_STRING, i + 1, replyList[i].c_str()); diff --git a/plugins/Quotes/src/DBUtils.cpp b/plugins/Quotes/src/DBUtils.cpp index d85f85c282..3fe5690273 100644 --- a/plugins/Quotes/src/DBUtils.cpp +++ b/plugins/Quotes/src/DBUtils.cpp @@ -1,6 +1,6 @@ #include "StdAfx.h" -std::string Quotes_DBGetStringA(HANDLE hContact,const char* szModule,const char* szSetting,const char* pszDefValue /*= NULL*/) +std::string Quotes_DBGetStringA(HCONTACT hContact,const char* szModule,const char* szSetting,const char* pszDefValue /*= NULL*/) { std::string sResult; char* pszSymbol = db_get_sa(hContact,szModule,szSetting); @@ -17,7 +17,7 @@ std::string Quotes_DBGetStringA(HANDLE hContact,const char* szModule,const char* return sResult; } -std::wstring Quotes_DBGetStringW(HANDLE hContact,const char* szModule,const char* szSetting,const wchar_t* pszDefValue/* = NULL*/) +std::wstring Quotes_DBGetStringW(HCONTACT hContact,const char* szModule,const char* szSetting,const wchar_t* pszDefValue/* = NULL*/) { std::wstring sResult; wchar_t* pszSymbol = db_get_wsa(hContact,szModule,szSetting); @@ -34,12 +34,12 @@ std::wstring Quotes_DBGetStringW(HANDLE hContact,const char* szModule,const char return sResult; } -bool Quotes_DBWriteDouble(HANDLE hContact,const char* szModule,const char* szSetting,double dValue) +bool Quotes_DBWriteDouble(HCONTACT hContact,const char* szModule,const char* szSetting,double dValue) { return 0 == db_set_blob(hContact, szModule, szSetting, &dValue, sizeof(dValue)); } -bool Quotes_DBReadDouble(HANDLE hContact,const char* szModule,const char* szSetting,double& rdValue) +bool Quotes_DBReadDouble(HCONTACT hContact,const char* szModule,const char* szSetting,double& rdValue) { DBVARIANT dbv = {0}; dbv.type = DBVT_BLOB; diff --git a/plugins/Quotes/src/DBUtils.h b/plugins/Quotes/src/DBUtils.h index 27e3de5038..330b953d27 100644 --- a/plugins/Quotes/src/DBUtils.h +++ b/plugins/Quotes/src/DBUtils.h @@ -1,13 +1,13 @@ #ifndef __54294385_3fdd_4f0c_98c3_c583a96e7fb4_DBUtils_h__ #define __54294385_3fdd_4f0c_98c3_c583a96e7fb4_DBUtils_h__ -std::string Quotes_DBGetStringA(HANDLE hContact,const char* szModule,const char* szSetting,const char* pszDefValue = NULL); -std::wstring Quotes_DBGetStringW(HANDLE hContact,const char* szModule,const char* szSetting,const wchar_t* pszDefValue = NULL); +std::string Quotes_DBGetStringA(HCONTACT hContact,const char* szModule,const char* szSetting,const char* pszDefValue = NULL); +std::wstring Quotes_DBGetStringW(HCONTACT hContact,const char* szModule,const char* szSetting,const wchar_t* pszDefValue = NULL); #define Quotes_DBGetStringT Quotes_DBGetStringW -bool Quotes_DBWriteDouble(HANDLE hContact,const char* szModule,const char* szSetting,double dValue); -bool Quotes_DBReadDouble(HANDLE hContact,const char* szModule,const char* szSetting,double& rdValue); +bool Quotes_DBWriteDouble(HCONTACT hContact,const char* szModule,const char* szSetting,double dValue); +bool Quotes_DBReadDouble(HCONTACT hContact,const char* szModule,const char* szSetting,double& rdValue); #endif //__54294385_3fdd_4f0c_98c3_c583a96e7fb4_DBUtils_h__ diff --git a/plugins/Quotes/src/ExtraImages.cpp b/plugins/Quotes/src/ExtraImages.cpp index 2a6c95b10d..ad2ac5e54a 100644 --- a/plugins/Quotes/src/ExtraImages.cpp +++ b/plugins/Quotes/src/ExtraImages.cpp @@ -23,7 +23,7 @@ void CExtraImages::RebuildExtraImages() { } -bool CExtraImages::SetContactExtraImage(HANDLE hContact,EImageIndex nIndex)const +bool CExtraImages::SetContactExtraImage(HCONTACT hContact,EImageIndex nIndex)const { if (!m_hExtraIcons) return false; @@ -47,7 +47,7 @@ bool CExtraImages::SetContactExtraImage(HANDLE hContact,EImageIndex nIndex)const int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp) { - HANDLE hContact = reinterpret_cast(wp); + HCONTACT hContact = reinterpret_cast(wp); const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr(); CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact); diff --git a/plugins/Quotes/src/ExtraImages.h b/plugins/Quotes/src/ExtraImages.h index ca9cfd7c42..f02bfbacf9 100644 --- a/plugins/Quotes/src/ExtraImages.h +++ b/plugins/Quotes/src/ExtraImages.h @@ -21,7 +21,7 @@ public: static CExtraImages& GetInstance(); void RebuildExtraImages(); - bool SetContactExtraImage(HANDLE hContact,EImageIndex nIndex)const; + bool SetContactExtraImage(HCONTACT hContact,EImageIndex nIndex)const; private: mutable CLightMutex m_lmExtraImages; diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 4d61bd793b..1536bf8e9f 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -191,7 +191,7 @@ namespace int QuotesEventFunc_OnContactDeleted(WPARAM wParam, LPARAM) { - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(wParam); const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr(); CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact); diff --git a/plugins/Quotes/src/IQuotesProvider.h b/plugins/Quotes/src/IQuotesProvider.h index 1317a115f6..a6359097b7 100644 --- a/plugins/Quotes/src/IQuotesProvider.h +++ b/plugins/Quotes/src/IQuotesProvider.h @@ -22,13 +22,13 @@ public: virtual bool Init() = 0; virtual const CProviderInfo& GetInfo()const = 0; - virtual void AddContact(HANDLE hContact) = 0; - virtual void DeleteContact(HANDLE hContact) = 0; + virtual void AddContact(HCONTACT hContact) = 0; + virtual void DeleteContact(HCONTACT hContact) = 0; virtual void ShowPropertyPage(WPARAM wp,OPTIONSDIALOGPAGE& odp) = 0; virtual void RefreshAll() = 0; - virtual void RefreshContact(HANDLE hContact) = 0; - virtual void SetContactExtraIcon(HANDLE hContact)const = 0; + virtual void RefreshContact(HCONTACT hContact) = 0; + virtual void SetContactExtraIcon(HCONTACT hContact)const = 0; virtual void Run() = 0; diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index be7b4fc974..282d5aa448 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -21,7 +21,7 @@ namespace { CModuleInfo::TXMLEnginePtr m_pXmlEngine; IXMLNode::TXMLNodePtr m_pNode; - HANDLE m_hContact; + HCONTACT m_hContact; LPCSTR m_pszModule; }; @@ -153,7 +153,7 @@ namespace return 0; } - IXMLNode::TXMLNodePtr export_contact(HANDLE hContact,const CModuleInfo::TXMLEnginePtr& pXmlEngine) + IXMLNode::TXMLNodePtr export_contact(HCONTACT hContact,const CModuleInfo::TXMLEnginePtr& pXmlEngine) { IXMLNode::TXMLNodePtr pNode = pXmlEngine->CreateNode(g_pszXmlContact,tstring()); if(pNode) @@ -273,7 +273,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()); - HANDLE hContact = reinterpret_cast(wp); + HCONTACT hContact = reinterpret_cast(wp); if(hContact) { CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact); @@ -307,13 +307,13 @@ INT_PTR Quotes_Export(WPARAM wp,LPARAM lp) namespace { - bool set_contact_settings(HANDLE hContact, DBCONTACTWRITESETTING& dbs) + bool set_contact_settings(HCONTACT hContact, DBCONTACTWRITESETTING& dbs) { assert(DBVT_DELETED != dbs.value.type); return (0 == db_set(hContact, dbs.szModule, dbs.szSetting, &dbs.value)); } - bool handle_module(HANDLE hContact,const IXMLNode::TXMLNodePtr& pXmlModule,UINT nFlags) + bool handle_module(HCONTACT hContact,const IXMLNode::TXMLNodePtr& pXmlModule,UINT nFlags) { size_t cCreatedRecords = 0; tstring sModuleName = pXmlModule->GetText(); @@ -488,7 +488,7 @@ namespace struct CContactState { CContactState() : m_hContact(NULL),m_bNewContact(false){} - HANDLE m_hContact; + HCONTACT m_hContact; CQuotesProviders::TQuotesProviderPtr m_pProvider; bool m_bNewContact; }; @@ -568,7 +568,7 @@ namespace visitor(const IXMLNode::TXMLNodePtr& pXmlQuotes) : m_hContact(NULL),m_pXmlQuotes(pXmlQuotes){} - HANDLE GetContact()const{return m_hContact;} + HCONTACT GetContact()const{return m_hContact;} private: virtual void Visit(const CQuotesProviderDukasCopy& rProvider) @@ -646,7 +646,7 @@ namespace } private: - HANDLE m_hContact; + HCONTACT m_hContact; IXMLNode::TXMLNodePtr m_pXmlQuotes; }; @@ -676,7 +676,7 @@ namespace { if(NULL == cst.m_hContact) { - cst.m_hContact = reinterpret_cast(CallService(MS_DB_CONTACT_ADD,0,0)); + cst.m_hContact = reinterpret_cast(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/QuoteChart.cpp b/plugins/Quotes/src/QuoteChart.cpp index 123c8c1a4f..82c4eefe0d 100644 --- a/plugins/Quotes/src/QuoteChart.cpp +++ b/plugins/Quotes/src/QuoteChart.cpp @@ -31,7 +31,7 @@ namespace return pChart; } - bool read_log_file(HANDLE hContact,TChart& rChart) + bool read_log_file(HCONTACT hContact,TChart& rChart) { tstring sLogFileName = GetContactLogFileName(hContact); if(false == sLogFileName.empty()) @@ -90,7 +90,7 @@ namespace case WM_CREATE: { CREATESTRUCT* pCS = reinterpret_cast(lp); - HANDLE hContact = reinterpret_cast(pCS->lpCreateParams); + HCONTACT hContact = reinterpret_cast(pCS->lpCreateParams); TChart* pChart = new TChart; read_log_file(hContact,*pChart); @@ -184,7 +184,7 @@ namespace inline HANDLE get_contact(HWND hWnd) { - HANDLE hContact = reinterpret_cast(GetWindowLongPtr(hWnd,GWLP_USERDATA)); + HCONTACT hContact = reinterpret_cast(GetWindowLongPtr(hWnd,GWLP_USERDATA)); return hContact; } @@ -202,7 +202,7 @@ namespace { case WM_INITDIALOG: { - HANDLE hContact = reinterpret_cast(lp); + HCONTACT hContact = reinterpret_cast(lp); TranslateDialogDefault(hDlg); @@ -260,7 +260,7 @@ namespace return (TRUE); case WM_CLOSE: { - HANDLE hContact = get_contact(hDlg); + HCONTACT hContact = get_contact(hDlg); SetWindowLongPtr(hDlg,GWLP_USERDATA,0); // save_options(hDlg,hContact); @@ -370,7 +370,7 @@ namespace INT_PTR QuotesMenu_Chart(WPARAM wp,LPARAM lp) { - HANDLE hContact = reinterpret_cast(wp); + HCONTACT hContact = reinterpret_cast(wp); if(NULL == hContact) { return 0; diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp index d21b3f2fed..fa7ae638c2 100644 --- a/plugins/Quotes/src/QuoteInfoDlg.cpp +++ b/plugins/Quotes/src/QuoteInfoDlg.cpp @@ -14,21 +14,21 @@ extern HGENMENU g_hMenuRefresh; namespace { - HANDLE g_hContact; + HCONTACT g_hContact; - inline bool IsMyContact(HANDLE hContact) + inline bool IsMyContact(HCONTACT hContact) { CQuotesProviders::TQuotesProviderPtr pProvider = CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact); return (NULL != pProvider); } - inline HANDLE get_contact(HWND hWnd) + inline HCONTACT get_contact(HWND hWnd) { - return reinterpret_cast(GetWindowLongPtr(hWnd,GWLP_USERDATA)); + return reinterpret_cast(GetWindowLongPtr(hWnd,GWLP_USERDATA)); } - bool get_fetch_time(time_t& rTime,HANDLE hContact) + bool get_fetch_time(time_t& rTime,HCONTACT hContact) { DBVARIANT dbv; if (db_get(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_FETCH_TIME, &dbv) || (DBVT_DWORD != dbv.type)) @@ -38,7 +38,7 @@ namespace return true; } - INT_PTR CALLBACK QuoteInfoDlgProcImpl(HANDLE hContact,HWND hdlg,UINT msg,WPARAM wParam,LPARAM lParam) + INT_PTR CALLBACK QuoteInfoDlgProcImpl(HCONTACT hContact,HWND hdlg,UINT msg,WPARAM wParam,LPARAM lParam) { switch(msg) { @@ -118,7 +118,7 @@ namespace int QuotesEventFunc_OnUserInfoInit(WPARAM wp,LPARAM lp) { - HANDLE hContact = reinterpret_cast(lp); + HCONTACT hContact = reinterpret_cast(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) { - HANDLE hContact = reinterpret_cast(wp); + HCONTACT hContact = reinterpret_cast(wp); if(NULL == hContact) { return 0; @@ -154,7 +154,7 @@ INT_PTR QuotesMenu_EditSettings(WPARAM wp,LPARAM lp) namespace { - bool get_log_file(HANDLE hContact,tstring& rsLogfile) + bool get_log_file(HCONTACT hContact,tstring& rsLogfile) { rsLogfile = GetContactLogFileName(hContact); return ((rsLogfile.empty()) ? false : true); @@ -163,7 +163,7 @@ namespace INT_PTR QuotesMenu_OpenLogFile(WPARAM wp,LPARAM lp) { - HANDLE hContact = reinterpret_cast(wp); + HCONTACT hContact = reinterpret_cast(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) { - HANDLE hContact = reinterpret_cast(wp); + HCONTACT hContact = reinterpret_cast(wp); if(NULL == hContact) { return 0; @@ -201,12 +201,12 @@ namespace { INT_PTR CALLBACK QuoteInfoDlgProc1(HWND hdlg,UINT msg,WPARAM wParam,LPARAM lParam) { - HANDLE hContact = NULL; + HCONTACT hContact = NULL; switch(msg) { case WM_INITDIALOG: { - hContact = reinterpret_cast(lParam); + hContact = reinterpret_cast(lParam); HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO,false); assert(hWL); WindowList_Add(hWL,hdlg,hContact); @@ -221,7 +221,7 @@ namespace return FALSE; case WM_DESTROY: { - HANDLE hContact = get_contact(hdlg); + HCONTACT hContact = get_contact(hdlg); if(hContact) { SetWindowLongPtr(hdlg,GWLP_USERDATA,0); @@ -251,7 +251,7 @@ namespace int Quotes_OnContactDoubleClick(WPARAM wp,LPARAM/* lp*/) { - HANDLE hContact = reinterpret_cast(wp); + HCONTACT hContact = reinterpret_cast(wp); if(CModuleInfo::GetQuoteProvidersPtr()->GetContactProviderPtr(hContact)) { HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_INFO,true); @@ -297,7 +297,7 @@ int Quotes_PrebuildContactMenu(WPARAM wp,LPARAM lp) #endif enable_menu(g_hMenuRefresh,false); - HANDLE hContact = reinterpret_cast(wp); + HCONTACT hContact = reinterpret_cast(wp); if(NULL == hContact) { return 0; diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp index e0f17a9b1d..b017c7c162 100644 --- a/plugins/Quotes/src/QuotesProviderBase.cpp +++ b/plugins/Quotes/src/QuotesProviderBase.cpp @@ -238,7 +238,7 @@ bool CQuotesProviderBase::IsOnline() return ID_STATUS_ONLINE == g_nStatus; } -void CQuotesProviderBase::AddContact(HANDLE hContact) +void CQuotesProviderBase::AddContact(HCONTACT hContact) { // CCritSection cs(m_cs); assert(m_aContacts.end() == std::find(m_aContacts.begin(),m_aContacts.end(),hContact)); @@ -246,7 +246,7 @@ void CQuotesProviderBase::AddContact(HANDLE hContact) m_aContacts.push_back(hContact); } -void CQuotesProviderBase::DeleteContact(HANDLE hContact) +void CQuotesProviderBase::DeleteContact(HCONTACT hContact) { CGuard cs(m_cs); @@ -257,7 +257,7 @@ void CQuotesProviderBase::DeleteContact(HANDLE hContact) } } -void CQuotesProviderBase::SetContactStatus(HANDLE hContact,int nNewStatus) +void CQuotesProviderBase::SetContactStatus(HCONTACT hContact,int nNewStatus) { int nStatus = db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_STATUS,ID_STATUS_OFFLINE); if(nNewStatus != nStatus) @@ -304,7 +304,7 @@ namespace public: CTendency() : m_nComparison(NonValid){} - bool Parse(const IQuotesProvider* pProvider,const tstring& rsFrmt,HANDLE hContact) + bool Parse(const IQuotesProvider* pProvider,const tstring& rsFrmt,HCONTACT hContact) { m_abValueFlags[0] = false; m_abValueFlags[1] = false; @@ -460,7 +460,7 @@ namespace }; tstring format_rate(const IQuotesProvider* pProvider, - HANDLE hContact, + HCONTACT hContact, const tstring& rsFrmt, double dRate) { @@ -535,7 +535,7 @@ namespace } void log_to_file(const IQuotesProvider* pProvider, - HANDLE hContact, + HCONTACT hContact, double dRate, const tstring& rsLogFileName, const tstring& rsFormat) @@ -563,7 +563,7 @@ namespace } void log_to_history(const IQuotesProvider* pProvider, - HANDLE hContact, + HCONTACT hContact, double dRate, time_t nTime, const tstring& rsFormat) @@ -581,7 +581,7 @@ namespace db_event_add(hContact, &dbei); } - bool do_set_contact_extra_icon(HANDLE hContact,const CTendency& tendency) + bool do_set_contact_extra_icon(HCONTACT hContact,const CTendency& tendency) { bool bResult = false; CTendency::EResult nComparison = tendency.Compare(); @@ -604,7 +604,7 @@ namespace } bool show_popup(const IQuotesProvider* pProvider, - HANDLE hContact, + HCONTACT hContact, double dRate, // double dPrevRate, // bool bValidPrevRate, @@ -685,7 +685,7 @@ namespace } } -void CQuotesProviderBase::WriteContactRate(HANDLE hContact,double dRate,const tstring& rsSymbol/* = ""*/) +void CQuotesProviderBase::WriteContactRate(HCONTACT hContact,double dRate,const tstring& rsSymbol/* = ""*/) { time_t nTime = ::time(NULL); @@ -825,9 +825,9 @@ void CQuotesProviderBase::WriteContactRate(HANDLE hContact,double dRate,const ts } } -HANDLE CQuotesProviderBase::CreateNewContact(const tstring& rsName) +HCONTACT CQuotesProviderBase::CreateNewContact(const tstring& rsName) { - HANDLE hContact = reinterpret_cast(CallService(MS_DB_CONTACT_ADD,0,0)); + 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)) @@ -1028,7 +1028,7 @@ void CQuotesProviderBase::RefreshAll() assert(b && "Failed to set event"); } -void CQuotesProviderBase::RefreshContact(HANDLE hContact) +void CQuotesProviderBase::RefreshContact(HCONTACT hContact) { {// for CCritSection CGuard cs(m_cs); @@ -1039,7 +1039,7 @@ void CQuotesProviderBase::RefreshContact(HANDLE hContact) assert(b && "Failed to set event"); } -void CQuotesProviderBase::SetContactExtraIcon(HANDLE hContact)const +void CQuotesProviderBase::SetContactExtraIcon(HCONTACT hContact)const { // tstring s = DBGetStringT(hContact,LIST_MODULE_NAME,CONTACT_LIST_NAME); // tostringstream o; diff --git a/plugins/Quotes/src/QuotesProviderBase.h b/plugins/Quotes/src/QuotesProviderBase.h index 7340d41f79..d468b38a68 100644 --- a/plugins/Quotes/src/QuotesProviderBase.h +++ b/plugins/Quotes/src/QuotesProviderBase.h @@ -50,7 +50,7 @@ public: }; protected: - typedef std::vector TContracts; + typedef std::vector TContracts; public: struct CXMLFileInfo; @@ -65,20 +65,20 @@ public: virtual bool Init(); virtual const CProviderInfo& GetInfo()const; - virtual void AddContact(HANDLE hContact); - virtual void DeleteContact(HANDLE hContact); + virtual void AddContact(HCONTACT hContact); + virtual void DeleteContact(HCONTACT hContact); virtual void Run(); virtual void Accept(CQuotesProviderVisitor& visitor)const; virtual void RefreshAll(); - virtual void RefreshContact(HANDLE hContact); - virtual void SetContactExtraIcon(HANDLE hContact)const; + virtual void RefreshContact(HCONTACT hContact); + virtual void SetContactExtraIcon(HCONTACT hContact)const; protected: const tstring& GetURL()const; - HANDLE CreateNewContact(const tstring& rsName); + HCONTACT CreateNewContact(const tstring& rsName); static bool IsOnline(); - static void SetContactStatus(HANDLE hContact,int nNewStatus); - void WriteContactRate(HANDLE hContact,double dRate,const tstring& rsSymbol = _T("")); + static void SetContactStatus(HCONTACT hContact,int nNewStatus); + void WriteContactRate(HCONTACT hContact,double dRate,const tstring& rsSymbol = _T("")); private: virtual void RefreshQuotes(TContracts& anContacts) = 0; diff --git a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp index 7a74575308..1d660b155d 100644 --- a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp +++ b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp @@ -10,12 +10,12 @@ CQuotesProviderDukasCopy::~CQuotesProviderDukasCopy() namespace { - inline tstring get_quote_id(HANDLE hContact) + inline tstring get_quote_id(HCONTACT hContact) { return Quotes_DBGetStringT(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_ID); } - inline bool is_quote_id_equal(HANDLE hContact,const tstring& sID) + inline bool is_quote_id_equal(HCONTACT hContact,const tstring& sID) { return sID == get_quote_id(hContact); } @@ -36,7 +36,7 @@ bool CQuotesProviderDukasCopy::WatchForQuote(const CQuote& rQuote,bool bWatch) if((false == bWatch) && (i != m_aContacts.end())) { - HANDLE hContact = *i; + HCONTACT hContact = *i; {// for CCritSection CGuard cs(m_cs); m_aContacts.erase(i); @@ -47,7 +47,7 @@ bool CQuotesProviderDukasCopy::WatchForQuote(const CQuote& rQuote,bool bWatch) } else if((true == bWatch) && (i == m_aContacts.end())) { - HANDLE hContact = CreateNewContact(rQuote.GetSymbol()); + HCONTACT hContact = CreateNewContact(rQuote.GetSymbol()); if(hContact) { db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_ID,sQuoteID.c_str()); @@ -72,7 +72,7 @@ tstring CQuotesProviderDukasCopy::BuildHTTPURL()const CGuard cs(m_cs); for(TContracts::const_iterator i = m_aContacts.begin();i != m_aContacts.end();++i) { - HANDLE hContact = *i; + HCONTACT hContact = *i; tstring sID = get_quote_id(hContact); if(false == sID.empty()) { @@ -243,7 +243,7 @@ void CQuotesProviderDukasCopy::RefreshQuotes(TContracts& anContacts) boost::bind(is_quote_id_equal,_1,ri.m_sID)); if(i != anContacts.end() && (true == IsOnline())) { - HANDLE hContact = *i; + HCONTACT hContact = *i; anContacts.erase(i); WriteContactRate(hContact,ri.m_dCurRate,ri.m_sName); @@ -270,38 +270,14 @@ void CQuotesProviderDukasCopy::Accept(CQuotesProviderVisitor& visitor)const visitor.Visit(*this); } -HANDLE CQuotesProviderDukasCopy::GetContactByQuoteID(const tstring& rsQuoteID)const +HCONTACT CQuotesProviderDukasCopy::GetContactByQuoteID(const tstring& rsQuoteID)const { CGuard cs(m_cs); TContracts::const_iterator i = std::find_if(m_aContacts.begin(),m_aContacts.end(), boost::bind(std::equal_to(),rsQuoteID,boost::bind(get_quote_id,_1))); if(i != m_aContacts.end()) - { return *i; - } - else - { - return NULL; - } -} - -// #ifdef CHART_IMPLEMENT -// bool CQuotesProviderDukasCopy::Chart(HANDLE hContact,const tstring& url)const -// { -// LogIt(Info,url); -// -// CHTTPSession http; -// if((true == http.OpenURL(url))) -// { -// tstring sHTML; -// if((true == http.ReadResponce(sHTML))) -// { -// LogIt(Info,sHTML); -// } -// } -// -// return false; -// } -// #endif //CHART_IMPLEMENT + return NULL; +} diff --git a/plugins/Quotes/src/QuotesProviderDukasCopy.h b/plugins/Quotes/src/QuotesProviderDukasCopy.h index 6bd49fc87e..117788c044 100644 --- a/plugins/Quotes/src/QuotesProviderDukasCopy.h +++ b/plugins/Quotes/src/QuotesProviderDukasCopy.h @@ -16,9 +16,9 @@ public: bool WatchForQuote(const CQuote& rQuote,bool bWatch); bool IsQuoteWatched(const CQuote& rQuote)const; - HANDLE GetContactByQuoteID(const tstring& rsQuoteID)const; + HCONTACT GetContactByQuoteID(const tstring& rsQuoteID)const; // #ifdef CHART_IMPLEMENT -// bool Chart(HANDLE hContact,const tstring& url)const; +// bool Chart(HCONTACT hContact,const tstring& url)const; // #endif private: diff --git a/plugins/Quotes/src/QuotesProviderFinance.cpp b/plugins/Quotes/src/QuotesProviderFinance.cpp index cbd121ea4b..83e6389d54 100644 --- a/plugins/Quotes/src/QuotesProviderFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderFinance.cpp @@ -3,7 +3,7 @@ void CQuotesProviderFinance::GetWatchedQuotes(TQuotes& raQuotes)const { raQuotes.clear(); - BOOST_FOREACH(HANDLE hContact,m_aContacts) + BOOST_FOREACH(HCONTACT hContact,m_aContacts) { tstring sID = Quotes_DBGetStringT(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_ID); tstring sSymbol = Quotes_DBGetStringT(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_SYMBOL,sID.c_str()); @@ -16,12 +16,12 @@ void CQuotesProviderFinance::GetWatchedQuotes(TQuotes& raQuotes)const namespace { - inline tstring get_quote_id(HANDLE hContact) + inline tstring get_quote_id(HCONTACT hContact) { return Quotes_DBGetStringT(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_ID); } - inline bool is_quote_id_equal(HANDLE hContact,const tstring& sID) + inline bool is_quote_id_equal(HCONTACT hContact,const tstring& sID) { return sID == get_quote_id(hContact); } @@ -35,7 +35,7 @@ bool CQuotesProviderFinance::WatchForQuote(const CQuote& rQuote,bool bWatch) if ((false == bWatch) && (i != m_aContacts.end())) { - HANDLE hContact = *i; + HCONTACT hContact = *i; {// for CCritSection CGuard cs(m_cs); m_aContacts.erase(i); @@ -46,7 +46,7 @@ bool CQuotesProviderFinance::WatchForQuote(const CQuote& rQuote,bool bWatch) } else if ((true == bWatch) && (i == m_aContacts.end())) { - HANDLE hContact = CreateNewContact(rQuote.GetSymbol()); + HCONTACT hContact = CreateNewContact(rQuote.GetSymbol()); if(hContact) { db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_ID,sQuoteID.c_str()); @@ -62,7 +62,7 @@ bool CQuotesProviderFinance::WatchForQuote(const CQuote& rQuote,bool bWatch) return false; } -HANDLE CQuotesProviderFinance::GetContactByQuoteID(const tstring& rsQuoteID)const +HCONTACT CQuotesProviderFinance::GetContactByQuoteID(const tstring& rsQuoteID)const { CGuard cs(m_cs); diff --git a/plugins/Quotes/src/QuotesProviderFinance.h b/plugins/Quotes/src/QuotesProviderFinance.h index f5f0e547cc..df71a70a90 100644 --- a/plugins/Quotes/src/QuotesProviderFinance.h +++ b/plugins/Quotes/src/QuotesProviderFinance.h @@ -9,7 +9,7 @@ public: public: void GetWatchedQuotes(TQuotes& raQuotes)const; bool WatchForQuote(const CQuote& rQuote,bool bWatch); - HANDLE GetContactByQuoteID(const tstring& rsQuoteID)const; + HCONTACT GetContactByQuoteID(const tstring& rsQuoteID)const; protected: virtual void ShowPropertyPage(WPARAM wp,OPTIONSDIALOGPAGE& odp); diff --git a/plugins/Quotes/src/QuotesProviderGoogle.cpp b/plugins/Quotes/src/QuotesProviderGoogle.cpp index f2fbc5f8ca..14f9ae1daa 100644 --- a/plugins/Quotes/src/QuotesProviderGoogle.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogle.cpp @@ -17,7 +17,7 @@ namespace return o.str(); } - inline bool is_rate_watched(HANDLE hContact, + inline bool is_rate_watched(HCONTACT hContact, const CQuotesProviderBase::CQuote& from, const CQuotesProviderBase::CQuote& to) { @@ -36,7 +36,7 @@ bool CQuotesProviderGoogle::WatchForRate(const CRateInfo& ri, if ((true == bWatch) && (i == m_aContacts.end())) { tstring sName = make_contact_name(ri.m_from.GetSymbol(),ri.m_to.GetSymbol()); - HANDLE hContact = CreateNewContact(sName); + HCONTACT hContact = CreateNewContact(sName); if(hContact) { db_set_ts(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_ID,ri.m_from.GetID().c_str()); @@ -55,7 +55,7 @@ bool CQuotesProviderGoogle::WatchForRate(const CRateInfo& ri, } else if ((false == bWatch) && (i != m_aContacts.end())) { - HANDLE hContact = *i; + HCONTACT hContact = *i; {// for CCritSection CGuard cs(m_cs); m_aContacts.erase(i); @@ -77,7 +77,7 @@ bool CQuotesProviderGoogle::GetWatchedRateInfo(size_t nIndex,CRateInfo& rRateInf { if(nIndex < m_aContacts.size()) { - HANDLE hContact = m_aContacts[nIndex]; + HCONTACT hContact = m_aContacts[nIndex]; tstring sSymbolFrom = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_ID); tstring sSymbolTo = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_ID); tstring sDescFrom = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_DESCRIPTION); @@ -101,7 +101,7 @@ namespace o << rsURL << _T("?a=") << std::fixed << dAmount << _T("&from=") << from << _T("&to=") << to; return o.str(); } - tstring build_url(HANDLE hContact,const tstring& rsURL,double dAmount = 1.0) + tstring build_url(HCONTACT hContact,const tstring& rsURL,double dAmount = 1.0) { tstring sFrom = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_ID); tstring sTo = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_ID); @@ -168,7 +168,7 @@ void CQuotesProviderGoogle::RefreshQuotes(TContracts& anContacts) for(TContracts::const_iterator i = anContacts.begin();i != anContacts.end() && IsOnline();++i) { - HANDLE hContact = *i; + HCONTACT hContact = *i; if(bUseExtendedStatus) { @@ -497,7 +497,7 @@ double CQuotesProviderGoogle::Convert(double dAmount,const CQuote& from,const CQ namespace { - bool is_equal_ids(HANDLE hContact,const tstring& rsFromID,const tstring& rsToID) + bool is_equal_ids(HCONTACT hContact,const tstring& rsFromID,const tstring& rsToID) { tstring sFrom = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_FROM_ID); tstring sTo = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_TO_ID); @@ -506,7 +506,7 @@ namespace } } -HANDLE CQuotesProviderGoogle::GetContactByID(const tstring& rsFromID,const tstring& rsToID)const +HCONTACT CQuotesProviderGoogle::GetContactByID(const tstring& rsFromID,const tstring& rsToID)const { CGuard cs(m_cs); diff --git a/plugins/Quotes/src/QuotesProviderGoogle.h b/plugins/Quotes/src/QuotesProviderGoogle.h index 48e3d27e11..59cb3273b0 100644 --- a/plugins/Quotes/src/QuotesProviderGoogle.h +++ b/plugins/Quotes/src/QuotesProviderGoogle.h @@ -27,7 +27,7 @@ public: size_t GetWatchedRateCount()const; bool GetWatchedRateInfo(size_t nIndex,CRateInfo& rRateInfo); - HANDLE GetContactByID(const tstring& rsFromID,const tstring& rsToID)const; + HCONTACT GetContactByID(const tstring& rsFromID,const tstring& rsToID)const; double Convert(double dAmount,const CQuote& from,const CQuote& to)const; diff --git a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp index 5150610ed5..be34fcb29e 100644 --- a/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp +++ b/plugins/Quotes/src/QuotesProviderGoogleFinance.cpp @@ -10,7 +10,7 @@ CQuotesProviderGoogleFinance::~CQuotesProviderGoogleFinance() namespace { - tstring build_url(HANDLE hContact,const tstring& rsURL) + tstring build_url(HCONTACT hContact,const tstring& rsURL) { tostringstream o; o << rsURL << _T("?q=") << Quotes_DBGetStringT(hContact,QUOTES_MODULE_NAME,DB_STR_QUOTE_ID); @@ -292,7 +292,7 @@ void CQuotesProviderGoogleFinance::RefreshQuotes(TContracts& anContacts) for(TContracts::const_iterator i = anContacts.begin();i != anContacts.end() && IsOnline();++i) { - HANDLE hContact = *i; + HCONTACT hContact = *i; if(bUseExtendedStatus) { diff --git a/plugins/Quotes/src/QuotesProviderVisitorFormater.cpp b/plugins/Quotes/src/QuotesProviderVisitorFormater.cpp index 0c95f3846f..a78096d052 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorFormater.cpp +++ b/plugins/Quotes/src/QuotesProviderVisitorFormater.cpp @@ -1,6 +1,6 @@ #include "StdAfx.h" -CQuotesProviderVisitorFormater::CQuotesProviderVisitorFormater(HANDLE hContact,TCHAR chr,int nWidth) +CQuotesProviderVisitorFormater::CQuotesProviderVisitorFormater(HCONTACT hContact,TCHAR chr,int nWidth) : m_hContact(hContact), m_chr(chr), m_nWidth(nWidth) @@ -45,7 +45,7 @@ void CQuotesProviderVisitorFormater::Visit(const CQuotesProviderGoogle& rProvide namespace { - bool get_fetch_time(HANDLE hContact,time_t& rTime) + bool get_fetch_time(HCONTACT hContact,time_t& rTime) { DBVARIANT dbv; if (db_get(hContact, QUOTES_MODULE_NAME, DB_STR_QUOTE_FETCH_TIME, &dbv) || (DBVT_DWORD != dbv.type)) @@ -55,7 +55,7 @@ namespace return true; } - tstring format_fetch_time(const CQuotesProviderBase& rProvider,HANDLE hContact,const tstring& rsFormat) + tstring format_fetch_time(const CQuotesProviderBase& rProvider,HCONTACT hContact,const tstring& rsFormat) { time_t nTime; if(true == get_fetch_time(hContact,nTime)) diff --git a/plugins/Quotes/src/QuotesProviderVisitorFormater.h b/plugins/Quotes/src/QuotesProviderVisitorFormater.h index 412c4a9fda..605c919725 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorFormater.h +++ b/plugins/Quotes/src/QuotesProviderVisitorFormater.h @@ -4,7 +4,7 @@ class CQuotesProviderVisitorFormater : public CQuotesProviderVisitor { public: - CQuotesProviderVisitorFormater(HANDLE hContact,TCHAR chr,int nWidth); + CQuotesProviderVisitorFormater(HCONTACT hContact,TCHAR chr,int nWidth); ~CQuotesProviderVisitorFormater(); const tstring& GetResult()const; @@ -21,7 +21,7 @@ private: // void FormatChangeValueHelper(bool bPercentage); private: - HANDLE m_hContact; + HCONTACT m_hContact; TCHAR m_chr; tstring m_sResult; int m_nWidth; diff --git a/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp b/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp index 752dcc403e..0f53784953 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp +++ b/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" -CQuotesProviderVisitorTendency::CQuotesProviderVisitorTendency(HANDLE hContact,TCHAR chr) +CQuotesProviderVisitorTendency::CQuotesProviderVisitorTendency(HCONTACT hContact,TCHAR chr) : m_hContact(hContact),m_chr(chr),m_bValid(false),m_dResult(0.0) { } diff --git a/plugins/Quotes/src/QuotesProviderVisitorTendency.h b/plugins/Quotes/src/QuotesProviderVisitorTendency.h index c9acf27317..48411d6a4b 100644 --- a/plugins/Quotes/src/QuotesProviderVisitorTendency.h +++ b/plugins/Quotes/src/QuotesProviderVisitorTendency.h @@ -4,7 +4,7 @@ class CQuotesProviderVisitorTendency : public CQuotesProviderVisitor { public: - CQuotesProviderVisitorTendency(HANDLE hContact,TCHAR chr); + CQuotesProviderVisitorTendency(HCONTACT hContact,TCHAR chr); bool IsValid()const{return m_bValid;} double GetResult()const{return m_dResult;} @@ -18,7 +18,7 @@ private: void GetValue(LPCSTR pszDbKeyName); private: - HANDLE m_hContact; + HCONTACT m_hContact; TCHAR m_chr; bool m_bValid; double m_dResult; diff --git a/plugins/Quotes/src/QuotesProviderYahoo.cpp b/plugins/Quotes/src/QuotesProviderYahoo.cpp index f34a21523b..20581b0d89 100644 --- a/plugins/Quotes/src/QuotesProviderYahoo.cpp +++ b/plugins/Quotes/src/QuotesProviderYahoo.cpp @@ -50,7 +50,7 @@ namespace typedef std::vector TStrings; - bool get_double_from_parsed_line(HANDLE hContact,const TStrings& rasParsedLine,size_t nIndex,const char* pszDbName) + bool get_double_from_parsed_line(HCONTACT hContact,const TStrings& rasParsedLine,size_t nIndex,const char* pszDbName) { if(rasParsedLine.size() > nIndex) { @@ -71,13 +71,13 @@ void CQuotesProviderYahoo::RefreshQuotes(TContracts& anContacts) tstring sURL = GetURL(); bool bUseExtendedStatus = CModuleInfo::GetInstance().GetExtendedStatusFlag(); - typedef std::map TQuoteID2ContractHandles; + typedef std::map TQuoteID2ContractHandles; TQuoteID2ContractHandles aQuoteID2Handles; tostringstream oURL; oURL << sURL << _T("dioksin.txt?s="); for(TContracts::const_iterator i = anContacts.begin();i != anContacts.end() && IsOnline();++i) { - HANDLE hContact = *i; + HCONTACT hContact = *i; if(bUseExtendedStatus) { SetContactStatus(hContact,ID_STATUS_OCCUPIED); @@ -151,7 +151,7 @@ void CQuotesProviderYahoo::RefreshQuotes(TContracts& anContacts) auto it3 = aQuoteID2Handles.find(asStrings[indexSymbol]); if(it3 != aQuoteID2Handles.end()) { - HANDLE hContact = it3->second; + HCONTACT hContact = it3->second; double dRate = 0.0; if(true == t2d(asStrings[indexLastTrade],dRate)) { diff --git a/plugins/Quotes/src/QuotesProviders.cpp b/plugins/Quotes/src/QuotesProviders.cpp index cfab6903ab..1acf732f6f 100644 --- a/plugins/Quotes/src/QuotesProviders.cpp +++ b/plugins/Quotes/src/QuotesProviders.cpp @@ -44,7 +44,7 @@ void CQuotesProviders::ClearProviders() namespace { - void convert_contact_settings(HANDLE hContact) + void convert_contact_settings(HCONTACT hContact) { WORD dwLogMode = db_get_w(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_LOG,static_cast(lmDisabled)); if ((dwLogMode&lmInternalHistory) || (dwLogMode&lmExternalFile)) @@ -60,7 +60,7 @@ void CQuotesProviders::InitProviders() const WORD nCurrentVersion = 17; WORD nVersion = db_get_w(NULL,QUOTES_MODULE_NAME,LAST_RUN_VERSION,1); - for(HANDLE hContact = db_find_first(QUOTES_MODULE_NAME); hContact; hContact = db_find_next(hContact, QUOTES_MODULE_NAME)) + for(HCONTACT hContact = db_find_first(QUOTES_MODULE_NAME); hContact; hContact = db_find_next(hContact, QUOTES_MODULE_NAME)) { TQuotesProviderPtr pProvider = GetContactProviderPtr(hContact); if(pProvider) @@ -76,7 +76,7 @@ void CQuotesProviders::InitProviders() db_set_w(NULL,QUOTES_MODULE_NAME,LAST_RUN_VERSION,nCurrentVersion); } -CQuotesProviders::TQuotesProviderPtr CQuotesProviders::GetContactProviderPtr(HANDLE hContact)const +CQuotesProviders::TQuotesProviderPtr CQuotesProviders::GetContactProviderPtr(HCONTACT hContact)const { char* szProto = GetContactProto(hContact); if(NULL == szProto || 0 != ::_stricmp(szProto, QUOTES_PROTOCOL_NAME)) diff --git a/plugins/Quotes/src/QuotesProviders.h b/plugins/Quotes/src/QuotesProviders.h index 8ccb3a5474..50394923cb 100644 --- a/plugins/Quotes/src/QuotesProviders.h +++ b/plugins/Quotes/src/QuotesProviders.h @@ -14,7 +14,7 @@ public: ~CQuotesProviders(); TQuotesProviderPtr FindProvider(const tstring& rsName)const; - TQuotesProviderPtr GetContactProviderPtr(HANDLE hContact)const; + TQuotesProviderPtr GetContactProviderPtr(HCONTACT hContact)const; const TQuotesProviders& GetProviders()const; private: diff --git a/plugins/Quotes/src/SettingsDlg.cpp b/plugins/Quotes/src/SettingsDlg.cpp index 9cf906526f..0045c21cad 100644 --- a/plugins/Quotes/src/SettingsDlg.cpp +++ b/plugins/Quotes/src/SettingsDlg.cpp @@ -126,10 +126,10 @@ namespace struct CSettingWindowParam { - CSettingWindowParam(HANDLE hContact) : m_hContact(hContact),m_pPopupSettings(NULL){} + CSettingWindowParam(HCONTACT hContact) : m_hContact(hContact),m_pPopupSettings(NULL){} ~CSettingWindowParam(){delete m_pPopupSettings;} - HANDLE m_hContact; + HCONTACT m_hContact; CPopupSettings* m_pPopupSettings; }; @@ -268,7 +268,7 @@ namespace { case WM_INITDIALOG: { - HANDLE hContact = reinterpret_cast(lp); + HCONTACT hContact = reinterpret_cast(lp); TranslateDialogDefault(hWnd); HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_SETTINGS,false); @@ -393,7 +393,7 @@ namespace case IDOK: { CSettingWindowParam* pParam = get_param(hWnd); - HANDLE hContact = pParam->m_hContact; + HCONTACT hContact = pParam->m_hContact; bool bUseContactSpec = 1 == ::IsDlgButtonChecked(hWnd,IDC_CHECK_CONTACT_SPECIFIC); @@ -507,7 +507,7 @@ namespace } -void ShowSettingsDlg(HANDLE hContact) +void ShowSettingsDlg(HCONTACT hContact) { HANDLE hWL = CModuleInfo::GetInstance().GetWindowList(WINDOW_PREFIX_SETTINGS,true); assert(hWL); @@ -933,7 +933,7 @@ COLORREF CPopupSettings::GetDefColourText() return ::GetSysColor(COLOR_BTNTEXT); } -void CPopupSettings::InitForContact(HANDLE hContact) +void CPopupSettings::InitForContact(HCONTACT hContact) { BYTE m = db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_MODE,static_cast(m_modeColour)); if(m >= CPopupSettings::colourDefault && m <= CPopupSettings::colourUserDefined) @@ -953,7 +953,7 @@ void CPopupSettings::InitForContact(HANDLE hContact) m_bUseHistory = 1 == db_get_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_HISTORY_FLAG,m_bUseHistory); } -void CPopupSettings::SaveForContact(HANDLE hContact)const +void CPopupSettings::SaveForContact(HCONTACT hContact)const { db_set_b(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_MODE,static_cast(m_modeColour)); db_set_dw(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_POPUP_COLOUR_BK,m_rgbBkg); @@ -1088,7 +1088,7 @@ tstring GenerateLogFileName(const tstring& rsLogFilePattern, return sPath; } -tstring GetContactLogFileName(HANDLE hContact) +tstring GetContactLogFileName(HCONTACT hContact) { tstring result; @@ -1113,7 +1113,7 @@ tstring GetContactLogFileName(HANDLE hContact) return result; } -tstring GetContactName(HANDLE hContact) +tstring GetContactName(HCONTACT hContact) { tstring sDescription = Quotes_DBGetStringT(hContact,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_DESCRIPTION); if(sDescription.empty()) diff --git a/plugins/Quotes/src/SettingsDlg.h b/plugins/Quotes/src/SettingsDlg.h index 569d0b7d2c..355f7bd216 100644 --- a/plugins/Quotes/src/SettingsDlg.h +++ b/plugins/Quotes/src/SettingsDlg.h @@ -25,8 +25,8 @@ public: static COLORREF GetDefColourBk(); static COLORREF GetDefColourText(); - void InitForContact(HANDLE hContact); - void SaveForContact(HANDLE hContact)const; + void InitForContact(HCONTACT hContact); + void SaveForContact(HCONTACT hContact)const; EColourMode GetColourMode()const; void SetColourMode(EColourMode nMode); @@ -101,7 +101,7 @@ private: mutable CPopupSettings* m_pPopupSettings; }; -void ShowSettingsDlg(HANDLE hContact); +void ShowSettingsDlg(HCONTACT hContact); bool ShowSettingsDlg(HWND hWndParent,CAdvProviderSettings* pAdvSettings); enum @@ -111,8 +111,8 @@ enum glfnResolveAll = glfnResolveQuoteName|glfnResolveUserProfile, }; tstring GenerateLogFileName(const tstring& rsLogFilePattern,const tstring& rsQuoteSymbol,int nFlags = glfnResolveAll); -tstring GetContactLogFileName(HANDLE hContact); -tstring GetContactName(HANDLE hContact); +tstring GetContactLogFileName(HCONTACT hContact); +tstring GetContactName(HCONTACT hContact); #endif //__E211E4D9_383C_43BE_A787_7EF1D585B90D_SettingsDlg_h__ diff --git a/plugins/Rate/src/main.cpp b/plugins/Rate/src/main.cpp index f9043254f4..b875ae23c6 100644 --- a/plugins/Rate/src/main.cpp +++ b/plugins/Rate/src/main.cpp @@ -69,7 +69,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda /////////////////////////////////////////////////////////////////////////////// -static void setExtraIcon(HANDLE hContact, int bRate = -1, BOOL clear = TRUE) +static void setExtraIcon(HCONTACT hContact, int bRate = -1, BOOL clear = TRUE) { if (hContact == NULL) return; @@ -106,7 +106,7 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) hExtraIcon = ExtraIcon_Register("contact_rate", LPGEN("Contact rate"), "rate_high"); // Set initial value for all contacts - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) setExtraIcon(hContact, -1, FALSE); return 0; @@ -117,7 +117,7 @@ int onContactSettingChanged(WPARAM wParam,LPARAM lParam) DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; if (wParam != NULL && !lstrcmpA(cws->szModule,"CList") && !lstrcmpA(cws->szSetting,"Rate")) - setExtraIcon((HANDLE)wParam, cws->value.type == DBVT_DELETED ? 0 : cws->value.bVal); + setExtraIcon((HCONTACT)wParam, cws->value.type == DBVT_DELETED ? 0 : cws->value.bVal); return 0; } diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index d1d129039f..335e4baf56 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -130,7 +130,7 @@ BOOL ShowListMainDlgProc_OpenContactMenu(HWND hDlg, HWND hList, int item, LASTUC if (hCMenu != NULL) { POINT p; GetCursorPos(&p); - DlgDat->hContact = (HANDLE) lvi.lParam; + DlgDat->hContact = (HCONTACT) lvi.lParam; BOOL ret = TrackPopupMenu(hCMenu, 0, p.x, p.y, 0, hDlg, NULL); DestroyMenu(hCMenu); if (ret) @@ -242,7 +242,7 @@ INT_PTR CALLBACK ShowListMainDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM if (LastUCOpt.HideOffline == 1) { szProto = GetContactProto(curContact->second); - if (szProto != NULL && db_get_w((HANDLE)curContact->second, szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) + if (szProto != NULL && db_get_w(curContact->second, szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) continue; } @@ -379,9 +379,8 @@ INT_PTR OnMenuCommandShowList(WPARAM wParam, LPARAM lParam) BYTE buf[1]; dbe.pBlob = buf; HANDLE curEvent; - HANDLE curContact = db_find_first(); - for (; curContact != NULL; curContact = db_find_next(curContact)) - { + + for (HCONTACT curContact = db_find_first(); curContact != NULL; curContact = db_find_next(curContact)) { curTime = ((__time64_t)db_get_dw(curContact, dbLastUC_ModuleName, dbLastUC_LastUsedTimeLo, -1)) | (((__time64_t)db_get_dw(curContact, dbLastUC_ModuleName, dbLastUC_LastUsedTimeHi, -1)) << 32); @@ -455,7 +454,7 @@ int Create_MenuitemShowList(void) return 0; } -BOOL SaveLastUsedTimeStamp(HANDLE hContact) +BOOL SaveLastUsedTimeStamp(HCONTACT hContact) { __time64_t ct = _time64(NULL); db_set_dw(hContact, dbLastUC_ModuleName, dbLastUC_LastUsedTimeLo, (DWORD)ct); @@ -485,7 +484,7 @@ static int OnPrebuildContactMenu (WPARAM wParam, LPARAM lParam) CLISTMENUITEM clmi = { sizeof(clmi) }; clmi.flags = CMIM_NAME | CMIF_TCHAR; - if ( db_get_b((HANDLE)wParam, dbLastUC_ModuleName, dbLastUC_IgnoreContact, 0) == 0) + if ( db_get_b((HCONTACT)wParam, dbLastUC_ModuleName, dbLastUC_IgnoreContact, 0) == 0) clmi.ptszName = TranslateT("Ignore Contact"); else clmi.ptszName = TranslateT("Show Contact"); @@ -516,7 +515,7 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) INT_PTR ToggleIgnore (WPARAM wParam, LPARAM lParam) { if (wParam != NULL) { - HANDLE hContact = ( HANDLE )wParam; + HCONTACT hContact = (HCONTACT)wParam; int state = db_get_b(hContact, dbLastUC_ModuleName, dbLastUC_IgnoreContact, 0) == 0 ? 1 : 0 ; db_set_b(hContact, dbLastUC_ModuleName, dbLastUC_IgnoreContact, state); return state; diff --git a/plugins/RecentContacts/src/RecentContacts.h b/plugins/RecentContacts/src/RecentContacts.h index 246bc9d8b0..474fce2d97 100644 --- a/plugins/RecentContacts/src/RecentContacts.h +++ b/plugins/RecentContacts/src/RecentContacts.h @@ -71,13 +71,13 @@ struct TABSRMM_SessionInfo { }; -typedef std::multimap <__time64_t, HANDLE, std::greater<__time64_t> > cmultimap; -typedef std::pair <__time64_t, HANDLE> cpair; +typedef std::multimap <__time64_t, HCONTACT, std::greater<__time64_t> > cmultimap; +typedef std::pair <__time64_t, HCONTACT> cpair; typedef struct LASTUC_DLG_DATA { cmultimap *Contacts; SIZE WindowMinSize; RECT ListUCRect; - HANDLE hContact; + HCONTACT hContact; } LASTUC_DLG_DATA; \ No newline at end of file diff --git a/plugins/RemovePersonalSettings/src/rps.cpp b/plugins/RemovePersonalSettings/src/rps.cpp index d1e8a698ea..0583087e57 100644 --- a/plugins/RemovePersonalSettings/src/rps.cpp +++ b/plugins/RemovePersonalSettings/src/rps.cpp @@ -97,7 +97,7 @@ BOOL GetSettings(const char *section, char *buffer, size_t bufferSize); void DeleteFileOrFolder(const char *name); void DeleteSetting(const char *setting); void DeleteSettingEx(const char *szModule, const char *szSetting); -BOOL isMetaContact(HANDLE hContact); +BOOL isMetaContact(HCONTACT hContact); @@ -222,9 +222,8 @@ void SetProtocolsOffline() void RemoveUsers() { if ( GetSettingBool("GlobalSettings", "RemoveAllUsers", TRUE) ) { - HANDLE hContact; + HCONTACT hContact, hContactOld; HANDLE hDbEvent; - HANDLE hContactOld; // To be faster, remove first all metacontacts (because it syncs histories) hContact = db_find_first(); @@ -232,14 +231,14 @@ void RemoveUsers() hContactOld = hContact; hContact = db_find_next(hContact); - if ( isMetaContact(hContactOld) ) - CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContactOld, 0); + if (isMetaContact(hContactOld) ) + CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContactOld, 0); } // Now delete all left-overs hContact = db_find_first(); while(hContact != NULL) { - CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); + CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); hContact = db_find_first(); } @@ -614,7 +613,7 @@ void DeleteFileOrFolder(const char *name) } -BOOL isMetaContact(HANDLE hContact) +BOOL isMetaContact(HCONTACT hContact) { return lstrcmpA(GetContactProto(hContact), METACONTACTS_PROTOCOL_NAME) == 0; } diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index 7e5d31be65..549d959a92 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -54,7 +54,7 @@ int LoadModules(void) int SmsRebuildContactMenu(WPARAM wParam,LPARAM lParam) { - Menu_ShowItem(ssSMSSettings.hContactMenuItems[0], GetContactPhonesCount((HANDLE)wParam)); + Menu_ShowItem(ssSMSSettings.hContactMenuItems[0], GetContactPhonesCount((HCONTACT)wParam)); return 0; } @@ -65,11 +65,11 @@ int SendSMSMenuCommand(WPARAM wParam,LPARAM lParam) // user clicked on the "SMS Message" on one of the users if (wParam) { - hwndSendSms = SendSMSWindowIsOtherInstanceHContact((HANDLE)wParam); + hwndSendSms = SendSMSWindowIsOtherInstanceHContact((HCONTACT)wParam); if (hwndSendSms) SetFocus(hwndSendSms); else - hwndSendSms = SendSMSWindowAdd((HANDLE)wParam); + hwndSendSms = SendSMSWindowAdd((HCONTACT)wParam); } // user clicked on the "SMS Send" in the Main Menu else{ @@ -77,7 +77,7 @@ int SendSMSMenuCommand(WPARAM wParam,LPARAM lParam) EnableWindow(GetDlgItem(hwndSendSms,IDC_NAME),TRUE); EnableWindow(GetDlgItem(hwndSendSms,IDC_SAVENUMBER),FALSE); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (GetContactPhonesCount(hContact)) { SendDlgItemMessage(hwndSendSms,IDC_NAME,CB_ADDSTRING,0,(LPARAM)GetContactNameW(hContact)); SendSMSWindowSMSContactAdd(hwndSendSms,hContact); @@ -134,7 +134,7 @@ void RestoreUnreadMessageAlerts(void) { DBEVENTINFO dbei = { sizeof(dbei) }; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) for (HANDLE hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hDbEvent)) { dbei.cbBlob = 0; if (db_event_get(hDbEvent, &dbei) == 0) diff --git a/plugins/SMS/src/common.h b/plugins/SMS/src/common.h index 5388d6dda6..ae468ebcc6 100644 --- a/plugins/SMS/src/common.h +++ b/plugins/SMS/src/common.h @@ -92,26 +92,26 @@ extern SMS_SETTINGS ssSMSSettings; #define DB_SMS_SetWord(Contact,valueName,parValue) db_set_w(Contact,PROTOCOL_NAMEA,valueName,parValue) #define DB_SMS_GetByte(Contact,valueName,parDefltValue) db_get_b(Contact,PROTOCOL_NAMEA,valueName,parDefltValue) #define DB_SMS_SetByte(Contact,valueName,parValue) db_set_b(Contact,PROTOCOL_NAMEA,valueName,parValue) -BOOL DB_GetStaticStringW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpszRetBuff,SIZE_T dwRetBuffSize,SIZE_T *pdwRetBuffSize); +BOOL DB_GetStaticStringW(HCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpszRetBuff,SIZE_T dwRetBuffSize,SIZE_T *pdwRetBuffSize); #define DB_SMS_GetStaticStringW(Contact,ValueName,Ret,RetBuffSize,pRetBuffSize) DB_GetStaticStringW(Contact,PROTOCOL_NAMEA,ValueName,Ret,RetBuffSize,pRetBuffSize) #define DB_SetStringW(Contact,Module,valueName,parValue) db_set_ws(Contact,Module,valueName,parValue) #define DB_SMS_SetStringW(Contact,valueName,parValue) db_set_ws(Contact,PROTOCOL_NAMEA,valueName,parValue) LRESULT CALLBACK MessageSubclassProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam); -LPSTR GetModuleName(HANDLE hContact); +LPSTR GetModuleName(HCONTACT hContact); void EnableControlsArray(HWND hWndDlg,WORD *pwControlsList,SIZE_T dwControlsListCount,BOOL bEnabled); // Declaration of function that returns received string with only numbers SIZE_T CopyNumberA(LPSTR lpszOutBuff,LPSTR lpszBuff,SIZE_T dwLen); SIZE_T CopyNumberW(LPWSTR lpcOutBuff,LPWSTR lpcBuff,SIZE_T dwLen); bool IsPhoneW(LPWSTR lpwszString,SIZE_T dwStringLen); -DWORD GetContactPhonesCount(HANDLE hContact); -BOOL IsContactPhone(HANDLE hContact,LPWSTR lpwszPhone,SIZE_T dwPhoneSize); +DWORD GetContactPhonesCount(HCONTACT hContact); +BOOL IsContactPhone(HCONTACT hContact,LPWSTR lpwszPhone,SIZE_T dwPhoneSize); // Declaration of function that returns HANDLE of contact by his cellular number -HANDLE HContactFromPhone(LPWSTR lpwszPhone,SIZE_T dwPhoneSize); -BOOL GetDataFromMessage(LPSTR lpszMessage,SIZE_T dwMessageSize,DWORD *pdwEventType,LPWSTR lpwszPhone,SIZE_T dwPhoneSize,SIZE_T *pdwPhoneSizeRet,UINT *piIcon); +HCONTACT HContactFromPhone(LPWSTR lpwszPhone,SIZE_T dwPhoneSize); +BOOL GetDataFromMessage(LPSTR lpszMessage,SIZE_T dwMessageSize,DWORD *pdwEventType,LPWSTR lpwszPhone,SIZE_T dwPhoneSize,SIZE_T *pdwPhoneSizeRet,UINT *piIcon); // Declaration of function that gets a XML string and return the asked tag. BOOL GetXMLFieldEx(LPSTR lpszXML,SIZE_T dwXMLSize,LPSTR *plpszData,SIZE_T *pdwDataSize,const char *tag1,...); diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp index f61e6ee67d..d560ad733c 100644 --- a/plugins/SMS/src/functions.cpp +++ b/plugins/SMS/src/functions.cpp @@ -1,6 +1,6 @@ #include "common.h" -BOOL DB_GetStaticStringW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszRetBuff,SIZE_T dwRetBuffSize,SIZE_T *pdwRetBuffSize) +BOOL DB_GetStaticStringW(HCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszRetBuff,SIZE_T dwRetBuffSize,SIZE_T *pdwRetBuffSize) {// sizes in wchars BOOL bRet=FALSE; SIZE_T dwReadedStringLen; @@ -26,7 +26,7 @@ BOOL DB_GetStaticStringW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LP return(bRet); } -LPSTR GetModuleName(HANDLE hContact) +LPSTR GetModuleName(HCONTACT hContact) { LPSTR lpszRet; @@ -92,7 +92,7 @@ bool IsPhoneW(LPWSTR lpwszString,SIZE_T dwStringLen) } -DWORD GetContactPhonesCountParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName) +DWORD GetContactPhonesCountParam(HCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName) { DWORD dwRet=0; char szBuff[MAX_PATH]; @@ -113,7 +113,7 @@ DWORD GetContactPhonesCountParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValu } -DWORD GetContactPhonesCount(HANDLE hContact) +DWORD GetContactPhonesCount(HCONTACT hContact) { DWORD dwRet = 0; LPSTR lpszProto = GetContactProto(hContact); @@ -130,7 +130,7 @@ DWORD GetContactPhonesCount(HANDLE hContact) } -BOOL IsContactPhoneParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszPhone,SIZE_T dwPhoneSize) +BOOL IsContactPhoneParam(HCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszPhone,SIZE_T dwPhoneSize) { char szBuff[MAX_PATH]; WCHAR wszPhoneLocal[MAX_PHONE_LEN]; @@ -157,7 +157,7 @@ BOOL IsContactPhoneParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LP } -BOOL IsContactPhone(HANDLE hContact,LPWSTR lpwszPhone,SIZE_T dwPhoneSize) +BOOL IsContactPhone(HCONTACT hContact,LPWSTR lpwszPhone,SIZE_T dwPhoneSize) { BOOL bRet=FALSE; WCHAR wszPhoneLocal[MAX_PHONE_LEN]; @@ -181,11 +181,11 @@ BOOL IsContactPhone(HANDLE hContact,LPWSTR lpwszPhone,SIZE_T dwPhoneSize) //This function get a string cellular number and return the HANDLE of the contact that has this //number in the miranda phonebook (and marked as an SMS able) at the User Details. //If no one has this number function returns NULL. -HANDLE HContactFromPhone(LPWSTR lpwszPhone,SIZE_T dwPhoneSize) +HCONTACT HContactFromPhone(LPWSTR lpwszPhone,SIZE_T dwPhoneSize) { if (lpwszPhone && dwPhoneSize) { //check not already on list - for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) if (IsContactPhone(hContact,lpwszPhone,dwPhoneSize)) return hContact; } diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp index 43cab8af13..e6f647adc6 100644 --- a/plugins/SMS/src/receive.cpp +++ b/plugins/SMS/src/receive.cpp @@ -45,7 +45,6 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) { LPSTR lpszMessageUTF; SIZE_T dwBuffLen,dwMessageXMLEncodedSize,dwMessageXMLDecodedSize; - HANDLE hContact; DBEVENTINFO dbei = { sizeof(dbei) }; dwBuffLen=(dwDataSize+MAX_PATH); @@ -61,7 +60,7 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) dwPhoneSize=CopyNumberA(szPhone,lpszPhone,dwPhoneSize); dwPhoneSize=MultiByteToWideChar(CP_UTF8,0,szPhone,dwPhoneSize,tszPhone,MAX_PHONE_LEN); - hContact=HContactFromPhone(tszPhone,dwPhoneSize); + HCONTACT hContact=HContactFromPhone(tszPhone,dwPhoneSize); dbei.szModule=GetModuleName(hContact); dbei.timestamp=time(NULL); @@ -89,7 +88,7 @@ int handleAckSMS(WPARAM wParam,LPARAM lParam) { dwPhoneSize=CopyNumberA(szPhone,lpszPhone,dwPhoneSize); dwPhoneSize=MultiByteToWideChar(CP_UTF8,0,szPhone,dwPhoneSize,tszPhone,MAX_PHONE_LEN); - HANDLE hContact=HContactFromPhone(tszPhone,dwPhoneSize); + HCONTACT hContact=HContactFromPhone(tszPhone,dwPhoneSize); DBEVENTINFO dbei={0}; dbei.cbSize=sizeof(dbei); @@ -212,7 +211,8 @@ int handleNewMessage(WPARAM wParam, LPARAM lParam) { char szServiceFunction[MAX_PATH], *pszServiceFunctionName; TCHAR szToolTip[MAX_PATH]; - HANDLE hContact = (HANDLE)wParam, hDbEvent = (HANDLE)lParam; + HCONTACT hContact = (HCONTACT)wParam; + HANDLE hDbEvent = (HANDLE)lParam; DBEVENTINFO dbei = { sizeof(dbei) }; if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) != -1) { diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index e7f640ffca..eea5b7ca60 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -30,10 +30,10 @@ Enjoy the code and use it smartly! //Defnition needed to the SMS window list typedef struct { - LIST_MT_ITEM lmtListMTItem; - HWND hWnd; - HBRUSH hBkgBrush; - HANDLE hContact; + LIST_MT_ITEM lmtListMTItem; + HWND hWnd; + HBRUSH hBkgBrush; + HCONTACT hContact; } RECV_SMS_WINDOW_DATA; INT_PTR CALLBACK RecvSmsDlgProc (HWND hWndDlg,UINT message,WPARAM wParam,LPARAM lParam); @@ -134,7 +134,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l { WCHAR wszPhone[MAX_PHONE_LEN]; HWND hwndSendSms; - HANDLE hContact; + HCONTACT hContact; hContact=HContactFromPhone(wszPhone,GetDlgItemText(hWndDlg,IDC_NUMBER,wszPhone,SIZEOF(wszPhone))); hwndSendSms=SendSMSWindowIsOtherInstanceHContact(hContact); @@ -164,7 +164,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l //This function create a new SMS receive window, and insert it to the list. //The function gets void and return the window HWND -HWND RecvSMSWindowAdd(HANDLE hContact,DWORD dwEventType,LPWSTR lpwszPhone,SIZE_T dwPhoneSize,LPSTR lpszMessage,SIZE_T dwMessageSize) +HWND RecvSMSWindowAdd(HCONTACT hContact,DWORD dwEventType,LPWSTR lpwszPhone,SIZE_T dwPhoneSize,LPSTR lpszMessage,SIZE_T dwMessageSize) { HWND hRet=NULL; diff --git a/plugins/SMS/src/recvdlg.h b/plugins/SMS/src/recvdlg.h index 5090dff12e..47363466fe 100644 --- a/plugins/SMS/src/recvdlg.h +++ b/plugins/SMS/src/recvdlg.h @@ -3,7 +3,7 @@ DWORD RecvSMSWindowInitialize (); void RecvSMSWindowDestroy (); -HWND RecvSMSWindowAdd (HANDLE hContact,DWORD dwEventType,LPWSTR lpwszPhone,SIZE_T dwPhoneSize,LPSTR lpszMessage,SIZE_T dwMessageSize); +HWND RecvSMSWindowAdd (HCONTACT hContact,DWORD dwEventType,LPWSTR lpwszPhone,SIZE_T dwPhoneSize,LPSTR lpszMessage,SIZE_T dwMessageSize); void RecvSMSWindowRemove (HWND hWndDlg); diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index e92fdbe2ce..e8c32565e7 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -36,20 +36,20 @@ Enjoy the code and use it smartly! //Defnition needed to the SMS window list typedef struct { - LIST_MT_ITEM lmtListMTItem; - HWND hWnd; - HBRUSH hBkgBrush; - HANDLE hProcess; - HANDLE hContact; - HANDLE hMyContact; - HTREEITEM hItemSend; - BOOL bMultiple; - SIZE_T dwContactsListCount; - HANDLE *phContactsList; - DBEVENTINFO *pdbei; + LIST_MT_ITEM lmtListMTItem; + HWND hWnd; + HBRUSH hBkgBrush; + HANDLE hProcess; + HCONTACT hContact; + HCONTACT hMyContact; + HTREEITEM hItemSend; + BOOL bMultiple; + SIZE_T dwContactsListCount; + HCONTACT *phContactsList; + DBEVENTINFO *pdbei; } SEND_SMS_WINDOW_DATA; -void AddContactPhonesToCombo (HWND hWnd,HANDLE hContact); +void AddContactPhonesToCombo (HWND hWnd,HCONTACT hContact); void SendSMSWindowFillTreeView (HWND hWnd); SIZE_T GetSMSMessageLenMax (HWND hWndDlg); @@ -427,7 +427,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l SendDlgItemMessage(hWndDlg,IDC_ADDRESS,CB_RESETCONTENT,0,0); if (SendDlgItemMessage(hWndDlg,IDC_NAME,CB_GETCURSEL,0,0)) { - HANDLE hContact=SendSMSWindowSMSContactGet(hWndDlg,(SendDlgItemMessage(hWndDlg,IDC_NAME,CB_GETCURSEL,0,0)-1)); + HCONTACT hContact = SendSMSWindowSMSContactGet(hWndDlg,(SendDlgItemMessage(hWndDlg,IDC_NAME,CB_GETCURSEL,0,0)-1)); if (hContact) AddContactPhonesToCombo(hWndDlg,hContact); } } @@ -557,7 +557,7 @@ INT_PTR CALLBACK SMSAcceptedDlgProc(HWND hWndDlg,UINT msg,WPARAM wParam,LPARAM l //This function create a new SMS send window, and insert it to the list. //The function gets void and return the window HWND -HWND SendSMSWindowAdd(HANDLE hContact) +HWND SendSMSWindowAdd(HCONTACT hContact) { HWND hRet=NULL; SEND_SMS_WINDOW_DATA *psswdWindowData=(SEND_SMS_WINDOW_DATA*)MEMALLOC(sizeof(SEND_SMS_WINDOW_DATA)); @@ -608,18 +608,18 @@ void SendSMSWindowRemove(HWND hWndDlg) //This function return the contact HANDLE for the given to the SMS send window. //The function gets the HWND of the window and return the HANDLE of the contact. -HANDLE SendSMSWindowHContactGet(HWND hWndDlg) +HCONTACT SendSMSWindowHContactGet(HWND hWndDlg) { - HANDLE hRet=NULL; + HCONTACT hRet=NULL; SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg); if (psswdWindowData) hRet=psswdWindowData->hMyContact; -return(hRet); + return(hRet); } //This function set the contact info of the person we send him the in the given to the SMS send window. //The function gets the HWND of the window and the HANDLE of the contact and return void -void SendSMSWindowHContactSet(HWND hWndDlg,HANDLE hContact) +void SendSMSWindowHContactSet(HWND hWndDlg,HCONTACT hContact) { SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg); if (psswdWindowData) psswdWindowData->hMyContact=hContact; @@ -837,7 +837,7 @@ return(NULL); //This function get the HANDLE of an user. if there is already a SMS send window for this contact //it return its HWND else the function return NULL. //The function gets the HANDLE of a contact and return HWND -HWND SendSMSWindowIsOtherInstanceHContact(HANDLE hContact) +HWND SendSMSWindowIsOtherInstanceHContact(HCONTACT hContact) { HWND hRet=NULL; SEND_SMS_WINDOW_DATA *psswdWindowData; @@ -893,33 +893,30 @@ void SendSMSWindowNext(HWND hWndDlg) ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// //This function gets a HANDLE of a contact and add it to a list. -void SendSMSWindowSMSContactAdd(HWND hWndDlg,HANDLE hContact) +void SendSMSWindowSMSContactAdd(HWND hWndDlg,HCONTACT hContact) { SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg); - if (psswdWindowData) - { + if (psswdWindowData) { psswdWindowData->dwContactsListCount++; if (psswdWindowData->phContactsList) - { - psswdWindowData->phContactsList=(HANDLE*)MEMREALLOC(psswdWindowData->phContactsList,(sizeof(HANDLE)*psswdWindowData->dwContactsListCount)); - }else{ - psswdWindowData->phContactsList=(HANDLE*)MEMALLOC((sizeof(HANDLE)*psswdWindowData->dwContactsListCount)); - } + psswdWindowData->phContactsList = (HCONTACT*)MEMREALLOC(psswdWindowData->phContactsList,(sizeof(HANDLE)*psswdWindowData->dwContactsListCount)); + else + psswdWindowData->phContactsList = (HCONTACT*)MEMALLOC((sizeof(HANDLE)*psswdWindowData->dwContactsListCount)); + *(psswdWindowData->phContactsList+psswdWindowData->dwContactsListCount-1)=hContact; } } //This function gets the number of the given contact in the combo list and return its contact. -HANDLE SendSMSWindowSMSContactGet(HWND hWndDlg,SIZE_T iNum) +HCONTACT SendSMSWindowSMSContactGet(HWND hWndDlg,SIZE_T iNum) { SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg); if (psswdWindowData) - { return(*((psswdWindowData->phContactsList)+iNum)); - } -return(NULL); + + return(NULL); } void SendSMSWindowSMSContactsRemove(HWND hWndDlg) @@ -977,7 +974,7 @@ void SendSMSWindowsUpdateAllAccountLists() -void AddContactPhonesToComboToListParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,HWND hWndList) +void AddContactPhonesToComboToListParam(HCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,HWND hWndList) { char szBuff[MAX_PATH]; TCHAR tszPhone[MAX_PHONE_LEN],tszPhoneRaw[MAX_PHONE_LEN]; @@ -1011,7 +1008,7 @@ void AddContactPhonesToComboToListParam(HANDLE hContact,LPSTR lpszModule,LPSTR l } -void AddContactPhonesToCombo(HWND hWnd,HANDLE hContact) +void AddContactPhonesToCombo(HWND hWnd,HCONTACT hContact) { HWND hWndList = GetDlgItem(hWnd,IDC_ADDRESS); SendDlgItemMessage(hWnd,IDC_ADDRESS,CB_RESETCONTENT,0,0); @@ -1032,7 +1029,7 @@ void AddContactPhonesToCombo(HWND hWnd,HANDLE hContact) -void AddContactPhonesToTreeViewParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,HWND hWndList,HTREEITEM *phParent) +void AddContactPhonesToTreeViewParam(HCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,HWND hWndList,HTREEITEM *phParent) { char szBuff[MAX_PATH]; TCHAR tszPhone[MAX_PHONE_LEN],tszPhoneRaw[MAX_PHONE_LEN]; @@ -1090,7 +1087,7 @@ void SendSMSWindowFillTreeView(HWND hWnd) HWND hWndTreeView=GetDlgItem(hWnd,IDC_NUMBERSLIST); TreeView_DeleteAllItems(hWndTreeView); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HTREEITEM hParent = NULL; LPSTR lpszProto = GetContactProto(hContact); if (lpszProto) { diff --git a/plugins/SMS/src/senddlg.h b/plugins/SMS/src/senddlg.h index e3ad1d40b5..81c7acf2dc 100644 --- a/plugins/SMS/src/senddlg.h +++ b/plugins/SMS/src/senddlg.h @@ -11,26 +11,26 @@ INT_PTR CALLBACK SMSTimedOutDlgProc(HWND hWndDlg,UINT msg,WPARAM wParam,LPARAM l HTREEITEM SendSMSWindowHItemSendGet(HWND hWndDlg); HTREEITEM SendSMSWindowNextHItemGet(HWND hWndDlg,HTREEITEM hItem); -HWND SendSMSWindowAdd(HANDLE hContact); -void SendSMSWindowRemove(HWND hWndDlg); -HANDLE SendSMSWindowHContactGet(HWND hWndDlg); -void SendSMSWindowHContactSet(HWND hWndDlg,HANDLE hContact); -HWND SendSMSWindowHwndByHProcessGet(HANDLE hProcess); -void SendSMSWindowHProcessSet(HWND hWndDlg,HANDLE hProcess); -BOOL SendSMSWindowMultipleGet(HWND hWndDlg); -void SendSMSWindowMultipleSet(HWND hWndDlg,BOOL bMultiple); -void SendSMSWindowNumberSet(HWND hWndDlg,LPWSTR lpwszPhone,SIZE_T dwPhoneSize); -void SendSMSWindowAsSentSet(HWND hWndDlg); -void SendSMSWindowDbeiSet(HWND hWndDlg,DBEVENTINFO *pdbei); -void SendSMSWindowDBAdd(HWND hWndDlg); -void SendSMSWindowHItemSendSet(HWND hWndDlg,HTREEITEM hItemSend); -HWND SendSMSWindowIsOtherInstanceHContact(HANDLE hContact); -void SendSMSWindowNext(HWND hWndDlg); +HWND SendSMSWindowAdd(HCONTACT hContact); +void SendSMSWindowRemove(HWND hWndDlg); +HCONTACT SendSMSWindowHContactGet(HWND hWndDlg); +void SendSMSWindowHContactSet(HWND hWndDlg,HCONTACT hContact); +HWND SendSMSWindowHwndByHProcessGet(HANDLE hProcess); +void SendSMSWindowHProcessSet(HWND hWndDlg,HANDLE hProcess); +BOOL SendSMSWindowMultipleGet(HWND hWndDlg); +void SendSMSWindowMultipleSet(HWND hWndDlg,BOOL bMultiple); +void SendSMSWindowNumberSet(HWND hWndDlg,LPWSTR lpwszPhone,SIZE_T dwPhoneSize); +void SendSMSWindowAsSentSet(HWND hWndDlg); +void SendSMSWindowDbeiSet(HWND hWndDlg,DBEVENTINFO *pdbei); +void SendSMSWindowDBAdd(HWND hWndDlg); +void SendSMSWindowHItemSendSet(HWND hWndDlg,HTREEITEM hItemSend); +HWND SendSMSWindowIsOtherInstanceHContact(HCONTACT hContact); +void SendSMSWindowNext(HWND hWndDlg); -void SendSMSWindowSMSContactAdd(HWND hWndDlg,HANDLE hContact); -HANDLE SendSMSWindowSMSContactGet(HWND hWndDlg,SIZE_T iNum); -void SendSMSWindowSMSContactsRemove(HWND hWndDlg); -void SendSMSWindowUpdateAccountList(HWND hWndDlg); -void SendSMSWindowsUpdateAllAccountLists(); +void SendSMSWindowSMSContactAdd(HWND hWndDlg,HCONTACT hContact); +HCONTACT SendSMSWindowSMSContactGet(HWND hWndDlg,SIZE_T iNum); +void SendSMSWindowSMSContactsRemove(HWND hWndDlg); +void SendSMSWindowUpdateAccountList(HWND hWndDlg); +void SendSMSWindowsUpdateAllAccountLists(); #endif // !defined(AFX_SMS_SENDDLG_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_) diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h index 795a882eee..4481f69b4e 100644 --- a/plugins/Scriver/src/chat/chat.h +++ b/plugins/Scriver/src/chat/chat.h @@ -93,7 +93,7 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedraw); void LoadMsgLogBitmaps(void); void FreeMsgLogBitmaps(void); -TCHAR* GetChatLogsFilename (HANDLE hContact, time_t tTime); +TCHAR* GetChatLogsFilename(HCONTACT hContact, time_t tTime); // window.c int GetTextPixelSize( TCHAR* pszText, HFONT hFont, BOOL bWidth); @@ -105,7 +105,7 @@ int OptionsInit(void); void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground); // manager.c -HWND SM_FindWindowByContact(HANDLE hContact); +HWND SM_FindWindowByContact(HCONTACT hContact); SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const TCHAR* pszOriginal, const TCHAR* pszCurrent); char SM_GetStatusIndicator(SESSION_INFO *si, USERINFO *ui); diff --git a/plugins/Scriver/src/chat/manager.cpp b/plugins/Scriver/src/chat/manager.cpp index 821a82bde6..51b1b7b4e0 100644 --- a/plugins/Scriver/src/chat/manager.cpp +++ b/plugins/Scriver/src/chat/manager.cpp @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../commonheaders.h" -HWND SM_FindWindowByContact(HANDLE hContact) +HWND SM_FindWindowByContact(HCONTACT hContact) { SESSION_INFO *pTemp = pci->wndList; diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index e5b2cfc617..196d868a7f 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -152,7 +152,7 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char* pszModule, int return TRUE; } -TCHAR* GetChatLogsFilename(HANDLE hContact, time_t tTime) +TCHAR* GetChatLogsFilename(HCONTACT hContact, time_t tTime) { REPLACEVARSARRAY rva[11]; TCHAR *p = { 0 }, *tszParsedName = { 0 }; diff --git a/plugins/Scriver/src/cmdlist.cpp b/plugins/Scriver/src/cmdlist.cpp index af591908db..1c6669877b 100644 --- a/plugins/Scriver/src/cmdlist.cpp +++ b/plugins/Scriver/src/cmdlist.cpp @@ -71,7 +71,7 @@ TCmdList *tcmdlist_remove(TCmdList *list, TCmdList *n) return list; } -TCmdList *tcmdlist_append2(TCmdList *list, HANDLE hContact, const char *data) +TCmdList *tcmdlist_append2(TCmdList *list, HCONTACT hContact, const char *data) { TCmdList *new_list = (TCmdList *)mir_alloc(sizeof(TCmdList)); TCmdList *attach_to = NULL; @@ -98,7 +98,7 @@ TCmdList *tcmdlist_append2(TCmdList *list, HANDLE hContact, const char *data) return list; } -TCmdList *tcmdlist_remove2(TCmdList *list, HANDLE hContact) +TCmdList *tcmdlist_remove2(TCmdList *list, HCONTACT hContact) { for (TCmdList *n = list; n != NULL; n = n->next) { if (n->hContact == hContact) { @@ -113,7 +113,7 @@ TCmdList *tcmdlist_remove2(TCmdList *list, HANDLE hContact) return list; } -TCmdList *tcmdlist_get2(TCmdList *list, HANDLE hContact) +TCmdList *tcmdlist_get2(TCmdList *list, HCONTACT hContact) { for (TCmdList *n = list; n != NULL; n = n->next) if (n->hContact == hContact) diff --git a/plugins/Scriver/src/cmdlist.h b/plugins/Scriver/src/cmdlist.h index f3ff8309db..ec9675474c 100644 --- a/plugins/Scriver/src/cmdlist.h +++ b/plugins/Scriver/src/cmdlist.h @@ -32,9 +32,9 @@ typedef struct _TCmdList { TCmdList *tcmdlist_append(TCmdList *list, const char *data, int maxSize, BOOL temporary); TCmdList *tcmdlist_remove(TCmdList *list, TCmdList *n); TCmdList *tcmdlist_remove_first(TCmdList *list); -TCmdList *tcmdlist_append2(TCmdList *list, HANDLE hContact, const char *data); -TCmdList *tcmdlist_remove2(TCmdList *list, HANDLE hContact); -TCmdList *tcmdlist_get2(TCmdList *list, HANDLE hContact); +TCmdList *tcmdlist_append2(TCmdList *list, HCONTACT hContact, const char *data); +TCmdList *tcmdlist_remove2(TCmdList *list, HCONTACT hContact); +TCmdList *tcmdlist_get2(TCmdList *list, HCONTACT hContact); int tcmdlist_len(TCmdList *list); TCmdList *tcmdlist_last(TCmdList *list); void tcmdlist_free(TCmdList * list); diff --git a/plugins/Scriver/src/commonheaders.h b/plugins/Scriver/src/commonheaders.h index d49706abec..9061830df1 100644 --- a/plugins/Scriver/src/commonheaders.h +++ b/plugins/Scriver/src/commonheaders.h @@ -102,7 +102,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define CFM_WEIGHT 0x00400000 #endif -extern HWND SM_FindWindowByContact(HANDLE hContact); +extern HWND SM_FindWindowByContact(HCONTACT hContact); extern HINSTANCE g_hInst; extern CREOleCallback reOleCallback; extern void ChangeStatusIcons(); diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index dcb1ec887f..51b2afb776 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -400,15 +400,15 @@ static int ackevent(WPARAM wParam, LPARAM lParam) return 0; ACKDATA *ack = (ACKDATA*)lParam; - MessageSendQueueItem *item = FindSendQueueItem((HANDLE)pAck->hContact, (HANDLE)pAck->hProcess); + MessageSendQueueItem *item = FindSendQueueItem(pAck->hContact, (HANDLE)pAck->hProcess); if (item == NULL) return 0; HWND hwndSender = item->hwndSender; if (ack->result == ACKRESULT_FAILED) { - if (item->hwndErrorDlg != NULL) { - item = FindOldestPendingSendQueueItem(hwndSender, (HANDLE)pAck->hContact); - } + if (item->hwndErrorDlg != NULL) + item = FindOldestPendingSendQueueItem(hwndSender, pAck->hContact); + if (item != NULL && item->hwndErrorDlg == NULL) { if (hwndSender != NULL) { ErrorWindowData *ewd = (ErrorWindowData *)mir_alloc(sizeof(ErrorWindowData)); diff --git a/plugins/Scriver/src/globals.h b/plugins/Scriver/src/globals.h index 20cd1e1a19..65ae3b8706 100644 --- a/plugins/Scriver/src/globals.h +++ b/plugins/Scriver/src/globals.h @@ -129,7 +129,7 @@ void ReleaseIcons(); void LoadGlobalIcons(); HICON GetCachedIcon(const char *name); void RegisterFontServiceFonts(); -int ScriverRestoreWindowPosition(HWND hwnd,HANDLE hContact,const char *szModule,const char *szNamePrefix, int flags, int showCmd); +int ScriverRestoreWindowPosition(HWND hwnd,HCONTACT hContact,const char *szModule,const char *szNamePrefix, int flags, int showCmd); int ImageList_AddIcon_Ex(HIMAGELIST hIml, int id); int ImageList_AddIcon_Ex2(HIMAGELIST hIml, HICON hIcon); diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index e38356629c..01d286fd0a 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -29,7 +29,7 @@ enum KB_ACTIONS {KB_PREV_TAB = 1, KB_NEXT_TAB, KB_SWITCHTOOLBAR, KB_SWITCHSTATUSBAR, KB_SWITCHTITLEBAR, KB_SWITCHINFOBAR, KB_MINIMIZE, KB_CLOSE, KB_CLEAR_LOG, KB_TAB1, KB_TAB2, KB_TAB3, KB_TAB4, KB_TAB5, KB_TAB6, KB_TAB7, KB_TAB8, KB_TAB9, KB_SEND_ALL, KB_PASTESEND, KB_QUOTE}; -void InputAreaContextMenu(HWND hwnd, WPARAM wParam, LPARAM lParam, HANDLE hContact) +void InputAreaContextMenu(HWND hwnd, WPARAM wParam, LPARAM lParam, HCONTACT hContact) { POINT pt; CHARRANGE sel, all = { 0, -1 }; diff --git a/plugins/Scriver/src/input.h b/plugins/Scriver/src/input.h index 7d4e8313e2..a36c5b02e0 100644 --- a/plugins/Scriver/src/input.h +++ b/plugins/Scriver/src/input.h @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef INPUT_H #define INPUT_H -extern void InputAreaContextMenu(HWND hwnd, WPARAM wParam, LPARAM lParam, HANDLE hContact); +extern void InputAreaContextMenu(HWND hwnd, WPARAM wParam, LPARAM lParam, HCONTACT hContact); extern void RegisterKeyBindings(); extern int InputAreaShortcuts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, CommonWindowData *windowData); BOOL HandleLinkClick(HINSTANCE hInstance, HWND hwndDlg, HWND hwndFocus, ENLINK *lParam); diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index dc7281a159..2f76dded88 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -131,7 +131,7 @@ static TCHAR *GetQuotedTextW(TCHAR * text) return out; } -static void saveDraftMessage(HWND hwnd, HANDLE hContact, int codepage) +static void saveDraftMessage(HWND hwnd, HCONTACT hContact, int codepage) { char *textBuffer = GetRichTextEncoded(hwnd, codepage); if (textBuffer != NULL) { @@ -141,7 +141,7 @@ static void saveDraftMessage(HWND hwnd, HANDLE hContact, int codepage) else g_dat.draftList = tcmdlist_remove2(g_dat.draftList, hContact); } -void NotifyLocalWinEvent(HANDLE hContact, HWND hwnd, unsigned int type) +void NotifyLocalWinEvent(HCONTACT hContact, HWND hwnd, unsigned int type) { if (hContact == NULL || hwnd == NULL) return; @@ -158,7 +158,7 @@ void NotifyLocalWinEvent(HANDLE hContact, HWND hwnd, unsigned int type) NotifyEventHooks(hHookWinEvt, 0, (LPARAM)&mwe); } -static BOOL IsUtfSendAvailable(HANDLE hContact) +static BOOL IsUtfSendAvailable(HCONTACT hContact) { char* szProto = GetContactProto(hContact); if ( szProto == NULL ) @@ -255,12 +255,12 @@ void SetStatusIcon(struct SrmmWindowData *dat) return; char *szProto = dat->szProto; - HANDLE hContact = dat->windowData.hContact; + HCONTACT hContact = dat->windowData.hContact; char* szMetaProto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); if ((INT_PTR)szMetaProto != CALLSERVICE_NOTFOUND && strcmp(dat->szProto, szMetaProto) == 0 && db_get_b(NULL,"CLC","Meta",0) == 0) { - hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)dat->windowData.hContact, 0); + hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->windowData.hContact, 0); if (hContact != NULL) szProto = GetContactProto(hContact); else @@ -1076,7 +1076,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TabControlData tcd; tcd.iFlags = TCDF_TEXT | TCDF_ICON; tcd.hIcon = GetTabIcon(dat); - tcd.pszText = GetTabName((HANDLE *)dat->windowData.hContact); + tcd.pszText = GetTabName(dat->windowData.hContact); SendMessage(dat->hwndParent, CM_UPDATETABCONTROL, (WPARAM)&tcd, (LPARAM)hwndDlg); mir_free(tcd.pszText); } @@ -1086,7 +1086,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP TitleBarData tbd = {0}; tbd.iFlags = TBDF_TEXT | TBDF_ICON; GetTitlebarIcon(dat, &tbd); - tbd.pszText = GetWindowTitle((HANDLE *)dat->windowData.hContact, dat->szProto); + tbd.pszText = GetWindowTitle(dat->windowData.hContact, dat->szProto); SendMessage(dat->hwndParent, CM_UPDATETITLEBAR, (WPARAM)&tbd, (LPARAM)hwndDlg); mir_free(tbd.pszText); } @@ -1772,8 +1772,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP smaddInfo.targetMessage = EM_REPLACESEL; smaddInfo.targetWParam = TRUE; smaddInfo.Protocolname = dat->szProto; - if (dat->szProto!=NULL && strcmp(dat->szProto,"MetaContacts")==0) { - HANDLE hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) dat->windowData.hContact, 0); + if (dat->szProto!=NULL && strcmp(dat->szProto,"MetaContacts") == 0) { + HCONTACT hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->windowData.hContact, 0); if (hContact!=NULL) { smaddInfo.Protocolname = GetContactProto(hContact); } diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index a6c124cb08..0a14b4575f 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -74,7 +74,7 @@ struct EventData struct LogStreamData { int stage; - HANDLE hContact; + HCONTACT hContact; HANDLE hDbEvent, hDbEventLast; char *buffer; int bufferOffset, bufferLen; @@ -85,7 +85,7 @@ struct LogStreamData EventData *events; }; -TCHAR *GetNickname(HANDLE hContact, const char* szProto) +TCHAR *GetNickname(HCONTACT hContact, const char* szProto) { CONTACTINFO ci = { sizeof(ci) }; ci.hContact = hContact; @@ -151,7 +151,7 @@ int DbEventIsShown(DBEVENTINFO * dbei, struct SrmmWindowData *dat) return DbEventIsCustomForMsgWindow(dbei); } -EventData* getEventFromDB(struct SrmmWindowData *dat, HANDLE hContact, HANDLE hDbEvent) +EventData* getEventFromDB(struct SrmmWindowData *dat, HCONTACT hContact, HANDLE hDbEvent) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.cbBlob = db_event_getBlobSize(hDbEvent); @@ -922,7 +922,7 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) smre.hwndRichEditControl = GetDlgItem(hwndDlg, IDC_LOG); smre.Protocolname = dat->szProto; if (dat->szProto != NULL && strcmp(dat->szProto, "MetaContacts") == 0) { - HANDLE hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->windowData.hContact, 0); + HCONTACT hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->windowData.hContact, 0); if (hContact != NULL) smre.Protocolname = GetContactProto(hContact); } diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 21a5586116..962ae1dfc2 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -845,7 +845,7 @@ static void RebuildList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) if (hItemUnknown && db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItemUnknown, 1); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem && db_get_b(hContact, SRMMMOD, SRMSGSET_TYPING, defType)) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 1); @@ -860,7 +860,7 @@ static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) if (hItemUnknown) db_set_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItemUnknown, 0) ? 1 : 0)); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) db_set_b(hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0) ? 1 : 0)); diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 2dc31ada48..f4f9133162 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -27,7 +27,7 @@ HCURSOR hCurSplitNS, hCurSplitWE, hCurHyperlinkHand, hDragCursor; HANDLE hHookWinEvt, hHookWinPopup, hHookWinWrite; HGENMENU hMsgMenuItem; -extern HWND GetParentWindow(HANDLE hContact, BOOL bChat); +extern HWND GetParentWindow(HCONTACT hContact, BOOL bChat); #define EVENTTYPE_SCRIVER 2010 #define SCRIVER_DB_GETEVENTTEXT "Scriver/GetText" @@ -59,11 +59,11 @@ static int SRMMStatusToPf2(int status) return 0; } -int IsAutoPopup(HANDLE hContact) { +int IsAutoPopup(HCONTACT hContact) { if (g_dat.flags & SMF_AUTOPOPUP) { char *szProto = GetContactProto(hContact); if (strcmp(szProto, "MetaContacts") == 0 ) { - hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact, 0); + hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); if (hContact != NULL) szProto = GetContactProto(hContact); } @@ -96,7 +96,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) if (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ)) return 0; - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HCONTACT)wParam); if (hwnd) SendMessage(hwnd, HM_DBEVENTADDED, wParam, lParam); @@ -108,9 +108,9 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) if (hwnd == NULL) { /* new message */ SkinPlaySound("AlertMsg"); - if (IsAutoPopup((HANDLE)wParam)) { + if (IsAutoPopup((HCONTACT)wParam)) { NewMessageWindowLParam newData = { 0 }; - newData.hContact = (HANDLE)wParam; + newData.hContact = (HCONTACT)wParam; HWND hParent = GetParentWindow(newData.hContact, FALSE); newData.flags = NMWLP_INCOMING; CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM)&newData); @@ -123,7 +123,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) CLISTEVENT cle = { sizeof(cle) }; cle.flags = CLEF_TCHAR; - cle.hContact = (HANDLE)wParam; + cle.hContact = (HCONTACT)wParam; cle.hDbEvent = (HANDLE)lParam; cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); cle.pszService = "SRMsg/ReadMessage"; @@ -137,14 +137,14 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) static INT_PTR SendMessageCommandW(WPARAM wParam, LPARAM lParam) { /* does the HCONTACT's protocol support IM messages? */ - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto == NULL) return 1; /* unknown contact */ if (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) return 1; - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HCONTACT)wParam); if (hwnd != NULL) { if (lParam) { HWND hEdit = GetDlgItem(hwnd, IDC_MESSAGE); @@ -155,7 +155,7 @@ static INT_PTR SendMessageCommandW(WPARAM wParam, LPARAM lParam) } else { NewMessageWindowLParam newData = { 0 }; - newData.hContact = (HANDLE)wParam; + newData.hContact = (HCONTACT)wParam; newData.szInitialText = (const char *) lParam; newData.isWchar = 1; HWND hParent = GetParentWindow(newData.hContact, FALSE); @@ -166,7 +166,7 @@ static INT_PTR SendMessageCommandW(WPARAM wParam, LPARAM lParam) static INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam) { - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); //logInfo("Show message window for: %s (%s)", CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, 0), szProto); if (szProto) { /* does the HCONTACT's protocol support IM messages? */ @@ -176,7 +176,7 @@ static INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam) else /* unknown contact */ return 1; - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HCONTACT)wParam); if (hwnd != NULL) { if (lParam) { HWND hEdit = GetDlgItem(hwnd, IDC_MESSAGE); @@ -187,7 +187,7 @@ static INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam) } else { NewMessageWindowLParam newData = { 0 }; - newData.hContact = (HANDLE)wParam; + newData.hContact = (HCONTACT)wParam; newData.szInitialText = (const char *)lParam; HWND hParent = GetParentWindow(newData.hContact, FALSE); CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), hParent, DlgProcMessage, (LPARAM)& newData); @@ -210,7 +210,7 @@ static int TypingMessage(WPARAM wParam, LPARAM lParam) SkinPlaySound((lParam) ? "TNStart" : "TNStop"); - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HCONTACT)wParam); if (hwnd) SendMessage(hwnd, DM_TYPING, 0, lParam); else if (lParam && (g_dat.flags2 & SMF2_SHOWTYPINGTRAY)) { @@ -231,7 +231,7 @@ static int TypingMessage(WPARAM wParam, LPARAM lParam) CLISTEVENT cle = {0}; cle.cbSize = sizeof(cle); - cle.hContact = (HANDLE)wParam; + cle.hContact = (HCONTACT)wParam; cle.hDbEvent = (HANDLE)1; cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR; cle.hIcon = GetCachedIcon("scriver_TYPING"); @@ -247,7 +247,7 @@ static int TypingMessage(WPARAM wParam, LPARAM lParam) static int MessageSettingChanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (lstrcmpA(cws->szModule, "CList") && (szProto == NULL || lstrcmpA(cws->szModule, szProto))) return 0; WindowList_Broadcast(g_dat.hMessageWindowList, DM_CLISTSETTINGSCHANGED, wParam, lParam); @@ -257,10 +257,8 @@ static int MessageSettingChanged(WPARAM wParam, LPARAM lParam) static int ContactDeleted(WPARAM wParam, LPARAM lParam) { HWND hwnd; - - if ((hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam))) { + if ((hwnd = WindowList_Find(g_dat.hMessageWindowList, (HCONTACT)wParam))) SendMessage(hwnd, WM_CLOSE, 0, 0); - } return 0; } @@ -276,7 +274,7 @@ static void RestoreUnreadMessageAlerts(void) cle.flags = CLEF_TCHAR; cle.ptszTooltip = toolTip; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hDbEvent = db_event_firstUnread(hContact); while (hDbEvent) { dbei.cbBlob = 0; @@ -340,9 +338,9 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) { - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HCONTACT)wParam); if (hwnd == NULL) - hwnd = SM_FindWindowByContact((HANDLE)wParam); + hwnd = SM_FindWindowByContact((HCONTACT)wParam); if (hwnd == NULL) return 1; @@ -356,7 +354,7 @@ static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == 0) return 0; @@ -378,7 +376,7 @@ static int AvatarChanged(WPARAM wParam, LPARAM lParam) if (wParam == 0) // protocol picture has changed... WindowList_Broadcast(g_dat.hMessageWindowList, DM_AVATARCHANGED, wParam, lParam); else { - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HCONTACT)wParam); SendMessage(hwnd, DM_AVATARCHANGED, wParam, lParam); } return 0; @@ -409,9 +407,9 @@ void ChangeStatusIcons() int StatusIconPressed(WPARAM wParam, LPARAM lParam) { StatusIconClickData *sicd = (StatusIconClickData *) lParam; - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HCONTACT)wParam); if (hwnd == NULL) - hwnd = SM_FindWindowByContact((HANDLE)wParam); + hwnd = SM_FindWindowByContact((HCONTACT)wParam); if (hwnd != NULL) { if (!strcmp(SRMMMOD, sicd->szModule)) { diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 03bacc17be..9272e3638b 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -61,7 +61,7 @@ struct TabCtrlData struct ParentWindowData { HWND hwnd; - HANDLE hContact; + HCONTACT hContact; int childrenCount; HWND hwndActive; HWND hwndStatus; @@ -84,7 +84,7 @@ struct ParentWindowData struct MessageWindowTabData { HWND hwnd; - HANDLE hContact; + HCONTACT hContact; char *szProto; ParentWindowData *parent; HICON hIcon; @@ -94,7 +94,7 @@ struct MessageWindowTabData struct NewMessageWindowLParam { - HANDLE hContact; + HCONTACT hContact; BOOL isChat; int isWchar; LPCSTR szInitialText; @@ -105,7 +105,7 @@ struct NewMessageWindowLParam struct CommonWindowData { - HANDLE hContact; + HCONTACT hContact; int codePage; DWORD flags; HWND hwndLog; @@ -230,8 +230,8 @@ int safe_wcslen(wchar_t *msg, int maxLen); void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend); void LoadMsgLogIcons(void); void FreeMsgLogIcons(void); -TCHAR *GetNickname(HANDLE hContact, const char* szProto); -int IsAutoPopup(HANDLE hContact); +TCHAR *GetNickname(HCONTACT hContact, const char* szProto); +int IsAutoPopup(HCONTACT hContact); #define MSGFONTID_MYMSG 0 #define MSGFONTID_YOURMSG 1 diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index 1c691acadd..ffa0b80403 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -33,11 +33,11 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPa ///////////////////////////////////////////////////////////////////////////////////////// -extern TCHAR *GetNickname(HANDLE hContact, const char* szProto); +extern TCHAR *GetNickname(HCONTACT hContact, const char* szProto); static const TCHAR *titleTokenNames[] = {_T("%name%"), _T("%status%"), _T("%statusmsg%"), _T("%account%")}; -TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto) +TCHAR* GetWindowTitle(HCONTACT hContact, const char *szProto) { int isTemplate; int i, j, len; @@ -135,7 +135,7 @@ TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto) return title; } -TCHAR* GetTabName(HANDLE *hContact) +TCHAR* GetTabName(HCONTACT hContact) { if (hContact) return GetNickname(hContact, NULL); @@ -317,7 +317,7 @@ static void ActivateChild(ParentWindowData *dat, HWND child) SendMessage(dat->hwndActive, DM_ACTIVATE, WA_ACTIVE, 0); } -static void AddChild(ParentWindowData *dat, HWND hwnd, HANDLE hContact) +static void AddChild(ParentWindowData *dat, HWND hwnd, HCONTACT hContact) { MessageWindowTabData *mwtd = (MessageWindowTabData *)mir_alloc(sizeof(MessageWindowTabData)); mwtd->hwnd = hwnd; @@ -549,13 +549,13 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) MessageWindowTabData *mwtd = (MessageWindowTabData *)tci.lParam; if (mwtd != NULL) { HWND hChild = mwtd->hwnd; - HANDLE hContact = mwtd->hContact; + HCONTACT hContact = mwtd->hContact; GetCursorPos(&pt); HWND hParent = WindowFromPoint(pt); while (GetParent(hParent) != NULL) hParent = GetParent(hParent); - hParent = WindowList_Find(g_dat.hParentWindowList, hParent); + hParent = WindowList_Find(g_dat.hParentWindowList, (HCONTACT)hParent); if ((hParent != NULL && hParent != GetParent(hwnd)) || (hParent == NULL && mwtd->parent->childrenCount > 1 && (GetKeyState(VK_CONTROL) & 0x8000))) { if (hParent == NULL) { RECT rc, rcDesktop; @@ -739,7 +739,6 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case WM_INITDIALOG: { HMENU hMenu; - HANDLE hSContact; int savePerContact = db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT); NewMessageWindowLParam *newData = (NewMessageWindowLParam *) lParam; dat = (ParentWindowData *) mir_alloc(sizeof(ParentWindowData)); @@ -775,12 +774,12 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (dat->prev != NULL) dat->prev->next = dat; - WindowList_Add(g_dat.hParentWindowList, hwndDlg, hwndDlg); + WindowList_Add(g_dat.hParentWindowList, hwndDlg, (HCONTACT)hwndDlg); SubclassTabCtrl(dat->hwndTabs); SetContainerWindowStyle(dat); - hSContact = savePerContact ? dat->hContact : NULL; + HCONTACT hSContact = savePerContact ? dat->hContact : NULL; dat->bTopmost = db_get_b(hSContact, SRMMMOD, SRMSGSET_TOPMOST, SRMSGDEFSET_TOPMOST); if (ScriverRestoreWindowPosition(hwndDlg, hSContact, SRMMMOD, (newData->isChat && !savePerContact) ? "chat" : "", 0, SW_HIDE)) SetWindowPos(hwndDlg, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW); @@ -1129,7 +1128,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR WindowList_Remove(g_dat.hParentWindowList, hwndDlg); int savePerContact = db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT); - HANDLE hContact = (savePerContact) ? dat->hContact : NULL; + HCONTACT hContact = (savePerContact) ? dat->hContact : NULL; WINDOWPLACEMENT wp = { sizeof(wp) }; GetWindowPlacement(hwndDlg, &wp); @@ -1208,7 +1207,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return TRUE; case CM_ADDCHILD: - AddChild(dat, (HWND)wParam, (HANDLE)lParam); + AddChild(dat, (HWND)wParam, (HCONTACT)lParam); return TRUE; case CM_ACTIVATECHILD: @@ -1507,7 +1506,7 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar } } -int ScriverRestoreWindowPosition(HWND hwnd, HANDLE hContact, const char *szModule,const char *szNamePrefix, int flags, int showCmd) +int ScriverRestoreWindowPosition(HWND hwnd, HCONTACT hContact, const char *szModule,const char *szNamePrefix, int flags, int showCmd) { WINDOWPLACEMENT wp; wp.length = sizeof(wp); @@ -1545,7 +1544,7 @@ int ScriverRestoreWindowPosition(HWND hwnd, HANDLE hContact, const char *szModul return 0; } -HWND GetParentWindow(HANDLE hContact, BOOL bChat) +HWND GetParentWindow(HCONTACT hContact, BOOL bChat) { NewMessageWindowLParam newData = { 0 }; newData.hContact = hContact; diff --git a/plugins/Scriver/src/msgwindow.h b/plugins/Scriver/src/msgwindow.h index ea71f2977c..c1977b23bd 100644 --- a/plugins/Scriver/src/msgwindow.h +++ b/plugins/Scriver/src/msgwindow.h @@ -88,9 +88,9 @@ struct TabControlData HICON hIcon; }; -TCHAR* GetWindowTitle(HANDLE *hContact, const char *szProto); -TCHAR* GetTabName(HANDLE *hContact); -HWND GetParentWindow(HANDLE hContact, BOOL bChat); -void NotifyLocalWinEvent(HANDLE hContact, HWND hwnd, unsigned int type); +TCHAR* GetWindowTitle(HCONTACT hContact, const char *szProto); +TCHAR* GetTabName(HCONTACT hContact); +HWND GetParentWindow(HCONTACT hContact, BOOL bChat); +void NotifyLocalWinEvent(HCONTACT hContact, HWND hwnd, unsigned int type); #endif diff --git a/plugins/Scriver/src/sendqueue.cpp b/plugins/Scriver/src/sendqueue.cpp index b77fc7a741..0328efb80a 100644 --- a/plugins/Scriver/src/sendqueue.cpp +++ b/plugins/Scriver/src/sendqueue.cpp @@ -66,7 +66,7 @@ MessageSendQueueItem* CreateSendQueueItem(HWND hwndSender) return item; } -MessageSendQueueItem* FindOldestPendingSendQueueItem(HWND hwndSender, HANDLE hContact) +MessageSendQueueItem* FindOldestPendingSendQueueItem(HWND hwndSender, HCONTACT hContact) { MessageSendQueueItem *item, *found = NULL; EnterCriticalSection(&queueMutex); @@ -79,7 +79,7 @@ MessageSendQueueItem* FindOldestPendingSendQueueItem(HWND hwndSender, HANDLE hCo return found; } -MessageSendQueueItem* FindSendQueueItem(HANDLE hContact, HANDLE hSendId) +MessageSendQueueItem* FindSendQueueItem(HCONTACT hContact, HANDLE hSendId) { mir_cslock lock(queueMutex); for (MessageSendQueueItem *item = global_sendQueue; item != NULL; item = item->next) @@ -159,7 +159,7 @@ void ReleaseSendQueueItems(HWND hwndSender) } } -int ReattachSendQueueItems(HWND hwndSender, HANDLE hContact) +int ReattachSendQueueItems(HWND hwndSender, HCONTACT hContact) { int count = 0; diff --git a/plugins/Scriver/src/sendqueue.h b/plugins/Scriver/src/sendqueue.h index 7d8955648a..204deec72a 100644 --- a/plugins/Scriver/src/sendqueue.h +++ b/plugins/Scriver/src/sendqueue.h @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct MessageSendQueueItem { HWND hwndSender; - HANDLE hContact; + HCONTACT hContact; char *proto; HANDLE hSendId; int timeout; @@ -44,12 +44,12 @@ void InitSendQueue(); void DestroySendQueue(); MessageSendQueueItem* CreateSendQueueItem(HWND hwndSender); TCHAR * GetSendBufferMsg(MessageSendQueueItem *item); -MessageSendQueueItem* FindOldestPendingSendQueueItem(HWND hwndSender, HANDLE hContact); -MessageSendQueueItem* FindSendQueueItem(HANDLE hContact, HANDLE hSendId); +MessageSendQueueItem* FindOldestPendingSendQueueItem(HWND hwndSender, HCONTACT hContact); +MessageSendQueueItem* FindSendQueueItem(HCONTACT hContact, HANDLE hSendId); BOOL RemoveSendQueueItem(MessageSendQueueItem* item); void ReportSendQueueTimeouts(HWND hwndSender); void ReleaseSendQueueItems(HWND hwndSender); -int ReattachSendQueueItems(HWND hwndSender, HANDLE hContact); +int ReattachSendQueueItems(HWND hwndSender, HCONTACT hContact); void RemoveAllSendQueueItems(); void SendSendQueueItem(MessageSendQueueItem* item); diff --git a/plugins/Scriver/src/statusicon.cpp b/plugins/Scriver/src/statusicon.cpp index f9c3d02936..28b26064f6 100644 --- a/plugins/Scriver/src/statusicon.cpp +++ b/plugins/Scriver/src/statusicon.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HANDLE hHookIconPressedEvt; -void DrawStatusIcons(HANDLE hContact, HDC hDC, RECT r, int gap) +void DrawStatusIcons(HCONTACT hContact, HDC hDC, RECT r, int gap) { HICON hIcon; int x = r.left; @@ -42,7 +42,7 @@ void DrawStatusIcons(HANDLE hContact, HDC hDC, RECT r, int gap) } } -void CheckStatusIconClick(HANDLE hContact, HWND hwndFrom, POINT pt, RECT r, int gap, int click_flags) +void CheckStatusIconClick(HCONTACT hContact, HWND hwndFrom, POINT pt, RECT r, int gap, int click_flags) { unsigned int iconNum = (pt.x - r.left) / (GetSystemMetrics(SM_CXSMICON) + gap); StatusIconData *si = Srmm_GetNthIcon(hContact, iconNum); @@ -61,7 +61,7 @@ void CheckStatusIconClick(HANDLE hContact, HWND hwndFrom, POINT pt, RECT r, int static int OnSrmmIconChanged(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) WindowList_Broadcast(g_dat.hParentWindowList, DM_STATUSICONCHANGE, 0, 0); else { @@ -88,7 +88,7 @@ int DeinitStatusIcons() return 0; } -int GetStatusIconsCount(HANDLE hContact) +int GetStatusIconsCount(HCONTACT hContact) { int nIcon = 0; while ( Srmm_GetNthIcon(hContact, nIcon) != NULL) diff --git a/plugins/Scriver/src/statusicon.h b/plugins/Scriver/src/statusicon.h index 7148a292c8..5d86eb7e22 100644 --- a/plugins/Scriver/src/statusicon.h +++ b/plugins/Scriver/src/statusicon.h @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. int InitStatusIcons(); int DeinitStatusIcons(); -int GetStatusIconsCount(HANDLE hContact); -void DrawStatusIcons(HANDLE hContact, HDC hdc, RECT r, int gap); -void CheckStatusIconClick(HANDLE hContact, HWND hwndFrom, POINT pt, RECT rc, int gap, int flags); +int GetStatusIconsCount(HCONTACT hContact); +void DrawStatusIcons(HCONTACT hContact, HDC hdc, RECT r, int gap); +void CheckStatusIconClick(HCONTACT hContact, HWND hwndFrom, POINT pt, RECT rc, int gap, int flags); #endif diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index de3173403e..6dccfe53bc 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -5,7 +5,7 @@ HINSTANCE g_hInst, g_hIconInst; char TEMP[MAX_PATH]; int TEMP_SIZE = 0; -HANDLE g_hEvent[2], g_hCLIcon=0, g_hFolders=0; +HANDLE g_hEvent[2], g_hCLIcon, g_hFolders = 0; HGENMENU g_hMenu[15]; int iService=0; @@ -37,7 +37,7 @@ PLUGININFOEX pluginInfoEx = { {0x1B2A39E5, 0xE2F6, 0x494D, {0x95, 0x8D, 0x18, 0x08, 0xFD, 0x11, 0x0D, 0xD5}} }; -LPSTR myDBGetStringDecode(HANDLE hContact,const char *szModule,const char *szSetting) +LPSTR myDBGetStringDecode(HCONTACT hContact,const char *szModule,const char *szSetting) { char *val = db_get_sa(hContact,szModule,szSetting); if (!val) return NULL; @@ -47,7 +47,7 @@ LPSTR myDBGetStringDecode(HANDLE hContact,const char *szModule,const char *szSet return buf; } -int myDBWriteStringEncode(HANDLE hContact,const char *szModule,const char *szSetting,const char *val) +int myDBWriteStringEncode(HCONTACT hContact,const char *szModule,const char *szSetting,const char *val) { int len = (int)strlen(val)+64; char *buf = (LPSTR)alloca(len); diff --git a/plugins/SecureIM/src/commonheaders.h b/plugins/SecureIM/src/commonheaders.h index 9396b9426d..69305e6d4d 100644 --- a/plugins/SecureIM/src/commonheaders.h +++ b/plugins/SecureIM/src/commonheaders.h @@ -102,7 +102,7 @@ int onModulesLoaded(WPARAM, LPARAM); int onShutdown(WPARAM, LPARAM); int ModuleLoad(WPARAM wParam, LPARAM lParam); -__forceinline int SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam) +__forceinline int SendBroadcast(HCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam) { return ProtoBroadcastAck( GetContactProto(hContact), hContact, type, result, hProcess, lParam); } diff --git a/plugins/SecureIM/src/crypt.h b/plugins/SecureIM/src/crypt.h index a2ec230e48..9da46e8be9 100644 --- a/plugins/SecureIM/src/crypt.h +++ b/plugins/SecureIM/src/crypt.h @@ -39,7 +39,7 @@ typedef partitionMessage* pPM; // memory struct for keys struct UinKey { - HANDLE hContact; // handle of contact + HCONTACT hContact; // handle of contact u_int header; // HEADER pSupPro proto; // proto struct BYTE mode,tmode; // mode: Native,PGP,GPG,RSA/AES,RSA [0..4] @@ -70,13 +70,13 @@ typedef UinKey* pUinKey; struct TFakeAckParams { - __forceinline TFakeAckParams(HANDLE p1, LONG p2, LPCSTR p3) : + __forceinline TFakeAckParams(HCONTACT p1, LONG p2, LPCSTR p3) : hContact(p1), id(p2), msg(p3) {} - HANDLE hContact; + HCONTACT hContact; LONG id; LPCSTR msg; }; @@ -90,73 +90,73 @@ extern LIST arClist; // crypt_lists.cpp void loadContactList(); void freeContactList(); -pUinKey addContact(HANDLE hContact); -void delContact(HANDLE hContact); -pSupPro getSupPro(HANDLE); -pUinKey findUinKey(HANDLE hContact); -pUinKey getUinKey(HANDLE hContact); +pUinKey addContact(HCONTACT hContact); +void delContact(HCONTACT hContact); +pSupPro getSupPro(HCONTACT); +pUinKey findUinKey(HCONTACT hContact); +pUinKey getUinKey(HCONTACT hContact); pUinKey getUinCtx(HANDLE); void addMsg2Queue(pUinKey,WPARAM,LPSTR); -void getContactName(HANDLE hContact, LPSTR szName); -void getContactNameA(HANDLE hContact, LPSTR szName); -void getContactUin(HANDLE hContact, LPSTR szUIN); -void getContactUinA(HANDLE hContact, LPSTR szUIN); +void getContactName(HCONTACT hContact, LPSTR szName); +void getContactNameA(HCONTACT hContact, LPSTR szName); +void getContactUin(HCONTACT hContact, LPSTR szUIN); +void getContactUinA(HCONTACT hContact, LPSTR szUIN); // crypt_check.cpp -int getContactStatus(HANDLE); +int getContactStatus(HCONTACT); -bool isSecureProtocol(HANDLE hContact); -BYTE isContactSecured(HANDLE hContact); +bool isSecureProtocol(HCONTACT hContact); +BYTE isContactSecured(HCONTACT hContact); bool isClientMiranda(pUinKey ptr, BOOL emptyMirverAsMiranda=FALSE); -bool isClientMiranda(HANDLE hContact, BOOL emptyMirverAsMiranda=FALSE); -bool isProtoSmallPackets(HANDLE); -bool isContactInvisible(HANDLE); -bool isNotOnList(HANDLE); -bool isContactNewPG(HANDLE); -bool isContactPGP(HANDLE); -bool isContactGPG(HANDLE); -bool isContactRSAAES(HANDLE); -bool isContactRSA(HANDLE); -bool isChatRoom(HANDLE); +bool isClientMiranda(HCONTACT hContact, BOOL emptyMirverAsMiranda=FALSE); +bool isProtoSmallPackets(HCONTACT); +bool isContactInvisible(HCONTACT); +bool isNotOnList(HCONTACT); +bool isContactNewPG(HCONTACT); +bool isContactPGP(HCONTACT); +bool isContactGPG(HCONTACT); +bool isContactRSAAES(HCONTACT); +bool isContactRSA(HCONTACT); +bool isChatRoom(HCONTACT); bool isFileExist(LPCSTR); bool isSecureIM(pUinKey ptr, BOOL emptyMirverAsSecureIM=FALSE); -bool isSecureIM(HANDLE hContact, BOOL emptyMirverAsSecureIM=FALSE); +bool isSecureIM(HCONTACT hContact, BOOL emptyMirverAsSecureIM=FALSE); // crypt_icons.cpp HICON mode2icon(int,int); HANDLE mode2clicon(int mode, int type); void RefreshContactListIcons(void); -void ShowStatusIcon(HANDLE,UINT); -void ShowStatusIcon(HANDLE); -void ShowStatusIconNotify(HANDLE); +void ShowStatusIcon(HCONTACT, UINT); +void ShowStatusIcon(HCONTACT); +void ShowStatusIconNotify(HCONTACT); // crypt_popups.cpp //static int CALLBACK PopupDlgProc(HWND,UINT,WPARAM,LPARAM); -void showPopup(LPCSTR,HANDLE,HICON,UINT); -void showPopupEC(HANDLE); -void showPopupDCmsg(HANDLE,LPCSTR); -void showPopupDC(HANDLE); -void showPopupKS(HANDLE); -void showPopupKRmsg(HANDLE,LPCSTR); -void showPopupKR(HANDLE); -void showPopupSM(HANDLE); -void showPopupRM(HANDLE); +void showPopup(LPCSTR, HCONTACT, HICON, UINT); +void showPopupEC(HCONTACT); +void showPopupDCmsg(HCONTACT, LPCSTR); +void showPopupDC(HCONTACT); +void showPopupKS(HCONTACT); +void showPopupKRmsg(HCONTACT, LPCSTR); +void showPopupKR(HCONTACT); +void showPopupSM(HCONTACT); +void showPopupRM(HCONTACT); // crypt_meta.cpp -BOOL isProtoMetaContacts(HANDLE); -BOOL isDefaultSubContact(HANDLE); -HANDLE getMetaContact(HANDLE); -HANDLE getMostOnline(HANDLE); -void DeinitMetaContact(HANDLE); +BOOL isProtoMetaContacts(HCONTACT); +BOOL isDefaultSubContact(HCONTACT); +HCONTACT getMetaContact(HCONTACT); +HCONTACT getMostOnline(HCONTACT); +void DeinitMetaContact(HCONTACT); // crypt_dll.cpp -LPSTR InitKeyA(pUinKey,int); -int InitKeyB(pUinKey,LPCSTR); -void InitKeyX(pUinKey,BYTE*); -BOOL CalculateKeyX(pUinKey,HANDLE); -LPSTR encodeMsg(pUinKey,LPARAM); -LPSTR decodeMsg(pUinKey,LPARAM,LPSTR); +LPSTR InitKeyA(pUinKey, int); +int InitKeyB(pUinKey, LPCSTR); +void InitKeyX(pUinKey, BYTE*); +BOOL CalculateKeyX(pUinKey, HCONTACT); +LPSTR encodeMsg(pUinKey, LPARAM); +LPSTR decodeMsg(pUinKey, LPARAM, LPSTR); BOOL LoadKeyPGP(pUinKey); BOOL LoadKeyGPG(pUinKey); diff --git a/plugins/SecureIM/src/crypt_check.cpp b/plugins/SecureIM/src/crypt_check.cpp index 9369a1ba64..44c6c8183a 100644 --- a/plugins/SecureIM/src/crypt_check.cpp +++ b/plugins/SecureIM/src/crypt_check.cpp @@ -1,6 +1,6 @@ #include "commonheaders.h" -int getContactStatus(HANDLE hContact) +int getContactStatus(HCONTACT hContact) { pSupPro ptr = getSupPro(hContact); if (ptr) @@ -9,7 +9,7 @@ int getContactStatus(HANDLE hContact) return -1; } -bool isSecureProtocol(HANDLE hContact) +bool isSecureProtocol(HCONTACT hContact) { pSupPro ptr = getSupPro(hContact); if (!ptr) @@ -18,7 +18,7 @@ bool isSecureProtocol(HANDLE hContact) return ptr->inspecting != 0; } -BYTE isContactSecured(HANDLE hContact) +BYTE isContactSecured(HCONTACT hContact) { // íóæíà ïðîâåðêà íà Offline è â ýòîì ñëó÷àå äðóãèå ñòàòóñû if (!arClist.getCount()) return 0; @@ -76,7 +76,7 @@ bool isClientMiranda(pUinKey ptr, BOOL emptyMirverAsMiranda) return isMiranda; } -bool isClientMiranda(HANDLE hContact, BOOL emptyMirverAsMiranda) +bool isClientMiranda(HCONTACT hContact, BOOL emptyMirverAsMiranda) { if (!bMCD) return true; if (!arClist.getCount()) return false; @@ -85,7 +85,7 @@ bool isClientMiranda(HANDLE hContact, BOOL emptyMirverAsMiranda) return (p) ? isClientMiranda(p, emptyMirverAsMiranda) : false; } -bool isProtoSmallPackets(HANDLE hContact) +bool isProtoSmallPackets(HCONTACT hContact) { pUinKey p = findUinKey(hContact); if (!p || !p->proto || !p->proto->inspecting) @@ -94,7 +94,7 @@ bool isProtoSmallPackets(HANDLE hContact) return strstr(p->proto->name,"IRC") != NULL || strstr(p->proto->name,"WinPopup") != NULL || strstr(p->proto->name,"VyChat") != NULL; } -bool isContactInvisible(HANDLE hContact) +bool isContactInvisible(HCONTACT hContact) { if (db_get_b(hContact, "CList", "Hidden", 0)) return true; @@ -114,12 +114,12 @@ bool isContactInvisible(HANDLE hContact) return false; } -bool isNotOnList(HANDLE hContact) +bool isNotOnList(HCONTACT hContact) { return db_get_b(hContact, "CList", "NotOnList", 0) != 0; } -bool isContactNewPG(HANDLE hContact) +bool isContactNewPG(HCONTACT hContact) { pUinKey p = findUinKey(hContact); if (!p || !p->proto || !p->proto->inspecting || !p->cntx) @@ -128,7 +128,7 @@ bool isContactNewPG(HANDLE hContact) return (p->features & CPP_FEATURES_NEWPG) != 0; } -bool isContactPGP(HANDLE hContact) +bool isContactPGP(HCONTACT hContact) { if (!bPGPloaded || (!bPGPkeyrings && !bPGPprivkey)) return false; @@ -142,7 +142,7 @@ bool isContactPGP(HANDLE hContact) return true; } -bool isContactGPG(HANDLE hContact) +bool isContactGPG(HCONTACT hContact) { if (!bGPGloaded || !bGPGkeyrings) return false; @@ -156,7 +156,7 @@ bool isContactGPG(HANDLE hContact) return true; } -bool isContactRSAAES(HANDLE hContact) +bool isContactRSAAES(HCONTACT hContact) { pUinKey p = findUinKey(hContact); if (!p || !p->proto || !p->proto->inspecting) @@ -165,7 +165,7 @@ bool isContactRSAAES(HANDLE hContact) return p->mode == MODE_RSAAES; } -bool isContactRSA(HANDLE hContact) +bool isContactRSA(HCONTACT hContact) { pUinKey p = findUinKey(hContact); if (!p || !p->proto || !p->proto->inspecting) @@ -174,7 +174,7 @@ bool isContactRSA(HANDLE hContact) return p->mode == MODE_RSA; } -bool isChatRoom(HANDLE hContact) +bool isChatRoom(HCONTACT hContact) { pUinKey p = findUinKey(hContact); if (!p || !p->proto || !p->proto->inspecting) @@ -205,7 +205,7 @@ bool isSecureIM(pUinKey ptr, BOOL emptyMirverAsSecureIM) return isSecureIM; } -bool isSecureIM(HANDLE hContact, BOOL emptyMirverAsSecureIM) +bool isSecureIM(HCONTACT hContact, BOOL emptyMirverAsSecureIM) { if (!bAIP) return false; diff --git a/plugins/SecureIM/src/crypt_dll.cpp b/plugins/SecureIM/src/crypt_dll.cpp index f9b5325e2f..59c5698384 100644 --- a/plugins/SecureIM/src/crypt_dll.cpp +++ b/plugins/SecureIM/src/crypt_dll.cpp @@ -73,7 +73,7 @@ void InitKeyX(pUinKey ptr,BYTE *key) // calculate secret key -BOOL CalculateKeyX(pUinKey ptr,HANDLE hContact) +BOOL CalculateKeyX(pUinKey ptr,HCONTACT hContact) { int agr = cpp_calc_keyx(ptr->cntx); if (agr) { diff --git a/plugins/SecureIM/src/crypt_icons.cpp b/plugins/SecureIM/src/crypt_icons.cpp index ab421e843b..dfb0d0771d 100644 --- a/plugins/SecureIM/src/crypt_icons.cpp +++ b/plugins/SecureIM/src/crypt_icons.cpp @@ -62,9 +62,9 @@ HANDLE mode2clicon(int mode, int type) } // îáíîâëÿåò èêîíêè â clist è â messagew -void ShowStatusIcon(HANDLE hContact, int mode) +void ShowStatusIcon(HCONTACT hContact, int mode) { - HANDLE hMC = getMetaContact(hContact); + HCONTACT hMC = getMetaContact(hContact); // îáíîâèòü èêîíêè â clist if (mode != -1) { @@ -92,12 +92,12 @@ void ShowStatusIcon(HANDLE hContact, int mode) } } -void ShowStatusIcon(HANDLE hContact) +void ShowStatusIcon(HCONTACT hContact) { ShowStatusIcon(hContact, isContactSecured(hContact)); } -void ShowStatusIconNotify(HANDLE hContact) +void ShowStatusIconNotify(HCONTACT hContact) { BYTE mode = isContactSecured(hContact); NotifyEventHooks(g_hEvent[(mode&SECURED) != 0], (WPARAM)hContact, 0); @@ -109,7 +109,7 @@ void RefreshContactListIcons(void) for (int i=0; i < arIcoList.getCount(); i++) arIcoList[i].hCLIcon = 0; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if (isSecureProtocol(hContact)) ShowStatusIcon(hContact); } diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 2e229a1ccf..9ec49d9705 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -62,7 +62,7 @@ void freeSupportedProtocols() arProto.destroy(); } -pSupPro getSupPro(HANDLE hContact) +pSupPro getSupPro(HCONTACT hContact) { for (int j=0; j < arProto.getCount(); j++) if (CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)arProto[j]->name)) @@ -72,7 +72,7 @@ pSupPro getSupPro(HANDLE hContact) } // add contact in the list of secureIM users -pUinKey addContact(HANDLE hContact) +pUinKey addContact(HCONTACT hContact) { if (hContact == NULL) return NULL; @@ -99,7 +99,7 @@ pUinKey addContact(HANDLE hContact) } // delete contact from the list of secureIM users -void delContact(HANDLE hContact) +void delContact(HCONTACT hContact) { pUinKey p = arClist.find((pUinKey)&hContact); if (p) { @@ -118,7 +118,7 @@ void loadContactList() freeContactList(); loadSupportedProtocols(); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) addContact(hContact); } @@ -138,12 +138,12 @@ void freeContactList() } // find user in the list of secureIM users and add him, if unknow -pUinKey findUinKey(HANDLE hContact) +pUinKey findUinKey(HCONTACT hContact) { return arClist.find((pUinKey)&hContact); } -pUinKey getUinKey(HANDLE hContact) +pUinKey getUinKey(HCONTACT hContact) { pUinKey p = arClist.find((pUinKey)&hContact); return (p) ? p : addContact(hContact); @@ -198,16 +198,16 @@ void addMsg2Queue(pUinKey ptr,WPARAM wParam,LPSTR szMsg) LeaveCriticalSection(&localQueueMutex); } -void getContactNameA(HANDLE hContact, LPSTR szName) { +void getContactNameA(HCONTACT hContact, LPSTR szName) { strcpy(szName,(LPCSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,0)); } -void getContactName(HANDLE hContact, LPSTR szName) +void getContactName(HCONTACT hContact, LPSTR szName) { wcscpy((LPWSTR)szName, (LPWSTR)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GSMDF_UNICODE)); } -void getContactUinA(HANDLE hContact, LPSTR szUIN) +void getContactUinA(HCONTACT hContact, LPSTR szUIN) { *szUIN = 0; @@ -233,7 +233,7 @@ void getContactUinA(HANDLE hContact, LPSTR szUIN) db_free(&dbv_uniqueid); } -void getContactUin(HANDLE hContact, LPSTR szUIN) +void getContactUin(HCONTACT hContact, LPSTR szUIN) { getContactUinA(hContact, szUIN); if (*szUIN) { diff --git a/plugins/SecureIM/src/crypt_metacontacts.cpp b/plugins/SecureIM/src/crypt_metacontacts.cpp index 39bebd23c2..50bd21767e 100644 --- a/plugins/SecureIM/src/crypt_metacontacts.cpp +++ b/plugins/SecureIM/src/crypt_metacontacts.cpp @@ -1,6 +1,6 @@ #include "commonheaders.h" -BOOL isProtoMetaContacts(HANDLE hContact) +BOOL isProtoMetaContacts(HCONTACT hContact) { if (bMetaContacts) { LPSTR proto = GetContactProto(hContact); @@ -10,7 +10,7 @@ BOOL isProtoMetaContacts(HANDLE hContact) return false; } -BOOL isDefaultSubContact(HANDLE hContact) +BOOL isDefaultSubContact(HCONTACT hContact) { if (bMetaContacts) return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0),0) == hContact; @@ -18,29 +18,29 @@ BOOL isDefaultSubContact(HANDLE hContact) return false; } -HANDLE getMetaContact(HANDLE hContact) +HCONTACT getMetaContact(HCONTACT hContact) { if (bMetaContacts) - return (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); + return (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); return 0; } -HANDLE getMostOnline(HANDLE hContact) +HCONTACT getMostOnline(HCONTACT hContact) { if (bMetaContacts) - return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + return (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); return 0; } // remove all secureim connections on subcontacts -void DeinitMetaContact(HANDLE hContact) +void DeinitMetaContact(HCONTACT hContact) { - HANDLE hMetaContact = isProtoMetaContacts(hContact) ? hContact : getMetaContact(hContact); + HCONTACT hMetaContact = isProtoMetaContacts(hContact) ? hContact : getMetaContact(hContact); if (hMetaContact) { for (int i=0; i < CallService(MS_MC_GETNUMCONTACTS,(WPARAM)hMetaContact,0); i++) { - HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hMetaContact, i); + HCONTACT hSubContact = (HCONTACT)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hMetaContact, i); if (hSubContact && (isContactSecured(hSubContact)&SECURED)) CallContactService(hSubContact,PSS_MESSAGE, PREF_METANODB, (LPARAM)SIG_DEIN); } diff --git a/plugins/SecureIM/src/crypt_misc.cpp b/plugins/SecureIM/src/crypt_misc.cpp index aa0025038c..6e34f77aee 100644 --- a/plugins/SecureIM/src/crypt_misc.cpp +++ b/plugins/SecureIM/src/crypt_misc.cpp @@ -2,7 +2,7 @@ static void sttWaitForExchange(LPVOID param) { - HANDLE hContact = (HANDLE)param; + HCONTACT hContact = (HCONTACT)param; pUinKey ptr = getUinKey(hContact); if (!ptr) return; diff --git a/plugins/SecureIM/src/crypt_popups.cpp b/plugins/SecureIM/src/crypt_popups.cpp index b584f5902d..9b085bdb3e 100644 --- a/plugins/SecureIM/src/crypt_popups.cpp +++ b/plugins/SecureIM/src/crypt_popups.cpp @@ -1,6 +1,6 @@ #include "commonheaders.h" -void showPopup(LPCSTR lpzText,HANDLE hContact,HICON hIcon, UINT type) +void showPopup(LPCSTR lpzText,HCONTACT hContact,HICON hIcon, UINT type) { //type=0 key colors //type=1 session colors @@ -52,50 +52,50 @@ void showPopup(LPCSTR lpzText,HANDLE hContact,HICON hIcon, UINT type) PUAddPopupW(&ppd); } -void showPopupDCmsg(HANDLE hContact,LPCSTR msg) +void showPopupDCmsg(HCONTACT hContact,LPCSTR msg) { if (db_get_b(0, MODULENAME, "dc", 1)) showPopup(msg, hContact, g_hPOP[POP_PU_DIS], 1); } -void showPopupDC(HANDLE hContact) +void showPopupDC(HCONTACT hContact) { if (db_get_b(0, MODULENAME, "dc", 1)) showPopup(sim006, hContact, g_hPOP[POP_PU_DIS], 1); } -void showPopupEC(HANDLE hContact) +void showPopupEC(HCONTACT hContact) { if (db_get_b(0, MODULENAME, "ec", 1)) showPopup(sim001, hContact, g_hPOP[POP_PU_EST], 1); } -void showPopupKS(HANDLE hContact) +void showPopupKS(HCONTACT hContact) { if (db_get_b(0, MODULENAME, "ks",1)) showPopup(sim007, hContact, g_hPOP[POP_PU_PRC], 0); } -void showPopupKRmsg(HANDLE hContact,LPCSTR msg) +void showPopupKRmsg(HCONTACT hContact,LPCSTR msg) { if (db_get_b(0, MODULENAME, "kr", 1)) showPopup(msg, hContact, g_hPOP[POP_PU_PRC], 0); } -void showPopupKR(HANDLE hContact) +void showPopupKR(HCONTACT hContact) { if (db_get_b(0, MODULENAME, "kr", 1)) showPopup(sim008, hContact, g_hPOP[POP_PU_PRC], 0); } -void showPopupSM(HANDLE hContact) +void showPopupSM(HCONTACT hContact) { if (db_get_b(0, MODULENAME, "ss", 0)) showPopup(sim009, hContact, g_hPOP[POP_PU_MSS], 2); SkinPlaySound("OutgoingSecureMessage"); } -void showPopupRM(HANDLE hContact) +void showPopupRM(HCONTACT hContact) { if (db_get_b(0, MODULENAME, "sr", 0)) showPopup(sim010, hContact, g_hPOP[POP_PU_MSR], 2); diff --git a/plugins/SecureIM/src/dbevent.cpp b/plugins/SecureIM/src/dbevent.cpp index 6e43318dad..7d3d0afaf7 100644 --- a/plugins/SecureIM/src/dbevent.cpp +++ b/plugins/SecureIM/src/dbevent.cpp @@ -1,7 +1,7 @@ #include "commonheaders.h" -void HistoryLog(HANDLE hContact, LPCSTR szText) +void HistoryLog(HCONTACT hContact, LPCSTR szText) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.szModule = GetContactProto(hContact); diff --git a/plugins/SecureIM/src/dbevent.h b/plugins/SecureIM/src/dbevent.h index c46ead73a1..4eb5251eb1 100644 --- a/plugins/SecureIM/src/dbevent.h +++ b/plugins/SecureIM/src/dbevent.h @@ -1,6 +1,6 @@ #ifndef __DBEVENT_H__ #define __DBEVENT_H__ -void HistoryLog(HANDLE,LPCSTR); +void HistoryLog(HCONTACT, LPCSTR); #endif diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 432d0ccb4d..31d5159a9b 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -977,7 +977,7 @@ void RefreshGeneralDlg(HWND hDlg, BOOL iInit) char tmp[NAMSIZE]; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { pUinKey ptr = getUinKey(hContact); if (ptr && isSecureProtocol(hContact) && !isChatRoom(hContact)) { if (iInit) { @@ -1063,7 +1063,7 @@ void RefreshPGPDlg(HWND hDlg, BOOL iInit) char tmp[NAMSIZE]; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { pUinKey ptr = getUinKey(hContact); if (ptr && ptr->mode == MODE_PGP && isSecureProtocol(hContact) /*&& !getMetaContact(hContact)*/ && !isChatRoom(hContact)) { LPSTR szKeyID = db_get_sa(hContact,MODULENAME,"pgp_abbr"); @@ -1123,7 +1123,7 @@ void RefreshGPGDlg(HWND hDlg, BOOL iInit) char tmp[NAMSIZE]; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { pUinKey ptr = getUinKey(hContact); if (ptr && ptr->mode == MODE_GPG && isSecureProtocol(hContact) /*&& !getMetaContact(hContact)*/ && !isChatRoom(hContact)) { if (iInit ) @@ -1176,7 +1176,7 @@ void ResetGeneralDlg(HWND hDlg) lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; char tmp[NAMSIZE]; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (!isSecureProtocol(hContact) || isChatRoom(hContact)) continue; diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index b2af53bb19..24efb7785b 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -3,7 +3,7 @@ int __cdecl onContactSettingChanged(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; if (!hContact || strcmp(cws->szSetting,"Status")) return 0; @@ -35,8 +35,9 @@ int __cdecl onContactSettingChanged(WPARAM wParam,LPARAM lParam) { // wParam=(WPARAM)(HANDLE)hContact // lParam=0 -int __cdecl onContactAdded(WPARAM wParam,LPARAM lParam) { - addContact((HANDLE)wParam); +int __cdecl onContactAdded(WPARAM wParam,LPARAM lParam) +{ + addContact((HCONTACT)wParam); return 0; } @@ -45,7 +46,7 @@ int __cdecl onContactAdded(WPARAM wParam,LPARAM lParam) { // lParam=0 int __cdecl onContactDeleted(WPARAM wParam,LPARAM lParam) { - delContact((HANDLE)wParam); + delContact((HCONTACT)wParam); return 0; } @@ -58,15 +59,15 @@ int __cdecl onExtraImageListRebuilding(WPARAM, LPARAM) int __cdecl onExtraImageApplying(WPARAM wParam, LPARAM) { - if (isSecureProtocol((HANDLE)wParam)) - ExtraIcon_SetIcon(g_hCLIcon, (HANDLE)wParam, mode2clicon( isContactSecured((HANDLE)wParam), 1)); + if (isSecureProtocol((HCONTACT)wParam)) + ExtraIcon_SetIcon(g_hCLIcon, (HCONTACT)wParam, mode2clicon(isContactSecured((HCONTACT)wParam), 1)); return 0; } int __cdecl onRebuildContactMenu(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; BOOL bMC = isProtoMetaContacts(hContact); if (bMC ) hContact = getMostOnline(hContact); // âîçüìåì òîò, ÷åðåç êîòîðûé ïîéäåò ñîîáùåíèå pUinKey ptr = getUinKey(hContact); diff --git a/plugins/SecureIM/src/svcs_menu.cpp b/plugins/SecureIM/src/svcs_menu.cpp index b8fba61f48..f099757b0d 100644 --- a/plugins/SecureIM/src/svcs_menu.cpp +++ b/plugins/SecureIM/src/svcs_menu.cpp @@ -3,19 +3,19 @@ INT_PTR __cdecl Service_IsContactSecured(WPARAM wParam, LPARAM lParam) { - return (isContactSecured((HANDLE)wParam)&SECURED) || isContactPGP((HANDLE)wParam) || isContactGPG((HANDLE)wParam); + return (isContactSecured((HCONTACT)wParam)&SECURED) || isContactPGP((HCONTACT)wParam) || isContactGPG((HCONTACT)wParam); } INT_PTR __cdecl Service_CreateIM(WPARAM wParam,LPARAM lParam) { - CallContactService((HANDLE)wParam,PSS_MESSAGE, PREF_METANODB,(LPARAM)SIG_INIT); + CallContactService((HCONTACT)wParam, PSS_MESSAGE, PREF_METANODB, (LPARAM)SIG_INIT); return 1; } INT_PTR __cdecl Service_DisableIM(WPARAM wParam,LPARAM lParam) { - CallContactService((HANDLE)wParam,PSS_MESSAGE, PREF_METANODB,(LPARAM)SIG_DEIN); + CallContactService((HCONTACT)wParam, PSS_MESSAGE, PREF_METANODB, (LPARAM)SIG_DEIN); return 1; } @@ -25,7 +25,7 @@ INT_PTR __cdecl Service_Status(WPARAM wParam, LPARAM lParam) case STATUS_DISABLED: case STATUS_ENABLED: case STATUS_ALWAYSTRY: - pUinKey ptr = getUinKey((HANDLE)wParam); + pUinKey ptr = getUinKey((HCONTACT)wParam); if (ptr) { ptr->status=ptr->tstatus=(BYTE)lParam; if (ptr->status == STATUS_ENABLED) db_unset(ptr->hContact, MODULENAME, "StatusID"); @@ -55,15 +55,15 @@ INT_PTR __cdecl Service_StatusTry(WPARAM wParam, LPARAM lParam) INT_PTR __cdecl Service_PGPdelKey(WPARAM wParam, LPARAM lParam) { if (bPGPloaded) { - db_unset((HANDLE)wParam, MODULENAME, "pgp"); - db_unset((HANDLE)wParam, MODULENAME, "pgp_mode"); - db_unset((HANDLE)wParam, MODULENAME, "pgp_abbr"); + db_unset((HCONTACT)wParam, MODULENAME, "pgp"); + db_unset((HCONTACT)wParam, MODULENAME, "pgp_mode"); + db_unset((HCONTACT)wParam, MODULENAME, "pgp_abbr"); } { - pUinKey ptr = getUinKey((HANDLE)wParam); + pUinKey ptr = getUinKey((HCONTACT)wParam); cpp_delete_context(ptr->cntx); ptr->cntx=0; } - ShowStatusIconNotify((HANDLE)wParam); + ShowStatusIconNotify((HCONTACT)wParam); return 1; } @@ -75,10 +75,10 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) char szKeyID[128]; szKeyID[0]='\0'; PVOID KeyID = pgp_select_keyid(GetForegroundWindow(),szKeyID); if (szKeyID[0]) { - db_unset((HANDLE)wParam,MODULENAME,"pgp"); - db_set_blob((HANDLE)wParam, MODULENAME, "pgp", KeyID, pgp_size_keyid()); - db_set_b((HANDLE)wParam,MODULENAME,"pgp_mode",0); - db_set_s((HANDLE)wParam,MODULENAME,"pgp_abbr",szKeyID); + db_unset((HCONTACT)wParam, MODULENAME, "pgp"); + db_set_blob((HCONTACT)wParam, MODULENAME, "pgp", KeyID, pgp_size_keyid()); + db_set_b((HCONTACT)wParam, MODULENAME, "pgp_mode", 0); + db_set_s((HCONTACT)wParam, MODULENAME, "pgp_abbr", szKeyID); del = false; } } @@ -87,10 +87,10 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) if (ShowSelectKeyDlg(0,KeyPath)) { char *publ = LoadKeys(KeyPath,false); if (publ) { - db_unset((HANDLE)wParam,MODULENAME,"pgp"); - db_set_s((HANDLE)wParam,MODULENAME,"pgp",publ); - db_set_b((HANDLE)wParam,MODULENAME,"pgp_mode",1); - db_set_s((HANDLE)wParam,MODULENAME,"pgp_abbr","(binary)"); + db_unset((HCONTACT)wParam, MODULENAME, "pgp"); + db_set_s((HCONTACT)wParam, MODULENAME, "pgp", publ); + db_set_b((HCONTACT)wParam, MODULENAME, "pgp_mode", 1); + db_set_s((HCONTACT)wParam, MODULENAME, "pgp_abbr", "(binary)"); mir_free(publ); del = false; } @@ -101,22 +101,22 @@ INT_PTR __cdecl Service_PGPsetKey(WPARAM wParam, LPARAM lParam) if (del) Service_PGPdelKey(wParam,lParam); else { - pUinKey ptr = getUinKey((HANDLE)wParam); + pUinKey ptr = getUinKey((HCONTACT)wParam); cpp_delete_context(ptr->cntx); ptr->cntx=0; } - ShowStatusIconNotify((HANDLE)wParam); + ShowStatusIconNotify((HCONTACT)wParam); return 1; } INT_PTR __cdecl Service_GPGdelKey(WPARAM wParam, LPARAM lParam) { if (bGPGloaded) - db_unset((HANDLE)wParam, MODULENAME, "gpg"); + db_unset((HCONTACT)wParam, MODULENAME, "gpg"); { - pUinKey ptr = getUinKey((HANDLE)wParam); + pUinKey ptr = getUinKey((HCONTACT)wParam); cpp_delete_context(ptr->cntx); ptr->cntx=0; } - ShowStatusIconNotify((HANDLE)wParam); + ShowStatusIconNotify((HCONTACT)wParam); return 1; } @@ -127,28 +127,28 @@ INT_PTR __cdecl Service_GPGsetKey(WPARAM wParam, LPARAM lParam) char szKeyID[128]; szKeyID[0]='\0'; gpg_select_keyid(GetForegroundWindow(),szKeyID); if (szKeyID[0]) { - db_set_s((HANDLE)wParam,MODULENAME,"gpg",szKeyID); + db_set_s((HCONTACT)wParam, MODULENAME, "gpg", szKeyID); del = false; } } if (del) Service_GPGdelKey(wParam,lParam); else { - pUinKey ptr = getUinKey((HANDLE)wParam); + pUinKey ptr = getUinKey((HCONTACT)wParam); cpp_delete_context(ptr->cntx); ptr->cntx=0; } - ShowStatusIconNotify((HANDLE)wParam); + ShowStatusIconNotify((HCONTACT)wParam); return 1; } INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam) { - pUinKey ptr = getUinKey((HANDLE)wParam); + pUinKey ptr = getUinKey((HCONTACT)wParam); switch(--lParam) { case MODE_NATIVE: case MODE_RSAAES: - if (isContactSecured((HANDLE)wParam)&SECURED) { + if (isContactSecured((HCONTACT)wParam)&SECURED) { msgbox(NULL, sim111, MODULENAME, MB_OK); return 0; } @@ -165,9 +165,9 @@ INT_PTR __cdecl Service_Mode(WPARAM wParam, LPARAM lParam) ptr->keyLoaded = 0; } ptr->mode=(BYTE)lParam; - db_set_b((HANDLE)wParam, MODULENAME, "mode", (BYTE)lParam); + db_set_b((HCONTACT)wParam, MODULENAME, "mode", (BYTE)lParam); } - ShowStatusIcon((HANDLE)wParam); + ShowStatusIcon((HCONTACT)wParam); break; } diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index 7350aa9e95..7a0c20fe3c 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -31,13 +31,13 @@ static void sttFakeAck(LPVOID param) delete tParam; } -int returnNoError(HANDLE hContact) +int returnNoError(HCONTACT hContact) { mir_forkthread(sttFakeAck, new TFakeAckParams(hContact, 777, 0)); return 777; } -int returnError(HANDLE hContact, LPCSTR err) +int returnError(HCONTACT hContact, LPCSTR err) { mir_forkthread(sttFakeAck, new TFakeAckParams(hContact, 666, err)); return 666; diff --git a/plugins/SecureIM/src/svcs_srmm.cpp b/plugins/SecureIM/src/svcs_srmm.cpp index 6c05f77bca..59791ee43c 100644 --- a/plugins/SecureIM/src/svcs_srmm.cpp +++ b/plugins/SecureIM/src/svcs_srmm.cpp @@ -11,7 +11,7 @@ int __cdecl onWindowEvent(WPARAM, LPARAM lParam) int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (isProtoMetaContacts(hContact)) hContact = getMostOnline(hContact); // âîçüìåì òîò, ÷åðåç êîòîðûé ïîéäåò ñîîáùåíèå diff --git a/plugins/SeenPlugin/src/file.cpp b/plugins/SeenPlugin/src/file.cpp index 8aea65614b..d049fda7d3 100644 --- a/plugins/SeenPlugin/src/file.cpp +++ b/plugins/SeenPlugin/src/file.cpp @@ -59,7 +59,7 @@ int InitFileOutput(void) /* Writes a line into the log. */ -void FileWrite(HANDLE hcontact) +void FileWrite(HCONTACT hcontact) { TCHAR szout[1024]; diff --git a/plugins/SeenPlugin/src/history.cpp b/plugins/SeenPlugin/src/history.cpp index bb269830a7..1d935e4d7b 100644 --- a/plugins/SeenPlugin/src/history.cpp +++ b/plugins/SeenPlugin/src/history.cpp @@ -31,7 +31,7 @@ char* BuildSetting(int historyLast) { return setting; } -void HistoryWrite(HANDLE hContact) +void HistoryWrite(HCONTACT hContact) { int historyMax = db_get_w(NULL, S_MOD, "HistoryMax", 10); if (historyMax < 0) @@ -64,7 +64,7 @@ void HistoryWrite(HANDLE hContact) db_set_w(hContact, S_MOD, "HistoryFirst", (historyFirst+1) % historyMax); } -void LoadHistoryList(HANDLE hContact, HWND hwnd, int nList) +void LoadHistoryList(HCONTACT hContact, HWND hwnd, int nList) { SendDlgItemMessage(hwnd, nList, LB_RESETCONTENT, 0, 0); int historyMax = db_get_w(NULL,S_MOD,"HistoryMax",10); @@ -161,13 +161,13 @@ void MyResizeGetOffset (HWND hwndDlg, HWND hwndControl, int nWidth, int nHeight, INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARAM lparam) { - HANDLE hContact; + HCONTACT hContact; TCHAR sztemp[1024]; switch(Message) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - hContact = (HANDLE)lparam; + hContact = (HCONTACT)lparam; SetWindowLongPtr(hwndDlg,GWLP_USERDATA,lparam); mir_sntprintf(sztemp, SIZEOF(sztemp), _T("%s: %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR), @@ -199,7 +199,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA return CallService(MS_CLIST_MENUDRAWITEM,wparam,lparam); case WM_COMMAND: - hContact=(HANDLE)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); + hContact=(HCONTACT)GetWindowLongPtr(hwndDlg,GWLP_USERDATA); if (CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wparam),MPCF_CONTACTMENU),(LPARAM)hContact)) break; @@ -278,7 +278,7 @@ INT_PTR CALLBACK HistoryDlgProc(HWND hwndDlg, UINT Message, WPARAM wparam, LPARA return FALSE; } -void ShowHistory(HANDLE hContact, BYTE isAlert) +void ShowHistory(HCONTACT hContact, BYTE isAlert) { HWND hHistoryDlg = WindowList_Find(hWindowList,hContact); if (hHistoryDlg == NULL) { diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp index 6056971494..849c271dc6 100644 --- a/plugins/SeenPlugin/src/menu.cpp +++ b/plugins/SeenPlugin/src/menu.cpp @@ -30,14 +30,14 @@ Handles the messages sent by clicking the contact's menu item */ INT_PTR MenuitemClicked(WPARAM wparam,LPARAM) { - ShowHistory((HANDLE)wparam, 0); + ShowHistory((HCONTACT)wparam, 0); return 0; } int BuildContactMenu(WPARAM wparam,LPARAM) { int id = -1, isetting; - HANDLE hContact = (HANDLE)wparam; + HCONTACT hContact = (HCONTACT)wparam; char *szProto = GetContactProto(hContact); CLISTMENUITEM cmi = { sizeof(cmi) }; @@ -49,10 +49,10 @@ int BuildContactMenu(WPARAM wparam,LPARAM) DBVARIANT dbv; if ( !db_get_ts(NULL, S_MOD, "MenuStamp", &dbv)) { - cmi.ptszName = ParseString(dbv.ptszVal, (HANDLE)wparam, 0); + cmi.ptszName = ParseString(dbv.ptszVal, (HCONTACT)wparam, 0); db_free(&dbv); } - else cmi.ptszName = ParseString(DEFAULT_MENUSTAMP, (HANDLE)wparam, 0); + else cmi.ptszName = ParseString(DEFAULT_MENUSTAMP, (HCONTACT)wparam, 0); if ( !_tcscmp(cmi.ptszName, TranslateT(""))) { if ( IsWatchedProtocol(szProto)) diff --git a/plugins/SeenPlugin/src/missed.cpp b/plugins/SeenPlugin/src/missed.cpp index ae29690d72..5746d0b647 100644 --- a/plugins/SeenPlugin/src/missed.cpp +++ b/plugins/SeenPlugin/src/missed.cpp @@ -42,7 +42,7 @@ int RemoveUser(int pos) int ResetMissed(void) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) db_set_b(hContact, S_MOD, "Missed", 0); ZeroMemory(&mcs,sizeof(mcs)); @@ -51,7 +51,7 @@ int ResetMissed(void) int CheckIfOnline(void) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if ( CallService(MS_CLIST_GETCONTACTICON, (WPARAM)hContact, 0) != ICON_OFFLINE) db_set_b(hContact, S_MOD, "Missed", 2); @@ -128,12 +128,12 @@ int Test(WPARAM wparam,LPARAM lparam) if (CallService(MS_IGNORE_ISIGNORED,wparam,IGNOREEVENT_USERONLINE)) return 0; - if ( db_get_b((HANDLE)wparam,S_MOD,"Missed",0)==2) + if ( db_get_b((HCONTACT)wparam,S_MOD,"Missed",0)==2) return 0; switch(lparam) { case ICON_OFFLINE: - if ( db_get_b((HANDLE)wparam,S_MOD,"Missed",0) == 1) { + if ( db_get_b((HCONTACT)wparam,S_MOD,"Missed",0) == 1) { WORD missed = IsUserMissed(wparam); if (!LOWORD(missed)) { mcs.times[mcs.count]=1; @@ -141,7 +141,7 @@ int Test(WPARAM wparam,LPARAM lparam) } else mcs.times[HIWORD(missed)]++; - db_set_b((HANDLE)wparam,S_MOD,"Missed",0); + db_set_b((HCONTACT)wparam,S_MOD,"Missed",0); } break; @@ -152,7 +152,7 @@ int Test(WPARAM wparam,LPARAM lparam) case ICON_DND: case ICON_FREE: case ICON_INVIS: - db_set_b((HANDLE)wparam,S_MOD,"Missed",1); + db_set_b((HCONTACT)wparam,S_MOD,"Missed",1); break; } diff --git a/plugins/SeenPlugin/src/seen.h b/plugins/SeenPlugin/src/seen.h index b716ead0a5..15b357ac1f 100644 --- a/plugins/SeenPlugin/src/seen.h +++ b/plugins/SeenPlugin/src/seen.h @@ -52,8 +52,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "resource.h" #include "version.h" -WCHAR *any_to_IdleNotidleUnknown(HANDLE hContact, const char *module_name, const char *setting_name, WCHAR *buff, int bufflen); -WCHAR *any_to_Idle(HANDLE hContact, const char *module_name, const char *setting_name, WCHAR *buff, int bufflen); +WCHAR *any_to_IdleNotidleUnknown(HCONTACT hContact, const char *module_name, const char *setting_name, WCHAR *buff, int bufflen); +WCHAR *any_to_Idle(HCONTACT hContact, const char *module_name, const char *setting_name, WCHAR *buff, int bufflen); #define NUM100NANOSEC 116444736000000000 @@ -94,7 +94,7 @@ typedef struct{ } MISSEDCONTACTS; int IsWatchedProtocol(const char* szProto); -TCHAR *ParseString(TCHAR*, HANDLE, BYTE); +TCHAR *ParseString(TCHAR*, HCONTACT, BYTE); void GetColorsFromDWord(LPCOLORREF First, LPCOLORREF Second, DWORD colDword); DWORD GetDWordFromColors(COLORREF First, COLORREF Second); int OptionsInit(WPARAM,LPARAM); @@ -106,11 +106,11 @@ int ModeChange(WPARAM,LPARAM); void SetOffline(void); int ModeChange_mo(WPARAM,LPARAM); int CheckIfOnline(void); -void ShowHistory(HANDLE hContact, BYTE isAlert); +void ShowHistory(HCONTACT hContact, BYTE isAlert); struct logthread_info { - HANDLE hContact; + HCONTACT hContact; char sProtoName[MAXMODULELABELLENGTH]; WORD currStatus; }; diff --git a/plugins/SeenPlugin/src/userinfo.cpp b/plugins/SeenPlugin/src/userinfo.cpp index 6205dcaa1e..ddab491d6a 100644 --- a/plugins/SeenPlugin/src/userinfo.cpp +++ b/plugins/SeenPlugin/src/userinfo.cpp @@ -40,10 +40,10 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) { TCHAR *szout; if ( !db_get_ts(NULL, S_MOD, "UserStamp", &dbv)) { - szout = ParseString(dbv.ptszVal, (HANDLE)lparam, 0); + szout = ParseString(dbv.ptszVal, (HCONTACT)lparam, 0); db_free(&dbv); } - else szout = ParseString(DEFAULT_USERSTAMP, (HANDLE)lparam, 0); + else szout = ParseString(DEFAULT_USERSTAMP, (HCONTACT)lparam, 0); SetDlgItemText(hdlg, IDC_INFOTEXT, szout); if ( !lstrcmp(szout, TranslateT(""))) @@ -62,7 +62,7 @@ INT_PTR CALLBACK UserinfoDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) int UserinfoInit(WPARAM wparam,LPARAM lparam) { - char *proto = GetContactProto((HANDLE)lparam); + char *proto = GetContactProto((HCONTACT)lparam); if ( IsWatchedProtocol(proto)) { OPTIONSDIALOGPAGE uip = { sizeof(uip) }; uip.hInstance = hInstance; diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index c7e0705a7d..9bcb42000b 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "seen.h" -void FileWrite(HANDLE); -void HistoryWrite(HANDLE hcontact); +void FileWrite(HCONTACT); +void HistoryWrite(HCONTACT hcontact); extern HANDLE g_hShutdownEvent; char * courProtoName = 0; @@ -96,7 +96,7 @@ BOOL isMSN(char *protoname) return FALSE; } -DWORD isSeen(HANDLE hcontact, SYSTEMTIME *st) +DWORD isSeen(HCONTACT hcontact, SYSTEMTIME *st) { FILETIME ft; ULONGLONG ll; @@ -142,7 +142,7 @@ TCHAR *wdays_short[] = { LPGENT("Sun."), LPGENT("Mon."), LPGENT("Tue."), LPGENT( TCHAR *monthnames[] = { LPGENT("January"), LPGENT("February"), LPGENT("March"), LPGENT("April"), LPGENT("May"), LPGENT("June"), LPGENT("July"), LPGENT("August"), LPGENT("September"), LPGENT("October"), LPGENT("November"), LPGENT("December") }; TCHAR *mnames_short[] = { LPGENT("Jan."), LPGENT("Feb."), LPGENT("Mar."), LPGENT("Apr."), LPGENT("May"), LPGENT("Jun."), LPGENT("Jul."), LPGENT("Aug."), LPGENT("Sep."), LPGENT("Oct."), LPGENT("Nov."), LPGENT("Dec.") }; -TCHAR *ParseString(TCHAR *szstring, HANDLE hcontact, BYTE isfile) +TCHAR *ParseString(TCHAR *szstring, HCONTACT hcontact, BYTE isfile) { #define MAXSIZE 1024 static TCHAR sztemp[MAXSIZE+1]; @@ -386,7 +386,7 @@ LBL_charPtr: return sztemp; } -void _DBWriteTime(SYSTEMTIME *st,HANDLE hcontact) +void _DBWriteTime(SYSTEMTIME *st, HCONTACT hcontact) { db_set_w(hcontact,S_MOD,"Day",st->wDay); db_set_w(hcontact,S_MOD,"Month",st->wMonth); @@ -398,7 +398,7 @@ void _DBWriteTime(SYSTEMTIME *st,HANDLE hcontact) } -void DBWriteTimeTS(DWORD t, HANDLE hcontact){ +void DBWriteTimeTS(DWORD t, HCONTACT hcontact){ SYSTEMTIME st; FILETIME ft; ULONGLONG ll = UInt32x32To64(CallService(MS_DB_TIME_TIMESTAMPTOLOCAL,t,0), 10000000) + NUM100NANOSEC; @@ -454,7 +454,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa switch(message) { case WM_COMMAND: if (HIWORD(wParam) == STN_CLICKED){ - HANDLE hContact = PUGetContact(hwnd); + HCONTACT hContact = PUGetContact(hwnd); if (hContact > 0) CallService(MS_MSG_SENDMESSAGE,(WPARAM)hContact,0); } case WM_CONTEXTMENU: @@ -465,7 +465,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa return DefWindowProc(hwnd, message, wParam, lParam); }; -void ShowPopup(HANDLE hcontact, const char * lpzProto, int newStatus) +void ShowPopup(HCONTACT hcontact, const char * lpzProto, int newStatus) { if ( CallService(MS_IGNORE_ISIGNORED, (WPARAM)hcontact, IGNOREEVENT_USERONLINE)) return; @@ -548,7 +548,7 @@ int UpdateValues(WPARAM wparam,LPARAM lparam) // to make this code faster if (!wparam) return 0; - HANDLE hContact = (HANDLE)wparam; + HCONTACT hContact = (HCONTACT)wparam; DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING *)lparam; //if (CallService(MS_IGNORE_ISIGNORED,(WPARAM)hContact,IGNOREEVENT_USERONLINE)) return 0; BOOL isIdleEvent = includeIdle?(strcmp(cws->szSetting,"IdleTS")==0):0; @@ -642,7 +642,7 @@ static void cleanThread(void *param) // I hope in 10 secons all logged-in contacts will be listed if ( WaitForSingleObject(g_hShutdownEvent, 10000) == WAIT_TIMEOUT) { - for (HANDLE hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) { + for (HCONTACT hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) { WORD oldStatus = db_get_w(hContact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE) | 0x8000; if (oldStatus > ID_STATUS_OFFLINE) { if (db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)==ID_STATUS_OFFLINE){ @@ -711,7 +711,7 @@ int ModeChange(WPARAM wparam,LPARAM lparam) return 0; } -short int isDbZero(HANDLE hContact, const char *module_name, const char *setting_name) +short int isDbZero(HCONTACT hContact, const char *module_name, const char *setting_name) { DBVARIANT dbv; if ( !db_get(hContact, module_name, setting_name, &dbv)) { @@ -729,7 +729,7 @@ short int isDbZero(HANDLE hContact, const char *module_name, const char *setting return -1; } -TCHAR *any_to_IdleNotidleUnknown(HANDLE hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) { +TCHAR *any_to_IdleNotidleUnknown(HCONTACT hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) { short int r = isDbZero(hContact, module_name, setting_name); if (r==-1){ _tcsncpy(buff, TranslateT("Unknown"), bufflen); @@ -740,7 +740,7 @@ TCHAR *any_to_IdleNotidleUnknown(HANDLE hContact, const char *module_name, const return buff; } -TCHAR *any_to_Idle(HANDLE hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) { +TCHAR *any_to_Idle(HCONTACT hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) { if (isDbZero(hContact, module_name, setting_name)==0) { //DB setting is NOT zero and exists buff[0] = L'/'; _tcsncpy(&buff[1], TranslateT("Idle"), bufflen-1); diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index a8f6dd53e8..4158368e9f 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "global.h" //--------------------------------------------------------------------------- -CSend::CSend(HWND Owner, HANDLE hContact, bool bFreeOnExit) { +CSend::CSend(HWND Owner, HCONTACT hContact, bool bFreeOnExit) { m_hWndO = Owner; m_bFreeOnExit = bFreeOnExit; m_pszFile = NULL; @@ -59,7 +59,7 @@ CSend::~CSend(){ } //--------------------------------------------------------------------------- -void CSend::SetContact(HANDLE hContact) { +void CSend::SetContact(HCONTACT hContact) { m_hContact = hContact; m_pszProto = GetContactProto(hContact); m_ChatRoom = db_get_b(hContact, m_pszProto, "ChatRoom", 0); @@ -145,7 +145,7 @@ void CSend::svcSendChat() { gci.pszModule = m_pszProto; for (int i = 0; i < cnt ; i++ ) { gci.iItem = i; - gci.Flags = BYINDEX | HCONTACT | ID; + gci.Flags = GCF_BYINDEX | GCF_HCONTACT | GCF_ID; CallService(MS_GC_GETINFO, 0, (LPARAM)&gci); if (gci.hContact == m_hContact) { GCDEST gcd = { m_pszProto, gci.pszID, GC_EVENT_SENDMESSAGE }; diff --git a/plugins/SendScreenshotPlus/src/CSend.h b/plugins/SendScreenshotPlus/src/CSend.h index 6e65252919..cdd12a5393 100644 --- a/plugins/SendScreenshotPlus/src/CSend.h +++ b/plugins/SendScreenshotPlus/src/CSend.h @@ -48,13 +48,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //--------------------------------------------------------------------------- class CSend { public: - CSend(HWND Owner, HANDLE hContact, bool bFreeOnExit); // oder (TfrmMain & Owner) + CSend(HWND Owner, HCONTACT hContact, bool bFreeOnExit); // oder (TfrmMain & Owner) virtual ~CSend(); virtual void Send() = 0; // void SendSync(bool Sync) {m_SendSync = Sync;}; bool m_bFreeOnExit; // need to "delete object;" on exit ? - void SetContact(HANDLE hContact); + void SetContact(HCONTACT hContact); BYTE GetEnableItem() {return m_EnableItem;}; LPTSTR GetErrorMsg() {return m_ErrorMsg;}; @@ -66,14 +66,13 @@ class CSend { private: protected: - LPTSTR m_pszSendTyp; //hold string for error mess - HWND m_hWndO; //window handle of caller - HANDLE m_hContact; //Contact handle - char* m_pszProto; //Contact Proto Modul - BYTE m_EnableItem; //hold flag for send type - void AfterSendDelete(); - BYTE m_ChatRoom; //is Contact chatroom -// bool m_SendSync; //send sync / async + LPTSTR m_pszSendTyp; //hold string for error mess + HWND m_hWndO; //window handle of caller + HCONTACT m_hContact; //Contact handle + char *m_pszProto; //Contact Proto Modul + BYTE m_EnableItem; //hold flag for send type + BYTE m_ChatRoom; //is Contact chatroom + void AfterSendDelete(); bool hasCap(unsigned int Flag); unsigned int m_PFflag; diff --git a/plugins/SendScreenshotPlus/src/CSendEmail.cpp b/plugins/SendScreenshotPlus/src/CSendEmail.cpp index c7f216b454..778c28390c 100644 --- a/plugins/SendScreenshotPlus/src/CSendEmail.cpp +++ b/plugins/SendScreenshotPlus/src/CSendEmail.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "global.h" //--------------------------------------------------------------------------- -CSendEmail::CSendEmail(HWND Owner, HANDLE hContact, bool bFreeOnExit) +CSendEmail::CSendEmail(HWND Owner, HCONTACT hContact, bool bFreeOnExit) : CSend(Owner, hContact, bFreeOnExit){ m_EnableItem = SS_DLG_DELETEAFTERSSEND | SS_DLG_DESCRIPTION; // SS_DLG_AUTOSEND | ; m_pszSendTyp = _T("Email transfer"); diff --git a/plugins/SendScreenshotPlus/src/CSendEmail.h b/plugins/SendScreenshotPlus/src/CSendEmail.h index 35e2372fc9..bfd51da9ce 100644 --- a/plugins/SendScreenshotPlus/src/CSendEmail.h +++ b/plugins/SendScreenshotPlus/src/CSendEmail.h @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CSendEmail : public CSend { public: // Deklaration Standardkonstruktor/Standarddestructor - CSendEmail(HWND Owner, HANDLE hContact, bool bFreeOnExit); + CSendEmail(HWND Owner, HCONTACT hContact, bool bFreeOnExit); ~CSendEmail(); void Send(); diff --git a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp index 355ea225ad..f7a4661261 100644 --- a/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp +++ b/plugins/SendScreenshotPlus/src/CSendFTPFile.cpp @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //--------------------------------------------------------------------------- -CSendFTPFile::CSendFTPFile(HWND Owner, HANDLE hContact, bool bFreeOnExit) +CSendFTPFile::CSendFTPFile(HWND Owner, HCONTACT hContact, bool bFreeOnExit) : CSend(Owner, hContact, bFreeOnExit){ m_EnableItem = NULL ; //SS_DLG_DESCRIPTION| SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; m_pszSendTyp = LPGENT("FTPFile transfer"); diff --git a/plugins/SendScreenshotPlus/src/CSendFTPFile.h b/plugins/SendScreenshotPlus/src/CSendFTPFile.h index 9fa83e0481..11eaabb3e0 100644 --- a/plugins/SendScreenshotPlus/src/CSendFTPFile.h +++ b/plugins/SendScreenshotPlus/src/CSendFTPFile.h @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CSendFTPFile : public CSend { public: // Deklaration Standardkonstruktor/Standarddestructor - CSendFTPFile(HWND Owner, HANDLE hContact, bool bFreeOnExit); + CSendFTPFile(HWND Owner, HCONTACT hContact, bool bFreeOnExit); ~CSendFTPFile(); void Send(); diff --git a/plugins/SendScreenshotPlus/src/CSendFile.cpp b/plugins/SendScreenshotPlus/src/CSendFile.cpp index 34489fbe1d..0453d581c0 100644 --- a/plugins/SendScreenshotPlus/src/CSendFile.cpp +++ b/plugins/SendScreenshotPlus/src/CSendFile.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "global.h" //--------------------------------------------------------------------------- -CSendFile::CSendFile(HWND Owner, HANDLE hContact, bool bFreeOnExit) +CSendFile::CSendFile(HWND Owner, HCONTACT hContact, bool bFreeOnExit) : CSend(Owner, hContact, bFreeOnExit){ m_EnableItem = SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND | SS_DLG_DESCRIPTION; m_pszSendTyp = _T("File transfer"); diff --git a/plugins/SendScreenshotPlus/src/CSendFile.h b/plugins/SendScreenshotPlus/src/CSendFile.h index 1476c58c14..07877cdac8 100644 --- a/plugins/SendScreenshotPlus/src/CSendFile.h +++ b/plugins/SendScreenshotPlus/src/CSendFile.h @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CSendFile : public CSend { public: // Deklaration Standardkonstruktor/Standarddestructor - CSendFile(HWND Owner, HANDLE hContact, bool bFreeOnExit); + CSendFile(HWND Owner, HCONTACT hContact, bool bFreeOnExit); ~CSendFile(); void Send(); diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp index af3f4f277f..cdc146b0e9 100644 --- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp @@ -34,7 +34,7 @@ INT_PTR (*g_MirCallService)(const char *, WPARAM, LPARAM)=NULL; //--------------------------------------------------------------------------- -CSendHTTPServer::CSendHTTPServer(HWND Owner, HANDLE hContact, bool bFreeOnExit) +CSendHTTPServer::CSendHTTPServer(HWND Owner, HCONTACT hContact, bool bFreeOnExit) : CSend(Owner, hContact, bFreeOnExit){ m_EnableItem = SS_DLG_DESCRIPTION ; //| SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND; m_pszSendTyp = _T("HTTPServer transfer"); diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.h b/plugins/SendScreenshotPlus/src/CSendHTTPServer.h index d8b2209aa0..740be3edf6 100644 --- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.h +++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.h @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CSendHTTPServer : public CSend { public: // Deklaration Standardkonstruktor/Standarddestructor - CSendHTTPServer(HWND Owner, HANDLE hContact, bool bFreeOnExit); + CSendHTTPServer(HWND Owner, HCONTACT hContact, bool bFreeOnExit); ~CSendHTTPServer(); void Send(); diff --git a/plugins/SendScreenshotPlus/src/CSendImageShack.cpp b/plugins/SendScreenshotPlus/src/CSendImageShack.cpp index 54608e6d35..68f91bbdc1 100644 --- a/plugins/SendScreenshotPlus/src/CSendImageShack.cpp +++ b/plugins/SendScreenshotPlus/src/CSendImageShack.cpp @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "global.h" //--------------------------------------------------------------------------- -CSendImageShack::CSendImageShack(HWND Owner, HANDLE hContact, bool bFreeOnExit) +CSendImageShack::CSendImageShack(HWND Owner, HCONTACT hContact, bool bFreeOnExit) : CSend(Owner, hContact, bFreeOnExit) { m_EnableItem = SS_DLG_AUTOSEND | SS_DLG_DELETEAFTERSSEND | SS_DLG_DESCRIPTION; m_pszSendTyp = _T("Image upload"); diff --git a/plugins/SendScreenshotPlus/src/CSendImageShack.h b/plugins/SendScreenshotPlus/src/CSendImageShack.h index c7ee7e1e15..6ab5670c7c 100644 --- a/plugins/SendScreenshotPlus/src/CSendImageShack.h +++ b/plugins/SendScreenshotPlus/src/CSendImageShack.h @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CSendImageShack : public CSend { public: // Deklaration Standardkonstruktor/Standarddestructor - CSendImageShack(HWND Owner, HANDLE hContact, bool bFreeOnExit); + CSendImageShack(HWND Owner, HCONTACT hContact, bool bFreeOnExit); ~CSendImageShack(); void Send(); diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 3df0ba8f66..9ad59587ef 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -210,7 +210,7 @@ INT_PTR service_CaptureAndSendDesktop(WPARAM wParam, LPARAM lParam) { delete frmMain; return -1; } - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT) wParam; LPSTR pszProto = GetContactProto(hContact); bool bChatRoom = db_get_b(hContact, pszProto, "ChatRoom", 0) != 0; frmMain->m_opt_chkTimed = false; @@ -239,7 +239,7 @@ INT_PTR service_OpenCaptureDialog(WPARAM wParam, LPARAM lParam){ delete frmMain; return -1; } - frmMain->Init(pszPath,(HANDLE)wParam); + frmMain->Init(pszPath, (HCONTACT)wParam); mir_free(pszPath); if(lParam==0xFFFF){ frmMain->SetTargetWindow(NULL); @@ -276,7 +276,7 @@ INT_PTR service_EditBitmap(WPARAM wParam, LPARAM lParam) { // lParam = (HANDLE)contact (can be null) INT_PTR service_Send2ImageShack(WPARAM wParam, LPARAM lParam) { LPSTR result = NULL; - CSendImageShack* cSend = new CSendImageShack(NULL, (HANDLE)lParam, false); + CSendImageShack* cSend = new CSendImageShack(NULL, (HCONTACT)lParam, false); cSend->m_pszFile = mir_a2t((char*)wParam); cSend->m_bDeleteAfterSend = FALSE; if (lParam != NULL) { diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index d7d058df1c..4be9eabbaa 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -764,7 +764,7 @@ void TfrmMain::SaveOptions(void) { } //--------------------------------------------------------------------------- -void TfrmMain::Init(LPTSTR DestFolder, HANDLE Contact) { +void TfrmMain::Init(LPTSTR DestFolder, HCONTACT Contact) { m_FDestFolder = mir_tstrdup(DestFolder); m_hContact = Contact; if(!m_hContact) m_opt_cboxSendBy = SS_JUSTSAVE; @@ -775,7 +775,8 @@ void TfrmMain::Init(LPTSTR DestFolder, HANDLE Contact) { _HandleMapping.insert(CHandleMapping::value_type(m_hWnd, this)); //check Contact - if(m_cSend) m_cSend->SetContact(Contact); + if(m_cSend) + m_cSend->SetContact(Contact); } //--------------------------------------------------------------------------- diff --git a/plugins/SendScreenshotPlus/src/UMainForm.h b/plugins/SendScreenshotPlus/src/UMainForm.h index cf6c827c4e..7e5029aa15 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.h +++ b/plugins/SendScreenshotPlus/src/UMainForm.h @@ -69,7 +69,7 @@ class TfrmMain{ bool m_bOnExitSave; static void Unload(); - void Init(LPTSTR DestFolder, HANDLE Contact); + void Init(LPTSTR DestFolder, HCONTACT Contact); void Close(){SendMessage(m_hWnd,WM_CLOSE,0,0);} void Show(){ShowWindow(m_hWnd,SW_SHOW);} void Hide(){ShowWindow(m_hWnd,SW_HIDE);} @@ -79,7 +79,7 @@ class TfrmMain{ private: HWND m_hWnd; - HANDLE m_hContact; + HCONTACT m_hContact; bool m_bDeleteAfterSend; bool m_bFormAbout, m_bFormEdit; HWND m_hTargetWindow, m_hLastWin; diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp index b73d3d5fa7..e32f22d332 100644 --- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp +++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp @@ -691,7 +691,7 @@ LRESULT CALLBACK PopupProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) /** * This is the service function for external plugins to use the nice messagebox * - * @param wParam - HANDLE hContact which can display an avatar for popups + * @param wParam - HCONTACT hContact which can display an avatar for popups * @param lParam - MSGBOX structure holding parameters * * @return The function returns the ID of the clicked button (IDOK, IDCANCEL, ...) diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 2180386f89..475e00ad62 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -44,9 +44,9 @@ HWND g_hSDlg; BOOL DONT = FALSE; BOOL StartUp, isLastTRUE = FALSE, g_mode,bSC = FALSE; -HANDLE session_list[255] = {0}; -HANDLE user_session_list[255] = {0}; -HANDLE session_list_recovered[255]; +HCONTACT session_list[255] = { 0 }; +HCONTACT user_session_list[255] = { 0 }; +HCONTACT session_list_recovered[255]; int count = 0; unsigned int ses_count = 0; @@ -227,7 +227,7 @@ INT_PTR CALLBACK SaveSessionDlgProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lpar GetWindowText(GetDlgItem(hdlg, IDC_LIST), szUserSessionName, SIZEOF(szUserSessionName)); szUserSessionName[lenght+1]='\0'; if (IsDlgButtonChecked(hdlg,IDC_SELCONTACTS)&&bSC) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { BYTE res =(BYTE)SendMessage(hClistControl, CLM_GETCHECKMARK, SendMessage(hClistControl, CLM_FINDCONTACT, (WPARAM)hContact, 0), 0); if (res) { user_session_list[i] = hContact; @@ -443,13 +443,13 @@ INT_PTR CloseCurrentSession(WPARAM wparam,LPARAM lparam) while(session_list[0]!=0) { mwid.cbSize = sizeof(MessageWindowInputData); - mwid.hContact=session_list[i]; - mwid.uFlags=MSG_WINDOW_UFLAG_MSG_BOTH; + mwid.hContact = session_list[i]; + mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; mwd.cbSize = sizeof(MessageWindowData); mwd.hContact = mwid.hContact; - mwd.uFlags=MSG_WINDOW_UFLAG_MSG_BOTH; - CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&mwid,(LPARAM)&mwd); + mwd.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; + CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd); if (g_mode) { @@ -468,7 +468,7 @@ int SaveSessionHandles(WPARAM wparam,LPARAM lparam) return 1; int k=0; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if ((k=CheckForDuplicate(session_list,hContact)) != -1 && !(g_bExclHidden && !CheckContactVisibility(hContact))) { AddSessionMark(hContact,lparam,'1'); AddInSessionOrder(hContact,lparam,k,1); @@ -597,8 +597,8 @@ int LoadSession(WPARAM wparam,LPARAM lparam) { int dup=0; int hidden[255]={'0'}; - HANDLE hContact; - HANDLE session_list_t[255]={0}; + HCONTACT hContact; + HCONTACT session_list_t[255] = { 0 }; int mode=0; int i=0,j=0; if ((UINT)lparam>=ses_limit&&lparam!=256) @@ -672,7 +672,7 @@ int LoadSession(WPARAM wparam,LPARAM lparam) int DelUserDefSession(int ses_count) { int i=0; - HANDLE hContact; + HCONTACT hContact; char szSessionName[256]={0}; TCHAR *szSessionNameBuf=NULL; @@ -713,7 +713,7 @@ int DelUserDefSession(int ses_count) int DeleteAutoSession(int ses_count) { int i=0; - HANDLE hContact; + HCONTACT hContact; char szSessionName[256]={0}; TCHAR *szSessionNameBuf=NULL; @@ -963,7 +963,7 @@ extern "C" __declspec(dllexport) int Load(void) int i=0; ZeroMemory(session_list_recovered, sizeof(session_list_recovered)); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if (db_get_b(hContact, MODNAME, "wasInLastSession", 0)) session_list_recovered[i++] = hContact; } diff --git a/plugins/Sessions/Src/Options.cpp b/plugins/Sessions/Src/Options.cpp index caaae48365..64932b37e7 100644 --- a/plugins/Sessions/Src/Options.cpp +++ b/plugins/Sessions/Src/Options.cpp @@ -46,7 +46,7 @@ int OpLoadSessionContacts(WPARAM wparam,LPARAM lparam) { ZeroMemory(session_list_t, sizeof(session_list_t)); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (LoadContactsFromMask(hContact,1,lparam)) { int i = GetInSessionOrder(hContact,1, lparam); session_list_t[i] = hContact; @@ -277,7 +277,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) if (((LPNMHDR)lparam)->idFrom == IDC_EMCLIST) { int iSelection = (int)((NMCLISTCONTROL *)lparam)->hItem; - HANDLE hContact = db_find_first(); + HCONTACT hContact = db_find_first(); for ( ; hContact; hContact = db_find_next(hContact)) if (SendDlgItemMessage(hdlg, IDC_EMCLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0) == iSelection) break; @@ -319,11 +319,11 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) if (!hOpClistControl) EnableWindow(GetDlgItem(hdlg,IDC_DEL),TRUE); else { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) SendMessage(hOpClistControl, CLM_SETCHECKMARK, (WPARAM)hContact,0); for (int i=0 ; session_list_t[i] > 0; i++) { - HANDLE hContact = (HANDLE)SendMessage(hOpClistControl,CLM_FINDCONTACT, (WPARAM)session_list_t[i], 0); + HCONTACT hContact = (HCONTACT)SendMessage(hOpClistControl, CLM_FINDCONTACT, (WPARAM)session_list_t[i], 0); SendMessage(hOpClistControl, CLM_SETCHECKMARK, (WPARAM)hContact, 1); } EnableWindow(GetDlgItem(hdlg,IDC_SAVE),FALSE); @@ -366,7 +366,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) case IDC_SAVE: { int i=0; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { BYTE res =(BYTE)SendMessage(GetDlgItem(hdlg,IDC_EMCLIST), CLM_GETCHECKMARK, SendMessage(GetDlgItem(hdlg,IDC_EMCLIST), CLM_FINDCONTACT, (WPARAM)hContact, 0), 0); if (res) { diff --git a/plugins/Sessions/Src/Sessions.h b/plugins/Sessions/Src/Sessions.h index fd9c805235..727918e007 100644 --- a/plugins/Sessions/Src/Sessions.h +++ b/plugins/Sessions/Src/Sessions.h @@ -58,8 +58,8 @@ INT_PTR CloseCurrentSession(WPARAM ,LPARAM ); int SaveSessionDate(); extern HINSTANCE hinstance; -extern HANDLE session_list_recovered[255]; -extern HANDLE session_list[255]; +extern HCONTACT session_list_recovered[255]; +extern HCONTACT session_list[255]; extern unsigned int ses_limit; extern unsigned int g_ses_count; extern BOOL g_bExclHidden; diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index 480c8d3c0f..dd5315185a 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -19,7 +19,7 @@ along with this program. If not, see . #include "sessions.h" -void AddSessionMark(HANDLE hContact, int mode, char bit) +void AddSessionMark(HCONTACT hContact, int mode, char bit) { DBVARIANT dbv; unsigned int i; @@ -70,7 +70,7 @@ void AddSessionMark(HANDLE hContact, int mode, char bit) } } -void RemoveSessionMark(HANDLE hContact,int mode,int marknum) +void RemoveSessionMark(HCONTACT hContact,int mode,int marknum) { unsigned int i=1; char temp_1[1]={'\0'},temp_2[1]={'\0'}; @@ -100,7 +100,7 @@ void RemoveSessionMark(HANDLE hContact,int mode,int marknum) } } -void SetSessionMark(HANDLE hContact,int mode,char bit,unsigned int marknum) +void SetSessionMark(HCONTACT hContact,int mode,char bit,unsigned int marknum) { DBVARIANT dbv; char* pszBuffer=NULL; @@ -124,7 +124,7 @@ void SetSessionMark(HANDLE hContact,int mode,char bit,unsigned int marknum) } } -BOOL LoadContactsFromMask(HANDLE hContact,int mode,int count) +BOOL LoadContactsFromMask(HCONTACT hContact,int mode,int count) { DBVARIANT dbv; if (mode == 0) { @@ -142,7 +142,7 @@ BOOL LoadContactsFromMask(HANDLE hContact,int mode,int count) return res; } -void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode) +void AddInSessionOrder(HCONTACT hContact,int mode,int ordernum,int writemode) { int i; char temp_1[2]={'\0'},temp_2[2]={'\0'}; @@ -233,7 +233,7 @@ void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode) } } -int GetInSessionOrder(HANDLE hContact,int mode,int count) +int GetInSessionOrder(HCONTACT hContact,int mode,int count) { int iOrder = 0; char szTemp[3]={'\0'}; @@ -258,7 +258,7 @@ int GetInSessionOrder(HANDLE hContact,int mode,int count) return iOrder; } -void SetInSessionOrder(HANDLE hContact,int mode,int count,unsigned int ordernum) +void SetInSessionOrder(HCONTACT hContact,int mode,int count,unsigned int ordernum) { int iOrder=0; char szTemp[3]={'\0'}; @@ -319,10 +319,10 @@ BOOL ResaveSettings(char* szName,int iFirst,int iLimit,TCHAR* szBuffer) return 1; } -int AddToCurSession (HANDLE wparam,LPARAM lparam) +int AddToCurSession(HCONTACT wparam, LPARAM lparam) { - if (CheckForDuplicate(session_list,wparam) == -1) { - for (int i=0;;i++) { + if (CheckForDuplicate(session_list, wparam) == -1) { + for (int i = 0;; i++) { if (session_list[i] == 0) { session_list[i] = wparam; break; @@ -346,7 +346,7 @@ int DelFromCurSession(HANDLE wparam,LPARAM lparam) return 0; } -int CheckForDuplicate(HANDLE contact_list[], HANDLE lparam) +int CheckForDuplicate(HCONTACT contact_list[], HANDLE lparam) { int i=0; HANDLE s_list[255] = {0}; @@ -425,7 +425,7 @@ void OffsetWindow(HWND parent, HWND hwnd, int dx, int dy) SetWindowPos(hwnd, NULL, rc.left, rc.top,0, 0, SWP_NOZORDER |SWP_NOSIZE); } -int CheckContactVisibility(HANDLE hContact) +int CheckContactVisibility(HCONTACT hContact) { if (db_get_b(hContact, "CList", "Hidden", 0)) return 0; diff --git a/plugins/Sessions/Src/Utils.h b/plugins/Sessions/Src/Utils.h index 3e5aaaa002..174ef38afc 100644 --- a/plugins/Sessions/Src/Utils.h +++ b/plugins/Sessions/Src/Utils.h @@ -20,16 +20,16 @@ along with this program. If not, see . #ifndef __UTILS_H__ # define __UTILS_H__ -void SetInSessionOrder(HANDLE hContact,int mode,int count,unsigned int ordernum); -void AddInSessionOrder(HANDLE hContact,int mode,int ordernum,int writemode); -int GetInSessionOrder(HANDLE hContact,int mode,int count); -void AddSessionMark(HANDLE hContact,int mode,char bit); -void RemoveSessionMark(HANDLE hContact,int mode,int marknum); -void SetSessionMark(HANDLE hContact,int mode,char bit,unsigned int marknum); -BOOL LoadContactsFromMask(HANDLE hContact,int mode,int count); -int AddToCurSession (HANDLE wparam,LPARAM lparam); +void SetInSessionOrder(HCONTACT hContact,int mode,int count,unsigned int ordernum); +void AddInSessionOrder(HCONTACT hContact,int mode,int ordernum,int writemode); +int GetInSessionOrder(HCONTACT hContact,int mode,int count); +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(HANDLE contact_list[],HANDLE lparam); +int CheckForDuplicate(HCONTACT contact_list[], HANDLE 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); @@ -37,7 +37,7 @@ int MarkUserDefSession(int ses_count,BYTE bCheck); BYTE IsMarkedUserDefSession(int ses_count); void SavePosition(HWND hWnd, char *wndName); void LoadPosition(HWND hWnd, char *wndName); -int CheckContactVisibility(HANDLE hContact); +int CheckContactVisibility(HCONTACT hContact); void RenameUserDefSession(int ses_count,TCHAR* ptszNewName); int FillFavoritesMenu (HMENU hMenu,int iLimit); diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index 5457f5e307..6de7acdb6c 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -62,7 +62,8 @@ struct TAddArgList int cch; // it's length (with space for NULL char) int count; // number we have so far LPSTR *files; - HANDLE hContact, hEvent; + HCONTACT hContact; + HANDLE hEvent; }; BOOL AddToList(TAddArgList& args) @@ -178,7 +179,7 @@ void __cdecl IssueTransferThread(void *param) struct TSlotInfo { - HANDLE hContact; + HCONTACT hContact; int hProto; int dwStatus; // will be aligned anyway }; @@ -257,7 +258,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) TSlotInfo *pContacts = (TSlotInfo*)mir_alloc((dwContacts + 2) * sizeof(TSlotInfo)); int i = 0; int dwOnline = 0; - for (HANDLE hContact = db_find_first(); hContact != 0; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact != 0; hContact = db_find_next(hContact)) { if (i >= dwContacts) break; @@ -353,7 +354,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) // worker thread to clear MRU, called by the IPC bridge void __cdecl ClearMRUThread(void*) { - for (HANDLE hContact = db_find_first(); hContact != 0; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact != 0; hContact = db_find_next(hContact)) if ( db_get_b(hContact, SHLExt_Name, SHLExt_MRU, 0) > 0) db_set_b(hContact, SHLExt_Name, SHLExt_MRU, 0); } diff --git a/plugins/ShellExt/src/shlcom.h b/plugins/ShellExt/src/shlcom.h index c7d88349d0..4e78587f61 100644 --- a/plugins/ShellExt/src/shlcom.h +++ b/plugins/ShellExt/src/shlcom.h @@ -86,7 +86,7 @@ struct TSlotIPC BYTE cbSize; int fType; // a REQUEST_* type TSlotIPC *Next; - HANDLE hContact; + HCONTACT hContact; UINT hProto; // hash of the protocol the user is on UINT hGroup; // hash of the entire path (not defined for REQUEST_GROUPS slots) WORD Status; @@ -207,7 +207,7 @@ struct TMenuDrawInfo int cch; int wID; // should be the same as the menu item's ID TSlotDrawTypes fTypes; - HANDLE hContact; + HCONTACT hContact; HICON hStatusIcon; // HICON from Self->ProtoIcons[index].hIcons[status]; Do not DestroyIcon() HBITMAP hStatusBitmap; // HBITMAP, don't free. int pid; diff --git a/plugins/ShellExt/src/shlext.cpp b/plugins/ShellExt/src/shlext.cpp index 64f46e1855..7672226989 100644 --- a/plugins/ShellExt/src/shlext.cpp +++ b/plugins/ShellExt/src/shlext.cpp @@ -702,7 +702,7 @@ HRESULT TShellExt::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT _idCmdFirs ///////////////////////////////////////////////////////////////////////////////////////// -HRESULT ipcGetFiles(THeaderIPC *pipch, IDataObject* pDataObject, HANDLE hContact) +HRESULT ipcGetFiles(THeaderIPC *pipch, IDataObject* pDataObject, HCONTACT hContact) { FORMATETC fet; fet.cfFormat = CF_HDROP; diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index 1c995f5262..aad11984f5 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -72,7 +72,7 @@ INT_PTR ToggleEnable(WPARAM wParam, LPARAM lParam) INT_PTR Toggle(WPARAM w, LPARAM l) { - HANDLE hContact = (HANDLE)w; + HCONTACT hContact = (HCONTACT)w; BOOL on = !db_get_b(hContact, protocolname, "TurnedOn", 0); db_set_b(hContact, protocolname, "TurnedOn", on); on = !on; @@ -87,7 +87,7 @@ INT_PTR Toggle(WPARAM w, LPARAM l) INT OnPreBuildContactMenu(WPARAM w, LPARAM l) { - HANDLE hContact = (HANDLE)w; + HCONTACT hContact = (HCONTACT)w; CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR; @@ -183,7 +183,7 @@ TCHAR* StrReplace (TCHAR* Search, TCHAR* Replace, TCHAR* Resource) INT addEvent(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HANDLE hDBEvent = (HANDLE)lParam; BOOL fEnabled = db_get_b(NULL, protocolname, KEY_ENABLED, 1); diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index 991384b69a..f2888d2443 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -79,7 +79,7 @@ static TCHAR *StrNormNewline(TCHAR *tszStr) struct AwayMsgDlgData { - HANDLE hContact; + HCONTACT hContact; HANDLE hSeq; HANDLE hAwayMsgEvent; }; @@ -97,7 +97,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP dat = (AwayMsgDlgData*)mir_alloc(sizeof(AwayMsgDlgData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); - dat->hContact = (HANDLE)lParam; + dat->hContact = (HCONTACT)lParam; dat->hSeq = (HANDLE)CallContactService(dat->hContact, PSS_GETAWAYMSG, 0, 0); dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : NULL; WindowList_Add(hWindowList, hwndDlg, dat->hContact); @@ -126,7 +126,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadSkinnedProtoIcon(szProto, dwStatus)); EnableWindow(GetDlgItem(hwndDlg, IDC_COPY), FALSE); } - Utils_RestoreWindowPosition(hwndDlg, (HANDLE)lParam, "SRAway", "AwayMsgDlg"); + Utils_RestoreWindowPosition(hwndDlg, (HCONTACT)lParam, "SRAway", "AwayMsgDlg"); return TRUE; case HM_AWAYMSG: @@ -203,7 +203,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM) { - if (HWND hwnd = WindowList_Find(hWindowList, (HANDLE)wParam)) + if (HWND hwnd = WindowList_Find(hWindowList, (HCONTACT)wParam)) { SetForegroundWindow(hwnd); SetFocus(hwnd); @@ -227,7 +227,7 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP dat = (AwayMsgDlgData*)mir_alloc(sizeof(AwayMsgDlgData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); - dat->hContact = (HANDLE)lParam; + dat->hContact = (HCONTACT)lParam; dat->hSeq = (HANDLE)CallContactService(dat->hContact, PSS_GETAWAYMSG, 0, 0); dat->hAwayMsgEvent = dat->hSeq ? HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG) : NULL; WindowList_Add(hWindowList2, hwndDlg, dat->hContact); @@ -301,7 +301,7 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP static INT_PTR CopyAwayMsgCommand(WPARAM wParam, LPARAM) { - if (HWND hwnd = WindowList_Find(hWindowList2, (HANDLE)wParam)) + if (HWND hwnd = WindowList_Find(hWindowList2, (HCONTACT)wParam)) { SetForegroundWindow(hwnd); SetFocus(hwnd); @@ -330,7 +330,7 @@ static char *StrFindURL(char *pszStr) static INT_PTR GoToURLMsgCommand(WPARAM wParam, LPARAM lParam) { - ptrA szMsg(db_get_sa((HANDLE)wParam, "CList", "StatusMsg")); + ptrA szMsg(db_get_sa((HCONTACT)wParam, "CList", "StatusMsg")); char *szURL = StrFindURL(szMsg); if (szURL != NULL) @@ -354,8 +354,8 @@ static INT_PTR GoToURLMsgCommand(WPARAM wParam, LPARAM lParam) static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM lParam) { TCHAR str[128]; - char *szProto = GetContactProto((HANDLE)wParam); - int iHidden = szProto ? db_get_b((HANDLE)wParam, szProto, "ChatRoom", 0) : 0; + char *szProto = GetContactProto((HCONTACT)wParam); + int iHidden = szProto ? db_get_b((HCONTACT)wParam, szProto, "ChatRoom", 0) : 0; int iStatus; CLISTMENUITEM clmi = { sizeof(clmi) }; @@ -363,7 +363,7 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM lParam) clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR; if (!iHidden) { iHidden = 1; - iStatus = db_get_w((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE); + iStatus = db_get_w((HCONTACT)wParam, szProto, "Status", ID_STATUS_OFFLINE); if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1,0) & PF1_MODEMSGRECV) { if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3,0) & Proto_Status2Flag(iStatus == ID_STATUS_OFFLINE ? ID_STATUS_INVISIBLE : iStatus)) { iHidden = 0; @@ -377,7 +377,7 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM lParam) Menu_ModifyItem(hAwayMsgMenuItem, &clmi); Skin_ReleaseIcon(clmi.hIcon); - ptrA szMsg(db_get_sa((HANDLE)wParam, "CList", "StatusMsg")); + ptrA szMsg(db_get_sa((HCONTACT)wParam, "CList", "StatusMsg")); clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR; if (!iHidden && szMsg != NULL) { diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index fc120c6acb..8494ad66d6 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -384,7 +384,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) return msg; } -TCHAR *InsertVarsIntoMsg(TCHAR *tszMsg, const char *szProto, int iStatus, HANDLE hContact) +TCHAR *InsertVarsIntoMsg(TCHAR *tszMsg, const char *szProto, int iStatus, HCONTACT hContact) { if (ServiceExists(MS_VARS_FORMATSTRING) && db_get_b(NULL, "SimpleStatusMsg", "EnableVariables", 1)) { @@ -523,7 +523,7 @@ void SaveStatusAsCurrent(const char *szProto, int iStatus) db_set_w(NULL, "SimpleStatusMsg", szSetting, (WORD)iStatus); } -static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, HANDLE hContact) +static TCHAR *GetAwayMessage(int iStatus, const char *szProto, BOOL bInsertVars, HCONTACT hContact) { TCHAR *format = NULL; char szSetting[80]; @@ -1775,7 +1775,7 @@ static int OnICQStatusMsgRequest(WPARAM wParam, LPARAM lParam, LPARAM lMirParam) char *szProto = (char *)lMirParam; BOOL bContactFound = FALSE; - HANDLE hContact; + HCONTACT hContact; for (hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) { if (db_get_dw(hContact, szProto, "UIN", 0) == (DWORD)lParam) { diff --git a/plugins/SmileyAdd/src/customsmiley.cpp b/plugins/SmileyAdd/src/customsmiley.cpp index 053028aaaa..e9efd4ddee 100644 --- a/plugins/SmileyAdd/src/customsmiley.cpp +++ b/plugins/SmileyAdd/src/customsmiley.cpp @@ -21,7 +21,7 @@ along with this program. If not, see . SmileyPackCListType g_SmileyPackCStore; -bool SmileyPackCListType::AddSmileyPack(HANDLE hContact, TCHAR* dir) +bool SmileyPackCListType::AddSmileyPack(HCONTACT hContact, TCHAR* dir) { bool res = true; if (GetSmileyPack(hContact) == NULL) { @@ -38,7 +38,7 @@ bool SmileyPackCListType::AddSmileyPack(HANDLE hContact, TCHAR* dir) } -bool SmileyPackCListType::AddSmiley(HANDLE hContact, TCHAR* path) +bool SmileyPackCListType::AddSmiley(HCONTACT hContact, TCHAR* path) { SmileyPackCType *smpack = GetSmileyPack(hContact); if (smpack == NULL) { diff --git a/plugins/SmileyAdd/src/customsmiley.h b/plugins/SmileyAdd/src/customsmiley.h index c613b5dc75..fc8e0dff02 100644 --- a/plugins/SmileyAdd/src/customsmiley.h +++ b/plugins/SmileyAdd/src/customsmiley.h @@ -69,8 +69,8 @@ private: public: int NumberOfSmileyPacks(void) { return m_SmileyPacks.getCount(); } - bool AddSmileyPack(HANDLE hContact, TCHAR* dir); - bool AddSmiley(HANDLE hContact, TCHAR* path); + bool AddSmileyPack(HCONTACT hContact, TCHAR* dir); + bool AddSmiley(HCONTACT hContact, TCHAR* path); void ClearAndFreeAll(void) { m_SmileyPacks.destroy(); } diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index aed46dc9c6..d46eb2da72 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -24,7 +24,7 @@ along with this program. If not, see . // we are not supposed to use this object, so be aware typedef struct NewMessageWindowLParam { - HANDLE hContact; + HCONTACT hContact; int isSend; const char *szInitialText; } @@ -56,7 +56,7 @@ public: mutable HBITMAP hSmlBmp; mutable HICON hSmlIco; int idxLastChar; - HANDLE hContact; + HCONTACT hContact; bool doSmileyReplace; bool doSmileyButton; bool OldButtonPlace; @@ -290,7 +290,7 @@ static MsgWndData* IsMsgWnd(HWND hwnd) } -static void MsgWndDetect(HWND hwndDlg, HANDLE hContact, msgData* datm) +static void MsgWndDetect(HWND hwndDlg, HCONTACT hContact, msgData* datm) { MsgWndData dat; @@ -303,7 +303,7 @@ static void MsgWndDetect(HWND hwndDlg, HANDLE hContact, msgData* datm) else dat.hContact = hContact; // Get the protocol for this contact to display correct smileys. - char *protonam = GetContactProto( DecodeMetaContact(dat.hContact)); + char *protonam = GetContactProto(DecodeMetaContact(dat.hContact)); if (protonam) { strncpy(dat.ProtocolName, protonam, sizeof(dat.ProtocolName)); dat.ProtocolName[sizeof(dat.ProtocolName)-1] = 0; diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp index b10c77cdae..91050e25cd 100644 --- a/plugins/SmileyAdd/src/general.cpp +++ b/plugins/SmileyAdd/src/general.cpp @@ -211,11 +211,11 @@ void DestroyGdiPlus(void) } } -HANDLE DecodeMetaContact(HANDLE hContact) +HCONTACT DecodeMetaContact(HCONTACT hContact) { if (hContact == NULL) return NULL; - HANDLE hReal = (HANDLE) CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) hContact, 0); - if (hReal == NULL || hReal == (HANDLE)CALLSERVICE_NOTFOUND) + HCONTACT hReal = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + if (hReal == NULL || hReal == (HCONTACT)CALLSERVICE_NOTFOUND) hReal = hContact; return hReal; diff --git a/plugins/SmileyAdd/src/general.h b/plugins/SmileyAdd/src/general.h index 489bd06b3a..f9c255e3fc 100644 --- a/plugins/SmileyAdd/src/general.h +++ b/plugins/SmileyAdd/src/general.h @@ -164,7 +164,7 @@ bool IsOldSrmm(void); int CalculateTextHeight(HDC hdc, CHARFORMAT2* chf); const TCHAR* GetImageExt(CMString &fname); -HANDLE DecodeMetaContact(HANDLE hContact); +HCONTACT DecodeMetaContact(HCONTACT hContact); bool IsSmileyProto(char* proto); HICON ImageList_GetIconFixed (HIMAGELIST himl, INT i, UINT fStyle); @@ -180,7 +180,7 @@ HICON GetDefaultIcon(bool copy = true); void CloseRichCallback(HWND hwnd); void CloseRichOwnerCallback(HWND hwnd); -bool SetRichCallback(HWND hwnd, HANDLE hContact, bool subany, bool subnew); +bool SetRichCallback(HWND hwnd, HCONTACT hContact, bool subany, bool subnew); void SetRichOwnerCallback(HWND hwnd, HWND hwndInput, HWND hwndLog); void ProcessAllInputAreas(bool restoreText); void RichEditData_Destroy(void); diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 2da19f7c31..7fb45de5f0 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -633,7 +633,7 @@ void OptionsType::WriteCustomCategories(const CMString& cats) } -void OptionsType::ReadContactCategory(HANDLE hContact, CMString& cats) +void OptionsType::ReadContactCategory(HCONTACT hContact, CMString& cats) { DBVARIANT dbv; INT_PTR res = db_get_ts(hContact, "SmileyAdd", "CustomCategory", &dbv); @@ -644,7 +644,7 @@ void OptionsType::ReadContactCategory(HANDLE hContact, CMString& cats) } -void OptionsType::WriteContactCategory(HANDLE hContact, const CMString& cats) +void OptionsType::WriteContactCategory(HCONTACT hContact, const CMString& cats) { if (cats.IsEmpty()) db_unset(hContact, "SmileyAdd", "CustomCategory"); diff --git a/plugins/SmileyAdd/src/options.h b/plugins/SmileyAdd/src/options.h index 349fe2f9dd..ed953c5760 100644 --- a/plugins/SmileyAdd/src/options.h +++ b/plugins/SmileyAdd/src/options.h @@ -48,10 +48,10 @@ public: static void ReadPackFileName(CMString& filename, const CMString& name, const CMString& defaultFilename); static void ReadCustomCategories(CMString& cats); - static void ReadContactCategory(HANDLE hContact, CMString& cats); + static void ReadContactCategory(HCONTACT hContact, CMString& cats); static void WritePackFileName(const CMString& filename, const CMString& name); static void WriteCustomCategories(const CMString& cats); - static void WriteContactCategory(HANDLE hContact, const CMString& cats); + static void WriteContactCategory(HCONTACT hContact, const CMString& cats); }; extern OptionsType opt; diff --git a/plugins/SmileyAdd/src/richcall.cpp b/plugins/SmileyAdd/src/richcall.cpp index 8ddc79d4a3..73579c0be9 100644 --- a/plugins/SmileyAdd/src/richcall.cpp +++ b/plugins/SmileyAdd/src/richcall.cpp @@ -21,7 +21,7 @@ along with this program. If not, see . struct RichEditData { HWND hwnd; - HANDLE hContact; + HCONTACT hContact; HWND hToolTip; int tipActive; bool inputarea; @@ -312,7 +312,7 @@ static LRESULT CALLBACK RichEditSubclass(HWND hwnd, UINT uMsg, WPARAM wParam, LP return result; } -bool SetRichCallback(HWND hwnd, HANDLE hContact, bool subany, bool subnew) +bool SetRichCallback(HWND hwnd, HCONTACT hContact, bool subany, bool subnew) { RichEditData* rdt = g_RichEditList.find((RichEditData*)&hwnd); if (rdt == NULL) { diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index 00f27437c6..f7db0a0b94 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -23,7 +23,7 @@ LIST menuHandleArray(5); //implementation of service functions -SmileyPackType* GetSmileyPack(const char* proto, HANDLE hContact, SmileyPackCType** smlc) +SmileyPackType* GetSmileyPack(const char* proto, HCONTACT hContact, SmileyPackCType** smlc) { hContact = DecodeMetaContact(hContact); if (smlc) @@ -100,7 +100,7 @@ INT_PTR ShowSmileySelectionCommand(WPARAM, LPARAM lParam) if (smaddInfo == NULL || smaddInfo->cbSize < SMADD_SHOWSEL_SIZE_V1) return FALSE; HWND parent = smaddInfo->cbSize > SMADD_SHOWSEL_SIZE_V1 ? smaddInfo->hwndParent : NULL; - HANDLE hContact = smaddInfo->cbSize > SMADD_SHOWSEL_SIZE_V2 ? smaddInfo->hContact : NULL; + HCONTACT hContact = smaddInfo->cbSize > SMADD_SHOWSEL_SIZE_V2 ? smaddInfo->hContact : NULL; SmileyToolWindowParam *stwp = new SmileyToolWindowParam; stwp->pSmileyPack = GetSmileyPack(smaddInfo->Protocolname, hContact); @@ -155,7 +155,7 @@ INT_PTR GetSmileyIconCommand(WPARAM, LPARAM lParam) static int GetInfoCommandE(SMADD_INFO2* smre, bool retDup) { if (smre == NULL || smre->cbSize < SMADD_INFO_SIZE_V1) return FALSE; - HANDLE hContact = smre->cbSize > SMADD_INFO_SIZE_V1 ? smre->hContact : NULL; + HCONTACT hContact = smre->cbSize > SMADD_INFO_SIZE_V1 ? smre->hContact : NULL; SmileyPackType* SmileyPack = GetSmileyPack(smre->Protocolname, hContact); @@ -282,7 +282,7 @@ INT_PTR ParseTextBatch(WPARAM, LPARAM lParam) SMADD_BATCHPARSE2* smre = (SMADD_BATCHPARSE2*) lParam; if (smre == NULL || smre->cbSize < SMADD_BATCHPARSE_SIZE_V1) return FALSE; - HANDLE hContact = smre->cbSize > SMADD_BATCHPARSE_SIZE_V1 ? smre->hContact : NULL; + HCONTACT hContact = smre->cbSize > SMADD_BATCHPARSE_SIZE_V1 ? smre->hContact : NULL; SmileyPackCType* smcp = NULL; SmileyPackType* SmileyPack = GetSmileyPack(smre->Protocolname, hContact, @@ -356,7 +356,7 @@ INT_PTR RegisterPack(WPARAM, LPARAM lParam) INT_PTR CustomCatMenu(WPARAM wParam, LPARAM lParam) { - const HANDLE hContact = (HANDLE)wParam; + const HCONTACT hContact = (HCONTACT)wParam; if (lParam != 0) { SmileyCategoryType* smct = g_SmileyCategories.GetSmileyCategory((unsigned)lParam - 3); @@ -382,7 +382,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) { SmileyCategoryListType::SmileyCategoryVectorType& smc = *g_SmileyCategories.GetSmileyCategoryList(); - char* protnam = GetContactProto((HANDLE)wParam); + char* protnam = GetContactProto((HCONTACT)wParam); bool haveMenu = IsSmileyProto(protnam); if (haveMenu && opt.UseOneForAll) { unsigned cnt = 0; @@ -399,7 +399,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) if (haveMenu) { CMString cat; - opt.ReadContactCategory((HANDLE)wParam, cat); + opt.ReadContactCategory((HCONTACT)wParam, cat); CLISTMENUITEM mi = { sizeof(mi) }; mi.hParentMenu = hContactMenuItem; @@ -473,8 +473,7 @@ INT_PTR LoadContactSmileys(WPARAM, LPARAM lParam) SMADD_CONT* cont = (SMADD_CONT*)lParam; - switch (cont->type) - { + switch (cont->type) { case 0: g_SmileyPackCStore.AddSmileyPack(cont->hContact, cont->path); NotifyEventHooks(hEvent1, (WPARAM)cont->hContact, 0); @@ -541,7 +540,7 @@ int AccountListChanged(WPARAM wParam, LPARAM lParam) int DbSettingChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBCONTACTWRITESETTING* cws = (DBCONTACTWRITESETTING*)lParam; if (hContact == NULL) return 0; diff --git a/plugins/SmileyAdd/src/services.h b/plugins/SmileyAdd/src/services.h index 992f921479..21ee912e79 100644 --- a/plugins/SmileyAdd/src/services.h +++ b/plugins/SmileyAdd/src/services.h @@ -38,7 +38,7 @@ INT_PTR LoadContactSmileys(WPARAM, LPARAM lParam); int AccountListChanged(WPARAM wParam, LPARAM lParam); int DbSettingChanged(WPARAM wParam, LPARAM lParam); -SmileyPackType* GetSmileyPack(const char* proto, HANDLE hContact = NULL, SmileyPackCType** smlc = NULL); +SmileyPackType* GetSmileyPack(const char* proto, HCONTACT hContact = NULL, SmileyPackCType** smlc = NULL); #endif // SMILEYADD_SERVICES_H_ diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp index abcfe7b7aa..51e1fafb8d 100644 --- a/plugins/SmileyAdd/src/smileys.cpp +++ b/plugins/SmileyAdd/src/smileys.cpp @@ -152,7 +152,7 @@ SmileyType* SmileyPackType::GetSmiley(unsigned index) } -static DWORD_PTR ConvertServiceParam(HANDLE hContact, const TCHAR *param) +static DWORD_PTR ConvertServiceParam(HCONTACT hContact, const TCHAR *param) { DWORD_PTR ret; if (param == NULL) @@ -168,7 +168,7 @@ static DWORD_PTR ConvertServiceParam(HANDLE hContact, const TCHAR *param) } -void SmileyType::CallSmileyService(HANDLE hContact) +void SmileyType::CallSmileyService(HCONTACT hContact) { _TPattern * srvsplit = _TPattern::compile(_T("(.*)\\|(.*)\\|(.*)")); _TMatcher * m0 = srvsplit->createTMatcher(GetTriggerText()); @@ -856,7 +856,7 @@ void SmileyCategoryListType::DeleteAccountAsCategory(PROTOACCOUNT *acc) { CMString tname(A2T_SM(acc->szModuleName)); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char* proto = GetContactProto(hContact); if (proto == NULL) continue; @@ -878,7 +878,7 @@ void SmileyCategoryListType::DeleteAccountAsCategory(PROTOACCOUNT *acc) } } -void SmileyCategoryListType::AddContactTransportAsCategory(HANDLE hContact, const CMString& defaultFile) +void SmileyCategoryListType::AddContactTransportAsCategory(HCONTACT hContact, const CMString& defaultFile) { char* proto = GetContactProto(hContact); if (proto == NULL) return; @@ -944,7 +944,7 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void) for (int i = 0; i < protoCount; i++) AddAccountAsCategory(accList[i], defaultFile); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) AddContactTransportAsCategory(hContact, defaultFile); CMString cats; diff --git a/plugins/SmileyAdd/src/smileys.h b/plugins/SmileyAdd/src/smileys.h index b654b32ff3..4e7d95f6fa 100644 --- a/plugins/SmileyAdd/src/smileys.h +++ b/plugins/SmileyAdd/src/smileys.h @@ -76,7 +76,7 @@ public: HICON GetIconDup(void); HBITMAP GetBitmap(COLORREF bkgClr, int sizeX, int sizeY); - void CallSmileyService(HANDLE hContact); + void CallSmileyService(HCONTACT hContact); void SetHidden(bool hid) { SetFlagsBit(HiddenSmiley, hid); } void SetRegEx(bool regex) { SetFlagsBit(RegExSmiley, regex); } @@ -291,7 +291,7 @@ public: void AddAndLoad(const CMString& name, const CMString& displayName); void AddAllProtocolsAsCategory(void); void AddAccountAsCategory(PROTOACCOUNT *acc, const CMString& defaultFile); - void AddContactTransportAsCategory(HANDLE hContact, const CMString& defaultFile); + void AddContactTransportAsCategory(HCONTACT hContact, const CMString& defaultFile); void ClearAndLoadAll(void); void ClearAll(void) diff --git a/plugins/SmileyAdd/src/smltool.cpp b/plugins/SmileyAdd/src/smltool.cpp index 821a0bc3d9..821173887b 100644 --- a/plugins/SmileyAdd/src/smltool.cpp +++ b/plugins/SmileyAdd/src/smltool.cpp @@ -45,7 +45,7 @@ private: int m_Direction; UINT m_TargetMessage; WPARAM m_TargetWParam; - HANDLE m_hContact; + HCONTACT m_hContact; int rowSel; bool m_Choosing; @@ -171,10 +171,10 @@ LRESULT SmileyToolWindowType::DialogProcedure(UINT msg, WPARAM wParam, LPARAM lP struct smlsrvstruct { - smlsrvstruct(SmileyType *tsml, HANDLE thContact) + smlsrvstruct(SmileyType *tsml, HCONTACT thContact) : sml(tsml), hContact(thContact) {} SmileyType *sml; - HANDLE hContact; + HCONTACT hContact; }; void CALLBACK smileyServiceCallback(void* arg) diff --git a/plugins/SmileyAdd/src/smltool.h b/plugins/SmileyAdd/src/smltool.h index 89fb786862..ccdab2511e 100644 --- a/plugins/SmileyAdd/src/smltool.h +++ b/plugins/SmileyAdd/src/smltool.h @@ -32,7 +32,7 @@ struct SmileyToolWindowParam HWND hWndParent; UINT targetMessage; WPARAM targetWParam; - HANDLE hContact; + HCONTACT hContact; }; diff --git a/plugins/Spamotron/src/bayes.cpp b/plugins/Spamotron/src/bayes.cpp index 8a00005150..9df33ba9a1 100644 --- a/plugins/Spamotron/src/bayes.cpp +++ b/plugins/Spamotron/src/bayes.cpp @@ -221,7 +221,7 @@ double get_msg_score(TCHAR *msg) return tmp1 / (tmp1 + tmp2); } -void queue_message(HANDLE hContact, DWORD msgtime, TCHAR *message) +void queue_message(HCONTACT hContact, DWORD msgtime, TCHAR *message) { char *tmp; sqlite3_stmt *stmt; @@ -245,7 +245,7 @@ void queue_message(HANDLE hContact, DWORD msgtime, TCHAR *message) sqlite3_finalize(stmt); } -void bayes_approve_contact(HANDLE hContact) +void bayes_approve_contact(HCONTACT hContact) { const char *message; TCHAR *messageW; diff --git a/plugins/Spamotron/src/common.h b/plugins/Spamotron/src/common.h index e8d0903b13..2e9501c0ff 100644 --- a/plugins/Spamotron/src/common.h +++ b/plugins/Spamotron/src/common.h @@ -42,7 +42,7 @@ #define _getOptD(a,b) _getCOptD(NULL, a, b) #define _setOptD(a,b) _setCOptD(NULL, a, b) -TCHAR* _getCOptS(TCHAR *buf, unsigned int buflen, HANDLE hContact, const char* option, const TCHAR *def); +TCHAR* _getCOptS(TCHAR *buf, unsigned int buflen, HCONTACT hContact, const char* option, const TCHAR *def); #define _getOptS(a,b,c,d) _getCOptS(a, b, NULL, c, d) #define _setCOptTS(a,b,c) db_set_ts(a, PLUGIN_NAME, b, c) #define _setCOptS(a,b,c) db_set_s(a, PLUGIN_NAME, b, c) @@ -105,11 +105,11 @@ BOOL _isvalidregex(TCHAR* strSearch); BOOL _regmatch(TCHAR* str, TCHAR* strSearch); BOOL Contains(TCHAR* dst, TCHAR* src); BOOL isOneDay(DWORD timestamp1, DWORD timestamp2); -void MarkUnread(HANDLE hContact); +void MarkUnread(HCONTACT hContact); -int ShowPopup(HANDLE hContact, BYTE popupType, TCHAR *line1, TCHAR *line2); +int ShowPopup(HCONTACT hContact, BYTE popupType, TCHAR *line1, TCHAR *line2); int ShowPopupPreview(HWND optDlg, BYTE popupType, TCHAR *line1, TCHAR *line2); -int _notify(HANDLE hContact, BYTE type, TCHAR *message, TCHAR *origmessage); +int _notify(HCONTACT hContact, BYTE type, TCHAR *message, TCHAR *origmessage); int LogToSystemHistory(char *message, char *origmessage); #define POPUP_DEFAULT 0 #define POPUP_BLOCKED 1 @@ -151,8 +151,8 @@ void learn_spam(TCHAR *msg); int get_token_count(int type); int get_msg_count(int type); double get_msg_score(TCHAR *msg); -void queue_message(HANDLE hContact, DWORD msgtime, TCHAR *message); -void bayes_approve_contact(HANDLE hContact); +void queue_message(HCONTACT hContact, DWORD msgtime, TCHAR *message); +void bayes_approve_contact(HCONTACT hContact); void dequeue_messages(); #ifdef _DEBUG diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index a2e4e3e0b3..7a3cdf0672 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -2,7 +2,7 @@ TCHAR currentResponse[256] = {0}; -TCHAR* _getCOptS(TCHAR *buf, unsigned int buflen, HANDLE hContact, const char* option, const TCHAR *def) +TCHAR* _getCOptS(TCHAR *buf, unsigned int buflen, HCONTACT hContact, const char* option, const TCHAR *def) { DBVARIANT dbv = {0}; _tcsnset(buf, 0, buflen); diff --git a/plugins/Spamotron/src/popups.cpp b/plugins/Spamotron/src/popups.cpp index 585f36170c..ee11962bed 100644 --- a/plugins/Spamotron/src/popups.cpp +++ b/plugins/Spamotron/src/popups.cpp @@ -192,7 +192,7 @@ int ShowPopupPreview(HWND optDlg, BYTE popupType, TCHAR *line1, TCHAR *line2) } -int ShowPopup(HANDLE hContact, BYTE popupType, TCHAR *line1, TCHAR *line2) +int ShowPopup(HCONTACT hContact, BYTE popupType, TCHAR *line1, TCHAR *line2) { POPUPDATAT ppdp = {0}; switch (popupType) diff --git a/plugins/Spamotron/src/spamotron.cpp b/plugins/Spamotron/src/spamotron.cpp index 78b95f6e8e..0c79c8b958 100644 --- a/plugins/Spamotron/src/spamotron.cpp +++ b/plugins/Spamotron/src/spamotron.cpp @@ -50,7 +50,7 @@ int OnDBEventAdded(WPARAM wParam, LPARAM lParam) int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBEVENTINFO *dbei = (DBEVENTINFO *)lParam; char *msgblob; POPUPDATA ppdp = {0}; @@ -68,7 +68,7 @@ int OnDBEventFilterAdd(WPARAM wParam, LPARAM lParam) // get hContact from DBEVENTINFO as icq_proto.c doesn't pass hContact the usual way for some reason. if (dbei->eventType == EVENTTYPE_AUTHREQUEST) - hContact = *((PHANDLE)(dbei->pBlob+sizeof(DWORD))); + hContact = (HCONTACT)*(PDWORD(dbei->pBlob+sizeof(DWORD))); // get maximum length of the message a protocol supports maxmsglen = CallProtoService(dbei->szModule, PS_GETCAPS, PFLAG_MAXLENOFMESSAGE, (LPARAM)hContact); @@ -524,7 +524,7 @@ void RemoveNotOnListSettings() { DBVARIANT dbv; char protoName[256] = {0}; - HANDLE hContact = db_find_first(); + HCONTACT hContact = db_find_first(); strcpy(protoName, "proto_"); while (hContact != NULL) { if (db_get_s(hContact, "Protocol", "p", &dbv) == 0) { diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp index 5f930e47bd..4858ee2297 100644 --- a/plugins/Spamotron/src/utils.cpp +++ b/plugins/Spamotron/src/utils.cpp @@ -433,7 +433,7 @@ TCHAR* ReplaceVarsNum(TCHAR *dst, unsigned int len, int num) return dst; } -int _notify(HANDLE hContact, BYTE type, TCHAR *message, TCHAR *origmessage) +int _notify(HCONTACT hContact, BYTE type, TCHAR *message, TCHAR *origmessage) { char *tmp, *tmporig; TCHAR msg[MAX_BUFFER_LENGTH]; @@ -484,7 +484,7 @@ int LogToSystemHistory(char *message, char *origmessage) return 0; } -void MarkUnread(HANDLE hContact) +void MarkUnread(HCONTACT hContact) { // We're not actually marking anything. We just pushing saved events to the database from a temporary location DBVARIANT _dbv = {0}; diff --git a/plugins/SpellChecker/src/commons.h b/plugins/SpellChecker/src/commons.h index fa435a0a42..ac8ba21e2d 100644 --- a/plugins/SpellChecker/src/commons.h +++ b/plugins/SpellChecker/src/commons.h @@ -120,7 +120,7 @@ struct Dialog { HWND hwnd; HWND hwnd_owner; - HANDLE hContact; + HCONTACT hContact; char name[64]; Dictionary *lang; TCHAR lang_name[32]; @@ -150,7 +150,7 @@ int MsgWindowEvent(WPARAM wParam, LPARAM lParam); int MsgWindowPopup(WPARAM wParam, LPARAM lParam); int IconPressed(WPARAM wParam, LPARAM lParam); -int AddContactTextBox(HANDLE hContact, HWND hwnd, char *name, BOOL srmm, HWND hwndOwner); +int AddContactTextBox(HCONTACT hContact, HWND hwnd, char *name, BOOL srmm, HWND hwndOwner); int RemoveContactTextBox(HWND hwnd); int ShowPopupMenu(HWND hwnd, HMENU hMenu, POINT pt, HWND hwndOwner); diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 78027c7ca6..afa493cb39 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -715,7 +715,7 @@ int GetClosestLanguage(TCHAR *lang_name) return -1; } -void GetUserProtoLanguageSetting(Dialog *dlg, HANDLE hContact, char *group, char *setting, BOOL isProtocol = TRUE) +void GetUserProtoLanguageSetting(Dialog *dlg, HCONTACT hContact, char *group, char *setting, BOOL isProtocol = TRUE) { DBVARIANT dbv = {0}; dbv.type = DBVT_TCHAR; @@ -776,7 +776,7 @@ void GetUserLanguageSetting(Dialog *dlg, char *setting) if (metacontacts_proto != NULL) { mc = CallService(MS_MC_GETMETACONTACT, (WPARAM) dlg->hContact, 0); if (mc != CALLSERVICE_NOTFOUND) { - HANDLE hMetaContact = (HANDLE) mc; + HCONTACT hMetaContact = (HCONTACT)mc; if (hMetaContact != NULL) { GetUserProtoLanguageSetting(dlg, hMetaContact, metacontacts_proto, setting); if (dlg->lang_name[0] != _T('\0')) @@ -816,7 +816,7 @@ void GetContactLanguage(Dialog *dlg) if (dlg->lang_name[0] == _T('\0')) { INT_PTR mc = CallService(MS_MC_GETMETACONTACT, (WPARAM) dlg->hContact, 0); if (mc != CALLSERVICE_NOTFOUND) { - HANDLE hMetaContact = (HANDLE) mc; + HCONTACT hMetaContact = (HCONTACT)mc; if (hMetaContact != NULL) { if (!db_get_ts(hMetaContact, MODULE_NAME, "TalkLanguage", &dbv)) { lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name)); @@ -899,7 +899,7 @@ void NotifyWrongSRMM() notified = TRUE; } -int AddContactTextBox(HANDLE hContact, HWND hwnd, char *name, BOOL srmm, HWND hwndOwner) +int AddContactTextBox(HCONTACT hContact, HWND hwnd, char *name, BOOL srmm, HWND hwndOwner) { if (languages.getCount() <= 0) return 0; @@ -1406,7 +1406,7 @@ int IconPressed(WPARAM wParam, LPARAM lParam) if (sicd == NULL || strcmp(sicd->szModule, MODULE_NAME) != 0) return 0; - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; diff --git a/plugins/SplashScreen/src/debug.h b/plugins/SplashScreen/src/debug.h index cf3de0cbb3..7ccd1b0b42 100644 --- a/plugins/SplashScreen/src/debug.h +++ b/plugins/SplashScreen/src/debug.h @@ -11,7 +11,7 @@ extern TCHAR szLogFile[MAX_PATH]; * */ -int inline _DebugPopup(HANDLE hContact, TCHAR *fmt, ...) +int inline _DebugPopup(HCONTACT hContact, TCHAR *fmt, ...) { va_list va; TCHAR debug[1024]; diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp index 5ce8eb08e6..cce7cdb970 100644 --- a/plugins/StartupSilence/src/main.cpp +++ b/plugins/StartupSilence/src/main.cpp @@ -136,7 +136,7 @@ int DisablePopup(WPARAM wParam, LPARAM lParam) || ((DefPopup == 1 && DefEnabled == 1) && timer !=2) ) //also filtered only: We do not run next lines every time //if "Filtered only..." is unchecked ---> { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact != NULL) { char* cp = GetContactProto(hContact); diff --git a/plugins/StopSpamMod/src/init.cpp b/plugins/StopSpamMod/src/init.cpp index 14c842d1df..5afac93be1 100755 --- a/plugins/StopSpamMod/src/init.cpp +++ b/plugins/StopSpamMod/src/init.cpp @@ -76,7 +76,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) return &pluginInfoEx; } -extern tstring DBGetContactSettingStringPAN(HANDLE hContact, char const * szModule, char const * szSetting, tstring errorValue); +extern tstring DBGetContactSettingStringPAN(HCONTACT hContact, char const * szModule, char const * szSetting, tstring errorValue); void InitVars() { diff --git a/plugins/StopSpamMod/src/stopspam.cpp b/plugins/StopSpamMod/src/stopspam.cpp index cd8fd9b75e..b2b788c30d 100755 --- a/plugins/StopSpamMod/src/stopspam.cpp +++ b/plugins/StopSpamMod/src/stopspam.cpp @@ -26,7 +26,7 @@ MIRANDA_HOOK_EVENT(ME_DB_CONTACT_ADDED, w, l) MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HANDLE hDbEvent = (HANDLE)lParam; DBEVENTINFO dbei = { sizeof(dbei) }; @@ -44,7 +44,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) // event is an auth request if(gbHandleAuthReq) { if(!(dbei.flags & DBEF_SENT) && !(dbei.flags & DBEF_READ) && dbei.eventType == EVENTTYPE_AUTHREQUEST) { - HANDLE hcntct = DbGetAuthEventContact(&dbei); + HCONTACT hcntct = DbGetAuthEventContact(&dbei); // if request is from unknown or not marked Answered contact int a = db_get_b(hcntct, "CList", "NotOnList", 0); @@ -83,7 +83,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) { - HANDLE hContact = (HANDLE)w; + HCONTACT hContact = (HCONTACT)w; if(!l) //fix potential DEP crash return 0; DBEVENTINFO * dbei = (DBEVENTINFO*)l; @@ -345,7 +345,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) MIRANDA_HOOK_EVENT(ME_DB_CONTACT_SETTINGCHANGED, w, l) { - HANDLE hContact = (HANDLE)w; + HCONTACT hContact = (HCONTACT)w; DBCONTACTWRITESETTING * cws = (DBCONTACTWRITESETTING*)l; // if CList/NotOnList is being deleted then remove answeredSetting diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index 73ab682878..ac092f927d 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -18,7 +18,7 @@ #include "headers.h" -tstring DBGetContactSettingStringPAN(HANDLE hContact, char const * szModule, char const * szSetting, tstring errorValue) +tstring DBGetContactSettingStringPAN(HCONTACT hContact, char const * szModule, char const * szSetting, tstring errorValue) { DBVARIANT dbv; //if(db_get(hContact, szModule, szSetting, &dbv)) @@ -30,7 +30,7 @@ tstring DBGetContactSettingStringPAN(HANDLE hContact, char const * szModule, cha return errorValue; } -std::string DBGetContactSettingStringPAN_A(HANDLE hContact, char const * szModule, char const * szSetting, std::string errorValue) +std::string DBGetContactSettingStringPAN_A(HCONTACT hContact, char const * szModule, char const * szSetting, std::string errorValue) { DBVARIANT dbv; //if(db_get(hContact, szModule, szSetting, &dbv)) @@ -97,7 +97,7 @@ int RemoveTmp(WPARAM,LPARAM) return 0; } -tstring variables_parse(tstring const &tstrFormat, HANDLE hContact){ +tstring variables_parse(tstring const &tstrFormat, HCONTACT hContact){ if (gbVarsServiceExist) { FORMATINFO fi; TCHAR *tszParsed; @@ -201,7 +201,7 @@ BOOL IsUrlContains(TCHAR * Str) return 0; } -tstring GetContactUid(HANDLE hContact, tstring Protocol) +tstring GetContactUid(HCONTACT hContact, tstring Protocol) { tstring Uid; TCHAR dUid[32]={0}; @@ -235,7 +235,7 @@ tstring GetContactUid(HANDLE hContact, tstring Protocol) return Uid; } -void LogSpamToFile(HANDLE hContact, tstring message) +void LogSpamToFile(HCONTACT hContact, tstring message) { if (!gbLogToFile) return; @@ -293,15 +293,15 @@ void CleanProtocolTmpThread(std::string proto) boost::this_thread::sleep(boost::posix_time::seconds(2)); } - std::list contacts; - for(HANDLE hContact = db_find_first(proto.c_str()); hContact; hContact = db_find_next(hContact, proto.c_str())) + std::list contacts; + for(HCONTACT hContact = db_find_first(proto.c_str()); hContact; hContact = db_find_next(hContact, proto.c_str())) if(db_get_b(hContact, "CList", "NotOnList", 0)|| (_T("Not In List")== DBGetContactSettingStringPAN(hContact,"CList","Group",_T("")))) contacts.push_back(hContact); boost::this_thread::sleep(boost::posix_time::seconds(5)); clean_mutex.lock(); - std::list::iterator end = contacts.end(); - for(std::list::iterator i = contacts.begin(); i != end; ++i) + std::list::iterator end = contacts.end(); + for(std::list::iterator i = contacts.begin(); i != end; ++i) { LogSpamToFile(*i, _T("Deleted")); HistoryLogFunc(*i, "Deleted"); @@ -320,15 +320,15 @@ void CleanProtocolExclThread(std::string proto) boost::this_thread::sleep(boost::posix_time::seconds(2)); } - std::list contacts; - for(HANDLE hContact = db_find_first(proto.c_str()); hContact; hContact = db_find_next(hContact, proto.c_str())) + std::list contacts; + for(HCONTACT hContact = db_find_first(proto.c_str()); hContact; hContact = db_find_next(hContact, proto.c_str())) if(db_get_b(hContact, "CList", "NotOnList", 0) && db_get_b(hContact, pluginName, "Excluded", 0)) contacts.push_back(hContact); boost::this_thread::sleep(boost::posix_time::seconds(5)); clean_mutex.lock(); - std::list::iterator end = contacts.end(); - for(std::list::iterator i = contacts.begin(); i != end; ++i) + std::list::iterator end = contacts.end(); + for(std::list::iterator i = contacts.begin(); i != end; ++i) { LogSpamToFile(*i, _T("Deleted")); HistoryLogFunc(*i, "Deleted"); @@ -358,7 +358,7 @@ void CleanThread() } } -void HistoryLog(HANDLE hContact, char *data, int event_type, int flags) +void HistoryLog(HCONTACT hContact, char *data, int event_type, int flags) { DBEVENTINFO Event = { sizeof(Event) }; Event.szModule = pluginName; @@ -370,7 +370,7 @@ void HistoryLog(HANDLE hContact, char *data, int event_type, int flags) db_event_add(hContact, &Event); } -void HistoryLogFunc(HANDLE hContact, std::string message) +void HistoryLogFunc(HCONTACT hContact, std::string message) { if(gbHistoryLog) { diff --git a/plugins/StopSpamMod/src/utilities.h b/plugins/StopSpamMod/src/utilities.h index 62a3ef5750..287a7bc54e 100755 --- a/plugins/StopSpamMod/src/utilities.h +++ b/plugins/StopSpamMod/src/utilities.h @@ -1,19 +1,19 @@ -tstring DBGetContactSettingStringPAN(HANDLE hContact, char const * szModule, char const * szSetting, tstring errorValue); -std::string DBGetContactSettingStringPAN_A(HANDLE hContact, char const * szModule, char const * szSetting, std::string errorValue); +tstring DBGetContactSettingStringPAN(HCONTACT hContact, char const * szModule, char const * szSetting, tstring errorValue); +std::string DBGetContactSettingStringPAN_A(HCONTACT hContact, char const * szModule, char const * szSetting, std::string errorValue); tstring &GetDlgItemString(HWND hwnd, int id); std::string &GetProtoList(); bool ProtoInList(std::string proto); void RemoveExcludedUsers(); -tstring variables_parse(tstring const &tstrFormat, HANDLE hContact); +tstring variables_parse(tstring const &tstrFormat, HCONTACT hContact); const int Stricmp(const TCHAR *str, const TCHAR *substr); //const int Stristr(const TCHAR *str, const TCHAR *substr); TCHAR* ReqGetText(DBEVENTINFO* dbei); BOOL IsUrlContains(TCHAR * Str); void DeleteCListGroupsByName(TCHAR* szGroupName); -tstring GetContactUid(HANDLE hContact, std::string Protocol); -void LogSpamToFile(HANDLE hContact, tstring message); +tstring GetContactUid(HCONTACT hContact, std::string Protocol); +void LogSpamToFile(HCONTACT hContact, tstring message); std::string toUTF8(std::wstring str); std::string toUTF8(std::string str); std::wstring toUTF16(std::string str); -void HistoryLogFunc(HANDLE hContact, std::string message); +void HistoryLogFunc(HCONTACT hContact, std::string message); std::string get_random_num(int length); \ No newline at end of file diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index 3f9c7bb1d7..309fbdc612 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -20,7 +20,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) // event is an auth request if (!(dbei.flags & DBEF_SENT) && !(dbei.flags & DBEF_READ) && dbei.eventType == EVENTTYPE_AUTHREQUEST) { - HANDLE hcntct = DbGetAuthEventContact(&dbei); + HCONTACT hcntct = DbGetAuthEventContact(&dbei); // if request is from unknown or not marked Answered contact //and if I don't sent message to this contact @@ -48,7 +48,7 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) { - HANDLE hContact = (HANDLE)w; + HCONTACT hContact = (HCONTACT)w; DBEVENTINFO *dbei = (DBEVENTINFO*)l; if (dbei == NULL) //fix potential DEP crash return 0; @@ -188,7 +188,7 @@ MIRANDA_HOOK_EVENT(ME_OPT_INITIALISE, w, l) MIRANDA_HOOK_EVENT(ME_DB_CONTACT_SETTINGCHANGED, w, l) { - HANDLE hContact = (HANDLE)w; + HCONTACT hContact = (HCONTACT)w; DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)l; // if CList/NotOnList is being deleted then remove answeredSetting diff --git a/plugins/StopSpamPlus/src/headers.h b/plugins/StopSpamPlus/src/headers.h index 3084a6d007..08f8965dab 100644 --- a/plugins/StopSpamPlus/src/headers.h +++ b/plugins/StopSpamPlus/src/headers.h @@ -48,8 +48,8 @@ INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) void SetDlgItemString(HWND hwndDlg, UINT idItem, std::string const &str); void SetDlgItemString(HWND hwndDlg, UINT idItem, std::wstring const &str); tstring &GetDlgItemString(HWND hwnd, int id); -bool IsExistMyMessage(HANDLE hContact); -tstring variables_parse(tstring const &tstrFormat, HANDLE hContact); +bool IsExistMyMessage(HCONTACT hContact); +tstring variables_parse(tstring const &tstrFormat, HCONTACT hContact); tstring trim(tstring const &tstr, tstring const &trimChars = _T(" \f\n\r\t\v")); INT_PTR IsContactPassed(WPARAM wParam, LPARAM /*lParam*/); diff --git a/plugins/StopSpamPlus/src/services.cpp b/plugins/StopSpamPlus/src/services.cpp index 8b2914beac..032b70c94c 100644 --- a/plugins/StopSpamPlus/src/services.cpp +++ b/plugins/StopSpamPlus/src/services.cpp @@ -2,7 +2,7 @@ INT_PTR IsContactPassed(WPARAM wParam, LPARAM /*lParam*/) { - HANDLE hContact = ( HANDLE )wParam; + HCONTACT hContact = (HCONTACT)wParam; std::string proto = GetContactProto(hContact); if ( !plSets->ProtoDisabled( proto.c_str())) @@ -22,8 +22,8 @@ INT_PTR IsContactPassed(WPARAM wParam, LPARAM /*lParam*/) INT_PTR RemoveTempContacts(WPARAM wParam,LPARAM lParam) { - for (HANDLE hContact = db_find_first(); hContact; ) { - HANDLE hNext = db_find_next(hContact); + for (HCONTACT hContact = db_find_first(); hContact; ) { + HCONTACT hNext = db_find_next(hContact); ptrT szGroup( db_get_tsa( hContact, "CList", "Group")); if ( db_get_b(hContact, "CList", "NotOnList", 0) || db_get_b(hContact, "CList", "Hidden", 0 ) || (szGroup != NULL && (_tcsstr(szGroup, _T("Not In List")) || _tcsstr(szGroup, TranslateT("Not In List"))))) { diff --git a/plugins/StopSpamPlus/src/utils.cpp b/plugins/StopSpamPlus/src/utils.cpp index d6faed1bfc..17ef65e2bb 100644 --- a/plugins/StopSpamPlus/src/utils.cpp +++ b/plugins/StopSpamPlus/src/utils.cpp @@ -12,7 +12,7 @@ tstring &GetDlgItemString(HWND hwnd, int id) return s; } -bool IsExistMyMessage(HANDLE hContact) +bool IsExistMyMessage(HCONTACT hContact) { HANDLE hDbEvent = db_event_first(hContact); while(hDbEvent){ @@ -41,7 +41,7 @@ void SetDlgItemString(HWND hwndDlg, UINT idItem, std::wstring const &str) SetDlgItemTextW(hwndDlg, idItem, str.c_str()); } -tstring variables_parse(tstring const &tstrFormat, HANDLE hContact){ +tstring variables_parse(tstring const &tstrFormat, HCONTACT hContact){ if (ServiceExists(MS_VARS_FORMATSTRING)) { FORMATINFO fi; tstring tstrResult; diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp index ce68f6b70e..25c3e4188b 100644 --- a/plugins/TabSRMM/src/TSButton.cpp +++ b/plugins/TabSRMM/src/TSButton.cpp @@ -389,7 +389,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, break; case BUTTONSETCONTAINER: - bct->pContainer = (TContainerData *)wParam; + bct->pContainer = (TContainerData*)wParam; break; case BUTTONSETASTITLE: diff --git a/plugins/TabSRMM/src/buttonbar.h b/plugins/TabSRMM/src/buttonbar.h index c50b1dc76e..9e0fd7a16d 100644 --- a/plugins/TabSRMM/src/buttonbar.h +++ b/plugins/TabSRMM/src/buttonbar.h @@ -34,9 +34,9 @@ static INT_PTR CB_RemoveButton(WPARAM wParam, LPARAM lParam); static INT_PTR CB_AddButton(WPARAM wParam, LPARAM lParam); static INT_PTR CB_GetButtonState(WPARAM wParam, LPARAM lParam); static INT_PTR CB_SetButtonState(WPARAM wParam, LPARAM lParam); -static void CB_GetButtonSettings(HANDLE hContact,CustomButtonData *cbd); +static void CB_GetButtonSettings(HCONTACT hContact,CustomButtonData *cbd); -void CB_WriteButtonSettings(HANDLE hContact,CustomButtonData *cbd); +void CB_WriteButtonSettings(HCONTACT hContact,CustomButtonData *cbd); int sstSortButtons(const void * vmtbi1, const void * vmtbi2); void CB_DeInitCustomButtons(); diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 833b9e6a3b..1cba4cbbcd 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -101,7 +101,7 @@ static int DBRemoveEnumProc(const char *szSetting, LPARAM lParam) return 0; } -static int Hlp_RemoveDatabaseSettings(HANDLE hContact, char *szModule, char *szPrefix) +static int Hlp_RemoveDatabaseSettings(HCONTACT hContact, char *szModule, char *szPrefix) { RemoveSettings rs; int i, count; @@ -350,7 +350,7 @@ static INT_PTR CB_GetButtonState(WPARAM wParam, LPARAM lParam) if (!realbutton) return 1; - HWND hwndDlg = M.FindWindow((HANDLE)wParam); + HWND hwndDlg = M.FindWindow((HCONTACT)wParam); if(!hwndDlg) return 1; HWND hwndBtn = GetDlgItem(hwndDlg, tempCID); @@ -385,7 +385,7 @@ static INT_PTR CB_SetButtonState(WPARAM wParam, LPARAM lParam) if (!realbutton) return 1; - HWND hwndDlg = M.FindWindow((HANDLE)wParam); + HWND hwndDlg = M.FindWindow((HCONTACT)wParam); if(!hwndDlg) return 1; @@ -856,7 +856,7 @@ void TSAPI BB_CustomButtonClick(TWindowData *dat, DWORD idFrom, HWND hwndFrom, B } -void CB_GetButtonSettings(HANDLE hContact, CustomButtonData *cbd) +void CB_GetButtonSettings(HCONTACT hContact, CustomButtonData *cbd) { DBVARIANT dbv = {0}; char SettingName[1024] = {'\0'}; @@ -884,7 +884,7 @@ void CB_GetButtonSettings(HANDLE hContact, CustomButtonData *cbd) } } -void CB_WriteButtonSettings(HANDLE hContact, CustomButtonData *cbd) +void CB_WriteButtonSettings(HCONTACT hContact, CustomButtonData *cbd) { char SettingName[1024] = {'\0'}; char SettingParameter[1024] = {'\0'}; diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index f8a4769b54..9192f6960f 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -103,7 +103,7 @@ struct TMUCSettings : public GlobalLogSettingsBase struct FLASH_PARAMS { - HANDLE hContact; + HCONTACT hContact; const char* sound; int iEvent; HICON hNotifyIcon; @@ -173,7 +173,7 @@ void DestroyGCMenu(HMENU *hMenu, int iIndex); void Chat_SetFilters(SESSION_INFO *si); void TSAPI DoFlashAndSoundWorker(FLASH_PARAMS* p); BOOL DoPopup(SESSION_INFO *si, GCEVENT* gce); -int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...); +int ShowPopup(HCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...); BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce); // message.c diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 61beccc984..5f44fa352c 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -35,7 +35,7 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateTab, BOOL bPopupContainer, BOOL bWantPopup) { - HANDLE hContact = si->hContact; + HCONTACT hContact = si->hContact; if (M.FindWindow(hContact) != 0) return 0; diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index dc22d4b655..e082f985a0 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -102,7 +102,7 @@ BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce) return TRUE; } -int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...) +int ShowPopup(HCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...) { POPUPDATAT pd = { 0 }; va_list marker; diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index bc0d140318..63001f7931 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -37,7 +37,7 @@ static OBJLIST arContacts(50, HandleKeySortT); -CContactCache::CContactCache(const HANDLE hContact) +CContactCache::CContactCache(const HCONTACT hContact) { m_hContact = hContact; m_wOldStatus = m_wStatus = m_wMetaStatus = ID_STATUS_OFFLINE; @@ -156,7 +156,7 @@ bool CContactCache::updateStatus() void CContactCache::updateMeta(bool fForce) { if (m_Valid) { - HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)m_hContact, 0); + HCONTACT hSubContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)m_hContact, 0); if (hSubContact && (hSubContact != m_hSubContact || fForce)) { m_hSubContact = hSubContact; m_szMetaProto = GetContactProto(m_hSubContact); @@ -442,7 +442,7 @@ void CContactCache::deletedHandler() ::SendMessage(m_hwnd, WM_CLOSE, 1, 2); releaseAlloced(); - m_hContact = (HANDLE)-1; + m_hContact = (HCONTACT)-1; } /** @@ -512,7 +512,7 @@ void CContactCache::updateStatusMsg(const char *szKey) * @return CContactCache* pointer to the cache entry for this contact */ -CContactCache* CContactCache::getContactCache(HANDLE hContact) +CContactCache* CContactCache::getContactCache(HCONTACT hContact) { CContactCache *cc = arContacts.find((CContactCache*)&hContact); if (cc == NULL) { diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h index 09deffbd46..ec1f8e4bb0 100644 --- a/plugins/TabSRMM/src/contactcache.h +++ b/plugins/TabSRMM/src/contactcache.h @@ -65,46 +65,46 @@ struct TSessionStats { struct CContactCache : public MZeroedObject { CContactCache() {} - CContactCache(const HANDLE hContact); + CContactCache(const HCONTACT hContact); ~CContactCache() { releaseAlloced(); } - const bool isValid() const { return(m_Valid); } - const WORD getStatus() const { return(m_wStatus); } - const WORD getMetaStatus() const { return(m_wMetaStatus); } - const WORD getActiveStatus() const { return(m_isMeta ? m_wMetaStatus : m_wStatus); } - const WORD getOldStatus() const { return(m_wOldStatus); } - const TCHAR* getNick() const { return(m_szNick); } - const HANDLE getContact() const { return(m_hContact); } - const HANDLE getActiveContact() const { return(m_isMeta ? (m_hSubContact ? m_hSubContact : m_hContact) : m_hContact); } - const DWORD getIdleTS() const { return(m_idleTS); } - const char* getProto() const { return(m_szProto); } - const TCHAR* getProtoT() const { return(m_tszProto); } - const char* getMetaProto() const { return(m_szMetaProto ? m_szMetaProto : C_INVALID_PROTO); } - const TCHAR* getMetaProtoT() const { return(m_szMetaProto ? m_tszMetaProto : C_INVALID_PROTO_T); } - const char* getActiveProto() const { return(m_isMeta ? (m_szMetaProto ? m_szMetaProto : m_szProto) : m_szProto); } - const TCHAR* getActiveProtoT() const { return(m_isMeta ? (m_szMetaProto ? m_tszMetaProto : m_tszProto) : m_tszProto); } - bool isMeta() const { return(m_isMeta); } - bool isSubContact() const { return(m_isSubcontact); } - bool isFavorite() const { return(m_isFavorite); } - bool isRecent() const { return(m_isRecent); } - const TCHAR* getRealAccount() const { return(m_szAccount ? m_szAccount : C_INVALID_ACCOUNT); } - const TCHAR* getUIN() const { return(m_szUIN); } - const TCHAR* getStatusMsg() const { return(m_szStatusMsg); } - const TCHAR* getXStatusMsg() const { return(m_xStatusMsg); } - const TCHAR* getListeningInfo() const { return(m_ListeningInfo); } - BYTE getXStatusId() const { return(m_xStatus); } - const HWND getWindowData(TWindowData*& dat) const { dat = m_dat; return(m_hwnd); } - const HWND getHwnd() const { return(m_hwnd); } - int getMaxMessageLength(); + const bool isValid() const { return(m_Valid); } + const WORD getStatus() const { return(m_wStatus); } + const WORD getMetaStatus() const { return(m_wMetaStatus); } + const WORD getActiveStatus() const { return(m_isMeta ? m_wMetaStatus : m_wStatus); } + const WORD getOldStatus() const { return(m_wOldStatus); } + const TCHAR* getNick() const { return(m_szNick); } + const HCONTACT getContact() const { return(m_hContact); } + const HCONTACT getActiveContact() const { return(m_isMeta ? (m_hSubContact ? m_hSubContact : m_hContact) : m_hContact); } + const DWORD getIdleTS() const { return(m_idleTS); } + const char* getProto() const { return(m_szProto); } + const TCHAR* getProtoT() const { return(m_tszProto); } + const char* getMetaProto() const { return(m_szMetaProto ? m_szMetaProto : C_INVALID_PROTO); } + const TCHAR* getMetaProtoT() const { return(m_szMetaProto ? m_tszMetaProto : C_INVALID_PROTO_T); } + const char* getActiveProto() const { return(m_isMeta ? (m_szMetaProto ? m_szMetaProto : m_szProto) : m_szProto); } + const TCHAR* getActiveProtoT() const { return(m_isMeta ? (m_szMetaProto ? m_tszMetaProto : m_tszProto) : m_tszProto); } + bool isMeta() const { return(m_isMeta); } + bool isSubContact() const { return(m_isSubcontact); } + bool isFavorite() const { return(m_isFavorite); } + bool isRecent() const { return(m_isRecent); } + const TCHAR* getRealAccount() const { return(m_szAccount ? m_szAccount : C_INVALID_ACCOUNT); } + const TCHAR* getUIN() const { return(m_szUIN); } + const TCHAR* getStatusMsg() const { return(m_szStatusMsg); } + const TCHAR* getXStatusMsg() const { return(m_xStatusMsg); } + const TCHAR* getListeningInfo() const { return(m_ListeningInfo); } + BYTE getXStatusId() const { return(m_xStatus); } + const HWND getWindowData(TWindowData*& dat) const { dat = m_dat; return(m_hwnd); } + const HWND getHwnd() const { return(m_hwnd); } + int getMaxMessageLength(); - TWindowData* getDat() const { return(m_dat); } + TWindowData* getDat() const { return(m_dat); } - void updateStats(int iType, size_t value = 0); - const DWORD getSessionStart() const { return(m_stats->started); } - const int getSessionMsgCount() const { return((int)m_stats->messageCount) ; } + void updateStats(int iType, size_t value = 0); + const DWORD getSessionStart() const { return(m_stats->started); } + const int getSessionMsgCount() const { return((int)m_stats->messageCount); } //////////////////////////////////////////////////////////////////////////// @@ -128,7 +128,7 @@ struct CContactCache : public MZeroedObject void saveHistory(WPARAM wParam, LPARAM lParam); void inputHistoryEvent(WPARAM wParam); - static CContactCache* getContactCache(HANDLE hContact); + static CContactCache* getContactCache(HCONTACT hContact); static void cacheUpdateMetaChanged(); private: @@ -137,24 +137,24 @@ private: void allocHistory(); void releaseAlloced(); - HANDLE m_hContact; - HANDLE m_hSubContact; - WORD m_wStatus, m_wMetaStatus; - WORD m_wOldStatus; - char* m_szProto, *m_szMetaProto; - TCHAR* m_tszProto, m_tszMetaProto[40]; - TCHAR* m_szAccount; - TCHAR m_szNick[80], m_szUIN[80]; - TCHAR* m_szStatusMsg, *m_xStatusMsg, *m_ListeningInfo; - BYTE m_xStatus; - DWORD m_idleTS; - bool m_isMeta, m_isSubcontact; - bool m_Valid; - bool m_isFavorite; - bool m_isRecent; - HWND m_hwnd; - int m_nMax; - int m_iHistoryCurrent, m_iHistoryTop, m_iHistorySize; + HCONTACT m_hContact; + HCONTACT m_hSubContact; + WORD m_wStatus, m_wMetaStatus; + WORD m_wOldStatus; + char* m_szProto, *m_szMetaProto; + TCHAR* m_tszProto, m_tszMetaProto[40]; + TCHAR* m_szAccount; + TCHAR m_szNick[80], m_szUIN[80]; + TCHAR* m_szStatusMsg, *m_xStatusMsg, *m_ListeningInfo; + BYTE m_xStatus; + DWORD m_idleTS; + bool m_isMeta, m_isSubcontact; + bool m_Valid; + bool m_isFavorite; + bool m_isRecent; + HWND m_hwnd; + int m_nMax; + int m_iHistoryCurrent, m_iHistoryTop, m_iHistorySize; TWindowData *m_dat; TSessionStats *m_stats; diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 9c3e27b556..f7d48af5fe 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -39,7 +39,7 @@ TContainerData *pLastActiveContainer = NULL; static bool fForceOverlayIcons = false; -static int ServiceParamsOK(ButtonItem *item, WPARAM *wParam, LPARAM *lParam, HANDLE hContact) +static int ServiceParamsOK(ButtonItem *item, WPARAM *wParam, LPARAM *lParam, HCONTACT hContact) { if (item->dwFlags & BUTTON_PASSHCONTACTW || item->dwFlags & BUTTON_PASSHCONTACTL || item->dwFlags & BUTTON_ISCONTACTDBACTION) { if (hContact == 0) @@ -135,14 +135,14 @@ void TSAPI SetAeroMargins(TContainerData *pContainer) * pointer and for removing the struct from the linked list. */ -TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDLE hContactFrom) +TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HCONTACT hContactFrom) { if (CMimAPI::m_shutDown) return NULL; int iFirstFree = -1, iFound = FALSE; - TContainerData *pContainer = (TContainerData *)mir_calloc( sizeof(TContainerData)); + TContainerData *pContainer = (TContainerData*)mir_calloc(sizeof(TContainerData)); if (!pContainer) return NULL; @@ -198,7 +198,7 @@ TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDLE hCont static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - TContainerData *pContainer = (TContainerData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + TContainerData *pContainer = (TContainerData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); BOOL bSkinned = CSkin::m_skinEnabled ? TRUE : FALSE; switch (msg) { @@ -555,7 +555,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, int iItem = 0; TCITEM item; - TContainerData *pContainer = (TContainerData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + TContainerData *pContainer = (TContainerData*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); BOOL bSkinned = CSkin::m_skinEnabled ? TRUE : FALSE; HWND hwndTab = GetDlgItem(hwndDlg, IDC_MSGTABS); @@ -873,7 +873,7 @@ panel_found: } else if (((LPNMHDR)lParam)->code == NM_RCLICK) { POINT pt; - HANDLE hContact = 0; + HCONTACT hContact = 0; HMENU hMenu; GetCursorPos(&pt); @@ -1013,7 +1013,7 @@ panel_found: bool fProcessMainMenu = pContainer->MenuBar->isMainMenu(); pContainer->MenuBar->Cancel(); - HANDLE hContact; + HCONTACT hContact; TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA); DWORD dwOldFlags = pContainer->dwFlags; ButtonItem *pItem = pContainer->buttonItems; @@ -1175,7 +1175,7 @@ panel_found: case DM_UPDATETITLE: { - HANDLE hContact = 0; + HCONTACT hContact = 0; const TCHAR *szNewTitle = NULL; TWindowData *dat = NULL; @@ -1197,7 +1197,7 @@ panel_found: dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA); } else { - HWND hwnd = M.FindWindow((HANDLE)wParam); + HWND hwnd = M.FindWindow((HCONTACT)wParam); if (hwnd == 0) { SESSION_INFO *si = SM_FindSessionByHCONTACT((HANDLE)wParam); if (si) { @@ -1205,7 +1205,7 @@ panel_found: return 0; } } - hContact = (HANDLE)wParam; + hContact = (HCONTACT)wParam; if (hwnd && hContact) dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA); } @@ -1392,7 +1392,7 @@ panel_found: SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)trans, (pContainer->dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0)); } if (pContainer->dwFlags & CNT_NEED_UPDATETITLE) { - HANDLE hContact = 0; + HCONTACT hContact = 0; pContainer->dwFlags &= ~CNT_NEED_UPDATETITLE; if (pContainer->hwndActive) { SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact); @@ -1550,7 +1550,7 @@ panel_found: { DWORD ws, wsold, ex = 0, exold = 0; HMENU hSysmenu = GetSystemMenu(hwndDlg, FALSE); - HANDLE hContact = 0; + HCONTACT hContact = 0; int i=0; UINT sBarHeight; bool bAero = M.isAero(); @@ -1897,7 +1897,7 @@ panel_found: item.mask = TCIF_PARAM; TabCtrl_GetItem(hwndTab, TabCtrl_GetCurSel(hwndTab), &item); - HANDLE hContact; + HCONTACT hContact; SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact); db_set_b(hContact, SRMSGMOD_T, "splitmax", (BYTE)((wp.showCmd == SW_SHOWMAXIMIZED) ? 1 : 0)); @@ -1934,7 +1934,7 @@ panel_found: pContainer->dwFlags &= ~(CNT_DEFERREDCONFIGURE | CNT_CREATE_MINIMIZED | CNT_DEFERREDSIZEREQUEST | CNT_CREATE_CLONED); for (int i=0; i < TabCtrl_GetItemCount(hwndTab); i++) { if (TabCtrl_GetItem(hwndTab, i, &item)) { - HANDLE hContact; + HCONTACT hContact; SendMessage((HWND)item.lParam, DM_QUERYHCONTACT, 0, (LPARAM)&hContact); char szCName[40]; @@ -2215,7 +2215,7 @@ void TSAPI AdjustTabClientRect(TContainerData *pContainer, RECT *rc) * if none is assigned, return the name of the default container */ -int TSAPI GetContainerNameForContact(HANDLE hContact, TCHAR *szName, int iNameLen) +int TSAPI GetContainerNameForContact(HCONTACT hContact, TCHAR *szName, int iNameLen) { // single window mode using cloned (temporary) containers if (M.GetByte("singlewinmode", 0)) { @@ -2255,7 +2255,7 @@ void TSAPI DeleteContainer(int iIndex) db_set_ts(NULL, CONTAINER_KEY, szIndex, _T("**mir_free**")); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ptrT tszValue(db_get_tsa(hContact, SRMSGMOD_T, CONTAINER_SUBKEY)); if (!lstrcmp(tszValue, tszContainerName)) db_unset(hContact, SRMSGMOD_T, CONTAINER_SUBKEY); @@ -2289,7 +2289,7 @@ void TSAPI RenameContainer(int iIndex, const TCHAR *szNew) db_set_ts(NULL, CONTAINER_KEY, szIndex, szNew); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ptrT tszValue(db_get_tsa(hContact, SRMSGMOD_T, CONTAINER_SUBKEY)); if (!lstrcmp(tszValue, tszContainerName)) db_set_ts(hContact, SRMSGMOD_T, CONTAINER_SUBKEY, szNew); @@ -2347,7 +2347,7 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) int iNumProtos = (int)CallService(MS_MC_GETNUMCONTACTS, (WPARAM)dat->hContact, 0); int iDefaultProtoByNum = (int)CallService(MS_MC_GETDEFAULTCONTACTNUM, (WPARAM)dat->hContact, 0); - HANDLE hContactMostOnline = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->hContact, 0); + HCONTACT hContactMostOnline = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)dat->hContact, 0); char *szProtoMostOnline = GetContactProto(hContactMostOnline); int isForced = M.GetDword(dat->hContact, "tabSRMM_forced", -1); @@ -2364,8 +2364,8 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) mir_snprintf(szTemp, sizeof(szTemp), "Handle%d", i); TCHAR *nick = NULL, *szStatusText = NULL; - HANDLE hContact; - if ((hContact = (HANDLE)db_get_dw(dat->hContact, PluginConfig.szMetaName, szTemp, 0)) != 0) { + HCONTACT hContact; + if ((hContact = (HCONTACT)db_get_dw(dat->hContact, PluginConfig.szMetaName, szTemp, 0)) != 0) { nick = pcli->pfnGetContactDisplayName(hContact, 0); mir_snprintf(szTemp, sizeof(szTemp), "Status%d", i); WORD wStatus = (WORD)db_get_w(dat->hContact, PluginConfig.szMetaName, szTemp, 0); diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index 5e2a6a1fbd..c6dcd90baa 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -147,7 +147,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, { TContainerData *pContainer = 0; HWND hwndTree = GetDlgItem(hwndDlg, IDC_SECTIONTREE); - pContainer = (TContainerData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + pContainer = (TContainerData*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: { @@ -160,7 +160,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, const TSideBarLayout* sblayouts = CSideBar::getLayouts(nr_layouts); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) lParam); - pContainer = (TContainerData *) lParam; + pContainer = (TContainerData*) lParam; pContainer->hWndOptions = hwndDlg; TranslateDialogDefault(hwndDlg); SetWindowText(hwndDlg, TranslateT("Container options")); diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index df63872efa..ffbb3e24bb 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -398,7 +398,7 @@ void CMenuBar::invoke(const int id) TWindowData *dat = (TWindowData*)GetWindowLongPtr(m_pContainer->hwndActive, GWLP_USERDATA); - HANDLE hContact = dat ? dat->hContact : 0; + HCONTACT hContact = dat ? dat->hContact : 0; if (index == 3 && hContact != 0) { hMenu = reinterpret_cast(::CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)hContact, 0)); @@ -699,7 +699,7 @@ RECT rcLastStatusBarClick; // remembers click (down event) point for status LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - TContainerData *pContainer = (TContainerData *)GetWindowLongPtr(GetParent(hWnd), GWLP_USERDATA); + TContainerData *pContainer = (TContainerData*)GetWindowLongPtr(GetParent(hWnd), GWLP_USERDATA); if (OldStatusBarproc == 0) { WNDCLASSEX wc = {0}; diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index ed244ccd1a..740e3d5f7b 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -44,7 +44,7 @@ static LIST arPopupList(10, HandleKeySortT); BOOL bWmNotify = TRUE; -static PLUGIN_DATAT* PU_GetByContact(const HANDLE hContact) +static PLUGIN_DATAT* PU_GetByContact(const HCONTACT hContact) { return arPopupList.find((PLUGIN_DATAT*)&hContact); } @@ -559,7 +559,7 @@ static TCHAR* GetPreviewT(WORD eventType, DBEVENTINFO* dbe) } } -static int PopupUpdateT(HANDLE hContact, HANDLE hEvent) +static int PopupUpdateT(HCONTACT hContact, HANDLE hEvent) { PLUGIN_DATAT *pdata = const_cast(PU_GetByContact(hContact)); if (!pdata) @@ -630,7 +630,7 @@ static int PopupUpdateT(HANDLE hContact, HANDLE hEvent) return 0; } -static int PopupShowT(NEN_OPTIONS *pluginOptions, HANDLE hContact, HANDLE hEvent, UINT eventType, HWND hContainer) +static int PopupShowT(NEN_OPTIONS *pluginOptions, HCONTACT hContact, HANDLE hEvent, UINT eventType, HWND hContainer) { //there has to be a maximum number of popups shown at the same time if (arPopupList.getCount() >= MAX_POPUPS) @@ -759,7 +759,7 @@ void TSAPI UpdateTrayMenuState(TWindowData *dat, BOOL bForced) * if we want tray support, add the contact to the list of unread sessions in the tray menu */ -int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szProto, const TCHAR *szStatus, HANDLE hContact, DWORD fromEvent) +int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szProto, const TCHAR *szStatus, HCONTACT hContact, DWORD fromEvent) { if (!PluginConfig.g_hMenuTrayUnread || hContact == 0 || szProto == NULL) return 0; @@ -823,7 +823,7 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro return 0; } -int tabSRMM_ShowPopup(HANDLE hContact, HANDLE hDbEvent, WORD eventType, int windowOpen, TContainerData *pContainer, HWND hwndChild, const char *szProto, TWindowData *dat) +int tabSRMM_ShowPopup(HCONTACT hContact, HANDLE hDbEvent, WORD eventType, int windowOpen, TContainerData *pContainer, HWND hwndChild, const char *szProto, TWindowData *dat) { if (nen_options.iDisable) // no popups at all. Period return 0; @@ -883,7 +883,7 @@ passed: * remove all popups for hContact, but only if the mask matches the current "mode" */ -void TSAPI DeletePopupsForContact(HANDLE hContact, DWORD dwMask) +void TSAPI DeletePopupsForContact(HCONTACT hContact, DWORD dwMask) { if (!(dwMask & nen_options.dwRemoveMask) || nen_options.iDisable || !PluginConfig.g_PopupAvail) return; diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h index c090228b07..f111e98d0c 100644 --- a/plugins/TabSRMM/src/functions.h +++ b/plugins/TabSRMM/src/functions.h @@ -53,9 +53,9 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP int TSAPI NEN_ReadOptions(NEN_OPTIONS *options); int TSAPI NEN_WriteOptions(NEN_OPTIONS *options); -int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szProto, const TCHAR *szStatus, HANDLE hContact, DWORD fromEvent); +int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szProto, const TCHAR *szStatus, HCONTACT hContact, DWORD fromEvent); int TSAPI PopupPreview(NEN_OPTIONS *pluginOptions); -void TSAPI DeletePopupsForContact(HANDLE hContact, DWORD dwMask); +void TSAPI DeletePopupsForContact(HCONTACT hContact, DWORD dwMask); /* * tray stuff @@ -65,7 +65,7 @@ void TSAPI CreateSystrayIcon(int create); void TSAPI FlashTrayIcon(HICON hIcon); void TSAPI UpdateTrayMenuState(TWindowData *dat, BOOL bForced); void TSAPI LoadFavoritesAndRecent(); -void TSAPI AddContactToFavorites(HANDLE hContact, const TCHAR *szNickname, const char *szProto, TCHAR *szStatus, +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); @@ -74,15 +74,15 @@ void TSAPI HandleMenuEntryFromhContact(int iSelection); * gneric msgwindow functions(creation, container management etc.) */ -BOOL TSAPI IsUtfSendAvailable(HANDLE hContact); -HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, HANDLE hContact, int isSend, +BOOL TSAPI IsUtfSendAvailable(HCONTACT hContact); +HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, HCONTACT hContact, int isSend, const char *pszInitialText, BOOL bActivateTAb, BOOL bPopupContainer, BOOL bWantPopup, HANDLE hdbEvent); int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd); void TSAPI FlashContainer(TContainerData *pContainer, int iMode, int iNum); void TSAPI CreateImageList(BOOL bInitial); -TContainerData* TSAPI FindMatchingContainer(const TCHAR *szName, HANDLE hContact); -TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HANDLE hContactFrom); +TContainerData* TSAPI FindMatchingContainer(const TCHAR *szName, HCONTACT hContact); +TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, HCONTACT hContactFrom); TContainerData* TSAPI FindContainerByName(const TCHAR *name); int TSAPI GetTabIndexFromHWND(HWND hwndTab, HWND hwnd); @@ -100,7 +100,7 @@ TContainerData* TSAPI RemoveContainerFromList(TContainerData *pContainer); void TSAPI CloseAllContainers(); void TSAPI DeleteContainer(int iIndex); void TSAPI RenameContainer(int iIndex, const TCHAR *newName); -int TSAPI GetContainerNameForContact(HANDLE hContact, TCHAR *szName, int iNameLen); +int TSAPI GetContainerNameForContact(HCONTACT hContact, TCHAR *szName, int iNameLen); HMENU TSAPI BuildContainerMenu(); void TSAPI BuildCodePageList(); void TSAPI PreTranslateDates(); @@ -108,7 +108,7 @@ void TSAPI ApplyContainerSetting(TContainerData *pContainer, DWORD flags, UINT void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam, BYTE iType = 0); void TSAPI GetDefaultContainerTitleFormat(); void TSAPI SetAeroMargins(TContainerData *pContainer); -int TABSRMM_FireEvent(HANDLE hContact, HWND hwnd, unsigned int type, unsigned int subType); +int TABSRMM_FireEvent(HCONTACT hContact, HWND hwnd, unsigned int type, unsigned int subType); INT_PTR MessageWindowOpened(WPARAM wParam, LPARAM lParam); @@ -154,7 +154,7 @@ int TSAPI UnloadTSButtonModule(); * debugging support */ -int _DebugPopup(HANDLE hContact, const TCHAR *fmt, ...); +int _DebugPopup(HCONTACT hContact, const TCHAR *fmt, ...); int _DebugMessage(HWND hwndDlg, TWindowData *dat, const char *fmt, ...); // themes @@ -175,7 +175,7 @@ int TSAPI LoadLocalFlags(HWND hwnd, TWindowData *dat); int TN_ModuleInit(); int TN_OptionsInitialize(WPARAM wParam, LPARAM lParam); int TN_ModuleDeInit(); -void TN_TypingMessage(HANDLE hContact, int iMode); +void TN_TypingMessage(HCONTACT hContact, int iMode); // hotkeys diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index a1f7bbd9ae..98e87b970a 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -306,7 +306,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, case IDC_SMILEYBTN: if (dat->doSmileys && PluginConfig.g_SmileyAddAvail) { - HANDLE hContact = dat->cache->getActiveContact(); + HCONTACT hContact = dat->cache->getActiveContact(); if (CheckValidSmileyPack(dat->cache->getActiveProto(), hContact) != 0) { SMADD_SHOWSEL3 smaddInfo = {0}; @@ -875,7 +875,7 @@ void TSAPI DM_InitRichEdit(TWindowData *dat) void TSAPI DM_SetDBButtonStates(HWND hwndChild, TWindowData *dat) { ButtonItem *buttonItem = dat->pContainer->buttonItems; - HANDLE hContact = dat->hContact, hFinalContact = 0; + HCONTACT hContact = dat->hContact, hFinalContact = 0; char *szModule, *szSetting; HWND hwndContainer = dat->pContainer->hwnd; @@ -978,7 +978,7 @@ void TSAPI DM_ScrollToBottom(TWindowData *dat, WPARAM wParam, LPARAM lParam) static void LoadKLThread(LPVOID _param) { DBVARIANT dbv; - if (!db_get_ts(_param, SRMSGMOD_T, "locale", &dbv)) { + if (!db_get_ts((HCONTACT)_param, SRMSGMOD_T, "locale", &dbv)) { HKL hkl = LoadKeyboardLayout(dbv.ptszVal, 0); PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_SETLOCALE, (WPARAM)_param, (LPARAM)hkl); db_free(&dbv); @@ -1278,7 +1278,7 @@ void TSAPI DM_NotifyTyping(TWindowData *dat, int mode) DWORD protoCaps; DWORD typeCaps; const char *szProto = 0; - HANDLE hContact = 0; + HCONTACT hContact = 0; if (!dat || !dat->hContact) return; @@ -1626,7 +1626,7 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM wParam, LPARAM lParam) SendMessage(hwndDlg, DM_ADDDIVIDER, 0, 0); } } - tabSRMM_ShowPopup((HANDLE)wParam, hDbEvent, dbei.eventType, m_pContainer->fHidden ? 0 : 1, m_pContainer, hwndDlg, dat->cache->getActiveProto(), dat); + tabSRMM_ShowPopup((HCONTACT)wParam, hDbEvent, dbei.eventType, m_pContainer->fHidden ? 0 : 1, m_pContainer, hwndDlg, dat->cache->getActiveProto(), dat); if (IsWindowVisible(m_pContainer->hwnd)) m_pContainer->fHidden = false; } @@ -1896,7 +1896,7 @@ static HANDLE hHookIconPressedEvt; static int OnSrmmIconChanged(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) M.BroadcastMessage(DM_STATUSICONCHANGE, 0, 0); else { diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index c346c06a79..219036be27 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -402,11 +402,11 @@ int CGlobals::DBSettingChanged(WPARAM wParam, LPARAM lParam) CContactCache* c = 0; bool fChanged = false, fNickChanged = false, fExtendedStatusChange = false; - hwnd = M.FindWindow((HANDLE)wParam); + hwnd = M.FindWindow((HCONTACT)wParam); if (hwnd == 0 && wParam != 0) { // we are not interested in this event if there is no open message window/tab if (!strcmp(setting, "Status") || !strcmp(setting, "MyHandle") || !strcmp(setting, "Nick") || !strcmp(cws->szModule, SRMSGMOD_T)) { - c = CContactCache::getContactCache((HANDLE)wParam); + c = CContactCache::getContactCache((HCONTACT)wParam); if (c) { fChanged = c->updateStatus(); if (strcmp(setting, "Status")) @@ -424,7 +424,7 @@ int CGlobals::DBSettingChanged(WPARAM wParam, LPARAM lParam) } if (wParam) { - c = CContactCache::getContactCache((HANDLE)wParam); + c = CContactCache::getContactCache((HCONTACT)wParam); if (c) { szProto = c->getProto(); if (!strcmp(cws->szModule, SRMSGMOD_T)) { // catch own relevant settings @@ -500,7 +500,7 @@ int CGlobals::DBSettingChanged(WPARAM wParam, LPARAM lParam) int CGlobals::DBContactDeleted(WPARAM wParam, LPARAM lParam) { if (wParam) { - CContactCache *c = CContactCache::getContactCache((HANDLE)wParam); + CContactCache *c = CContactCache::getContactCache((HCONTACT)wParam); if (c) c->deletedHandler(); } @@ -515,7 +515,7 @@ int CGlobals::DBContactDeleted(WPARAM wParam, LPARAM lParam) int CGlobals::MetaContactEvent(WPARAM wParam, LPARAM lParam) { if (wParam) { - CContactCache *c = CContactCache::getContactCache((HANDLE)wParam); + CContactCache *c = CContactCache::getContactCache((HCONTACT)wParam); if (c) { c->updateMeta(true); if (c->getHwnd()) { @@ -532,7 +532,7 @@ int CGlobals::PreshutdownSendRecv(WPARAM wParam, LPARAM lParam) ::TN_ModuleDeInit(); ::CloseAllContainers(); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) db_set_dw(hContact, SRMSGMOD_T, "messagecount", 0); ::SI_DeinitStatusIcons(); @@ -582,7 +582,7 @@ void CGlobals::RestoreUnreadMessageAlerts(void) cle.pszService = "SRMsg/ReadMessage"; cle.flags = CLEF_TCHAR; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (db_get_dw(hContact, "SendLater", "count", 0)) sendLater->addContact(hContact); @@ -616,7 +616,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) if (dat == NULL || !c->isValid()) return; - HANDLE hContact = c->getContact(); + HCONTACT hContact = c->getContact(); if (!PluginConfig.m_LogStatusChanges && !M.GetByte(hContact, "logstatuschanges", 0)) return; diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index a92858d9e1..d1918004c7 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -95,7 +95,7 @@ static INT_PTR HotkeyProcessor(WPARAM wParam, LPARAM lParam) void TSAPI HandleMenuEntryFromhContact(int iSelection) { - HWND hWnd = M.FindWindow((HANDLE)iSelection); + HWND hWnd = M.FindWindow((HCONTACT)iSelection); if (iSelection == 0) return; @@ -205,7 +205,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE; } else if (dis->CtlType == ODT_MENU) { - HWND hWnd = M.FindWindow((HANDLE)dis->itemID); + HWND hWnd = M.FindWindow((HCONTACT)dis->itemID); DWORD idle = 0; if (hWnd == NULL) { @@ -390,7 +390,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case DM_DOCREATETAB: { - HWND hWnd = M.FindWindow((HANDLE)lParam); + HWND hWnd = M.FindWindow((HCONTACT)lParam); if (hWnd && IsWindow(hWnd)) { TContainerData *pContainer = 0; SendMessage(hWnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer); @@ -401,7 +401,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP else SendMessage(hWnd, WM_CLOSE, 0, 1); - CreateNewTabForContact((TContainerData *)wParam, (HANDLE)lParam, 0, NULL, TRUE, TRUE, FALSE, 0); + CreateNewTabForContact((TContainerData*)wParam, (HCONTACT)lParam, 0, NULL, TRUE, TRUE, FALSE, 0); } } } @@ -420,7 +420,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP else SendMessage(si->hWnd, WM_CLOSE, 0, 1); - si->hWnd = CreateNewRoom((TContainerData *)wParam, si, TRUE, 0, 0); + si->hWnd = CreateNewRoom((TContainerData*)wParam, si, TRUE, 0, 0); } } } @@ -443,13 +443,13 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP */ case DM_REMOVECLISTEVENT: CallService(MS_CLIST_REMOVEEVENT, wParam, lParam); - db_event_markRead((HANDLE)wParam, (HANDLE)lParam); + db_event_markRead((HCONTACT)wParam, (HANDLE)lParam); return 0; case DM_SETLOCALE: { - HKL hkl = (HKL)lParam; - HANDLE hContact = (HANDLE)wParam; + HKL hkl = (HKL)lParam; + HCONTACT hContact = (HCONTACT)wParam; HWND hWnd = M.FindWindow(hContact); if (hWnd) { diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 5b11efa34e..90a8c07f74 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -1364,7 +1364,7 @@ void CInfoPanel::dismissConfig(bool fForced) * @param panel CInfoPanel* the panel which owns it */ -CTip::CTip(const HWND hwndParent, const HANDLE hContact, const TCHAR *pszText, const CInfoPanel* panel) +CTip::CTip(const HWND hwndParent, const HCONTACT hContact, const TCHAR *pszText, const CInfoPanel* panel) { m_hwnd = ::CreateWindowEx(WS_EX_TOOLWINDOW, _T("RichEditTipClass"), _T(""), (M.isAero() ? WS_THICKFRAME : WS_BORDER) | WS_POPUPWINDOW | WS_TABSTOP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, 0, 40, 40, 0, 0, g_hInst, this); diff --git a/plugins/TabSRMM/src/infopanel.h b/plugins/TabSRMM/src/infopanel.h index cd5a25031f..0e2c962706 100644 --- a/plugins/TabSRMM/src/infopanel.h +++ b/plugins/TabSRMM/src/infopanel.h @@ -74,7 +74,7 @@ public: LEFT_BAR_WIDTH = 20 }; - CTip (const HWND hwndParent, const HANDLE hContact, const TCHAR *pszText = 0, const CInfoPanel *panel = 0); + CTip (const HWND hwndParent, const HCONTACT hContact, const TCHAR *pszText = 0, const CInfoPanel *panel = 0); ~CTip() { mir_free(m_pszText); @@ -89,16 +89,16 @@ private: static INT_PTR CALLBACK WndProcStub(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK RichEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - HWND m_hwnd; // our window handle - HWND m_hRich; // handle of the rich edit child - HWND m_hwndParent; // parent window (used for position calculations and to send notifications) - HANDLE m_hContact; // contact handle - char *m_pszText; // the richedit text - SIZE m_szRich; // size of the richedit control (height auto-calculated to make it fit the text) - RECT m_rcRich; // adjusted rectangle for the richedit control (client coordinates) - HICON m_hIcon; // optional icon to show in the title line - LPCTSTR m_szTitle; // optional text to show in the title - int m_leftWidth; + HWND m_hwnd; // our window handle + HWND m_hRich; // handle of the rich edit child + HWND m_hwndParent; // parent window (used for position calculations and to send notifications) + HCONTACT m_hContact; // contact handle + char *m_pszText; // the richedit text + SIZE m_szRich; // size of the richedit control (height auto-calculated to make it fit the text) + RECT m_rcRich; // adjusted rectangle for the richedit control (client coordinates) + HICON m_hIcon; // optional icon to show in the title line + LPCTSTR m_szTitle; // optional text to show in the title + int m_leftWidth; const CInfoPanel *m_panel; // the info panel parent (if any) }; diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index d385388432..69a97a7a5f 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -164,12 +164,12 @@ void CMimAPI::BroadcastMessageAsync(UINT msg, WPARAM wParam, LPARAM lParam) WindowList_BroadcastAsync(m_hMessageWindowList, msg, wParam, lParam); } -HWND CMimAPI::FindWindow(HANDLE h) const +HWND CMimAPI::FindWindow(HCONTACT h) const { return WindowList_Find(m_hMessageWindowList, h); } -INT_PTR CMimAPI::AddWindow(HWND hWnd, HANDLE h) +INT_PTR CMimAPI::AddWindow(HWND hWnd, HCONTACT h) { return WindowList_Add(m_hMessageWindowList, hWnd, h); } @@ -335,7 +335,7 @@ int CMimAPI::TypingMessage(WPARAM wParam, LPARAM lParam) int issplit = 1, foundWin = 0, preTyping = 0; BOOL fShowOnClist = TRUE; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact) { if ((hwnd = M.FindWindow(hContact)) && M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING)) preTyping = SendMessage(hwnd, DM_TYPING, 0, lParam); @@ -407,7 +407,7 @@ int CMimAPI::TypingMessage(WPARAM wParam, LPARAM lParam) } if (fShowOnClist) { CLISTEVENT cle = { sizeof(cle) }; - cle.hContact = (HANDLE)wParam; + cle.hContact = (HCONTACT)wParam; cle.hDbEvent = (HANDLE)1; cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR; cle.hIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]; @@ -468,7 +468,7 @@ int CMimAPI::ProtoAck(WPARAM wParam, LPARAM lParam) int CMimAPI::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return NULL; @@ -497,7 +497,7 @@ int CMimAPI::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) int CMimAPI::DispatchNewEvent(WPARAM wParam, LPARAM lParam) { if (wParam) { - HWND h = M.FindWindow((HANDLE)wParam); + HWND h = M.FindWindow((HCONTACT)wParam); if (h) PostMessage(h, HM_DBEVENTADDED, wParam, lParam); // was SENDMESSAGE !!! XXX } @@ -522,7 +522,7 @@ int CMimAPI::MessageEventAdded(WPARAM wParam, LPARAM lParam) DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get(hDbEvent, &dbei); - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HWND hwnd = M.FindWindow(hContact); BOOL isCustomEvent = IsCustomEvent(dbei.eventType); @@ -614,7 +614,7 @@ int CMimAPI::MessageEventAdded(WPARAM wParam, LPARAM lParam) else { char *szProto = GetContactProto(hContact); if (PluginConfig.g_MetaContactsAvail && szProto && !strcmp(szProto, (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0))) { - HANDLE hSubconttact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, wParam, 0); + HCONTACT hSubconttact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, wParam, 0); szProto = GetContactProto(hSubconttact); } if (szProto) { diff --git a/plugins/TabSRMM/src/mim.h b/plugins/TabSRMM/src/mim.h index e79f38077a..51f70830db 100644 --- a/plugins/TabSRMM/src/mim.h +++ b/plugins/TabSRMM/src/mim.h @@ -107,14 +107,14 @@ public: { return db_get_dw(0, szModule, szSetting, uDefault); } static DWORD __forceinline GetDword(const char *szSetting, DWORD uDefault) { return db_get_dw(0, SRMSGMOD_T, szSetting, uDefault); } - static DWORD __forceinline GetDword(const HANDLE hContact, const char *szSetting, DWORD uDefault) + static DWORD __forceinline GetDword(const HCONTACT hContact, const char *szSetting, DWORD uDefault) { return db_get_dw(hContact, SRMSGMOD_T, szSetting, uDefault); } static int __forceinline GetByte(const char *szSetting, int uDefault) { return db_get_b(0, SRMSGMOD_T, szSetting, uDefault); } static int __forceinline GetByte(const char *szModule, const char *szSetting, int uDefault) { return db_get_b(0, szModule, szSetting, uDefault); } - static int __forceinline GetByte(const HANDLE hContact, const char *szSetting, int uDefault) + static int __forceinline GetByte(const HCONTACT hContact, const char *szSetting, int uDefault) { return db_get_b(hContact, SRMSGMOD_T, szSetting, uDefault); } static bool __forceinline GetBool(const char *szModule, const char *szSetting, bool uDefault) @@ -182,9 +182,9 @@ public: void BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam); void BroadcastMessageAsync(UINT msg, WPARAM wParam, LPARAM lParam); - INT_PTR AddWindow(HWND hWnd, HANDLE h); + INT_PTR AddWindow(HWND hWnd, HCONTACT h); INT_PTR RemoveWindow(HWND hWnd); - HWND FindWindow(HANDLE h) const; + HWND FindWindow(HCONTACT h) const; static LPCTSTR StriStr(const TCHAR *szString, const TCHAR *szSearchFor); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 2d5d635a3a..7662b3703b 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -71,7 +71,7 @@ static void _clrMsgFilter(LPARAM lParam) m->wParam = 0; } -BOOL TSAPI IsUtfSendAvailable(HANDLE hContact) +BOOL TSAPI IsUtfSendAvailable(HCONTACT hContact) { char *szProto = GetContactProto(hContact); if (szProto == NULL) diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index d8bf4baa15..9a7f0217bc 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -711,7 +711,7 @@ int TSAPI GetAvatarVisibility(HWND hwndDlg, TWindowData *dat) * checks, if there is a valid smileypack installed for the given protocol */ -int TSAPI CheckValidSmileyPack(const char *szProto, HANDLE hContact) +int TSAPI CheckValidSmileyPack(const char *szProto, HCONTACT hContact) { SMADD_INFO2 smainfo = {0}; @@ -894,7 +894,7 @@ void TSAPI FlashOnClist(HWND hwndDlg, TWindowData *dat, HANDLE hEvent, DBEVENTIN if ((GetForegroundWindow() != dat->pContainer->hwnd || dat->pContainer->hwndActive != hwndDlg) && !(dbei->flags & DBEF_SENT) && dbei->eventType == EVENTTYPE_MESSAGE && !(dat->dwFlagsEx & MWF_SHOW_FLASHCLIST)) { ZeroMemory(&cle, sizeof(cle)); cle.cbSize = sizeof(cle); - cle.hContact = (HANDLE)dat->hContact; + cle.hContact = (HCONTACT)dat->hContact; cle.hDbEvent = hEvent; cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); cle.pszService = "SRMsg/ReadMessage"; @@ -1214,7 +1214,7 @@ void TSAPI GetMYUIN(TWindowData *dat) static int g_IEViewAvail = -1; static int g_HPPAvail = -1; -UINT TSAPI GetIEViewMode(HWND hwndDlg, HANDLE hContact) +UINT TSAPI GetIEViewMode(HWND hwndDlg, HCONTACT hContact) { int iWantIEView = 0, iWantHPP = 0; diff --git a/plugins/TabSRMM/src/msgdlgutils.h b/plugins/TabSRMM/src/msgdlgutils.h index 0b9aac3e20..6e85f994ab 100644 --- a/plugins/TabSRMM/src/msgdlgutils.h +++ b/plugins/TabSRMM/src/msgdlgutils.h @@ -40,7 +40,7 @@ int TSAPI MsgWindowUpdateMenu (TWindowData *dat, HMENU submenu, int menuID); int TSAPI MsgWindowMenuHandler (TWindowData *dat, int selection, int menuId); int TSAPI GetAvatarVisibility (HWND hwndDlg, TWindowData *dat); void TSAPI UpdateStatusBar (const TWindowData *dat); -int TSAPI CheckValidSmileyPack (const char *szProto, HANDLE hContact); +int TSAPI CheckValidSmileyPack (const char *szProto, HCONTACT hContact); TCHAR* TSAPI QuoteText (const TCHAR *text, int charsPerLine, int removeExistingQuotes); void TSAPI UpdateReadChars (const TWindowData *dat); void TSAPI ShowPicture (TWindowData *dat, BOOL showNewPic); @@ -52,7 +52,7 @@ BOOL TSAPI DoRtfToTags (TCHAR * pszText, const TWindowData *dat); void TSAPI GetMYUIN (TWindowData *dat); void TSAPI SetMessageLog (TWindowData *dat); void TSAPI SwitchMessageLog (TWindowData *dat, int iMode); -UINT TSAPI GetIEViewMode (HWND hwndDlg, HANDLE hContact); +UINT TSAPI GetIEViewMode (HWND hwndDlg, HCONTACT hContact); void TSAPI FindFirstEvent (TWindowData *dat); void TSAPI SaveSplitter (TWindowData *dat); void TSAPI LoadSplitter (TWindowData *dat); diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 910c7a16a0..d031bf322f 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -93,7 +93,7 @@ static HICON Logicons[NR_LOGICONS]; #define STREAMSTAGE_STOP 3 struct LogStreamData { int stage; - HANDLE hContact; + HCONTACT hContact; HANDLE hDbEvent, hDbEventLast; char *buffer; int bufferOffset, bufferLen; @@ -556,7 +556,7 @@ int DbEventIsForMsgWindow(DBEVENTINFO *dbei) return et && ( et->flags & DETF_MSGWINDOW ); } -static char *Template_CreateRTFFromDbEvent(TWindowData *dat, HANDLE hContact, HANDLE hDbEvent, int prefixParaBreak, LogStreamData *streamData) +static char *Template_CreateRTFFromDbEvent(TWindowData *dat, HCONTACT hContact, HANDLE hDbEvent, int prefixParaBreak, LogStreamData *streamData) { char *buffer, c; TCHAR ci, cc; diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index b136c44603..2d54a4702a 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -847,7 +847,7 @@ static void RebuildList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) if (hItemUnknown && M.GetByte(SRMSGMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItemUnknown, 1); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem && db_get_b(hContact, SRMSGMOD, SRMSGSET_TYPING, defType)) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 1); @@ -862,7 +862,7 @@ static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) if (hItemUnknown) db_set_b(0, SRMSGMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItemUnknown, 0) ? 1 : 0)); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) db_set_b(hContact, SRMSGMOD, SRMSGSET_TYPING, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0) ? 1 : 0)); diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index d7c069a011..9185fea23e 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -133,7 +133,7 @@ static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) { TContainerData *pContainer; - HWND hwnd = M.FindWindow((HANDLE)wParam); + HWND hwnd = M.FindWindow((HCONTACT)wParam); if (hwnd != NULL) { TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (dat == NULL || (pContainer = dat->pContainer) == NULL) @@ -166,7 +166,7 @@ static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) static INT_PTR SetUserPrefs(WPARAM wParam, LPARAM) { - HWND hWnd = WindowList_Find(PluginConfig.hUserPrefsWindowList, (HANDLE)wParam); + HWND hWnd = WindowList_Find(PluginConfig.hUserPrefsWindowList, (HCONTACT)wParam); if (hWnd) { SetForegroundWindow(hWnd); // already open, bring it to front return 0; @@ -197,7 +197,7 @@ static INT_PTR GetMessageWindowFlags(WPARAM wParam, LPARAM lParam) HWND hwndTarget = (HWND)lParam; if (hwndTarget == 0) - hwndTarget = M.FindWindow((HANDLE)wParam); + hwndTarget = M.FindWindow((HCONTACT)wParam); if (hwndTarget == 0) return 0; @@ -234,7 +234,7 @@ INT_PTR MessageWindowOpened(WPARAM wParam, LPARAM lParam) TContainerData *pContainer = NULL; if (wParam) - hwnd = M.FindWindow((HANDLE)wParam); + hwnd = M.FindWindow((HCONTACT)wParam); else if (lParam) hwnd = (HWND) lParam; else @@ -271,7 +271,7 @@ INT_PTR MessageWindowOpened(WPARAM wParam, LPARAM lParam) static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) { - HANDLE hContact = ((CLISTEVENT *) lParam)->hContact; + HCONTACT hContact = ((CLISTEVENT *) lParam)->hContact; HWND hwndExisting = M.FindWindow(hContact); if (hwndExisting != 0) @@ -296,7 +296,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) INT_PTR SendMessageCommand_W(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; TNewWindowData newData = { 0 }; int isSplit = 1; @@ -355,7 +355,7 @@ INT_PTR SendMessageCommand_W(WPARAM wParam, LPARAM lParam) INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; TNewWindowData newData = { 0 }; int isSplit = 1; @@ -391,7 +391,7 @@ INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam) SendMessage(hwnd, DM_ACTIVATEME, 0, 0); // ask the message window about its parent... } else { TCHAR szName[CONTAINER_NAMELEN + 1]; - GetContainerNameForContact((HANDLE)wParam, szName, CONTAINER_NAMELEN); + GetContainerNameForContact((HCONTACT)wParam, szName, CONTAINER_NAMELEN); TContainerData *pContainer = FindContainerByName(szName); if (pContainer == NULL) pContainer = CreateContainer(szName, FALSE, hContact); @@ -465,7 +465,7 @@ int MyAvatarChanged(WPARAM wParam, LPARAM lParam) int AvatarChanged(WPARAM wParam, LPARAM lParam) { avatarCacheEntry *ace = (avatarCacheEntry *)lParam; - HWND hwnd = M.FindWindow((HANDLE)wParam); + HWND hwnd = M.FindWindow((HCONTACT)wParam); if (wParam == 0) { // protocol picture has changed... M.BroadcastMessage(DM_PROTOAVATARCHANGED, wParam, lParam); @@ -660,7 +660,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild) * bPopupContainer: restore container if it was minimized, otherwise flash it... */ -HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, HANDLE hContact, int isSend, const char *pszInitialText, BOOL bActivateTab, BOOL bPopupContainer, BOOL bWantPopup, HANDLE hdbEvent) +HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, HCONTACT hContact, int isSend, const char *pszInitialText, BOOL bActivateTab, BOOL bPopupContainer, BOOL bWantPopup, HANDLE hdbEvent) { TCHAR newcontactname[128], tabtitle[128]; int newItem; @@ -832,7 +832,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, HANDLE hContact, i * a new (cloned) one. */ -TContainerData* TSAPI FindMatchingContainer(const TCHAR *szName, HANDLE hContact) +TContainerData* TSAPI FindMatchingContainer(const TCHAR *szName, HCONTACT hContact) { int iMaxTabs = M.GetDword("maxtabs", 0); if (iMaxTabs > 0 && M.GetByte("limittabs", 0) && !_tcsncmp(szName, _T("default"), 6)) { @@ -880,7 +880,7 @@ void TSAPI CreateImageList(BOOL bInitial) PluginConfig.g_IconTypingEvent = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]; } -int TABSRMM_FireEvent(HANDLE hContact, HWND hwnd, unsigned int type, unsigned int subType) +int TABSRMM_FireEvent(HCONTACT hContact, HWND hwnd, unsigned int type, unsigned int subType) { if (hContact == NULL || hwnd == NULL || !M.GetByte("_eventapi", 1)) return 0; diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index b6a3ace22d..0412e44e76 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -194,7 +194,7 @@ struct TContainerData LONG uChildMinHeight; int tBorder; int tBorder_outer_left, tBorder_outer_right, tBorder_outer_top, tBorder_outer_bottom; - HANDLE hContactFrom; + HCONTACT hContactFrom; BOOL isCloned; HWND hwndStatus; int statusBarHeight; @@ -237,100 +237,100 @@ struct SESSION_INFO; struct TWindowData { - UINT cbSize; - BYTE bType; + UINT cbSize; + BYTE bType; TContainerData *pContainer; // parent container description structure - HWND hwnd; - DWORD dwFlags; - DWORD dwFlagsEx; - HANDLE hContact; - char *szProto; - TCHAR szMyNickname[130]; - TCHAR szStatusBar[100]; - TCHAR szStatusBarCustom[100]; - TCHAR newtitle[130]; // tab title... - TCHAR szStatus[50]; - WORD wStatus; - char *sendBuffer; - int iSendBufferSize; - int iSendLength; // message length in utf-8 octets - HICON hTabIcon, hTabStatusIcon, hXStatusIcon, hClientIcon, hTaskbarIcon; - HICON iFlashIcon; - BOOL mayFlashTab; - BOOL bTabFlash; - HWND hwndIEView, hwndFlash, hwndIWebBrowserControl, hwndHPP; - HWND hwndContactPic, hwndPanelPic, hwndPanelPicParent; - UINT bbLSideWidth; //MAD - UINT bbRSideWidth; //MAD - BYTE kstate[256]; + HWND hwnd; + DWORD dwFlags; + DWORD dwFlagsEx; + HCONTACT hContact; + char *szProto; + TCHAR szMyNickname[130]; + TCHAR szStatusBar[100]; + TCHAR szStatusBarCustom[100]; + TCHAR newtitle[130]; // tab title... + TCHAR szStatus[50]; + WORD wStatus; + char *sendBuffer; + int iSendBufferSize; + int iSendLength; // message length in utf-8 octets + HICON hTabIcon, hTabStatusIcon, hXStatusIcon, hClientIcon, hTaskbarIcon; + HICON iFlashIcon; + BOOL mayFlashTab; + BOOL bTabFlash; + HWND hwndIEView, hwndFlash, hwndIWebBrowserControl, hwndHPP; + HWND hwndContactPic, hwndPanelPic, hwndPanelPicParent; + UINT bbLSideWidth; //MAD + UINT bbRSideWidth; //MAD + BYTE kstate[256]; SESSION_INFO *si; - RECT rcNick, rcUIN, rcStatus, rcPic; - HANDLE hDbEventFirst, hDbEventLast; - int sendMode; - int splitterY, originalSplitterY, dynaSplitter, savedSplitter, savedSplitY, savedDynaSplit; - int multiSplitterX; - SIZE minEditBoxSize; - int showUIElements; - int nTypeSecs; - int nTypeMode; - DWORD nLastTyping; - int showTyping; - DWORD lastMessage; - int iTabID; - HKL hkl; // keyboard layout identifier - DWORD dwTickLastEvent, dwUnread; - HBITMAP hOwnPic; - SIZE pic; - int showPic, showInfoPic; - BOOL fMustOffset; - BOOL isHistory; - int doSmileys; - UINT codePage; - HICON hSmileyIcon; - int iLastEventType; - time_t lastEventTime; - int iRealAvatarHeight; - int iButtonBarReallyNeeds; - DWORD dwLastActivity; - int iOpenJobs; - int iCurrentQueueError; - BOOL bIsMeta; - HANDLE hFlashingEvent; - TCHAR myUin[80]; - BOOL bNotOnList; - int SendFormat; - HANDLE *hQueuedEvents; - int iNextQueuedEvent; + RECT rcNick, rcUIN, rcStatus, rcPic; + HANDLE hDbEventFirst, hDbEventLast; + int sendMode; + int splitterY, originalSplitterY, dynaSplitter, savedSplitter, savedSplitY, savedDynaSplit; + int multiSplitterX; + SIZE minEditBoxSize; + int showUIElements; + int nTypeSecs; + int nTypeMode; + DWORD nLastTyping; + int showTyping; + DWORD lastMessage; + int iTabID; + HKL hkl; // keyboard layout identifier + DWORD dwTickLastEvent, dwUnread; + HBITMAP hOwnPic; + SIZE pic; + int showPic, showInfoPic; + BOOL fMustOffset; + BOOL isHistory; + int doSmileys; + UINT codePage; + HICON hSmileyIcon; + int iLastEventType; + time_t lastEventTime; + int iRealAvatarHeight; + int iButtonBarReallyNeeds; + DWORD dwLastActivity; + int iOpenJobs; + int iCurrentQueueError; + BOOL bIsMeta; + HANDLE hFlashingEvent; + TCHAR myUin[80]; + BOOL bNotOnList; + int SendFormat; + HANDLE *hQueuedEvents; + int iNextQueuedEvent; #define EVENT_QUEUE_SIZE 10 - int iEventQueueSize; - LCID lcid; - TCHAR lcID[10]; - int panelWidth; - DWORD idle; - HWND hwndTip; + int iEventQueueSize; + LCID lcid; + TCHAR lcID[10]; + int panelWidth; + DWORD idle; + HWND hwndTip; TOOLINFO ti; - HANDLE hTimeZone; - DWORD panelStatusCX; + HANDLE hTimeZone; + DWORD panelStatusCX; COLORREF inputbg; avatarCacheEntry *ace, *ownAce; - HANDLE *hHistoryEvents; - int maxHistory, curHistory; - HANDLE hTheme, hThemeIP, hThemeToolbar; - char szMicroLf[128]; - DWORD isAutoRTL; - int nMax; // max message size - int textLen; // current text len - LONG ipFieldHeight; - BOOL clr_added; - BOOL fIsReattach; - WPARAM wParam; // used for "delayed" actions like moved splitters in minimized windows - LPARAM lParam; - int iHaveRTLLang; - BOOL fInsertMode; - bool fkeyProcessed; - bool fEditNotesActive; + HANDLE *hHistoryEvents; + int maxHistory, curHistory; + HANDLE hTheme, hThemeIP, hThemeToolbar; + char szMicroLf[128]; + DWORD isAutoRTL; + int nMax; // max message size + int textLen; // current text len + LONG ipFieldHeight; + BOOL clr_added; + BOOL fIsReattach; + WPARAM wParam; // used for "delayed" actions like moved splitters in minimized windows + LPARAM lParam; + int iHaveRTLLang; + BOOL fInsertMode; + bool fkeyProcessed; + bool fEditNotesActive; CInfoPanel *Panel; CContactCache *cache; @@ -417,17 +417,18 @@ struct TIconDescW struct TNewWindowData { - HANDLE hContact; - int isWchar; - const char* szInitialText; - int iTabID; - int iTabImage; - int iActivate; - TCITEM item; - TContainerData* pContainer; - BOOL bWantPopup; - HANDLE hdbEvent; - HKL hkl; + HCONTACT hContact; + int isWchar; + LPCSTR szInitialText; + int iTabID; + int iTabImage; + int iActivate; + TCITEM item; + BOOL bWantPopup; + HANDLE hdbEvent; + HKL hkl; + + TContainerData *pContainer; }; // flags for the container dwFlags @@ -894,7 +895,7 @@ struct TABSRMM_SessionInfo { typedef struct { int cbSize; - HANDLE hContact; + HCONTACT hContact; int uFlags; // should be same as input data unless 0, then it will be the actual type HWND hwndWindow; //top level window for the contact or NULL if no window exists int uState; // see window states diff --git a/plugins/TabSRMM/src/nen.h b/plugins/TabSRMM/src/nen.h index cb7c400a53..812369f357 100644 --- a/plugins/TabSRMM/src/nen.h +++ b/plugins/TabSRMM/src/nen.h @@ -43,7 +43,7 @@ #define MODULE "tabSRMM_NEN" -int tabSRMM_ShowPopup(HANDLE hContact, HANDLE hDbEvent, WORD eventType, int windowOpen, TContainerData *pContainer, HWND hwndChild, const char *szProto, TWindowData *dat); +int tabSRMM_ShowPopup(HCONTACT hContact, HANDLE hDbEvent, WORD eventType, int windowOpen, TContainerData *pContainer, HWND hwndChild, const char *szProto, TWindowData *dat); #define DEFAULT_COLBACK RGB(255,255,128) #define DEFAULT_COLTEXT RGB(0,0,0) diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 8b6e673db2..81631416d7 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -269,7 +269,7 @@ int _cdecl CSendLater::addStub(const char *szSetting, LPARAM lParam) * addJob() will deal with possible duplicates * @param hContact HANDLE: contact's handle */ -void CSendLater::processSingleContact(const HANDLE hContact) +void CSendLater::processSingleContact(const HCONTACT hContact) { int iCount = db_get_dw(hContact, "SendLater", "count", 0); @@ -291,7 +291,7 @@ void CSendLater::processContacts() { if (m_fAvail && m_sendLaterContactList.getCount() != 0) { for (int i=0; i < m_sendLaterContactList.getCount(); i++) - processSingleContact(m_sendLaterContactList[i]); + processSingleContact((HCONTACT)m_sendLaterContactList[i]); m_sendLaterContactList.destroy(); } @@ -310,9 +310,9 @@ void CSendLater::processContacts() */ int CSendLater::addJob(const char *szSetting, LPARAM lParam) { - HANDLE hContact = (HANDLE)lParam; - DBVARIANT dbv = {0}; - char *szOrig_Utf = 0; + HCONTACT hContact = (HCONTACT)lParam; + DBVARIANT dbv = {0}; + char *szOrig_Utf = 0; if (!m_fAvail || !szSetting || !strcmp(szSetting, "count") || lstrlenA(szSetting) < 8) return 0; @@ -395,13 +395,12 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam) */ int CSendLater::sendIt(CSendLaterJob *job) { - HANDLE hContact = job->hContact; - time_t now = time(0); - DWORD dwFlags = 0; - DBVARIANT dbv = {0}; + HCONTACT hContact = job->hContact; + time_t now = time(0); + DWORD dwFlags = 0; + DBVARIANT dbv = {0}; const char *szProto = 0; - if (job->bCode == CSendLaterJob::JOB_HOLD || job->bCode == CSendLaterJob::JOB_DEFERRED || job->fSuccess || job->fFailed || job->lastSent > now) return 0; // this one is frozen or done (will be removed soon), don't process it now. @@ -486,7 +485,7 @@ int CSendLater::sendIt(CSendLaterJob *job) * and new jobs are created. */ -void CSendLater::addContact(const HANDLE hContact) +void CSendLater::addContact(const HCONTACT hContact) { if (!m_fAvail) return; @@ -559,7 +558,7 @@ void CSendLater::qMgrUpdate(bool fReEnable) } } -LRESULT CSendLater::qMgrAddFilter(const HANDLE hContact, const TCHAR* tszNick) +LRESULT CSendLater::qMgrAddFilter(const HCONTACT hContact, const TCHAR* tszNick) { LRESULT lr; diff --git a/plugins/TabSRMM/src/sendlater.h b/plugins/TabSRMM/src/sendlater.h index 3ac3d1b302..9c49b3fc00 100644 --- a/plugins/TabSRMM/src/sendlater.h +++ b/plugins/TabSRMM/src/sendlater.h @@ -68,18 +68,19 @@ public: bool mustDelete(); CSendLaterJob(); ~CSendLaterJob(); - char szId[20]; // database key name (time stamp of original send) - HANDLE hContact; // original contact where the message has been assigned - HANDLE hTargetContact; // *real* contact (can be different for metacontacts, e.g). - HANDLE hProcess; // returned from the protocols sending service. needed to find it in the ACK handler - time_t created; // job was created at this time (important to kill jobs, that are too old) - time_t lastSent; // time at which the delivery was initiated. used to handle timeouts - char *sendBuffer; // utf-8 send buffer - PBYTE pBuf; // conventional send buffer (for non-utf8 protocols) - DWORD dwFlags; - int iSendCount; // # of times we tried to send it... - bool fSuccess, fFailed; - BYTE bCode; // error/progress code (for the UI) + + char szId[20]; // database key name (time stamp of original send) + HCONTACT hContact; // original contact where the message has been assigned + HCONTACT hTargetContact; // *real* contact (can be different for metacontacts, e.g). + HANDLE hProcess; // returned from the protocols sending service. needed to find it in the ACK handler + time_t created; // job was created at this time (important to kill jobs, that are too old) + time_t lastSent; // time at which the delivery was initiated. used to handle timeouts + char *sendBuffer; // utf-8 send buffer + PBYTE pBuf; // conventional send buffer (for non-utf8 protocols) + DWORD dwFlags; + int iSendCount; // # of times we tried to send it... + bool fSuccess, fFailed; + BYTE bCode; // error/progress code (for the UI) }; class CSendLater { @@ -109,7 +110,7 @@ public: bool processCurrentJob(); void processContacts(); int addJob(const char *szSetting, LPARAM lParam); - void addContact(const HANDLE hContact); + void addContact(const HCONTACT hContact); HANDLE processAck(const ACKDATA *ack); void invokeQueueMgrDlg(); @@ -117,7 +118,7 @@ public: static INT_PTR svcQMgr(WPARAM wParam, LPARAM lParam); private: - void processSingleContact(const HANDLE hContact); + void processSingleContact(const HCONTACT hContact); int sendIt(CSendLaterJob *job); INT_PTR CALLBACK DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); @@ -126,7 +127,7 @@ private: void qMgrFillList(bool fClear = true); void qMgrSetupColumns(); void qMgrSaveColumns(); - LRESULT qMgrAddFilter(const HANDLE hContact, const TCHAR* tszNick); + LRESULT qMgrAddFilter(const HCONTACT hContact, const TCHAR* tszNick); LIST m_sendLaterContactList; LIST m_sendLaterJobList; diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index a3a0764f30..30b9d6a183 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -127,7 +127,7 @@ entry_found: #define SPLIT_WORD_CUTOFF 20 -static int SendChunkW(WCHAR *chunk, HANDLE hContact, DWORD dwFlags) +static int SendChunkW(WCHAR *chunk, HCONTACT hContact, DWORD dwFlags) { int wLen = lstrlenW(chunk); DWORD memRequired = (wLen + 1) * sizeof(WCHAR); @@ -142,7 +142,7 @@ static int SendChunkW(WCHAR *chunk, HANDLE hContact, DWORD dwFlags) return CallContactService(hContact, PSS_MESSAGE, dwFlags, (LPARAM)pBuf); } -static int SendChunkA(char *chunk, HANDLE hContact, char *szSvc, DWORD dwFlags) +static int SendChunkA(char *chunk, HCONTACT hContact, char *szSvc, DWORD dwFlags) { return(CallContactService(hContact, szSvc, dwFlags, (LPARAM)chunk)); } @@ -150,13 +150,13 @@ static int SendChunkA(char *chunk, HANDLE hContact, char *szSvc, DWORD dwFlags) static void DoSplitSendW(LPVOID param) { SendJob *job = sendQueue->getJobByIndex((int)param); - BOOL fFirstSend = FALSE; + BOOL fFirstSend = FALSE; WCHAR *wszSaved, savedChar; - int iCur = 0, iSavedCur = 0, i; - BOOL fSplitting = TRUE; - HANDLE hContact = job->hOwner; - DWORD dwFlags = job->dwFlags; - int chunkSize = job->chunkSize / 2; + int iCur = 0, iSavedCur = 0, i; + BOOL fSplitting = TRUE; + HCONTACT hContact = job->hOwner; + DWORD dwFlags = job->dwFlags; + int chunkSize = job->chunkSize / 2; char *szProto = GetContactProto(hContact); int iLen = lstrlenA(job->szSendBuffer); @@ -224,14 +224,14 @@ static void DoSplitSendW(LPVOID param) static void DoSplitSendA(LPVOID param) { SendJob *job = sendQueue->getJobByIndex((int)param); - int id; - BOOL fFirstSend = FALSE; + int id; + BOOL fFirstSend = FALSE; char *szBegin, *szTemp, *szSaved, savedChar; - int iLen, iCur = 0, iSavedCur = 0, i; - BOOL fSplitting = TRUE; - HANDLE hContact = job->hOwner; - DWORD dwFlags = job->dwFlags; - int chunkSize = job->chunkSize; + int iLen, iCur = 0, iSavedCur = 0, i; + BOOL fSplitting = TRUE; + HCONTACT hContact = job->hOwner; + DWORD dwFlags = job->dwFlags; + int chunkSize = job->chunkSize; iLen = lstrlenA(job->szSendBuffer); szTemp = (char *)mir_alloc(iLen + 1); @@ -322,7 +322,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) int iSendLength = getSendLength(iEntry, dat->sendMode); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem && SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) { CContactCache *c = CContactCache::getContactCache(hContact); @@ -339,7 +339,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry) return 0; } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem && SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) { doSendLater(iEntry, 0, hContact, false); @@ -804,7 +804,7 @@ LRESULT SendQueue::WarnPendingJobs(unsigned int uNrMessages) * * @return the index on success, -1 on failure */ -int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, HANDLE hContact, bool fIsSendLater) +int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, HCONTACT hContact, bool fIsSendLater) { bool fAvail = sendLater->isAvail(); diff --git a/plugins/TabSRMM/src/sendqueue.h b/plugins/TabSRMM/src/sendqueue.h index 05dec3a0d2..38ee818db2 100644 --- a/plugins/TabSRMM/src/sendqueue.h +++ b/plugins/TabSRMM/src/sendqueue.h @@ -44,7 +44,7 @@ struct SendJob char *szSendBuffer; int iSendLength; // length of message in utf-8 octets (used to check maxlen) int sendCount; - HANDLE hOwner; + HCONTACT hOwner; HWND hwndOwner; unsigned iStatus; TCHAR szErrorMsg[128]; @@ -92,7 +92,7 @@ public: void recallFailed(const TWindowData *dat, int iEntry) const; void showErrorControls(TWindowData *dat, const int showCmd) const; int ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam); - int doSendLater(int iIndex, TWindowData *dat, HANDLE hContact = 0, bool fIsSendLater = true); + int doSendLater(int iIndex, TWindowData *dat, HCONTACT hContact = 0, bool fIsSendLater = true); /* * static members */ diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index aa4d89dc70..68ae9c218f 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -840,7 +840,7 @@ CSideBarButton* CSideBar::findSession(const TWindowData *dat) * @return CSideBarButtonItem*: pointer to the found item. Zero, if none was found */ -CSideBarButton* CSideBar::findSession(const HANDLE hContact) +CSideBarButton* CSideBar::findSession(const HCONTACT hContact) { if (hContact == NULL) return NULL; diff --git a/plugins/TabSRMM/src/sidebar.h b/plugins/TabSRMM/src/sidebar.h index 71e1f4070b..6150b2526b 100644 --- a/plugins/TabSRMM/src/sidebar.h +++ b/plugins/TabSRMM/src/sidebar.h @@ -194,7 +194,7 @@ private: void removeAll(); void Invalidate(); CSideBarButton* findSession(const TWindowData *dat); - CSideBarButton* findSession(const HANDLE hContact); + CSideBarButton* findSession(const HCONTACT hContact); LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index 2df7517252..292c70872e 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -178,7 +178,7 @@ int _DebugTraceA(const char *fmt, ...) * popup plugin. */ -int _DebugPopup(HANDLE hContact, const TCHAR *fmt, ...) +int _DebugPopup(HCONTACT hContact, const TCHAR *fmt, ...) { va_list va; TCHAR debug[1024]; diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index b939e197a3..0bbe718678 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -972,7 +972,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara TabControlData *tabdat = (TabControlData *)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (tabdat) { if (tabdat->pContainer == NULL) - tabdat->pContainer = (TContainerData *)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA); + tabdat->pContainer = (TContainerData*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA); tabdat->dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); } diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index a2584bebe2..8c900a51d6 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -81,7 +81,7 @@ static int helpActive = 0; * templates */ -static void LoadTemplatesFrom(TTemplateSet *tSet, HANDLE hContact, int rtl) +static void LoadTemplatesFrom(TTemplateSet *tSet, HCONTACT hContact, int rtl) { DBVARIANT dbv = {0}; int i; @@ -112,8 +112,8 @@ void LoadDefaultTemplates() db_set_ts(NULL, TEMPLATES_MODULE, TemplateNames[i], LTR_Default.szTemplates[i]); db_set_b(0, TEMPLATES_MODULE, "setup", 2); } - LoadTemplatesFrom(<R_Active, (HANDLE)0, 0); - LoadTemplatesFrom(&RTL_Active, (HANDLE)0, 1); + LoadTemplatesFrom(<R_Active, 0, 0); + LoadTemplatesFrom(&RTL_Active, 0, 1); } INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -140,7 +140,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP COLORREF url_visited = RGB(128, 0, 128); COLORREF url_unvisited = RGB(0, 0, 255); dat = (TWindowData*)mir_calloc( sizeof(TWindowData)); - dat->pContainer = (TContainerData *)mir_alloc(sizeof(TContainerData)); + dat->pContainer = (TContainerData*)mir_alloc(sizeof(TContainerData)); ZeroMemory(dat->pContainer, sizeof(TContainerData)); teInfo = (TemplateEditorInfo *)dat->pContainer; ZeroMemory(teInfo, sizeof(TemplateEditorInfo)); diff --git a/plugins/TabSRMM/src/templates.h b/plugins/TabSRMM/src/templates.h index dc2cff5b1a..505411aadc 100644 --- a/plugins/TabSRMM/src/templates.h +++ b/plugins/TabSRMM/src/templates.h @@ -31,18 +31,18 @@ struct TemplateEditorInfo int inEdit; // template currently in editor BOOL updateInfo[TMPL_ERRMSG + 1]; // item states... HWND hwndParent; - HANDLE hContact; + HCONTACT hContact; }; struct TemplateEditorNew { - HANDLE hContact; + HCONTACT hContact; BOOL rtl; HWND hwndParent; }; BOOL CALLBACK DlgProcTemplateEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -static void LoadTemplatesFrom(TTemplateSet *tSet, HANDLE hContact, int rtl); +static void LoadTemplatesFrom(TTemplateSet *tSet, HCONTACT hContact, int rtl); void LoadDefaultTemplates(); #define DM_UPDATETEMPLATEPREVIEW (WM_USER + 50) diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp index 53f93000a5..b636ae54e6 100644 --- a/plugins/TabSRMM/src/trayicon.cpp +++ b/plugins/TabSRMM/src/trayicon.cpp @@ -231,7 +231,7 @@ void TSAPI FlashTrayIcon(HICON hIcon) * is deleted, if necessary. */ -void TSAPI AddContactToFavorites(HANDLE hContact, const TCHAR *szNickname, const char *szProto, TCHAR *szStatus, WORD wStatus, HICON hIcon, BOOL mode, HMENU hMenu) +void TSAPI AddContactToFavorites(HCONTACT hContact, const TCHAR *szNickname, const char *szProto, TCHAR *szStatus, WORD wStatus, HICON hIcon, BOOL mode, HMENU hMenu) { MENUITEMINFO mii = {0}; TCHAR szMenuEntry[80]; @@ -248,7 +248,7 @@ void TSAPI AddContactToFavorites(HANDLE hContact, const TCHAR *szNickname, const szProto = GetContactProto(hContact); if (szProto) { if (wStatus == 0) - wStatus = db_get_w((HANDLE)hContact, szProto, "Status", ID_STATUS_OFFLINE); + wStatus = db_get_w((HCONTACT)hContact, szProto, "Status", ID_STATUS_OFFLINE); if (szStatus == NULL) szStatus = pcli->pfnGetStatusModeDescription(wStatus, 0); } @@ -273,7 +273,7 @@ void TSAPI AddContactToFavorites(HANDLE hContact, const TCHAR *szNickname, const UINT uid = GetMenuItemID(hMenu, 0); if (uid) { DeleteMenu(hMenu, (UINT_PTR)0, MF_BYPOSITION); - db_set_dw((HANDLE)uid, SRMSGMOD_T, "isRecent", 0); + db_set_dw((HCONTACT)uid, SRMSGMOD_T, "isRecent", 0); } } addnew: @@ -324,7 +324,7 @@ void TSAPI AddContactToFavorites(HANDLE hContact, const TCHAR *szNickname, const typedef struct _recentEntry { DWORD dwTimestamp; - HANDLE hContact; + HCONTACT hContact; } RCENTRY; void TSAPI LoadFavoritesAndRecent() @@ -336,7 +336,7 @@ void TSAPI LoadFavoritesAndRecent() if (recentEntries == NULL) return; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (M.GetByte(hContact, "isFavorite", 0)) AddContactToFavorites(hContact, NULL, NULL, NULL, 0, 0, 1, PluginConfig.g_hMenuFavorites); if ((dwRecent = M.GetDword(hContact, "isRecent", 0)) != 0 && iIndex < nen_options.wMaxRecent) { diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index a5ee6aa901..937482a3ff 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -89,7 +89,7 @@ static int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM return DefWindowProc(hWnd, message, wParam, lParam); } -void TN_TypingMessage(HANDLE hContact, int iMode) +void TN_TypingMessage(HCONTACT hContact, int iMode) { // hidden & ignored contacts check if (db_get_b(hContact, "CList", "Hidden", 0) || (db_get_dw(hContact, "Ignore", "Mask1",0) & 1)) // 9 - online notification @@ -363,7 +363,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]; - ppd.lchContact = (HANDLE)wParam; + ppd.lchContact = (HCONTACT)wParam; ppd.PluginWindowProc = NULL; ppd.PluginData = NULL; PUAddPopupT(&ppd); diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index a5b57a9287..ac362d93f1 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -57,13 +57,13 @@ static int have_ieview = 0, have_hpp = 0; static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: { DWORD sCodePage; int i; - hContact = (HANDLE)lParam; + hContact = (HCONTACT)lParam; DWORD maxhist = M.GetDword(hContact, "maxhist", 0); BYTE bIEView = M.GetByte(hContact, "ieview", 0); BYTE bHPP = M.GetByte(hContact, "hpplog", 0); @@ -362,87 +362,86 @@ int TSAPI LoadLocalFlags(HWND hwnd, TWindowData *dat) */ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - switch(msg) { - case WM_INITDIALOG: { + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + switch (msg) { + case WM_INITDIALOG: + hContact = (HCONTACT)lParam; + TranslateDialogDefault(hwndDlg); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hContact); + SendMessage(hwndDlg, WM_COMMAND, WM_USER + 200, 0); + return TRUE; - hContact = (HANDLE)lParam; - TranslateDialogDefault(hwndDlg); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hContact); - SendMessage(hwndDlg, WM_COMMAND, WM_USER + 200, 0); - return TRUE; + case WM_COMMAND: + switch (LOWORD(wParam)) { + case WM_USER + 200: { + DWORD dwLocalFlags, dwLocalMask, maskval; + int i = 0; + + dwLocalFlags = M.GetDword(hContact, "mwflags", 0); + dwLocalMask = M.GetDword(hContact, "mwmask", 0); + + while (checkboxes[i].uId) { + maskval = checkboxes[i].uFlag; + + if (dwLocalMask & maskval) + CheckDlgButton(hwndDlg, checkboxes[i].uId, (dwLocalFlags & maskval) ? BST_CHECKED : BST_UNCHECKED); + else + CheckDlgButton(hwndDlg, checkboxes[i].uId, BST_INDETERMINATE); + i++; + } + if (M.GetByte("logstatuschanges", 0) == M.GetByte(hContact, "logstatuschanges", 0)) + CheckDlgButton(hwndDlg, IDC_UPREFS_LOGSTATUS, BST_INDETERMINATE); + else + CheckDlgButton(hwndDlg, IDC_UPREFS_LOGSTATUS, M.GetByte(hContact, "logstatuschanges", 0) ? BST_CHECKED : BST_UNCHECKED); + break; } - case WM_COMMAND: - switch(LOWORD(wParam)) { - case WM_USER + 200: { - DWORD dwLocalFlags, dwLocalMask, maskval; - int i = 0; + case WM_USER + 100: { + int i = 0; + LRESULT state; + HWND hwnd = M.FindWindow(hContact); + TWindowData *dat = NULL; + DWORD *dwActionToTake = (DWORD *)lParam, dwMask = 0, dwFlags = 0, maskval; - dwLocalFlags = M.GetDword(hContact, "mwflags", 0); - dwLocalMask = M.GetDword(hContact, "mwmask", 0); + if (hwnd) + dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - while(checkboxes[i].uId) { - maskval = checkboxes[i].uFlag; + while (checkboxes[i].uId) { + maskval = checkboxes[i].uFlag; - if (dwLocalMask & maskval) - CheckDlgButton(hwndDlg, checkboxes[i].uId, (dwLocalFlags & maskval) ? BST_CHECKED : BST_UNCHECKED); - else - CheckDlgButton(hwndDlg, checkboxes[i].uId, BST_INDETERMINATE); - i++; - } - if (M.GetByte("logstatuschanges", 0) == M.GetByte(hContact, "logstatuschanges", 0)) - CheckDlgButton(hwndDlg, IDC_UPREFS_LOGSTATUS, BST_INDETERMINATE); - else - CheckDlgButton(hwndDlg, IDC_UPREFS_LOGSTATUS, M.GetByte(hContact, "logstatuschanges", 0) ? BST_CHECKED : BST_UNCHECKED); - break; - } - case WM_USER + 100: { - int i=0; - LRESULT state; - HWND hwnd = M.FindWindow(hContact); - TWindowData *dat = NULL; - DWORD *dwActionToTake = (DWORD *)lParam, dwMask = 0, dwFlags = 0, maskval; - - if (hwnd) - dat = (TWindowData*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - - while(checkboxes[i].uId) { - maskval = checkboxes[i].uFlag; - - state = IsDlgButtonChecked(hwndDlg, checkboxes[i].uId); - if (state != BST_INDETERMINATE) { - dwMask |= maskval; - dwFlags = (state == BST_CHECKED) ? (dwFlags | maskval) : (dwFlags & ~maskval); - } - i++; - } - state = IsDlgButtonChecked(hwndDlg, IDC_UPREFS_LOGSTATUS); - if (state != BST_INDETERMINATE) { - db_set_b(hContact, SRMSGMOD_T, "logstatuschanges", (BYTE)state); - } - if (dwMask) { - db_set_dw(hContact, SRMSGMOD_T, "mwmask", dwMask); - db_set_dw(hContact, SRMSGMOD_T, "mwflags", dwFlags); - } - else { - db_unset(hContact, SRMSGMOD_T, "mwmask"); - db_unset(hContact, SRMSGMOD_T, "mwflags"); - } - if (hwnd && dat) { - if (dwMask) - *dwActionToTake |= (DWORD)UPREF_ACTION_REMAKELOG; - if ((dat->dwFlags & MWF_LOG_RTL) != (dwFlags & MWF_LOG_RTL)) - *dwActionToTake |= (DWORD)UPREF_ACTION_APPLYOPTIONS; - } - break; + state = IsDlgButtonChecked(hwndDlg, checkboxes[i].uId); + if (state != BST_INDETERMINATE) { + dwMask |= maskval; + dwFlags = (state == BST_CHECKED) ? (dwFlags | maskval) : (dwFlags & ~maskval); } - case IDC_REVERTGLOBAL: - db_unset(hContact, SRMSGMOD_T, "mwmask"); - db_unset(hContact, SRMSGMOD_T, "mwflags"); - SendMessage(hwndDlg, WM_COMMAND, WM_USER + 200, 0); - break; + i++; + } + state = IsDlgButtonChecked(hwndDlg, IDC_UPREFS_LOGSTATUS); + if (state != BST_INDETERMINATE) { + db_set_b(hContact, SRMSGMOD_T, "logstatuschanges", (BYTE)state); } + if (dwMask) { + db_set_dw(hContact, SRMSGMOD_T, "mwmask", dwMask); + db_set_dw(hContact, SRMSGMOD_T, "mwflags", dwFlags); + } + else { + db_unset(hContact, SRMSGMOD_T, "mwmask"); + db_unset(hContact, SRMSGMOD_T, "mwflags"); + } + if (hwnd && dat) { + if (dwMask) + *dwActionToTake |= (DWORD)UPREF_ACTION_REMAKELOG; + if ((dat->dwFlags & MWF_LOG_RTL) != (dwFlags & MWF_LOG_RTL)) + *dwActionToTake |= (DWORD)UPREF_ACTION_APPLYOPTIONS; + } + break; + } + case IDC_REVERTGLOBAL: + db_unset(hContact, SRMSGMOD_T, "mwmask"); + db_unset(hContact, SRMSGMOD_T, "mwflags"); + SendMessage(hwndDlg, WM_COMMAND, WM_USER + 200, 0); break; + } + break; } return FALSE; } @@ -456,16 +455,16 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA * @return LRESULT (ignored for dialog procs, use * DWLP_MSGRESULT) */ - INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) - { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); +INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); TCITEM tci; - switch(msg) { + switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - hContact = (HANDLE)lParam; + hContact = (HCONTACT)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hContact); WindowList_Add(PluginConfig.hUserPrefsWindowList, hwndDlg, hContact); @@ -507,7 +506,7 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_OPTIONSTAB)), &tci); ShowWindow((HWND)tci.lParam, SW_HIDE); break; - case TCN_SELCHANGE: + case TCN_SELCHANGE: tci.mask = TCIF_PARAM; TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), TabCtrl_GetCurSel(GetDlgItem(hwndDlg, IDC_OPTIONSTAB)), &tci); ShowWindow((HWND)tci.lParam, SW_SHOW); @@ -518,7 +517,7 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA break; case WM_COMMAND: - switch(LOWORD(wParam)) { + switch (LOWORD(wParam)) { case IDCANCEL: DestroyWindow(hwndDlg); break; @@ -530,7 +529,7 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA tci.mask = TCIF_PARAM; int count = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_OPTIONSTAB)); - for (int i=0; i < count; i++) { + for (int i = 0; i < count; i++) { TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_OPTIONSTAB), i, &tci); SendMessage((HWND)tci.lParam, WM_COMMAND, WM_USER + 100, (LPARAM)&dwActionToTake); } @@ -569,4 +568,4 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA break; } return FALSE; - } +} diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 55525d62c5..2d6d5c7f5e 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -617,7 +617,7 @@ int Utils::RTFColorToIndex(int iCol) */ INT_PTR CALLBACK Utils::PopupDlgProcError(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)PUGetPluginData(hWnd); + HCONTACT hContact = (HCONTACT)PUGetPluginData(hWnd); switch (message) { case WM_COMMAND: @@ -642,7 +642,7 @@ INT_PTR CALLBACK Utils::PopupDlgProcError(HWND hWnd, UINT message, WPARAM wParam * @param cs TContainerSettings* target structure * @return 0 on success, 1 failure (blob does not exist OR is not a valid private setting structure */ -int Utils::ReadContainerSettingsFromDB(const HANDLE hContact, TContainerSettings *cs, const char *szKey) +int Utils::ReadContainerSettingsFromDB(const HCONTACT hContact, TContainerSettings *cs, const char *szKey) { CopyMemory(cs, &PluginConfig.globalContainerSettings, sizeof(TContainerSettings)); @@ -664,7 +664,7 @@ int Utils::ReadContainerSettingsFromDB(const HANDLE hContact, TContainerSettings return 1; } -int Utils::WriteContainerSettingsToDB(const HANDLE hContact, TContainerSettings *cs, const char *szKey) +int Utils::WriteContainerSettingsToDB(const HCONTACT hContact, TContainerSettings *cs, const char *szKey) { ::db_set_blob(hContact, SRMSGMOD_T, szKey ? szKey : CNT_KEYNAME, cs, sizeof(TContainerSettings)); return 0; @@ -823,7 +823,7 @@ HICON Utils::iconFromAvatar(const TWindowData *dat) return hIcon; } -AVATARCACHEENTRY* Utils::loadAvatarFromAVS(const HANDLE hContact) +AVATARCACHEENTRY* Utils::loadAvatarFromAVS(const HCONTACT hContact) { if (!ServiceExists(MS_AV_GETAVATARBITMAP)) return 0; @@ -1336,7 +1336,7 @@ INT_PTR CALLBACK CWarning::dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP if (!(m_dwFlags & MB_YESNO || m_dwFlags & MB_YESNOCANCEL)) ::ShowWindow(hwnd, SW_SHOWNORMAL); - WindowList_Add(hWindowList, hwnd, hwnd); + WindowList_Add(hWindowList, hwnd, (HCONTACT)hwnd); } return TRUE; diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h index 90ae419e8e..7e3b56b310 100644 --- a/plugins/TabSRMM/src/utils.h +++ b/plugins/TabSRMM/src/utils.h @@ -76,8 +76,8 @@ public: static void TSAPI RTF_ColorAdd (const TCHAR *tszColname, size_t length); static void TSAPI CreateColorMap (TCHAR *Text); static int TSAPI RTFColorToIndex (int iCol); - static int TSAPI ReadContainerSettingsFromDB (const HANDLE hContact, TContainerSettings *cs, const char *szKey = 0); - static int TSAPI WriteContainerSettingsToDB (const HANDLE hContact, TContainerSettings *cs, const char *szKey = 0); + static int TSAPI ReadContainerSettingsFromDB (const HCONTACT hContact, TContainerSettings *cs, const char *szKey = 0); + static int TSAPI WriteContainerSettingsToDB (const HCONTACT hContact, TContainerSettings *cs, const char *szKey = 0); static void TSAPI SettingsToContainer (TContainerData *pContainer); static void TSAPI ContainerToSettings (TContainerData *pContainer); static void TSAPI ReadPrivateContainerSettings (TContainerData *pContainer, bool fForce = false); @@ -97,7 +97,7 @@ public: const TCHAR *tszFilename, bool fForceOverwrite); static void TSAPI scaleAvatarHeightLimited (const HBITMAP hBm, double& dNewWidth, double& dNewHeight, const LONG maxHeight); - static AVATARCACHEENTRY* TSAPI loadAvatarFromAVS (const HANDLE hContact); + static AVATARCACHEENTRY* TSAPI loadAvatarFromAVS (const HCONTACT hContact); static void TSAPI sanitizeFilename (wchar_t *tszFilename); static void TSAPI ensureTralingBackslash (wchar_t *szPathname); diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp index 3377994eb6..dd0ffc75d4 100644 --- a/plugins/TipperYM/src/message_pump.cpp +++ b/plugins/TipperYM/src/message_pump.cpp @@ -48,14 +48,14 @@ bool NeedWaitForContent(CLCINFOTIPEX *clcitex) if (opt.bWaitForContent && IsContactTooltip(clcitex)) { - char *szProto = GetContactProto(clcitex->hItem); + char *szProto = GetContactProto((HCONTACT)clcitex->hItem); if (!szProto) return false; if (opt.bWaitForStatusMsg && !bStatusMsgReady) { - db_unset(clcitex->hItem, MODULE, "TempStatusMsg"); - if (CanRetrieveStatusMsg(clcitex->hItem, szProto) && - CallContactService(clcitex->hItem, PSS_GETAWAYMSG, 0, 0)) + db_unset((HCONTACT)clcitex->hItem, MODULE, "TempStatusMsg"); + if (CanRetrieveStatusMsg((HCONTACT)clcitex->hItem, szProto) && + CallContactService((HCONTACT)clcitex->hItem, PSS_GETAWAYMSG, 0, 0)) { if (WaitForContentTimerID) KillTimer(0, WaitForContentTimerID); @@ -69,7 +69,7 @@ bool NeedWaitForContent(CLCINFOTIPEX *clcitex) CallProtoService(szProto, PS_GETAVATARCAPS, AF_ENABLED, 0)) { DBVARIANT dbv; - if (!db_get_s(clcitex->hItem, "ContactPhoto", "File", &dbv)) + if (!db_get_s((HCONTACT)clcitex->hItem, "ContactPhoto", "File", &dbv)) { if (!strstr(dbv.pszVal, ".xml")) { @@ -137,14 +137,12 @@ unsigned int CALLBACK MessagePumpThread(void *param) } case MUM_DELETEPOPUP: { - if (hwndTip) - { + if (hwndTip) { MyDestroyWindow(hwndTip); hwndTip = 0; } - if (clcitex) - { + if (clcitex) { mir_free(clcitex); clcitex = 0; } @@ -155,7 +153,7 @@ unsigned int CALLBACK MessagePumpThread(void *param) } case MUM_GOTSTATUS: { - HANDLE hContact = (HANDLE)hwndMsg.wParam; + HCONTACT hContact = (HCONTACT)hwndMsg.wParam; TCHAR *swzMsg = (TCHAR *)hwndMsg.lParam; if (opt.bWaitForContent && @@ -171,7 +169,7 @@ unsigned int CALLBACK MessagePumpThread(void *param) if (swzMsg) { - db_set_ts(clcitex->hItem, MODULE, "TempStatusMsg", swzMsg); + db_set_ts((HCONTACT)clcitex->hItem, MODULE, "TempStatusMsg", swzMsg); mir_free(swzMsg); } @@ -193,7 +191,7 @@ unsigned int CALLBACK MessagePumpThread(void *param) } case MUM_GOTAVATAR: { - HANDLE hContact = (HANDLE)hwndMsg.wParam; + HCONTACT hContact = (HCONTACT)hwndMsg.wParam; if (opt.bWaitForContent && bAvatarReady == false && @@ -352,7 +350,7 @@ int ProtoAck(WPARAM wParam, LPARAM lParam) int AvatarChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; PostMPMessage(MUM_GOTAVATAR, (WPARAM)hContact, 0); return 0; } diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 2d9c01ed4d..ed49ccb962 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -2101,7 +2101,7 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETGREYOUTFLAGS, 0, 0); SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETLEFTMARGIN, 2, 0); { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem && db_get_b(hContact, MODULE, "FavouriteContact", 0)) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 1); @@ -2118,7 +2118,7 @@ INT_PTR CALLBACK DlgProcFavouriteContacts(HWND hwndDlg, UINT msg, WPARAM wParam, BYTE isChecked; int count = 0; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) { isChecked = (BYTE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0); diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index c2b01d3bf8..b9c3d80277 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -305,7 +305,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pwd->bIsTextTip = false; pwd->iIndent = opt.iTextIndent; pwd->iSidebarWidth= opt.iSidebarWidth; - pwd->hContact = pwd->clcit.hItem; + pwd->hContact = (HCONTACT)pwd->clcit.hItem; pwd->iIconIndex = (int)CallService(MS_CLIST_GETCONTACTICON, (WPARAM)pwd->hContact, 0); // don't use stored status message @@ -1528,7 +1528,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (dwItems & TRAYTIP_NUMCONTACTS) { int iCount = 0, iCountOnline = 0; - for (HANDLE hContact = db_find_first(pa->szModuleName); hContact; hContact = db_find_next(hContact, pa->szModuleName)) { + for (HCONTACT hContact = db_find_first(pa->szModuleName); hContact; hContact = db_find_next(hContact, pa->szModuleName)) { if (db_get_w(hContact, pa->szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) iCountOnline++; iCount++; @@ -1646,7 +1646,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa bool bTitlePainted = false; int iCount = 0, iCountOnline = 0; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (db_get_b(hContact, MODULE, "FavouriteContact", 0)) { char *proto = GetContactProto(hContact); if (proto == NULL) diff --git a/plugins/TipperYM/src/popwin.h b/plugins/TipperYM/src/popwin.h index 81d36b0210..64e8df08ce 100644 --- a/plugins/TipperYM/src/popwin.h +++ b/plugins/TipperYM/src/popwin.h @@ -107,7 +107,7 @@ typedef struct { HPEN hpenBorder, hpenDivider; int iTitleHeight, iAvatarHeight, iIconsHeight, iTextHeight, iLabelWidth; int iRealAvatarWidth, iRealAvatarHeight; - HANDLE hContact; + HCONTACT hContact; int iIconIndex; CLCINFOTIPEX clcit; TCHAR swzTitle[TITLE_TEXT_LEN]; diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 74d6990c98..77938b3d62 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA. #include "common.h" -bool DBGetContactSettingAsString(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +bool DBGetContactSettingAsString(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DBVARIANT dbv; buff[0] = 0; @@ -63,7 +63,7 @@ bool DBGetContactSettingAsString(HANDLE hContact, const char *szModuleName, cons return buff[0] ? true : false; } -bool CheckContactType(HANDLE hContact, const DISPLAYITEM &di) +bool CheckContactType(HCONTACT hContact, const DISPLAYITEM &di) { if (di.type == DIT_ALL) return true; @@ -127,7 +127,7 @@ void StripBBCodesInPlace(TCHAR *swzText) } } -DWORD LastMessageTimestamp(HANDLE hContact) +DWORD LastMessageTimestamp(HCONTACT hContact) { HANDLE hDbEvent = db_event_last(hContact); while (hDbEvent) { @@ -153,7 +153,7 @@ void FormatTimestamp(DWORD ts, char *szFormat, TCHAR *buff, int bufflen) CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt); } -bool Uid(HANDLE hContact, char *szProto, TCHAR *buff, int bufflen) +bool Uid(HCONTACT hContact, char *szProto, TCHAR *buff, int bufflen) { char *tmpProto = NULL; @@ -184,7 +184,7 @@ bool UidName(char *szProto, TCHAR *buff, int bufflen) return false; } -TCHAR *GetLastMessageText(HANDLE hContact) +TCHAR *GetLastMessageText(HCONTACT hContact) { HANDLE hDbEvent = db_event_last(hContact); while (hDbEvent) { @@ -210,7 +210,7 @@ TCHAR *GetLastMessageText(HANDLE hContact) return 0; } -bool CanRetrieveStatusMsg(HANDLE hContact, char *szProto) +bool CanRetrieveStatusMsg(HCONTACT hContact, char *szProto) { if (opt.bGetNewStatusMsg) { @@ -242,26 +242,21 @@ bool CanRetrieveStatusMsg(HANDLE hContact, char *szProto) return false; } -TCHAR *GetStatusMessageText(HANDLE hContact) +TCHAR *GetStatusMessageText(HCONTACT hContact) { TCHAR *swzMsg = 0; DBVARIANT dbv; char *szProto = GetContactProto(hContact); - if (szProto) - { + if (szProto) { if (!strcmp(szProto, szMetaModuleName)) - { - hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); - } - else - { + hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + else { WORD wStatus = (int)CallProtoService(szProto, PS_GETSTATUS, 0, 0); if (wStatus == ID_STATUS_OFFLINE) return NULL; - if (!db_get_ts(hContact, MODULE, "TempStatusMsg", &dbv)) - { + if (!db_get_ts(hContact, MODULE, "TempStatusMsg", &dbv)) { if (_tcslen(dbv.ptszVal) != 0) swzMsg = mir_tstrdup(dbv.ptszVal); db_free(&dbv); @@ -291,7 +286,7 @@ TCHAR *GetStatusMessageText(HANDLE hContact) return swzMsg; } -bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int bufflen) +bool GetSysSubstText(HCONTACT hContact, TCHAR *swzRawSpec, TCHAR *buff, int bufflen) { if (!_tcscmp(swzRawSpec, _T("uid"))) { @@ -366,14 +361,15 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle } else if (!_tcscmp(swzRawSpec, _T("meta_subuid"))) { - HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); - if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND) return false; + HCONTACT hSubContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND) + return false; return Uid(hSubContact, 0, buff, bufflen); } else if (!_tcscmp(swzRawSpec, _T("meta_subproto"))) { // get protocol of active subcontact - HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + HCONTACT hSubContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); if (!hSubContact || (INT_PTR)hSubContact == CALLSERVICE_NOTFOUND) return false; return GetSysSubstText(hSubContact, _T("account"), buff, bufflen); @@ -413,18 +409,18 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle DWORD dwLastTs, dwNewTs, dwRecountTs; DWORD dwTime, dwDiff; int iNumber = 1; - HANDLE hTmpContact = hContact; + HCONTACT hTmpContact = hContact; char *szProto = GetContactProto(hContact); if (szProto && !strcmp(szProto, szMetaModuleName)) { iNumber = CallService(MS_MC_GETNUMCONTACTS, (WPARAM)hContact, 0); - hTmpContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, 0); + hTmpContact = (HCONTACT)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, 0); } for (int i = 0; i < iNumber; i++) { if (i > 0) - hTmpContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, i); + hTmpContact = (HCONTACT)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, i); dwRecountTs = db_get_dw(hTmpContact, MODULE, "LastCountTS", 0); dwTime = (DWORD)time(0); dwDiff = (dwTime - dwRecountTs); @@ -478,7 +474,7 @@ bool GetSysSubstText(HANDLE hContact, TCHAR *swzRawSpec, TCHAR *buff, int buffle return false; } -bool GetSubstText(HANDLE hContact, const DISPLAYSUBST &ds, TCHAR *buff, int bufflen) +bool GetSubstText(HCONTACT hContact, const DISPLAYSUBST &ds, TCHAR *buff, int bufflen) { TranslateFunc *transFunc = 0; for (int i = 0; i < iTransFuncsCount; i++) @@ -513,7 +509,7 @@ bool GetSubstText(HANDLE hContact, const DISPLAYSUBST &ds, TCHAR *buff, int buff return false; } -bool GetRawSubstText(HANDLE hContact, char *szRawSpec, TCHAR *buff, int bufflen) +bool GetRawSubstText(HCONTACT hContact, char *szRawSpec, TCHAR *buff, int bufflen) { size_t lenght = strlen(szRawSpec); for (size_t i = 0; i < lenght; i++) @@ -545,7 +541,7 @@ bool GetRawSubstText(HANDLE hContact, char *szRawSpec, TCHAR *buff, int bufflen) return false; } -bool ApplySubst(HANDLE hContact, const TCHAR *swzSource, bool parseTipperVarsFirst, TCHAR *swzDest, int iDestLen) +bool ApplySubst(HCONTACT hContact, const TCHAR *swzSource, bool parseTipperVarsFirst, TCHAR *swzDest, int iDestLen) { // hack - allow empty strings before passing to variables (note - zero length strings return false after this) if (swzDest && swzSource && _tcslen(swzSource) == 0) { @@ -789,12 +785,12 @@ error: return true; } -bool GetLabelText(HANDLE hContact, const DISPLAYITEM &di, TCHAR *buff, int bufflen) +bool GetLabelText(HCONTACT hContact, const DISPLAYITEM &di, TCHAR *buff, int bufflen) { return ApplySubst(hContact, di.swzLabel, false, buff, bufflen); } -bool GetValueText(HANDLE hContact, const DISPLAYITEM &di, TCHAR *buff, int bufflen) +bool GetValueText(HCONTACT hContact, const DISPLAYITEM &di, TCHAR *buff, int bufflen) { return ApplySubst(hContact, di.swzValue, di.bParseTipperVarsFirst, buff, bufflen); } @@ -893,7 +889,7 @@ TCHAR *GetProtoExtraStatusMessage(char *szProto) db_free(&dbv); if (ServiceExists(MS_VARS_FORMATSTRING)) { - HANDLE hContact = db_find_first(); + HCONTACT hContact = db_find_first(); char *proto = GetContactProto(hContact); while(!proto) { hContact = db_find_next(hContact); @@ -961,7 +957,7 @@ TCHAR *GetJabberAdvStatusText(char *szProto, const char *szSlot, const char *szV return swzText; } -HICON GetJabberActivityIcon(HANDLE hContact, char *szProto) +HICON GetJabberActivityIcon(HCONTACT hContact, char *szProto) { DBVARIANT dbv; HICON hIcon = NULL; diff --git a/plugins/TipperYM/src/subst.h b/plugins/TipperYM/src/subst.h index 7df4a13cca..05e62014da 100644 --- a/plugins/TipperYM/src/subst.h +++ b/plugins/TipperYM/src/subst.h @@ -21,25 +21,25 @@ Boston, MA 02111-1307, USA. #ifndef _SUBST_INC #define _SUBST_INC -bool GetLabelText(HANDLE hContact, const DISPLAYITEM &di, TCHAR *buff, int iBufflen); -bool GetValueText(HANDLE hContact, const DISPLAYITEM &di, TCHAR *buff, int iBufflen); +bool GetLabelText(HCONTACT hContact, const DISPLAYITEM &di, TCHAR *buff, int iBufflen); +bool GetValueText(HCONTACT hContact, const DISPLAYITEM &di, TCHAR *buff, int iBufflen); -bool CheckContactType(HANDLE hContact, const DISPLAYITEM &di); +bool CheckContactType(HCONTACT hContact, const DISPLAYITEM &di); void StripBBCodesInPlace(TCHAR *text); // can be used with hContact == 0 to get uid for a given proto bool UidName(char *szProto, TCHAR *buff, int bufflen); -bool Uid(HANDLE hContact, char *szProto, TCHAR *buff, int bufflen); +bool Uid(HCONTACT hContact, char *szProto, TCHAR *buff, int bufflen); // get info for status and tray tooltip -bool DBGetContactSettingAsString(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen); -bool CanRetrieveStatusMsg(HANDLE hContact, char *szProto); +bool DBGetContactSettingAsString(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen); +bool CanRetrieveStatusMsg(HCONTACT hContact, char *szProto); TCHAR *GetProtoStatusMessage(char *szProto, WORD status); TCHAR *GetProtoExtraStatusTitle(char *szProto); TCHAR *GetProtoExtraStatusMessage(char *szProto); TCHAR *GetListeningTo(char *szProto); TCHAR *GetJabberAdvStatusText(char *szProto, const char *szSlot, const char *szValue); -HICON GetJabberActivityIcon(HANDLE hContact, char *szProto); +HICON GetJabberActivityIcon(HCONTACT hContact, char *szProto); #endif diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index c3161b17dc..91ef259fa6 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -111,9 +111,9 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) int EventDeleted(WPARAM wParam, LPARAM lParam) { DBEVENTINFO dbei = { sizeof(dbei) }; - if ( !db_event_get((HANDLE)lParam, &dbei)) + if (!db_event_get((HANDLE)lParam, &dbei)) if (dbei.eventType == EVENTTYPE_MESSAGE) - db_unset((HANDLE)wParam, MODULE, "LastCountTS"); + db_unset((HCONTACT)wParam, MODULE, "LastCountTS"); return 0; } diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp index 24276afbbe..5fcb384aa4 100644 --- a/plugins/TipperYM/src/translations.cpp +++ b/plugins/TipperYM/src/translations.cpp @@ -61,14 +61,14 @@ void AddTranslation(DBVTranslation *newTrans) mir_free(szName); } -TCHAR *NullTranslation(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *NullTranslation(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { if (DBGetContactSettingAsString(hContact, szModuleName, szSettingName, buff, bufflen)) return buff; return NULL; } -TCHAR *TimestampToShortDate(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *TimestampToShortDate(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0); if (ts == 0) return 0; @@ -81,7 +81,7 @@ TCHAR *TimestampToShortDate(HANDLE hContact, const char *szModuleName, const cha return buff; } -TCHAR *TimestampToLongDate(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *TimestampToLongDate(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0); if (ts == 0) return 0; @@ -94,7 +94,7 @@ TCHAR *TimestampToLongDate(HANDLE hContact, const char *szModuleName, const char return buff; } -TCHAR *TimestampToTime(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *TimestampToTime(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0); if (ts == 0) return 0; @@ -107,7 +107,7 @@ TCHAR *TimestampToTime(HANDLE hContact, const char *szModuleName, const char *sz return buff; } -TCHAR *TimestampToTimeNoSecs(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *TimestampToTimeNoSecs(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0); if (ts == 0) return 0; @@ -120,7 +120,7 @@ TCHAR *TimestampToTimeNoSecs(HANDLE hContact, const char *szModuleName, const ch return buff; } -TCHAR *TimestampToTimeDifference(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *TimestampToTimeDifference(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DWORD ts = db_get_dw(hContact, szModuleName, szSettingName, 0); DWORD t = (DWORD)time(0); @@ -140,7 +140,7 @@ TCHAR *TimestampToTimeDifference(HANDLE hContact, const char *szModuleName, cons return buff; } -TCHAR *SecondsToTimeDifference(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *SecondsToTimeDifference(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DWORD diff = db_get_dw(hContact, szModuleName, szSettingName, 0); int d = (diff / 60 / 60 / 24); @@ -156,7 +156,7 @@ TCHAR *SecondsToTimeDifference(HANDLE hContact, const char *szModuleName, const return buff; } -TCHAR *WordToStatusDesc(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *WordToStatusDesc(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { WORD wStatus = db_get_w(hContact, szModuleName, szSettingName, ID_STATUS_OFFLINE); TCHAR *szStatus = pcli->pfnGetStatusModeDescription(wStatus, 0); @@ -164,7 +164,7 @@ TCHAR *WordToStatusDesc(HANDLE hContact, const char *szModuleName, const char *s return buff; } -TCHAR *ByteToYesNo(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *ByteToYesNo(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DBVARIANT dbv; if (!db_get(hContact, szModuleName, szSettingName, &dbv)) @@ -184,7 +184,7 @@ TCHAR *ByteToYesNo(HANDLE hContact, const char *szModuleName, const char *szSett return 0; } -TCHAR *ByteToGender(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *ByteToGender(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { BYTE val = (BYTE)db_get_b(hContact, szModuleName, szSettingName, 0); if (val == 'F') @@ -198,7 +198,7 @@ TCHAR *ByteToGender(HANDLE hContact, const char *szModuleName, const char *szSet return buff; } -TCHAR *WordToCountry(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *WordToCountry(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { char *szCountryName = 0; WORD cid = (WORD)db_get_w(hContact, szModuleName, szSettingName, (WORD)-1); @@ -213,7 +213,7 @@ TCHAR *WordToCountry(HANDLE hContact, const char *szModuleName, const char *szSe return 0; } -TCHAR *DwordToIp(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *DwordToIp(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { DWORD ip = db_get_dw(hContact, szModuleName, szSettingName, 0); if (ip) { @@ -243,7 +243,7 @@ bool GetInt(const DBVARIANT &dbv, int *iVal) return false; } -TCHAR *DayMonthYearToDate(HANDLE hContact, const char *szModuleName, const char *prefix, TCHAR *buff, int bufflen) +TCHAR *DayMonthYearToDate(HCONTACT hContact, const char *szModuleName, const char *prefix, TCHAR *buff, int bufflen) { DBVARIANT dbv; char szSettingName[256]; @@ -291,7 +291,7 @@ TCHAR *DayMonthYearToDate(HANDLE hContact, const char *szModuleName, const char return 0; } -TCHAR *DayMonthYearToAge(HANDLE hContact, const char *szModuleName, const char *szPrefix, TCHAR *buff, int bufflen) +TCHAR *DayMonthYearToAge(HCONTACT hContact, const char *szModuleName, const char *szPrefix, TCHAR *buff, int bufflen) { DBVARIANT dbv; char szSettingName[256]; @@ -340,7 +340,7 @@ TCHAR *DayMonthYearToAge(HANDLE hContact, const char *szModuleName, const char * return 0; } -TCHAR *HoursMinutesSecondsToTime(HANDLE hContact, const char *szModuleName, const char *szPrefix, TCHAR *buff, int bufflen) +TCHAR *HoursMinutesSecondsToTime(HCONTACT hContact, const char *szModuleName, const char *szPrefix, TCHAR *buff, int bufflen) { DBVARIANT dbv; char szSettingName[256]; @@ -384,7 +384,7 @@ TCHAR *HoursMinutesSecondsToTime(HANDLE hContact, const char *szModuleName, cons return 0; } -TCHAR *HoursMinutesToTime(HANDLE hContact, const char *szModuleName, const char *szPrefix, TCHAR *buff, int bufflen) +TCHAR *HoursMinutesToTime(HCONTACT hContact, const char *szModuleName, const char *szPrefix, TCHAR *buff, int bufflen) { DBVARIANT dbv; char szSettingName[256]; @@ -420,7 +420,7 @@ TCHAR *HoursMinutesToTime(HANDLE hContact, const char *szModuleName, const char return 0; } -TCHAR *DmyToTimeDifference(HANDLE hContact, const char *szModuleName, const char *szPrefix, TCHAR *buff, int bufflen) +TCHAR *DmyToTimeDifference(HCONTACT hContact, const char *szModuleName, const char *szPrefix, TCHAR *buff, int bufflen) { DBVARIANT dbv; char szSettingName[256]; @@ -522,7 +522,7 @@ TCHAR *DmyToTimeDifference(HANDLE hContact, const char *szModuleName, const char return 0; } -TCHAR *DayMonthToDaysToNextBirthday(HANDLE hContact, const char *szModuleName, const char *szPrefix, TCHAR *buff, int bufflen) +TCHAR *DayMonthToDaysToNextBirthday(HCONTACT hContact, const char *szModuleName, const char *szPrefix, TCHAR *buff, int bufflen) { DBVARIANT dbv; char szSettingName[256]; @@ -575,7 +575,7 @@ TCHAR *DayMonthToDaysToNextBirthday(HANDLE hContact, const char *szModuleName, c } -TCHAR *EmptyXStatusToDefaultName(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *EmptyXStatusToDefaultName(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { TCHAR szDefaultName[1024]; CUSTOM_STATUS xstatus = {0}; @@ -615,7 +615,7 @@ TCHAR *EmptyXStatusToDefaultName(HANDLE hContact, const char *szModuleName, cons return 0; } -TCHAR *TimezoneToTime(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *TimezoneToTime(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { int timezone = db_get_b(hContact,szModuleName,szSettingName,256); if (timezone==256 || (char)timezone==-100) @@ -640,7 +640,7 @@ TCHAR *TimezoneToTime(HANDLE hContact, const char *szModuleName, const char *szS return buff; } -TCHAR *ByteToDay(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *ByteToDay(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { int iDay = db_get_w(hContact, szModuleName, szSettingName, -1); if (iDay > -1 && iDay < 7) @@ -653,7 +653,7 @@ TCHAR *ByteToDay(HANDLE hContact, const char *szModuleName, const char *szSettin return 0; } -TCHAR *ByteToMonth(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *ByteToMonth(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { int iMonth = db_get_w(hContact, szModuleName, szSettingName, 0); if (iMonth > 0 && iMonth < 13) @@ -666,7 +666,7 @@ TCHAR *ByteToMonth(HANDLE hContact, const char *szModuleName, const char *szSett return 0; } -TCHAR *ByteToLanguage(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) +TCHAR *ByteToLanguage(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen) { int iLang = db_get_b(hContact, szModuleName, szSettingName, 0); if (iLang) diff --git a/plugins/TipperYM/src/translations.h b/plugins/TipperYM/src/translations.h index 985920054e..7f09002bad 100644 --- a/plugins/TipperYM/src/translations.h +++ b/plugins/TipperYM/src/translations.h @@ -117,9 +117,9 @@ static char *months[12] = { void InitTranslations(); void DeinitTranslations(); -TCHAR *TimestampToTimeDifference(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen); -TCHAR *EmptyXStatusToDefaultName(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen); -TCHAR *WordToStatusDesc(HANDLE hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen); +TCHAR *TimestampToTimeDifference(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen); +TCHAR *EmptyXStatusToDefaultName(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen); +TCHAR *WordToStatusDesc(HCONTACT hContact, const char *szModuleName, const char *szSettingName, TCHAR *buff, int bufflen); #endif diff --git a/plugins/TooltipNotify/src/DbHelpers.cpp b/plugins/TooltipNotify/src/DbHelpers.cpp index 19de8c826f..15261988de 100644 --- a/plugins/TooltipNotify/src/DbHelpers.cpp +++ b/plugins/TooltipNotify/src/DbHelpers.cpp @@ -11,7 +11,7 @@ static int EnumSettingsProc1(const char *pszSetting, LPARAM lParam) return 0; } -bool ModuleSettingsExists(HANDLE hContact, const char* pszModuleName) +bool ModuleSettingsExists(HCONTACT hContact, const char* pszModuleName) { DBCONTACTENUMSETTINGS dbces = {0}; dbces.szModule = pszModuleName; @@ -28,7 +28,7 @@ static int EnumSettingsProc2(const char *pszSetting, LPARAM lParam) return 0; } -void DeleteModuleSettings(HANDLE hContact, const char* pszModuleName) +void DeleteModuleSettings(HCONTACT hContact, const char* pszModuleName) { SettingsList settingsList; DBCONTACTENUMSETTINGS dbces = {0}; @@ -48,7 +48,7 @@ void DeleteModuleSettings(HANDLE hContact, const char* pszModuleName) } -static int GetSetting(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) +static int GetSetting(HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { int rr = db_get(hContact, szModule, szSetting, dbv); if (dbv->type != DBVT_UTF8) @@ -57,7 +57,7 @@ static int GetSetting(HANDLE hContact, const char *szModule, const char *szSetti return 1; } -void RenameModule(HANDLE hContact, const char* pszOldName, const char* pszNewName) +void RenameModule(HCONTACT hContact, const char* pszOldName, const char* pszNewName) { SettingsList settingsList; DBCONTACTENUMSETTINGS dbces = {0}; diff --git a/plugins/TooltipNotify/src/DbHelpers.h b/plugins/TooltipNotify/src/DbHelpers.h index 374df04c05..d07b6cf26b 100644 --- a/plugins/TooltipNotify/src/DbHelpers.h +++ b/plugins/TooltipNotify/src/DbHelpers.h @@ -2,6 +2,6 @@ // ////////////////////////////////////////////////////////////////////// -bool ModuleSettingsExists(HANDLE hContact, const char* pszModuleName); -void DeleteModuleSettings(HANDLE hContact, const char* pszModuleName); -void RenameModule(HANDLE hContact, const char* pszOldName, const char* pszNewName); +bool ModuleSettingsExists(HCONTACT hContact, const char* pszModuleName); +void DeleteModuleSettings(HCONTACT hContact, const char* pszModuleName); +void RenameModule(HCONTACT hContact, const char* pszOldName, const char* pszNewName); diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index 3931c5aa29..2352c0749c 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -162,7 +162,7 @@ int CTooltipNotify::ProtoContactIsTyping(WPARAM wParam, LPARAM lParam) { STooltipData *pTooltipData = new STooltipData; pTooltipData->uiTimeout = lParam*1000; - pTooltipData->hContact = (HANDLE)wParam; + pTooltipData->hContact = (HCONTACT)wParam; pTooltipData->iStatus = ID_TTNTF_STATUS_TYPING; EndNotifyAll(); @@ -211,7 +211,7 @@ int CTooltipNotify::ProtoAck(WPARAM wParam, LPARAM lParam) int CTooltipNotify::ContactSettingChanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if(hContact==NULL) return 0; bool idle = false; @@ -798,7 +798,7 @@ void CTooltipNotify::LoadList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown if (hItemUnknown && !m_sOptions.bIgnoreUnknown) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItemUnknown, 1); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0); if (hItem && !db_get_b(hContact, MODULENAME, CONTACT_IGNORE_TTNOTIFY, m_sOptions.bIgnoreNew)) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItem, 1); @@ -813,7 +813,7 @@ void CTooltipNotify::SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown if (hItemUnknown) m_sOptions.bIgnoreUnknown = (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemUnknown, 0) ? 0 : 1); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0); if (hItem) { BYTE bChecked = (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0)); @@ -912,7 +912,7 @@ TCHAR *CTooltipNotify::StatusToString(int iStatus, TCHAR *szStatus, int iBufSize } -TCHAR *CTooltipNotify::MakeTooltipString(HANDLE hContact, int iStatus, TCHAR *szString, int iBufSize) +TCHAR *CTooltipNotify::MakeTooltipString(HCONTACT hContact, int iStatus, TCHAR *szString, int iBufSize) { TCHAR szStatus[32]; StatusToString(iStatus, szStatus, SIZEOF(szStatus)); diff --git a/plugins/TooltipNotify/src/TooltipNotify.h b/plugins/TooltipNotify/src/TooltipNotify.h index 886cacb553..58ddbf9cb9 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.h +++ b/plugins/TooltipNotify/src/TooltipNotify.h @@ -67,7 +67,7 @@ private: CTooltip *pTooltip; UINT_PTR idTimer; UINT uiTimeout; - HANDLE hContact; + HCONTACT hContact; int iStatus; }; @@ -88,7 +88,7 @@ private: MapTimerIdProtoIter FindProtoByTimer(UINT idTimer); template TooltipsListIter FindBy(T STooltipData::* m, const T& value); TCHAR *StatusToString(int iStatus, TCHAR *szStatus, int iBufSize); - TCHAR *MakeTooltipString(HANDLE hContact, int iStatus, TCHAR *szString, int iBufSize); + TCHAR *MakeTooltipString(HCONTACT hContact, int iStatus, TCHAR *szString, int iBufSize); void MigrateSettings(); void RegisterFonts(); void GetFont(int iStatus, LOGFONT* lf, COLORREF* text, COLORREF* bg); diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index a0b350f1a9..8b35da97e9 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -44,18 +44,18 @@ static LIST gMsgWndList(10, HandleKeySortT); static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam) { WORD countryNumber; - char *pszProto = GetContactProto((HANDLE)wParam); + char *pszProto = GetContactProto((HCONTACT)wParam); /* UserinfoEx */ - if (countryNumber = db_get_w((HANDLE)wParam, USERINFO, SET_CONTACT_ORIGIN_COUNTRY, 0)) + if (countryNumber = db_get_w((HCONTACT)wParam, USERINFO, SET_CONTACT_ORIGIN_COUNTRY, 0)) return countryNumber; - if (countryNumber = db_get_w((HANDLE)wParam, USERINFO, SET_CONTACT_COUNTRY, 0)) + if (countryNumber = db_get_w((HCONTACT)wParam, USERINFO, SET_CONTACT_COUNTRY, 0)) return countryNumber; - if (countryNumber = db_get_w((HANDLE)wParam, USERINFO, SET_CONTACT_COMPANY_COUNTRY, 0)) + if (countryNumber = db_get_w((HCONTACT)wParam, USERINFO, SET_CONTACT_COMPANY_COUNTRY, 0)) return countryNumber; /* fallback proto settings */ - if (countryNumber = db_get_w((HANDLE)wParam, pszProto, "Country", 0)) + if (countryNumber = db_get_w((HCONTACT)wParam, pszProto, "Country", 0)) return countryNumber; - if (countryNumber = db_get_w((HANDLE)wParam, pszProto, "CompanyCountry", 0)) + if (countryNumber = db_get_w((HCONTACT)wParam, pszProto, "CompanyCountry", 0)) return countryNumber; return (INT_PTR)0xFFFF; @@ -69,7 +69,7 @@ static void CALLBACK SetExtraImage(LPARAM lParam) { /* get contact's country */ int countryNumber = ServiceDetectContactOriginCountry(lParam, 0); - ExtraIcon_SetIcon(hExtraIconSvc, (HANDLE)lParam, (countryNumber != 0xFFFF || g_bUseUnknownFlag) ? LoadFlagHandle(countryNumber) : NULL); + ExtraIcon_SetIcon(hExtraIconSvc, (HCONTACT)lParam, (countryNumber != 0xFFFF || g_bUseUnknownFlag) ? LoadFlagHandle(countryNumber) : NULL); } static int OnCListApplyIcons(WPARAM wParam, LPARAM) @@ -82,7 +82,7 @@ static int OnCListApplyIcons(WPARAM wParam, LPARAM) * message winsow status icon functions ***********************************************************************************************************/ -MsgWndData::MsgWndData(HWND hwnd, HANDLE hContact) +MsgWndData::MsgWndData(HWND hwnd, HCONTACT hContact) { m_hwnd = hwnd; m_hContact = hContact; diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.h b/plugins/UserInfoEx/src/Flags/svc_flags.h index 71c0cb5bee..55d57a93ae 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.h +++ b/plugins/UserInfoEx/src/Flags/svc_flags.h @@ -33,11 +33,11 @@ extern bool g_eiGender, g_eiHome, g_eiEmail, g_eiPhone; struct MsgWndData { - HANDLE m_hContact; - HWND m_hwnd; - int m_countryID; + HCONTACT m_hContact; + HWND m_hwnd; + int m_countryID; - MsgWndData(HWND hwnd, HANDLE hContact); + MsgWndData(HWND hwnd, HCONTACT hContact); ~MsgWndData(); void FlagsIconSet(); diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp index 794af36cc8..2731b85bca 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.cpp +++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp @@ -255,7 +255,7 @@ MZodiac MAnnivDate::Zodiac() * param: hContact - handle to a contact to read the date from * return: 0 on success, 1 otherwise **/ -int MAnnivDate::DBGetReminderOpts(HANDLE hContact) +int MAnnivDate::DBGetReminderOpts(HCONTACT hContact) { if (!hContact || hContact == INVALID_HANDLE_VALUE) return 1; @@ -287,7 +287,7 @@ int MAnnivDate::DBGetReminderOpts(HANDLE hContact) * param: hContact - handle to a contact to read the date from * return: 0 on success, 1 otherwise **/ -int MAnnivDate::DBWriteReminderOpts(HANDLE hContact) +int MAnnivDate::DBWriteReminderOpts(HCONTACT hContact) { if (!hContact || hContact == INVALID_HANDLE_VALUE) return 1; @@ -336,7 +336,7 @@ int MAnnivDate::DBWriteReminderOpts(HANDLE hContact) * szYear - setting of the year to read * return: 0 on success, 1 otherwise **/ -int MAnnivDate::DBGetDate(HANDLE hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear) +int MAnnivDate::DBGetDate(HCONTACT hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear) { ZeroDate(); @@ -371,7 +371,7 @@ int MAnnivDate::DBGetDate(HANDLE hContact, LPCSTR pszModule, LPCSTR szDay, LPCST * szYear - setting of the year to read * return: 0 on success, 1 otherwise **/ -int MAnnivDate::DBWriteDate(HANDLE hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear) +int MAnnivDate::DBWriteDate(HCONTACT hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear) { return db_set_b(hContact, pszModule, szDay, (BYTE)Day()) || @@ -390,7 +390,7 @@ int MAnnivDate::DBWriteDate(HANDLE hContact, LPCSTR pszModule, LPCSTR szDay, LPC * szYear - setting of the year to read * return: 0 on success, 1 otherwise **/ -int MAnnivDate::DBDeleteDate(HANDLE hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear) const +int MAnnivDate::DBDeleteDate(HCONTACT hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear) const { int ret; @@ -413,7 +413,7 @@ int MAnnivDate::DBDeleteDate(HANDLE hContact, LPCSTR pszModule, LPCSTR szDay, LP * pszSetting - key used to identify the datestamp * return: 0 on success, 1 otherwise **/ -int MAnnivDate::DBGetDateStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting) +int MAnnivDate::DBGetDateStamp(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) { DBVARIANT dbv; if (DB::Setting::GetAsIs(hContact, pszModule, pszSetting, &dbv)) @@ -436,7 +436,7 @@ int MAnnivDate::DBGetDateStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSett * pszSetting - key used to save the datestamp * return: 0 on success, 1 otherwise **/ -int MAnnivDate::DBWriteDateStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting) +int MAnnivDate::DBWriteDateStamp(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) { if (hContact == INVALID_HANDLE_VALUE || pszModule == 0 || *pszModule == 0 || pszSetting == 0 || *pszSetting == 0) return 1; @@ -457,7 +457,7 @@ int MAnnivDate::DBWriteDateStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSe * pszProto - basic protocol module * return: 0 on success, 1 otherwise **/ -int MAnnivDate::DBGetBirthDate(HANDLE hContact, LPSTR pszProto) +int MAnnivDate::DBGetBirthDate(HCONTACT hContact, LPSTR pszProto) { Clear(); @@ -482,7 +482,7 @@ int MAnnivDate::DBGetBirthDate(HANDLE hContact, LPSTR pszProto) // try to get setting from the default subcontact first const int def = DB::MetaContact::SubDefNum(hContact); if (def > -1 && def < INT_MAX) { - HANDLE hSubContact = DB::MetaContact::Sub(hContact, def); + HCONTACT hSubContact = DB::MetaContact::Sub(hContact, def); if (hSubContact != NULL && !DBGetBirthDate(hSubContact, NULL)) { RemoveFlags(MADF_HASCUSTOM); SetFlags(MADF_HASMETA); @@ -496,7 +496,7 @@ int MAnnivDate::DBGetBirthDate(HANDLE hContact, LPSTR pszProto) if (cnt < INT_MAX) { for (int i = 0; i < cnt; i++) { if (i != def) { - HANDLE hSubContact = DB::MetaContact::Sub(hContact, i); + HCONTACT hSubContact = DB::MetaContact::Sub(hContact, i); if (hSubContact != NULL && !DBGetBirthDate(hSubContact, NULL)) { RemoveFlags(MADF_HASCUSTOM); SetFlags(MADF_HASMETA); @@ -521,7 +521,7 @@ int MAnnivDate::DBGetBirthDate(HANDLE hContact, LPSTR pszProto) * return: 0 on success, 1 otherwise **/ -int MAnnivDate::DBMoveBirthDate(HANDLE hContact, BYTE bOld, BYTE bNew) +int MAnnivDate::DBMoveBirthDate(HCONTACT hContact, BYTE bOld, BYTE bNew) { Clear(); switch(bOld) { @@ -556,7 +556,7 @@ int MAnnivDate::DBMoveBirthDate(HANDLE hContact, BYTE bOld, BYTE bNew) * return: 0 on success, 1 otherwise **/ -int MAnnivDate::DBWriteBirthDate(HANDLE hContact) +int MAnnivDate::DBWriteBirthDate(HCONTACT hContact) { LPCSTR pszModule = SvcReminderGetMyBirthdayModule(); @@ -599,7 +599,7 @@ int MAnnivDate::DBWriteBirthDate(HANDLE hContact) * return: 0 on success, 1 otherwise **/ -int MAnnivDate::DBDeleteBirthDate(HANDLE hContact) +int MAnnivDate::DBDeleteBirthDate(HCONTACT hContact) { return DBDeleteDate(hContact, Module(), SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR); } @@ -617,7 +617,7 @@ int MAnnivDate::DBDeleteBirthDate(HANDLE hContact) * return: 0 on success, 1 otherwise **/ -int MAnnivDate::DBGetAnniversaryDate(HANDLE hContact, WORD iIndex) +int MAnnivDate::DBGetAnniversaryDate(HCONTACT hContact, WORD iIndex) { Clear(); @@ -649,7 +649,7 @@ int MAnnivDate::DBGetAnniversaryDate(HANDLE hContact, WORD iIndex) * pszProto - basic protocol module * return: 0 on success, 1 otherwise **/ -int MAnnivDate::DBWriteAnniversaryDate(HANDLE hContact, WORD wIndex) +int MAnnivDate::DBWriteAnniversaryDate(HCONTACT hContact, WORD wIndex) { // date can only be written to db as anniversary if it is not marked as birthday if (wIndex <= ANID_LAST && _wID != ANID_BIRTHDAY) { @@ -673,7 +673,7 @@ int MAnnivDate::DBWriteAnniversaryDate(HANDLE hContact, WORD wIndex) * automatic backup service ***********************************************************************************************************/ -static WORD AskUser(HANDLE hContact, MAnnivDate *pOldCustomDate, MAnnivDate *pNewProtoDate) +static WORD AskUser(HCONTACT hContact, MAnnivDate *pOldCustomDate, MAnnivDate *pNewProtoDate) { MSGBOX MB; TCHAR szMsg[MAXDATASIZE]; @@ -707,7 +707,7 @@ static WORD AskUser(HANDLE hContact, MAnnivDate *pOldCustomDate, MAnnivDate *pNe * return: 0 if backup was done, 1 otherwise **/ -int MAnnivDate::BackupBirthday(HANDLE hContact, LPSTR pszProto, const BYTE bDontIgnoreAnything, PWORD lastAnswer) +int MAnnivDate::BackupBirthday(HCONTACT hContact, LPSTR pszProto, const BYTE bDontIgnoreAnything, PWORD lastAnswer) { if (!hContact) return 1; @@ -742,7 +742,7 @@ int MAnnivDate::BackupBirthday(HANDLE hContact, LPSTR pszProto, const BYTE bDont // allow backup only, if the custom setting differs from all meta subcontacts' protocol based settings, too. for (int i = 0; (i < nSubContactCount) && bWantBackup && bIsMeta; i++) { - HANDLE hSubContact = DB::MetaContact::Sub(hContact, i); + HCONTACT hSubContact = DB::MetaContact::Sub(hContact, i); if (hSubContact && !mdbIgnore.DBGetDate(hSubContact, pszProto, SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR)) bWantBackup = bWantBackup && !IsEqual(mdbIgnore.SystemTime()) @@ -767,7 +767,7 @@ int MAnnivDate::BackupBirthday(HANDLE hContact, LPSTR pszProto, const BYTE bDont // update metasubcontacts for (int i = 0; i < nSubContactCount; i++) { - HANDLE hSubContact = DB::MetaContact::Sub(hContact, i); + HCONTACT hSubContact = DB::MetaContact::Sub(hContact, i); if (hSubContact != NULL) { if (!mdbIgnore.DBGetDate(hSubContact, DB::Contact::Proto(hSubContact), SET_CONTACT_BIRTHDAY, SET_CONTACT_BIRTHMONTH, SET_CONTACT_BIRTHYEAR)) mdbIgnore.DBWriteDateStamp(hSubContact, USERINFO, SET_REMIND_BIRTHDAY_IGNORED); diff --git a/plugins/UserInfoEx/src/classMAnnivDate.h b/plugins/UserInfoEx/src/classMAnnivDate.h index acc3790b96..c2ebffbe89 100644 --- a/plugins/UserInfoEx/src/classMAnnivDate.h +++ b/plugins/UserInfoEx/src/classMAnnivDate.h @@ -50,8 +50,8 @@ private: BYTE _bRemind; // per user setting for reminder (0 - disabled, 1 - use local offset, 2 - use global offset) WORD _wDaysEarlier; // number of days to the anniversary the user wants to be reminded of this anniversary - int DBWriteDate(HANDLE hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear); - int DBDeleteDate(HANDLE hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear) const; + int DBWriteDate(HCONTACT hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear); + int DBDeleteDate(HCONTACT hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear) const; public: MAnnivDate(); @@ -93,23 +93,23 @@ public: void Clear(); // read date from database - int DBGetDate(HANDLE hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear); - int DBGetDateStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting); - int DBGetAnniversaryDate(HANDLE hContact, WORD iIndex); - int DBGetBirthDate(HANDLE hContact, LPSTR pszProto = NULL); - int DBGetReminderOpts(HANDLE hContact); + int DBGetDate(HCONTACT hContact, LPCSTR pszModule, LPCSTR szDay, LPCSTR szMonth, LPCSTR szYear); + int DBGetDateStamp(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting); + int DBGetAnniversaryDate(HCONTACT hContact, WORD iIndex); + int DBGetBirthDate(HCONTACT hContact, LPSTR pszProto = NULL); + int DBGetReminderOpts(HCONTACT hContact); // write date to database - int DBWriteDateStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting); - int DBWriteAnniversaryDate(HANDLE hContact, WORD wIndex); - int DBWriteBirthDate(HANDLE hContact); - int DBWriteReminderOpts(HANDLE hContact); + int DBWriteDateStamp(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting); + int DBWriteAnniversaryDate(HCONTACT hContact, WORD wIndex); + int DBWriteBirthDate(HCONTACT hContact); + int DBWriteReminderOpts(HCONTACT hContact); // delete date from database - int DBDeleteBirthDate(HANDLE hContact); + int DBDeleteBirthDate(HCONTACT hContact); - int DBMoveBirthDate(HANDLE hContact, BYTE bOld, BYTE bNew); - int BackupBirthday (HANDLE hContact, LPSTR pszProto = NULL, const BYTE bDontIgnoreAnything = FALSE, PWORD lastAnswer = NULL); + int DBMoveBirthDate(HCONTACT hContact, BYTE bOld, BYTE bNew); + int BackupBirthday (HCONTACT hContact, LPSTR pszProto = NULL, const BYTE bDontIgnoreAnything = FALSE, PWORD lastAnswer = NULL); // setting values void SetDate(SYSTEMTIME &st); diff --git a/plugins/UserInfoEx/src/classMTime.cpp b/plugins/UserInfoEx/src/classMTime.cpp index 0d5a42f9d8..5035d8eac9 100644 --- a/plugins/UserInfoEx/src/classMTime.cpp +++ b/plugins/UserInfoEx/src/classMTime.cpp @@ -408,7 +408,7 @@ void MTime::GetLocalTime() ::GetLocalTime(&_SysTime); } -void MTime::GetLocalTime(HANDLE hContact) +void MTime::GetLocalTime(HCONTACT hContact) { TIME_ZONE_INFORMATION tzi; @@ -423,7 +423,7 @@ void MTime::GetLocalTime(HANDLE hContact) * read and write time to miranda's database *********************************************/ -int MTime::DBGetStamp (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting) +int MTime::DBGetStamp (HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) { DWORD dwTimeStamp; @@ -446,7 +446,7 @@ int MTime::DBGetStamp (HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting) return 0; } -int MTime::DBWriteStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting) +int MTime::DBWriteStamp(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) { if (hContact == INVALID_HANDLE_VALUE || pszModule == NULL || pszModule[0] == 0 || diff --git a/plugins/UserInfoEx/src/classMTime.h b/plugins/UserInfoEx/src/classMTime.h index 99706578aa..1363a0247b 100644 --- a/plugins/UserInfoEx/src/classMTime.h +++ b/plugins/UserInfoEx/src/classMTime.h @@ -90,7 +90,7 @@ public: // get current time void GetTimeUTC(); void GetLocalTime(); - void GetLocalTime(HANDLE hContact); + void GetLocalTime(HCONTACT hContact); // conversions void UTCToLocal(); @@ -100,8 +100,8 @@ public: void TzSpecificLocalToUTC(TIME_ZONE_INFORMATION *tzi); // read and write from and to db - int DBGetStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting); - int DBWriteStamp(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting); + int DBGetStamp(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting); + int DBWriteStamp(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting); // operatoren void operator = (DWORD& dwTimeStamp) { FromStampAsUTC(dwTimeStamp); }; diff --git a/plugins/UserInfoEx/src/ctrl_annivedit.cpp b/plugins/UserInfoEx/src/ctrl_annivedit.cpp index f0da0189d1..c0041d26e5 100644 --- a/plugins/UserInfoEx/src/ctrl_annivedit.cpp +++ b/plugins/UserInfoEx/src/ctrl_annivedit.cpp @@ -140,7 +140,7 @@ void CAnnivEditCtrl::EnableCurrentItem() MAnnivDate *pCurrent = Current(); if (pCurrent) { - HANDLE hContact; + HCONTACT hContact; PSGetContact(_hwndDlg, hContact); @@ -233,8 +233,8 @@ INT_PTR CAnnivEditCtrl::DeleteDate(WORD wIndex) // only delete values, but not the item if (_pDates[wIndex]->Id() == ANID_BIRTHDAY) { - HANDLE hContact; - LPCSTR pszProto; + HCONTACT hContact; + LPCSTR pszProto; PSGetContact(_hwndDlg, hContact); PSGetBaseProto(_hwndDlg, pszProto); @@ -273,7 +273,7 @@ INT_PTR CAnnivEditCtrl::DeleteDate(WORD wIndex) * param: * return: 0 on success 1 otherwise **/ -INT_PTR CAnnivEditCtrl::DBGetBirthDay(HANDLE hContact, LPCSTR pszProto) +INT_PTR CAnnivEditCtrl::DBGetBirthDay(HCONTACT hContact, LPCSTR pszProto) { MAnnivDate mdb; @@ -290,7 +290,7 @@ INT_PTR CAnnivEditCtrl::DBGetBirthDay(HANDLE hContact, LPCSTR pszProto) * param: * return: 0 on success 1 otherwise **/ -INT_PTR CAnnivEditCtrl::DBGetAnniversaries(HANDLE hContact) +INT_PTR CAnnivEditCtrl::DBGetAnniversaries(HCONTACT hContact) { MAnnivDate mda; @@ -317,7 +317,7 @@ INT_PTR CAnnivEditCtrl::DBGetAnniversaries(HANDLE hContact) * param: hContact - the contact to write the anniversaries to * return: 0 on success 1 otherwise **/ -INT_PTR CAnnivEditCtrl::DBWriteBirthDay(HANDLE hContact) +INT_PTR CAnnivEditCtrl::DBWriteBirthDay(HCONTACT hContact) { MAnnivDate *pmdb; @@ -346,7 +346,7 @@ INT_PTR CAnnivEditCtrl::DBWriteBirthDay(HANDLE hContact) * param: hContact - the contact to write the anniversaries to * return: 0 on success 1 otherwise **/ -INT_PTR CAnnivEditCtrl::DBWriteAnniversaries(HANDLE hContact) +INT_PTR CAnnivEditCtrl::DBWriteAnniversaries(HCONTACT hContact) { const LPCSTR szPrefix[] = { "Reminder", "Offset", "Desc", "Day", "Month", "Year", "Stamp", "Date" }; CHAR szSet0[MAXSETTING]; @@ -526,7 +526,7 @@ void CAnnivEditCtrl::OnRemindEditChanged() **/ void CAnnivEditCtrl::OnReminderChecked() { - HANDLE hContact; + HCONTACT hContact; LPCSTR pszProto; int state; TCHAR buf[6]; @@ -606,7 +606,7 @@ void CAnnivEditCtrl::SetZodiacAndAge(MAnnivDate *mt) } } -BOOL CAnnivEditCtrl::OnInfoChanged(HANDLE hContact, LPCSTR pszProto) +BOOL CAnnivEditCtrl::OnInfoChanged(HCONTACT hContact, LPCSTR pszProto) { BOOL bChanged; bChanged = DBGetBirthDay(hContact, pszProto); @@ -616,7 +616,7 @@ BOOL CAnnivEditCtrl::OnInfoChanged(HANDLE hContact, LPCSTR pszProto) return bChanged; } -void CAnnivEditCtrl::OnApply(HANDLE hContact, LPCSTR pszProto) +void CAnnivEditCtrl::OnApply(HCONTACT hContact, LPCSTR pszProto) { DBWriteBirthDay(hContact); DBWriteAnniversaries(hContact); diff --git a/plugins/UserInfoEx/src/ctrl_annivedit.h b/plugins/UserInfoEx/src/ctrl_annivedit.h index ee6307f8ed..932fe8f49f 100644 --- a/plugins/UserInfoEx/src/ctrl_annivedit.h +++ b/plugins/UserInfoEx/src/ctrl_annivedit.h @@ -42,11 +42,11 @@ class CAnnivEditCtrl : public CBaseCtrl BYTE ItemValid(WORD wIndex) const; BYTE CurrentItemValid() const; - INT_PTR DBGetBirthDay(HANDLE hContact, LPCSTR pszProto); - INT_PTR DBWriteBirthDay(HANDLE hContact); + INT_PTR DBGetBirthDay(HCONTACT hContact, LPCSTR pszProto); + INT_PTR DBWriteBirthDay(HCONTACT hContact); - INT_PTR DBGetAnniversaries(HANDLE hContact); - INT_PTR DBWriteAnniversaries(HANDLE hContact); + INT_PTR DBGetAnniversaries(HCONTACT hContact); + INT_PTR DBWriteAnniversaries(HCONTACT hContact); CAnnivEditCtrl(HWND hDlg, WORD idCtrl, LPCSTR pszSetting); ~CAnnivEditCtrl(); @@ -87,8 +87,8 @@ public: static CBaseCtrl* CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszSetting); virtual void Release(); - virtual BOOL OnInfoChanged(HANDLE hContact, LPCSTR pszProto); - virtual void OnApply(HANDLE hContact, LPCSTR pszProto); + virtual BOOL OnInfoChanged(HCONTACT hContact, LPCSTR pszProto); + virtual void OnApply(HCONTACT hContact, LPCSTR pszProto); }; #endif /* _UINFOEX_CTRLANNIVEDIT_H_ */ \ No newline at end of file diff --git a/plugins/UserInfoEx/src/ctrl_base.cpp b/plugins/UserInfoEx/src/ctrl_base.cpp index 070ae8eb7f..5e90f7f989 100644 --- a/plugins/UserInfoEx/src/ctrl_base.cpp +++ b/plugins/UserInfoEx/src/ctrl_base.cpp @@ -219,7 +219,7 @@ void CCtrlList::OnReset() * * **/ -BOOL CCtrlList::OnInfoChanged(HANDLE hContact, LPCSTR pszProto) +BOOL CCtrlList::OnInfoChanged(HCONTACT hContact, LPCSTR pszProto) { BOOL bChanged = 0; INT_PTR i; @@ -238,7 +238,7 @@ BOOL CCtrlList::OnInfoChanged(HANDLE hContact, LPCSTR pszProto) * * **/ -void CCtrlList::OnApply(HANDLE hContact, LPCSTR pszProto) +void CCtrlList::OnApply(HCONTACT hContact, LPCSTR pszProto) { INT_PTR i; diff --git a/plugins/UserInfoEx/src/ctrl_base.h b/plugins/UserInfoEx/src/ctrl_base.h index d0bf2b50fb..20ef261090 100644 --- a/plugins/UserInfoEx/src/ctrl_base.h +++ b/plugins/UserInfoEx/src/ctrl_base.h @@ -163,7 +163,7 @@ public: * @retval TRUE - the content was updated * @retval FALSE - content not updated **/ - virtual BOOL OnInfoChanged(HANDLE hContact, LPCSTR pszProto) { return 0; } + virtual BOOL OnInfoChanged(HCONTACT hContact, LPCSTR pszProto) { return 0; } /** * This is a pure virtual method, which is the common interface @@ -174,7 +174,7 @@ public: * * @return nothing **/ - virtual void OnApply(HANDLE hContact, LPCSTR pszProto) { } + virtual void OnApply(HCONTACT hContact, LPCSTR pszProto) { } /** * This is a pure virtual method, which is called to set the @@ -220,8 +220,8 @@ public: void Release(); void OnReset(); - BOOL OnInfoChanged(HANDLE hContact, LPCSTR pszProto); - void OnApply(HANDLE hContact, LPCSTR pszProto); + BOOL OnInfoChanged(HCONTACT hContact, LPCSTR pszProto); + void OnApply(HCONTACT hContact, LPCSTR pszProto); void OnChangedByUser(WORD idCtrl, WORD wChangedMsg); INT_PTR OnSetTextColour(HWND hCtrl, HDC hdc); }; diff --git a/plugins/UserInfoEx/src/ctrl_combo.cpp b/plugins/UserInfoEx/src/ctrl_combo.cpp index 1eb3817f3e..42a6d6df00 100644 --- a/plugins/UserInfoEx/src/ctrl_combo.cpp +++ b/plugins/UserInfoEx/src/ctrl_combo.cpp @@ -148,7 +148,7 @@ void CCombo::Release() * * @return nothing **/ -BOOL CCombo::OnInfoChanged(HANDLE hContact, LPCSTR pszProto) +BOOL CCombo::OnInfoChanged(HCONTACT hContact, LPCSTR pszProto) { if (!_Flags.B.hasChanged && _pList != NULL) { @@ -196,7 +196,7 @@ BOOL CCombo::OnInfoChanged(HANDLE hContact, LPCSTR pszProto) * * @return nothing **/ -void CCombo::OnApply(HANDLE hContact, LPCSTR pszProto) +void CCombo::OnApply(HCONTACT hContact, LPCSTR pszProto) { if (_Flags.B.hasChanged) { diff --git a/plugins/UserInfoEx/src/ctrl_combo.h b/plugins/UserInfoEx/src/ctrl_combo.h index 5e0db3b196..ad5ea0aa54 100644 --- a/plugins/UserInfoEx/src/ctrl_combo.h +++ b/plugins/UserInfoEx/src/ctrl_combo.h @@ -61,8 +61,8 @@ public: static CBaseCtrl* CreateObj(HWND hDlg, WORD idCtrl, LPCSTR pszSetting, BYTE bDBDataType, LPIDSTRLIST pList, int nListCount); virtual void Release(); - virtual BOOL OnInfoChanged(HANDLE hContact, LPCSTR pszProto); - virtual void OnApply(HANDLE hContact, LPCSTR pszProto); + virtual BOOL OnInfoChanged(HCONTACT hContact, LPCSTR pszProto); + virtual void OnApply(HCONTACT hContact, LPCSTR pszProto); virtual void OnChangedByUser(WORD wChangedMsg); }; diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index 1efda63861..12286d6f71 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -690,7 +690,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L cbi.dwID = 0; if (DialogBoxParam(ghInst, MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) { - HANDLE hContact = NULL; + HCONTACT hContact = NULL; SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact); if (hContact) cbi.wFlags |= CTRLF_HASCUSTOM; @@ -748,7 +748,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L } if (DialogBoxParam(ghInst, MAKEINTRESOURCE(dlgID), GetParent(hwnd), dlgProc, (LPARAM)&cbi) == IDOK) { - HANDLE hContact; + HCONTACT hContact; SendMessage(hDlgDetails, PSM_GETCONTACT, NULL, (LPARAM)&hContact); if (hContact) cbi.wFlags |= CTRLF_HASCUSTOM; @@ -826,7 +826,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L { TCHAR szVal[MAXDATASIZE] = { 0 }; int ccVal; - HANDLE hContact; + HCONTACT hContact; HWND hDlgDetails = GetParent(GetParent(hwnd)); EnableWindow(cbex->hBtnDel, GetWindowTextLength(cbex->hEdit) > 0); @@ -1124,7 +1124,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L **/ case CBEXM_ENABLEITEM: if (cbex->iSelectedItem >= 0 && cbex->iSelectedItem < cbex->numItems) { - HANDLE hContact; + HCONTACT hContact; BYTE bEnabled; PSGetContact(GetParent(hwnd), hContact); @@ -1277,7 +1277,7 @@ int CtrlContactAddItemFromDB( HWND hCtrl, LPCSTR szIcon, LPTSTR szItem, - HANDLE hContact, + HCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szSettingVal) @@ -1330,7 +1330,7 @@ int CtrlContactAddMyItemsFromDB( HWND hCtrl, LPCSTR szIcon, WORD wForcedFlags, - HANDLE hContact, + HCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szFormatCat, @@ -1406,7 +1406,7 @@ int CtrlContactAddMyItemsFromDB( **/ int CtrlContactWriteItemToDB( HWND hCtrl, - HANDLE hContact, + HCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR pszSetting) @@ -1448,7 +1448,7 @@ int CtrlContactWriteItemToDB( int CtrlContactWriteMyItemsToDB( HWND hCtrl, int iFirstItem, - HANDLE hContact, + HCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szFormatCat, diff --git a/plugins/UserInfoEx/src/ctrl_contact.h b/plugins/UserInfoEx/src/ctrl_contact.h index 69b57bac0a..92cc6894ff 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.h +++ b/plugins/UserInfoEx/src/ctrl_contact.h @@ -69,9 +69,9 @@ typedef struct TComboExItem int CtrlContactLoadModule(); int CtrlContactUnLoadModule(); -int CtrlContactAddItemFromDB(HWND hCtrl, LPCSTR szIcon, LPTSTR szItem, HANDLE hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szSettingVal); -int CtrlContactAddMyItemsFromDB(HWND hCtrl, LPCSTR szIcon, WORD wForcedFlags, HANDLE hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szFormatCat, LPCSTR szFormatVal); -int CtrlContactWriteItemToDB(HWND hCtrl, HANDLE hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR pszSetting); -int CtrlContactWriteMyItemsToDB(HWND hCtrl, int iFirstItem, HANDLE hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szFormatCat, LPCSTR szFormatVal); +int CtrlContactAddItemFromDB(HWND hCtrl, LPCSTR szIcon, LPTSTR szItem, HCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szSettingVal); +int CtrlContactAddMyItemsFromDB(HWND hCtrl, LPCSTR szIcon, WORD wForcedFlags, HCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szFormatCat, LPCSTR szFormatVal); +int CtrlContactWriteItemToDB(HWND hCtrl, HCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR pszSetting); +int CtrlContactWriteMyItemsToDB(HWND hCtrl, int iFirstItem, HCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR szFormatCat, LPCSTR szFormatVal); #endif /* _UI_CTRL_INCLUDE_ */ \ No newline at end of file diff --git a/plugins/UserInfoEx/src/ctrl_edit.cpp b/plugins/UserInfoEx/src/ctrl_edit.cpp index 2d25aa7213..c87490dba0 100644 --- a/plugins/UserInfoEx/src/ctrl_edit.cpp +++ b/plugins/UserInfoEx/src/ctrl_edit.cpp @@ -105,7 +105,7 @@ void CEditCtrl::OnReset() * * @return nothing **/ -BOOL CEditCtrl::OnInfoChanged(HANDLE hContact, LPCSTR pszProto) +BOOL CEditCtrl::OnInfoChanged(HCONTACT hContact, LPCSTR pszProto) { if (!_Flags.B.hasChanged) { @@ -165,7 +165,7 @@ BOOL CEditCtrl::OnInfoChanged(HANDLE hContact, LPCSTR pszProto) * * @return nothing **/ -void CEditCtrl::OnApply(HANDLE hContact, LPCSTR pszProto) +void CEditCtrl::OnApply(HCONTACT hContact, LPCSTR pszProto) { if (_Flags.B.hasChanged) { diff --git a/plugins/UserInfoEx/src/ctrl_edit.h b/plugins/UserInfoEx/src/ctrl_edit.h index de95a46226..4e569645ba 100644 --- a/plugins/UserInfoEx/src/ctrl_edit.h +++ b/plugins/UserInfoEx/src/ctrl_edit.h @@ -57,8 +57,8 @@ public: virtual void Release(); virtual void OnReset(); - virtual BOOL OnInfoChanged(HANDLE hContact, LPCSTR pszProto); - virtual void OnApply(HANDLE hContact, LPCSTR pszProto); + virtual BOOL OnInfoChanged(HCONTACT hContact, LPCSTR pszProto); + virtual void OnApply(HCONTACT hContact, LPCSTR pszProto); virtual void OnChangedByUser(WORD wChangedMsg); void OpenUrl(); diff --git a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp index 76152e13c4..d98c591f34 100644 --- a/plugins/UserInfoEx/src/ctrl_tzcombo.cpp +++ b/plugins/UserInfoEx/src/ctrl_tzcombo.cpp @@ -157,7 +157,7 @@ void CTzCombo::Release() * * @return _Flags.B.hasChanged member **/ -BOOL CTzCombo::OnInfoChanged(HANDLE hContact, LPCSTR pszProto) +BOOL CTzCombo::OnInfoChanged(HCONTACT hContact, LPCSTR pszProto) { if (!_Flags.B.hasChanged) { //use new core tz interface to change the cbbox @@ -198,7 +198,7 @@ BOOL CTzCombo::OnInfoChanged(HANDLE hContact, LPCSTR pszProto) * * @return nothing **/ -void CTzCombo::OnApply(HANDLE hContact, LPCSTR pszProto) +void CTzCombo::OnApply(HCONTACT hContact, LPCSTR pszProto) { if (_Flags.B.hasChanged) { diff --git a/plugins/UserInfoEx/src/ctrl_tzcombo.h b/plugins/UserInfoEx/src/ctrl_tzcombo.h index 7c87c0ce2b..487792ebd5 100644 --- a/plugins/UserInfoEx/src/ctrl_tzcombo.h +++ b/plugins/UserInfoEx/src/ctrl_tzcombo.h @@ -46,8 +46,8 @@ public: virtual void Release(); // virtual void OnReset() {}; - virtual BOOL OnInfoChanged(HANDLE hContact, LPCSTR pszProto); - virtual void OnApply(HANDLE hContact, LPCSTR pszProto); + virtual BOOL OnInfoChanged(HCONTACT hContact, LPCSTR pszProto); + virtual void OnApply(HCONTACT hContact, LPCSTR pszProto); virtual void OnChangedByUser(WORD wChangedMsg); void GetTime(LPTSTR szTime, WORD cchTime); diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index 00ad372ef0..d451d11ad5 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -91,12 +91,12 @@ class CAnnivList struct CItemData { - HANDLE _hContact; + HCONTACT _hContact; MAnnivDate* _pDate; WORD _wDaysBefore; BYTE _wReminderState; - CItemData(HANDLE hContact, MAnnivDate &date) + CItemData(HCONTACT hContact, MAnnivDate &date) { _hContact = hContact; _wReminderState = date.RemindOption(); @@ -740,7 +740,7 @@ class CAnnivList * @retval TRUE if successful * @retval FALSE if failed **/ - BYTE AddRow(HANDLE hContact, LPCSTR pszProto, MAnnivDate &ad, MTime &mtNow, WORD wDaysBefore) + BYTE AddRow(HCONTACT hContact, LPCSTR pszProto, MAnnivDate &ad, MTime &mtNow, WORD wDaysBefore) { TCHAR szText[MAX_PATH]; int diff, iItem = -1; @@ -810,7 +810,6 @@ class CAnnivList **/ void RebuildList() { - HANDLE hContact; LPSTR pszProto; MTime mtNow; MAnnivDate ad; @@ -827,7 +826,7 @@ class CAnnivList mtNow.GetLocalTime(); // insert the items into the list - for (hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { // ignore meta subcontacts here, as they are not interesting. if (!DB::MetaContact::IsSub(hContact)) { @@ -835,15 +834,13 @@ class CAnnivList pszProto = DB::Contact::Proto(hContact); if (pszProto) { numContacts++; - switch (GenderOf(hContact, pszProto)) - { - case 'M': { - numMale++; - } break; + switch (GenderOf(hContact, pszProto)) { + case 'M': + numMale++; + break; - case 'F': { - numFemale++; - } + case 'F': + numFemale++; } if (!ad.DBGetBirthDate(hContact, pszProto)) { diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp index 06a470f67d..470d988a1f 100644 --- a/plugins/UserInfoEx/src/dlg_msgbox.cpp +++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp @@ -613,7 +613,7 @@ static LRESULT CALLBACK PopupProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP /** * This is the service function for external plugins to use the nice messagebox * -* @param wParam - HANDLE hContact which can display an avatar for popups +* @param wParam - HCONTACT hContact which can display an avatar for popups * @param lParam - MSGBOX structure holding parameters * * @return The function returns the ID of the clicked button (IDOK, IDCANCEL, ...) diff --git a/plugins/UserInfoEx/src/dlg_propsheet.cpp b/plugins/UserInfoEx/src/dlg_propsheet.cpp index 978da21f4f..653f9c77b2 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.cpp +++ b/plugins/UserInfoEx/src/dlg_propsheet.cpp @@ -253,7 +253,7 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam) myGlobals.WantAeroAdaption = db_get_b(NULL, MODNAME, SET_PROPSHEET_AEROADAPTION, TRUE); // allow only one dialog per user - if (HWND hWnd = WindowList_Find(ghWindowList, (HANDLE)wParam)) { + if (HWND hWnd = WindowList_Find(ghWindowList, (HCONTACT)wParam)) { SetForegroundWindow(hWnd); SetFocus(hWnd); return 0; @@ -285,7 +285,7 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam) ImageList_AddIcon(psh._hImages, hDefIcon); // init contact - psh._hContact = (HANDLE)wParam; + psh._hContact = (HCONTACT)wParam; if (psh._hContact == NULL) { // mark owner icons as initiated bInitIcons |= INIT_ICONS_OWNER; @@ -294,7 +294,7 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam) } else { // get contact's protocol - psh._pszPrefix = psh._pszProto = DB::Contact::Proto((HANDLE)wParam); + psh._pszPrefix = psh._pszProto = DB::Contact::Proto((HCONTACT)wParam); if (psh._pszProto == NULL) { MsgErr(NULL, LPGENT("Could not find contact's protocol. Maybe it is not active!")); return 1; @@ -313,12 +313,12 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam) // metacontacts sub pages if (bScanMetaSubContacts) { - int numSubs = DB::MetaContact::SubCount((HANDLE)wParam); + int numSubs = DB::MetaContact::SubCount((HCONTACT)wParam); psh._dwFlags &= ~PSF_PROTOPAGESONLY_INIT; psh._dwFlags |= PSF_PROTOPAGESONLY; for (int i = 0; i < numSubs; i++) { - psh._hContact = DB::MetaContact::Sub((HANDLE)wParam, i); + psh._hContact = DB::MetaContact::Sub((HCONTACT)wParam, i); psh._nSubContact = i; if (psh._hContact) { psh._pszProto = DB::Contact::Proto(psh._hContact); @@ -326,7 +326,7 @@ static INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam) NotifyEventHooks(ghDetailsInitEvent, (WPARAM)&psh, (LPARAM)psh._hContact); } } - psh._hContact = (HANDLE)wParam; + psh._hContact = (HCONTACT)wParam; } // sort the pages by the position read from database @@ -409,10 +409,10 @@ static INT_PTR AddPage(WPARAM wParam, LPARAM lParam) **/ static int OnDeleteContact(WPARAM wParam, LPARAM lParam) { - HWND hWnd = WindowList_Find(ghWindowList, (HANDLE)wParam); - if (hWnd != NULL) - DestroyWindow(hWnd); - return 0; + HWND hWnd = WindowList_Find(ghWindowList, (HCONTACT)wParam); + if (hWnd != NULL) + DestroyWindow(hWnd); + return 0; } /** @@ -1356,7 +1356,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar **/ case HM_SETTING_CHANGED: if (!(pPs->dwFlags & PSF_LOCKED)) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING*)lParam; if (hContact != pPs->hContact) { @@ -1593,7 +1593,7 @@ static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar // count valid subcontacts whose protocol supports the PSS_GETINFO service to update the information int numSubs = DB::MetaContact::SubCount(pPs->hContact); for (int i = 0; i < numSubs; i++) { - HANDLE hSubContact = DB::MetaContact::Sub(pPs->hContact, i); + HCONTACT hSubContact = DB::MetaContact::Sub(pPs->hContact, i); if (hSubContact != NULL) { if (ProtoServiceExists(DB::Contact::Proto(hSubContact), PSS_GETINFO)) { pPs->infosUpdated = (TAckInfo*)mir_realloc(pPs->infosUpdated, sizeof(TAckInfo)* (pPs->nSubContacts + 1)); diff --git a/plugins/UserInfoEx/src/dlg_propsheet.h b/plugins/UserInfoEx/src/dlg_propsheet.h index c7965e5693..dce0416454 100644 --- a/plugins/UserInfoEx/src/dlg_propsheet.h +++ b/plugins/UserInfoEx/src/dlg_propsheet.h @@ -40,7 +40,7 @@ class CPsTreeItem DWORD _dwFlags; // some flags int _iPosition; // initiating position if custom (used for sorting) LPARAM _initParam; - HANDLE _hContact; // contact the page is accociated with (may be a meta subcontact if details dialog is shown for a meta contact) + HCONTACT _hContact; // contact the page is accociated with (may be a meta subcontact if details dialog is shown for a meta contact) LPCSTR _pszProto; // protocol the page is accociated with (is the contact's protocol if _hContact is not NULL) LPCSTR _pszPrefix; // pointer to the dialog owning contact's protocol @@ -68,7 +68,7 @@ public: __inline LPCSTR Proto() const { return _pszProto; }; __inline LPTSTR Label() const { return _ptszLabel; }; void Rename( const LPTSTR pszLabel ); - __inline HANDLE hContact() const { return _hContact; }; + __inline HCONTACT hContact() const { return _hContact; }; __inline HWND Wnd() const { return _hWnd; }; __inline int DlgId() const { return _idDlg; }; @@ -219,7 +219,7 @@ class CPsHdr { public: DWORD _dwSize; // size of this class in bytes - HANDLE _hContact; // handle to the owning contact + HCONTACT _hContact; // handle to the owning contact LPCSTR _pszProto; // owning contact's protocol LPCSTR _pszPrefix; // name prefix for treeitem settings CPsTreeItem** _pPages; // the pages @@ -238,15 +238,15 @@ public: struct TAckInfo { - HANDLE hContact; - LPINT/*PINT_PTR*/ acks; - int count; + HCONTACT hContact; + LPINT acks; + int count; }; struct TPropSheet { // dialogs owner - HANDLE hContact; + HCONTACT hContact; CHAR pszProto[MAXMODULELABELLENGTH]; HANDLE hProtoAckEvent; // eventhook for protocol acks diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index 0906dacaae..efb32e0efc 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -30,17 +30,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. **/ CExImContactBase::CExImContactBase() { - _pszNick = NULL; - _pszDisp = NULL; - _pszGroup = NULL; - _pszProto = NULL; - _pszProtoOld = NULL; - _pszAMPro = NULL; - _pszUIDKey = NULL; - _dbvUIDHash = NULL; + _pszNick = NULL; + _pszDisp = NULL; + _pszGroup = NULL; + _pszProto = NULL; + _pszProtoOld = NULL; + _pszAMPro = NULL; + _pszUIDKey = NULL; + _dbvUIDHash = NULL; ZeroMemory(&_dbvUID, sizeof(DBVARIANT)); - _hContact = INVALID_HANDLE_VALUE; - _isNewContact = FALSE; + _hContact = (HCONTACT)INVALID_HANDLE_VALUE; + _isNewContact = FALSE; } /** @@ -69,7 +69,7 @@ CExImContactBase::~CExImContactBase() * param: hContact - handle to contact whose information to read * return: TRUE if successful or FALSE otherwise **/ -BYTE CExImContactBase::fromDB(HANDLE hContact) +BYTE CExImContactBase::fromDB(HCONTACT hContact) { BYTE ret = FALSE; BYTE isChatRoom = FALSE; @@ -224,15 +224,14 @@ BYTE CExImContactBase::fromIni(LPSTR& row) * param: hMetaContact - a meta contact to add this contact to * return: handle of the contact if successful **/ -HANDLE CExImContactBase::toDB() +HCONTACT CExImContactBase::toDB() { // create new contact if none exists if (_hContact == INVALID_HANDLE_VALUE && _pszProto && _pszUIDKey && _dbvUID.type != DBVT_DELETED) { PROTOACCOUNT* pszAccount = 0; if (NULL == (pszAccount = ProtoGetAccount( _pszProto ))) { //account does not exist - _hContact = INVALID_HANDLE_VALUE; - return INVALID_HANDLE_VALUE; + return _hContact = (HCONTACT)INVALID_HANDLE_VALUE; } if (!IsAccountEnabled(pszAccount)) { ; @@ -240,20 +239,17 @@ HANDLE CExImContactBase::toDB() // create new contact _hContact = DB::Contact::Add(); if (!_hContact) { - _hContact = INVALID_HANDLE_VALUE; - return INVALID_HANDLE_VALUE; + return _hContact = (HCONTACT)INVALID_HANDLE_VALUE; } // Add the protocol to the new contact if (CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)_hContact, (LPARAM)_pszProto)) { DB::Contact::Delete(_hContact); - _hContact = INVALID_HANDLE_VALUE; - return INVALID_HANDLE_VALUE; + return _hContact = (HCONTACT)INVALID_HANDLE_VALUE; } // write uid to protocol module if (db_set(_hContact, _pszProto, _pszUIDKey, &_dbvUID)) { DB::Contact::Delete(_hContact); - _hContact = INVALID_HANDLE_VALUE; - return INVALID_HANDLE_VALUE; + return _hContact = (HCONTACT)INVALID_HANDLE_VALUE; } // write nick and display name if (_pszNick) db_set_utf(_hContact, _pszProto, SET_CONTACT_NICK, _pszNick); @@ -477,7 +473,7 @@ BYTE CExImContactBase::isMeta() const return DB::Module::IsMeta(_pszProto); } -BYTE CExImContactBase::isHandle(HANDLE hContact) +BYTE CExImContactBase::isHandle(HCONTACT hContact) { LPCSTR pszProto; DBVARIANT dbv; @@ -527,10 +523,7 @@ BYTE CExImContactBase::isHandle(HANDLE hContact) **/ HANDLE CExImContactBase::findHandle() { - HANDLE hContact; - - for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) - { + for (HCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { if (isHandle(hContact)) { _hContact = hContact; _isNewContact = FALSE; @@ -538,6 +531,5 @@ HANDLE CExImContactBase::findHandle() } } _isNewContact = TRUE; - _hContact = INVALID_HANDLE_VALUE; - return INVALID_HANDLE_VALUE; + return _hContact = (HCONTACT)INVALID_HANDLE_VALUE; } diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.h b/plugins/UserInfoEx/src/ex_import/classExImContactBase.h index 377b341c3e..c9bb3fee24 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.h +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.h @@ -36,7 +36,7 @@ protected: LPSTR _pszUIDKey; DWORD _dbvUIDHash; DBVARIANT _dbvUID; - HANDLE _hContact; + HCONTACT _hContact; BYTE _isNewContact; // is this contact a new one? HANDLE findHandle(); @@ -52,7 +52,7 @@ public: // __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 HANDLE handle() const { return _hContact; } + __inline HCONTACT handle() const { return _hContact; } __inline void disp(LPCSTR val) { _pszDisp = val ? mir_strdup(val): NULL; } __inline void group(LPCSTR val) { _pszGroup = val ? mir_strdup(val): NULL; } @@ -77,16 +77,16 @@ public: mir_free(temp); } - BYTE isHandle(HANDLE hContact); - BYTE isMeta() const; + BYTE isHandle(HCONTACT hContact); + BYTE isMeta() const; - LPSTR uid2String(BYTE bPrependType); + LPSTR uid2String(BYTE bPrependType); - BYTE fromDB(HANDLE hContact); - BYTE fromIni(LPSTR& row); + BYTE fromDB(HCONTACT hContact); + BYTE fromIni(LPSTR& row); - HANDLE toDB(); - void toIni(FILE* file, int modCount); + HCONTACT toDB(); + void toIni(FILE* file, int modCount); - BYTE operator = (HANDLE hContact) { return fromDB(hContact); } + BYTE operator = (HCONTACT hContact) { return fromDB(hContact); } }; diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index a292f6d803..8aa92d5285 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -219,7 +219,7 @@ int CExImContactXML::Export(FILE *xmlfile, DB::CEnumList* pModules) const int cnt = DB::MetaContact::SubCount(_hContact); const int def = DB::MetaContact::SubDefNum(_hContact); - HANDLE hSubContact = DB::MetaContact::Sub(_hContact, def); + HCONTACT hSubContact = DB::MetaContact::Sub(_hContact, def); // export default subcontact if (hSubContact && vContact.fromDB(hSubContact)) @@ -488,7 +488,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) // delete last contact db_free(&_dbvUID); - _hContact = INVALID_HANDLE_VALUE; + _hContact = (HCONTACT)INVALID_HANDLE_VALUE; _xmlNode = xContact; MIR_FREE(_pszAMPro); ampro(xContact->Attribute("ampro")); @@ -511,7 +511,7 @@ int CExImContactXML::LoadXmlElemnt(TiXmlElement *xContact) if (vSub = xSub) { // identify metacontact by the first valid subcontact in xmlfile if (_hContact == INVALID_HANDLE_VALUE && vSub.handle() != INVALID_HANDLE_VALUE) { - HANDLE hMeta = (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)vSub.handle(), NULL); + HCONTACT hMeta = (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)vSub.handle(), NULL); if (hMeta != NULL) { _hContact = hMeta; break; @@ -610,7 +610,7 @@ int CExImContactXML::ImportContact() LPGENT("You aborted import of a new contact.\nSome information may be missing for this contact.\n\nDo you want to delete the incomplete contact?")); if (result == IDYES) { DB::Contact::Delete(_hContact); - _hContact = INVALID_HANDLE_VALUE; + _hContact = (HCONTACT)INVALID_HANDLE_VALUE; } } return ERROR_ABORTED; @@ -674,9 +674,9 @@ int CExImContactXML::Import(BYTE keepMetaSubContact) return result; // convert default subcontact to metacontact - _hContact = (HANDLE)CallService(MS_MC_CONVERTTOMETA, (WPARAM)vContact.handle(), NULL); + _hContact = (HCONTACT)CallService(MS_MC_CONVERTTOMETA, (WPARAM)vContact.handle(), NULL); if (_hContact == NULL) { - _hContact = INVALID_HANDLE_VALUE; + _hContact = (HCONTACT)INVALID_HANDLE_VALUE; return ERROR_CONVERT_METACONTACT; } @@ -753,7 +753,7 @@ int CExImContactXML::ImportMetaSubContact(CExImContactXML * pMetaContact) MIR_FREE(ptszMetaNick); if (result == IDYES) { DB::Contact::Delete(_hContact); - _hContact = INVALID_HANDLE_VALUE; + _hContact = (HCONTACT)INVALID_HANDLE_VALUE; } } return ERROR_ADDTO_METACONTACT; diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index d170c6d993..1c552187e2 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -292,7 +292,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar // module must exist in at least one contact if (pDat->ExImContact->Typ != EXIM_CONTACT) // TRUE = All Contacts { - HANDLE hContact; + HCONTACT hContact; for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) { diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp index 1949ae96f0..3ddfbe0f93 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp @@ -37,7 +37,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * file - file to write the settings to * return nothing **/ -static void ExportModule(HANDLE hContact, LPCSTR pszModule, FILE* file) +static void ExportModule(HCONTACT hContact, LPCSTR pszModule, FILE* file) { DB::CEnumList Settings; @@ -126,7 +126,7 @@ static void ExportModule(HANDLE hContact, LPCSTR pszModule, FILE* file) * pModules - module to export, NULL to export all modules of a contact * file - ini file to write the contact to **/ -static BYTE ExportContact(HANDLE hContact, DB::CEnumList* pModules, FILE* file) +static BYTE ExportContact(HCONTACT hContact, DB::CEnumList* pModules, FILE* file) { CExImContactBase vcc; @@ -167,7 +167,7 @@ int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName) errno_t err; DB::CEnumList Modules; SYSTEMTIME now; - HANDLE hContact; + HCONTACT hContact; if (!DlgExImModules_SelectModulesToExport(ExImContact, &Modules, NULL)) { @@ -298,7 +298,7 @@ static DWORD ImportreadLine(FILE* file, LPSTR &str) * cchBuf - character count of the buffer * return: handle to the contact that matches the information or NULL if no match **/ -static HANDLE ImportFindContact(HANDLE hContact, LPSTR &strBuf, BYTE bCanCreate) +static HCONTACT ImportFindContact(HCONTACT hContact, LPSTR &strBuf, BYTE bCanCreate) { CExImContactBase vcc; @@ -322,7 +322,7 @@ static HANDLE ImportFindContact(HANDLE hContact, LPSTR &strBuf, BYTE bCanCreate) * strLine - string with the setting and its value to write to db * return: 0 if writing was ok, 1 otherwise **/ -int ImportSetting(HANDLE hContact, LPCSTR pszModule, LPSTR &strLine) +int ImportSetting(HCONTACT hContact, LPCSTR pszModule, LPSTR &strLine) { DBVARIANT dbv; LPSTR end, value; @@ -433,10 +433,10 @@ int ImportSetting(HANDLE hContact, LPCSTR pszModule, LPSTR &strLine) * strLine - string with the setting and its value to write to db * return: 0 if writing was ok, 1 otherwise **/ -int SvcExImINI_Import(HANDLE hContact, LPCSTR pszFileName) +int SvcExImINI_Import(HCONTACT hContact, LPCSTR pszFileName) { FILE *file; - HANDLE hNewContact = INVALID_HANDLE_VALUE; + HCONTACT hNewContact = (HCONTACT)INVALID_HANDLE_VALUE; DWORD end, numLines = 0; CHAR szModule[MAXSETTING] = {0}; @@ -471,7 +471,7 @@ int SvcExImINI_Import(HANDLE hContact, LPCSTR pszFileName) strBuf = mir_strnerase(strBuf, 0, 1); numContactsInFile++; - if ((hNewContact = ImportFindContact(hContact, strBuf, FALSE)) != INVALID_HANDLE_VALUE) + if ((hNewContact = ImportFindContact(hContact, strBuf, FALSE)) != (HCONTACT)INVALID_HANDLE_VALUE) numContactsAdded++; continue; } @@ -484,13 +484,13 @@ int SvcExImINI_Import(HANDLE hContact, LPCSTR pszFileName) *szModule = 0; numContactsInFile++; - if ((hNewContact = ImportFindContact(hContact, strBuf, TRUE)) != INVALID_HANDLE_VALUE) + if ((hNewContact = ImportFindContact(hContact, strBuf, TRUE)) != (HCONTACT)INVALID_HANDLE_VALUE) numContactsAdded++; continue; } // read modules and settings only for valid contacts - if (hNewContact != INVALID_HANDLE_VALUE) { + if (hNewContact != (HCONTACT)INVALID_HANDLE_VALUE) { // found a module line if (strBuf[0] == '[' && (end = (strchr(strBuf, ']') - strBuf)) > 0) { mir_strncpy(szModule, &strBuf[1], end); diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.h b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.h index 6961b1b6f7..9d737fcdb8 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.h +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.h @@ -25,6 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma once int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName); - int SvcExImINI_Import(HANDLE hContact, LPCSTR pszFileName); + int SvcExImINI_Import(HCONTACT hContact, LPCSTR pszFileName); #endif /* _SVC_EXIMINI_H_ */ diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp index e3b6f45f2c..824c4c0fd1 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp @@ -557,7 +557,7 @@ size_t CLineBuffer::GetTokenNext(const CHAR delim, CLineBuffer * pBuf) * * return: 0 if successful, 1 otherwise **/ -int CLineBuffer::DBWriteTokenFirst(HANDLE hContact, const CHAR* pszModule, const CHAR* pszSetting, const CHAR delim) +int CLineBuffer::DBWriteTokenFirst(HCONTACT hContact, const CHAR* pszModule, const CHAR* pszSetting, const CHAR delim) { PBYTE here; int iRet = 1; @@ -594,7 +594,7 @@ int CLineBuffer::DBWriteTokenFirst(HANDLE hContact, const CHAR* pszModule, const * * return: 0 if successful, 1 otherwise **/ -int CLineBuffer::DBWriteTokenNext(HANDLE hContact, const CHAR* pszModule, const CHAR* pszSetting, const CHAR delim) +int CLineBuffer::DBWriteTokenNext(HCONTACT hContact, const CHAR* pszModule, const CHAR* pszSetting, const CHAR delim) { PBYTE here; int iRet = 1; @@ -628,7 +628,7 @@ int CLineBuffer::DBWriteTokenNext(HANDLE hContact, const CHAR* pszModule, const * * return: 0 if successful, 1 otherwise **/ -int CLineBuffer::DBWriteSettingString(HANDLE hContact, const CHAR* pszModule, const CHAR* pszSetting) +int CLineBuffer::DBWriteSettingString(HCONTACT hContact, const CHAR* pszModule, const CHAR* pszSetting) { if (_pVal && _cbUsed > 0) return db_set_s(hContact, pszModule, pszSetting, (LPSTR)_pVal); @@ -649,11 +649,11 @@ int CLineBuffer::DBWriteSettingString(HANDLE hContact, const CHAR* pszModule, co **/ CVCardFileVCF::CVCardFileVCF() { - _pFile = NULL; - _hContact = INVALID_HANDLE_VALUE; - _pszBaseProto = NULL; - _hasUtf8 = 0; - _useUtf8 = FALSE; + _pFile = NULL; + _hContact = (HCONTACT)INVALID_HANDLE_VALUE; + _pszBaseProto = NULL; + _hasUtf8 = 0; + _useUtf8 = FALSE; } /** @@ -850,7 +850,7 @@ void CVCardFileVCF::writeLineEncoded(const CHAR *szSet, size_t *cbRew) * pszMode - the mode the file should be opened with * return TRUE or FALSE **/ -BYTE CVCardFileVCF::Open(HANDLE hContact, LPCSTR pszFileName, LPCSTR pszMode) +BYTE CVCardFileVCF::Open(HCONTACT hContact, LPCSTR pszFileName, LPCSTR pszMode) { if (!(_pFile = fopen(pszFileName, pszMode))) return FALSE; @@ -873,9 +873,9 @@ void CVCardFileVCF::Close(void) { if (_pFile) fclose(_pFile); - _pFile = NULL; - _hContact = INVALID_HANDLE_VALUE; - _pszBaseProto = NULL; + _pFile = NULL; + _hContact = (HCONTACT)INVALID_HANDLE_VALUE; + _pszBaseProto = NULL; } /** diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h index 3fbab056e7..2507d83b61 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.h @@ -59,9 +59,9 @@ public: size_t GetTokenFirst(const CHAR delim, CLineBuffer * pBuf); size_t GetTokenNext(const CHAR delim, CLineBuffer * pBuf); - int DBWriteTokenFirst(HANDLE hContact, const CHAR* pszModule, const CHAR* pszSetting, const CHAR delim); - int DBWriteTokenNext(HANDLE hContact, const CHAR* pszModule, const CHAR* pszSetting, const CHAR delim); - int DBWriteSettingString(HANDLE hContact, const CHAR* pszModule, const CHAR* pszSetting); + int DBWriteTokenFirst(HCONTACT hContact, const CHAR* pszModule, const CHAR* pszSetting, const CHAR delim); + int DBWriteTokenNext(HCONTACT hContact, const CHAR* pszModule, const CHAR* pszSetting, const CHAR delim); + int DBWriteSettingString(HCONTACT hContact, const CHAR* pszModule, const CHAR* pszSetting); }; class CVCardFileVCF @@ -69,7 +69,7 @@ class CVCardFileVCF private: CLineBuffer _clVal; FILE *_pFile; - HANDLE _hContact; + HCONTACT _hContact; const CHAR *_pszBaseProto; WORD _cbRew; BYTE _useUtf8; @@ -87,7 +87,7 @@ private: public: CVCardFileVCF(); - BYTE Open(HANDLE hContact, LPCSTR pszFileName, LPCSTR pszMode); + BYTE Open(HCONTACT hContact, LPCSTR pszFileName, LPCSTR pszMode); void Close(void); BYTE Export(BYTE bExportUtf); BYTE Import(); diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp index 61d46dcef8..c4664b0975 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp @@ -93,7 +93,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName) LONG cbHeader; SYSTEMTIME now; DWORD result; - HANDLE hContact; + HCONTACT hContact; result = (DWORD)DialogBox(ghInst, MAKEINTRESOURCE(IDD_EXPORT_DATAHISTORY), @@ -346,7 +346,7 @@ DWORD CFileXml::CountContacts(TiXmlElement* xmlParent) * pszFileName - full qualified path to the xml file which is to import * return: ERROR_OK on success or one other element of ImportError to tell the type of failure **/ -int CFileXml::Import(HANDLE hContact, LPCSTR pszFileName) +int CFileXml::Import(HCONTACT hContact, LPCSTR pszFileName) { TiXmlDocument doc; TiXmlElement *xmlCard = NULL; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h index 3ec0ca998a..382fdb6dde 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.h @@ -50,13 +50,13 @@ class CFileXml { /* int ExportOwner(FILE *xmlfile, BYTE bExportEvents); - int ExportContact(FILE *xmlfile, HANDLE hContact, BYTE bExportEvents, LPENUMLIST pModules); - int ExportSubContact(TiXmlElement *xContact, HANDLE hContact, BYTE bExportEvents); + int ExportContact(FILE *xmlfile, HCONTACT hContact, BYTE bExportEvents, LPENUMLIST pModules); + int ExportSubContact(TiXmlElement *xContact, HCONTACT hContact, BYTE bExportEvents); */ public: CFileXml(); - int Import(HANDLE hContact, LPCSTR pszFileName); + int Import(HCONTACT hContact, LPCSTR pszFileName); int Export(lpExImParam ExImContact, LPCSTR pszFileName); }; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp index f331f1f3e3..0632d96f32 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp @@ -211,7 +211,7 @@ INT_PTR svcExIm_MainExport_Service(WPARAM wParam, LPARAM lParam) { ExImParam ExIm; ZeroMemory(&ExIm, sizeof(ExIm)); - ExIm.hContact = INVALID_HANDLE_VALUE; + ExIm.hContact = (HCONTACT)INVALID_HANDLE_VALUE; ExIm.Typ = EXIM_ALL; return SvcExImport_Export(&ExIm, (HWND)lParam); } @@ -220,7 +220,7 @@ INT_PTR svcExIm_MainImport_Service(WPARAM wParam, LPARAM lParam) { ExImParam ExIm; ZeroMemory(&ExIm, sizeof(ExIm)); - ExIm.hContact = INVALID_HANDLE_VALUE; + ExIm.hContact = (HCONTACT)INVALID_HANDLE_VALUE; ExIm.Typ = EXIM_ALL; return SvcExImport_Import(&ExIm, (HWND)lParam); } @@ -233,7 +233,7 @@ INT_PTR svcExIm_ContactExport_Service(WPARAM wParam, LPARAM lParam) { ExImParam ExIm; ZeroMemory(&ExIm, sizeof(ExIm)); - ExIm.hContact = (HANDLE)wParam; + ExIm.hContact = (HCONTACT)wParam; ExIm.Typ = EXIM_CONTACT; return SvcExImport_Export(&ExIm, (HWND)lParam); } @@ -242,7 +242,7 @@ INT_PTR svcExIm_ContactImport_Service(WPARAM wParam, LPARAM lParam) { ExImParam ExIm; ZeroMemory(&ExIm, sizeof(ExIm)); - ExIm.hContact = (HANDLE)wParam; + ExIm.hContact = (HCONTACT)wParam; ExIm.Typ = EXIM_CONTACT; return SvcExImport_Import(&ExIm, (HWND)lParam); } diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.h b/plugins/UserInfoEx/src/ex_import/svc_ExImport.h index 16c64c25e3..484c266535 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.h +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.h @@ -26,7 +26,7 @@ typedef struct { BYTE Typ; union { - HANDLE hContact; + HCONTACT hContact; LPSTR pszName; LPTSTR ptszName; }; diff --git a/plugins/UserInfoEx/src/mir_contactqueue.cpp b/plugins/UserInfoEx/src/mir_contactqueue.cpp index 00c612295d..0c9ff0883b 100644 --- a/plugins/UserInfoEx/src/mir_contactqueue.cpp +++ b/plugins/UserInfoEx/src/mir_contactqueue.cpp @@ -123,7 +123,7 @@ void CContactQueue::RemoveAll() * * @return nothing **/ -void CContactQueue::RemoveAll(HANDLE hContact) +void CContactQueue::RemoveAll(HCONTACT hContact) { Lock(); @@ -149,7 +149,7 @@ void CContactQueue::RemoveAll(HANDLE hContact) * * @return nothing **/ -void CContactQueue::RemoveAllConsiderParam(HANDLE hContact, PVOID param) +void CContactQueue::RemoveAllConsiderParam(HCONTACT hContact, PVOID param) { Lock(); @@ -177,7 +177,7 @@ void CContactQueue::RemoveAllConsiderParam(HANDLE hContact, PVOID param) * @retval TRUE - The item is added to the queue successfully. * @retval FALSE - The item is not added to the queue. **/ -BOOL CContactQueue::Add(int waitTime, HANDLE hContact, PVOID param) +BOOL CContactQueue::Add(int waitTime, HCONTACT hContact, PVOID param) { BOOL rc; @@ -201,7 +201,7 @@ BOOL CContactQueue::Add(int waitTime, HANDLE hContact, PVOID param) * @retval TRUE - The item is added to the queue successfully. * @retval FALSE - The item is not added to the queue. **/ -BOOL CContactQueue::AddIfDontHave(int waitTime, HANDLE hContact, PVOID param) +BOOL CContactQueue::AddIfDontHave(int waitTime, HCONTACT hContact, PVOID param) { int i; BOOL rc; @@ -235,7 +235,7 @@ BOOL CContactQueue::AddIfDontHave(int waitTime, HANDLE hContact, PVOID param) * @retval TRUE - The item is added to the queue successfully. * @retval FALSE - The item is not added to the queue. **/ -BOOL CContactQueue::AddUnique(int waitTime, HANDLE hContact, PVOID param) +BOOL CContactQueue::AddUnique(int waitTime, HCONTACT hContact, PVOID param) { BOOL rc; @@ -261,7 +261,7 @@ BOOL CContactQueue::AddUnique(int waitTime, HANDLE hContact, PVOID param) * @retval TRUE - The item is added to the queue successfully. * @retval FALSE - The item is not added to the queue. **/ -BOOL CContactQueue::AddUniqueConsiderParam(int waitTime, HANDLE hContact, PVOID param) +BOOL CContactQueue::AddUniqueConsiderParam(int waitTime, HCONTACT hContact, PVOID param) { BOOL rc; @@ -285,7 +285,7 @@ BOOL CContactQueue::AddUniqueConsiderParam(int waitTime, HANDLE hContact, PVOID * @retval TRUE - The item is added to the queue successfully. * @retval FALSE - The item is not added to the queue. **/ -BOOL CContactQueue::InternalAdd(int waitTime, HANDLE hContact, PVOID param) +BOOL CContactQueue::InternalAdd(int waitTime, HCONTACT hContact, PVOID param) { BOOL rc; CQueueItem *qi = (CQueueItem *) mir_alloc(sizeof(CQueueItem)); diff --git a/plugins/UserInfoEx/src/mir_contactqueue.h b/plugins/UserInfoEx/src/mir_contactqueue.h index b42d89c1a6..4da54dcacc 100644 --- a/plugins/UserInfoEx/src/mir_contactqueue.h +++ b/plugins/UserInfoEx/src/mir_contactqueue.h @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct CQueueItem { DWORD check_time; - HANDLE hContact; + HCONTACT hContact; PVOID param; }; @@ -65,7 +65,7 @@ public: * * @return nothing **/ - void RemoveAll(HANDLE hContact); + void RemoveAll(HCONTACT hContact); /** * This function removes all queue items for the hContact considering the correct parameter. @@ -75,7 +75,7 @@ public: * * @return nothing **/ - void RemoveAllConsiderParam(HANDLE hContact, PVOID param); + void RemoveAllConsiderParam(HCONTACT hContact, PVOID param); /** * This method adds the desired new item. @@ -87,7 +87,7 @@ public: * @retval TRUE - The item is added to the queue successfully. * @retval FALSE - The item is not added to the queue. **/ - BOOL Add(int waitTime, HANDLE hContact, PVOID param = NULL); + BOOL Add(int waitTime, HCONTACT hContact, PVOID param = NULL); /** * This method adds the desired new item only, if the queue does not yet contain @@ -100,7 +100,7 @@ public: * @retval TRUE - The item is added to the queue successfully. * @retval FALSE - The item is not added to the queue. **/ - BOOL AddIfDontHave(int waitTime, HANDLE hContact, PVOID param = NULL); + BOOL AddIfDontHave(int waitTime, HCONTACT hContact, PVOID param = NULL); /** * This method removes all existing queue items for the contact and adds a new queue item @@ -113,7 +113,7 @@ public: * * @return nothing **/ - BOOL AddUnique(int waitTime, HANDLE hContact, PVOID param = NULL); + BOOL AddUnique(int waitTime, HCONTACT hContact, PVOID param = NULL); /** * This method removes all existing queue items for the contact with the same parameter as @e param @@ -126,7 +126,7 @@ public: * * @return nothing **/ - BOOL AddUniqueConsiderParam (int waitTime, HANDLE hContact, PVOID param = NULL); + BOOL AddUniqueConsiderParam (int waitTime, HCONTACT hContact, PVOID param = NULL); /** * This method resumes the worker thread and immitiatly goes on with the next entry. @@ -140,7 +140,7 @@ public: protected: virtual void OnEmpty () {}; - virtual void Callback (HANDLE hContact, PVOID param) = 0; + virtual void Callback (HCONTACT hContact, PVOID param) = 0; /** * This is the real thread callback function. As long as _status @@ -198,7 +198,7 @@ private: * @retval TRUE - The item is added to the queue successfully. * @retval FALSE - The item is not added to the queue. **/ - BOOL InternalAdd(int waitTime, HANDLE hContact, PVOID param); + BOOL InternalAdd(int waitTime, HCONTACT hContact, PVOID param); }; #endif // __CONTACTASYNCQUEUE_H__ \ No newline at end of file diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index ed48c02193..1a41e8da34 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -25,41 +25,41 @@ namespace DB { namespace MetaContact { -INT_PTR SubCount(HANDLE hMetaContact) +INT_PTR SubCount(HCONTACT hMetaContact) { INT_PTR result = CallService(MS_MC_GETNUMCONTACTS, (WPARAM) hMetaContact, 0); return (result == CALLSERVICE_NOTFOUND) ? -1 : result; } -INT_PTR SubDefNum(HANDLE hMetaContact) +INT_PTR SubDefNum(HCONTACT hMetaContact) { INT_PTR result = CallService(MS_MC_GETDEFAULTCONTACTNUM, (WPARAM) hMetaContact, 0); return (result == CALLSERVICE_NOTFOUND) ? -1 : result; } -HANDLE Sub(HANDLE hMetaContact, int idx) +HCONTACT Sub(HCONTACT hMetaContact, int idx) { if (idx != -1) { INT_PTR result = CallService(MS_MC_GETSUBCONTACT, (WPARAM) hMetaContact, (LPARAM) idx); - return (result == CALLSERVICE_NOTFOUND) ? NULL : (HANDLE) result; + return (result == CALLSERVICE_NOTFOUND) ? NULL : (HCONTACT)result; } return NULL; } -bool IsSub(HANDLE hContact) +bool IsSub(HCONTACT hContact) { return myGlobals.szMetaProto && db_get_b(NULL, myGlobals.szMetaProto, "Enabled", TRUE) && db_get_b(hContact, myGlobals.szMetaProto, "IsSubcontact", FALSE); } -HANDLE GetMeta(HANDLE hContact) +HCONTACT GetMeta(HCONTACT hContact) { if (!myGlobals.szMetaProto) return NULL; - HANDLE result = (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM) hContact, 0); - return (result == (HANDLE)CALLSERVICE_NOTFOUND) ? NULL : result; + HCONTACT result = (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); + return (result == (HCONTACT)CALLSERVICE_NOTFOUND) ? NULL : result; } } /* namespace MetaContact */ @@ -76,7 +76,7 @@ namespace Contact { * @return Returns the display name of a contact. **/ -LPTSTR DisplayName(HANDLE hContact) +LPTSTR DisplayName(HCONTACT hContact) { return pcli->pfnGetContactDisplayName(hContact, 0); } @@ -87,7 +87,7 @@ LPTSTR DisplayName(HANDLE hContact) * @return This function returns the basic protocol of a contact. **/ -LPSTR Proto(HANDLE hContact) +LPSTR Proto(HCONTACT hContact) { if (hContact) { INT_PTR result; @@ -112,16 +112,16 @@ INT_PTR GetCount() * Simply adds a new contact without setting up any protocol or something else * @return HANDLE The function returns the HANDLE of the new contact **/ -HANDLE Add() +HCONTACT Add() { - return (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); + return (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); } /** * This function deletes a contact from the database. * @param hContact - handle to the contact **/ -BYTE Delete(HANDLE hContact) +BYTE Delete(HCONTACT hContact) { return CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0) != 0; } @@ -159,7 +159,7 @@ namespace Module { * return: nothing **/ -void Delete(HANDLE hContact, LPCSTR pszModule) +void Delete(HCONTACT hContact, LPCSTR pszModule) { CEnumList Settings; if (!Settings.EnumSettings(hContact, pszModule)) @@ -187,7 +187,7 @@ static int IsEmptyEnumProc(LPCSTR pszSetting, LPARAM lParam) * @retval FALSE - the module contains settings **/ -bool IsEmpty(HANDLE hContact, LPCSTR pszModule) +bool IsEmpty(HCONTACT hContact, LPCSTR pszModule) { DBCONTACTENUMSETTINGS dbces = { 0 }; dbces.pfnEnumProc = IsEmptyEnumProc; @@ -236,7 +236,7 @@ namespace Setting { * @retval 1 - error **/ -BYTE Get(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, DBVARIANT *dbv, const BYTE destType) +BYTE Get(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting, DBVARIANT *dbv, const BYTE destType) { // read value without translation to specific type BYTE result = db_get_s(hContact, pszModule, pszSetting, dbv, 0) != 0; @@ -256,7 +256,7 @@ BYTE Get(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, DBVARIANT *dbv, c * @return string value **/ -LPSTR GetAString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting) +LPSTR GetAString(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) { DBVARIANT dbv; if (GetAString(hContact, pszModule, pszSetting, &dbv) == 0){ @@ -277,7 +277,7 @@ LPSTR GetAString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting) * @return string value **/ -LPWSTR GetWString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting) +LPWSTR GetWString(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) { DBVARIANT dbv; if (GetWString(hContact, pszModule, pszSetting, &dbv) == 0) { @@ -302,7 +302,7 @@ LPWSTR GetWString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting) * @retval 1 - error **/ -BYTE GetEx(HANDLE hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR pszSetting, DBVARIANT *dbv, const BYTE destType) +BYTE GetEx(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR pszSetting, DBVARIANT *dbv, const BYTE destType) { BYTE result = !pszModule || Get(hContact, pszModule, pszSetting, dbv, destType); // try to read setting from the contact's protocol module @@ -311,13 +311,12 @@ BYTE GetEx(HANDLE hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR pszSetting // try to get setting from a metasubcontact if (result && DB::Module::IsMetaAndScan(pszProto)) { const INT_PTR def = DB::MetaContact::SubDefNum(hContact); - HANDLE hSubContact; + HCONTACT hSubContact; // try to get setting from the default subcontact first if (def > -1 && def < INT_MAX) { hSubContact = DB::MetaContact::Sub(hContact, def); - if (hSubContact != NULL) { + if (hSubContact != NULL) result = DB::Setting::GetEx(hSubContact, pszModule, DB::Contact::Proto(hSubContact), pszSetting, dbv, destType) != 0; - } } // scan all subcontacts for the setting if (result) { @@ -348,7 +347,7 @@ BYTE GetEx(HANDLE hContact, LPCSTR pszModule, LPCSTR pszProto, LPCSTR pszSetting * @return This function returns the WORD which contains the source of information. **/ -WORD GetCtrl(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR pszProto, LPCSTR pszSetting, DBVARIANT *dbv, const BYTE destType) +WORD GetCtrl(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR pszProto, LPCSTR pszSetting, DBVARIANT *dbv, const BYTE destType) { WORD wFlags = 0; @@ -367,7 +366,7 @@ WORD GetCtrl(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR pszP // try to read the setting from the sub contacts' modules else if (DB::Module::IsMetaAndScan(pszProto)) { const INT_PTR def = DB::MetaContact::SubDefNum(hContact); - HANDLE hSubContact; + HCONTACT hSubContact; // try to get setting from the default subcontact first if (def > -1 && def < INT_MAX) { hSubContact = DB::MetaContact::Sub(hContact, def); @@ -410,7 +409,7 @@ WORD GetCtrl(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSubModule, LPCSTR pszP * @retval FALSE - setting does not exist **/ -BYTE Exists(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting) +BYTE Exists(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting) { if (pszModule && pszSetting) { CHAR szDummy[1]; @@ -429,7 +428,7 @@ BYTE Exists(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting) * @return nothing **/ -void DeleteArray(HANDLE hContact, LPCSTR pszModule, LPCSTR pszFormat, int iStart) +void DeleteArray(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszFormat, int iStart) { CHAR pszSetting[MAXSETTING]; do { @@ -703,7 +702,7 @@ static FORCEINLINE bool IsEqual(const DBEVENTINFO *d1, const DBEVENTINFO *d2, bo * **/ -bool Exists(HANDLE hContact, HANDLE& hDbExistingEvent, DBEVENTINFO *dbei) +bool Exists(HCONTACT hContact, HANDLE& hDbExistingEvent, DBEVENTINFO *dbei) { bool result = false; DBEVENTINFO edbei; @@ -827,7 +826,7 @@ INT_PTR CEnumList::EnumModules() * @retval 0 - success **/ -INT_PTR CEnumList::EnumSettings(HANDLE hContact, LPCSTR pszModule) +INT_PTR CEnumList::EnumSettings(HCONTACT hContact, LPCSTR pszModule) { DBCONTACTENUMSETTINGS dbces = { 0 }; dbces.pfnEnumProc = (DBSETTINGENUMPROC)CEnumList::EnumSettingsProc; diff --git a/plugins/UserInfoEx/src/mir_db.h b/plugins/UserInfoEx/src/mir_db.h index 27424857fb..2732d6e6f8 100644 --- a/plugins/UserInfoEx/src/mir_db.h +++ b/plugins/UserInfoEx/src/mir_db.h @@ -24,12 +24,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. namespace DB { namespace MetaContact{ - INT_PTR SubCount(HANDLE hMetaContact); - INT_PTR SubDefNum(HANDLE hMetaContact); - HANDLE Sub(HANDLE hMetaContact, int idx); + INT_PTR SubCount(HCONTACT hMetaContact); + INT_PTR SubDefNum(HCONTACT hMetaContact); + HCONTACT Sub(HCONTACT hMetaContact, int idx); - bool IsSub(HANDLE hContact); - HANDLE GetMeta(HANDLE hContact); + bool IsSub(HCONTACT hContact); + HCONTACT GetMeta(HCONTACT hContact); } /* namespace MetaContact */ /** @@ -37,21 +37,21 @@ namespace MetaContact{ * or modify contacts in the database. **/ namespace Contact { - LPTSTR DisplayName(HANDLE hContact); - LPSTR Proto(HANDLE hContact); + LPTSTR DisplayName(HCONTACT hContact); + LPSTR Proto(HCONTACT hContact); INT_PTR GetCount(); - HANDLE Add(); - BYTE Delete(HANDLE hContact); + HCONTACT Add(); + BYTE Delete(HCONTACT hContact); DWORD WhenAdded(DWORD dwUIN, LPCSTR szBaseProto); } /* namespace Contact */ namespace Module { - void Delete(HANDLE hContact, LPCSTR pszModule); - bool IsEmpty(HANDLE hContact, LPCSTR pszModule); + void Delete(HCONTACT hContact, LPCSTR pszModule); + bool IsEmpty(HCONTACT hContact, LPCSTR pszModule); bool IsMeta(LPCSTR pszModule); bool IsMetaAndScan(LPCSTR pszModule); @@ -62,38 +62,38 @@ namespace Module { **/ namespace Setting { - BYTE Get(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, DBVARIANT *dbv, const BYTE nType); - static FORCEINLINE BYTE GetAsIs(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, DBVARIANT *dbv) + BYTE Get(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting, DBVARIANT *dbv, const BYTE nType); + static FORCEINLINE BYTE GetAsIs(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting, DBVARIANT *dbv) { return Get(hContact, pszModule, pszSetting, dbv, 0); } - static FORCEINLINE BYTE GetAString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, DBVARIANT *dbv) + static FORCEINLINE BYTE GetAString(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting, DBVARIANT *dbv) { return Get(hContact, pszModule, pszSetting, dbv, DBVT_ASCIIZ); } - LPSTR GetAString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting); - static FORCEINLINE BYTE GetWString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, DBVARIANT *dbv) + LPSTR GetAString(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting); + static FORCEINLINE BYTE GetWString(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting, DBVARIANT *dbv) { return Get(hContact, pszModule, pszSetting, dbv, DBVT_WCHAR); } - LPWSTR GetWString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting); - static FORCEINLINE BYTE GetUString(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting, DBVARIANT *dbv) + LPWSTR GetWString(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting); + static FORCEINLINE BYTE GetUString(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting, DBVARIANT *dbv) { return Get(hContact, pszModule, pszSetting, dbv, DBVT_UTF8); } - BYTE GetEx(HANDLE hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv, const BYTE nType); - static FORCEINLINE BYTE GetAsIsEx(HANDLE hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv) + BYTE GetEx(HCONTACT hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv, const BYTE nType); + static FORCEINLINE BYTE GetAsIsEx(HCONTACT hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv) { return GetEx(hContact, pszModule, szProto, pszSetting, dbv, 0); } - static FORCEINLINE LPSTR GetAStringEx(HANDLE hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting) + static FORCEINLINE LPSTR GetAStringEx(HCONTACT hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting) { DBVARIANT dbv; return (!GetEx(hContact, pszModule, szProto, pszSetting, &dbv, DBVT_ASCIIZ) && dbv.type == DBVT_ASCIIZ) ? dbv.pszVal : NULL; } - static FORCEINLINE LPWSTR GetWStringEx(HANDLE hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting) + static FORCEINLINE LPWSTR GetWStringEx(HCONTACT hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting) { DBVARIANT dbv; return (!GetEx(hContact, pszModule, szProto, pszSetting, &dbv, DBVT_WCHAR) && dbv.type == DBVT_WCHAR) ? dbv.pwszVal : NULL; } - static FORCEINLINE LPSTR GetUStringEx(HANDLE hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting) + static FORCEINLINE LPSTR GetUStringEx(HCONTACT hContact, LPCSTR pszModule, LPCSTR szProto, LPCSTR pszSetting) { DBVARIANT dbv; return (!GetEx(hContact, pszModule, szProto, pszSetting, &dbv, DBVT_UTF8) && dbv.type == DBVT_UTF8) ? dbv.pszVal : NULL; } - WORD GetCtrl(HANDLE hContact, LPCSTR pszModule, LPCSTR szSubModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv, const BYTE nType); - static FORCEINLINE WORD GetAsIsCtrl(HANDLE hContact, LPCSTR pszModule, LPCSTR szSubModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv) + WORD GetCtrl(HCONTACT hContact, LPCSTR pszModule, LPCSTR szSubModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv, const BYTE nType); + static FORCEINLINE WORD GetAsIsCtrl(HCONTACT hContact, LPCSTR pszModule, LPCSTR szSubModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv) { return GetCtrl(hContact, pszModule, szSubModule, szProto, pszSetting, dbv, 0); } - static FORCEINLINE WORD GetAStringCtrl(HANDLE hContact, LPCSTR pszModule, LPCSTR szSubModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv) + static FORCEINLINE WORD GetAStringCtrl(HCONTACT hContact, LPCSTR pszModule, LPCSTR szSubModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv) { return GetCtrl(hContact, pszModule, szSubModule, szProto, pszSetting, dbv, DBVT_ASCIIZ); } - static FORCEINLINE WORD GetWStringCtrl(HANDLE hContact, LPCSTR pszModule, LPCSTR szSubModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv) + static FORCEINLINE WORD GetWStringCtrl(HCONTACT hContact, LPCSTR pszModule, LPCSTR szSubModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv) { return GetCtrl(hContact, pszModule, szSubModule, szProto, pszSetting, dbv, DBVT_WCHAR); } - static FORCEINLINE WORD GetUStringCtrl(HANDLE hContact, LPCSTR pszModule, LPCSTR szSubModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv) + static FORCEINLINE WORD GetUStringCtrl(HCONTACT hContact, LPCSTR pszModule, LPCSTR szSubModule, LPCSTR szProto, LPCSTR pszSetting, DBVARIANT *dbv) { return GetCtrl(hContact, pszModule, szSubModule, szProto, pszSetting, dbv, DBVT_UTF8); } #define GetTString GetWString @@ -104,8 +104,8 @@ namespace Setting { /** * misc operations **/ - BYTE Exists(HANDLE hContact, LPCSTR pszModule, LPCSTR pszSetting); - void DeleteArray(HANDLE hContact, LPCSTR pszModule, LPCSTR pszFormat, int iStart); + BYTE Exists(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszSetting); + void DeleteArray(HCONTACT hContact, LPCSTR pszModule, LPCSTR pszFormat, int iStart); } /* namespace Setting */ @@ -115,11 +115,11 @@ namespace Variant { } /* namespace Variant */ namespace Event { - HANDLE FindLast(HANDLE hContact); + HANDLE FindLast(HCONTACT hContact); bool GetInfo(HANDLE hEvent, DBEVENTINFO *dbei); bool GetInfoWithData(HANDLE hEvent, DBEVENTINFO *dbei); DWORD GetTime(HANDLE hEvent); - bool Exists(HANDLE hContact, HANDLE& hDbExistingEvent, DBEVENTINFO *dbei); + bool Exists(HCONTACT hContact, HANDLE& hDbExistingEvent, DBEVENTINFO *dbei); } /* namespace Events */ /** @@ -140,7 +140,7 @@ public: LPSTR Insert(LPCSTR str); INT_PTR EnumModules(); - INT_PTR EnumSettings(HANDLE hContact, LPCSTR pszModule); + INT_PTR EnumSettings(HCONTACT hContact, LPCSTR pszModule); }; } /* namespace DB */ \ No newline at end of file diff --git a/plugins/UserInfoEx/src/psp_base.cpp b/plugins/UserInfoEx/src/psp_base.cpp index ebdf9e1e96..77ec44c285 100644 --- a/plugins/UserInfoEx/src/psp_base.cpp +++ b/plugins/UserInfoEx/src/psp_base.cpp @@ -56,46 +56,40 @@ INT_PTR CALLBACK PSPBaseProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) return pCtrlList->OnSetTextColour((HWND)lParam, (HDC)wParam); case WM_NOTIFY: - { - switch (((LPNMHDR)lParam)->idFrom) { - case 0: { - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; - LPSTR pszProto; - - switch (((LPNMHDR)lParam)->code) { - case PSN_RESET: { - pCtrlList->OnReset(); - } break; - - case PSN_INFOCHANGED: { - if (PSGetBaseProto(hDlg, pszProto) && *pszProto) { - BOOL bChanged = (GetWindowLongPtr(hDlg, DWLP_MSGRESULT)&PSP_CHANGED)|pCtrlList->OnInfoChanged(hContact, pszProto); - SetWindowLongPtr(hDlg, DWLP_MSGRESULT, bChanged ? PSP_CHANGED : 0); - } - } break; - - case PSN_APPLY: { - if (PSGetBaseProto(hDlg, pszProto) && *pszProto) { - pCtrlList->OnApply(hContact, pszProto); - } - } break; - } - } break; + switch (((LPNMHDR)lParam)->idFrom) { + case 0: + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; + LPSTR pszProto; + + switch (((LPNMHDR)lParam)->code) { + case PSN_RESET: + pCtrlList->OnReset(); + break; + + case PSN_INFOCHANGED: + if (PSGetBaseProto(hDlg, pszProto) && *pszProto) { + BOOL bChanged = (GetWindowLongPtr(hDlg, DWLP_MSGRESULT)&PSP_CHANGED) | pCtrlList->OnInfoChanged(hContact, pszProto); + SetWindowLongPtr(hDlg, DWLP_MSGRESULT, bChanged ? PSP_CHANGED : 0); + } + break; + + case PSN_APPLY: + if (PSGetBaseProto(hDlg, pszProto) && *pszProto) + pCtrlList->OnApply(hContact, pszProto); + break; } - } break; + break; + } + break; case WM_COMMAND: - { - if (!PspIsLocked(hDlg)) { - pCtrlList->OnChangedByUser(LOWORD(wParam), HIWORD(wParam)); - } - } break; + if (!PspIsLocked(hDlg)) + pCtrlList->OnChangedByUser(LOWORD(wParam), HIWORD(wParam)); + break; case WM_DESTROY: - { - // destroy all control objects and the list - pCtrlList->Release(); - } + // destroy all control objects and the list + pCtrlList->Release(); } } return 0; diff --git a/plugins/UserInfoEx/src/psp_contact.cpp b/plugins/UserInfoEx/src/psp_contact.cpp index 09f0604ba3..b71f809b49 100644 --- a/plugins/UserInfoEx/src/psp_contact.cpp +++ b/plugins/UserInfoEx/src/psp_contact.cpp @@ -41,7 +41,7 @@ INT_PTR CALLBACK PSPProcContactHome(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM if (pCtrlList) { TCHAR szAddr[MAX_PATH]; - HANDLE hContact = (HANDLE)lParam; + HCONTACT hContact = (HCONTACT)lParam; LPIDSTRLIST pList; UINT nList; @@ -74,7 +74,7 @@ INT_PTR CALLBACK PSPProcContactHome(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM { case 0: { - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; LPCSTR pszProto; HWND hCtrl; @@ -196,7 +196,7 @@ INT_PTR CALLBACK PSPProcContactWork(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM if (pCtrlList) { TCHAR szAddr[MAX_PATH]; - HANDLE hContact = (HANDLE)lParam; + HCONTACT hContact = (HCONTACT)lParam; LPIDSTRLIST pList; UINT nList; @@ -227,7 +227,7 @@ INT_PTR CALLBACK PSPProcContactWork(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM { case 0: { - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; LPCSTR pszProto; HWND hCtrl; diff --git a/plugins/UserInfoEx/src/psp_general.cpp b/plugins/UserInfoEx/src/psp_general.cpp index 896b016c1c..d881f8b812 100644 --- a/plugins/UserInfoEx/src/psp_general.cpp +++ b/plugins/UserInfoEx/src/psp_general.cpp @@ -77,7 +77,7 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { case 0: { - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; char* pszProto; switch (((LPNMHDR)lParam)->code) @@ -149,7 +149,7 @@ INT_PTR CALLBACK PSPProcGeneral(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case WM_COMMAND: { - HANDLE hContact; + HCONTACT hContact; LPCSTR pszProto; switch (LOWORD(wParam)) diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 300eaf9d27..49626f63e7 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -488,7 +488,7 @@ static INT_PTR CALLBACK DlgProc_AdvancedOpts(HWND hDlg, UINT uMsg, WPARAM wParam LPGENT("This will delete all settings, you've made!\nAll TreeView settings, window positions and any other settings!\n\nAre you sure to procceed?")); if (WantReset) { - HANDLE hContact; + HCONTACT hContact; DB::CEnumList Settings; // delete all skin icons @@ -706,7 +706,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam if (bOld != bNew) { //keep the database clean MAnnivDate mdb; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; DBWriteComboByte(hDlg, EDIT_BIRTHMODULE, SET_REMIND_BIRTHMODULE, DEFVAL_REMIND_BIRTHMODULE); //walk through all the contacts stored in the DB for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) diff --git a/plugins/UserInfoEx/src/psp_origin.cpp b/plugins/UserInfoEx/src/psp_origin.cpp index 979a574747..6b337a4d5c 100644 --- a/plugins/UserInfoEx/src/psp_origin.cpp +++ b/plugins/UserInfoEx/src/psp_origin.cpp @@ -72,7 +72,7 @@ INT_PTR CALLBACK PSPProcOrigin(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara { case 0: { - HANDLE hContact = (HANDLE)((LPPSHNOTIFY) lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; LPCSTR pszProto; switch (((LPNMHDR) lParam)->code) diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp index f0e2084f16..098fc8ad72 100644 --- a/plugins/UserInfoEx/src/psp_profile.cpp +++ b/plugins/UserInfoEx/src/psp_profile.cpp @@ -278,7 +278,7 @@ static HWND ProfileList_BeginLabelEdit(LPLISTCTRL pList, int iItem, int iSubItem { LVITEM lvi; LPLCITEM pItem; - HANDLE hContact; + HCONTACT hContact; RECT rcList; if (!PtrIsValid(pList)) @@ -431,7 +431,7 @@ static BYTE ProfileList_AddNewItem(HWND hDlg, LPLISTCTRL pList, const PROFILEENT { LPLCITEM pItem; LVITEM lvi; - HANDLE hContact; + HCONTACT hContact; if (PtrIsValid(pList) && (pItem = (LPLCITEM)mir_alloc(sizeof(LCITEM)))) { PSGetContact(hDlg, hContact); @@ -478,7 +478,7 @@ static int ProfileList_AddItemlistFromDB( int &iItem, LPIDSTRLIST idList, UINT nList, - HANDLE hContact, + HCONTACT hContact, LPCSTR pszModule, LPCSTR szCatFormat, LPCSTR szValFormat, @@ -1113,7 +1113,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR switch (((LPNMHDR)lParam)->idFrom) { case 0: { - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; LPCSTR pszProto; if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hList))) @@ -1144,11 +1144,11 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR // scan all basic protocols for the subcontacts if (DB::Module::IsMetaAndScan(pszProto)) { int iDefault = CallService(MS_MC_GETDEFAULTCONTACTNUM, (WPARAM)hContact, NULL); - HANDLE hSubContact, hDefContact; + HCONTACT hSubContact, hDefContact; LPCSTR pszSubBaseProto; int j, numSubs; - if ((hDefContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, iDefault)) && + if ((hDefContact = (HCONTACT)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, iDefault)) && (pszSubBaseProto = DB::Contact::Proto(hDefContact))) { if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hDefContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA|CTRLF_HASPROTO)) < 0) @@ -1158,7 +1158,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR numSubs = CallService(MS_MC_GETNUMCONTACTS, (WPARAM)hContact, NULL); for (j = 0; j < numSubs; j++) { if (j == iDefault) continue; - if (!(hSubContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, j))) continue; + if (!(hSubContact = (HCONTACT)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, j))) continue; if (!(pszSubBaseProto = DB::Contact::Proto(hSubContact))) continue; if ((numProtoItems += ProfileList_AddItemlistFromDB(pList, iItem, idList, nList, hSubContact, pszSubBaseProto, pFmt[i].szCatFmt, pFmt[i].szValFmt, CTRLF_HASMETA|CTRLF_HASPROTO)) < 0) return FALSE; @@ -1270,7 +1270,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR { HMENU hMenu = CreatePopupMenu(); MENUITEMINFO mii; - HANDLE hContact; + HCONTACT hContact; LVHITTESTINFO hi; LPLCITEM pItem; POINT pt; diff --git a/plugins/UserInfoEx/src/svc_avatar.cpp b/plugins/UserInfoEx/src/svc_avatar.cpp index abccecb80e..38b3897a43 100644 --- a/plugins/UserInfoEx/src/svc_avatar.cpp +++ b/plugins/UserInfoEx/src/svc_avatar.cpp @@ -50,7 +50,7 @@ namespace NServices * * **/ - static void SetZodiacAvatar(HANDLE hContact) + static void SetZodiacAvatar(HCONTACT hContact) { MAnnivDate mtb; @@ -76,7 +76,7 @@ namespace NServices } } - void DeleteAvatar(HANDLE hContact) + void DeleteAvatar(HCONTACT hContact) { if (hContact && db_get_b(hContact, "ContactPhoto", "IsZodiac", FALSE)) { @@ -94,7 +94,7 @@ namespace NServices * * **/ - static int OnAvatarChanged(HANDLE hContact, AVATARCACHEENTRY *ace) + static int OnAvatarChanged(HCONTACT hContact, AVATARCACHEENTRY *ace) { if (hContact) { @@ -127,7 +127,7 @@ namespace NServices **/ void Enable(BYTE bEnable) { - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; if (bEnable && !ghChangedHook) diff --git a/plugins/UserInfoEx/src/svc_contactinfo.cpp b/plugins/UserInfoEx/src/svc_contactinfo.cpp index 0c39d10aec..1743477c89 100644 --- a/plugins/UserInfoEx/src/svc_contactinfo.cpp +++ b/plugins/UserInfoEx/src/svc_contactinfo.cpp @@ -705,7 +705,7 @@ INT_PTR GetContactInfo(WPARAM wParam, LPARAM lParam) static INT_PTR GetContactSettingStrExService(WPARAM wParam, LPARAM lParam) { DBCONTACTGETSETTING *cgs = (DBCONTACTGETSETTING*)lParam; - return DB::Setting::GetEx((HANDLE)wParam, USERINFO, + return DB::Setting::GetEx((HCONTACT)wParam, USERINFO, cgs->szModule, cgs->szSetting, cgs->pValue, cgs->pValue->type); } diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp index 9fae47b727..40bbf256cc 100644 --- a/plugins/UserInfoEx/src/svc_email.cpp +++ b/plugins/UserInfoEx/src/svc_email.cpp @@ -39,7 +39,7 @@ bool g_eiEmail = false; * @retval NULL, if contact does not provide any email address **/ -static LPSTR Get(HANDLE hContact) +static LPSTR Get(HCONTACT hContact) { // ignore owner if (hContact != NULL) { @@ -84,7 +84,7 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) __try { - val = Get((HANDLE) wParam); + val = Get((HCONTACT)wParam); if (val) { LPSTR szUrl; INT_PTR len; @@ -126,8 +126,8 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam) static int OnCListApplyIcons(WPARAM wParam, LPARAM lParam) { - LPSTR val = Get((HANDLE)wParam); - ExtraIcon_SetIcon(ghExtraIconSvc, (HANDLE)wParam, (val) ? ICO_BTN_EMAIL: 0); + LPSTR val = Get((HCONTACT)wParam); + ExtraIcon_SetIcon(ghExtraIconSvc, (HCONTACT)wParam, (val) ? ICO_BTN_EMAIL : 0); mir_free(val); return 0; } @@ -139,7 +139,7 @@ static int OnCListApplyIcons(WPARAM wParam, LPARAM lParam) * @param lParam - (DBCONTACTWRITESETTING*)pdbcws **/ -static int OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcws) +static int OnContactSettingChanged(HCONTACT hContact, DBCONTACTWRITESETTING* pdbcws) { if (hContact && pdbcws && pdbcws->szSetting && ((pdbcws->value.type & DBVTF_VARIABLELENGTH) || (pdbcws->value.type == DBVT_DELETED)) && @@ -163,7 +163,7 @@ static int OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw static int OnPreBuildMenu(WPARAM wParam, LPARAM lParam) { - LPSTR val = Get((HANDLE)wParam); + LPSTR val = Get((HCONTACT)wParam); Menu_ShowItem(ghMenuItem, val != NULL); mir_free(val); return 0; diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp index 75ddfdf09f..26a26d7aa7 100644 --- a/plugins/UserInfoEx/src/svc_gender.cpp +++ b/plugins/UserInfoEx/src/svc_gender.cpp @@ -30,7 +30,7 @@ static HANDLE hApplyIconHook = NULL; bool g_eiGender = false; -BYTE GenderOf(HANDLE hContact, LPCSTR pszProto) +BYTE GenderOf(HCONTACT hContact, LPCSTR pszProto) { DBVARIANT dbv; if (DB::Setting::GetAsIsEx(hContact, USERINFO, pszProto, SET_CONTACT_GENDER, &dbv) == 0) { @@ -53,7 +53,7 @@ BYTE GenderOf(HANDLE hContact, LPCSTR pszProto) * @retval 0 - contact does not provide its gender **/ -BYTE GenderOf(HANDLE hContact) +BYTE GenderOf(HCONTACT hContact) { return GenderOf(hContact, DB::Contact::Proto(hContact)); } @@ -69,7 +69,7 @@ BYTE GenderOf(HANDLE hContact) * @param lParam - not used **/ -static int OnCListApplyIcons(HANDLE hContact, LPARAM) +static int OnCListApplyIcons(HCONTACT hContact, LPARAM) { if (ghExtraIconSvc != INVALID_HANDLE_VALUE) { char *icoName; @@ -90,7 +90,7 @@ static int OnCListApplyIcons(HANDLE hContact, LPARAM) * @param lParam - (DBCONTACTWRITESETTING*)pdbcws **/ -static int OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcws) +static int OnContactSettingChanged(HCONTACT hContact, DBCONTACTWRITESETTING* pdbcws) { if (hContact && pdbcws && (pdbcws->value.type <= DBVT_BYTE) && !lstrcmpA(pdbcws->szSetting, SET_CONTACT_GENDER)) OnCListApplyIcons(hContact, 0); diff --git a/plugins/UserInfoEx/src/svc_gender.h b/plugins/UserInfoEx/src/svc_gender.h index 8c7c892ccf..1e90820b95 100644 --- a/plugins/UserInfoEx/src/svc_gender.h +++ b/plugins/UserInfoEx/src/svc_gender.h @@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _UINFOEX_SVCGENDER_H_INCLUDED_ #define _UINFOEX_SVCGENDER_H_INCLUDED_ -BYTE GenderOf(HANDLE hContact, LPCSTR pszProto); -BYTE GenderOf(HANDLE hContact); +BYTE GenderOf(HCONTACT hContact, LPCSTR pszProto); +BYTE GenderOf(HCONTACT hContact); bool SvcGenderEnableExtraIcons(bool bEnable = false, bool bUpdateDB = false); void SvcGenderUnloadModule(); diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp index abc25bfdce..2845570486 100644 --- a/plugins/UserInfoEx/src/svc_homepage.cpp +++ b/plugins/UserInfoEx/src/svc_homepage.cpp @@ -39,7 +39,7 @@ bool g_eiHome = false; * @retval NULL if contact provides no homepage **/ -static LPSTR Get(HANDLE hContact) +static LPSTR Get(HCONTACT hContact) { // ignore owner if (hContact != NULL) { @@ -68,7 +68,7 @@ static LPSTR Get(HANDLE hContact) static INT_PTR MenuCommand(WPARAM wParam, LPARAM lParam) { - LPSTR szUrl = Get((HANDLE)wParam); + LPSTR szUrl = Get((HCONTACT)wParam); if (szUrl) { CallService(MS_UTILS_OPENURL, 1, (LPARAM)szUrl); mir_free(szUrl); @@ -89,7 +89,7 @@ static INT_PTR MenuCommand(WPARAM wParam, LPARAM lParam) * @param lParam - not used **/ -static int OnCListApplyIcons(HANDLE hContact, LPARAM) +static int OnCListApplyIcons(HCONTACT hContact, LPARAM) { LPSTR val = Get(hContact); if (ghExtraIconSvc != INVALID_HANDLE_VALUE) @@ -105,7 +105,7 @@ static int OnCListApplyIcons(HANDLE hContact, LPARAM) * @param lParam - (DBCONTACTWRITESETTING*)pdbcws **/ -static int OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcws) +static int OnContactSettingChanged(HCONTACT hContact, DBCONTACTWRITESETTING* pdbcws) { if (hContact && pdbcws && pdbcws->szSetting && ((pdbcws->value.type & DBVTF_VARIABLELENGTH) || (pdbcws->value.type == DBVT_DELETED)) && @@ -127,7 +127,7 @@ static int OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw static int OnPreBuildMenu(WPARAM wParam, LPARAM lParam) { - LPSTR val = Get((HANDLE)wParam); + LPSTR val = Get((HCONTACT)wParam); Menu_ShowItem(ghMenuItem, val != 0); mir_free(val); return 0; diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp index 258cde98c1..6a510f28c3 100644 --- a/plugins/UserInfoEx/src/svc_phone.cpp +++ b/plugins/UserInfoEx/src/svc_phone.cpp @@ -47,7 +47,7 @@ bool g_eiPhone = false; * @retval PHONE_NONE: The contact does not provide any phone number **/ -static INT_PTR Get(HANDLE hContact) +static INT_PTR Get(HCONTACT hContact) { INT_PTR nType = PHONE_NONE; @@ -86,7 +86,7 @@ static INT_PTR Get(HANDLE hContact) * @param lParam - not used **/ -static int OnCListApplyIcons(HANDLE hContact, LPARAM) +static int OnCListApplyIcons(HCONTACT hContact, LPARAM) { char *icoName; switch (Get(hContact)) { @@ -105,7 +105,7 @@ static int OnCListApplyIcons(HANDLE hContact, LPARAM) * @param lParam - (DBCONTACTWRITESETTING*)pdbcws **/ -static int OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcws) +static int OnContactSettingChanged(HCONTACT hContact, DBCONTACTWRITESETTING* pdbcws) { if (hContact && pdbcws && pdbcws->szSetting && ((pdbcws->value.type & DBVTF_VARIABLELENGTH) || (pdbcws->value.type == DBVT_DELETED)) && diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index 0b83a036cb..4d2715dc39 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -485,7 +485,7 @@ class CContactUpdater : public CContactQueue { CUpdProgress* _pProgress; // pointer to the progress dialog/popup HANDLE _hProtoAckEvent; // handle to protocol ack notification - HANDLE _hContact; // current contact being refreshed + HCONTACT _hContact; // current contact being refreshed PBYTE _hContactAcks; // array of acknoledgements for the current contact to wait for INT_PTR _nContactAcks; // number of acknoledgements for the current contact to wait for @@ -627,7 +627,7 @@ class CContactUpdater : public CContactQueue * * @return nothing **/ - virtual void Callback(HANDLE hContact, PVOID param) + virtual void Callback(HCONTACT hContact, PVOID param) { LPSTR pszProto = DB::Contact::Proto(hContact); @@ -687,7 +687,7 @@ public: * * **/ - BOOL QueueAddRefreshContact(HANDLE hContact, int iWait) + BOOL QueueAddRefreshContact(HCONTACT hContact, int iWait) { LPSTR pszProto = DB::Contact::Proto(hContact); @@ -708,7 +708,7 @@ public: { int iWait = 100; - for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) if (QueueAddRefreshContact(hContact, iWait)) iWait += 5000; @@ -840,13 +840,13 @@ static int OnContactAdded(WPARAM wParam, LPARAM lParam) { try { - DWORD dwStmp = db_get_dw((HANDLE)wParam, USERINFO, SET_CONTACT_ADDEDTIME, 0); + DWORD dwStmp = db_get_dw((HCONTACT)wParam, USERINFO, SET_CONTACT_ADDEDTIME, 0); if (!dwStmp) { MTime mt; mt.GetLocalTime(); - mt.DBWriteStamp((HANDLE)wParam, USERINFO, SET_CONTACT_ADDEDTIME); + mt.DBWriteStamp((HCONTACT)wParam, USERINFO, SET_CONTACT_ADDEDTIME); // create updater, if not yet exists if (!ContactUpdater) @@ -858,8 +858,7 @@ static int OnContactAdded(WPARAM wParam, LPARAM lParam) ContactUpdater->AddIfDontHave( (ContactUpdater->Size() > 0) ? max(ContactUpdater->Get(ContactUpdater->Size() - 1)->check_time + 15000, 4000) - : 4000, - (HANDLE)wParam); + : 4000, (HCONTACT)wParam); } } catch(...) diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index e0dd88f83e..235694e451 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -173,7 +173,7 @@ static HICON GetAnnivIcon(const CEvent &evt) * @return nothing **/ -static void NotifyWithExtraIcon(HANDLE hContact, const CEvent &evt) +static void NotifyWithExtraIcon(HCONTACT hContact, const CEvent &evt) { if (gRemindOpts.bCListExtraIcon) { char szIcon[MAXSETTING], *icoName; @@ -244,7 +244,7 @@ static LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA * @return return value of the popup service **/ -static int NotifyWithPopup(HANDLE hContact, CEvent::EType eventType, int DaysToAnniv, LPCTSTR pszDesc, LPCTSTR pszMsg) +static int NotifyWithPopup(HCONTACT hContact, CEvent::EType eventType, int DaysToAnniv, LPCTSTR pszDesc, LPCTSTR pszMsg) { if (!gRemindOpts.bPopups) return 1; @@ -304,7 +304,7 @@ static int NotifyWithPopup(HANDLE hContact, CEvent::EType eventType, int DaysToA * @return nothing **/ -static void NotifyFlashCListIcon(HANDLE hContact, const CEvent &evt) +static void NotifyFlashCListIcon(HCONTACT hContact, const CEvent &evt) { if (!gRemindOpts.bFlashCList || evt._wDaysLeft != 0) return; @@ -369,7 +369,7 @@ static BYTE NotifyWithSound(const CEvent &evt) * "check for anniversary" functions ***********************************************************************************************************/ -static LPCTSTR ContactGender(HANDLE hContact) +static LPCTSTR ContactGender(HCONTACT hContact) { switch (GenderOf(hContact)) { case 'M': return TranslateT("He"); @@ -378,7 +378,7 @@ static LPCTSTR ContactGender(HANDLE hContact) return TranslateT("He/She"); } -static BYTE CheckAnniversaries(HANDLE hContact, MTime &Now, CEvent &evt, BYTE bNotify) +static BYTE CheckAnniversaries(HCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNotify) { int numAnniversaries = 0; int Diff; @@ -466,7 +466,7 @@ static BYTE CheckAnniversaries(HANDLE hContact, MTime &Now, CEvent &evt, BYTE bN * @retval FALSE - contact has no birthday or it is not within the desired period of time. **/ -static BYTE CheckBirthday(HANDLE hContact, MTime &Now, CEvent &evt, BYTE bNotify, PWORD LastAnwer) +static BYTE CheckBirthday(HCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNotify, PWORD LastAnwer) { BYTE result = FALSE; @@ -534,7 +534,7 @@ static BYTE CheckBirthday(HANDLE hContact, MTime &Now, CEvent &evt, BYTE bNotify * @return nothing **/ -static void CheckContact(HANDLE hContact, MTime &Now, CEvent &evt, BYTE bNotify, PWORD LastAnwer = 0) +static void CheckContact(HCONTACT hContact, MTime &Now, CEvent &evt, BYTE bNotify, PWORD LastAnwer = 0) { // ignore meta subcontacts here as their birthday information are collected explicitly if (hContact && @@ -570,7 +570,7 @@ void SvcReminderCheckAll(const ENotify notify) now.GetLocalTime(); //walk through all the contacts stored in the DB - for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) CheckContact(hContact, now, evt, notify != NOTIFY_CLIST, &a1); if (notify != NOTIFY_CLIST) { @@ -623,7 +623,7 @@ static int OnCListRebuildIcons(WPARAM, LPARAM) * @return This function must return 0 in order to continue in the notification chain. **/ -int OnCListApplyIcon(HANDLE hContact, LPARAM) +int OnCListApplyIcon(HCONTACT hContact, LPARAM) { if (gRemindOpts.RemindState != REMIND_OFF) { CEvent evt; @@ -645,7 +645,7 @@ int OnCListApplyIcon(HANDLE hContact, LPARAM) * @return This function must return 0 in order to continue in the notification chain. **/ -static int OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcws) +static int OnContactSettingChanged(HCONTACT hContact, DBCONTACTWRITESETTING* pdbcws) { if (hContact && // valid contact not owner! ghCListIA && // extraicons active @@ -656,7 +656,7 @@ static int OnContactSettingChanged(HANDLE hContact, DBCONTACTWRITESETTING* pdbcw !strncmp(pdbcws->szSetting, "Anniv", 5) || !strncmp(pdbcws->szSetting, "DOB", 3))) { - HANDLE hMeta = DB::MetaContact::GetMeta(hContact); + HCONTACT hMeta = DB::MetaContact::GetMeta(hContact); WORD LastAnswer = IDNONE; CEvent evt; MTime now; @@ -727,7 +727,7 @@ static INT_PTR CheckService(WPARAM, LPARAM) static INT_PTR BackupBirthdayService(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; MAnnivDate mdb; if (hContact) { @@ -872,7 +872,7 @@ void SvcReminderEnable(BYTE bEnable) UpdateTimer(TRUE); } else { // Reminder is off - for (HANDLE hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact)) NotifyWithExtraIcon(hContact, CEvent()); gRemindOpts.RemindState = REMIND_OFF; diff --git a/plugins/UserInfoEx/src/svc_timezone.cpp b/plugins/UserInfoEx/src/svc_timezone.cpp index 37f0a89d11..777a12e2a8 100644 --- a/plugins/UserInfoEx/src/svc_timezone.cpp +++ b/plugins/UserInfoEx/src/svc_timezone.cpp @@ -41,7 +41,7 @@ INT_PTR GetContactTimeZoneInformation(WPARAM wParam,LPARAM lParam) { //use new core tz interface LPTIME_ZONE_INFORMATION pTimeZoneInformation = (LPTIME_ZONE_INFORMATION)lParam; - (*pTimeZoneInformation) = *tmi.getTzi(tmi.createByContact((HANDLE)wParam, 0)); + (*pTimeZoneInformation) = *tmi.getTzi(tmi.createByContact((HCONTACT)wParam, 0)); return (pTimeZoneInformation == NULL); } @@ -58,7 +58,7 @@ INT_PTR GetContactLocalTime(WPARAM wParam, LPARAM lParam) { //use new core tz interface LPSYSTEMTIME pSystemTime = (LPSYSTEMTIME)lParam; - return (INT_PTR)tmi.getTimeZoneTimeByContact((HANDLE)wParam, pSystemTime); + return (INT_PTR)tmi.getTimeZoneTimeByContact((HCONTACT)wParam, pSystemTime); } /*********************************************************************************************************** diff --git a/plugins/UserInfoEx/src/svc_timezone_old.cpp b/plugins/UserInfoEx/src/svc_timezone_old.cpp index 683af3c65b..641d4c6d3e 100644 --- a/plugins/UserInfoEx/src/svc_timezone_old.cpp +++ b/plugins/UserInfoEx/src/svc_timezone_old.cpp @@ -375,7 +375,7 @@ static TZ_MAP MirTZ2WinTZ(const CHAR MirTz) * @retval CTimeZone* - Pointer to the timezone. **/ -CTimeZone* GetContactTimeZone(HANDLE hContact, LPCSTR pszProto) +CTimeZone* GetContactTimeZone(HCONTACT hContact, LPCSTR pszProto) { LPTSTR ptszName; CTimeZone* pTimeZone = NULL; @@ -410,7 +410,7 @@ CTimeZone* GetContactTimeZone(HANDLE hContact, LPCSTR pszProto) * **/ -CTimeZone* GetContactTimeZone(HANDLE hContact) +CTimeZone* GetContactTimeZone(HCONTACT hContact) { return GetContactTimeZone(hContact, DB::Contact::Proto(hContact)); } @@ -431,7 +431,7 @@ CTimeZone* GetContactTimeZone(HANDLE hContact) * @e dwIndex retrieved its value. If not, dwIndex is -100 (unspecified). **/ -WORD GetContactTimeZoneCtrl(HANDLE hContact, LPCSTR pszProto, CTimeZone** pTimeZone) +WORD GetContactTimeZoneCtrl(HCONTACT hContact, LPCSTR pszProto, CTimeZone** pTimeZone) { WORD flags; DBVARIANT dbv; @@ -476,7 +476,7 @@ WORD GetContactTimeZoneCtrl(HANDLE hContact, LPCSTR pszProto, CTimeZone** pTimeZ * @return String containing display name. **/ -LPCTSTR GetContactTimeZoneDisplayName(HANDLE hContact) +LPCTSTR GetContactTimeZoneDisplayName(HCONTACT hContact) { CTimeZone *pTimeZone; @@ -561,7 +561,7 @@ INT_PTR GetContactTimeZoneInformation_old(WPARAM wParam,LPARAM lParam) CTimeZone *pTimeZone; TIME_ZONE_INFORMATION* pTimeZoneInformation = (TIME_ZONE_INFORMATION*)lParam; - pTimeZone = GetContactTimeZone((HANDLE)wParam); + pTimeZone = GetContactTimeZone((HCONTACT)wParam); if (pTimeZone && pTimeZoneInformation) (*pTimeZoneInformation) = *pTimeZone; @@ -580,7 +580,7 @@ INT_PTR GetContactTimeZoneInformation_old(WPARAM wParam,LPARAM lParam) INT_PTR GetContactLocalTime_old(WPARAM wParam, LPARAM lParam) { MTime now; - now.GetLocalTime((HANDLE)wParam); + now.GetLocalTime((HCONTACT)wParam); LPSYSTEMTIME pSystemTime = (LPSYSTEMTIME)lParam; *pSystemTime = now.SystemTime(); diff --git a/plugins/UserInfoEx/src/svc_timezone_old.h b/plugins/UserInfoEx/src/svc_timezone_old.h index 8d8627039f..073794fd21 100644 --- a/plugins/UserInfoEx/src/svc_timezone_old.h +++ b/plugins/UserInfoEx/src/svc_timezone_old.h @@ -78,10 +78,10 @@ struct CTimeZone : public REG_TZI_FORMAT typedef INT_PTR (*PEnumNamesProc)(CTimeZone* pTimeZone, int index, LPARAM lParam); -CTimeZone* GetContactTimeZone(HANDLE hContact); -CTimeZone* GetContactTimeZone(HANDLE hContact, LPCSTR pszProto); -WORD GetContactTimeZoneCtrl(HANDLE hContact, LPCSTR pszProto, CTimeZone** pTimeZone); -LPCTSTR GetContactTimeZoneDisplayName(HANDLE hContact); +CTimeZone* GetContactTimeZone(HCONTACT hContact); +CTimeZone* GetContactTimeZone(HCONTACT hContact, LPCSTR pszProto); +WORD GetContactTimeZoneCtrl(HCONTACT hContact, LPCSTR pszProto, CTimeZone** pTimeZone); +LPCTSTR GetContactTimeZoneDisplayName(HCONTACT hContact); INT_PTR EnumTimeZones(PEnumNamesProc enumProc, LPARAM lParam); INT_PTR GetContactTimeZoneInformation_old(WPARAM wParam, LPARAM lParam); diff --git a/plugins/Utils/mir_buffer.h b/plugins/Utils/mir_buffer.h index 1461be9f61..40d450fa47 100644 --- a/plugins/Utils/mir_buffer.h +++ b/plugins/Utils/mir_buffer.h @@ -439,7 +439,7 @@ class Buffer }; -static void ReplaceVars(Buffer *buffer, HANDLE hContact, TCHAR **variables, int numVariables) +static void ReplaceVars(Buffer *buffer, HCONTACT hContact, TCHAR **variables, int numVariables) { if (buffer->len < 3) return; @@ -502,7 +502,7 @@ static void ReplaceVars(Buffer *buffer, HANDLE hContact, TCHAR **variable } -static void ReplaceTemplate(Buffer *out, HANDLE hContact, TCHAR *templ, TCHAR **vars, int numVars) +static void ReplaceTemplate(Buffer *out, HCONTACT hContact, TCHAR *templ, TCHAR **vars, int numVars) { if (ServiceExists(MS_VARS_FORMATSTRING)) diff --git a/plugins/Utils/mir_options.cpp b/plugins/Utils/mir_options.cpp index 1e0b5189df..5ceadf4486 100644 --- a/plugins/Utils/mir_options.cpp +++ b/plugins/Utils/mir_options.cpp @@ -33,7 +33,7 @@ Boston, MA 02111-1307, USA. #include "mir_options.h" #include "mir_memory.h" -static TCHAR* MyDBGetContactSettingTString(HANDLE hContact, char* module, char* setting, TCHAR* out, size_t len, TCHAR *def) +static TCHAR* MyDBGetContactSettingTString(HCONTACT hContact, char* module, char* setting, TCHAR* out, size_t len, TCHAR *def) { DBVARIANT dbv = {0}; diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index 2299324552..a655d799ae 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -75,7 +75,7 @@ static builtinCnfs[] = typedef struct { TCHAR* tszContact; - HANDLE hContact; + HCONTACT hContact; DWORD flags; } CONTACTCE; /* contact cache entry */ @@ -104,7 +104,7 @@ BYTE getContactInfoType(TCHAR* type) /* returns info about a contact as a string */ -TCHAR* getContactInfoT(BYTE type, HANDLE hContact) +TCHAR* getContactInfoT(BYTE type, HCONTACT hContact) { /* returns dynamic allocated buffer with info, or NULL if failed */ TCHAR *res = NULL; @@ -216,7 +216,7 @@ int getContactFromString(CONTACTSINFO *ci) for (int i=0; i < cacheSize; i++) { if ((!_tcscmp(cce[i].tszContact, tszContact)) && (ci->flags == cce[i].flags)) { /* found in cache */ - ci->hContacts = (HANDLE*)mir_alloc(sizeof(HANDLE)); + ci->hContacts = (HCONTACT*)mir_alloc(sizeof(HCONTACT)); if (ci->hContacts == NULL) return -1; @@ -227,7 +227,7 @@ int getContactFromString(CONTACTSINFO *ci) } /* contact was not in cache, do a search */ - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *szProto = GetContactProto(hContact); if (szProto == NULL) continue; @@ -325,7 +325,7 @@ int getContactFromString(CONTACTSINFO *ci) } } if (bMatch) { - ci->hContacts = (HANDLE*)mir_realloc(ci->hContacts, (count+1)*sizeof(HANDLE)); + ci->hContacts = (HCONTACT*)mir_realloc(ci->hContacts, (count + 1)*sizeof(HCONTACT)); if (ci->hContacts == NULL) return -1; @@ -353,7 +353,7 @@ int getContactFromString(CONTACTSINFO *ci) static int contactSettingChanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *dbw = (DBCONTACTWRITESETTING*)lParam; - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT)wParam; mir_cslock lck(csContactCache); for (int i=0; i < cacheSize; i++) { @@ -407,7 +407,7 @@ int deinitContactModule() // returns a string in the form , cannot be _HANDLE_! // result must be freed -TCHAR *encodeContactToString(HANDLE hContact) +TCHAR* encodeContactToString(HCONTACT hContact) { char *szProto = GetContactProto(hContact); TCHAR *tszUniqueId = getContactInfoT(CNF_UNIQUEID, hContact); @@ -423,16 +423,16 @@ TCHAR *encodeContactToString(HANDLE hContact) // returns a contact from a string in the form // returns INVALID_HANDLE_VALUE in case of an error. -HANDLE *decodeContactFromString(TCHAR *tszContact) +HCONTACT decodeContactFromString(TCHAR *tszContact) { - HANDLE hContact = INVALID_HANDLE_VALUE; + HCONTACT hContact = (HCONTACT)INVALID_HANDLE_VALUE; CONTACTSINFO ci = { sizeof(ci) }; ci.tszContact = tszContact; ci.flags = CI_PROTOID|CI_TCHAR; int count = getContactFromString( &ci ); if (count != 1) { mir_free(ci.hContacts); - return (HANDLE*)hContact; + return hContact; } if (ci.hContacts != NULL) { @@ -440,5 +440,5 @@ HANDLE *decodeContactFromString(TCHAR *tszContact) mir_free(ci.hContacts); } - return (HANDLE*)hContact; + return hContact; } diff --git a/plugins/Variables/src/contact.h b/plugins/Variables/src/contact.h index 5e5eae2e69..0a81df4d1f 100644 --- a/plugins/Variables/src/contact.h +++ b/plugins/Variables/src/contact.h @@ -83,7 +83,7 @@ typedef struct { WCHAR *wszContact; TCHAR *tszContact; }; - HANDLE *hContacts; // (output) Array of contacts found. + HCONTACT *hContacts; // (output) Array of contacts found. DWORD flags; // Contact details that will be matched with the search // string (flags can be combined). } CONTACTSINFO; @@ -115,5 +115,5 @@ typedef struct { #define CI_TCHAR 0 #endif -TCHAR *encodeContactToString(HANDLE hContact); -HANDLE *decodeContactFromString(TCHAR *tszContact); +TCHAR *encodeContactToString(HCONTACT hContact); +HCONTACT decodeContactFromString(TCHAR *tszContact); diff --git a/plugins/Variables/src/dbhelpers.h b/plugins/Variables/src/dbhelpers.h index cb5852de34..8cc7332a69 100644 --- a/plugins/Variables/src/dbhelpers.h +++ b/plugins/Variables/src/dbhelpers.h @@ -22,7 +22,7 @@ #endif // database helpers -static int __inline DBWriteIthSettingByte(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting,BYTE val) { +static int __inline DBWriteIthSettingByte(DWORD i, HCONTACT hContact,const char *szModule,const char *szSetting,BYTE val) { char dbSetting[128]; @@ -30,7 +30,7 @@ static int __inline DBWriteIthSettingByte(DWORD i, HANDLE hContact,const char *s return db_set_b(hContact, szModule, dbSetting, val); } -static int __inline DBWriteIthSettingWord(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting,WORD val) { +static int __inline DBWriteIthSettingWord(DWORD i, HCONTACT hContact,const char *szModule,const char *szSetting,WORD val) { char dbSetting[128]; @@ -38,7 +38,7 @@ static int __inline DBWriteIthSettingWord(DWORD i, HANDLE hContact,const char *s return db_set_w(hContact, szModule, dbSetting, val); } -static int __inline DBWriteIthSettingDword(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting,DWORD val) { +static int __inline DBWriteIthSettingDword(DWORD i, HCONTACT hContact,const char *szModule,const char *szSetting,DWORD val) { char dbSetting[128]; @@ -46,7 +46,7 @@ static int __inline DBWriteIthSettingDword(DWORD i, HANDLE hContact,const char * return db_set_dw(hContact, szModule, dbSetting, val); } -static int __inline DBWriteIthSettingString(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting,const char *val) { +static int __inline DBWriteIthSettingString(DWORD i, HCONTACT hContact,const char *szModule,const char *szSetting,const char *val) { char dbSetting[128]; @@ -54,7 +54,7 @@ static int __inline DBWriteIthSettingString(DWORD i, HANDLE hContact,const char return db_set_s(hContact, szModule, dbSetting, val); } -static int __inline DBGetIthSettingByte(DWORD i, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) { +static int __inline DBGetIthSettingByte(DWORD i, HCONTACT hContact, const char *szModule, const char *szSetting, int errorValue) { char dbSetting[128]; @@ -63,7 +63,7 @@ static int __inline DBGetIthSettingByte(DWORD i, HANDLE hContact, const char *sz return db_get_b(hContact, szModule, dbSetting, errorValue); } -static WORD __inline DBGetIthSettingWord(DWORD i, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) { +static WORD __inline DBGetIthSettingWord(DWORD i, HCONTACT hContact, const char *szModule, const char *szSetting, int errorValue) { char dbSetting[128]; @@ -72,7 +72,7 @@ static WORD __inline DBGetIthSettingWord(DWORD i, HANDLE hContact, const char *s return db_get_w(hContact, szModule, dbSetting, errorValue); } -static DWORD __inline DBGetIthSettingDword(DWORD i, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) { +static DWORD __inline DBGetIthSettingDword(DWORD i, HCONTACT hContact, const char *szModule, const char *szSetting, int errorValue) { char dbSetting[128]; @@ -81,7 +81,7 @@ static DWORD __inline DBGetIthSettingDword(DWORD i, HANDLE hContact, const char return db_get_dw(hContact, szModule, dbSetting, errorValue); } -static int __inline DBGetIthSetting(DWORD i, HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { +static int __inline DBGetIthSetting(DWORD i, HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { char dbSetting[128]; @@ -90,7 +90,7 @@ static int __inline DBGetIthSetting(DWORD i, HANDLE hContact, const char *szModu return db_get(hContact, szModule, dbSetting, dbv); } -static int __inline DBDeleteIthSetting(DWORD i, HANDLE hContact,const char *szModule,const char *szSetting) { +static int __inline DBDeleteIthSetting(DWORD i, HCONTACT hContact,const char *szModule,const char *szSetting) { char dbSetting[128]; diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index d19484235b..669d737aa3 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -140,9 +140,9 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM case VARM_SETSUBJECT: { LPARAM res = 0; - HANDLE hContact, hItem; + HCONTACT hContact, hItem; - hContact = (HANDLE)wParam; + hContact = (HCONTACT)wParam; log_debugA("VARM_SETSUBJECT: %u", hContact); if (hContact == INVALID_HANDLE_VALUE) { TCHAR *tszContact = db_get_tsa(NULL, MODULENAME, SETTING_SUBJECT); @@ -154,7 +154,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM } } if ((hContact != INVALID_HANDLE_VALUE) && (hContact != NULL)) - hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); + hItem = (HCONTACT)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); else hItem = NULL; @@ -225,7 +225,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM case WM_DESTROY: db_unset(NULL, MODULENAME, SETTING_SUBJECT); { - HANDLE hContact = (HANDLE)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0); + HCONTACT hContact = (HCONTACT)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0); if (hContact != NULL) { TCHAR *tszContact = encodeContactToString(hContact); if (tszContact != NULL) { @@ -726,7 +726,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM else extraText = NULL; if (string != NULL) { - TCHAR *newString = variables_parsedup(string, extraText, (HANDLE)SendMessage(GetParent(hwndDlg), VARM_GETSUBJECT, 0, 0)); + TCHAR *newString = variables_parsedup(string, extraText, (HCONTACT)SendMessage(GetParent(hwndDlg), VARM_GETSUBJECT, 0, 0)); if (newString != NULL) { TCHAR *oldString = Hlp_GetDlgItemText(hwndDlg, IDC_RESULT); if (oldString == NULL || _tcscmp(oldString, newString)) @@ -1003,7 +1003,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l SendMessageA(hwndDlg, VARM_GETEXTRATEXT, (WPARAM)len + 1, (LPARAM)dat->vhs->fi->szExtraText); } } - dat->vhs->fi->hContact = (HANDLE)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0); + dat->vhs->fi->hContact = (HCONTACT)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0); } // fall through diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index 65ccfe638c..3cb038c029 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -24,7 +24,7 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai) if (ai->argc != 2) return NULL; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; CONTACTSINFO ci = { 0 }; ci.cbSize = sizeof(ci); @@ -40,7 +40,7 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai) return NULL; } - hContact = (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); + hContact = (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); if (hContact == NULL) return NULL; @@ -79,7 +79,7 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai) if (ai->argc != 2) return NULL; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; CONTACTSINFO ci = { 0 }; ci.cbSize = sizeof(ci); @@ -95,7 +95,7 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai) return NULL; } - hContact = (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT, (WPARAM)hContact, 0); + hContact = (HCONTACT)CallService(MS_MC_GETDEFAULTCONTACT, (WPARAM)hContact, 0); if (hContact == NULL) return NULL; @@ -134,7 +134,7 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai) if (ai->argc != 2) return NULL; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; CONTACTSINFO ci = { 0 }; ci.cbSize = sizeof(ci); @@ -150,7 +150,7 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai) return NULL; } - hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + hContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); if (hContact == NULL) return NULL; diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index f2a9a1b4e9..3c7279782c 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -99,7 +99,7 @@ static TCHAR* parseContact(ARGUMENTSINFO *ai) mir_free(ci.hContacts); return NULL; } - HANDLE hContact = ci.hContacts[n]; + HCONTACT hContact = ci.hContacts[n]; log_debugA("contact: %x", hContact); mir_free(ci.hContacts); @@ -127,7 +127,7 @@ static TCHAR* parseContactInfo(ARGUMENTSINFO *ai) if (ai->argc != 3) return NULL; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; CONTACTSINFO ci = { 0 }; ci.cbSize = sizeof(ci); ci.tszContact = ai->targv[1]; @@ -172,7 +172,7 @@ static TCHAR* parseDBProfilePath(ARGUMENTSINFO *ai) return mir_tstrdup(path); } -static TCHAR* getDBSetting(HANDLE hContact, char* module, char* setting, TCHAR* defaultValue) +static TCHAR* getDBSetting(HCONTACT hContact, char* module, char* setting, TCHAR* defaultValue) { DBVARIANT dbv; if (db_get_s(hContact, module, setting, &dbv, 0)) @@ -210,7 +210,7 @@ static TCHAR* parseDBSetting(ARGUMENTSINFO *ai) return NULL; TCHAR *res = NULL, *szDefaultValue = NULL; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; if (_tcslen(ai->targv[1]) > 0) { CONTACTSINFO ci = { 0 }; @@ -247,7 +247,7 @@ static TCHAR* parseLastSeenDate(ARGUMENTSINFO *ai) if (ai->argc <= 1) return NULL; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; CONTACTSINFO ci = { 0 }; ci.cbSize = sizeof(ci); ci.tszContact = ai->targv[1]; @@ -300,7 +300,7 @@ static TCHAR* parseLastSeenTime(ARGUMENTSINFO *ai) if (ai->argc <= 1) return NULL; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; CONTACTSINFO ci = { 0 }; ci.cbSize = sizeof(ci); @@ -355,7 +355,7 @@ static TCHAR* parseLastSeenStatus(ARGUMENTSINFO *ai) if (ai->argc != 2) return NULL; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; CONTACTSINFO ci = { 0 }; ci.cbSize = sizeof(ci); ci.tszContact = ai->targv[1]; @@ -498,7 +498,7 @@ static BOOL isValidDbEvent(DBEVENTINFO *dbe, int flags) return (bEventType && bEventFlags); } -static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) +static HANDLE findDbEvent(HCONTACT hContact, HANDLE hDbEvent, int flags) { DBEVENTINFO dbe; BOOL bEventOk; @@ -530,7 +530,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) hMatchEvent = hSearchEvent = NULL; matchTimestamp = priorTimestamp = 0; if (flags & DBE_FIRST) { - for (HANDLE hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) { + for (HCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) { hSearchEvent = findDbEvent(hSearchContact, NULL, flags); dbe.cbBlob = 0; if (!db_event_get(hSearchEvent, &dbe)) { @@ -543,7 +543,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) hDbEvent = hMatchEvent; } else if (flags & DBE_LAST) { - for (HANDLE hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) { + for (HCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) { hSearchEvent = findDbEvent(hSearchContact, NULL, flags); dbe.cbBlob = 0; if (!db_event_get(hSearchEvent, &dbe)) { @@ -559,7 +559,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) dbe.cbBlob = 0; if (!db_event_get(hDbEvent, &dbe)) { priorTimestamp = dbe.timestamp; - for (HANDLE hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) { + for (HCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) { hSearchEvent = findDbEvent(hSearchContact, hDbEvent, flags); dbe.cbBlob = 0; if (!db_event_get(hSearchEvent, &dbe)) { @@ -575,7 +575,7 @@ static HANDLE findDbEvent(HANDLE hContact, HANDLE hDbEvent, int flags) else if (flags & DBE_PREV) { if (!db_event_get(hDbEvent, &dbe)) { priorTimestamp = dbe.timestamp; - for (HANDLE hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) { + for (HCONTACT hSearchContact = db_find_first(); hSearchContact; hSearchContact = db_find_next(hSearchContact)) { hSearchEvent = findDbEvent(hSearchContact, hDbEvent, flags); dbe.cbBlob = 0; if (!db_event_get(hSearchEvent, &dbe)) { @@ -648,7 +648,7 @@ static TCHAR* parseDbEvent(ARGUMENTSINFO *ai) break; } - HANDLE hContact = NULL; + HCONTACT hContact = NULL; CONTACTSINFO ci = { 0 }; ci.cbSize = sizeof(ci); diff --git a/plugins/Variables/src/variables.h b/plugins/Variables/src/variables.h index 2eb66836ff..a537364c84 100644 --- a/plugins/Variables/src/variables.h +++ b/plugins/Variables/src/variables.h @@ -122,7 +122,7 @@ For example: ?contact(miranda@hotmail.com,email) or ?contact(Miranda,nick). The #define VARM_GETINPUTTEXT (WM_APP+13) #define VARM_GETINPUTTEXTLENGTH (WM_APP+14) #define VARM_SETSUBJECT (WM_APP+15) -#define VARM_GETSUBJECT (WM_APP+16) // wParam=HANDLE hContact +#define VARM_GETSUBJECT (WM_APP+16) // wParam=HCONTACT hContact #define VARM_SETEXTRATEXT (WM_APP+17) #define VARM_GETEXTRATEXT (WM_APP+18) #define VARM_GETEXTRATEXTLENGTH (WM_APP+19) @@ -136,7 +136,7 @@ typedef struct { int cbSize; char *szFormat; char *szSource; - HANDLE hContact; + HCONTACT hContact; int pCount; // number of succesful parses int eCount; // number of failures } FORMATINFOV1; @@ -172,7 +172,7 @@ int initTokenRegister(); int deinitTokenRegister(); // contact.c BYTE getContactInfoType(TCHAR* type); -TCHAR* getContactInfoT(BYTE type, HANDLE hContact); +TCHAR* getContactInfoT(BYTE type, HCONTACT hContact); int getContactFromString( CONTACTSINFO* ); int initContactModule(); int deinitContactModule(); diff --git a/plugins/Watrack_MPD/src/utilities.cpp b/plugins/Watrack_MPD/src/utilities.cpp index 55e100cea1..901bfbe6b9 100755 --- a/plugins/Watrack_MPD/src/utilities.cpp +++ b/plugins/Watrack_MPD/src/utilities.cpp @@ -17,7 +17,7 @@ #include "commonheaders.h" -TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef) +TCHAR* __stdcall UniGetContactSettingUtf(HCONTACT hContact, const char *szModule,const char* szSetting, TCHAR* szDef) { DBVARIANT dbv = {DBVT_DELETED}; TCHAR* szRes = NULL; diff --git a/plugins/Watrack_MPD/src/utilities.h b/plugins/Watrack_MPD/src/utilities.h index 018f32a03c..6460a8d479 100755 --- a/plugins/Watrack_MPD/src/utilities.h +++ b/plugins/Watrack_MPD/src/utilities.h @@ -2,6 +2,6 @@ #define UTILITIES_H HANDLE CreateThreadEx(pThreadFuncEx AFunc, void* arg, DWORD* pThreadID); -TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef); +TCHAR* __stdcall UniGetContactSettingUtf(HCONTACT hContact, const char *szModule,const char* szSetting, TCHAR* szDef); #endif diff --git a/plugins/Weather/src/weather.h b/plugins/Weather/src/weather.h index 0130a8e383..27fd3f82c7 100644 --- a/plugins/Weather/src/weather.h +++ b/plugins/Weather/src/weather.h @@ -226,7 +226,7 @@ struct MYOPTIONS // other misc stuff TCHAR Default[64]; - HANDLE DefStn; + HCONTACT DefStn; }; void DestroyOptions(void); @@ -234,7 +234,7 @@ void DestroyOptions(void); //============ STRUCT USED TO MAKE AN UPDATE LIST ============ struct WCONTACTLIST { - HANDLE hContact; + HCONTACT hContact; struct WCONTACTLIST *next; }; @@ -395,7 +395,7 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa int ContactDeleted(WPARAM wParam,LPARAM lParam); -BOOL IsMyContact(HANDLE hContact); +BOOL IsMyContact(HCONTACT hContact); // functions in weather_conv.c BOOL is_number(char *s); @@ -422,10 +422,10 @@ void GetID(TCHAR *pszID); TCHAR *GetError(int code); // functions in weather_data.c -void GetStationID(HANDLE hContact, TCHAR* id, size_t idlen); -WEATHERINFO LoadWeatherInfo(HANDLE Change); -int DBGetData(HANDLE hContact, char *setting, DBVARIANT *dbv); -int DBGetStaticString(HANDLE hContact, const char *szModule, const char *valueName, TCHAR *dest, size_t dest_len); +void GetStationID(HCONTACT hContact, TCHAR* id, size_t idlen); +WEATHERINFO LoadWeatherInfo(HCONTACT Change); +int DBGetData(HCONTACT hContact, char *setting, DBVARIANT *dbv); +int DBGetStaticString(HCONTACT hContact, const char *szModule, const char *valueName, TCHAR *dest, size_t dest_len); void EraseAllInfo(void); @@ -438,7 +438,7 @@ void wSetData(WCHAR **Data, const WCHAR *Value); void wfree(char **Data); void wfree(WCHAR **Data); -void DBDataManage(HANDLE hContact, WORD Mode, WPARAM wParam, LPARAM lParam); +void DBDataManage(HCONTACT hContact, WORD Mode, WPARAM wParam, LPARAM lParam); // functions in weather_http.c int InternetDownloadFile (char *szUrl, char *cookie, TCHAR** szData); @@ -498,12 +498,12 @@ INT_PTR WeatherLoadIcon(WPARAM wParam, LPARAM lParam); void UpdateMenu(BOOL State); void UpdatePopupMenu(BOOL State); void AddMenuItems(); -void AvatarDownloaded(HANDLE hContact); +void AvatarDownloaded(HCONTACT hContact); // functions in weather_update.c -int UpdateWeather(HANDLE hContact); +int UpdateWeather(HCONTACT hContact); -int RetrieveWeather(HANDLE hContact, WEATHERINFO *winfo); +int RetrieveWeather(HCONTACT hContact, WEATHERINFO *winfo); void UpdateAll(BOOL AutoUpdate, BOOL RemoveOld); void UpdateThreadProc(LPVOID hWnd); @@ -512,7 +512,7 @@ INT_PTR UpdateAllInfo(WPARAM wParam,LPARAM lParam); INT_PTR UpdateSingleRemove(WPARAM wParam,LPARAM lParam); INT_PTR UpdateAllRemove(WPARAM wParam,LPARAM lParam); -int GetWeatherData(HANDLE hContact); +int GetWeatherData(HCONTACT hContact); void CALLBACK timerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); void CALLBACK timerProc2(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime); @@ -522,8 +522,8 @@ void InitMwin(void); void DestroyMwin(void); INT_PTR Mwin_MenuClicked(WPARAM wParam, LPARAM lParam); int BuildContactMenu(WPARAM wparam, LPARAM lparam); -void UpdateMwinData(HANDLE hContact); -void removeWindow(HANDLE hContact); +void UpdateMwinData(HCONTACT hContact); +void removeWindow(HCONTACT hContact); // functions in weather_userinfo.c int UserInfoInit(WPARAM wParam, LPARAM lParam); @@ -535,7 +535,7 @@ INT_PTR CALLBACK DlgProcINIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int BriefInfo(WPARAM wParam, LPARAM lParam); INT_PTR BriefInfoSvc(WPARAM wParam, LPARAM lParam); -void LoadBriefInfoText(HWND hwndDlg, HANDLE hContact); +void LoadBriefInfoText(HWND hwndDlg, HCONTACT hContact); INT_PTR CALLBACK DlgProcBrief(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); void InitIcons(void); diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index 25e95846e6..a587b471a6 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -40,7 +40,7 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam) return 0; // search for existing contact - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { // check if it is a weather contact if ( IsMyContact(hContact)) { DBVARIANT dbv; @@ -64,7 +64,7 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam) // if contact with the same ID was not found, add it if (psr->cbSize < sizeof(PROTOSEARCHRESULT)) return 0; - HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); + HCONTACT hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)WEATHERPROTONAME); // suppress online notification for the new contact CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, IGNOREEVENT_USERONLINE); diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp index 9f93bd6a1a..13758addac 100644 --- a/plugins/Weather/src/weather_contacts.cpp +++ b/plugins/Weather/src/weather_contacts.cpp @@ -43,7 +43,7 @@ INT_PTR ViewLog(WPARAM wParam, LPARAM lParam) { // see if the log path is set DBVARIANT dbv; - if ( !db_get_ts((HANDLE)wParam, WEATHERPROTONAME, "Log", &dbv)) { + if (!db_get_ts((HCONTACT)wParam, WEATHERPROTONAME, "Log", &dbv)) { if (dbv.pszVal[0] != 0) ShellExecute((HWND)lParam, _T("open"), dbv.ptszVal, _T(""), _T(""), SW_SHOW); db_free(&dbv); @@ -59,10 +59,10 @@ INT_PTR ViewLog(WPARAM wParam, LPARAM lParam) INT_PTR LoadForecast(WPARAM wParam, LPARAM lParam) { TCHAR id[256], loc2[256]; - GetStationID((HANDLE)wParam, id, SIZEOF(id)); + GetStationID((HCONTACT)wParam, id, SIZEOF(id)); if (id[0] != 0) { // check if the complte forecast URL is set. If it is not, display warning and quit - if ( DBGetStaticString((HANDLE)wParam, WEATHERPROTONAME, "InfoURL", loc2, SIZEOF(loc2)) || loc2[0] == 0) { + if (DBGetStaticString((HCONTACT)wParam, WEATHERPROTONAME, "InfoURL", loc2, SIZEOF(loc2)) || loc2[0] == 0) { MessageBox(NULL, TranslateT("The URL for complete forcast have not been set. You can set it from the Edit Settings dialog."), TranslateT("Weather Protocol"), MB_ICONINFORMATION); return 1; @@ -78,10 +78,10 @@ INT_PTR LoadForecast(WPARAM wParam, LPARAM lParam) INT_PTR WeatherMap(WPARAM wParam, LPARAM lParam) { TCHAR id[256], loc2[256]; - GetStationID((HANDLE)wParam, id, SIZEOF(id)); + GetStationID((HCONTACT)wParam, id, SIZEOF(id)); if (id[0] != 0) { // check if the weather map URL is set. If it is not, display warning and quit - if ( DBGetStaticString((HANDLE)wParam, WEATHERPROTONAME, "MapURL", loc2, SIZEOF(loc2)) || loc2[0] == 0) { + if (DBGetStaticString((HCONTACT)wParam, WEATHERPROTONAME, "MapURL", loc2, SIZEOF(loc2)) || loc2[0] == 0) { MessageBox(NULL, TranslateT("The URL for weather map have not been set. You can set it from the Edit Settings dialog."), TranslateT("Weather Protocol"), MB_ICONINFORMATION); return 1; } @@ -99,7 +99,7 @@ INT_PTR WeatherMap(WPARAM wParam, LPARAM lParam) // wParam = current contact INT_PTR EditSettings(WPARAM wParam, LPARAM lParam) { - HWND hEditDlg = WindowList_Find(hWindowList, (HANDLE)wParam); + HWND hEditDlg = WindowList_Find(hWindowList, (HCONTACT)wParam); // search the dialog list to prevent multiple instance of dialog for the same contact if (hEditDlg != NULL) { @@ -109,7 +109,7 @@ INT_PTR EditSettings(WPARAM wParam, LPARAM lParam) } else { // if the dialog box is not opened, open a new one - if (IsMyContact((HANDLE)wParam)) + if (IsMyContact((HCONTACT)wParam)) CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_EDIT), NULL, DlgProcChange, (LPARAM)wParam); } @@ -118,7 +118,7 @@ INT_PTR EditSettings(WPARAM wParam, LPARAM lParam) typedef struct { - HANDLE hContact; + HCONTACT hContact; HICON hRename; HICON hUserDetail; HICON hFile; @@ -133,7 +133,7 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa TCHAR str[256], str2[256], city[256], filter[256], *pfilter, *chop; char loc[512]; OPENFILENAME ofn; // common dialog box structure - HANDLE hContact; + HCONTACT hContact; WIDATA *sData; CntSetWndDataType *wndData = NULL; @@ -142,7 +142,7 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa TranslateDialogDefault(hwndDlg); wndData = ( CntSetWndDataType* )mir_alloc(sizeof(CntSetWndDataType)); - wndData->hContact = hContact = (HANDLE)lParam; + wndData->hContact = hContact = (HCONTACT)lParam; wndData->hRename = LoadSkinnedIcon(SKINICON_OTHER_RENAME); wndData->hUserDetail = LoadSkinnedIcon(SKINICON_OTHER_USERDETAILS); wndData->hFile = LoadSkinnedIcon(SKINICON_EVENT_FILE); @@ -430,14 +430,14 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa // wParam = deleted contact int ContactDeleted(WPARAM wParam, LPARAM lParam) { - if ( !IsMyContact((HANDLE)wParam)) + if (!IsMyContact((HCONTACT)wParam)) return 0; - removeWindow((HANDLE)wParam); + removeWindow((HCONTACT)wParam); // exit this function if it is not default station DBVARIANT dbv; - if ( !db_get_ts((HANDLE)wParam, WEATHERPROTONAME, "ID", &dbv)) { + if (!db_get_ts((HCONTACT)wParam, WEATHERPROTONAME, "ID", &dbv)) { if ( _tcscmp(dbv.ptszVal, opt.Default)) { db_free(&dbv); return 0; @@ -448,7 +448,7 @@ int ContactDeleted(WPARAM wParam, LPARAM lParam) // now the default station is deleted, try to get a new one // start looking for other weather stations - for (HANDLE hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) { + for (HCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) { if ( !db_get_ts(hContact, WEATHERPROTONAME, "ID", &dbv)) { // if the station is not a default station, set it as the new default station // this is the first weather station encountered from the search @@ -475,7 +475,7 @@ int ContactDeleted(WPARAM wParam, LPARAM lParam) return 0; } -BOOL IsMyContact(HANDLE hContact) +BOOL IsMyContact(HCONTACT hContact) { const char* szProto = GetContactProto(hContact); return szProto != NULL && strcmp(WEATHERPROTONAME, szProto) == 0; diff --git a/plugins/Weather/src/weather_conv.cpp b/plugins/Weather/src/weather_conv.cpp index c986ab7530..7e18e3f749 100644 --- a/plugins/Weather/src/weather_conv.cpp +++ b/plugins/Weather/src/weather_conv.cpp @@ -572,7 +572,7 @@ TCHAR* GetDisplay(WEATHERINFO *w, const TCHAR *dis, TCHAR* str) TCHAR svcReturnText[MAX_TEXT_SIZE]; INT_PTR GetDisplaySvcFunc(WPARAM wParam, LPARAM lParam) { - WEATHERINFO winfo = LoadWeatherInfo((HANDLE)wParam); + WEATHERINFO winfo = LoadWeatherInfo((HCONTACT)wParam); return (INT_PTR)GetDisplay(&winfo, (TCHAR*)lParam, svcReturnText); } diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp index 4f5aaaa0ad..288b415509 100644 --- a/plugins/Weather/src/weather_data.cpp +++ b/plugins/Weather/src/weather_data.cpp @@ -30,7 +30,7 @@ saving individual weather data for a weather contact. // hContact = the current contact handle // return value = the string for station ID -void GetStationID(HANDLE hContact, TCHAR* id, size_t idlen) +void GetStationID(HCONTACT hContact, TCHAR* id, size_t idlen) { // accessing the database if (DBGetStaticString(hContact, WEATHERPROTONAME, "ID", id, idlen)) @@ -40,7 +40,7 @@ void GetStationID(HANDLE hContact, TCHAR* id, size_t idlen) // initialize weather info by loading values from database // hContact = current contact handle // return value = the current weather information in WEATHERINFO struct -WEATHERINFO LoadWeatherInfo(HANDLE hContact) +WEATHERINFO LoadWeatherInfo(HCONTACT hContact) { // obtaining values from the DB // assuming station ID must exist at all time, but others does not have to @@ -86,7 +86,7 @@ WEATHERINFO LoadWeatherInfo(HANDLE hContact) // getting weather setting from database // return 0 on success -int DBGetData(HANDLE hContact, char *setting, DBVARIANT *dbv) +int DBGetData(HCONTACT hContact, char *setting, DBVARIANT *dbv) { if ( db_get_ts(hContact, WEATHERCONDITION, setting, dbv)) { size_t len = strlen(setting) + 1; @@ -100,7 +100,7 @@ int DBGetData(HANDLE hContact, char *setting, DBVARIANT *dbv) return 0; } -int DBGetStaticString(HANDLE hContact, const char *szModule, const char *valueName, TCHAR *dest, size_t dest_len) +int DBGetStaticString(HCONTACT hContact, const char *szModule, const char *valueName, TCHAR *dest, size_t dest_len) { DBVARIANT dbv; if ( db_get_ts( hContact, szModule, valueName, &dbv )) @@ -121,10 +121,10 @@ void EraseAllInfo() { TCHAR str[255]; int ContactCount = 0; - HANDLE LastContact = NULL; + HCONTACT LastContact = NULL; DBVARIANT dbv; // loop through all contacts - for (HANDLE hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) { + for (HCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) { db_set_w(hContact,WEATHERPROTONAME, "Status",ID_STATUS_OFFLINE); db_set_w(hContact,WEATHERPROTONAME, "StatusIcon",ID_STATUS_OFFLINE); db_unset(hContact, "CList", "MyHandle"); @@ -424,7 +424,7 @@ int GetWeatherDataFromDB(const char *szSetting, LPARAM lparam) // remove or display the weather information for a contact // hContact - the contact in which the info is going to be removed -void DBDataManage(HANDLE hContact, WORD Mode, WPARAM wParam, LPARAM lParam) +void DBDataManage(HCONTACT hContact, WORD Mode, WPARAM wParam, LPARAM lParam) { LIST arSettings(10); diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index 6ccbfb19f0..8444644f7f 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -30,7 +30,7 @@ HGENMENU hMwinMenu; typedef struct { - HANDLE hContact; + HCONTACT hContact; HWND hAvt; BOOL haveAvatar; } MWinDataType; @@ -47,7 +47,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara data = (MWinDataType*)mir_calloc(sizeof(MWinDataType)); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data); - data->hContact = (HANDLE)((LPCREATESTRUCT)lParam)->lpCreateParams; + data->hContact = (HCONTACT)((LPCREATESTRUCT)lParam)->lpCreateParams; data->hAvt = CreateWindow(AVATAR_CONTROL_CLASS, TEXT(""), WS_CHILD, 0, 0, opt.AvatarSize, opt.AvatarSize, hwnd, NULL, hInst, 0); if (data->hAvt) SendMessage(data->hAvt, AVATAR_SETCONTACT, 0, (LPARAM)data->hContact); @@ -246,7 +246,7 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara return(TRUE); } -static void addWindow(HANDLE hContact) +static void addWindow(HCONTACT hContact) { DBVARIANT dbv; db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv); @@ -273,7 +273,7 @@ static void addWindow(HANDLE hContact) db_set_b(hContact, "CList", "Hidden", TRUE); } -void removeWindow(HANDLE hContact) +void removeWindow(HCONTACT hContact) { DWORD frameId = db_get_dw(hContact, WEATHERPROTONAME, "mwin", 0); @@ -284,7 +284,7 @@ void removeWindow(HANDLE hContact) db_unset(hContact, "CList", "Hidden"); } -void UpdateMwinData(HANDLE hContact) +void UpdateMwinData(HCONTACT hContact) { HWND hwnd = WindowList_Find(hMwinWindowList, hContact); if (hwnd != NULL) @@ -294,11 +294,11 @@ void UpdateMwinData(HANDLE hContact) INT_PTR Mwin_MenuClicked(WPARAM wParam,LPARAM lParam) { - BOOL addwnd = WindowList_Find(hMwinWindowList, (HANDLE)wParam) == NULL; + BOOL addwnd = WindowList_Find(hMwinWindowList, (HCONTACT)wParam) == NULL; if (addwnd) - addWindow((HANDLE)wParam); + addWindow((HCONTACT)wParam); else - removeWindow((HANDLE)wParam); + removeWindow((HCONTACT)wParam); return 0; } @@ -307,7 +307,7 @@ int BuildContactMenu(WPARAM wparam,LPARAM lparam) { CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | - (db_get_dw((HANDLE)wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0); + (db_get_dw((HCONTACT)wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0); Menu_ModifyItem(hMwinMenu, &mi); return 0; } @@ -372,7 +372,7 @@ void InitMwin(void) strcpy(fontid.prefix, "fnt1"); FontRegisterT(&fontid); - for (HANDLE hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) + for (HCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) if (db_get_dw(hContact, WEATHERPROTONAME, "mwin", 0)) addWindow(hContact); @@ -381,7 +381,7 @@ void InitMwin(void) void DestroyMwin(void) { - for (HANDLE hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) { + for (HCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) { DWORD frameId = db_get_dw(hContact, WEATHERPROTONAME, "mwin", 0); if (frameId) CallService(MS_CLIST_FRAMES_REMOVEFRAME, frameId, 0); diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp index d8396532fd..27152b0d9b 100644 --- a/plugins/Weather/src/weather_popup.cpp +++ b/plugins/Weather/src/weather_popup.cpp @@ -36,26 +36,17 @@ int WeatherPopup(WPARAM wParam, LPARAM lParam) { // determine if the popup should display or not if (opt.UsePopup && opt.UpdatePopup && (!opt.PopupOnChange || (BOOL)lParam) && - !db_get_b((HANDLE)wParam, WEATHERPROTONAME, "DPopUp", 0)) + !db_get_b((HCONTACT)wParam, WEATHERPROTONAME, "DPopUp", 0)) { - POPUPDATAT ppd = {0}; - WEATHERINFO winfo; - - // setup the popup - ppd.lchContact = (HANDLE)wParam; -// if ((HANDLE)wParam != NULL) { // for actual contact - winfo = LoadWeatherInfo((HANDLE)wParam); - ppd.PluginData = ppd.lchIcon = LoadSkinnedProtoIcon(WEATHERPROTONAME, winfo.status); - GetDisplay(&winfo, opt.pTitle, ppd.lptzContactName); - GetDisplay(&winfo, opt.pText, ppd.lptzText); - ppd.PluginWindowProc = PopupDlgProc; -// } -// else { // for preview -// ppd.lchIcon = LoadSkinnedProtoIcon(WEATHERPROTONAME, ONLINE); -// strcpy(ppd.lpzContactName, Translate("This is the name of the city")); -// strcpy(ppd.lpzText, Translate("Here is a short weather description")); -// ppd.PluginWindowProc = NULL; -// } + WEATHERINFO winfo = LoadWeatherInfo((HCONTACT)wParam); + + // setup the popup + POPUPDATAT ppd = { 0 }; + ppd.lchContact = (HCONTACT)wParam; + ppd.PluginData = ppd.lchIcon = LoadSkinnedProtoIcon(WEATHERPROTONAME, winfo.status); + GetDisplay(&winfo, opt.pTitle, ppd.lptzContactName); + GetDisplay(&winfo, opt.pText, ppd.lptzText); + ppd.PluginWindowProc = PopupDlgProc; ppd.colorBack = (opt.UseWinColors)?GetSysColor(COLOR_BTNFACE):opt.BGColour; ppd.colorText = (opt.UseWinColors)?GetSysColor(COLOR_WINDOWTEXT):opt.TextColour; ppd.iSeconds = opt.pDelay; @@ -129,7 +120,7 @@ int WPShowMessage(TCHAR* lpzText, WORD kind) LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { DWORD ID = 0; - HANDLE hContact; + HCONTACT hContact; hContact = PUGetContact(hWnd); switch(message) { @@ -257,7 +248,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) HMENU hMenu, hMenu1; RECT pos; HWND button; - HANDLE hContact; + HCONTACT hContact; switch (msg) { case WM_INITDIALOG: diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index a398b748b9..6362a9c65d 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -110,7 +110,7 @@ INT_PTR WeatherLoadIcon(WPARAM wParam,LPARAM lParam) static void __cdecl AckThreadProc(HANDLE param) { Sleep(100); - ProtoBroadcastAck(WEATHERPROTONAME, param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0); + ProtoBroadcastAck(WEATHERPROTONAME, (HCONTACT)param, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0); } // nothing to do here because weather proto do not need to retrieve contact info form network @@ -163,7 +163,7 @@ INT_PTR WeatherGetAvatarInfo(WPARAM wParam, LPARAM lParam) } -void AvatarDownloaded(HANDLE hContact) +void AvatarDownloaded(HCONTACT hContact) { PROTO_AVATAR_INFORMATIONT AI = {0}; AI.cbSize = sizeof(AI); @@ -176,16 +176,16 @@ void AvatarDownloaded(HANDLE hContact) } -static void __cdecl WeatherGetAwayMsgThread(HANDLE hContact) +static void __cdecl WeatherGetAwayMsgThread(void *hContact) { Sleep(100); DBVARIANT dbv; - if ( !db_get_ts(hContact, "CList", "StatusMsg", &dbv)) { - ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal); + if (!db_get_ts((HCONTACT)hContact, "CList", "StatusMsg", &dbv)) { + ProtoBroadcastAck(WEATHERPROTONAME, (HCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal); db_free( &dbv ); } - else ProtoBroadcastAck(WEATHERPROTONAME, hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0); + else ProtoBroadcastAck(WEATHERPROTONAME, (HCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0); } static INT_PTR WeatherGetAwayMsg(WPARAM wParam, LPARAM lParam) diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index ace0423881..a951d5980b 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -34,7 +34,7 @@ UPDATELIST *UpdateListTail; // retrieve weather info and display / log them // hContact = current contact -int UpdateWeather(HANDLE hContact) +int UpdateWeather(HCONTACT hContact) { TCHAR str[256], str2[MAX_TEXT_SIZE]; DBVARIANT dbv; @@ -219,7 +219,7 @@ int UpdateWeather(HANDLE hContact) // a linked list queue for updating weather station // this function add a weather contact to the end of queue for update // hContact = current contact -void UpdateListAdd(HANDLE hContact) +void UpdateListAdd(HCONTACT hContact) { UPDATELIST *newItem = (UPDATELIST*)mir_alloc(sizeof(UPDATELIST)); newItem->hContact = hContact; @@ -236,9 +236,9 @@ void UpdateListAdd(HANDLE hContact) // get the first item from the update queue and remove it from the queue // return value = the contact for next update -HANDLE UpdateGetFirst() +HCONTACT UpdateGetFirst() { - HANDLE hContact = NULL; + HCONTACT hContact = NULL; WaitForSingleObject(hUpdateMutex, INFINITE); @@ -283,9 +283,10 @@ void DestroyUpdateList(void) void UpdateAll(BOOL AutoUpdate, BOOL RemoveData) { // add all weather contact to the update queue list - for (HANDLE hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) + for (HCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) if ( !db_get_b(hContact,WEATHERPROTONAME, "AutoUpdate",FALSE) || !AutoUpdate) { - if (RemoveData) DBDataManage((HANDLE)hContact, WDBM_REMOVE, 0, 0); + if (RemoveData) + DBDataManage((HCONTACT)hContact, WDBM_REMOVE, 0, 0); UpdateListAdd(hContact); } @@ -299,9 +300,9 @@ void UpdateAll(BOOL AutoUpdate, BOOL RemoveData) // wParam = handle for the weather station that is going to be updated INT_PTR UpdateSingleStation(WPARAM wParam, LPARAM lParam) { - if (IsMyContact((HANDLE)wParam)) { + if (IsMyContact((HCONTACT)wParam)) { // add the station to the end of the update queue - UpdateListAdd((HANDLE)wParam); + UpdateListAdd((HCONTACT)wParam); // if it is not updating, then start the update thread process // if it is updating, the stations just added to the queue will get @@ -317,10 +318,10 @@ INT_PTR UpdateSingleStation(WPARAM wParam, LPARAM lParam) // wParam = handle for the weather station that is going to be updated INT_PTR UpdateSingleRemove(WPARAM wParam, LPARAM lParam) { - if (IsMyContact((HANDLE)wParam)) { + if (IsMyContact((HCONTACT)wParam)) { // add the station to the end of the update queue, and also remove old data - DBDataManage((HANDLE)wParam, WDBM_REMOVE, 0, 0); - UpdateListAdd((HANDLE)wParam); + DBDataManage((HCONTACT)wParam, WDBM_REMOVE, 0, 0); + UpdateListAdd((HCONTACT)wParam); // if it is not updating, then start the update thread process // if it is updating, the stations just added to the queue will get updated by the already-running process @@ -372,7 +373,7 @@ INT_PTR UpdateAllRemove(WPARAM wParam,LPARAM lParam) { // getting weather data and save them into the database // hContact = the contact to get the data -int GetWeatherData(HANDLE hContact) +int GetWeatherData(HCONTACT hContact) { // get eacnh part of the id's TCHAR id[256]; diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp index 955b46639b..827badd085 100644 --- a/plugins/Weather/src/weather_userinfo.cpp +++ b/plugins/Weather/src/weather_userinfo.cpp @@ -46,7 +46,7 @@ int UserInfoInit(WPARAM wParam, LPARAM lParam) } else { // check if it is a weather contact - if (IsMyContact((HANDLE)lParam)) { + if (IsMyContact((HCONTACT)lParam)) { // register the contact info page odp.pszTemplate = MAKEINTRESOURCEA(IDD_USERINFO); odp.pfnDlgProc = DlgProcUIPage; @@ -64,16 +64,16 @@ INT_PTR CALLBACK DlgProcUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa WEATHERINFO w; TCHAR str[MAX_TEXT_SIZE]; - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SendMessage(GetDlgItem(hwndDlg,IDC_MOREDETAIL), BUTTONSETASFLATBTN, TRUE, 0); // save the contact handle for later use - hContact = (HANDLE)lParam; + hContact = (HCONTACT)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hContact); // load weather info for the contact - w = LoadWeatherInfo((HANDLE)lParam); + w = LoadWeatherInfo((HCONTACT)lParam); SetDlgItemText(hwndDlg, IDC_INFO1, GetDisplay(&w, TranslateT("Current condition for %n"), str)); SendDlgItemMessage(hwndDlg, IDC_INFOICON, STM_SETICON, @@ -158,12 +158,12 @@ static int BriefDlgResizer(HWND hwnd, LPARAM lParam, UTILRESIZECONTROL *urc) INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static const unsigned tabstops = 48; - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: // save the contact handle for later use - hContact = (HANDLE)lParam; + hContact = (HCONTACT)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hContact); SendDlgItemMessage(hwndDlg, IDC_MTEXT, EM_AUTOURLDETECT, (WPARAM) TRUE, 0); @@ -327,7 +327,7 @@ INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l // set the title of the dialog and on the which rectangle // also load brief info into message box -void LoadBriefInfoText(HWND hwndDlg, HANDLE hContact) +void LoadBriefInfoText(HWND hwndDlg, HCONTACT hContact) { WEATHERINFO winfo; TCHAR str[4096], str2[4096]; @@ -354,8 +354,8 @@ void LoadBriefInfoText(HWND hwndDlg, HANDLE hContact) int BriefInfo(WPARAM wParam, LPARAM lParam) { // make sure that the contact is actually a weather one - if (IsMyContact((HANDLE)wParam)) { - HWND hMoreDataDlg = WindowList_Find(hDataWindowList,(HANDLE)wParam); + if (IsMyContact((HCONTACT)wParam)) { + HWND hMoreDataDlg = WindowList_Find(hDataWindowList, (HCONTACT)wParam); if (hMoreDataDlg != NULL) { SetForegroundWindow(hMoreDataDlg); SetFocus(hMoreDataDlg); diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index a627aec43b..1432bb4c4e 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -96,7 +96,7 @@ void ChangeContactStatus(int con_stat) if (con_stat == 3) status_code = ID_STATUS_NA; - for (HANDLE hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) + for (HCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) db_set_w(hContact, MODULENAME, "Status", status_code); } diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index 5ce833865b..c1e00d6532 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -104,7 +104,7 @@ void FillFontListThread(void *param) /*****************************************************************************/ void TxtclrLoop() { - for (HANDLE hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) { + for (HCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) { HWND hwndDlg = WindowList_Find(hWindowList, hContact); SetDlgItemText(hwndDlg, IDC_DATA, _T("")); InvalidateRect(hwndDlg, NULL, 1); @@ -114,7 +114,7 @@ void TxtclrLoop() /*****************************************************************************/ void BGclrLoop() { - for (HANDLE hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) { + for (HCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) { HWND hwndDlg = (WindowList_Find(hWindowList, hContact)); SetDlgItemText(hwndDlg, IDC_DATA, _T("")); SendMessage(GetDlgItem(hwndDlg, IDC_DATA), EM_SETBKGNDCOLOR, 0, BackgoundClr); @@ -128,7 +128,7 @@ void StartUpdate(void *dummy) StartUpDelay = 1; Sleep(((db_get_dw(NULL, MODULENAME, START_DELAY_KEY, 0)) * SECOND)); - for (HANDLE hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) + for (HCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) GetData(hContact); StartUpDelay = 0; @@ -138,7 +138,7 @@ void StartUpdate(void *dummy) void ContactLoop(void *dummy) { if (StartUpDelay == 0) { - for (HANDLE hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) { + for (HCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) { GetData(hContact); Sleep(10); // avoid 100% CPU } @@ -176,7 +176,7 @@ void InitialiseGlobals(void) /*****************************************************************************/ int Doubleclick(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; char *szProto = GetContactProto(hContact); if ( lstrcmpA(MODULENAME, szProto)) return 0; @@ -371,7 +371,7 @@ int ModulesLoaded(WPARAM, LPARAM) /*****************************************************************************/ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HWND hwndDlg = WindowList_Find(hWindowList, hContact); if (hwndDlg != NULL) { DestroyWindow(hwndDlg); @@ -432,7 +432,7 @@ INT_PTR AddContactMenuCommand(WPARAM, LPARAM) } /*****************************************************************************/ -int OnTopMenuCommand(WPARAM wParam, LPARAM lParam, HANDLE singlecontact) +int OnTopMenuCommand(WPARAM wParam, LPARAM lParam, HCONTACT singlecontact) { int ontop = 0; int done = 0; @@ -455,7 +455,7 @@ int OnTopMenuCommand(WPARAM wParam, LPARAM lParam, HANDLE singlecontact) /*****************************************************************************/ INT_PTR WebsiteMenuCommand(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ptrT url( db_get_tsa(hContact, MODULENAME, "URL")); if (url) CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)url); @@ -465,7 +465,7 @@ INT_PTR WebsiteMenuCommand(WPARAM wParam, LPARAM lParam) } /*****************************************************************************/ -int UpdateMenuCommand(WPARAM wParam, LPARAM lParam, HANDLE singlecontact) +int UpdateMenuCommand(WPARAM wParam, LPARAM lParam, HCONTACT singlecontact) { mir_forkthread(GetData, singlecontact); return 0; @@ -474,14 +474,14 @@ int UpdateMenuCommand(WPARAM wParam, LPARAM lParam, HANDLE singlecontact) /*****************************************************************************/ int ContactMenuItemUpdateData(WPARAM wParam, LPARAM lParam) { - UpdateMenuCommand(wParam, lParam, (HANDLE)wParam); + UpdateMenuCommand(wParam, lParam, (HCONTACT)wParam); return 0; } /*****************************************************************************/ INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM) { - HWND hwndDlg = WindowList_Find(hWindowList, (HANDLE)wParam); + HWND hwndDlg = WindowList_Find(hWindowList, (HCONTACT)wParam); if (hwndDlg) { DestroyWindow(hwndDlg); return 0; @@ -496,7 +496,7 @@ INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM) /*****************************************************************************/ INT_PTR CntAlertMenuCommand(WPARAM wParam, LPARAM) { - HWND hwndDlg = WindowList_Find(hWindowList, (HANDLE) wParam); + HWND hwndDlg = WindowList_Find(hWindowList, (HCONTACT) wParam); if (hwndDlg) { DestroyWindow(hwndDlg); return 0; diff --git a/plugins/WebView/src/webview.h b/plugins/WebView/src/webview.h index d74d6de614..73c410bf7d 100644 --- a/plugins/WebView/src/webview.h +++ b/plugins/WebView/src/webview.h @@ -117,7 +117,7 @@ //lets get rid of some warnings void CodetoSymbol(char *truncated); -void GetData(HANDLE hContact); +void GetData(void *param); void FillFontListThread(void *); INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); @@ -190,8 +190,8 @@ INT_PTR ShowHideContactCommand(WPARAM wParam, LPARAM lParam); INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM lParam); INT_PTR StpPrcssMenuCommand(WPARAM wParam, LPARAM lParam); -int UpdateMenuCommand(WPARAM wParam, LPARAM lParam, HANDLE singlecontact); -int OnTopMenuCommand(WPARAM wParam, LPARAM lParam, HANDLE singlecontact); +int UpdateMenuCommand(WPARAM wParam, LPARAM lParam, HCONTACT singlecontact); +int OnTopMenuCommand(WPARAM wParam, LPARAM lParam, HCONTACT singlecontact); // void ChangeContactStatus(int con_stat); @@ -206,7 +206,7 @@ void RemoveTabs(char *truncated); void FastTagFilter(char *truncated); void EraseBlock(char *truncated); void EraseSymbols(char *truncated); -int ProcessAlerts(HANDLE hContact, char *truncated, char *tstr, char *contactname, int notpresent); +int ProcessAlerts(HCONTACT hContact, char *truncated, char *tstr, char *contactname, int notpresent); INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); @@ -223,8 +223,8 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM void AckFunc(void *dummy); int SiteDeleted(WPARAM wParam, LPARAM lParam); -int WErrorPopup(HANDLE hContact, TCHAR *textdisplay); -int WAlertPopup(HANDLE hContact, TCHAR *displaytext); +int WErrorPopup(HCONTACT hContact, TCHAR *textdisplay); +int WAlertPopup(HCONTACT hContact, TCHAR *displaytext); ////////////////////// // wrappers diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index 5da24a6c4d..0ab3287d87 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -29,7 +29,7 @@ int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) switch (message) { case WM_COMMAND: case WM_CONTEXTMENU: - HANDLE hContact = PUGetContact(hWnd); + HCONTACT hContact = PUGetContact(hWnd); ptrT url( db_get_tsa(hContact, MODULENAME, URL_KEY)); if (message == WM_COMMAND) { // left click @@ -44,7 +44,7 @@ int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if ( db_get_b(NULL, MODULENAME, LCLK_WEB_PGE_KEY, 0)) { CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)url); PUDeletePopup(hWnd); - db_set_w((HANDLE)wParam, MODULENAME, "Status", ID_STATUS_ONLINE); + db_set_w((HCONTACT)wParam, MODULENAME, "Status", ID_STATUS_ONLINE); } // dismiss if ( db_get_b(NULL, MODULENAME, LCLK_DISMISS_KEY, 1)) @@ -65,7 +65,7 @@ int CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if ( db_get_b(NULL, MODULENAME, RCLK_WEB_PGE_KEY, 1)) { CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)url); PUDeletePopup(hWnd); - db_set_w((HANDLE)wParam, MODULENAME, "Status", ID_STATUS_ONLINE); + db_set_w((HCONTACT)wParam, MODULENAME, "Status", ID_STATUS_ONLINE); } // dismiss if ( db_get_b(NULL, MODULENAME, RCLK_DISMISS_KEY, 0)) @@ -88,21 +88,21 @@ int WDisplayDataAlert(void *hContact) } /*****************************************************************************/ -int WAlertPopup(HANDLE hContact, TCHAR *displaytext) +int WAlertPopup(HCONTACT hContact, TCHAR *displaytext) { NotifyEventHooks(hHookAlertPopup, (WPARAM)hContact, (LPARAM)displaytext); return 0; } /*****************************************************************************/ -int WErrorPopup(HANDLE hContact, TCHAR *textdisplay) +int WErrorPopup(HCONTACT hContact, TCHAR *textdisplay) { NotifyEventHooks(hHookErrorPopup, (WPARAM)hContact, (LPARAM) textdisplay); return 0; } /*****************************************************************************/ -int WAlertOSD(HANDLE hContact, TCHAR *displaytext) +int WAlertOSD(HCONTACT hContact, TCHAR *displaytext) { NotifyEventHooks(hHookAlertOSD, (WPARAM)hContact, (LPARAM) displaytext); return 0; @@ -115,13 +115,13 @@ int WPopupAlert(WPARAM wParam, LPARAM lParam) if( ((HANDLE)wParam) != NULL) { DBVARIANT dbv; - db_get_ts((HANDLE)wParam, MODULENAME, PRESERVE_NAME_KEY, &dbv); + db_get_ts((HCONTACT)wParam, MODULENAME, PRESERVE_NAME_KEY, &dbv); lstrcpyn(ppd.lptzContactName, dbv.ptszVal, SIZEOF(ppd.lptzContactName)); db_free(&dbv); } else lstrcpy(ppd.lptzContactName, _A2T(MODULENAME)); - ppd.lchContact = (HANDLE)wParam; + ppd.lchContact = (HCONTACT)wParam; ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE)); TCHAR *displaytext = (TCHAR*)lParam; @@ -158,7 +158,7 @@ int PopupAlert(WPARAM wParam, LPARAM lParam) POPUPDATA ppd = { 0 }; if (((HANDLE)wParam) != NULL) { DBVARIANT dbv; - if ( !db_get_s((HANDLE)wParam, MODULENAME, PRESERVE_NAME_KEY, &dbv)) { + if ( !db_get_s((HCONTACT)wParam, MODULENAME, PRESERVE_NAME_KEY, &dbv)) { lstrcpynA(ppd.lptzContactName, dbv.pszVal, SIZEOF(ppd.lptzContactName)); db_free(&dbv); } @@ -166,7 +166,7 @@ int PopupAlert(WPARAM wParam, LPARAM lParam) if (ppd.lptzContactName[0] == 0) strncpy_s(ppd.lptzContactName, SIZEOF(ppd.lptzContactName), MODULENAME, _TRUNCATE); - ppd.lchContact = (HANDLE)wParam; + ppd.lchContact = (HCONTACT)wParam; ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE)); char *displaytext = (char*)lParam; @@ -205,7 +205,7 @@ int OSDAlert(WPARAM wParam, LPARAM lParam) if (((HANDLE)wParam) != NULL) { DBVARIANT dbv; - if ( !db_get_s((HANDLE)wParam, MODULENAME, PRESERVE_NAME_KEY, &dbv)) { + if ( !db_get_s((HCONTACT)wParam, MODULENAME, PRESERVE_NAME_KEY, &dbv)) { strncpy_s(contactname, SIZEOF(contactname), dbv.pszVal, _TRUNCATE); db_free(&dbv); } @@ -225,7 +225,7 @@ int OSDAlert(WPARAM wParam, LPARAM lParam) /*****************************************************************************/ int ErrorMsgs(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; TCHAR newdisplaytext[2000], *displaytext = (TCHAR*)lParam; if ( db_get_b(NULL, MODULENAME, SUPPRESS_ERR_KEY, 0)) @@ -254,7 +254,7 @@ int ErrorMsgs(WPARAM wParam, LPARAM lParam) } /*****************************************************************************/ -void SaveToFile(HANDLE hContact, char *truncated) +void SaveToFile(HCONTACT hContact, char *truncated) { char *mode; if (!db_get_b(hContact, MODULENAME, APPEND_KEY, 0)) @@ -299,7 +299,7 @@ void SaveToFile(HANDLE hContact, char *truncated) } /*****************************************************************************/ -int ProcessAlerts(HANDLE hContact, char *truncated, char *tstr, char *contactname, int notpresent) +int ProcessAlerts(HCONTACT hContact, char *truncated, char *tstr, char *contactname, int notpresent) { char alertstring[255]; TCHAR displaystring[300]; @@ -479,7 +479,7 @@ int ProcessAlerts(HANDLE hContact, char *truncated, char *tstr, char *contactnam // file exists? if ( _taccess(newcachepath, 0) != -1) { if ((pcachefile = _tfopen(newcachepath, _T("r"))) == NULL) - WErrorPopup(contactname, TranslateT("Cannot read from file")); + WErrorPopup((HCONTACT)contactname, TranslateT("Cannot read from file")); else { ZeroMemory(&cachecompare, sizeof(cachecompare)); fread(cachecompare, sizeof(cachecompare), 1, pcachefile); @@ -488,7 +488,7 @@ int ProcessAlerts(HANDLE hContact, char *truncated, char *tstr, char *contactnam } // write to cache if ((pcachefile = _tfopen(newcachepath, _T("w"))) == NULL) - WErrorPopup(contactname, TranslateT("Cannot write to file 1")); + WErrorPopup((HCONTACT)contactname, TranslateT("Cannot write to file 1")); else { fwrite(tempraw, strlen(tempraw), 1, pcachefile); //smaller cache fclose(pcachefile); @@ -691,7 +691,7 @@ int ProcessAlerts(HANDLE hContact, char *truncated, char *tstr, char *contactnam // file exists? if ( _taccess(newcachepath, 0) != -1) { if ((pcachefile = _tfopen(newcachepath, _T("r"))) == NULL) - WErrorPopup(contactname, TranslateT("Cannot read from file")); + WErrorPopup((HCONTACT)contactname, TranslateT("Cannot read from file")); else { ZeroMemory(&cachecompare, sizeof(cachecompare)); fread(cachecompare, sizeof(cachecompare), 1, pcachefile); @@ -700,7 +700,7 @@ int ProcessAlerts(HANDLE hContact, char *truncated, char *tstr, char *contactnam } // write to cache if ((pcachefile = _tfopen(newcachepath, _T("w"))) == NULL) - WErrorPopup(contactname, TranslateT("Cannot write to file 2")); + WErrorPopup((HCONTACT)contactname, TranslateT("Cannot write to file 2")); else { fwrite(raw, strlen(raw), 1, pcachefile); //smaller cache db_set_ts(hContact, MODULENAME, CACHE_FILE_KEY, newcachepath); @@ -814,7 +814,7 @@ int ProcessAlerts(HANDLE hContact, char *truncated, char *tstr, char *contactnam /*****************************************************************************/ int DataWndAlertCommand(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if ( WindowList_Find(hWindowList, hContact)) return 0; @@ -836,8 +836,10 @@ int DataWndAlertCommand(WPARAM wParam, LPARAM lParam) } /*****************************************************************************/ -void ReadFromFile(HANDLE hContact) +void ReadFromFile(void *param) { + HCONTACT hContact = (HCONTACT)param; + DBVARIANT dbv; char truncated[MAXSIZE1]; int AmountWspcRem = 0; diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index 2c166e17ae..24ba98a50b 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -119,16 +119,16 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara static TCHAR tszSizeString[] = _T("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); -static HANDLE FindContactByUrl(HWND hwndDlg) +static HCONTACT FindContactByUrl(HWND hwndDlg) { - HANDLE res = NULL; + HCONTACT res = NULL; TCHAR urltext[300], titlebartxt[300]; int contactcount = 0; GetDlgItemText(hwndDlg, IDC_OPEN_URL, urltext, SIZEOF(urltext)); GetWindowText(hwndDlg, titlebartxt, SIZEOF(titlebartxt)); - for (HANDLE hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) { + for (HCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) { ptrT db1( db_get_tsa(hContact, MODULENAME, URL_KEY)); ptrT db2( db_get_tsa(hContact, MODULENAME, PRESERVE_NAME_KEY)); @@ -149,13 +149,13 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA DBVARIANT dbv; RECT rc; TCHAR url[300]; - HANDLE hContact; + HCONTACT hContact; switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); { - HANDLE hContact2 = (HANDLE) lParam; + HCONTACT hContact2 = (HCONTACT)lParam; SetWindowLong(hwndDlg, GWLP_USERDATA, (LONG) hContact2); WindowList_Add(hWindowList, hwndDlg, hContact2); @@ -339,7 +339,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_OPEN_URL: GetDlgItemText(hwndDlg, IDC_OPEN_URL, url, SIZEOF(url)); CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)url); - db_set_w((HANDLE)wParam, MODULENAME, "Status", ID_STATUS_ONLINE); + db_set_w((HCONTACT)wParam, MODULENAME, "Status", ID_STATUS_ONLINE); break; case IDC_UPDATE_BUTTON: diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp index 4522eee824..b56688180c 100644 --- a/plugins/WebView/src/webview_getdata.cpp +++ b/plugins/WebView/src/webview_getdata.cpp @@ -27,8 +27,9 @@ int Startingup = 1; int AlreadyDownloading = 0; /*******************/ -void GetData(HANDLE hContact) +void GetData(void *param) { + HCONTACT hContact = (HCONTACT)param; int statpos = 0, dispos = 0, statposend = 0; char*pos; DBVARIANT dbv; diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp index d7606ecb12..fd3246dc47 100644 --- a/plugins/WebView/src/webview_opts.cpp +++ b/plugins/WebView/src/webview_opts.cpp @@ -277,7 +277,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l int alertIndex = 0; int eventIndex = 0; static int test; - HANDLE hContact; + HCONTACT hContact; ParentHwnd = GetParent(hwndDlg); @@ -285,7 +285,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_INITDIALOG: test = 0; TranslateDialogDefault(hwndDlg); - hContact = (HANDLE)lParam; + hContact = (HCONTACT)lParam; SetWindowLong(hwndDlg, GWLP_USERDATA, (LONG) hContact); @@ -509,7 +509,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break; case IDC_ENABLE_ALERTS: - hContact = (HANDLE) GetWindowLong(hwndDlg, GWLP_USERDATA); + hContact = (HCONTACT)GetWindowLong(hwndDlg, GWLP_USERDATA); EnableWindow(GetDlgItem(hwndDlg, IDC_ADD_DATE_NAME), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS))); if ( IsDlgButtonChecked(hwndDlg, IDC_ADD_DATE_NAME)) { @@ -631,7 +631,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_ALERT_TYPE: if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) { - hContact = (HANDLE) GetWindowLong(hwndDlg, GWLP_USERDATA); + hContact = (HCONTACT) GetWindowLong(hwndDlg, GWLP_USERDATA); int alertIndex = SendDlgItemMessage(hwndDlg, IDC_ALERT_TYPE, CB_GETCURSEL, 0, 0); if (HIWORD(wParam) == CBN_SELCHANGE) { @@ -678,7 +678,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_EVENT_TYPE: if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) { - HANDLE hContact = (HANDLE) GetWindowLong(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT) GetWindowLong(hwndDlg, GWLP_USERDATA); int eventIndex = SendDlgItemMessage(hwndDlg, IDC_EVENT_TYPE, CB_GETCURSEL, 0, 0); if (HIWORD(wParam) == CBN_SELCHANGE) { @@ -709,7 +709,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_ALERT_APPLY: case IDC_OK2: { - hContact = (HANDLE) GetWindowLong(hwndDlg, GWLP_USERDATA); + hContact = (HCONTACT) GetWindowLong(hwndDlg, GWLP_USERDATA); TCHAR buf[MAX_PATH]; eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0); @@ -815,13 +815,13 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM HWND ParentHwnd = GetParent(hwndDlg); static int test; static int test2; - HANDLE hContact; + HCONTACT hContact; switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - hContact = (HANDLE) lParam; + hContact = (HCONTACT) lParam; test = 0; test2 = 0; @@ -927,7 +927,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_CPY_STRINGS: { TCHAR string[128]; - hContact = (HANDLE) GetWindowLong(hwndDlg, GWLP_USERDATA); + hContact = (HCONTACT) GetWindowLong(hwndDlg, GWLP_USERDATA); GetDlgItemText(hwndDlg, IDC_START, string, SIZEOF(string)); db_set_ts(hContact, MODULENAME, ALRT_S_STRING_KEY, string); @@ -1022,7 +1022,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; } - hContact = (HANDLE) GetWindowLong(hwndDlg, GWLP_USERDATA); + hContact = (HCONTACT) GetWindowLong(hwndDlg, GWLP_USERDATA); GetDlgItemText(hwndDlg, IDC_URL, url, SIZEOF(url)); db_set_ts(hContact, MODULENAME, URL_KEY, url); diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 776c5431e1..717966f75d 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -32,7 +32,7 @@ static char szInvalidChars[] = { '\\', '/', ':', '*', '?', '\"', '<', '>', '|' } int DBSettingChanged(WPARAM wParam, LPARAM lParam) { // We can't upload changes to NULL contact - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; @@ -60,7 +60,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) for (int i=0; i < SIZEOF(szInvalidChars); i++ ) { TCHAR *p = _tcschr(nick, szInvalidChars[i]); if (p != NULL) { - WErrorPopup("ERROR", TranslateT("Invalid symbol present in contact name.")); + WErrorPopup((HCONTACT)"ERROR", TranslateT("Invalid symbol present in contact name.")); *p = '_'; invalidpresent =1; } @@ -111,7 +111,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) /*****************************************************************************/ int SiteDeleted(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (lstrcmpA(GetContactProto(hContact), MODULENAME)) return 0; @@ -152,7 +152,7 @@ INT_PTR OpenCacheDir(WPARAM, LPARAM) mir_sntprintf(cachedirectorypath, SIZEOF(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\%s"), cachepath, cacheend); if( _taccess(cachedirectorypath, 0) != 0) - WErrorPopup("ERROR", TranslateT("Cache folder does not exist.")); + WErrorPopup((HCONTACT)"ERROR", TranslateT("Cache folder does not exist.")); else ShellExecute(NULL, _T("open"), cachedirectorypath, NULL, NULL, SW_SHOWNORMAL); return 0; @@ -163,11 +163,11 @@ INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM lParam) { FILE *pfile = fopen("psite.bat", "r"); if (pfile == NULL) { - WErrorPopup("ERROR", TranslateT("Missing \"psite.bat\" file.")); + WErrorPopup((HCONTACT)"ERROR", TranslateT("Missing \"psite.bat\" file.")); return 0; } - ptrT url( db_get_tsa((HANDLE) wParam, MODULENAME, "URL")); + ptrT url( db_get_tsa((HCONTACT)wParam, MODULENAME, "URL")); if (url == NULL) return 0; @@ -188,7 +188,7 @@ INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM lParam) /*****************************************************************************/ INT_PTR StpPrcssMenuCommand(WPARAM wParam, LPARAM) { - db_set_b((HANDLE)wParam, MODULENAME, STOP_KEY, 1); + db_set_b((HCONTACT)wParam, MODULENAME, STOP_KEY, 1); return 0; } @@ -251,7 +251,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam) // Make sure no contact has offline status for any reason on first time run if ( db_get_b(NULL, MODULENAME, "FirstTime", 100) == 100) { - for (HANDLE hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) + for (HCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE); db_set_b(NULL, MODULENAME, "FirstTime", 1); @@ -341,7 +341,7 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) int samename = 0; // search for existing contact - for (HANDLE hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) { + for (HCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) { // check ID to see if the contact already exist in the database if (!db_get_ts(hContact, MODULENAME, "URL", &dbv)) { if (!lstrcmpi(psr->nick, dbv.ptszVal)) { @@ -359,7 +359,7 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) } if (psr->nick == NULL) { - WErrorPopup("ERROR", TranslateT("Please select site in Find/Add contacts...")); + WErrorPopup((HCONTACT)"ERROR", TranslateT("Please select site in Find/Add contacts...")); return 0; } @@ -367,7 +367,7 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) if (psr->cbSize != sizeof(PROTOSEARCHRESULT)) return NULL; - HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); + HCONTACT hContact = (HCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) MODULENAME); /////////write to db @@ -403,7 +403,7 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) TCHAR *Nend = _tcschr(Newnick, '.'); if (Nend) *Nend = '\0'; - for (HANDLE hContact2 = db_find_first(MODULENAME); hContact2 != NULL; hContact2 = db_find_next(hContact2, MODULENAME)) { + for (HCONTACT hContact2 = db_find_first(MODULENAME); hContact2 != NULL; hContact2 = db_find_next(hContact2, MODULENAME)) { if (!db_get_ts(hContact2, MODULENAME, PRESERVE_NAME_KEY, &dbv)) { if (!lstrcmpi(Newnick, dbv.ptszVal)) { // remove the flag for not on list and hidden, thus make the @@ -461,6 +461,6 @@ INT_PTR GetInfo(WPARAM, LPARAM) /*****************************************************************************/ void AckFunc(void *dummy) { - for (HANDLE hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) + for (HCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) ProtoBroadcastAck(MODULENAME, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0); } diff --git a/plugins/WhenWasIt/src/birthdays.cpp b/plugins/WhenWasIt/src/birthdays.cpp index a99ed2e868..d3615a06f9 100644 --- a/plugins/WhenWasIt/src/birthdays.cpp +++ b/plugins/WhenWasIt/src/birthdays.cpp @@ -82,7 +82,7 @@ void CBirthdays::Realloc(int increaseCapacity) birthdays = (PBirthdayContact *) realloc(birthdays, size * sizeof(PBirthdayContact)); } -int CBirthdays::Add(HANDLE hContact, HANDLE hClistIcon) +int CBirthdays::Add(HCONTACT hContact, HANDLE hClistIcon) { if ( !Contains(hContact)) { EnsureCapacity(); @@ -107,12 +107,12 @@ int CBirthdays::Remove(int index) return -1; } -int CBirthdays::Remove(HANDLE hContact) +int CBirthdays::Remove(HCONTACT hContact) { return Remove( Index(hContact)); } -int CBirthdays::Contains(HANDLE hContact) const +int CBirthdays::Contains(HCONTACT hContact) const { for (int i = 0; i < count; i++) if (birthdays[i]->hContact == hContact) @@ -121,7 +121,7 @@ int CBirthdays::Contains(HANDLE hContact) const return FALSE; } -int CBirthdays::Index(HANDLE hContact) const +int CBirthdays::Index(HCONTACT hContact) const { for (int i = 0; i < count; i++) if (birthdays[i]->hContact == hContact) @@ -140,7 +140,7 @@ int CBirthdays::GetAdvancedIconIndex() const return advancedIcon; } -HANDLE CBirthdays::GetClistIcon(HANDLE hContact) const +HANDLE CBirthdays::GetClistIcon(HCONTACT hContact) const { int index = Index(hContact); if ((index >= 0) && (index < count)) diff --git a/plugins/WhenWasIt/src/birthdays.h b/plugins/WhenWasIt/src/birthdays.h index c54042800c..f42b8dc09c 100644 --- a/plugins/WhenWasIt/src/birthdays.h +++ b/plugins/WhenWasIt/src/birthdays.h @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define M_WWI_BIRTHDAYS_H struct TBirthdayContact{ - HANDLE hContact; + HCONTACT hContact; HANDLE hClistIcon; }; @@ -45,19 +45,19 @@ class CBirthdays CBirthdays(int initialSize = 10); ~CBirthdays(); - int Add(HANDLE hContact, HANDLE hClistIcon); + int Add(HCONTACT hContact, HANDLE hClistIcon); int Remove(int index); - int Remove(HANDLE hContact); + int Remove(HCONTACT hContact); void Clear(); void Destroy(); - int Index(HANDLE hContact) const; - int Contains(HANDLE hContact) const; + int Index(HCONTACT hContact) const; + int Contains(HCONTACT hContact) const; void SetAdvancedIconIndex(int advIcon); int GetAdvancedIconIndex() const; - HANDLE GetClistIcon(HANDLE hContact) const; + HANDLE GetClistIcon(HCONTACT hContact) const; int Count() const; int Size() const; diff --git a/plugins/WhenWasIt/src/date_utils.cpp b/plugins/WhenWasIt/src/date_utils.cpp index 6c510da4ae..863371eead 100644 --- a/plugins/WhenWasIt/src/date_utils.cpp +++ b/plugins/WhenWasIt/src/date_utils.cpp @@ -33,7 +33,7 @@ bool IsDOBValid(int year, int month, int day) return (year != 0 && month != 0 && day != 0); } -int GetContactDOB(HANDLE hContact, int &year, int &month, int &day) +int GetContactDOB(HCONTACT hContact, int &year, int &month, int &day) { year = db_get_w(hContact, "UserInfo", "DOBy", 0); month = db_get_b(hContact, "UserInfo", "DOBm", 0); @@ -69,7 +69,7 @@ int GetContactDOB(HANDLE hContact, int &year, int &month, int &day) return DOB_UNKNOWN; } -int GetContactAge(HANDLE hContact) +int GetContactAge(HCONTACT hContact) { int year, month, day; time_t tNow; @@ -79,7 +79,7 @@ int GetContactAge(HANDLE hContact) return (now->tm_year + 1900) - year; } -char GetContactGender(HANDLE hContact) +char GetContactGender(HCONTACT hContact) { char gender = db_get_b(hContact, "UserInfo", "Gender", 'U'); if (gender == 'U') @@ -185,7 +185,7 @@ void FillStandard(char *&module, char *&sYear, char *&sMonth, char *&sDay) sDay = "DOBd"; } -int SaveBirthday(HANDLE hContact, int year, int month, int day, int mode) +int SaveBirthday(HCONTACT hContact, int year, int month, int day, int mode) { char *sModule, *sdModule, *sd2Module; //s* = keep, sd* = delete, sd2* = delete char *sYear, *sdYear, *sd2Year; diff --git a/plugins/WhenWasIt/src/date_utils.h b/plugins/WhenWasIt/src/date_utils.h index 6b4cfcc7f2..db69702729 100644 --- a/plugins/WhenWasIt/src/date_utils.h +++ b/plugins/WhenWasIt/src/date_utils.h @@ -42,10 +42,10 @@ bool IsDOBValid(int year, int month, int day); unsigned int DaysToBirthday(time_t now, int ctYear, int ctMonth, int ctDay); int DaysAfterBirthday(time_t now, int ctYear, int ctMonth, int ctDay); -int GetContactAge(HANDLE hContact); -int GetContactDOB(HANDLE hContact, int &year, int &month, int &day); -char GetContactGender(HANDLE hContact); +int GetContactAge(HCONTACT hContact); +int GetContactDOB(HCONTACT hContact, int &year, int &month, int &day); +char GetContactGender(HCONTACT hContact); -int SaveBirthday(HANDLE hContact, int year, int month, int day, int mode); +int SaveBirthday(HCONTACT hContact, int year, int month, int day, int mode); #endif //H_WWI_DATE_UTILS_H \ No newline at end of file diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index ddbe9fa6b8..dfbd581dd5 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -272,7 +272,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara case IDC_PREVIEW: { - HANDLE hContact = db_find_first(); + HCONTACT hContact = db_find_first(); int dtb = rand() % 11; //0..10 int age = rand() % 50 + 1; //1..50 PopupNotifyBirthday(hContact, dtb, age); @@ -391,15 +391,14 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hWnd, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hWnd, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hWnd); SetWindowLongPtr(hWnd, GWLP_USERDATA, lParam); - { - HANDLE hContact = (HANDLE) lParam; + HCONTACT hContact = (HCONTACT)lParam; WindowList_Add(hAddBirthdayWndsList, hWnd, hContact); Utils_RestoreWindowPositionNoSize(hWnd,hContact,ModuleName,"BirthdayWnd"); } @@ -490,7 +489,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l case IDOK: { SYSTEMTIME st; - HANDLE hContact = (HANDLE) GetWindowLongPtr(hWnd, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hWnd, GWLP_USERDATA); HWND hDate = GetDlgItem(hWnd, IDC_DATE); if (DateTime_GetSystemtime(hDate, &st) == GDT_VALID) { int mode = SendMessage(GetDlgItem(hWnd, IDC_COMPATIBILITY), CB_GETCURSEL, 0, 0); //SAVE modes in date_utils.h are synced @@ -520,7 +519,7 @@ void AddAnchorWindowToDeferList(HDWP &hdWnds, HWND window, RECT *rParent, WINDOW #define NA TranslateT("N/A") -TCHAR *GetBirthdayModule(int module, HANDLE hContact) +TCHAR *GetBirthdayModule(int module, HCONTACT hContact) { switch (module) { case DOB_MBIRTHDAY: return _T("mBirthday"); @@ -570,7 +569,7 @@ INT_PTR CALLBACK BirthdaysCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam } //only updates the birthday part of the list view entry. Won't update the szProto and the contact name (those shouldn't change anyway :)) -int UpdateBirthdayEntry(HWND hList, HANDLE hContact, int entry, int bShowAll, int bShowCurrentAge, int bAdd) +int UpdateBirthdayEntry(HWND hList, HCONTACT hContact, int entry, int bShowAll, int bShowCurrentAge, int bAdd) { int currentMonth, currentDay; int res = entry; @@ -656,14 +655,14 @@ static LRESULT CALLBACK BirthdaysListSubclassProc(HWND hWnd, UINT msg, WPARAM wP case WM_LBUTTONDBLCLK: { int count = ListView_GetItemCount(hWnd); - HANDLE hContact; + HCONTACT hContact; LVITEM item = {0}; item.mask = LVIF_PARAM; for (int i = 0; i < count; i++) { if (ListView_GetItemState(hWnd, i, LVIS_SELECTED)) { item.iItem = i; ListView_GetItem(hWnd, &item); - hContact = (HANDLE) item.lParam; + hContact = (HCONTACT)item.lParam; CallService(MS_WWI_ADD_BIRTHDAY, (WPARAM) hContact, 0); } } @@ -687,7 +686,7 @@ int LoadBirthdays(HWND hWnd, int bShowAll) ListView_DeleteAllItems(hList); int count = 0; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) count = UpdateBirthdayEntry(hList, hContact, count, bShowAll, commonData.cShowAgeMode, 1); SetBirthdaysCount(hWnd); @@ -747,7 +746,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa case WWIM_UPDATE_BIRTHDAY: {//wParam = hContact HWND hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST); - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT)wParam; int i; int count = ListView_GetItemCount(hList); //int bShowCurrentAge = db_get_b(NULL, ModuleName, "ShowCurrentAge", 0); @@ -939,7 +938,7 @@ INT_PTR CALLBACK DlgProcUpcoming(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar DWORD WINAPI OpenMessageWindowThread(void *data) { - HANDLE hContact = (HANDLE) data; + HCONTACT hContact = (HCONTACT)data; CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM) hContact, 0); CallServiceSync("SRMsg/LaunchMessageWindow", (WPARAM) hContact, 0); return 0; @@ -950,7 +949,7 @@ int HandlePopupClick(HWND hWnd, int action) switch (action) { case 2: //OPEN MESSAGE WINDOW { - HANDLE hContact = (HANDLE) PUGetContact(hWnd); + HCONTACT hContact = (HCONTACT)PUGetContact(hWnd); if (hContact) { DWORD threadID; HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, hContact, 0, &threadID); diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp index 9cf7266433..98793832d5 100644 --- a/plugins/WhenWasIt/src/hooked_events.cpp +++ b/plugins/WhenWasIt/src/hooked_events.cpp @@ -68,7 +68,7 @@ static int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) DBCONTACTWRITESETTING *dw = (DBCONTACTWRITESETTING *) lParam; DBVARIANT dv = dw->value; if ((strcmp(dw->szModule, DUMMY_MODULE) == 0) && (strcmp(dw->szSetting, DUMMY_SETTING) == 0)) - RefreshContactListIcons((HANDLE)wParam); + RefreshContactListIcons((HCONTACT)wParam); return 0; } @@ -152,7 +152,7 @@ int UnhookEvents() ///////////////////////////////////////////////////////////////////////////////////////// -int RefreshContactListIcons(HANDLE hContact) +int RefreshContactListIcons(HCONTACT hContact) { if (hContact == 0) return 0; diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp index 98dbef5e6f..b759b405df 100644 --- a/plugins/WhenWasIt/src/notifiers.cpp +++ b/plugins/WhenWasIt/src/notifiers.cpp @@ -64,7 +64,7 @@ TCHAR *BuildDABText(int dab, TCHAR *name, TCHAR *text, int size) return text; } -int PopupNotifyBirthday(HANDLE hContact, int dtb, int age) +int PopupNotifyBirthday(HCONTACT hContact, int dtb, int age) { TCHAR *name = GetContactName(hContact, NULL); const int MAX_SIZE = 1024; @@ -111,7 +111,7 @@ int PopupNotifyBirthday(HANDLE hContact, int dtb, int age) return 0; } -int PopupNotifyMissedBirthday(HANDLE hContact, int dab, int age) +int PopupNotifyMissedBirthday(HCONTACT hContact, int dab, int age) { TCHAR *name = GetContactName(hContact, NULL); const int MAX_SIZE = 1024; @@ -155,7 +155,7 @@ int PopupNotifyMissedBirthday(HANDLE hContact, int dab, int age) return 0; } -int DialogNotifyBirthday(HANDLE hContact, int dtb, int age) +int DialogNotifyBirthday(HCONTACT hContact, int dtb, int age) { TCHAR *name = GetContactName(hContact, NULL); const int MAX_SIZE = 1024; @@ -181,7 +181,7 @@ int DialogNotifyBirthday(HANDLE hContact, int dtb, int age) return 0; } -int DialogNotifyMissedBirthday(HANDLE hContact, int dab, int age) +int DialogNotifyMissedBirthday(HCONTACT hContact, int dab, int age) { TCHAR *name = GetContactName(hContact, NULL); const int MAX_SIZE = 1024; @@ -221,7 +221,7 @@ int SoundNotifyBirthday(int dtb) //called with oldClistIcon != -1 from dlg_handlers whtn the extra icon slot changes. int RefreshAllContactListIcons(int oldClistIcon) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (oldClistIcon != -1) ExtraIcon_Clear(hWWIExtraIcons, hContact); diff --git a/plugins/WhenWasIt/src/notifiers.h b/plugins/WhenWasIt/src/notifiers.h index 344774ce02..598421078b 100644 --- a/plugins/WhenWasIt/src/notifiers.h +++ b/plugins/WhenWasIt/src/notifiers.h @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DUMMY_SETTING "refreshIconsDummyVal" struct TUpcomingBirthday{ - HANDLE hContact; + HCONTACT hContact; TCHAR *name; TCHAR *message; int dtb; @@ -40,13 +40,13 @@ struct TUpcomingBirthday{ typedef TUpcomingBirthday *PUpcomingBirthday; void PopupNotifyNoBirthdays(); -int PopupNotifyBirthday(HANDLE hContact, int dtb, int age); -int PopupNotifyMissedBirthday(HANDLE hContact, int dab, int age); -int DialogNotifyBirthday(HANDLE hContact, int dtb, int age); -int DialogNotifyMissedBirthday(HANDLE hContact, int dab, int age); +int PopupNotifyBirthday(HCONTACT hContact, int dtb, int age); +int PopupNotifyMissedBirthday(HCONTACT hContact, int dab, int age); +int DialogNotifyBirthday(HCONTACT hContact, int dtb, int age); +int DialogNotifyMissedBirthday(HCONTACT hContact, int dab, int age); int SoundNotifyBirthday(int dtb); -int RefreshContactListIcons(HANDLE hContact); +int RefreshContactListIcons(HCONTACT hContact); int RefreshAllContactListIcons(int oldClistIcon = -1); #endif //M_WWI_NOTIFIERS_H \ No newline at end of file diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp index 5ad63f93d4..c86a52c81b 100644 --- a/plugins/WhenWasIt/src/services.cpp +++ b/plugins/WhenWasIt/src/services.cpp @@ -87,7 +87,7 @@ int DestroyServices() returns -1 if notify is not necesarry returns daysToBirthday if it should notify */ -int NotifyContactBirthday(HANDLE hContact, time_t now, int daysInAdvance) +int NotifyContactBirthday(HCONTACT hContact, time_t now, int daysInAdvance) { int year, month, day; GetContactDOB(hContact, year, month, day); @@ -100,7 +100,7 @@ int NotifyContactBirthday(HANDLE hContact, time_t now, int daysInAdvance) // returns -1 if notify is not necessary // returns daysAfterBirthday if it should notify -int NotifyMissedContactBirthday(HANDLE hContact, time_t now, int daysAfter) +int NotifyMissedContactBirthday(HCONTACT hContact, time_t now, int daysAfter) { if (daysAfter > 0) { @@ -169,7 +169,7 @@ INT_PTR ShowListService(WPARAM wParam, LPARAM lParam) INT_PTR AddBirthdayService(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT)wParam; HWND hWnd = WindowList_Find(hAddBirthdayWndsList, hContact); if ( !hWnd) { hWnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_ADD_BIRTHDAY), NULL, DlgProcAddBirthday, (LPARAM) hContact); @@ -194,7 +194,7 @@ DWORD WINAPI RefreshUserDetailsWorkerThread(LPVOID param) int delay = db_get_w(NULL, ModuleName, "UpdateDelay", REFRESH_DETAILS_DELAY); int res; - HANDLE hContact = db_find_first(); + HCONTACT hContact = db_find_first(); while (hContact != NULL) { res = CallContactService(hContact, PSS_GETINFO, 0, 0); hContact = db_find_next(hContact); @@ -301,7 +301,7 @@ int DoImport(TCHAR *fileName) TCHAR *szHandle = buffer; TCHAR *szProto = delProto + 1; - HANDLE hContact = GetContactFromID(szHandle, szProto); + HCONTACT hContact = GetContactFromID(szHandle, szProto); if (hContact) { delProto[0] = tmp; delAccount[0] = tmp; @@ -334,7 +334,7 @@ int DoExport(TCHAR *fileName) _ftprintf(fout, _T("%c%s"), _T(COMMENT_CHAR), TranslateT("Warning! Please do not mix Unicode and Ansi exported birthday files. You should use the same version (Ansi/Unicode) of WhenWasIt that was used to export the info.\n")); _ftprintf(fout, _T("%c%s"), _T(COMMENT_CHAR), TranslateT("This file was exported with a Unicode version of WhenWasIt. Please only use a Unicode version of the plugin to import the birthdays.\n")); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { int year, month, day; GetContactDOB(hContact, year, month, day); if ( IsDOBValid(year, month, day)) { diff --git a/plugins/WhenWasIt/src/services.h b/plugins/WhenWasIt/src/services.h index 5bc19aca3f..437cc93f73 100644 --- a/plugins/WhenWasIt/src/services.h +++ b/plugins/WhenWasIt/src/services.h @@ -42,8 +42,8 @@ extern int bBirthdayFound; int InitServices(); int DestroyServices(); -int NotifyContactBirthday(HANDLE hContact, time_t now, int daysInAdvance); -int NotifyMissedContactBirthday(HANDLE hContact, time_t now, int daysAfter); +int NotifyContactBirthday(HCONTACT hContact, time_t now, int daysInAdvance); +int NotifyMissedContactBirthday(HCONTACT hContact, time_t now, int daysAfter); int DoExport(TCHAR *fileName); int DoImport(TCHAR *fileName); diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp index a2f2bb6ade..f09f9ffdca 100644 --- a/plugins/WhenWasIt/src/utils.cpp +++ b/plugins/WhenWasIt/src/utils.cpp @@ -118,7 +118,7 @@ void HexToBin(char *inData, ULONG &size, LPBYTE &outData) i = size; } -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, char *szError, char *szResult, size_t size) +int GetStringFromDatabase(HCONTACT hContact, char *szModule, char *szSettingName, char *szError, char *szResult, size_t size) { DBVARIANT dbv = {0}; int res = 1; @@ -156,7 +156,7 @@ int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, si #pragma warning (disable: 4312) -TCHAR *GetContactName(HANDLE hContact, char *szProto) +TCHAR *GetContactName(HCONTACT hContact, char *szProto) { CONTACTINFO ctInfo = { sizeof(ctInfo) }; ctInfo.szProto = (szProto) ? szProto : GetContactProto(hContact); @@ -176,12 +176,12 @@ TCHAR *GetContactName(HANDLE hContact, char *szProto) return buffer; } -TCHAR *GetContactID(HANDLE hContact) +TCHAR *GetContactID(HCONTACT hContact) { return GetContactID(hContact, GetContactProto(hContact)); } -TCHAR *GetContactID(HANDLE hContact, char *szProto) +TCHAR *GetContactID(HCONTACT hContact, char *szProto) { CONTACTINFO ctInfo = { sizeof(ctInfo) }; ctInfo.szProto = szProto; @@ -217,9 +217,9 @@ TCHAR *GetContactID(HANDLE hContact, char *szProto) return (!ret) ? buffer : NULL; } -HANDLE GetContactFromID(TCHAR *szID, char *szProto) +HCONTACT GetContactFromID(TCHAR *szID, char *szProto) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *m_szProto = GetContactProto(hContact); TCHAR *szHandle = GetContactID(hContact, szProto); if (szHandle) { @@ -232,7 +232,7 @@ HANDLE GetContactFromID(TCHAR *szID, char *szProto) return NULL; } -HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto) +HCONTACT GetContactFromID(TCHAR *szID, wchar_t *szProto) { char protocol[1024]; WideCharToMultiByte(CP_ACP, 0, szProto, -1, protocol, sizeof(protocol), NULL, NULL); diff --git a/plugins/WhenWasIt/src/utils.h b/plugins/WhenWasIt/src/utils.h index 6468ab63bc..022b79b117 100644 --- a/plugins/WhenWasIt/src/utils.h +++ b/plugins/WhenWasIt/src/utils.h @@ -44,10 +44,10 @@ RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, int size); -TCHAR *GetContactName(HANDLE hContact, char *szProto); -TCHAR *GetContactID(HANDLE hContact); -TCHAR *GetContactID(HANDLE hContact, char *szProto); -HANDLE GetContactFromID(TCHAR *szID, char *szProto); -HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto); +TCHAR *GetContactName(HCONTACT hContact, char *szProto); +TCHAR *GetContactID(HCONTACT hContact); +TCHAR *GetContactID(HCONTACT hContact, char *szProto); +HCONTACT GetContactFromID(TCHAR *szID, char *szProto); +HCONTACT GetContactFromID(TCHAR *szID, wchar_t *szProto); #endif \ No newline at end of file diff --git a/plugins/WinterSpeak/src/ConfigDatabase.cpp b/plugins/WinterSpeak/src/ConfigDatabase.cpp index 64af1e35f4..0184e7e5d0 100644 --- a/plugins/WinterSpeak/src/ConfigDatabase.cpp +++ b/plugins/WinterSpeak/src/ConfigDatabase.cpp @@ -47,7 +47,7 @@ void ConfigDatabase::setActiveFlag(ActiveFlag flag, bool state) } //------------------------------------------------------------------------------ -ConfigDatabase::act ConfigDatabase::getActiveUser(HANDLE user) const +ConfigDatabase::act ConfigDatabase::getActiveUser(HCONTACT user) const { ActiveUsersMap::const_iterator iter = m_active_users.find(user); @@ -69,7 +69,7 @@ ConfigDatabase::act ConfigDatabase::getActiveUser(HANDLE user) const } //------------------------------------------------------------------------------ -void ConfigDatabase::setActiveUser(HANDLE user, act state) +void ConfigDatabase::setActiveUser(HCONTACT user, act state) { m_active_users[user].status = state.status; m_active_users[user].message = state.message; @@ -89,10 +89,8 @@ void ConfigDatabase::load() m_welcome_msg = DBGetContactSettingString(SPEAK, WELCOME_MSG, L"Welcome to Miranda"); // iterate through all the users and add them to the list if active - HANDLE contact = db_find_first(); - - while (NULL != contact) - { + HCONTACT contact = db_find_first(); + while (NULL != contact) { m_active_users[contact].status = (db_get_b(contact, SPEAK, ACTIVE_STATE, true) != 0); m_active_users[contact].message = (db_get_b(contact, SPEAK, ACTIVE_MSG, true) != 0); diff --git a/plugins/WinterSpeak/src/ConfigDatabase.h b/plugins/WinterSpeak/src/ConfigDatabase.h index 5682abf0f0..da8b46dc8f 100644 --- a/plugins/WinterSpeak/src/ConfigDatabase.h +++ b/plugins/WinterSpeak/src/ConfigDatabase.h @@ -26,13 +26,13 @@ public: bool message; }; - typedef std::map ActiveUsersMap; + typedef std::map ActiveUsersMap; //-------------------------------------------------------------------------- // Description : get/set the voice description //-------------------------------------------------------------------------- - VoiceDesc getVoiceDesc() const { return m_voice_desc; } - void setVoiceDesc(const VoiceDesc &desc) { m_voice_desc = desc; } + VoiceDesc getVoiceDesc() const { return m_voice_desc; } + void setVoiceDesc(const VoiceDesc &desc) { m_voice_desc = desc; } //-------------------------------------------------------------------------- // Description : get/set the welcome message @@ -43,37 +43,36 @@ public: //-------------------------------------------------------------------------- // Description : get/set an status flags //-------------------------------------------------------------------------- - bool getActiveFlag(ActiveFlag flag) const; + bool getActiveFlag(ActiveFlag flag) const; void setActiveFlag(ActiveFlag flag, bool state); //-------------------------------------------------------------------------- // Description : get/set the user active flag //-------------------------------------------------------------------------- - act getActiveUser(HANDLE user) const; - void setActiveUser(HANDLE user, act state); - ActiveUsersMap getActiveUsers() const { return m_active_users; } - + act getActiveUser(HCONTACT user) const; + void setActiveUser(HCONTACT user, act state); + ActiveUsersMap getActiveUsers() const { return m_active_users; } + //-------------------------------------------------------------------------- // Description : load/save the settings from the miranda database //-------------------------------------------------------------------------- void load(); void save(); - private: +private: //-------------------------------------------------------------------------- // Description : For some reason this isn't implemented in miranda yet // Just get a string from the db - // Parameters : szModule - the entrys' module - // szSetting - the entrys' setting - // def - default string if entry doesn't exist + // Parameters : szModule - the entrys' module + // szSetting - the entrys' setting + // def - default string if entry doesn't exist //-------------------------------------------------------------------------- static std::wstring DBGetContactSettingString(const char *szModule, const char *szSetting, const WCHAR *def); - VoiceDesc m_voice_desc; - unsigned int m_active_flags; + VoiceDesc m_voice_desc; + unsigned int m_active_flags; std::wstring m_welcome_msg; //std::string m_welcome_msg; - ActiveUsersMap m_active_users; + ActiveUsersMap m_active_users; }; - diff --git a/plugins/WinterSpeak/src/DialogConfigActive.cpp b/plugins/WinterSpeak/src/DialogConfigActive.cpp index 5d20b91586..8c59b83fca 100644 --- a/plugins/WinterSpeak/src/DialogConfigActive.cpp +++ b/plugins/WinterSpeak/src/DialogConfigActive.cpp @@ -255,7 +255,7 @@ void DialogConfigActive::SetAllContactIcons(HWND hwndList, HWND window) { ConfigDatabase::ActiveUsersMap::const_iterator iter; for (iter = active_users.begin(); iter != active_users.end(); ++iter) { - HANDLE hContact = iter->first; + HCONTACT hContact = iter->first; if(hContact == 0) { } else { @@ -331,7 +331,7 @@ void DialogConfigActive::save(HWND window) m_db.setActiveFlag(ConfigDatabase::ActiveFlag_FreeForChat, (IsDlgButtonChecked(window, IDC_ACTIVE_FREEFORCHAT) != 0)); m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Invisible, (IsDlgButtonChecked(window, IDC_ACTIVE_INVISIBLE) != 0)); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(window, IDC_ACTIVE_USERS, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) SaveItemMask(GetDlgItem(window, IDC_ACTIVE_USERS), hContact, hItem); @@ -342,7 +342,7 @@ void DialogConfigActive::save(HWND window) m_db.save(); } -void DialogConfigActive::SaveItemMask(HWND hwndList, HANDLE hContact, HANDLE hItem) { +void DialogConfigActive::SaveItemMask(HWND hwndList, HCONTACT hContact, HANDLE hItem) { ConfigDatabase::act mask; mask.message = true; mask.status = true; diff --git a/plugins/WinterSpeak/src/DialogConfigActive.h b/plugins/WinterSpeak/src/DialogConfigActive.h index 8dbbbd43a9..f1b428972b 100644 --- a/plugins/WinterSpeak/src/DialogConfigActive.h +++ b/plugins/WinterSpeak/src/DialogConfigActive.h @@ -38,7 +38,7 @@ class DialogConfigActive : public MirandaDialog void SetIconsForColumn(HWND hwndList, HANDLE hItem, HANDLE hItemAll, int iColumn, int iImage); void SetAllChildIcons(HWND hwndList, HANDLE hFirstItem, int iColumn, int iImage); void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *groupChildCount); - void SaveItemMask(HWND hwndList, HANDLE hContact, HANDLE hItem); + void SaveItemMask(HWND hwndList, HCONTACT hContact, HANDLE hItem); static DialogConfigActive *m_instance; ConfigDatabase &m_db; diff --git a/plugins/WinterSpeak/src/SpeakAnnounce.cpp b/plugins/WinterSpeak/src/SpeakAnnounce.cpp index 2b9855f61b..e9120f20eb 100644 --- a/plugins/WinterSpeak/src/SpeakAnnounce.cpp +++ b/plugins/WinterSpeak/src/SpeakAnnounce.cpp @@ -72,7 +72,7 @@ void SpeakAnnounce::statusChange(DBCONTACTWRITESETTING *write_setting, HANDLE us } //------------------------------------------------------------------------------ -void SpeakAnnounce::incomingEvent(HANDLE user, HANDLE event) +void SpeakAnnounce::incomingEvent(HCONTACT user, HANDLE event) { if (m_event_info.isValidEvent(event)) { diff --git a/plugins/WinterSpeak/src/SpeakAnnounce.h b/plugins/WinterSpeak/src/SpeakAnnounce.h index ff681e6fdb..e4980a292a 100644 --- a/plugins/WinterSpeak/src/SpeakAnnounce.h +++ b/plugins/WinterSpeak/src/SpeakAnnounce.h @@ -17,7 +17,7 @@ class SpeakAnnounce //-------------------------------------------------------------------------- // Description : handle an event //-------------------------------------------------------------------------- - void incomingEvent(HANDLE user, HANDLE event); + void incomingEvent(HCONTACT user, HANDLE event); //-------------------------------------------------------------------------- // Description : handle a protocol state change diff --git a/plugins/WinterSpeak/src/SpeakConfig.cpp b/plugins/WinterSpeak/src/SpeakConfig.cpp index 40c9d48dbe..605b120f92 100644 --- a/plugins/WinterSpeak/src/SpeakConfig.cpp +++ b/plugins/WinterSpeak/src/SpeakConfig.cpp @@ -33,13 +33,13 @@ void SpeakConfig::update(Subject &subject) } //------------------------------------------------------------------------------ -bool SpeakConfig::status(const std::wstring &sentence, HANDLE user) { +bool SpeakConfig::status(const std::wstring &sentence, HCONTACT user) { return say(sentence, user, false); } -bool SpeakConfig::message(const std::wstring &sentence, HANDLE user) { +bool SpeakConfig::message(const std::wstring &sentence, HCONTACT user) { return say(sentence, user, true); } -bool SpeakConfig::say(const std::wstring &sentence, HANDLE user, bool message) +bool SpeakConfig::say(const std::wstring &sentence, HCONTACT user, bool message) { if (!m_tts.get()){ return false; @@ -89,11 +89,10 @@ bool SpeakConfig::say(const std::wstring &sentence, HANDLE user, bool message) // if its a user say, then check the users status if (active) { - if(message) { + if(message) active = m_db.getActiveUser(user).message; - } else { + else active = m_db.getActiveUser(user).status; - } } } diff --git a/plugins/WinterSpeak/src/SpeakConfig.h b/plugins/WinterSpeak/src/SpeakConfig.h index e1a4cb421a..6894eecfb3 100644 --- a/plugins/WinterSpeak/src/SpeakConfig.h +++ b/plugins/WinterSpeak/src/SpeakConfig.h @@ -8,34 +8,34 @@ class TextToSpeech; class SpeakConfig : public Observer { - public: +public: SpeakConfig(HINSTANCE instance); - virtual ~SpeakConfig(); + virtual ~SpeakConfig(); - //-------------------------------------------------------------------------- - // Description : Called by a subject that this observer is observing - // to signify a change in state - // Parameters : subject - the subject that changed - //-------------------------------------------------------------------------- - virtual void update(Subject &subject); + //-------------------------------------------------------------------------- + // Description : Called by a subject that this observer is observing + // to signify a change in state + // Parameters : subject - the subject that changed + //-------------------------------------------------------------------------- + virtual void update(Subject &subject); //-------------------------------------------------------------------------- // Description : speak a sentence // Parameters : sentence - the sentence to speak - // user - the user to associate the say with - // NULL = ignore user + // user - the user to associate the say with + // NULL = ignore user // Returns : true - speak successful // false - speak failed //-------------------------------------------------------------------------- - bool status(const std::wstring &sentence, HANDLE user = NULL); - bool message(const std::wstring &sentence, HANDLE user = NULL); - bool say(const std::wstring &sentence, HANDLE user, bool message); + bool status(const std::wstring &sentence, HCONTACT user = NULL); + bool message(const std::wstring &sentence, HCONTACT user = NULL); + bool say(const std::wstring &sentence, HCONTACT user, bool message); - private: - HINSTANCE m_instance; +private: + HINSTANCE m_instance; ConfigDatabase m_db; - std::auto_ptr m_tts; - DialogConfigEngine m_dialog_engine; - DialogConfigActive m_dialog_active; + std::auto_ptr m_tts; + DialogConfigEngine m_dialog_engine; + DialogConfigActive m_dialog_active; }; \ No newline at end of file diff --git a/plugins/WinterSpeak/src/main.cpp b/plugins/WinterSpeak/src/main.cpp index 56e7665459..e20c0fa113 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), reinterpret_cast(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), reinterpret_cast(wParam)); } //----------------------------------------------------------------------------- @@ -56,7 +56,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(reinterpret_cast(wParam), reinterpret_cast(lParam)); return 0; } diff --git a/plugins/XSoundNotify/src/Common.h b/plugins/XSoundNotify/src/Common.h index c71dd34a4a..106022b842 100644 --- a/plugins/XSoundNotify/src/Common.h +++ b/plugins/XSoundNotify/src/Common.h @@ -23,11 +23,11 @@ struct XSN_Data { - HANDLE hContact; + HCONTACT hContact; TCHAR path[MAX_PATH]; BYTE ignore; - __forceinline XSN_Data(HANDLE _aContact, TCHAR *_path, BYTE _ignore) : + __forceinline XSN_Data(HCONTACT _aContact, TCHAR *_path, BYTE _ignore) : hContact(_aContact) { _tcsncpy(path, _path, SIZEOF(path)); diff --git a/plugins/XSoundNotify/src/dialog.cpp b/plugins/XSoundNotify/src/dialog.cpp index 84b5602a20..ec114a71b2 100644 --- a/plugins/XSoundNotify/src/dialog.cpp +++ b/plugins/XSoundNotify/src/dialog.cpp @@ -15,7 +15,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP case WM_INITDIALOG: { TranslateDialogDefault(hwndDlg); - HANDLE hContact = (HANDLE)lParam; + HCONTACT hContact = (HCONTACT)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); WindowList_Add(hChangeSoundDlgList, hwndDlg, hContact); Utils_RestoreWindowPositionNoSize(hwndDlg, hContact, SETTINGSNAME, "ChangeSoundDlg"); @@ -77,7 +77,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP switch (LOWORD(wParam)) { case IDOK: { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact); if (p != NULL) { if (lstrcmpi(p->path, _T(""))) { @@ -116,7 +116,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP ofn.lpstrDefExt = _T(""); if (GetOpenFileName(&ofn)) { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); SetDlgItemText(hwndDlg, IDC_CONT_LABEL_SOUND, PathFindFileName(FileName)); XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact); if (p == NULL) @@ -134,7 +134,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP case IDC_CONT_BUTTON_TEST_PLAY: { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact); isIgnoreSound = 0; if (p == NULL) { @@ -156,7 +156,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP case IDC_CONT_BUTTON_RESET_SOUND: { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_TEST_PLAY), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_RESET_SOUND), FALSE); CheckDlgButton(hwndDlg, IDC_CONT_IGNORE_SOUND, BST_UNCHECKED); @@ -173,7 +173,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP case IDC_CONT_IGNORE_SOUND: { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact); if (p == NULL) { DBVARIANT dbv; @@ -195,7 +195,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP break; case WM_DESTROY: - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); Utils_SaveWindowPosition(hwndDlg, hContact, SETTINGSNAME, "ChangeSoundDlg"); WindowList_Remove(hChangeSoundDlgList, hwndDlg); } @@ -204,7 +204,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP INT_PTR ShowDialog(WPARAM wParam, LPARAM lParam) { - HWND hChangeSoundDlg = WindowList_Find(hChangeSoundDlgList, (HANDLE)wParam); + HWND hChangeSoundDlg = WindowList_Find(hChangeSoundDlgList, (HCONTACT)wParam); if (!hChangeSoundDlg) { hChangeSoundDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACTS), 0, DlgProcContactsOptions, (LPARAM)wParam); ShowWindow(hChangeSoundDlg, SW_SHOW); diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp index 339bb93342..c7d98bc589 100644 --- a/plugins/XSoundNotify/src/options.cpp +++ b/plugins/XSoundNotify/src/options.cpp @@ -50,7 +50,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETCURSEL, 0, 0); PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char* szUniqueId = (char*)CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR) szUniqueId != CALLSERVICE_NOTFOUND && szUniqueId != NULL) { DBVARIANT dbvuid = {0}; @@ -85,7 +85,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_OPT_COMBO_USERS: if ((HIWORD(wParam) == CBN_SELCHANGE) || (HIWORD(wParam) == LBN_SELCHANGE)) { int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0); - HANDLE hContact = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0); + HCONTACT hContact = (HCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0); EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_CHOOSE_SOUND), TRUE); DBVARIANT dbv = {0}; if ( !db_get_ts(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) @@ -129,7 +129,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (GetOpenFileName(&ofn)) { SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, PathFindFileName(FileName)); int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0); - HANDLE hContact = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0); + HCONTACT hContact = (HCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0); XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact); if (p == NULL) XSN_Users.insert( new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0)); @@ -149,7 +149,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_OPT_BUTTON_TEST_PLAY: { int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0); - HANDLE hContact = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0); + HCONTACT hContact = (HCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0); XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact); isIgnoreSound = 0; if (p == NULL) { @@ -176,7 +176,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l CheckDlgButton(hwndDlg, IDC_OPT_IGNORE_SOUND, BST_UNCHECKED); SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, TranslateT("Not set")); int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0); - HANDLE hContact = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0); + HCONTACT hContact = (HCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0); XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact); if (p != NULL) { XSN_Users.remove(p); @@ -191,7 +191,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_OPT_IGNORE_SOUND: { int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0); - HANDLE hContact = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0); + HCONTACT hContact = (HCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0); XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact); if (p == NULL) { DBVARIANT dbv; diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp index 6f63acaa3b..a567a8d580 100644 --- a/plugins/XSoundNotify/src/xsn_main.cpp +++ b/plugins/XSoundNotify/src/xsn_main.cpp @@ -113,9 +113,9 @@ static int ProcessEvent(WPARAM wParam, LPARAM lParam) if (!isReceiveMessage(HANDLE(lParam))) return 0; - isIgnoreSound = db_get_b((HANDLE)wParam, SETTINGSNAME, SETTINGSIGNOREKEY, 0); + isIgnoreSound = db_get_b((HCONTACT)wParam, SETTINGSNAME, SETTINGSIGNOREKEY, 0); DBVARIANT dbv; - if ( !isIgnoreSound && !db_get_ts((HANDLE)wParam, SETTINGSNAME, SETTINGSKEY, &dbv)) { + if ( !isIgnoreSound && !db_get_ts((HCONTACT)wParam, SETTINGSNAME, SETTINGSKEY, &dbv)) { TCHAR PlaySoundPath[MAX_PATH] = {0}; PathToAbsoluteT(dbv.ptszVal, PlaySoundPath); SkinPlaySoundFile(PlaySoundPath); @@ -154,7 +154,7 @@ static int OnLoadInit(WPARAM wParam, LPARAM lParam) static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact) { char* szProto = GetContactProto(hContact); PROTOACCOUNT *pa = ProtoGetAccount(szProto); diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index 7662e0bfd3..06e080d274 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -117,7 +117,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"BadConnect:ActualAccountSO-read enter\n"); #endif - int size = strlen(ActualAccount->Name)+strlen(Translate(BADCONNECTTITLE)); + int size = (int)(strlen(ActualAccount->Name)+strlen(Translate(BADCONNECTTITLE))); TitleStrA = new char[size]; mir_snprintf(TitleStrA, size, Translate(BADCONNECTTITLE), ActualAccount->Name); @@ -127,7 +127,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA if (ShowPopup) { - BadConnectPopup.lchContact=ActualAccount; + BadConnectPopup.lchContact=(HCONTACT)ActualAccount; BadConnectPopup.lchIcon=g_LoadIconEx(3); BadConnectPopup.colorBack=ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC ? ActualAccount->BadConnectN.PopupB : GetSysColor(COLOR_BTNFACE); BadConnectPopup.colorText=ActualAccount->BadConnectN.Flags & YAMN_ACC_POPC ? ActualAccount->BadConnectN.PopupT : GetSysColor(COLOR_WINDOWTEXT); diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index bc306c1a4b..83bc7a02e3 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -510,7 +510,7 @@ int AddNewMailsToListView(HWND hListView,HACCOUNT ActualAccount,struct CMailNumb lfoundi=0; } - NewMailPopup.lchContact=(ActualAccount->hContact != NULL) ? ActualAccount->hContact : ActualAccount; + NewMailPopup.lchContact=(ActualAccount->hContact != NULL) ? ActualAccount->hContact : (HCONTACT)ActualAccount; NewMailPopup.lchIcon=g_LoadIconEx(2); NewMailPopup.colorBack=nflags & YAMN_ACC_POPC ? ActualAccount->NewMailN.PopupB : GetSysColor(COLOR_BTNFACE); NewMailPopup.colorText=nflags & YAMN_ACC_POPC ? ActualAccount->NewMailN.PopupT : GetSysColor(COLOR_WINDOWTEXT); @@ -681,7 +681,7 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR { POPUPDATAT NewMailPopup ={0}; - NewMailPopup.lchContact=(ActualAccount->hContact != NULL) ? ActualAccount->hContact : ActualAccount; + NewMailPopup.lchContact=(ActualAccount->hContact != NULL) ? ActualAccount->hContact : (HCONTACT)ActualAccount; NewMailPopup.lchIcon=g_LoadIconEx(2); NewMailPopup.colorBack=nflags & YAMN_ACC_POPC ? ActualAccount->NewMailN.PopupB : GetSysColor(COLOR_BTNFACE); NewMailPopup.colorText=nflags & YAMN_ACC_POPC ? ActualAccount->NewMailN.PopupT : GetSysColor(COLOR_WINDOWTEXT); @@ -784,7 +784,7 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR { POPUPDATAT NoNewMailPopup; - NoNewMailPopup.lchContact=(ActualAccount->hContact != NULL) ? ActualAccount->hContact : ActualAccount; + NoNewMailPopup.lchContact=(ActualAccount->hContact != NULL) ? ActualAccount->hContact : (HCONTACT)ActualAccount; NoNewMailPopup.lchIcon=g_LoadIconEx(1); NoNewMailPopup.colorBack=ActualAccount->NoNewMailN.Flags & YAMN_ACC_POPC ? ActualAccount->NoNewMailN.PopupB : GetSysColor(COLOR_BTNFACE); NoNewMailPopup.colorText=ActualAccount->NoNewMailN.Flags & YAMN_ACC_POPC ? ActualAccount->NoNewMailN.PopupT : GetSysColor(COLOR_WINDOWTEXT); @@ -830,7 +830,7 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam //if clicked and it's new mail popup window if ((HIWORD(wParam)==STN_CLICKED) && (-1 != (PluginParam=CallService(MS_POPUP_GETPLUGINDATA,(WPARAM)hWnd,(LPARAM)&PluginParam)))) { - HANDLE hContact = 0; + HCONTACT hContact = 0; HACCOUNT Account; if (PluginParam) { PYAMN_MAILSHOWPARAM MailParam = new YAMN_MAILSHOWPARAM; @@ -849,15 +849,15 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam } else { DBVARIANT dbv; - hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,0); + hContact=(HCONTACT)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,0); - if (!db_get((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv)) + if (!db_get((HCONTACT)hContact,YAMN_DBMODULE,"Id",&dbv)) { Account=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal); db_free(&dbv); } else - Account = (HACCOUNT) hContact; //???? + Account = (HACCOUNT)hContact; //???? #ifdef DEBUG_SYNCHRO @@ -900,7 +900,7 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam break; case UM_FREEPLUGINDATA:{ PYAMN_MAILSHOWPARAM mpd = (PYAMN_MAILSHOWPARAM)PUGetPluginData(hWnd); - HANDLE hContact = 0; + HCONTACT hContact = 0; if ((mpd) && (INT_PTR)mpd != -1)free(mpd); return FALSE; } @@ -914,12 +914,12 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam case WM_YAMN_STOPACCOUNT: { HACCOUNT ActualAccount; - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; - hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,0); + hContact=(HCONTACT)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,0); - if (!db_get((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv)) + if (!db_get((HCONTACT) hContact,YAMN_DBMODULE,"Id",&dbv)) { ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal); db_free(&dbv); @@ -947,12 +947,12 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPar if ((HIWORD(wParam)==STN_CLICKED) && (msg==WM_COMMAND)) { HACCOUNT ActualAccount; - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; - hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,0); + hContact=(HCONTACT)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,0); - if (!db_get((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv)) + if (!db_get((HCONTACT)hContact,YAMN_DBMODULE,"Id",&dbv)) { ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal); db_free(&dbv); @@ -1014,12 +1014,12 @@ LRESULT CALLBACK NoNewMailPopupProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPar case WM_YAMN_STOPACCOUNT: { HACCOUNT ActualAccount; - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; - hContact=(HANDLE)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,0); + hContact=(HCONTACT)CallService(MS_POPUP_GETCONTACT,(WPARAM)hWnd,0); - if (!db_get((HANDLE) hContact,YAMN_DBMODULE,"Id",&dbv)) + if (!db_get((HCONTACT) hContact,YAMN_DBMODULE,"Id",&dbv)) { ActualAccount=(HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)dbv.pszVal); db_free(&dbv); @@ -1465,12 +1465,11 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg,UINT msg,WPARAM wParam,LPARAM if (MailParam->mail->Flags & YAMN_MSG_UNSEEN) { MailParam->mail->Flags&=~YAMN_MSG_UNSEEN; //mark the message as seen HWND hMailBrowser; - if (hMailBrowser=WindowList_Find(YAMNVar.NewMailAccountWnd,MailParam->account)) { + if (hMailBrowser=WindowList_Find(YAMNVar.NewMailAccountWnd, (HCONTACT)MailParam->account)) { struct CChangeContent Params={MailParam->account->NewMailN.Flags|YAMN_ACC_MSGP,MailParam->account->NoNewMailN.Flags|YAMN_ACC_MSGP}; SendMessageW(hMailBrowser,WM_YAMN_CHANGECONTENT,(WPARAM)MailParam->account,(LPARAM)&Params); - } else { - UpdateMails(NULL,MailParam->account,MailParam->account->NewMailN.Flags,MailParam->account->NoNewMailN.Flags); } + else UpdateMails(NULL,MailParam->account,MailParam->account->NewMailN.Flags,MailParam->account->NoNewMailN.Flags); } } ShowWindow(GetDlgItem(hDlg, IDC_SPLITTER),(MailParam->mail->Flags & YAMN_MSG_BODYRECEIVED)?SW_SHOW:SW_HIDE); @@ -1737,7 +1736,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM ReadDoneFcn(ActualAccount->AccountAccessSO); WindowList_Add(YAMNVar.MessageWnds,hDlg,NULL); - WindowList_Add(YAMNVar.NewMailAccountWnd,hDlg,ActualAccount); + WindowList_Add(YAMNVar.NewMailAccountWnd,hDlg, (HCONTACT)ActualAccount); { TCHAR accstatus[512]; @@ -2510,7 +2509,7 @@ DWORD WINAPI MailBrowser(LPVOID Param) #endif ReadDoneFcn(ActualAccount->AccountAccessSO); - if (NULL != (hMailBrowser=WindowList_Find(YAMNVar.NewMailAccountWnd,ActualAccount))) + if (NULL != (hMailBrowser=WindowList_Find(YAMNVar.NewMailAccountWnd, (HCONTACT)ActualAccount))) WndFound=TRUE; if ((hMailBrowser==NULL) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG))) { diff --git a/plugins/YAMN/src/proto/pop3/pop3comm.cpp b/plugins/YAMN/src/proto/pop3/pop3comm.cpp index 16bbafd65a..ebd9c90d2c 100644 --- a/plugins/YAMN/src/proto/pop3/pop3comm.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3comm.cpp @@ -276,7 +276,7 @@ int RegisterPOP3Plugin(WPARAM,LPARAM) for (Finder=POP3Plugin->FirstAccount;Finder != NULL;Finder=Finder->Next) { Finder->hContact = NULL; - for (HANDLE hContact = db_find_first(YAMN_DBMODULE); hContact; hContact = db_find_next(hContact, YAMN_DBMODULE)) { + for (HCONTACT hContact = db_find_first(YAMN_DBMODULE); hContact; hContact = db_find_next(hContact, YAMN_DBMODULE)) { if (!db_get_s(hContact,YAMN_DBMODULE,"Id",&dbv)) { if ( strcmp( dbv.pszVal, Finder->Name) == 0) { Finder->hContact = hContact; @@ -294,7 +294,7 @@ int RegisterPOP3Plugin(WPARAM,LPARAM) if (Finder->hContact == NULL && (Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) { //No account contact found, have to create one - Finder->hContact =(HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); + Finder->hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)Finder->hContact,(LPARAM)YAMN_DBMODULE); db_set_s(Finder->hContact,YAMN_DBMODULE,"Id",Finder->Name); db_set_s(Finder->hContact,YAMN_DBMODULE,"Nick",Finder->Name); diff --git a/plugins/YAMN/src/services.cpp b/plugins/YAMN/src/services.cpp index 21d565ba4d..40484f73e0 100644 --- a/plugins/YAMN/src/services.cpp +++ b/plugins/YAMN/src/services.cpp @@ -65,12 +65,12 @@ static int Service_ContactDoubleclicked(WPARAM wParam, LPARAM lParam) static INT_PTR ContactApplication(WPARAM wParam, LPARAM lParam) { - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if ( lstrcmpA(szProto, YAMN_DBMODULE)) return 0; DBVARIANT dbv; - if ( db_get((HANDLE) wParam, YAMN_DBMODULE, "Id", &dbv)) + if ( db_get((HCONTACT)wParam, YAMN_DBMODULE, "Id", &dbv)) return 0; HACCOUNT ActualAccount = (HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); @@ -168,12 +168,12 @@ static INT_PTR AccountMailCheck(WPARAM wParam, LPARAM lParam) static INT_PTR ContactMailCheck(WPARAM wParam, LPARAM lParam) { - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if ( lstrcmpA(szProto, YAMN_DBMODULE)) return 0; DBVARIANT dbv; - if ( db_get((HANDLE) wParam, YAMN_DBMODULE, "Id", &dbv)) + if ( db_get((HCONTACT) wParam, YAMN_DBMODULE, "Id", &dbv)) return 0; HACCOUNT ActualAccount = (HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); @@ -227,12 +227,12 @@ void MainMenuAccountClicked(WPARAM wParam, LPARAM lParam) /*static*/ void ContactDoubleclicked(WPARAM wParam, LPARAM lParam) { - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if ( lstrcmpA(szProto, YAMN_DBMODULE)) return; DBVARIANT dbv; - if ( db_get(( HANDLE )wParam, YAMN_DBMODULE, "Id", &dbv)) + if ( db_get((HCONTACT)wParam, YAMN_DBMODULE, "Id", &dbv)) return; HACCOUNT ActualAccount = (HACCOUNT) CallService(MS_YAMN_FINDACCOUNTBYNAME, (WPARAM)POP3Plugin, (LPARAM)dbv.pszVal); @@ -483,7 +483,7 @@ void RefreshContact(void) db_set_b(Finder->hContact, "CList", "Hidden", 1); } else if ((Finder->Flags & YAMN_ACC_ENA) && (Finder->NewMailN.Flags & YAMN_ACC_CONT)) { - Finder->hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); + Finder->hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)Finder->hContact, (LPARAM)YAMN_DBMODULE); db_set_s(Finder->hContact, YAMN_DBMODULE, "Id", Finder->Name); db_set_s(Finder->hContact, YAMN_DBMODULE, "Nick", Finder->Name); diff --git a/plugins/YAPP/src/message_pump.h b/plugins/YAPP/src/message_pump.h index fc3d889a0a..6283a0f14b 100644 --- a/plugins/YAPP/src/message_pump.h +++ b/plugins/YAPP/src/message_pump.h @@ -15,7 +15,7 @@ struct PopupData { int cbSize; int flags; // OR of PDF_* flags below - HANDLE hContact; + HCONTACT hContact; HICON hIcon; union { char *pszTitle; diff --git a/plugins/YAPP/src/options.cpp b/plugins/YAPP/src/options.cpp index accbc0f630..7b11771414 100644 --- a/plugins/YAPP/src/options.cpp +++ b/plugins/YAPP/src/options.cpp @@ -99,7 +99,7 @@ void ShowExamplePopups() pd.ptzText = TranslateT("Thequickbrownfoxjumpedoverthelazydog."); ShowPopup(pd); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (options.av_layout != PAV_NONE && ServiceExists(MS_AV_DRAWAVATAR)) { AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0); if (ace && (ace->dwFlags & AVS_BITMAP_VALID)) { diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp index 5f73b97421..7089f01b98 100644 --- a/plugins/YAPP/src/popwin.cpp +++ b/plugins/YAPP/src/popwin.cpp @@ -695,7 +695,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pd->colorBack = MNotifyGetDWord(pwd->hNotify, NFOPT_BACKCOLOR, colBg); pd->colorText = MNotifyGetDWord(pwd->hNotify, NFOPT_TEXTCOLOR, colSecondLine); pd->timeout = MNotifyGetDWord(pwd->hNotify, NFOPT_TIMEOUT, options.default_timeout); - pd->hContact = (HANDLE)MNotifyGetDWord(pwd->hNotify, NFOPT_CONTACT, 0); + pd->hContact = (HCONTACT)MNotifyGetDWord(pwd->hNotify, NFOPT_CONTACT, 0); pd->hIcon = (HICON)MNotifyGetDWord(pwd->hNotify, NFOPT_ICON, 0); const wchar_t *swzName = MNotifyGetWString(pwd->hNotify, NFOPT_TITLEW, 0); diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index 3c8e2557c6..808b184990 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -162,7 +162,7 @@ void ShowPopup(PopupData &pd_in) static INT_PTR GetContact(WPARAM wParam, LPARAM lParam) { HWND hwndPop = (HWND)wParam; - HANDLE hContact; + HCONTACT hContact; if (GetCurrentThreadId() == message_pump_thread_id) SendMessage(hwndPop, PUM_GETCONTACT, (WPARAM)&hContact, 0); else { diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index 34cf80857a..6eee2d60eb 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -25,7 +25,7 @@ CLIST_INTERFACE *pcli; HINSTANCE hInst; int hLangpack; -HANDLE hForwardFrom, hForwardTo; +HCONTACT hForwardFrom, hForwardTo; TCHAR tszForwardTemplate[MAXTEMPLATESIZE]; int iSplit, iSplitMaxSize, iSendParts, iMarkRead, iSendAndHistory, iForwardOnStatus; @@ -89,7 +89,8 @@ int ProtoAck(WPARAM wparam,LPARAM lparam) */ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam, hDBEvent = (HANDLE)lParam; + HCONTACT hContact = (HCONTACT)wParam; + HANDLE hDBEvent = (HANDLE)lParam; // is the message sender accepted for forwarding if (hForwardFrom != 0 && hForwardFrom != hContact) @@ -209,7 +210,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) strncpy(szMsgPart, szBuf, cbPortion); szMsgPart[cbPortion] = 0; - HANDLE hMsgProc = (HANDLE)CallContactService((HANDLE)hForwardTo, PSS_MESSAGE, PREF_UTF, (LPARAM)szMsgPart); + HANDLE hMsgProc = (HANDLE)CallContactService(hForwardTo, PSS_MESSAGE, PREF_UTF, (LPARAM)szMsgPart); MESSAGE_PROC* msgProc = (MESSAGE_PROC*)mir_alloc(sizeof(MESSAGE_PROC)); msgProc->hProcess = hMsgProc; @@ -235,8 +236,8 @@ extern "C" int __declspec(dllexport) Load() mir_getCLI(); // Load plugin options from DB - hForwardFrom = (HANDLE)db_get_dw(NULL, "yaRelay", "ForwardFrom", 0); - hForwardTo = (HANDLE)db_get_dw(NULL, "yaRelay", "ForwardTo", 0); + hForwardFrom = (HCONTACT)db_get_dw(NULL, "yaRelay", "ForwardFrom", 0); + hForwardTo = (HCONTACT)db_get_dw(NULL, "yaRelay", "ForwardTo", 0); iForwardOnStatus = db_get_dw(NULL, "yaRelay", "ForwardOnStatus", STATUS_OFFLINE | STATUS_AWAY | STATUS_NA); diff --git a/plugins/YARelay/src/options.cpp b/plugins/YARelay/src/options.cpp index 4d96a1ca49..eafc4f93b1 100644 --- a/plugins/YARelay/src/options.cpp +++ b/plugins/YARelay/src/options.cpp @@ -50,7 +50,7 @@ static void OptionsFrameEnableControls(HWND hwndDlg) */ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - HANDLE hContact; + HCONTACT hContact; int idx; switch (uMsg) { case WM_INITDIALOG: @@ -144,9 +144,9 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, if (SendMessage(GetDlgItem(hwndDlg, IDC_RADIO_ALL), BM_GETCHECK, 0, 0) == BST_CHECKED) hForwardFrom = 0; else - hForwardFrom = (HANDLE)SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_FROM), CB_GETITEMDATA, SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_FROM), CB_GETCURSEL, 0, 0), 0); + hForwardFrom = (HCONTACT)SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_FROM), CB_GETITEMDATA, SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_FROM), CB_GETCURSEL, 0, 0), 0); - hForwardTo = (HANDLE)SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_TO), CB_GETITEMDATA, SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_TO), CB_GETCURSEL, 0, 0), 0); + hForwardTo = (HCONTACT)SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_TO), CB_GETITEMDATA, SendMessage(GetDlgItem(hwndDlg, IDC_COMBO_TO), CB_GETCURSEL, 0, 0), 0); iForwardOnStatus = 0; if (SendMessage(GetDlgItem(hwndDlg, IDC_CHECK1), BM_GETCHECK, 0, 0) == BST_CHECKED) iForwardOnStatus |= STATUS_OFFLINE; if (SendMessage(GetDlgItem(hwndDlg, IDC_CHECK2), BM_GETCHECK, 0, 0) == BST_CHECKED) iForwardOnStatus |= STATUS_ONLINE; diff --git a/plugins/YARelay/src/stdafx.h b/plugins/YARelay/src/stdafx.h index cc74ee704e..248f7fe5f1 100644 --- a/plugins/YARelay/src/stdafx.h +++ b/plugins/YARelay/src/stdafx.h @@ -48,7 +48,7 @@ Features: extern HINSTANCE hInst; -extern HANDLE hForwardFrom, hForwardTo; +extern HCONTACT hForwardFrom, hForwardTo; extern TCHAR tszForwardTemplate[MAXTEMPLATESIZE]; extern int iSplit, iSplitMaxSize, iSendParts, iMarkRead, iSendAndHistory, iForwardOnStatus; diff --git a/plugins/YahooGroups/src/services.cpp b/plugins/YahooGroups/src/services.cpp index e5c1175db4..104ce5a949 100644 --- a/plugins/YahooGroups/src/services.cpp +++ b/plugins/YahooGroups/src/services.cpp @@ -106,7 +106,7 @@ void AddNewGroup(char *newGroup) availableGroups.Add(_strdup(group + 1)); } -void AddContactToGroup(HANDLE hContact, char *group) +void AddContactToGroup(HCONTACT hContact, char *group) { const int MAX_SIZE = 1024; wchar_t wide[MAX_SIZE] = {0}; @@ -159,13 +159,13 @@ void CreateGroup(char *group) } } -void ProcessContacts(void (*callback)(HANDLE, char *), char *protocol) +void ProcessContacts(void (*callback)(HCONTACT, char *), char *protocol) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) callback(hContact, protocol); } -void YahooMoveCallback(HANDLE hContact, char *unused) +void YahooMoveCallback(HCONTACT hContact, char *unused) { char protocol[128] = {0}; GetContactProtocol(hContact, protocol, sizeof(protocol)); @@ -182,7 +182,7 @@ void YahooMoveCallback(HANDLE hContact, char *unused) } } -void ResetGroupCallback(HANDLE hContact, char *protocol) +void ResetGroupCallback(HCONTACT hContact, char *protocol) { char p[128] = {0}; @@ -197,13 +197,11 @@ void ResetGroupCallback(HANDLE hContact, char *protocol) INT_PTR YahooGroupsMoveService(WPARAM wParam, LPARAM lParam) { ProcessContacts(YahooMoveCallback, NULL); - return 0; } INT_PTR YahooGroupsResetService(WPARAM wParam, LPARAM lParam) { ProcessContacts(ResetGroupCallback, NULL); - return 0; } diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp index 2c2c761d9b..4274f8c38a 100644 --- a/plugins/YahooGroups/src/utils.cpp +++ b/plugins/YahooGroups/src/utils.cpp @@ -132,7 +132,7 @@ void HexToBin(char *inData, ULONG &size, LPBYTE &outData) i = size; } -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, char *szError, char *szResult, int size) +int GetStringFromDatabase(HCONTACT hContact, char *szModule, char *szSettingName, char *szError, char *szResult, int size) { DBVARIANT dbv = {0}; int res = 1; @@ -163,7 +163,7 @@ int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, return res; } -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, int count) +int GetStringFromDatabase(HCONTACT hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, int count) { DBVARIANT dbv = {0}; int res = 1; @@ -204,7 +204,7 @@ int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, return GetStringFromDatabase(NULL, ModuleName, szSettingName, szError, szResult, count); } -TCHAR *GetContactName(HANDLE hContact, char *szProto) +TCHAR *GetContactName(HCONTACT hContact, char *szProto) { CONTACTINFO ctInfo; char proto[200]; @@ -240,12 +240,12 @@ TCHAR *GetContactName(HANDLE hContact, char *szProto) return buffer; } -void GetContactProtocol(HANDLE hContact, char *szProto, int size) +void GetContactProtocol(HCONTACT hContact, char *szProto, int size) { GetStringFromDatabase(hContact, "Protocol", "p", NULL, szProto, size); } -TCHAR *GetContactID(HANDLE hContact) +TCHAR *GetContactID(HCONTACT hContact) { char protocol[256]; GetContactProtocol(hContact, protocol, sizeof(protocol)); @@ -253,7 +253,7 @@ TCHAR *GetContactID(HANDLE hContact) return GetContactID(hContact, protocol); } -TCHAR *GetContactID(HANDLE hContact, char *szProto) +TCHAR *GetContactID(HCONTACT hContact, char *szProto) { CONTACTINFO ctInfo; @@ -322,7 +322,7 @@ HANDLE GetContactFromID(TCHAR *szID, char *szProto) TCHAR *tmp; int found = 0; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { GetContactProtocol(hContact, cProtocol, sizeof(cProtocol)); szHandle = GetContactID(hContact, cProtocol); diff --git a/plugins/YahooGroups/src/utils.h b/plugins/YahooGroups/src/utils.h index 9133633caf..c3dc480dfa 100644 --- a/plugins/YahooGroups/src/utils.h +++ b/plugins/YahooGroups/src/utils.h @@ -44,17 +44,17 @@ void ScreenToClient(HWND hWnd, LPRECT rect); void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors); RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors); -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, char *szError, char *szResult, int size); -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, int count); +int GetStringFromDatabase(HCONTACT hContact, char *szModule, char *szSettingName, char *szError, char *szResult, int size); +int GetStringFromDatabase(HCONTACT hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, int count); int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, int size); int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, int count); -TCHAR *GetContactName(HANDLE hContact, char *szProto); -TCHAR *GetContactID(HANDLE hContact); -TCHAR *GetContactID(HANDLE hContact, char *szProto); +TCHAR *GetContactName(HCONTACT hContact, char *szProto); +TCHAR *GetContactID(HCONTACT hContact); +TCHAR *GetContactID(HCONTACT hContact, char *szProto); HANDLE GetContactFromID(TCHAR *szID, char *szProto); HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto); -void GetContactProtocol(HANDLE hContact, char *szProto, int size); +void GetContactProtocol(HCONTACT hContact, char *szProto, int size); int MyPUShowMessage(char *lpzText, BYTE kind); diff --git a/plugins/mTextControl/src/services.cpp b/plugins/mTextControl/src/services.cpp index 5f2ce42f52..0afa1df715 100644 --- a/plugins/mTextControl/src/services.cpp +++ b/plugins/mTextControl/src/services.cpp @@ -169,7 +169,7 @@ INT_PTR MText_CreateW(WPARAM wParam, LPARAM lParam) { //--------------------------------------------------------------------------- // allocate text object (advanced) HANDLE DLL_CALLCONV -MTI_MTextCreateEx (HANDLE userHandle, HANDLE hContact, void *text, DWORD flags) { +MTI_MTextCreateEx (HANDLE userHandle, HCONTACT hContact, void *text, DWORD flags) { TextObject *result = new TextObject; result->options = TextUserGetOptions(userHandle); result->ftd = new CFormattedTextDraw; @@ -337,7 +337,7 @@ INT_PTR MText_GetInterface(WPARAM wParam, LPARAM lParam) { MText->Create = MTI_MTextCreate; MText->CreateW = MTI_MTextCreateW; // MText->CreateT = defined inside api - MText->CreateEx = MTI_MTextCreateEx; + MText->CreateEx = MTI_MTextCreateEx; MText->Measure = MTI_MTextMeasure; MText->Display = MTI_MTextDisplay; MText->SetParent = MTI_MTextSetParent; diff --git a/plugins/mTextControl/src/services.h b/plugins/mTextControl/src/services.h index 589c33cba2..d5efb2ac87 100644 --- a/plugins/mTextControl/src/services.h +++ b/plugins/mTextControl/src/services.h @@ -25,7 +25,7 @@ void UnloadServices(); __declspec(dllexport) HANDLE DLL_CALLCONV MTI_MTextCreate (HANDLE userHandle, char *text); __declspec(dllexport) HANDLE DLL_CALLCONV MTI_MTextCreateW (HANDLE userHandle, WCHAR *text); -__declspec(dllexport) HANDLE DLL_CALLCONV MTI_MTextCreateEx (HANDLE userHandle, HANDLE hContact, void *text, DWORD flags); +__declspec(dllexport) HANDLE DLL_CALLCONV MTI_MTextCreateEx (HANDLE userHandle, HCONTACT hContact, void *text, DWORD flags); __declspec(dllexport) int DLL_CALLCONV MTI_MTextMeasure (HDC dc, SIZE *sz, HANDLE text); __declspec(dllexport) int DLL_CALLCONV MTI_MTextDisplay (HDC dc, POINT pos, SIZE sz, HANDLE text); __declspec(dllexport) int DLL_CALLCONV MTI_MTextSetParent (HANDLE text, HWND hwnd, RECT rect); diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp index 56c471ef27..10efe9572e 100644 --- a/plugins/wbOSD/src/events.cpp +++ b/plugins/wbOSD/src/events.cpp @@ -72,7 +72,7 @@ int ProtoAck(WPARAM,LPARAM lparam) int ContactSettingChanged(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT) wParam; DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; logmsg("ContactSettingChanged1"); @@ -98,7 +98,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) int ContactStatusChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT) wParam; WORD oldStatus = LOWORD(lParam); WORD newStatus = HIWORD(lParam); DWORD ann=db_get_dw(NULL,THIS_MODULE,"announce", DEFAULT_ANNOUNCE); diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index 6e764e8b78..a4617dbd29 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -20,7 +20,7 @@ along with this program. If not, see . void __cdecl CAimProto::avatar_request_thread(void* param) { - HANDLE hContact = (HANDLE)param; + HCONTACT hContact = (HCONTACT)param; char *sn = getStringA(hContact, AIM_KEY_SN); debugLogA("Starting avatar request thread for %s)", sn); @@ -59,7 +59,7 @@ void __cdecl CAimProto::avatar_upload_thread(void* param) delete req; } -void CAimProto::avatar_request_handler(HANDLE hContact, char* hash, unsigned char type)//checks to see if the avatar needs requested +void CAimProto::avatar_request_handler(HCONTACT hContact, char* hash, unsigned char type)//checks to see if the avatar needs requested { if (hContact == NULL) { @@ -99,15 +99,13 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* hash, const AI.hContact = contact_from_sn(sn); - if (data_len > 0) - { + if (data_len > 0) { const TCHAR *type; AI.format = ProtoGetBufferFormat(data, &type); get_avatar_filename(AI.hContact, AI.filename, SIZEOF(AI.filename), type); int fileId = _topen(AI.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE); - if (fileId >= 0) - { + if (fileId >= 0) { _write(fileId, data, data_len); _close(fileId); res = true; @@ -123,7 +121,7 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* hash, const ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, res ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, &AI, 0); } -int CAimProto::get_avatar_filename(HANDLE hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext) +int CAimProto::get_avatar_filename(HCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext) { int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST( _T("%miranda_avatarcache%")), m_szModuleName); diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp index f58f824016..7ba14d4e84 100644 --- a/protocols/AimOscar/src/chat.cpp +++ b/protocols/AimOscar/src/chat.cpp @@ -68,7 +68,7 @@ void CAimProto::chat_event(const char* id, const char* sn, int evt, const TCHAR* TCHAR* idt = mir_a2t(id); TCHAR* snt = mir_a2t(sn); - HANDLE hContact = contact_from_sn(sn); + HCONTACT hContact = contact_from_sn(sn); TCHAR* nick = hContact ? (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), GCDNF_TCHAR) : snt; @@ -137,7 +137,7 @@ int CAimProto::OnGCEvent(WPARAM wParam,LPARAM lParam) case GC_USER_PRIVMESS: { char* sn = mir_t2a(gch->ptszUID); - HANDLE hContact = contact_from_sn(sn); + HCONTACT hContact = contact_from_sn(sn); mir_free(sn); CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); } @@ -160,7 +160,7 @@ int CAimProto::OnGCEvent(WPARAM wParam,LPARAM lParam) case GC_USER_NICKLISTMENU: { char *sn = mir_t2a(gch->ptszUID); - HANDLE hContact = contact_from_sn(sn); + HCONTACT hContact = contact_from_sn(sn); mir_free(sn); switch (gch->dwData) diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp index ae5f3b8698..8d4972e3e4 100644 --- a/protocols/AimOscar/src/file.cpp +++ b/protocols/AimOscar/src/file.cpp @@ -484,7 +484,7 @@ void CAimProto::shutdown_file_transfers(void) ft_list_type::ft_list_type() : OBJLIST (10) {}; -file_transfer* ft_list_type::find_by_cookie(char* cookie, HANDLE hContact) +file_transfer* ft_list_type::find_by_cookie(char* cookie, HCONTACT hContact) { for (int i = 0; i < getCount(); ++i) { @@ -528,7 +528,7 @@ void ft_list_type::remove_by_ft(file_transfer *ft) } } -file_transfer::file_transfer(HANDLE hCont, char* nick, char* cookie) +file_transfer::file_transfer(HCONTACT hCont, char* nick, char* cookie) { memset(this, 0, sizeof(*this)); diff --git a/protocols/AimOscar/src/file.h b/protocols/AimOscar/src/file.h index 591e86b75b..61bc3e9d13 100644 --- a/protocols/AimOscar/src/file.h +++ b/protocols/AimOscar/src/file.h @@ -23,7 +23,7 @@ struct CAimProto; struct file_transfer { - HANDLE hContact; + HCONTACT hContact; char* sn; char icbm_cookie[8]; @@ -56,7 +56,7 @@ struct file_transfer bool requester; bool success; - file_transfer(HANDLE hCont, char* nick, char* cookie); + file_transfer(HCONTACT hCont, char* nick, char* cookie); ~file_transfer(); void listen(CAimProto* ppro); @@ -68,8 +68,8 @@ struct ft_list_type : OBJLIST { ft_list_type(); - file_transfer* find_by_handle(HANDLE hContact); - file_transfer* find_by_cookie(char* cookie, HANDLE hContact); + file_transfer* find_by_handle(HCONTACT hContact); + file_transfer* find_by_cookie(char* cookie, HCONTACT hContact); file_transfer* find_by_port(unsigned short port); bool find_by_ft(file_transfer *ft); diff --git a/protocols/AimOscar/src/links.cpp b/protocols/AimOscar/src/links.cpp index 9c8766872f..a4ca30f868 100644 --- a/protocols/AimOscar/src/links.cpp +++ b/protocols/AimOscar/src/links.cpp @@ -113,7 +113,7 @@ static INT_PTR ServiceParseAimLink(WPARAM /*wParam*/,LPARAM lParam) if (!proto->contact_from_sn(sn)) /* does not yet check if sn is current user */ { - HANDLE hContact = proto->contact_from_sn(sn, true); + HCONTACT hContact = proto->contact_from_sn(sn, true); proto->add_contact_to_group(hContact, group && group[0] ? group : AIM_DEFAULT_GROUP); } mir_free(group); @@ -137,7 +137,7 @@ static INT_PTR ServiceParseAimLink(WPARAM /*wParam*/,LPARAM lParam) } if (sn == NULL) return 1; /* parse failed */ - HANDLE hContact = proto->contact_from_sn(sn, true, true); + HCONTACT hContact = proto->contact_from_sn(sn, true, true); if (hContact) CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, (LPARAM)msg); diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index ebe3659655..8789f548e2 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -131,7 +131,7 @@ HANDLE CAimProto::AddToList(int flags, PROTOSEARCHRESULT* psr) if (state != 1) return 0; TCHAR *id = psr->id ? psr->id : psr->nick; char *sn = psr->flags & PSR_UNICODE ? mir_u2a((wchar_t*)id) : mir_strdup((char*)id); - HANDLE hContact = contact_from_sn(sn, true, (flags & PALF_TEMPORARY) != 0); + HCONTACT hContact = contact_from_sn(sn, true, (flags & PALF_TEMPORARY) != 0); mir_free(sn); return hContact; //See authrequest for serverside addition } @@ -160,7 +160,7 @@ int CAimProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) //////////////////////////////////////////////////////////////////////////////////////// // PSR_AUTH -int __cdecl CAimProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* evt) +int __cdecl CAimProto::AuthRecv(HCONTACT hContact, PROTORECVEVENT* evt) { return 1; } @@ -168,7 +168,7 @@ int __cdecl CAimProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* evt) //////////////////////////////////////////////////////////////////////////////////////// // PSS_AUTHREQUEST -int __cdecl CAimProto::AuthRequest(HANDLE hContact, const TCHAR* szMessage) +int __cdecl CAimProto::AuthRequest(HCONTACT hContact, const TCHAR* szMessage) { //Not a real authrequest- only used b/c we don't know the group until now. if (state != 1) @@ -196,7 +196,7 @@ HANDLE __cdecl CAimProto::ChangeInfo(int iInfoType, void* pInfoData) //////////////////////////////////////////////////////////////////////////////////////// // FileAllow - starts a file transfer -HANDLE __cdecl CAimProto::FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath) +HANDLE __cdecl CAimProto::FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath) { file_transfer *ft = (file_transfer*)hTransfer; if (ft && ft_list.find_by_ft(ft)) @@ -224,7 +224,7 @@ HANDLE __cdecl CAimProto::FileAllow(HANDLE hContact, HANDLE hTransfer, const PRO //////////////////////////////////////////////////////////////////////////////////////// // FileCancel - cancels a file transfer -int __cdecl CAimProto::FileCancel(HANDLE hContact, HANDLE hTransfer) +int __cdecl CAimProto::FileCancel(HCONTACT hContact, HANDLE hTransfer) { file_transfer *ft = (file_transfer*)hTransfer; if (!ft_list.find_by_ft(ft)) return 0; @@ -247,7 +247,7 @@ int __cdecl CAimProto::FileCancel(HANDLE hContact, HANDLE hTransfer) //////////////////////////////////////////////////////////////////////////////////////// // FileDeny - denies a file transfer -int __cdecl CAimProto::FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* /*szReason*/) +int __cdecl CAimProto::FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* /*szReason*/) { file_transfer *ft = (file_transfer*)hTransfer; if (!ft_list.find_by_ft(ft)) return 0; @@ -302,7 +302,7 @@ int __cdecl CAimProto::FileResume(HANDLE hTransfer, int* action, const PROTOCHAR //////////////////////////////////////////////////////////////////////////////////////// // GetCaps - return protocol capabilities bits -DWORD_PTR __cdecl CAimProto::GetCaps(int type, HANDLE hContact) +DWORD_PTR __cdecl CAimProto::GetCaps(int type, HCONTACT hContact) { switch (type) { @@ -345,7 +345,7 @@ DWORD_PTR __cdecl CAimProto::GetCaps(int type, HANDLE hContact) //////////////////////////////////////////////////////////////////////////////////////// // GetInfo - retrieves a contact info -int __cdecl CAimProto::GetInfo(HANDLE hContact, int infoType) +int __cdecl CAimProto::GetInfo(HCONTACT hContact, int infoType) { return 1; } @@ -421,7 +421,7 @@ HWND __cdecl CAimProto::CreateExtendedSearchUI(HWND owner) //////////////////////////////////////////////////////////////////////////////////////// // RecvContacts -int __cdecl CAimProto::RecvContacts(HANDLE hContact, PROTORECVEVENT*) +int __cdecl CAimProto::RecvContacts(HCONTACT hContact, PROTORECVEVENT*) { return 1; } @@ -429,7 +429,7 @@ int __cdecl CAimProto::RecvContacts(HANDLE hContact, PROTORECVEVENT*) //////////////////////////////////////////////////////////////////////////////////////// // RecvFile -int __cdecl CAimProto::RecvFile(HANDLE hContact, PROTOFILEEVENT* evt) +int __cdecl CAimProto::RecvFile(HCONTACT hContact, PROTOFILEEVENT* evt) { return Proto_RecvFile(hContact, evt); } @@ -437,7 +437,7 @@ int __cdecl CAimProto::RecvFile(HANDLE hContact, PROTOFILEEVENT* evt) //////////////////////////////////////////////////////////////////////////////////////// // RecvMsg -int __cdecl CAimProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) +int __cdecl CAimProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT* pre) { char *omsg = pre->szMessage; char *bbuf = NULL; @@ -458,7 +458,7 @@ int __cdecl CAimProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) //////////////////////////////////////////////////////////////////////////////////////// // RecvUrl -int __cdecl CAimProto::RecvUrl(HANDLE hContact, PROTORECVEVENT*) +int __cdecl CAimProto::RecvUrl(HCONTACT hContact, PROTORECVEVENT*) { return 1; } @@ -466,7 +466,7 @@ int __cdecl CAimProto::RecvUrl(HANDLE hContact, PROTORECVEVENT*) //////////////////////////////////////////////////////////////////////////////////////// // SendContacts -int __cdecl CAimProto::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList) +int __cdecl CAimProto::SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) { return 1; } @@ -474,7 +474,7 @@ int __cdecl CAimProto::SendContacts(HANDLE hContact, int flags, int nContacts, H //////////////////////////////////////////////////////////////////////////////////////// // SendFile - sends a file -HANDLE __cdecl CAimProto::SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) +HANDLE __cdecl CAimProto::SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) { if (state != 1) return 0; @@ -557,7 +557,7 @@ void __cdecl CAimProto::msg_ack_success(void* param) } -int __cdecl CAimProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc) +int __cdecl CAimProto::SendMsg(HCONTACT hContact, int flags, const char* pszSrc) { if (pszSrc == NULL) return 0; @@ -626,7 +626,7 @@ int __cdecl CAimProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc) //////////////////////////////////////////////////////////////////////////////////////// // SendUrl -int __cdecl CAimProto::SendUrl(HANDLE hContact, int flags, const char* url) +int __cdecl CAimProto::SendUrl(HCONTACT hContact, int flags, const char* url) { return 1; } @@ -634,7 +634,7 @@ int __cdecl CAimProto::SendUrl(HANDLE hContact, int flags, const char* url) //////////////////////////////////////////////////////////////////////////////////////// // SetApparentMode - sets the visibility m_iStatus -int __cdecl CAimProto::SetApparentMode(HANDLE hContact, int mode) +int __cdecl CAimProto::SetApparentMode(HCONTACT hContact, int mode) { return 0; } @@ -715,7 +715,7 @@ void __cdecl CAimProto::get_online_msg_thread(void* arg) { Sleep(150); - const HANDLE hContact = arg; + HCONTACT hContact = (HCONTACT)arg; DBVARIANT dbv; if (!db_get_ts(hContact, MOD_KEY_CL, OTH_KEY_SM, &dbv)) { ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal); @@ -724,7 +724,7 @@ void __cdecl CAimProto::get_online_msg_thread(void* arg) else ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0); } -HANDLE __cdecl CAimProto::GetAwayMsg(HANDLE hContact) +HANDLE __cdecl CAimProto::GetAwayMsg(HCONTACT hContact) { if (state != 1) return 0; @@ -746,7 +746,7 @@ HANDLE __cdecl CAimProto::GetAwayMsg(HANDLE hContact) //////////////////////////////////////////////////////////////////////////////////////// // PSR_AWAYMSG -int __cdecl CAimProto::RecvAwayMsg(HANDLE hContact, int statusMode, PROTORECVEVENT* pre) +int __cdecl CAimProto::RecvAwayMsg(HCONTACT hContact, int statusMode, PROTORECVEVENT* pre) { ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)pre->szMessage); return 0; @@ -800,7 +800,7 @@ int __cdecl CAimProto::SetAwayMsg(int status, const TCHAR* msg) ///////////////////////////////////////////////////////////////////////////////////////// // UserIsTyping - sends a UTN notification -int __cdecl CAimProto::UserIsTyping(HANDLE hContact, int type) +int __cdecl CAimProto::UserIsTyping(HCONTACT hContact, int type) { if (state != 1) return 0; diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h index 041a78694c..bdd1dd42e7 100644 --- a/protocols/AimOscar/src/proto.h +++ b/protocols/AimOscar/src/proto.h @@ -33,18 +33,18 @@ struct CAimProto : public PROTO virtual int __cdecl Authorize( HANDLE hDbEvent ); virtual int __cdecl AuthDeny( HANDLE hDbEvent, const TCHAR* szReason ); - virtual int __cdecl AuthRecv( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl AuthRequest( HANDLE hContact, const TCHAR* szMessage ); + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl AuthRequest(HCONTACT hContact, const TCHAR* szMessage ); virtual HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData ); - virtual HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath ); - virtual int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer ); - virtual int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason ); + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath ); + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer ); + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason ); virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** szFilename ); - virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL ); - virtual int __cdecl GetInfo( HANDLE hContact, int infoType ); + virtual DWORD_PTR __cdecl GetCaps( int type, HCONTACT hContact = NULL ); + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType ); virtual HANDLE __cdecl SearchBasic( const PROTOCHAR* id ); virtual HANDLE __cdecl SearchByEmail( const PROTOCHAR* email ); @@ -52,24 +52,24 @@ struct CAimProto : public PROTO virtual HWND __cdecl SearchAdvanced( HWND owner ); virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ); - virtual int __cdecl RecvContacts( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvFile( HANDLE hContact, PROTOFILEEVENT* ); - virtual int __cdecl RecvMsg( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvUrl( HANDLE hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvFile(HCONTACT hContact, PROTOFILEEVENT* ); + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT* ); - virtual int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ); - virtual HANDLE __cdecl SendFile( HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles ); - virtual int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg ); - virtual int __cdecl SendUrl( HANDLE hContact, int flags, const char* url ); + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList); + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles); + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg ); + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url ); - virtual int __cdecl SetApparentMode( HANDLE hContact, int mode ); + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode ); virtual int __cdecl SetStatus( int iNewStatus ); - virtual HANDLE __cdecl GetAwayMsg( HANDLE hContact ); - virtual int __cdecl RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVENT* evt ); + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact ); + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt ); virtual int __cdecl SetAwayMsg( int m_iStatus, const TCHAR* msg ); - virtual int __cdecl UserIsTyping( HANDLE hContact, int type ); + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type ); virtual int __cdecl OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam ); @@ -213,9 +213,9 @@ struct CAimProto : public PROTO void __cdecl avatar_request_thread( void* param ); void __cdecl avatar_upload_thread( void* param ); - void avatar_request_handler(HANDLE hContact, char* hash, unsigned char type); + void avatar_request_handler(HCONTACT hContact, char* hash, unsigned char type); void avatar_retrieval_handler(const char* sn, const char* hash, const char* data, int data_len); - int get_avatar_filename(HANDLE hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext); + int get_avatar_filename(HCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext); ////////////////////////////////////////////////////////////////////////////////////// // away.cpp @@ -414,36 +414,37 @@ struct CAimProto : public PROTO ////////////////////////////////////////////////////////////////////////////////////// // utilities.cpp - struct msg_ack_param { HANDLE hContact; const char *msg; int id; bool success; }; + struct msg_ack_param { HCONTACT hContact; const char *msg; int id; bool success; }; void __cdecl msg_ack_success(void*); void __cdecl start_connection(void*); + HCONTACT find_chat_contact(const char * room); + HCONTACT contact_from_sn(const char* sn, bool addIfNeeded = false, bool temporary = false); + void broadcast_status(int status); bool wait_conn(HANDLE& hConn, HANDLE& hEvent, unsigned short service); - bool is_my_contact(HANDLE hContact); - HANDLE find_chat_contact(const char * room); - HANDLE contact_from_sn(const char* sn, bool addIfNeeded = false, bool temporary = false); - void add_contact_to_group(HANDLE hContact, const char* group); - void set_local_nick(HANDLE hContact, char* nick, char* note); + bool is_my_contact(HCONTACT hContact); + void add_contact_to_group(HCONTACT hContact, const char* group); + void set_local_nick(HCONTACT hContact, char* nick, char* note); void upload_nicks(void); void update_server_group(const char* group, unsigned short group_id); void offline_contacts(void); - void offline_contact(HANDLE hContact, bool remove_settings); + void offline_contact(HCONTACT hContact, bool remove_settings); unsigned short get_default_port(void); int open_contact_file(const char* sn, const TCHAR* file, const char* mode, TCHAR* &path, bool contact_dir); void write_away_message(const char* sn, const char* msg, bool utf); void write_profile(const char* sn, const char* msg, bool utf); - unsigned short getBuddyId(HANDLE hContact, int i); - unsigned short getGroupId(HANDLE hContact, int i); - void setBuddyId(HANDLE hContact, int i, unsigned short id); - void setGroupId(HANDLE hContact, int i, unsigned short id); - int deleteBuddyId(HANDLE hContact, int i); - int deleteGroupId(HANDLE hContact, int i); + unsigned short getBuddyId(HCONTACT hContact, int i); + unsigned short getGroupId(HCONTACT hContact, int i); + void setBuddyId(HCONTACT hContact, int i, unsigned short id); + void setGroupId(HCONTACT hContact, int i, unsigned short id); + int deleteBuddyId(HCONTACT hContact, int i); + int deleteGroupId(HCONTACT hContact, int i); - unsigned short search_for_free_item_id(HANDLE hbuddy); + unsigned short search_for_free_item_id(HCONTACT hbuddy); unsigned short* get_members_of_group(unsigned short group_id, unsigned short& size); void ShowPopup( const char* msg, int flags, char* url = 0 ); diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index d45fd61412..2702a5af90 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -238,7 +238,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003 unsigned char sn_len = snac.ubyte(); char* sn = snac.part(1, sn_len); - HANDLE hContact = contact_from_sn(sn, true); + HCONTACT hContact = contact_from_sn(sn, true); int offset = sn_len + 3; int tlv_count = snac.ushort(offset); @@ -618,7 +618,7 @@ void CAimProto::snac_user_offline(SNAC &snac)//family 0x0003 { unsigned char buddy_length=snac.ubyte(); char* buddy=snac.part(1,buddy_length); - HANDLE hContact=contact_from_sn(buddy, true); + HCONTACT hContact=contact_from_sn(buddy, true); if (hContact) offline_contact(hContact,0); mir_free(buddy); @@ -646,7 +646,7 @@ void CAimProto::process_ssi_list(SNAC &snac, int &offset) { case 0x0000: //buddy record { - HANDLE hContact = contact_from_sn(name, true); + HCONTACT hContact = contact_from_sn(name, true); if (hContact) { int i; @@ -863,7 +863,7 @@ void CAimProto::modify_ssi_list(SNAC &snac, int &offset) { case 0x0000: //buddy record { - HANDLE hContact = contact_from_sn(name, true); + HCONTACT hContact = contact_from_sn(name, true); if (hContact) { for (int tlv_offset = 0; tlv_offset < tlv_size; ) @@ -982,7 +982,7 @@ void CAimProto::delete_ssi_list(SNAC &snac, int &offset) unsigned short item_id=snac.ushort(offset+4+name_length); unsigned short type=snac.ushort(offset+6+name_length); - HANDLE hContact = contact_from_sn(name); + HCONTACT hContact = contact_from_sn(name); switch (type) { case 0x0000: //buddy record @@ -1094,7 +1094,7 @@ void CAimProto::snac_message_accepted(SNAC &snac)//family 0x004 unsigned char sn_length=snac.ubyte(10); char* sn = snac.part(11,sn_length); - HANDLE hContact = contact_from_sn(sn); + HCONTACT hContact = contact_from_sn(sn); if (hContact) { msg_ack_param *msg_ack = (msg_ack_param*)mir_alloc(sizeof(msg_ack_param)); @@ -1117,7 +1117,7 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho unsigned char sn_length = snac.ubyte(10); char* sn = snac.part(11,sn_length); - HANDLE hContact = contact_from_sn(sn, true, true), hMsgContact = NULL; + HCONTACT hContact = contact_from_sn(sn, true, true), hMsgContact = NULL; int offset=15+sn_length; @@ -1476,7 +1476,7 @@ void CAimProto::snac_file_decline(SNAC &snac)//family 0x0004 int sn_len = snac.ubyte(10); char* sn = snac.part(11, sn_len); int reason = snac.ushort(11 + sn_len); - HANDLE hContact = contact_from_sn(sn); + HCONTACT hContact = contact_from_sn(sn); msg_ack_param *msg_ack = (msg_ack_param*)mir_alloc(sizeof(msg_ack_param)); msg_ack->hContact = hContact; @@ -1496,7 +1496,7 @@ void CAimProto::snac_file_decline(SNAC &snac)//family 0x0004 if (error == 0x02) { debugLogA("File Transfer declied"); - HANDLE hContact = contact_from_sn(sn); + HCONTACT hContact = contact_from_sn(sn); file_transfer *ft = ft_list.find_by_cookie(icbm_cookie, hContact); if (ft) { @@ -1527,7 +1527,7 @@ void CAimProto::snac_received_info(SNAC &snac)//family 0x0002 char* sn = snac.part(1, sn_length); unsigned short tlv_count = snac.ushort(3 + sn_length); offset = 5 + sn_length; - HANDLE hContact = contact_from_sn(sn, true, true); + HCONTACT hContact = contact_from_sn(sn, true, true); while (offset < snac.len()) { @@ -1589,7 +1589,7 @@ void CAimProto::snac_typing_notification(SNAC &snac)//family 0x004 { unsigned char sn_length=snac.ubyte(10); char* sn=snac.part(11,sn_length); - HANDLE hContact=contact_from_sn(sn); + HCONTACT hContact=contact_from_sn(sn); if (hContact) { unsigned short type=snac.ushort(11+sn_length); @@ -2304,7 +2304,7 @@ void CAimProto::snac_admin_account_confirm(SNAC &snac)//family 0x0007 { char sn[33]; int sn_length=buf[SNAC_SIZE*2]; - HANDLE hContact; + HCONTACT hContact; ZeroMemory(sn,sizeof(sn)); memcpy(sn,&buf[SNAC_SIZE*2+1],sn_length); hContact=find_contact(sn); diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp index 05ab61d12e..3a484527b3 100644 --- a/protocols/AimOscar/src/services.cpp +++ b/protocols/AimOscar/src/services.cpp @@ -91,8 +91,7 @@ INT_PTR CAimProto::GetProfile(WPARAM wParam, LPARAM lParam) return 0; DBVARIANT dbv; - if (!getString((HANDLE)wParam, AIM_KEY_SN, &dbv)) - { + if (!getString((HCONTACT)wParam, AIM_KEY_SN, &dbv)) { request_HTML_profile = 1; aim_query_profile(hServerConn, seqno, dbv.pszVal); db_free(&dbv); @@ -106,7 +105,7 @@ INT_PTR CAimProto::GetHTMLAwayMsg(WPARAM wParam, LPARAM /*lParam*/) return 0; DBVARIANT dbv; - if (!getString((HANDLE)wParam, AIM_KEY_SN, &dbv)) + if (!getString((HCONTACT)wParam, AIM_KEY_SN, &dbv)) { request_away_message = 1; aim_query_away_message(hServerConn, seqno, dbv.pszVal); @@ -120,7 +119,7 @@ int CAimProto::OnDbSettingChanged(WPARAM wParam,LPARAM lParam) if (strcmp(cws->szModule, MOD_KEY_CL) == 0 && state == 1 && wParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (strcmp(cws->szSetting, AIM_KEY_NL) == 0) { if (cws->value.type == DBVT_DELETED) @@ -170,7 +169,7 @@ int CAimProto::OnContactDeleted(WPARAM wParam,LPARAM /*lParam*/) { if (state != 1) return 0; - const HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (db_get_b(hContact, MOD_KEY_CL, AIM_KEY_NL, 0)) return 0; @@ -204,8 +203,8 @@ int CAimProto::OnGroupChange(WPARAM wParam,LPARAM lParam) { if (state != 1 || !getByte(AIM_KEY_MG, 1)) return 0; - const HANDLE hContact = (HANDLE)wParam; - const CLISTGROUPCHANGE* grpchg = (CLISTGROUPCHANGE*)lParam; + HCONTACT hContact = (HCONTACT)wParam; + CLISTGROUPCHANGE* grpchg = (CLISTGROUPCHANGE*)lParam; if (hContact == NULL) { @@ -255,7 +254,7 @@ INT_PTR CAimProto::AddToServerList(WPARAM wParam, LPARAM /*lParam*/) { if (state != 1) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBVARIANT dbv; if (!db_get_utf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0]) { @@ -271,7 +270,7 @@ INT_PTR CAimProto::BlockBuddy(WPARAM wParam, LPARAM /*lParam*/) { if (state != 1) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; unsigned short item_id; DBVARIANT dbv; if (getString(hContact, AIM_KEY_SN, &dbv)) return 0; @@ -329,7 +328,7 @@ INT_PTR CAimProto::OnJoinChat(WPARAM wParam, LPARAM /*lParam*/) { if (state != 1) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBVARIANT dbv; if (!getString(hContact, "ChatRoomID", &dbv)) @@ -345,7 +344,7 @@ INT_PTR CAimProto::OnLeaveChat(WPARAM wParam, LPARAM /*lParam*/) { if (state != 1) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBVARIANT dbv; if (!getString(hContact, "ChatRoomID", &dbv)) diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index 0a553f1d55..711dd27b9d 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -120,7 +120,7 @@ static const char* extra_ES_icon_name[2] = "hiptop", }; -static void set_AT_icon(CAimProto* ppro, HANDLE hContact) +static void set_AT_icon(CAimProto* ppro, HCONTACT hContact) { if (ppro->isChatRoom(hContact)) return; @@ -128,7 +128,7 @@ static void set_AT_icon(CAimProto* ppro, HANDLE hContact) ExtraIcon_SetIcon(hExtraAT, hContact, (i < 5) ? GetIconHandle(extra_AT_icon_name[i]) : NULL); } -static void set_ES_icon(CAimProto* ppro, HANDLE hContact) +static void set_ES_icon(CAimProto* ppro, HCONTACT hContact) { if (ppro->isChatRoom(hContact)) return; @@ -136,7 +136,7 @@ static void set_ES_icon(CAimProto* ppro, HANDLE hContact) ExtraIcon_SetIcon(hExtraAT, hContact, (i < 2) ? GetIconHandle(extra_ES_icon_name[i]) : NULL); } -void set_contact_icon(CAimProto* ppro, HANDLE hContact) +void set_contact_icon(CAimProto* ppro, HCONTACT hContact) { if (!ppro->getByte(AIM_KEY_AT, 0)) set_AT_icon(ppro, hContact); if (!ppro->getByte(AIM_KEY_ES, 0)) set_ES_icon(ppro, hContact); @@ -144,27 +144,27 @@ void set_contact_icon(CAimProto* ppro, HANDLE hContact) void remove_AT_icons(CAimProto* ppro) { - for (HANDLE hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) + for (HCONTACT hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) if (!ppro->isChatRoom(hContact)) ExtraIcon_Clear(hExtraAT, hContact); } void remove_ES_icons(CAimProto* ppro) { - for (HANDLE hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) + for (HCONTACT hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) if (!ppro->isChatRoom(hContact)) ExtraIcon_Clear(hExtraES, hContact); } void add_AT_icons(CAimProto* ppro) { - for (HANDLE hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) + for (HCONTACT hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) set_AT_icon(ppro, hContact); } void add_ES_icons(CAimProto* ppro) { - for (HANDLE hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) + for (HCONTACT hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) set_ES_icon(ppro, hContact); } @@ -179,7 +179,7 @@ void InitExtraIcons(void) int CAimProto::OnPreBuildContactMenu(WPARAM wParam,LPARAM /*lParam*/) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; bool bIsChatRoom = isChatRoom(hContact); //see if we should add the html away message context menu items diff --git a/protocols/AimOscar/src/theme.h b/protocols/AimOscar/src/theme.h index 8c520ceb75..c2e8093ce9 100644 --- a/protocols/AimOscar/src/theme.h +++ b/protocols/AimOscar/src/theme.h @@ -33,6 +33,6 @@ void remove_AT_icons(CAimProto* ppro); void add_ES_icons(CAimProto* ppro); void remove_ES_icons(CAimProto* ppro); -void set_contact_icon(CAimProto* ppro, HANDLE hContact); +void set_contact_icon(CAimProto* ppro, HCONTACT hContact); #endif diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index acbdfc7557..fd4dba0bea 100644 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -1326,25 +1326,21 @@ INT_PTR CALLBACK join_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ///////////////////////////////////////////////////////////////////////////////////////// // Invite to chat dialog -static void clist_chat_invite_send(HANDLE hItem, HWND hwndList, chat_list_item* item, CAimProto* ppro, char *msg) +static void clist_chat_invite_send(HCONTACT hItem, HWND hwndList, chat_list_item* item, CAimProto* ppro, char *msg) { if (hItem == NULL) - hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); + hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); - while (hItem) - { - if (IsHContactGroup(hItem)) - { - HANDLE hItemT = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); - if (hItemT) clist_chat_invite_send(hItemT, hwndList, item, ppro, msg); + while (hItem) { + if (IsHContactGroup(hItem)) { + HCONTACT hItemT = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + if (hItemT) + clist_chat_invite_send(hItemT, hwndList, item, ppro, msg); } - else - { + else { int chk = SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0); - if (chk) - { - if (IsHContactInfo(hItem)) - { + if (chk) { + if (IsHContactInfo(hItem)) { TCHAR buf[128] = _T(""); SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf); @@ -1353,11 +1349,9 @@ static void clist_chat_invite_send(HANDLE hItem, HWND hwndList, chat_list_item* item->cookie, item->exchange, item->instance, sn, msg); mir_free(sn); } - else - { + else { DBVARIANT dbv; - if (!ppro->getString(hItem, AIM_KEY_SN, &dbv)) - { + if (!ppro->getString(hItem, AIM_KEY_SN, &dbv)) { ppro->aim_chat_invite(ppro->hServerConn, ppro->seqno, item->cookie, item->exchange, item->instance, dbv.pszVal, msg); db_free(&dbv); @@ -1365,30 +1359,28 @@ static void clist_chat_invite_send(HANDLE hItem, HWND hwndList, chat_list_item* } } } - hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); + hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); } } -static void clist_validate_contact(HANDLE hItem, HWND hwndList, CAimProto* ppro) +static void clist_validate_contact(HCONTACT hItem, HWND hwndList, CAimProto* ppro) { if (!ppro->is_my_contact(hItem) || ppro->isChatRoom(hItem) || ppro->getWord(hItem, AIM_KEY_ST, ID_STATUS_OFFLINE) == ID_STATUS_ONTHEPHONE) SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0); } -static void clist_chat_prepare(HANDLE hItem, HWND hwndList, CAimProto* ppro) +static void clist_chat_prepare(HCONTACT hItem, HWND hwndList, CAimProto* ppro) { if (hItem == NULL) - hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); - - while (hItem) - { - HANDLE hItemN = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); - - if (IsHContactGroup(hItem)) - { - HANDLE hItemT = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); - if (hItemT) clist_chat_prepare(hItemT, hwndList, ppro); + hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); + + while (hItem) { + HCONTACT hItemN = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); + if (IsHContactGroup(hItem)) { + HCONTACT hItemT = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + if (hItemT) + clist_chat_prepare(hItemT, hwndList, ppro); } else if (IsHContactContact(hItem)) clist_validate_contact(hItem, hwndList, ppro); @@ -1397,13 +1389,11 @@ static void clist_chat_prepare(HANDLE hItem, HWND hwndList, CAimProto* ppro) } } - INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { invite_chat_param* param = (invite_chat_param*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - switch (msg) - { + switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -1433,7 +1423,7 @@ INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP { case CLN_NEWCONTACT: if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) - clist_validate_contact(nmc->hItem, nmc->hdr.hwndFrom, param->ppro); + clist_validate_contact((HCONTACT)nmc->hItem, nmc->hdr.hwndFrom, param->ppro); break; case CLN_LISTREBUILT: diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 58ca76cb0e..7df2eccaaf 100644 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -160,15 +160,15 @@ unsigned short CAimProto::get_default_port(void) return getWord(AIM_KEY_PN, getByte(AIM_KEY_DSSL, 0) ? AIM_DEFAULT_PORT : AIM_DEFAULT_SSL_PORT); } -bool CAimProto::is_my_contact(HANDLE hContact) +bool CAimProto::is_my_contact(HCONTACT hContact) { const char* szProto = GetContactProto(hContact); return szProto != NULL && strcmp(m_szModuleName, szProto) == 0; } -HANDLE CAimProto::find_chat_contact(const char* room) +HCONTACT CAimProto::find_chat_contact(const char* room) { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; if (!getString(hContact, "ChatRoomID", &dbv)) { bool found = !strcmp(room, dbv.pszVal); @@ -180,11 +180,11 @@ HANDLE CAimProto::find_chat_contact(const char* room) return NULL; } -HANDLE CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool temporary) +HCONTACT CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool temporary) { ptrA norm_sn( normalize_name(sn)); - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; if (!getString(hContact, AIM_KEY_SN, &dbv)) { bool found = !strcmp(norm_sn, dbv.pszVal); @@ -195,7 +195,7 @@ HANDLE CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool tempora } if (addIfNeeded) { - HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + HCONTACT hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if (hContact) { if (CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) m_szModuleName) == 0) { setString(hContact, AIM_KEY_SN, norm_sn); @@ -234,7 +234,7 @@ void CAimProto::update_server_group(const char* group, unsigned short group_id) mir_free(user_id_array); } -void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group) +void CAimProto::add_contact_to_group(HCONTACT hContact, const char* new_group) { if (new_group == NULL) return; @@ -300,7 +300,7 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group) db_free(&dbv); } -void CAimProto::offline_contact(HANDLE hContact, bool remove_settings) +void CAimProto::offline_contact(HCONTACT hContact, bool remove_settings) { if (remove_settings) { @@ -318,7 +318,7 @@ void CAimProto::offline_contact(HANDLE hContact, bool remove_settings) void CAimProto::offline_contacts(void) { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) offline_contact(hContact,true); allow_list.destroy(); @@ -376,14 +376,14 @@ void create_group(const char *group) mir_free(szGroupName); } -unsigned short CAimProto::search_for_free_item_id(HANDLE hbuddy)//returns a free item id and links the id to the buddy +unsigned short CAimProto::search_for_free_item_id(HCONTACT hbuddy)//returns a free item id and links the id to the buddy { unsigned short id; retry: id = get_random(); - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { for(int i=1; ;++i) { unsigned short item_id = getBuddyId(hContact, i); if (item_id == 0) break; @@ -402,7 +402,7 @@ unsigned short* CAimProto::get_members_of_group(unsigned short group_id, unsigne unsigned short* list = NULL; size = 0; - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { for(int i=1; ;++i) { unsigned short user_group_id = getGroupId(hContact, i); if (user_group_id == 0) @@ -422,7 +422,7 @@ unsigned short* CAimProto::get_members_of_group(unsigned short group_id, unsigne void CAimProto::upload_nicks(void) { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; if ( !db_get_utf(hContact, MOD_KEY_CL, "MyHandle", &dbv)) { set_local_nick(hContact, dbv.pszVal, NULL); @@ -431,7 +431,7 @@ void CAimProto::upload_nicks(void) } } -void CAimProto::set_local_nick(HANDLE hContact, char* nick, char* note) +void CAimProto::set_local_nick(HCONTACT hContact, char* nick, char* note) { DBVARIANT dbv; if (getString(hContact, AIM_KEY_SN, &dbv)) return; @@ -498,42 +498,42 @@ void BdList::remove_by_id(unsigned short id) ///////////////////////////////////////////////////////////////////////////////////////// -unsigned short CAimProto::getBuddyId(HANDLE hContact, int i) +unsigned short CAimProto::getBuddyId(HCONTACT hContact, int i) { char item[sizeof(AIM_KEY_BI)+10]; mir_snprintf(item, sizeof(AIM_KEY_BI)+10, AIM_KEY_BI"%d", i); return getWord(hContact, item, 0); } -void CAimProto::setBuddyId(HANDLE hContact, int i, unsigned short id) +void CAimProto::setBuddyId(HCONTACT hContact, int i, unsigned short id) { char item[sizeof(AIM_KEY_BI)+10]; mir_snprintf(item, sizeof(AIM_KEY_BI)+10, AIM_KEY_BI"%d", i); setWord(hContact, item, id); } -int CAimProto::deleteBuddyId(HANDLE hContact, int i) +int CAimProto::deleteBuddyId(HCONTACT hContact, int i) { char item[sizeof(AIM_KEY_BI)+10]; mir_snprintf(item, sizeof(AIM_KEY_BI)+10, AIM_KEY_BI"%d", i); return delSetting(hContact, item); } -unsigned short CAimProto::getGroupId(HANDLE hContact, int i) +unsigned short CAimProto::getGroupId(HCONTACT hContact, int i) { char item[sizeof(AIM_KEY_GI)+10]; mir_snprintf(item, sizeof(AIM_KEY_GI)+10, AIM_KEY_GI"%d", i); return getWord(hContact, item, 0); } -void CAimProto::setGroupId(HANDLE hContact, int i, unsigned short id) +void CAimProto::setGroupId(HCONTACT hContact, int i, unsigned short id) { char item[sizeof(AIM_KEY_GI)+10]; mir_snprintf(item, sizeof(AIM_KEY_GI)+10, AIM_KEY_GI"%d", i); setWord(hContact, item, id); } -int CAimProto::deleteGroupId(HANDLE hContact, int i) +int CAimProto::deleteGroupId(HCONTACT hContact, int i) { char item[sizeof(AIM_KEY_GI)+10]; mir_snprintf(item, sizeof(AIM_KEY_GI)+10, AIM_KEY_GI"%d", i); diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index 1b84fb79c7..32bdd1a2da 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -127,7 +127,7 @@ void CMLan::SetMirandaStatus(u_int status) void CMLan::SetAllOffline() { - for (HANDLE hContact = db_find_first(PROTONAME); hContact; hContact = db_find_next(hContact, PROTONAME)) { + for (HCONTACT hContact = db_find_first(PROTONAME); hContact; hContact = db_find_next(hContact, PROTONAME)) { db_set_w(hContact, PROTONAME, "Status", ID_STATUS_OFFLINE); db_unset(hContact, PROTONAME, "IP"); } @@ -204,7 +204,7 @@ void CMLan::Check() if (!cont->m_time) { cont->m_status = ID_STATUS_OFFLINE; - HANDLE hContact = FindContact(cont->m_addr, cont->m_nick, false, false, false); + HCONTACT hContact = FindContact(cont->m_addr, cont->m_nick, false, false, false); if (hContact) { db_set_w(hContact,PROTONAME,"Status",ID_STATUS_OFFLINE); @@ -236,9 +236,9 @@ void CMLan::SendPacketExt(TPacket& pak, u_long addr) delete[] buf; } -HANDLE CMLan::FindContact(in_addr addr, const char* nick, bool add_to_list, bool make_permanent, bool make_visible, u_int status) +HCONTACT CMLan::FindContact(in_addr addr, const char* nick, bool add_to_list, bool make_permanent, bool make_visible, u_int status) { - for (HANDLE res = db_find_first(PROTONAME); res; res = db_find_next(res, PROTONAME)) { + for (HCONTACT res = db_find_first(PROTONAME); res; res = db_find_next(res, PROTONAME)) { u_long caddr = db_get_dw(res, PROTONAME, "ipaddr", -1); if (caddr==addr.S_un.S_addr) { if (make_permanent) @@ -250,7 +250,7 @@ HANDLE CMLan::FindContact(in_addr addr, const char* nick, bool add_to_list, boo } if (add_to_list) { - HANDLE res=(HANDLE)CallService(MS_DB_CONTACT_ADD,0,0); + HCONTACT res=(HCONTACT)CallService(MS_DB_CONTACT_ADD,0,0); CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)res,(LPARAM)PROTONAME); db_set_dw(res,PROTONAME, "ipaddr", addr.S_un.S_addr); db_set_s(res,PROTONAME, "Nick", nick); @@ -315,7 +315,7 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from) cont->m_ver = pak.idVersion; u_int old_status = cont->m_status; cont->m_status = pak.idStatus; - HANDLE hContact = FindContact(cont->m_addr, cont->m_nick, false, false, false); + HCONTACT hContact = FindContact(cont->m_addr, cont->m_nick, false, false, false); if (hContact) { db_set_w(hContact,PROTONAME, "Status", cont->m_status); @@ -358,7 +358,7 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from) if (pak.idAckMessage) { - HANDLE hContact = FindContact(cont->m_addr, cont->m_nick, false, false, false); + HCONTACT hContact = FindContact(cont->m_addr, cont->m_nick, false, false, false); if (hContact) ProtoBroadcastAck(PROTONAME, hContact, pak.flIsUrl?ACKTYPE_URL:ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)pak.idAckMessage, 0); } @@ -374,7 +374,7 @@ void CMLan::OnRecvPacket(u_char* mes, int len, in_addr from) if (pak.idReqAwayMessage && cont) { - HANDLE hContact = FindContact(cont->m_addr, cont->m_nick, true, false, false); + HCONTACT hContact = FindContact(cont->m_addr, cont->m_nick, true, false, false); // Removed - it causes that whoisreadingawaymessage plugin was not working // if (hContact) // { @@ -459,9 +459,8 @@ int CMLan::AddToContactList(u_int flags, EMPSEARCHRESULT* psr) bool TempAdd = flags&PALF_TEMPORARY; - HANDLE contact = FindContact(addr, psr->hdr.nick, true, !TempAdd, !TempAdd, psr->stat); - if (contact!=NULL) - { + HCONTACT contact = FindContact(addr, psr->hdr.nick, true, !TempAdd, !TempAdd, psr->stat); + if (contact != NULL) { db_set_w(contact,PROTONAME,"Status", psr->stat ); db_set_w(contact,PROTONAME,"RemoteVersion", psr->ver ); } @@ -569,7 +568,7 @@ void CMLan::SearchExt(TDataHolder* hold) void CMLan::SendMessageExt(TDataHolder* hold) { Sleep(0); - if (db_get_w((HANDLE)hold->hContact, PROTONAME, "Status", ID_STATUS_OFFLINE)==ID_STATUS_OFFLINE) + if (db_get_w((HCONTACT)hold->hContact, PROTONAME, "Status", ID_STATUS_OFFLINE)==ID_STATUS_OFFLINE) { Sleep(20); ProtoBroadcastAck(PROTONAME, hold->hContact, (hold->op==LEXT_SENDURL)?ACKTYPE_URL:ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)hold->id, 0); @@ -578,7 +577,7 @@ void CMLan::SendMessageExt(TDataHolder* hold) { TPacket pak; ZeroMemory(&pak, sizeof(pak)); - u_long addr = db_get_dw((HANDLE)hold->hContact, PROTONAME, "ipaddr", 0); + u_long addr = db_get_dw((HCONTACT)hold->hContact, PROTONAME, "ipaddr", 0); pak.strMessage = hold->msg; pak.idMessage = hold->id; if (hold->op==LEXT_SENDURL) @@ -595,7 +594,7 @@ void CMLan::GetAwayMsgExt(TDataHolder* hold) TPacket pak; ZeroMemory(&pak, sizeof(pak)); pak.idReqAwayMessage = hold->id; - u_long addr = db_get_dw((HANDLE)hold->hContact, PROTONAME, "ipaddr", 0); + u_long addr = db_get_dw((HCONTACT)hold->hContact, PROTONAME, "ipaddr", 0); SendPacketExt(pak, addr); ProtoBroadcastAck(PROTONAME, hold->hContact, ACKTYPE_AWAYMSG, ACKRESULT_SENTREQUEST, (HANDLE)hold->id, 0); diff --git a/protocols/EmLanProto/src/mlan.h b/protocols/EmLanProto/src/mlan.h index 4ec8993b23..41bde7544b 100644 --- a/protocols/EmLanProto/src/mlan.h +++ b/protocols/EmLanProto/src/mlan.h @@ -30,7 +30,7 @@ public: long id; long op; - HANDLE hContact; + HCONTACT hContact; char* const msg; CMLan* lan; @@ -101,7 +101,7 @@ private: CRITICAL_SECTION m_csAccessAwayMes; void RequestStatus(bool answer=false, u_long m_addr=INADDR_BROADCAST); - HANDLE FindContact(in_addr addr, const char* nick, bool add_to_list, bool make_permanent, bool make_visible, u_int status = ID_STATUS_ONLINE); + HCONTACT FindContact(in_addr addr, const char* nick, bool add_to_list, bool make_permanent, bool make_visible, u_int status = ID_STATUS_ONLINE); void DeleteCache(); void StartChecking(); @@ -176,7 +176,7 @@ private: int m_cid; SOCKET m_socket; u_long m_addr; - HANDLE m_hContact; + HCONTACT m_hContact; char* m_szDescription; char** m_szFiles; diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index 196497a291..8e3006a12a 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -48,7 +48,7 @@ bool FacebookProto::GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::string * return false; } -void FacebookProto::CheckAvatarChange(HANDLE hContact, std::string image_url) +void FacebookProto::CheckAvatarChange(HCONTACT hContact, std::string image_url) { // Facebook contacts always have some avatar - keep avatar in database even if we have loaded empty one (e.g. for 'On Mobile' contacts) if (image_url.empty()) diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index 9b4dd11a58..6a4884090c 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -84,7 +84,7 @@ int FacebookProto::OnGCEvent(WPARAM wParam,LPARAM lParam) case GC_USER_PRIVMESS: { char* sn = mir_t2a(hook->ptszUID); - HANDLE hContact = ContactIDToHContact(sn); + HCONTACT hContact = ContactIDToHContact(sn); mir_free(sn); CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, 0); @@ -112,7 +112,7 @@ int FacebookProto::OnGCEvent(WPARAM wParam,LPARAM lParam) case GC_USER_NICKLISTMENU: { char *sn = mir_t2a(hook->ptszUID); - HANDLE hContact = ContactIDToHContact(sn); + HCONTACT hContact = ContactIDToHContact(sn); mir_free(sn); switch (hook->dwData) @@ -194,7 +194,7 @@ void FacebookProto::RemoveChatContact(const TCHAR *tchat_id, const char *id) char *FacebookProto::GetChatUsers(const TCHAR *chat_id) { GC_INFO gci = {0}; - gci.Flags = USERS; + gci.Flags = GCF_USERS; gci.pszModule = m_szModuleName; gci.pszID = chat_id; CallService(MS_GC_GETINFO, 0, (LPARAM)&gci); @@ -248,7 +248,7 @@ void FacebookProto::AddChat(const TCHAR *tid, const TCHAR *tname) INT_PTR FacebookProto::OnJoinChat(WPARAM wParam,LPARAM suppress) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; // TODO: load info from server + old history,... diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index fb2f712265..92333f3d1f 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -1252,7 +1252,7 @@ bool facebook_client::send_message(std::string message_recipient, std::string me case 1356003: // Contact is offline { - HANDLE hContact = parent->ContactIDToHContact(message_recipient); + HCONTACT hContact = parent->ContactIDToHContact(message_recipient); if (hContact != NULL) parent->setWord(hContact, "Status", ID_STATUS_OFFLINE); return false; diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index f225c5b8c7..fde9b8f678 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -22,7 +22,7 @@ along with this program. If not, see . #include "common.h" -void FacebookProto::SaveName(HANDLE hContact, const facebook_user *fbu) +void FacebookProto::SaveName(HCONTACT hContact, const facebook_user *fbu) { if (fbu->real_name.empty()) { delSetting(hContact, FACEBOOK_KEY_NICK); @@ -55,7 +55,7 @@ void FacebookProto::SaveName(HANDLE hContact, const facebook_user *fbu) } } -bool FacebookProto::IsMyContact(HANDLE hContact, bool include_chat) +bool FacebookProto::IsMyContact(HCONTACT hContact, bool include_chat) { const char *proto = GetContactProto(hContact); if (proto && !strcmp(m_szModuleName, proto)) { @@ -66,9 +66,9 @@ bool FacebookProto::IsMyContact(HANDLE hContact, bool include_chat) return false; } -HANDLE FacebookProto::ChatIDToHContact(std::tstring chat_id) +HCONTACT FacebookProto::ChatIDToHContact(std::tstring chat_id) { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (!IsMyContact(hContact, true)) continue; @@ -80,9 +80,9 @@ HANDLE FacebookProto::ChatIDToHContact(std::tstring chat_id) return 0; } -HANDLE FacebookProto::ContactIDToHContact(std::string user_id) +HCONTACT FacebookProto::ContactIDToHContact(std::string user_id) { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (!IsMyContact(hContact)) continue; @@ -98,7 +98,7 @@ std::string FacebookProto::ThreadIDToContactID(std::string thread_id) { std::string user_id; - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (!IsMyContact(hContact)) continue; @@ -138,9 +138,9 @@ std::string FacebookProto::ThreadIDToContactID(std::string thread_id) return user_id; } -HANDLE FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, bool dont_check) +HCONTACT FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, bool dont_check) { - HANDLE hContact; + HCONTACT hContact; if (!dont_check) { // First, check if this contact exists @@ -150,7 +150,7 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, boo } // If not, make a new contact! - hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if(hContact) { if(CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)m_szModuleName) == 0) @@ -193,7 +193,7 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, ContactType type, boo void FacebookProto::SetAllContactStatuses(int status) { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (isChatRoom(hContact)) continue; @@ -228,7 +228,7 @@ void FacebookProto::DeleteContactFromServer(void *data) if (fbu != NULL) fbu->deleted = true; - HANDLE hContact = ContactIDToHContact(id); + HCONTACT hContact = ContactIDToHContact(id); // If contact wasn't deleted from database if (hContact != NULL) { @@ -265,7 +265,7 @@ void FacebookProto::AddContactToServer(void *data) http::response resp = facy.flap(REQUEST_REQUEST_FRIEND, &query); if (resp.data.find("\"success\":true", 0) != std::string::npos) { - HANDLE hContact = ContactIDToHContact(id); + HCONTACT hContact = ContactIDToHContact(id); // If contact wasn't deleted from database if (hContact != NULL) @@ -287,7 +287,7 @@ void FacebookProto::ApproveContactToServer(void *data) if (data == NULL) return; - HANDLE hContact = (*(HANDLE*)data); + HCONTACT hContact = *(HCONTACT*)data; delete data; std::string post_data = "fb_dtsg=" + facy.dtsg_; @@ -310,7 +310,7 @@ void FacebookProto::CancelFriendsRequest(void *data) if (data == NULL) return; - HANDLE hContact = (*(HANDLE*)data); + HCONTACT hContact = *(HCONTACT*)data; delete data; std::string query = "phstamp=0&confirmed=1"; @@ -370,7 +370,7 @@ void FacebookProto::SendPokeWorker(void *p) } -HANDLE FacebookProto::GetAwayMsg(HANDLE hContact) +HANDLE FacebookProto::GetAwayMsg(HCONTACT hContact) { return 0; // Status messages are disabled } diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 49bb562c39..e35c52f3b9 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -120,20 +120,21 @@ void RefreshPrivacy(HWND hwnd, post_status_data *data) SendDlgItemMessage(hwnd, IDC_PRIVACY, CB_SETCURSEL, data->proto->getByte(FACEBOOK_KEY_PRIVACY_TYPE, 0), 0); } -void ClistPrepare(FacebookProto *proto, HANDLE hItem, HWND hwndList) +void ClistPrepare(FacebookProto *proto, HCONTACT hItem, HWND hwndList) { if (hItem == NULL) - hItem = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); + hItem = (HCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); while (hItem) { - HANDLE hItemN = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); + HCONTACT hItemN = (HCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); if (IsHContactGroup(hItem)) { - HANDLE hItemT = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + HCONTACT hItemT = (HCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); if (hItemT) ClistPrepare(proto, hItemT, hwndList); - } else if (IsHContactContact(hItem)) { + } + else if (IsHContactContact(hItem)) { if (!proto->IsMyContact(hItem) || ptrA(proto->getStringA(hItem, FACEBOOK_KEY_ID)) == NULL) SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0); } @@ -142,14 +143,14 @@ void ClistPrepare(FacebookProto *proto, HANDLE hItem, HWND hwndList) } } -void GetSelectedContacts(FacebookProto *proto, HANDLE hItem, HWND hwndList, std::vector *contacts) +void GetSelectedContacts(FacebookProto *proto, HCONTACT hItem, HWND hwndList, std::vector *contacts) { if (hItem == NULL) - hItem = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); + hItem = (HCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); while (hItem) { if (IsHContactGroup(hItem)) { - HANDLE hItemT = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + HCONTACT hItemT = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); if (hItemT) GetSelectedContacts(proto, hItemT, hwndList, contacts); } else { @@ -160,7 +161,7 @@ void GetSelectedContacts(FacebookProto *proto, HANDLE hItem, HWND hwndList, std: contacts->push_back(fu); } } - hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); + hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); } } diff --git a/protocols/FacebookRM/src/entities.h b/protocols/FacebookRM/src/entities.h index a924324019..6909b6d611 100644 --- a/protocols/FacebookRM/src/entities.h +++ b/protocols/FacebookRM/src/entities.h @@ -24,7 +24,7 @@ along with this program. If not, see . struct facebook_user { - HANDLE handle; + HCONTACT handle; std::string user_id; std::string real_name; @@ -164,16 +164,16 @@ struct send_chat struct send_direct { - send_direct(HANDLE hContact,const std::string &msg, HANDLE msgid) : hContact(hContact), msg(msg), msgid(msgid) {} - HANDLE hContact; + send_direct(HCONTACT hContact,const std::string &msg, HANDLE msgid) : hContact(hContact), msg(msg), msgid(msgid) {} + HCONTACT hContact; std::string msg; HANDLE msgid; }; struct send_typing { - send_typing(HANDLE hContact,const int status) : hContact(hContact), status(status) {} - HANDLE hContact; + send_typing(HCONTACT hContact,const int status) : hContact(hContact), status(status) {} + HCONTACT hContact; int status; }; diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp index 676522cc87..81c54f3fd8 100644 --- a/protocols/FacebookRM/src/events.cpp +++ b/protocols/FacebookRM/src/events.cpp @@ -22,7 +22,7 @@ along with this program. If not, see . #include "common.h" -void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD flags, std::string *url, std::string *notification_id) +void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HCONTACT contact, DWORD flags, std::string *url, std::string *notification_id) { char name[256]; diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 06118a9381..28e102b46e 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -438,7 +438,7 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa } } } else { // classic contact - HANDLE hContact = proto->ContactIDToHContact(json_as_pstring(reader)); + HCONTACT hContact = proto->ContactIDToHContact(json_as_pstring(reader)); if (hContact) { TCHAR ttime[64], tstr[100]; _tcsftime(ttime, SIZEOF(ttime), _T("%X"), utils::conversion::fbtime_to_timeinfo(json_as_float(time))); @@ -519,7 +519,7 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa } } - HANDLE hChatContact = NULL; + HCONTACT hChatContact = NULL; // RM TODO: better use check if chatroom exists/is in db/is online... no? /// e.g. HANDLE hChatContact = proto->ChatIDToHContact(thread_id); ? @@ -627,7 +627,7 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa facebook_user fbu; fbu.user_id = json_as_pstring(from); - HANDLE hContact = proto->AddToContactList(&fbu, CONTACT_FRIEND); + HCONTACT hContact = proto->AddToContactList(&fbu, CONTACT_FRIEND); if (proto->isOnline() && proto->getWord(hContact, "Status", 0) == ID_STATUS_OFFLINE) proto->setWord(hContact, "Status", ID_STATUS_ONLINE); diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index 667692a4c9..051cb9cd39 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -22,7 +22,7 @@ along with this program. If not, see . #include "common.h" -int FacebookProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) +int FacebookProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT *pre) { ForkThread(&FacebookProto::ReadMessageWorker, hContact); CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF); @@ -76,7 +76,7 @@ void FacebookProto::SendChatMsgWorker(void *p) send_chat *data = static_cast(p); std::string err_message = ""; - HANDLE hContact = ChatIDToHContact(std::tstring(_A2T(data->chat_id.c_str()))); + HCONTACT hContact = ChatIDToHContact(std::tstring(_A2T(data->chat_id.c_str()))); if (hContact) { std::string tid; DBVARIANT dbv; @@ -107,7 +107,7 @@ void FacebookProto::SendChatMsgWorker(void *p) delete data; } -int FacebookProto::SendMsg(HANDLE hContact, int flags, const char *msg) +int FacebookProto::SendMsg(HCONTACT hContact, int flags, const char *msg) { // TODO: msg comes as Unicode (retyped wchar_t*), why should we convert it as ANSI to UTF-8? o_O if (flags & PREF_UNICODE) @@ -118,7 +118,7 @@ int FacebookProto::SendMsg(HANDLE hContact, int flags, const char *msg) return facy.msgid_; } -int FacebookProto::UserIsTyping(HANDLE hContact,int type) +int FacebookProto::UserIsTyping(HCONTACT hContact,int type) { if (hContact && isOnline()) ForkThread(&FacebookProto::SendTypingWorker, new send_typing(hContact, type)); @@ -168,7 +168,7 @@ void FacebookProto::ReadMessageWorker(void *p) if (p == NULL) return; - HANDLE hContact = static_cast(p); + HCONTACT hContact = static_cast(p); if (getBool(FACEBOOK_KEY_KEEP_UNREAD, 0) || getBool(hContact, FACEBOOK_KEY_KEEP_UNREAD, 0)) return; @@ -186,7 +186,7 @@ void FacebookProto::ReadMessageWorker(void *p) facy.flap(REQUEST_MARK_READ, &data); } -void FacebookProto::ParseSmileys(std::string message, HANDLE hContact) +void FacebookProto::ParseSmileys(std::string message, HCONTACT hContact) { if (!getByte(FACEBOOK_KEY_CUSTOM_SMILEYS, DEFAULT_CUSTOM_SMILEYS)) return; diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 777ce172db..c06e9b562a 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -63,7 +63,7 @@ void FacebookProto::ProcessBuddyList(void* data) if (!fbu->deleted) { - HANDLE hContact = fbu->handle; + HCONTACT hContact = fbu->handle; if (!hContact) hContact = AddToContactList(fbu, CONTACT_FRIEND); @@ -154,7 +154,7 @@ void FacebookProto::ProcessFriendList(void* data) // Check and update old contacts - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if ( isChatRoom(hContact)) continue; @@ -243,7 +243,7 @@ void FacebookProto::ProcessFriendList(void* data) facebook_user *fbu = iter->second; if (!fbu->deleted) - HANDLE hContact = AddToContactList(fbu, CONTACT_FRIEND/*, true*/); // This contact is surely new ...am I sure? ...I'm not, so "true" is commented now + HCONTACT hContact = AddToContactList(fbu, CONTACT_FRIEND/*, true*/); // This contact is surely new ...am I sure? ...I'm not, so "true" is commented now delete fbu; } @@ -361,7 +361,7 @@ void FacebookProto::ProcessUnreadMessage(void *p) for (std::map::iterator it = chatrooms.begin(); it != chatrooms.end(); ) { facebook_chatroom *room = it->second; - HANDLE hChatContact = NULL; + HCONTACT hChatContact = NULL; if (GetChatUsers(room->thread_id.c_str()) == NULL) { AddChat(room->thread_id.c_str(), room->chat_name.c_str()); hChatContact = ChatIDToHContact(room->thread_id); @@ -397,7 +397,7 @@ void FacebookProto::ProcessUnreadMessage(void *p) fbu.real_name = messages[i]->sender_name; // TODO: optimize this? - HANDLE hContact = AddToContactList(&fbu, CONTACT_NONE); + HCONTACT hContact = AddToContactList(&fbu, CONTACT_NONE); setString(hContact, FACEBOOK_KEY_MESSAGE_ID, messages[i]->message_id.c_str()); // Save TID if not exists already @@ -486,7 +486,7 @@ void FacebookProto::ProcessMessages(void* data) fbu.user_id = messages[i]->user_id; fbu.real_name = messages[i]->sender_name; - HANDLE hContact = AddToContactList(&fbu, CONTACT_NONE); + HCONTACT hContact = AddToContactList(&fbu, CONTACT_NONE); setString(hContact, FACEBOOK_KEY_MESSAGE_ID, messages[i]->message_id.c_str()); // Save TID if not exists already @@ -627,7 +627,7 @@ void FacebookProto::ProcessFriendRequests(void*) if (fbu->user_id.length() && fbu->real_name.length()) { - HANDLE hContact = AddToContactList(fbu, CONTACT_APPROVE); + HCONTACT hContact = AddToContactList(fbu, CONTACT_APPROVE); setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_APPROVE); bool seen = false; diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index bbe948120d..5e05071dec 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -104,7 +104,7 @@ FacebookProto::~FacebookProto() ////////////////////////////////////////////////////////////////////////////// -DWORD_PTR FacebookProto::GetCaps(int type, HANDLE hContact) +DWORD_PTR FacebookProto::GetCaps(int type, HCONTACT hContact) { switch(type) { @@ -261,7 +261,7 @@ HANDLE FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr) return NULL; } - HANDLE hContact = AddToContactList(&fbu, CONTACT_NONE); + HCONTACT hContact = AddToContactList(&fbu, CONTACT_NONE); if (hContact) { if (flags & PALF_TEMPORARY) { db_set_b(hContact, "Clist", "Hidden", 1); @@ -276,7 +276,7 @@ HANDLE FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr) return hContact; } -int FacebookProto::AuthRequest(HANDLE hContact,const PROTOCHAR *message) +int FacebookProto::AuthRequest(HCONTACT hContact,const PROTOCHAR *message) { return RequestFriendship((WPARAM)hContact, NULL); } @@ -286,7 +286,7 @@ int FacebookProto::Authorize(HANDLE hDbEvent) if (!hDbEvent || isOffline()) return 1; - HANDLE hContact = HContactFromAuthEvent(hDbEvent); + HCONTACT hContact = HContactFromAuthEvent(hDbEvent); if (hContact == INVALID_HANDLE_VALUE) return 1; @@ -298,7 +298,7 @@ int FacebookProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason) if (!hDbEvent || isOffline()) return 1; - HANDLE hContact = HContactFromAuthEvent(hDbEvent); + HCONTACT hContact = HContactFromAuthEvent(hDbEvent); if (hContact == INVALID_HANDLE_VALUE) return 1; @@ -450,7 +450,7 @@ INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM lParam) if (!isOnline()) return 1; - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(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) { - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(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) { - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(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; - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(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); - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(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; - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(wParam); ptrA id(getStringA(hContact, FACEBOOK_KEY_ID)); if (id == NULL) @@ -633,7 +633,7 @@ INT_PTR FacebookProto::OnCancelFriendshipRequest(WPARAM wParam,LPARAM lParam) return 0; } -HANDLE FacebookProto::HContactFromAuthEvent(HANDLE hEvent) +HCONTACT FacebookProto::HContactFromAuthEvent(HANDLE hEvent) { DWORD body[2]; DBEVENTINFO dbei = { sizeof(dbei) }; @@ -641,13 +641,13 @@ HANDLE FacebookProto::HContactFromAuthEvent(HANDLE hEvent) dbei.pBlob = (PBYTE)&body; if (db_event_get(hEvent, &dbei)) - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; if (dbei.eventType != EVENTTYPE_AUTHREQUEST) - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; if (strcmp(dbei.szModule, m_szModuleName)) - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; return DbGetAuthEventContact(&dbei); } diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index 3d056a92c4..9b5b550253 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -54,11 +54,11 @@ public: __forceinline INT_PTR getStringUtf(const char *name, DBVARIANT *result) { return db_get_utf(NULL, m_szModuleName, name, result); } - __forceinline INT_PTR getStringUtf(HANDLE hContact, const char *name, DBVARIANT *result) { + __forceinline INT_PTR getStringUtf(HCONTACT hContact, const char *name, DBVARIANT *result) { return db_get_utf(hContact, m_szModuleName, name, result); } __forceinline void setStringUtf(const char *name, const char* value) { db_set_utf(NULL, m_szModuleName, name, value); } - __forceinline void setStringUtf(HANDLE hContact, const char *name, const char* value) { db_set_utf(hContact, m_szModuleName, name, value); } + __forceinline void setStringUtf(HCONTACT hContact, const char *name, const char* value) { db_set_utf(hContact, m_szModuleName, name, value); } //PROTO_INTERFACE @@ -67,18 +67,18 @@ public: virtual int __cdecl Authorize(HANDLE hDbEvent); virtual int __cdecl AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason); - virtual int __cdecl AuthRecv(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl AuthRequest(HANDLE hContact, const PROTOCHAR* szMessage); + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl AuthRequest(HCONTACT hContact, const PROTOCHAR* szMessage); virtual HANDLE __cdecl ChangeInfo(int iInfoType, void* pInfoData); - virtual HANDLE __cdecl FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath); - virtual int __cdecl FileCancel(HANDLE hContact, HANDLE hTransfer); - virtual int __cdecl FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason); + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath); + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer); + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason); virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** szFilename); - virtual DWORD_PTR __cdecl GetCaps(int type, HANDLE hContact = NULL); - virtual int __cdecl GetInfo(HANDLE hContact, int infoType); + virtual DWORD_PTR __cdecl GetCaps(int type, HCONTACT hContact = NULL); + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType); virtual HANDLE __cdecl SearchBasic(const PROTOCHAR* id); virtual HANDLE __cdecl SearchByEmail(const PROTOCHAR* email); @@ -86,24 +86,24 @@ public: virtual HWND __cdecl SearchAdvanced(HWND owner); virtual HWND __cdecl CreateExtendedSearchUI(HWND owner); - virtual int __cdecl RecvContacts(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl RecvFile(HANDLE hContact, PROTOFILEEVENT*); - virtual int __cdecl RecvMsg(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl RecvUrl(HANDLE hContact, PROTORECVEVENT*); + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvFile(HCONTACT hContact, PROTOFILEEVENT*); + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT*); - virtual int __cdecl SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList); - virtual HANDLE __cdecl SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles); - virtual int __cdecl SendMsg(HANDLE hContact, int flags, const char* msg); - virtual int __cdecl SendUrl(HANDLE hContact, int flags, const char* url); + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList); + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles); + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg); + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url); - virtual int __cdecl SetApparentMode(HANDLE hContact, int mode); + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode); virtual int __cdecl SetStatus(int iNewStatus); - virtual HANDLE __cdecl GetAwayMsg(HANDLE hContact); - virtual int __cdecl RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT* evt); + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact); + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt); virtual int __cdecl SetAwayMsg(int iStatus, const PROTOCHAR* msg); - virtual int __cdecl UserIsTyping(HANDLE hContact, int type); + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type); virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam); @@ -185,13 +185,13 @@ public: void __cdecl SendPokeWorker(void*); // Contacts handling - bool IsMyContact(HANDLE, bool include_chat = false); - HANDLE ContactIDToHContact(std::string); - HANDLE ChatIDToHContact(std::tstring); + bool IsMyContact(HCONTACT, bool include_chat = false); + HCONTACT ContactIDToHContact(std::string); + HCONTACT ChatIDToHContact(std::tstring); std::string ThreadIDToContactID(std::string thread_id); - HANDLE AddToContactList(facebook_user*, ContactType type, bool dont_check = false); - void SetAllContactStatuses(int status); - HANDLE HContactFromAuthEvent(HANDLE hEvent); + HCONTACT AddToContactList(facebook_user*, ContactType type, bool dont_check = false); + void SetAllContactStatuses(int status); + HCONTACT HContactFromAuthEvent(HANDLE hEvent); // Chats handling void AddChat(const TCHAR *id, const TCHAR *name); @@ -209,11 +209,11 @@ public: // Helpers std::tstring GetAvatarFolder(); bool GetDbAvatarInfo(PROTO_AVATAR_INFORMATIONT &ai, std::string *url); - void CheckAvatarChange(HANDLE hContact, std::string image_url); + void CheckAvatarChange(HCONTACT hContact, std::string image_url); void ToggleStatusMenuItems(BOOL bEnable); - void ParseSmileys(std::string message, HANDLE hContact); + void ParseSmileys(std::string message, HCONTACT hContact); void OpenUrl(std::string url); - void SaveName(HANDLE hContact, const facebook_user *fbu); + void SaveName(HCONTACT hContact, const facebook_user *fbu); // Handles, Locks HGENMENU m_hMenuRoot, m_hMenuServicesRoot, m_hStatusMind; @@ -227,10 +227,10 @@ public: std::string last_status_msg_; HANDLE hSmileysFolder_; - std::vector avatar_queue; + std::vector avatar_queue; static void CALLBACK APC_callback(ULONG_PTR p); // Information providing - void NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD flags, std::string *url = NULL, std::string *notification_id = NULL); + void NotifyEvent(TCHAR* title, TCHAR* info, HCONTACT contact, DWORD flags, std::string *url = NULL, std::string *notification_id = NULL); }; diff --git a/protocols/FacebookRM/src/stubs.cpp b/protocols/FacebookRM/src/stubs.cpp index 1689b89f3f..34412fe8b3 100644 --- a/protocols/FacebookRM/src/stubs.cpp +++ b/protocols/FacebookRM/src/stubs.cpp @@ -27,7 +27,7 @@ HANDLE FacebookProto::AddToListByEvent(int flags,int iContact,HANDLE hDbEvent) return NULL; } -int FacebookProto::AuthRecv(HANDLE hContact,PROTORECVEVENT *) +int FacebookProto::AuthRecv(HCONTACT hContact,PROTORECVEVENT *) { return 1; } @@ -38,17 +38,17 @@ HANDLE FacebookProto::ChangeInfo(int type,void *info_data) return NULL; } -HANDLE FacebookProto::FileAllow(HANDLE hContact,HANDLE hTransfer,const PROTOCHAR *path) +HANDLE FacebookProto::FileAllow(HCONTACT hContact,HANDLE hTransfer,const PROTOCHAR *path) { return NULL; } -int FacebookProto::FileCancel(HANDLE hContact,HANDLE hTransfer) +int FacebookProto::FileCancel(HCONTACT hContact,HANDLE hTransfer) { return 1; } -int FacebookProto::FileDeny(HANDLE hContact,HANDLE hTransfer,const PROTOCHAR *reason) +int FacebookProto::FileDeny(HCONTACT hContact,HANDLE hTransfer,const PROTOCHAR *reason) { return 1; } @@ -58,7 +58,7 @@ int FacebookProto::FileResume(HANDLE hTransfer,int *action,const PROTOCHAR **fil return 1; } -int FacebookProto::GetInfo(HANDLE hContact, int infoType) +int FacebookProto::GetInfo(HCONTACT hContact, int infoType) { // TODO: Most probably some ProtoAck should be here instead return 1; @@ -74,42 +74,42 @@ HWND FacebookProto::CreateExtendedSearchUI(HWND owner) return NULL; } -int FacebookProto::RecvContacts(HANDLE hContact,PROTORECVEVENT *) +int FacebookProto::RecvContacts(HCONTACT hContact,PROTORECVEVENT *) { return 1; } -int FacebookProto::RecvFile(HANDLE hContact,PROTORECVFILET *) +int FacebookProto::RecvFile(HCONTACT hContact,PROTORECVFILET *) { return 1; } -int FacebookProto::RecvUrl(HANDLE hContact,PROTORECVEVENT *) +int FacebookProto::RecvUrl(HCONTACT hContact,PROTORECVEVENT *) { return 1; } -int FacebookProto::SendContacts(HANDLE hContact,int flags,int nContacts,HANDLE *hContactsList) +int FacebookProto::SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) { return 1; } -HANDLE FacebookProto::SendFile(HANDLE hContact,const PROTOCHAR *desc, PROTOCHAR **files) +HANDLE FacebookProto::SendFile(HCONTACT hContact,const PROTOCHAR *desc, PROTOCHAR **files) { return NULL; } -int FacebookProto::SendUrl(HANDLE hContact,int flags,const char *url) +int FacebookProto::SendUrl(HCONTACT hContact,int flags,const char *url) { return 1; } -int FacebookProto::SetApparentMode(HANDLE hContact,int mode) +int FacebookProto::SetApparentMode(HCONTACT hContact,int mode) { return 1; } -int FacebookProto::RecvAwayMsg(HANDLE hContact,int mode,PROTORECVEVENT *evt) +int FacebookProto::RecvAwayMsg(HCONTACT hContact,int mode,PROTORECVEVENT *evt) { return 1; } diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index 6177f46b96..e0b7fd134e 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -53,7 +53,7 @@ HANDLE GetIconHandle(const char* name) HGENMENU g_hContactMenuItems[CMITEMS_COUNT]; // Helper functions -static FacebookProto * GetInstanceByHContact(HANDLE hContact) +static FacebookProto * GetInstanceByHContact(HCONTACT hContact) { char *proto = GetContactProto(hContact); if(!proto) @@ -69,7 +69,7 @@ static FacebookProto * GetInstanceByHContact(HANDLE hContact) template INT_PTR GlobalService(WPARAM wParam,LPARAM lParam) { - FacebookProto *proto = GetInstanceByHContact(reinterpret_cast(wParam)); + FacebookProto *proto = GetInstanceByHContact(reinterpret_cast(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(reinterpret_cast(wParam)); return proto ? proto->OnPrebuildContactMenu(wParam,lParam) : 0; } @@ -152,7 +152,7 @@ void UninitContactMenus() int FacebookProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(wParam); bool bIsChatroom = isChatRoom(hContact); Menu_ShowItem(g_hContactMenuItems[CMI_VISIT_PROFILE], true); diff --git a/protocols/GTalkExt/src/avatar.cpp b/protocols/GTalkExt/src/avatar.cpp index 74359484f9..744b990e96 100644 --- a/protocols/GTalkExt/src/avatar.cpp +++ b/protocols/GTalkExt/src/avatar.cpp @@ -84,7 +84,7 @@ BOOL SaveAvatar(HANDLE hFile) struct AVACHANGED { HANDLE hTimer; - HANDLE hContact; + HCONTACT hContact; }; VOID CALLBACK CallSetAvatar(PVOID lpParameter, BOOLEAN TimerOrWaitFired) @@ -107,11 +107,11 @@ VOID CALLBACK CallSetAvatar(PVOID lpParameter, BOOLEAN TimerOrWaitFired) int AvaChanged(WPARAM wParam, LPARAM lParam) { - if (!lParam && db_get_b((HANDLE)wParam, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) { + if (!lParam && db_get_b((HCONTACT)wParam, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) { BOOL enqueued = FALSE; AVACHANGED *ach = (AVACHANGED*)malloc(sizeof(AVACHANGED)); __try { - ach->hContact = (HANDLE)wParam; + ach->hContact = (HCONTACT)wParam; enqueued = CreateTimerQueueTimer(&ach->hTimer, NULL, CallSetAvatar, ach, SET_AVATAR_INTERVAL, 0, WT_EXECUTEONLYONCE); } __finally { @@ -146,7 +146,7 @@ BOOL InitAvaUnit(BOOL init) } } -void SetAvatar(HANDLE hContact) +void SetAvatar(HCONTACT hContact) { mir_cslock lck(g_csSetAvatar); diff --git a/protocols/GTalkExt/src/db.cpp b/protocols/GTalkExt/src/db.cpp index a652babe49..661bce4409 100644 --- a/protocols/GTalkExt/src/db.cpp +++ b/protocols/GTalkExt/src/db.cpp @@ -42,7 +42,7 @@ void RenewPseudocontactHandles() db_unset(0, protos[i]->szModuleName, "GMailExtNotifyContact"); // remove this } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (db_get_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) { LPCSTR proto = (LPCSTR)GetContactProto(hContact); db_set_dw(NULL, proto, PSEUDOCONTACT_LINK, (DWORD)hContact); diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index 4643a26275..087a38e2aa 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -426,7 +426,7 @@ int OnExtListInit(WPARAM wParam, LPARAM lParam) int OnFilterPopup(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if ( !db_get_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) return 0; diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index 30321de558..4e66154ac0 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -42,7 +42,7 @@ struct POPUP_DATA_HEADER { BOOL MarkRead; HANDLE hDbEvent; - HANDLE hContact; + HCONTACT hContact; LPTSTR jid; LPTSTR url; }; @@ -65,7 +65,7 @@ LPCSTR GetJidAcc(LPCTSTR jid) return NULL; } -void MarkEventRead(HANDLE hCnt, HANDLE hEvt) +void MarkEventRead(HCONTACT hCnt, HANDLE hEvt) { DWORD settings = (DWORD)TlsGetValue(itlsSettings); if ( ReadCheckbox(0, IDC_POPUPSENABLED, settings) && @@ -77,7 +77,7 @@ void MarkEventRead(HANDLE hCnt, HANDLE hEvt) int OnEventDeleted(WPARAM hContact, LPARAM hDbEvent, LPARAM wnd) { - if (db_get_b((HANDLE)hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) { + if (db_get_b((HCONTACT)hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) { CallService(MS_CLIST_REMOVEEVENT, hContact, hDbEvent); PostMessage((HWND)wnd, EVENT_DELETED_MSG, hContact, hDbEvent); } @@ -166,11 +166,11 @@ void FormatPseudocontactDisplayName(LPTSTR buff, LPCTSTR jid, LPCTSTR unreadCoun wsprintf(buff, _T("%s"), jid); //!!!!!!!!!!! } -HANDLE SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTSTR displayName) +HCONTACT SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTSTR displayName) { - HANDLE result = (HANDLE)db_get_dw(NULL, acc, PSEUDOCONTACT_LINK, 0); + HCONTACT result = (HCONTACT)db_get_dw(NULL, acc, PSEUDOCONTACT_LINK, 0); if (!result || !db_get_b(result, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) { - result = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + result = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); db_set_dw(0, acc, PSEUDOCONTACT_LINK, (DWORD)result); db_set_b(result, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 1); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)result, (LPARAM)acc); @@ -191,7 +191,7 @@ HANDLE SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTSTR return result; } -HANDLE AddCListNotification(HANDLE hContact, LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount) +HANDLE AddCListNotification(HCONTACT hContact, LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount) { mir_ptr szUrl( mir_utf8encodeT(url)), szText( mir_utf8encodeT(data->lptzText)); @@ -216,7 +216,7 @@ BOOL UsePopups() void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount) { - HANDLE hCnt = SetupPseudocontact(jid, unreadCount, acc, &data->lptzContactName[0]); + HCONTACT hCnt = SetupPseudocontact(jid, unreadCount, acc, &data->lptzContactName[0]); HANDLE hEvt = ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, (DWORD)TlsGetValue(itlsSettings)) ? AddCListNotification(hCnt, acc, data, jid, url, unreadCount) : NULL; @@ -287,7 +287,7 @@ void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unre void ClearNotificationContactHistory(LPCSTR acc) { - HANDLE hContact = (HANDLE)db_get_dw(NULL, acc, PSEUDOCONTACT_LINK, 0); + HCONTACT hContact = (HCONTACT)db_get_dw(NULL, acc, PSEUDOCONTACT_LINK, 0); if (!hContact || !db_get_b(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) return; diff --git a/protocols/GTalkExt/src/notifications.h b/protocols/GTalkExt/src/notifications.h index 456cb3d366..43de74607d 100644 --- a/protocols/GTalkExt/src/notifications.h +++ b/protocols/GTalkExt/src/notifications.h @@ -40,5 +40,5 @@ void UnreadMailNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unread void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount, const MAIL_THREAD_NOTIFICATION *mtn); void CloseNotifications(LPCSTR acc, LPCTSTR url, LPCTSTR jid, BOOL PopupsOnly); DWORD ReadNotificationSettings(LPCSTR acc); -HANDLE SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTSTR displayName = NULL); +HCONTACT SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTSTR displayName = NULL); LPCSTR GetJidAcc(LPCTSTR jid); \ No newline at end of file diff --git a/protocols/GTalkExt/src/stdafx.h b/protocols/GTalkExt/src/stdafx.h index 7e8bc5669b..fd47c8a964 100644 --- a/protocols/GTalkExt/src/stdafx.h +++ b/protocols/GTalkExt/src/stdafx.h @@ -72,5 +72,5 @@ extern HINSTANCE g_hInst; extern LIST g_accs; -void SetAvatar(HANDLE hContact); +void SetAvatar(HCONTACT hContact); BOOL InitAvaUnit(BOOL init); diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index e97d3a319f..6cadef414a 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -26,7 +26,7 @@ ////////////////////////////////////////////////////////// // Avatars support -void GGPROTO::getAvatarFilename(HANDLE hContact, TCHAR *pszDest, int cbLen) +void GGPROTO::getAvatarFilename(HCONTACT hContact, TCHAR *pszDest, int cbLen) { int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST( _T("%miranda_avatarcache%")), m_szModuleName); @@ -142,7 +142,7 @@ char *gg_avatarhash(char *param) return bin2hex(digest, sizeof(digest), result); } -void GGPROTO::requestAvatarTransfer(HANDLE hContact, char *szAvatarURL) +void GGPROTO::requestAvatarTransfer(HCONTACT hContact, char *szAvatarURL) { if (pth_avatar.dwThreadId == NULL) { debugLogA("requestAvatarTransfer(): Can not list_add element to avatar_transfers list. No pth_avatar.dwThreadId"); @@ -159,7 +159,7 @@ void GGPROTO::requestAvatarTransfer(HANDLE hContact, char *szAvatarURL) gg_LeaveCriticalSection(&avatar_mutex, "requestAvatarTransfer", 1, 1, "avatar_mutex", 1); } -void GGPROTO::requestAvatarInfo(HANDLE hContact, int iWaitFor) +void GGPROTO::requestAvatarInfo(HCONTACT hContact, int iWaitFor) { if (pth_avatar.dwThreadId == NULL) { debugLogA("requestAvatarInfo(): Can not list_add element to avatar_requests list. No pth_avatar.dwThreadId"); @@ -192,7 +192,7 @@ void __cdecl GGPROTO::avatarrequestthread(void*) if (avatar_requests.getCount()) { GGREQUESTAVATARDATA *data = avatar_requests[0]; int iWaitFor = data->iWaitFor; - HANDLE hContact = data->hContact; + HCONTACT hContact = data->hContact; avatar_requests.remove(0); mir_free(data); gg_LeaveCriticalSection(&avatar_mutex, "avatarrequestthread", 3, 1, "avatar_mutex", 1); diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 938e1dead2..562468c5e9 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -628,7 +628,7 @@ retry: const char *__status = gg_pubdir50_get(res, i, GG_PUBDIR50_STATUS); uin_t uin = __fmnumber ? atoi(__fmnumber) : 0; - HANDLE hContact = (res->seq == GG_SEQ_CHINFO) ? NULL : getcontact(uin, 0, 0, NULL); + HCONTACT hContact = (res->seq == GG_SEQ_CHINFO) ? NULL : getcontact(uin, 0, 0, NULL); debugLogA("mainthread() (%x): Search result for uin %d, seq %d.", this, uin, res->seq); if (res->seq == GG_SEQ_SEARCH) { @@ -766,7 +766,7 @@ retry: // Status (version >= 6.0) case GG_EVENT_STATUS60: { - HANDLE hContact = getcontact(e->event.status60.uin, 0, 0, NULL); + HCONTACT hContact = getcontact(e->event.status60.uin, 0, 0, NULL); int oldstatus = getWord(hContact, GG_KEY_STATUS, (WORD)ID_STATUS_OFFLINE); uin_t uin = (uin_t)getDword(GG_KEY_UIN, 0); @@ -991,7 +991,7 @@ retry: // Get rid of empty image if (e->event.image_reply.size && e->event.image_reply.image) { - HANDLE hContact = getcontact(e->event.image_reply.sender, 1, 0, NULL); + HCONTACT hContact = getcontact(e->event.image_reply.sender, 1, 0, NULL); void *img = (void *)img_loadpicture(e, 0); if (!img) @@ -1064,7 +1064,7 @@ retry: pre.tszDescription = filenameT; pre.ptszFiles = &filenameT; pre.lParam = (LPARAM)dcc7; - ProtoChainRecvFile(dcc7->contact, &pre); + ProtoChainRecvFile((HCONTACT)dcc7->contact, &pre); mir_free(filenameT); e->event.dcc7_new = NULL; @@ -1078,7 +1078,7 @@ retry: if (dcc7->type == GG_SESSION_DCC7_SEND) { debugLogA("mainthread() (%x): File transfer denied by client %d (reason = %d).", this, dcc7->peer_uin, e->event.dcc7_reject.reason); - ProtoBroadcastAck(dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0); + ProtoBroadcastAck((HCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0); // Remove from watches and free gg_EnterCriticalSection(&ft_mutex, "mainthread", 21, "ft_mutex", 1); @@ -1139,7 +1139,7 @@ retry: } if (dcc7->contact) - ProtoBroadcastAck(dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); + ProtoBroadcastAck((HCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); // Free dcc gg_dcc7_free(dcc7); @@ -1186,7 +1186,7 @@ retry: case GG_EVENT_TYPING_NOTIFICATION: { - HANDLE hContact = getcontact(e->event.typing_notification.uin, 0, 0, NULL); + HCONTACT hContact = getcontact(e->event.typing_notification.uin, 0, 0, NULL); #ifdef DEBUGMODE debugLogA("mainthread() (%x): Typing notification from %d (%d).", this, e->event.typing_notification.uin, e->event.typing_notification.length); @@ -1272,7 +1272,7 @@ void GGPROTO::broadcastnewstatus(int newStatus) // When contact is deleted int GGPROTO::contactdeleted(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT)wParam; uin_t uin = (uin_t)getDword(hContact, GG_KEY_UIN, 0); // Terminate conference if contact is deleted @@ -1327,7 +1327,7 @@ static TCHAR* sttSettingToTchar( DBVARIANT* value ) int GGPROTO::dbsettingchanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT)wParam; char *szProto = NULL; debugLogA("dbsettingchanged(): fired. szModule=%s szSetting=%s", cws->szModule, cws->szSetting); @@ -1411,7 +1411,7 @@ void GGPROTO::setalloffline() debugLogA("setalloffline(): started. Setting buddies offline"); setWord(GG_KEY_STATUS, ID_STATUS_OFFLINE); - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { setWord(hContact, GG_KEY_STATUS, ID_STATUS_OFFLINE); // Clear IP and port settings delSetting(hContact, GG_KEY_CLIENTIP); @@ -1427,7 +1427,7 @@ void GGPROTO::setalloffline() //////////////////////////////////////////////////////////// // All users set offline -void GGPROTO::notifyuser(HANDLE hContact, int refresh) +void GGPROTO::notifyuser(HCONTACT hContact, int refresh) { uin_t uin; if (!hContact) return; @@ -1469,7 +1469,7 @@ void GGPROTO::notifyuser(HANDLE hContact, int refresh) void GGPROTO::notifyall() { - HANDLE hContact; + HCONTACT hContact; int count = 0, cc = 0; uin_t *uins; char *types; @@ -1522,13 +1522,13 @@ void GGPROTO::notifyall() //////////////////////////////////////////////////////////// // Get contact by uin -HANDLE GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick) +HCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick) { #ifdef DEBUGMODE debugLogA("getcontact(): uin=%d create=%d inlist=%d", uin, create, inlist); #endif // Look for contact in DB - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if ((uin_t)getDword(hContact, GG_KEY_UIN, 0) == uin && !isChatRoom(hContact)) { if (inlist) { db_unset(hContact, "CList", "NotOnList"); @@ -1540,7 +1540,7 @@ HANDLE GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick) if (!create) return NULL; - HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); + HCONTACT hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if (!hContact) { debugLog(_T("getcontact(): Failed to create Gadu-Gadu contact %s"), szNick); return NULL; @@ -1698,7 +1698,7 @@ void GGPROTO::changecontactstatus(uin_t uin, int status, const TCHAR *idescr, in #ifdef DEBUGMODE debugLogA("changecontactstatus(): uin=%d status=%d", uin, status); #endif - HANDLE hContact = getcontact(uin, 0, 0, NULL); + HCONTACT hContact = getcontact(uin, 0, 0, NULL); // Check if contact is on list if (!hContact) return; diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index 2e9093015c..e0f39d35dc 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -38,7 +38,7 @@ extern INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam #define SVS_TIMEZONE 7 #define SVS_GGVERSION 9 -static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, char *szSetting, int special, int disableIfUndef) +static void SetValue(HWND hwndDlg, int idCtrl, HCONTACT hContact, char *szModule, char *szSetting, int special, int disableIfUndef) { DBVARIANT dbv = {0}; TCHAR str[256]; @@ -688,7 +688,7 @@ static INT_PTR CALLBACK gg_advoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, struct GGDETAILSDLGDATA { GGPROTO *gg; - HANDLE hContact; + HCONTACT hContact; int disableUpdate; int updating; }; @@ -704,7 +704,7 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, TranslateDialogDefault(hwndDlg); dat = (struct GGDETAILSDLGDATA *)mir_alloc(sizeof(struct GGDETAILSDLGDATA)); - dat->hContact=(HANDLE)lParam; + dat->hContact = (HCONTACT)lParam; dat->disableUpdate = FALSE; dat->updating = FALSE; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); @@ -728,7 +728,7 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, case PSN_INFOCHANGED: { char *szProto; - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; GGPROTO *gg = dat->gg; // Show updated message @@ -902,7 +902,7 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, int GGPROTO::details_init(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)lParam; + HCONTACT hContact = (HCONTACT)lParam; char* pszTemplate; if (hContact == NULL){ diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 761b5a7747..38a38bf22c 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -60,7 +60,7 @@ void GGPROTO::dccstart() void GGPROTO::dccconnect(uin_t uin) { struct gg_dcc *local_dcc; - HANDLE hContact = getcontact(uin, 0, 0, NULL); + HCONTACT hContact = getcontact(uin, 0, 0, NULL); DWORD ip, myuin; WORD port; debugLogA("dccconnect(): Connecting to uin %d.", uin); @@ -89,7 +89,7 @@ void GGPROTO::dccconnect(uin_t uin) // THREAD: File transfer fail struct ftfaildata { - HANDLE hContact; + HCONTACT hContact; HANDLE hProcess; }; @@ -103,7 +103,7 @@ void __cdecl GGPROTO::ftfailthread(void *param) debugLogA("ftfailthread(): end."); } -HANDLE ftfail(GGPROTO *gg, HANDLE hContact) +HANDLE ftfail(GGPROTO *gg, HCONTACT hContact) { ftfaildata *ft = (ftfaildata*)malloc(sizeof(struct ftfaildata)); #ifdef DEBUGMODE @@ -273,7 +273,7 @@ void __cdecl GGPROTO::dccmainthread(void*) strncat(filename, (char*)local_dcc->file_info.filename, sizeof(filename) - strlen(filename)); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); - pfts.hContact = (HANDLE)local_dcc->contact; + pfts.hContact = (HCONTACT)local_dcc->contact; pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND); pfts.pszFiles = NULL; pfts.totalFiles = 1; @@ -286,7 +286,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.currentFileProgress = local_dcc->offset; pfts.currentFileTime = 0; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 3, "ft_mutex", 1); - ProtoBroadcastAck(local_dcc->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc, (LPARAM)&pfts); + ProtoBroadcastAck((HCONTACT)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc, (LPARAM)&pfts); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } break; @@ -304,7 +304,7 @@ void __cdecl GGPROTO::dccmainthread(void*) strncat(filename, (char*)local_dcc->file_info.filename, sizeof(filename) - strlen(filename)); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); - pfts.hContact = (HANDLE)local_dcc->contact; + pfts.hContact = (HCONTACT)local_dcc->contact; pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND); pfts.pszFiles = NULL; pfts.totalFiles = 1; @@ -317,11 +317,11 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.currentFileProgress = local_dcc->file_info.size; pfts.currentFileTime = 0; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 4, "ft_mutex", 1); - ProtoBroadcastAck(local_dcc->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc, (LPARAM)&pfts); + ProtoBroadcastAck((HCONTACT)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc, (LPARAM)&pfts); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); _close(local_dcc->file_fd); local_dcc->file_fd = -1; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 5, "ft_mutex", 1); - ProtoBroadcastAck(local_dcc->contact, ACKTYPE_FILE, ACKRESULT_SUCCESS, local_dcc, 0); + ProtoBroadcastAck((HCONTACT)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_SUCCESS, local_dcc, 0); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } // Free dcc @@ -361,7 +361,7 @@ void __cdecl GGPROTO::dccmainthread(void*) { _close(local_dcc->file_fd); local_dcc->file_fd = -1; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 6, "ft_mutex", 1); - ProtoBroadcastAck(local_dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, local_dcc, 0); + ProtoBroadcastAck((HCONTACT)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, local_dcc, 0); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } // Free dcc @@ -393,7 +393,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pre.lParam = (LPARAM)local_dcc; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 7, "ft_mutex", 1); - ProtoChainRecvFile(local_dcc->contact, &pre); + ProtoChainRecvFile((HCONTACT)local_dcc->contact, &pre); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); mir_free(filenameT); @@ -503,7 +503,7 @@ void __cdecl GGPROTO::dccmainthread(void*) strncat(filename, (char*)local_dcc7->filename, sizeof(filename) - strlen(filename)); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); - pfts.hContact = (HANDLE)local_dcc7->contact; + pfts.hContact = (HCONTACT)local_dcc7->contact; pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND); pfts.pszFiles = NULL; pfts.totalFiles = 1; @@ -516,7 +516,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.currentFileProgress = local_dcc7->offset; pfts.currentFileTime = 0; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 9, "ft_mutex", 1); - ProtoBroadcastAck(local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc7, (LPARAM)&pfts); + ProtoBroadcastAck((HCONTACT)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc7, (LPARAM)&pfts); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } break; @@ -534,7 +534,7 @@ void __cdecl GGPROTO::dccmainthread(void*) strncat(filename, (char*)local_dcc7->filename, sizeof(filename) - strlen(filename)); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); - pfts.hContact = (HANDLE)local_dcc7->contact; + pfts.hContact = (HCONTACT)local_dcc7->contact; pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND); pfts.pszFiles = NULL; pfts.totalFiles = 1; @@ -547,11 +547,11 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.currentFileProgress = local_dcc7->size; pfts.currentFileTime = 0; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 10, "ft_mutex", 1); - ProtoBroadcastAck(local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc7, (LPARAM)&pfts); + ProtoBroadcastAck((HCONTACT)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc7, (LPARAM)&pfts); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); _close(local_dcc7->file_fd); local_dcc7->file_fd = -1; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 11, "ft_mutex", 1); - ProtoBroadcastAck(local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_SUCCESS, local_dcc7, 0); + ProtoBroadcastAck((HCONTACT)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_SUCCESS, local_dcc7, 0); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } // Free dcc @@ -595,7 +595,7 @@ void __cdecl GGPROTO::dccmainthread(void*) if (local_dcc7->contact) { gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 12, "ft_mutex", 1); - ProtoBroadcastAck(local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, local_dcc7, 0); + ProtoBroadcastAck((HCONTACT)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, local_dcc7, 0); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } @@ -684,7 +684,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const PROTOCHAR* szPath) TCHAR error[512]; mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc)\n%s"), errno, _tcserror(errno), szPath); showpopup(m_tszUserName, error, GG_POPUP_ERROR); - ProtoBroadcastAck(dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); + ProtoBroadcastAck((HCONTACT)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); // Free transfer gg_free_dcc(dcc); return 0; @@ -722,7 +722,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const PROTOCHAR* szPath) if (iFtRemoveRes == -1) { debugLogA("dcc7fileallow(): File transfer denied."); - ProtoBroadcastAck(dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0); + ProtoBroadcastAck((HCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0); // Free transfer gg_dcc7_free(dcc7); return 0; @@ -736,7 +736,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const PROTOCHAR* szPath) mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc7)\n%s"), errno, _tcserror(errno), szPath); showpopup(m_tszUserName, error, GG_POPUP_ERROR); gg_dcc7_reject(dcc7, GG_DCC7_REJECT_USER); - ProtoBroadcastAck(dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); + ProtoBroadcastAck((HCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); // Free transfer gg_dcc7_free(dcc7); return 0; @@ -807,7 +807,7 @@ int GGPROTO::dccfilecancel(HANDLE hTransfer) gg_LeaveCriticalSection(&ft_mutex, "dccfilecancel", 44, 1, "ft_mutex", 1); // Send failed info - ProtoBroadcastAck(dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); + ProtoBroadcastAck((HCONTACT)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); // Close file if (dcc->file_fd != -1) { @@ -837,7 +837,7 @@ int GGPROTO::dcc7filecancel(HANDLE hTransfer) gg_LeaveCriticalSection(&ft_mutex, "dcc7filecancel", 45, 1, "ft_mutex", 1); // Send failed info - ProtoBroadcastAck(dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); + ProtoBroadcastAck((HCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); // Close file if (dcc7->file_fd != -1) { @@ -856,7 +856,7 @@ int GGPROTO::dcc7filecancel(HANDLE hTransfer) //////////////////////////////////////////////////////////// // File receiving allowed -HANDLE GGPROTO::FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath) +HANDLE GGPROTO::FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath) { // Check if its proper dcc struct gg_common *c = (struct gg_common *) hTransfer; @@ -872,7 +872,7 @@ HANDLE GGPROTO::FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* sz //////////////////////////////////////////////////////////// // File transfer canceled -int GGPROTO::FileCancel(HANDLE hContact, HANDLE hTransfer) +int GGPROTO::FileCancel(HCONTACT hContact, HANDLE hTransfer) { // Check if its proper dcc struct gg_common *c = (struct gg_common *) hTransfer; @@ -888,7 +888,7 @@ int GGPROTO::FileCancel(HANDLE hContact, HANDLE hTransfer) //////////////////////////////////////////////////////////// // File receiving denied -int GGPROTO::FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason) +int GGPROTO::FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason) { // Check if its proper dcc struct gg_common *c = (struct gg_common *) hTransfer; @@ -904,7 +904,7 @@ int GGPROTO::FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReas //////////////////////////////////////////////////////////// // Called when received an file -int GGPROTO::RecvFile(HANDLE hContact, PROTOFILEEVENT* pre) +int GGPROTO::RecvFile(HCONTACT hContact, PROTOFILEEVENT* pre) { return Proto_RecvFile(hContact, pre); } @@ -912,7 +912,7 @@ int GGPROTO::RecvFile(HANDLE hContact, PROTOFILEEVENT* pre) //////////////////////////////////////////////////////////// // Called when user sends a file -HANDLE GGPROTO::SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) +HANDLE GGPROTO::SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) { char *bslash, *filename; struct gg_dcc *dcc; diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 674ebe146d..2945c3c96c 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -196,7 +196,7 @@ static int gg_modulesloaded(WPARAM wParam, LPARAM lParam) ////////////////////////////////////////////////////////// // Gets protocol instance associated with a contact -static GGPROTO* gg_getprotoinstance(HANDLE hContact) +static GGPROTO* gg_getprotoinstance(HCONTACT hContact) { char* szProto = GetContactProto(hContact); if (szProto == NULL) @@ -213,7 +213,7 @@ static GGPROTO* gg_getprotoinstance(HANDLE hContact) // Handles PrebuildContactMenu event static int gg_prebuildcontactmenu(WPARAM wParam, LPARAM lParam) { - const HANDLE hContact = (HANDLE)wParam; + const HCONTACT hContact = (HCONTACT)wParam; GGPROTO* gg = gg_getprotoinstance(hContact); if (gg == NULL) return 0; @@ -232,7 +232,7 @@ static int gg_prebuildcontactmenu(WPARAM wParam, LPARAM lParam) // Contact block service function INT_PTR GGPROTO::blockuser(WPARAM wParam, LPARAM lParam) { - const HANDLE hContact = (HANDLE)wParam; + const HCONTACT hContact = (HCONTACT)wParam; setByte(hContact, GG_KEY_BLOCK, !getByte(hContact, GG_KEY_BLOCK, 0)); notifyuser(hContact, 1); return 0; diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h index 2acf921ec1..d5babd7e52 100644 --- a/protocols/Gadu-Gadu/src/gg.h +++ b/protocols/Gadu-Gadu/src/gg.h @@ -122,13 +122,13 @@ typedef struct struct GGREQUESTAVATARDATA { - HANDLE hContact; + HCONTACT hContact; int iWaitFor; }; struct GGGETAVATARDATA { - HANDLE hContact; + HCONTACT hContact; char *szAvatarURL; }; diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 69b3afc0f9..24e8c40aa8 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -127,16 +127,16 @@ GGPROTO::~GGPROTO() HANDLE GGPROTO::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) { return NULL; } int GGPROTO::Authorize(HANDLE hDbEvent) { return 1; } int GGPROTO::AuthDeny(HANDLE hDbEvent, const TCHAR *szReason) { return 1; } -int GGPROTO::AuthRecv(HANDLE hContact, PROTORECVEVENT *pre) { return 1; } -int GGPROTO::AuthRequest(HANDLE hContact, const TCHAR *szMessage) { return 1; } +int GGPROTO::AuthRecv(HCONTACT hContact, PROTORECVEVENT *pre) { return 1; } +int GGPROTO::AuthRequest(HCONTACT hContact, const TCHAR *szMessage) { return 1; } HANDLE GGPROTO::ChangeInfo(int iInfoType, void *pInfoData) { return NULL; } int GGPROTO::FileResume(HANDLE hTransfer, int *action, const PROTOCHAR** szFilename) { return 1; } HANDLE GGPROTO::SearchByEmail(const PROTOCHAR *email) { return NULL; } -int GGPROTO::RecvContacts(HANDLE hContact, PROTORECVEVENT *pre) { return 1; } -int GGPROTO::RecvUrl(HANDLE hContact, PROTORECVEVENT *pre) { return 1; } -int GGPROTO::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE *hContactsList) { return 1; } -int GGPROTO::SendUrl(HANDLE hContact, int flags, const char *url) { return 1; } -int GGPROTO::RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT *evt) { return 1; } +int GGPROTO::RecvContacts(HCONTACT hContact, PROTORECVEVENT *pre) { return 1; } +int GGPROTO::RecvUrl(HCONTACT hContact, PROTORECVEVENT *pre) { return 1; } +int GGPROTO::SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) { return 1; } +int GGPROTO::SendUrl(HCONTACT hContact, int flags, const char *url) { return 1; } +int GGPROTO::RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT *evt) { return 1; } ////////////////////////////////////////////////////////// // when contact is added to list @@ -160,7 +160,7 @@ HANDLE GGPROTO::AddToList(int flags, PROTOSEARCHRESULT *psr) ////////////////////////////////////////////////////////// // checks proto capabilities -DWORD_PTR GGPROTO::GetCaps(int type, HANDLE hContact) +DWORD_PTR GGPROTO::GetCaps(int type, HCONTACT hContact) { switch (type) { case PFLAGNUM_1: @@ -190,11 +190,11 @@ void __cdecl GGPROTO::cmdgetinfothread(void *hContact) { debugLogA("cmdgetinfothread(): started. Failed info retreival."); gg_sleep(100, FALSE, "cmdgetinfothread", 103, 1); - ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE) 1, 0); + ProtoBroadcastAck((HCONTACT)hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)1, 0); debugLogA("cmdgetinfothread(): end."); } -int GGPROTO::GetInfo(HANDLE hContact, int infoType) +int GGPROTO::GetInfo(HCONTACT hContact, int infoType) { gg_pubdir50_t req; @@ -570,7 +570,7 @@ HWND GGPROTO::CreateExtendedSearchUI(HWND owner) ////////////////////////////////////////////////////////// // when messsage received -int GGPROTO::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) +int GGPROTO::RecvMsg(HCONTACT hContact, PROTORECVEVENT *pre) { return Proto_RecvMessage(hContact, pre); } @@ -580,7 +580,7 @@ int GGPROTO::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) typedef struct { - HANDLE hContact; + HCONTACT hContact; int seq; } GG_SEQ_ACK; @@ -592,7 +592,7 @@ void __cdecl GGPROTO::sendackthread(void *ack) mir_free(ack); } -int GGPROTO::SendMsg(HANDLE hContact, int flags, const char *msg) +int GGPROTO::SendMsg(HCONTACT hContact, int flags, const char *msg) { uin_t uin = (uin_t)getDword(hContact, GG_KEY_UIN, 0); if (!isonline() || !uin) @@ -633,7 +633,7 @@ int GGPROTO::SendMsg(HANDLE hContact, int flags, const char *msg) ////////////////////////////////////////////////////////// // visible lists -int GGPROTO::SetApparentMode(HANDLE hContact, int mode) +int GGPROTO::SetApparentMode(HCONTACT hContact, int mode) { setWord(hContact, GG_KEY_APPARENT, (WORD)mode); notifyuser(hContact, 1); @@ -670,18 +670,18 @@ void __cdecl GGPROTO::getawaymsgthread(void *hContact) debugLogA("getawaymsgthread(): started"); gg_sleep(100, FALSE, "getawaymsgthread", 106, 1); - if (!db_get_s(hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_TCHAR)) + if (!db_get_s((HCONTACT)hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_TCHAR)) { - ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) dbv.ptszVal); + ProtoBroadcastAck((HCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal); debugLog(_T("getawaymsgthread(): Reading away msg <%s>."), dbv.ptszVal); db_free(&dbv); } else { - ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) NULL); + ProtoBroadcastAck((HCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)NULL); } debugLogA("getawaymsgthread(): end"); } -HANDLE GGPROTO::GetAwayMsg(HANDLE hContact) +HANDLE GGPROTO::GetAwayMsg(HCONTACT hContact) { #ifdef DEBUGMODE debugLogA("GetAwayMsg(): ForkThread 17 GGPROTO::getawaymsgthread"); @@ -757,7 +757,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const PROTOCHAR *newMsg) ////////////////////////////////////////////////////////// // sends a notification that the user is typing a message -int GGPROTO::UserIsTyping(HANDLE hContact, int type) +int GGPROTO::UserIsTyping(HCONTACT hContact, int type) { uin_t uin = getDword(hContact, GG_KEY_UIN, 0); if (!uin || !isonline()) diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index acc9c1b395..4aa8a54ca4 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -36,18 +36,18 @@ struct GGPROTO : public PROTO virtual int __cdecl Authorize( HANDLE hDbEvent ); virtual int __cdecl AuthDeny( HANDLE hDbEvent, const TCHAR* szReason ); - virtual int __cdecl AuthRecv( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl AuthRequest( HANDLE hContact, const TCHAR* szMessage ); + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl AuthRequest(HCONTACT hContact, const TCHAR* szMessage ); virtual HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData ); - virtual HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const TCHAR* szPath ); - virtual int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer ); - virtual int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const TCHAR* szReason ); + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath ); + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer ); + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason ); virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const TCHAR** szFilename ); - virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL ); - virtual int __cdecl GetInfo( HANDLE hContact, int infoType ); + virtual DWORD_PTR __cdecl GetCaps( int type, HCONTACT hContact = NULL ); + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType ); virtual HANDLE __cdecl SearchBasic( const TCHAR* id ); virtual HANDLE __cdecl SearchByEmail( const TCHAR* email ); @@ -55,24 +55,24 @@ struct GGPROTO : public PROTO virtual HWND __cdecl SearchAdvanced( HWND owner ); virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ); - virtual int __cdecl RecvContacts( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvFile( HANDLE hContact, PROTORECVFILET* ); - virtual int __cdecl RecvMsg( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvUrl( HANDLE hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvFile(HCONTACT hContact, PROTORECVFILET* ); + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT* ); - virtual int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ); - virtual HANDLE __cdecl SendFile( HANDLE hContact, const TCHAR* szDescription, TCHAR** ppszFiles ); - virtual int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg ); - virtual int __cdecl SendUrl( HANDLE hContact, int flags, const char* url ); + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList); + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles ); + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg ); + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url ); - virtual int __cdecl SetApparentMode( HANDLE hContact, int mode ); + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode ); virtual int __cdecl SetStatus( int iNewStatus ); - virtual HANDLE __cdecl GetAwayMsg( HANDLE hContact ); - virtual int __cdecl RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVENT* evt ); + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact ); + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt ); virtual int __cdecl SetAwayMsg( int m_iStatus, const TCHAR* msg ); - virtual int __cdecl UserIsTyping( HANDLE hContact, int type ); + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type ); virtual int __cdecl OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam ); @@ -110,10 +110,10 @@ struct GGPROTO : public PROTO void gg_sleep(DWORD miliseconds, BOOL alterable, char* callingFunction, int sleepNumber, int logging); /* Global GG functions */ - void notifyuser(HANDLE hContact, int refresh); + void notifyuser(HCONTACT hContact, int refresh); void setalloffline(); void disconnect(); - HANDLE getcontact(uin_t uin, int create, int inlist, TCHAR *nick); + HCONTACT getcontact(uin_t uin, int create, int inlist, TCHAR *nick); void __cdecl mainthread(void *empty); int isonline(); int refreshstatus(int status); @@ -133,9 +133,9 @@ struct GGPROTO : public PROTO void menus_init(); /* Avatar functions */ - void getAvatarFilename(HANDLE hContact, TCHAR *pszDest, int cbLen); - void requestAvatarTransfer(HANDLE hContact, char *szAvatarURL); - void requestAvatarInfo(HANDLE hContact, int iWaitFor); + void getAvatarFilename(HCONTACT hContact, TCHAR *pszDest, int cbLen); + void requestAvatarTransfer(HCONTACT hContact, char *szAvatarURL); + void requestAvatarInfo(HCONTACT hContact, int iWaitFor); void getOwnAvatar(); void setAvatar(const TCHAR *szFilename); bool getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts); @@ -152,11 +152,11 @@ struct GGPROTO : public PROTO void __cdecl setavatarthread(void*); /* File transfer functions */ - HANDLE fileallow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath); - int filecancel(HANDLE hContact, HANDLE hTransfer); - int filedeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason); - int recvfile(HANDLE hContact, PROTOFILEEVENT* pre); - HANDLE sendfile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles); + HANDLE fileallow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath); + int filecancel(HCONTACT hContact, HANDLE hTransfer); + int filedeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason); + int recvfile(HCONTACT hContact, PROTOFILEEVENT* pre); + HANDLE sendfile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles); HANDLE dccfileallow(HANDLE hTransfer, const PROTOCHAR* szPath); HANDLE dcc7fileallow(HANDLE hTransfer, const PROTOCHAR* szPath); @@ -187,8 +187,8 @@ struct GGPROTO : public PROTO int img_sendonrequest(gg_event* e); BOOL img_opened(uin_t uin); void *img_loadpicture(gg_event* e, TCHAR *szFileName); - int img_display(HANDLE hContact, void *img); - int img_displayasmsg(HANDLE hContact, void *img); + int img_display(HCONTACT hContact, void *img); + int img_displayasmsg(HCONTACT hContact, void *img); void __cdecl img_dlgcallthread(void *param); @@ -211,7 +211,7 @@ struct GGPROTO : public PROTO int gc_destroy(); TCHAR * gc_getchat(uin_t sender, uin_t *recipients, int recipients_count); GGGC *gc_lookup(const TCHAR *id); - int gc_changenick(HANDLE hContact, TCHAR *ptszNick); + int gc_changenick(HCONTACT hContact, TCHAR *ptszNick); int __cdecl gc_event(WPARAM wParam, LPARAM lParam); diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 5fb2027896..676b7abbe5 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -138,8 +138,8 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam) list_remove(&chats, chat, 1); // Remove contact from contact list (duh!) should be done by chat.dll !! - for (HANDLE hContact = db_find_first(); hContact; ) { - HANDLE hNext = db_find_next(hContact); + for (HCONTACT hContact = db_find_first(); hContact; ) { + HCONTACT hNext = db_find_next(hContact); DBVARIANT dbv; if (!getTString(hContact, "ChatRoomID", &dbv)) { if (dbv.ptszVal && !_tcscmp(gch->pDest->ptszID, dbv.ptszVal)) @@ -193,7 +193,7 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam) // Privmessage selected if (gch->pDest->iType == GC_USER_PRIVMESS) { - HANDLE hContact = NULL; + HCONTACT hContact = NULL; if ((uin = _ttoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, NULL))) CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); } @@ -369,7 +369,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count // Add contacts for(i = 0; i < chat->recipients_count; i++) { - HANDLE hContact = getcontact(chat->recipients[i], 1, 0, NULL); + HCONTACT hContact = getcontact(chat->recipients[i], 1, 0, NULL); UIN2IDT(chat->recipients[i], id); if (hContact && (name = pcli->pfnGetContactDisplayName(hContact, 0)) != NULL) gce.ptszNick = name; @@ -389,7 +389,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count return chat->id; } -static HANDLE gg_getsubcontact(GGPROTO* gg, HANDLE hContact) +static HCONTACT gg_getsubcontact(GGPROTO* gg, HCONTACT hContact) { char* szProto = GetContactProto(hContact); char* szMetaProto = (char*)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); @@ -397,10 +397,8 @@ static HANDLE gg_getsubcontact(GGPROTO* gg, HANDLE hContact) if (szProto && szMetaProto && (INT_PTR)szMetaProto != CALLSERVICE_NOTFOUND && !lstrcmpA(szProto, szMetaProto)) { int nSubContacts = (int)CallService(MS_MC_GETNUMCONTACTS, (WPARAM)hContact, 0), i; - HANDLE hMetaContact; - for (i = 0; i < nSubContacts; i++) - { - hMetaContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, i); + for (i = 0; i < nSubContacts; i++) { + HCONTACT hMetaContact = (HCONTACT)CallService(MS_MC_GETSUBCONTACT, (WPARAM)hContact, i); szProto = GetContactProto(hMetaContact); if (szProto && !lstrcmpA(szProto, gg->m_szModuleName)) return hMetaContact; @@ -425,7 +423,7 @@ static void gg_gc_resetclistopts(HWND hwndList) static int gg_gc_countcheckmarks(HWND hwndList) { int count = 0; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem && SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) count++; @@ -477,10 +475,10 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa TCHAR* chat; uin_t* participants = (uin_t*)calloc(count, sizeof(uin_t)); gg->debugLogA("gg_gc_openconfdlg(): WM_COMMAND IDOK Opening new conference for %d contacts.", count); - for (HANDLE hContact = db_find_first(); hContact && i < count; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact && i < count; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem && SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) { - HANDLE hMetaContact = gg_getsubcontact(gg, hContact); // MetaContacts support + HCONTACT hMetaContact = gg_getsubcontact(gg, hContact); // MetaContacts support participants[i++] = db_get_dw(hMetaContact ? hMetaContact : hContact, gg->m_szModuleName, GG_KEY_UIN, 0); } } @@ -526,10 +524,10 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa if (!gg) break; // Delete non-gg contacts - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + HCONTACT hItem = (HCONTACT)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) { - HANDLE hMetaContact = gg_getsubcontact(gg, hContact); // MetaContacts support + HCONTACT hMetaContact = gg_getsubcontact(gg, hContact); // MetaContacts support if (hMetaContact) { szProto = gg->m_szModuleName; uin = (uin_t)gg->getDword(hMetaContact, GG_KEY_UIN, 0); @@ -620,7 +618,7 @@ INT_PTR GGPROTO::gc_openconf(WPARAM wParam, LPARAM lParam) return 1; } -int GGPROTO::gc_changenick(HANDLE hContact, TCHAR *ptszNick) +int GGPROTO::gc_changenick(HCONTACT hContact, TCHAR *ptszNick) { list_t l; uin_t uin = getDword(hContact, GG_KEY_UIN, 0); diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 15006095aa..607edfdb37 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -49,7 +49,7 @@ typedef struct _GGIMAGEENTRY typedef struct { - HANDLE hContact; + HCONTACT hContact; HANDLE hEvent; HWND hWnd; uin_t uin; @@ -730,7 +730,7 @@ void __cdecl GGPROTO::img_dlgcallthread(void *param) //////////////////////////////////////////////////////////////////////////// // Open dialog receive for specified contact -GGIMAGEDLGDATA *gg_img_recvdlg(GGPROTO *gg, HANDLE hContact) +GGIMAGEDLGDATA *gg_img_recvdlg(GGPROTO *gg, HCONTACT hContact) { // Create dialog data GGIMAGEDLGDATA *dat = (GGIMAGEDLGDATA *)calloc(1, sizeof(GGIMAGEDLGDATA)); @@ -804,7 +804,7 @@ TCHAR *gg_img_hasextension(TCHAR *filename) //////////////////////////////////////////////////////////////////////////////// // Display received image using message with [img] BBCode -int GGPROTO::img_displayasmsg(HANDLE hContact, void *img) +int GGPROTO::img_displayasmsg(HCONTACT hContact, void *img) { GGIMAGEENTRY *dat = (GGIMAGEENTRY *)img; TCHAR szPath[MAX_PATH], path[MAX_PATH], *pImgext, imgext[6]; @@ -896,7 +896,7 @@ BOOL GGPROTO::img_opened(uin_t uin) //////////////////////////////////////////////////////////////////////////// // Image Module : Looking for window entry, create if not found -int GGPROTO::img_display(HANDLE hContact, void *img) +int GGPROTO::img_display(HCONTACT hContact, void *img) { list_t l = imagedlgs; GGIMAGEDLGDATA *dat; @@ -1173,7 +1173,7 @@ BOOL GGPROTO::img_sendonrequest(gg_event* e) INT_PTR GGPROTO::img_sendimg(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; GGIMAGEDLGDATA *dat = NULL; gg_EnterCriticalSection(&img_mutex, "img_sendimg", 64, "img_mutex", 1); diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 1ac699ffcd..e4954fc14c 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -26,7 +26,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr) char *contacts; // Readup contacts - for (HANDLE hContact = db_find_first(gg->m_szModuleName); hContact; hContact = db_find_next(hContact, gg->m_szModuleName)) { + for (HCONTACT hContact = db_find_first(gg->m_szModuleName); hContact; hContact = db_find_next(hContact, gg->m_szModuleName)) { if (gg->isChatRoom(hContact)) continue; @@ -210,7 +210,7 @@ void GGPROTO::parsecontacts(char *contacts) // Loadup contact if (uin && strNick) { - HANDLE hContact = getcontact(uin, 1, 1, _A2T(strNick)); + HCONTACT hContact = getcontact(uin, 1, 1, _A2T(strNick)); #ifdef DEBUGMODE debugLogA("parsecontacts(): Found contact %d with nickname \"%s\".", uin, strNick); #endif diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp index 2e6238a963..f241938c5a 100644 --- a/protocols/Gadu-Gadu/src/links.cpp +++ b/protocols/Gadu-Gadu/src/links.cpp @@ -99,7 +99,7 @@ static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam) if (ServiceExists(MS_MSG_SENDMESSAGE)) { - HANDLE hContact = gg->getcontact(uin, 1, 0, NULL); + HCONTACT hContact = gg->getcontact(uin, 1, 0, NULL); if (hContact != NULL) CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); } diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index f666244462..4b6d8610df 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -382,7 +382,7 @@ INT_PTR GGPROTO::get_acc_mgr_gui(WPARAM wParam, LPARAM lParam) INT_PTR GGPROTO::leavechat(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index f95dc36351..54ade38cac 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -24,14 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, unsigned long adr, int port) { - HANDLE hContact; - HANDLE hc; + HCONTACT hContact; TCHAR szNick[256]; char szService[256]; bool bFlag = false; CONTACT usertemp = { (TCHAR*)name.c_str(), NULL, NULL, false, false, true }; - hc = CList_FindContact(&usertemp); + HCONTACT hc = CList_FindContact(&usertemp); if (hc && db_get_b(hc, "CList", "NotOnList", 0) == 0 && db_get_b(hc, "CList", "Hidden", 0) == 0) bFlag = true; @@ -63,9 +62,8 @@ BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, PostIrcMessage(_T("/PRIVMSG %s \001VERSION\001"), name.c_str()); } else { - CLISTEVENT cle = { 0 }; - cle.cbSize = sizeof(cle); - cle.hContact = (HANDLE)hContact; + CLISTEVENT cle = { sizeof(cle) }; + cle.hContact = hContact; cle.hDbEvent = (HANDLE)"dccchat"; cle.flags = CLEF_TCHAR; cle.hIcon = LoadIconEx(IDI_DCC); @@ -82,12 +80,12 @@ BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask, return TRUE; } -HANDLE CIrcProto::CList_AddContact(CONTACT * user, bool InList, bool SetOnline) +HCONTACT CIrcProto::CList_AddContact(CONTACT *user, bool InList, bool SetOnline) { if (user->name == NULL) return 0; - HANDLE hContact = CList_FindContact(user); + HCONTACT hContact = CList_FindContact(user); if (hContact) { if (InList) db_unset(hContact, "CList", "NotOnList"); @@ -99,7 +97,7 @@ HANDLE CIrcProto::CList_AddContact(CONTACT * user, bool InList, bool SetOnline) } // here we create a new one since no one is to be found - hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if (hContact) { CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName); @@ -118,9 +116,9 @@ HANDLE CIrcProto::CList_AddContact(CONTACT * user, bool InList, bool SetOnline) return false; } -HANDLE CIrcProto::CList_SetOffline(struct CONTACT * user) +HCONTACT CIrcProto::CList_SetOffline(CONTACT *user) { - HANDLE hContact = CList_FindContact(user); + HCONTACT hContact = CList_FindContact(user); if (hContact) { DBVARIANT dbv; if (!getTString(hContact, "Default", &dbv)) { @@ -142,7 +140,7 @@ bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo) DisconnectAllDCCSessions(false); - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (isChatRoom(hContact)) continue; @@ -162,7 +160,7 @@ bool CIrcProto::CList_SetAllOffline(BYTE ChatsToo) return true; } -HANDLE CIrcProto::CList_FindContact(CONTACT* user) +HCONTACT CIrcProto::CList_FindContact(CONTACT *user) { if (!user || !user->name) return 0; @@ -170,11 +168,11 @@ HANDLE CIrcProto::CList_FindContact(CONTACT* user) TCHAR* lowercasename = mir_tstrdup(user->name); CharLower(lowercasename); - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (isChatRoom(hContact)) continue; - HANDLE hContact_temp = NULL; + HCONTACT hContact_temp = NULL; ptrT DBNick(getTStringA(hContact, "Nick")); ptrT DBUser(getTStringA(hContact, "UUser")); ptrT DBHost(getTStringA(hContact, "UHost")); @@ -185,7 +183,7 @@ HANDLE CIrcProto::CList_FindContact(CONTACT* user) CharLower(DBWildcard); if (IsChannel(user->name)) { if (DBDefault && !lstrcmpi(DBDefault, user->name)) - hContact_temp = (HANDLE)-1; + hContact_temp = (HCONTACT)-1; } else if (user->ExactNick && DBNick && !lstrcmpi(DBNick, user->name)) hContact_temp = hContact; @@ -210,7 +208,7 @@ HANDLE CIrcProto::CList_FindContact(CONTACT* user) if (hContact_temp != NULL) { mir_free(lowercasename); - if (hContact_temp != (HANDLE)-1) + if (hContact_temp != (HCONTACT)-1) return hContact_temp; return 0; } diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index c67304d98d..41556d434e 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -98,7 +98,7 @@ VOID CALLBACK OnlineNotifTimerProc3(HWND, UINT, UINT_PTR idEvent, DWORD) int count = (int)CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)ppro->m_szModuleName); for (int i = 0; i < count; i++) { GC_INFO gci = { 0 }; - gci.Flags = BYINDEX | NAME | TYPE | COUNT; + gci.Flags = GCF_BYINDEX | GCF_NAME | GCF_TYPE | GCF_COUNT; gci.iItem = i; gci.pszModule = ppro->m_szModuleName; if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci) && gci.iType == GCW_CHATROOM) @@ -140,7 +140,7 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) if (name.IsEmpty() && name2.IsEmpty()) { DBVARIANT dbv; - for (HANDLE hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) { + for (HCONTACT hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) { if (ppro->isChatRoom(hContact)) continue; @@ -215,7 +215,7 @@ VOID CALLBACK OnlineNotifTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD) ppro->SetChatTimer(ppro->OnlineNotifTimer, ppro->m_onlineNotificationTime * 1000, OnlineNotifTimerProc); } -int CIrcProto::AddOutgoingMessageToDB(HANDLE hContact, TCHAR* msg) +int CIrcProto::AddOutgoingMessageToDB(HCONTACT hContact, TCHAR* msg) { if (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING) return 0; @@ -582,7 +582,7 @@ bool CIrcProto::OnIrc_NICK(const CIrcMessage* pmsg) DoEvent(GC_EVENT_CHUID, NULL, pmsg->prefix.sNick.c_str(), pmsg->parameters[0].c_str(), NULL, NULL, NULL, true, false); struct CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), (TCHAR*)pmsg->prefix.sUser.c_str(), (TCHAR*)pmsg->prefix.sHost.c_str(), false, false, false }; - HANDLE hContact = CList_FindContact(&user); + HCONTACT hContact = CList_FindContact(&user); if (hContact) { if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) setWord(hContact, "Status", ID_STATUS_ONLINE); @@ -615,7 +615,7 @@ bool CIrcProto::OnIrc_NOTICE(const CIrcMessage* pmsg) S2 = pmsg->parameters[0].c_str(); else { GC_INFO gci = { 0 }; - gci.Flags = BYID | TYPE; + gci.Flags = GCF_BYID | GCF_TYPE; gci.pszModule = m_szModuleName; CMString S3 = GetWord(pmsg->parameters[1].c_str(), 0); @@ -696,12 +696,12 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage* pmsg) return true; if ((m_ignore && IsIgnored(pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, 'q'))) { - HANDLE hContact = CList_FindContact(&user); + HCONTACT hContact = CList_FindContact(&user); if (!hContact || (hContact && db_get_b(hContact, "CList", "Hidden", 0) == 1)) return true; } - HANDLE hContact = CList_AddContact(&user, false, true); + HCONTACT hContact = CList_AddContact(&user, false, true); PROTORECVEVENT pre = { 0 }; pre.timestamp = (DWORD)time(NULL); @@ -1066,7 +1066,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) // incoming chat request if (bIsChat) { CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), 0, 0, false, false, true }; - HANDLE hContact = CList_FindContact(&user); + HCONTACT hContact = CList_FindContact(&user); // check if it should be ignored if (m_DCCChatIgnore == 1 || @@ -1139,7 +1139,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) if (!CList_FindContact(&user)) return true; - HANDLE hContact = CList_AddContact(&user, false, true); + HCONTACT hContact = CList_AddContact(&user, false, true); if (hContact) { DCCINFO* di = new DCCINFO; di->hContact = hContact; @@ -1188,7 +1188,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg) //if we got incoming CTCP Version for contact in CList - then write its as MirVer for that contact! if (pmsg->m_bIncoming && command == _T("version")) { struct CONTACT user = { (TCHAR*)pmsg->prefix.sNick.c_str(), (TCHAR*)pmsg->prefix.sUser.c_str(), (TCHAR*)pmsg->prefix.sHost.c_str(), false, false, false }; - HANDLE hContact = CList_FindContact(&user); + HCONTACT hContact = CList_FindContact(&user); if (hContact) setTString(hContact, "MirVer", DoColorCodes(GetWordAddress(mess.c_str(), 1), TRUE, FALSE)); } @@ -1688,7 +1688,7 @@ bool CIrcProto::OnIrc_WHOIS_END(const CIrcMessage* pmsg) { if (pmsg->m_bIncoming && pmsg->parameters.getCount() > 1 && m_manualWhoisCount < 1) { CONTACT user = { (TCHAR*)pmsg->parameters[1].c_str(), NULL, NULL, false, false, true }; - HANDLE hContact = CList_FindContact(&user); + HCONTACT hContact = CList_FindContact(&user); if (hContact) ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)WhoisAwayReply.c_str()); } @@ -1767,7 +1767,7 @@ bool CIrcProto::OnIrc_WHOIS_NO_USER(const CIrcMessage* pmsg) m_whoisDlg->ShowMessageNoUser(pmsg); CONTACT user = { (TCHAR*)pmsg->parameters[1].c_str(), NULL, NULL, false, false, false }; - HANDLE hContact = CList_FindContact(&user); + HCONTACT hContact = CList_FindContact(&user); if (hContact) { AddOutgoingMessageToDB(hContact, (TCHAR*)((CMString)_T("> ") + pmsg->parameters[2] + (CMString)_T(": ") + pmsg->parameters[1]).c_str()); @@ -1949,7 +1949,7 @@ bool CIrcProto::OnIrc_WHO_END(const CIrcMessage* pmsg) const TCHAR* p1 = UserList; m_whoReply = _T(""); CONTACT user = { (TCHAR*)pmsg->parameters[1].c_str(), NULL, NULL, false, true, false }; - HANDLE hContact = CList_FindContact(&user); + HCONTACT hContact = CList_FindContact(&user); if (hContact && getByte(hContact, "AdvancedMode", 0) == 1) { ptrT DBHost(getTStringA(hContact, "UHost")); @@ -2118,7 +2118,7 @@ bool CIrcProto::OnIrc_USERHOST_REPLY(const CIrcMessage* pmsg) finduser.host = (TCHAR*)host.c_str(); finduser.user = (TCHAR*)user.c_str(); - HANDLE hContact = CList_FindContact(&finduser); + HCONTACT hContact = CList_FindContact(&finduser); if (hContact && getByte(hContact, "AdvancedMode", 0) == 0) { setWord(hContact, "Status", awaystatus == '-' ? ID_STATUS_AWAY : ID_STATUS_ONLINE); setTString(hContact, "User", user.c_str()); @@ -2370,7 +2370,7 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*) int count = CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)m_szModuleName); for (int i = 0; i < count; i++) { GC_INFO gci = { 0 }; - gci.Flags = BYINDEX | DATA | NAME | TYPE; + gci.Flags = GCF_BYINDEX | GCF_DATA | GCF_NAME | GCF_TYPE; gci.iItem = i; gci.pszModule = m_szModuleName; if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci) && gci.iType == GCW_CHATROOM) { diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index b11400f6d2..a78fabf304 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -212,7 +212,7 @@ static void __stdcall sttSetTimerOff(void* _pro) ppro->KillChatTimer(ppro->OnlineNotifTimer3); } -BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, HANDLE hContact) +BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, HCONTACT hContact) { TCHAR temp[30]; lstrcpyn(temp, GetWord(text.c_str(), 0).c_str(), 29); @@ -371,7 +371,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, HANDLE hContact TCHAR szTemp[40]; CMString S = MakeWndID(window); GC_INFO gci = { 0 }; - gci.Flags = BYID | NAME | COUNT; + gci.Flags = GCF_BYID | GCF_NAME | GCF_COUNT; gci.pszModule = m_szModuleName; gci.pszID = S.c_str(); if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) @@ -628,7 +628,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, HANDLE hContact if (ulAdr) { CONTACT user = { (TCHAR*)two.c_str(), NULL, NULL, false, false, true }; - HANDLE hContact = CList_AddContact(&user, false, false); + HCONTACT hContact = CList_AddContact(&user, false, false); if (hContact) { CMString s; @@ -679,7 +679,7 @@ BOOL CIrcProto::DoHardcodedCommand(CMString text, TCHAR* window, HANDLE hContact if (ulAdr) { CMString contact = two; contact += _T(DCCSTRING); CONTACT user = { (TCHAR*)contact.c_str(), NULL, NULL, false, false, true }; - HANDLE hContact = CList_AddContact(&user, false, false); + HCONTACT hContact = CList_AddContact(&user, false, false); setByte(hContact, "DCC", 1); int iPort = 0; @@ -805,7 +805,7 @@ bool CIrcProto::PostIrcMessage(const TCHAR* fmt, ...) return PostIrcMessageWnd(NULL, NULL, szBuf); } -bool CIrcProto::PostIrcMessageWnd(TCHAR* window, HANDLE hContact, const TCHAR* szBuf) +bool CIrcProto::PostIrcMessageWnd(TCHAR* window, HCONTACT hContact, const TCHAR* szBuf) { DBVARIANT dbv; TCHAR windowname[256]; diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h index 4e963e743c..cf351b65a5 100644 --- a/protocols/IRCG/src/irc.h +++ b/protocols/IRCG/src/irc.h @@ -217,76 +217,76 @@ struct CIrcProto : public PROTO virtual HANDLE __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ); virtual HANDLE __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ); - virtual int __cdecl Authorize( HANDLE hContact ); - virtual int __cdecl AuthDeny( HANDLE hContact, const TCHAR* szReason ); - virtual int __cdecl AuthRecv( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl AuthRequest( HANDLE hContact, const TCHAR* szMessage ); + virtual int __cdecl Authorize(HANDLE hDbEvent); + virtual int __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR* szReason); + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl AuthRequest(HCONTACT hContact, const TCHAR *szMessage); - virtual HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData ); + virtual HANDLE __cdecl ChangeInfo( int iInfoType, void *pInfoData); - virtual HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const TCHAR* szPath ); - virtual int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer ); - virtual int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const TCHAR* szReason ); - virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const TCHAR** szFilename ); + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath); + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer ); + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason); + virtual int __cdecl FileResume( HANDLE hTransfer, int *action, const TCHAR **szFilename); - virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL ); - virtual int __cdecl GetInfo( HANDLE hContact, int infoType ); + virtual DWORD_PTR __cdecl GetCaps( int type, HCONTACT hContact = NULL); + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType); - virtual HANDLE __cdecl SearchBasic( const PROTOCHAR* id ); - virtual HANDLE __cdecl SearchByEmail( const PROTOCHAR* email ); - virtual HANDLE __cdecl SearchByName( const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName ); - virtual HWND __cdecl SearchAdvanced( HWND owner ); - virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ); + virtual HANDLE __cdecl SearchBasic(const PROTOCHAR* id); + virtual HANDLE __cdecl SearchByEmail(const PROTOCHAR* email); + virtual HANDLE __cdecl SearchByName(const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName); + virtual HWND __cdecl SearchAdvanced(HWND owner); + virtual HWND __cdecl CreateExtendedSearchUI(HWND owner); - virtual int __cdecl RecvContacts( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvFile( HANDLE hContact, PROTORECVFILET* ); - virtual int __cdecl RecvMsg( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvUrl( HANDLE hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvFile(HCONTACT hContact, PROTORECVFILET*); + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT*); - virtual int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ); - virtual HANDLE __cdecl SendFile( HANDLE hContact, const TCHAR* szDescription, TCHAR** ppszFiles ); - virtual int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg ); - virtual int __cdecl SendUrl( HANDLE hContact, int flags, const char* url ); + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList); + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles); + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg); + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url); - virtual int __cdecl SetApparentMode( HANDLE hContact, int mode ); - virtual int __cdecl SetStatus( int iNewStatus ); + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode); + virtual int __cdecl SetStatus(int iNewStatus); - virtual HANDLE __cdecl GetAwayMsg( HANDLE hContact ); - virtual int __cdecl RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVENT* evt ); - virtual int __cdecl SetAwayMsg( int m_iStatus, const TCHAR* msg ); + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact); + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT *evt); + virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR *msg); - virtual int __cdecl UserIsTyping( HANDLE hContact, int type ); + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type); - virtual int __cdecl OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam ); + virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam); // Services - INT_PTR __cdecl SvcCreateAccMgrUI( WPARAM, LPARAM ); - INT_PTR __cdecl GetMyAwayMsg( WPARAM, LPARAM ); - - INT_PTR __cdecl OnChangeNickMenuCommand( WPARAM, LPARAM ); - INT_PTR __cdecl OnDoubleclicked( WPARAM, LPARAM ); - INT_PTR __cdecl OnJoinChat( WPARAM, LPARAM ); - INT_PTR __cdecl OnJoinMenuCommand( WPARAM, LPARAM ); - INT_PTR __cdecl OnLeaveChat( WPARAM, LPARAM ); - INT_PTR __cdecl OnMenuChanSettings( WPARAM, LPARAM ); + INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM); + INT_PTR __cdecl GetMyAwayMsg(WPARAM, LPARAM); + + INT_PTR __cdecl OnChangeNickMenuCommand(WPARAM, LPARAM); + INT_PTR __cdecl OnDoubleclicked(WPARAM, LPARAM); + INT_PTR __cdecl OnJoinChat(WPARAM, LPARAM); + INT_PTR __cdecl OnJoinMenuCommand(WPARAM, LPARAM); + INT_PTR __cdecl OnLeaveChat(WPARAM, LPARAM); + INT_PTR __cdecl OnMenuChanSettings(WPARAM, LPARAM); INT_PTR __cdecl OnMenuDisconnect( WPARAM , LPARAM ); - INT_PTR __cdecl OnMenuIgnore( WPARAM, LPARAM ); - INT_PTR __cdecl OnMenuWhois( WPARAM, LPARAM ); + INT_PTR __cdecl OnMenuIgnore(WPARAM, LPARAM); + INT_PTR __cdecl OnMenuWhois(WPARAM, LPARAM); INT_PTR __cdecl OnQuickConnectMenuCommand(WPARAM, LPARAM ); - INT_PTR __cdecl OnShowListMenuCommand( WPARAM, LPARAM ); - INT_PTR __cdecl OnShowServerMenuCommand( WPARAM, LPARAM ); + INT_PTR __cdecl OnShowListMenuCommand(WPARAM, LPARAM); + INT_PTR __cdecl OnShowServerMenuCommand(WPARAM, LPARAM); // Events - int __cdecl OnContactDeleted( WPARAM, LPARAM ); - int __cdecl OnInitOptionsPages( WPARAM, LPARAM ); - int __cdecl OnInitUserInfo( WPARAM, LPARAM ); - int __cdecl OnModulesLoaded( WPARAM, LPARAM ); - int __cdecl OnMenuPreBuild( WPARAM, LPARAM ); - int __cdecl OnPreShutdown( WPARAM, LPARAM ); - int __cdecl OnDbSettingChanged( WPARAM, LPARAM ); + int __cdecl OnContactDeleted(WPARAM, LPARAM); + int __cdecl OnInitOptionsPages(WPARAM, LPARAM); + int __cdecl OnInitUserInfo(WPARAM, LPARAM); + int __cdecl OnModulesLoaded(WPARAM, LPARAM); + int __cdecl OnMenuPreBuild(WPARAM, LPARAM); + int __cdecl OnPreShutdown(WPARAM, LPARAM); + int __cdecl OnDbSettingChanged(WPARAM, LPARAM); - int __cdecl GCEventHook( WPARAM, LPARAM ); - int __cdecl GCMenuHook( WPARAM, LPARAM ); + int __cdecl GCEventHook(WPARAM, LPARAM); + int __cdecl GCMenuHook(WPARAM, LPARAM); // Data @@ -389,46 +389,46 @@ struct CIrcProto : public PROTO CDlgBase::CreateParam OptCreateAccount, OptCreateConn, OptCreateIgnore, OptCreateOther; //clist.cpp - HANDLE CList_AddContact(struct CONTACT * user, bool InList, bool SetOnline); - bool CList_SetAllOffline(BYTE ChatsToo); - HANDLE CList_SetOffline(struct CONTACT * user); + HCONTACT CList_AddContact(CONTACT *user, bool InList, bool SetOnline); + bool CList_SetAllOffline(BYTE ChatsToo); + HCONTACT CList_SetOffline(CONTACT *user); - bool CList_AddEvent(struct CONTACT * user, HICON Icon, HANDLE event, const char * tooltip, int type ) ; - HANDLE CList_FindContact (struct CONTACT * user); - BOOL CList_AddDCCChat(const CMString& name, const CMString& hostmask, unsigned long adr, int port) ; + bool CList_AddEvent(CONTACT *user, HICON Icon, HANDLE event, const char *tooltip, int type ) ; + HCONTACT CList_FindContact(CONTACT *user); + BOOL CList_AddDCCChat(const CMString &name, const CMString &hostmask, unsigned long adr, int port) ; //commandmonitor.cpp UINT_PTR IdentTimer, InitTimer, KeepAliveTimer, OnlineNotifTimer, OnlineNotifTimer3; - int AddOutgoingMessageToDB(HANDLE hContact, TCHAR* msg); + int AddOutgoingMessageToDB(HCONTACT hContact, TCHAR *msg); bool DoOnConnect(const CIrcMessage *pmsg); - int DoPerform(const char* event); - void __cdecl ResolveIPThread( void* di ); + int DoPerform(const char *event); + void __cdecl ResolveIPThread(void *di); - bool AddIgnore(const TCHAR* mask, const TCHAR* mode, const TCHAR* network) ; - int IsIgnored(const CMString& nick, const CMString& address, const CMString& host, char type) ; + bool AddIgnore(const TCHAR *mask, const TCHAR *mode, const TCHAR *network) ; + int IsIgnored(const CMString &nick, const CMString &address, const CMString &host, char type) ; int IsIgnored(CMString user, char type); - bool RemoveIgnore(const TCHAR* mask) ; + bool RemoveIgnore(const TCHAR *mask) ; //input.cpp CMString DoAlias( const TCHAR *text, TCHAR *window); - BOOL DoHardcodedCommand( CMString text, TCHAR* window, HANDLE hContact ); - CMString DoIdentifiers( CMString text, const TCHAR* window ); - void FormatMsg(CMString& text); - bool PostIrcMessageWnd(TCHAR* pszWindow, HANDLE hContact,const TCHAR* szBuf); - bool PostIrcMessage( const TCHAR* fmt, ...); + BOOL DoHardcodedCommand(CMString text, TCHAR *window, HCONTACT hContact); + CMString DoIdentifiers(CMString text, const TCHAR *window); + void FormatMsg(CMString &text); + bool PostIrcMessageWnd(TCHAR *pszWindow, HCONTACT hContact, const TCHAR *szBuf); + bool PostIrcMessage(const TCHAR *fmt, ...); // irclib.cpp UINT_PTR DCCTimer; - void SendIrcMessage( const TCHAR*, bool bNotify = true, int codepage = -1 ); + void SendIrcMessage(const TCHAR*, bool bNotify = true, int codepage = -1); // ircproto.cpp - void __cdecl AckBasicSearch( void* param ); - void __cdecl AckMessageFail( void* info ); - void __cdecl AckMessageFailDcc( void* info ); - void __cdecl AckMessageSuccess( void* info ); + void __cdecl AckBasicSearch(void* param); + void __cdecl AckMessageFail(void* info); + void __cdecl AckMessageFailDcc(void* info); + void __cdecl AckMessageSuccess(void* info); - int SetStatusInternal( int iNewStatus, bool bIsInternal ); + int SetStatusInternal(int iNewStatus, bool bIsInternal); //options.cpp HWND m_hwndConnect; @@ -501,12 +501,12 @@ struct CIrcProto : public PROTO //////////////////////////////////////////////////////////////////////////////////////// // former CIrcSession class - void AddDCCSession(HANDLE hContact, CDccSession* dcc); + void AddDCCSession(HCONTACT hContact, CDccSession* dcc); void AddDCCSession(DCCINFO* pdci, CDccSession* dcc); - void RemoveDCCSession(HANDLE hContact); + void RemoveDCCSession(HCONTACT hContact); void RemoveDCCSession(DCCINFO* pdci); - CDccSession* FindDCCSession(HANDLE hContact); + CDccSession* FindDCCSession(HCONTACT hContact); CDccSession* FindDCCSession(DCCINFO* pdci); CDccSession* FindDCCSendByPort(int iPort); CDccSession* FindDCCRecvByPortAndName(int iPort, const TCHAR* szName); diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index f1daa53f6a..b1e97a4212 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -457,7 +457,7 @@ void __cdecl CIrcProto::ThreadProc(void*) m_info.Reset(); } -void CIrcProto::AddDCCSession(HANDLE, CDccSession* dcc) +void CIrcProto::AddDCCSession(HCONTACT, CDccSession* dcc) { EnterCriticalSection(&m_dcc); @@ -479,7 +479,7 @@ void CIrcProto::AddDCCSession(DCCINFO*, CDccSession* dcc) LeaveCriticalSection(&m_dcc); } -void CIrcProto::RemoveDCCSession(HANDLE hContact) +void CIrcProto::RemoveDCCSession(HCONTACT hContact) { EnterCriticalSection(&m_dcc); @@ -505,7 +505,7 @@ void CIrcProto::RemoveDCCSession(DCCINFO* pdci) LeaveCriticalSection(&m_dcc); } -CDccSession* CIrcProto::FindDCCSession(HANDLE hContact) +CDccSession* CIrcProto::FindDCCSession(HCONTACT hContact) { EnterCriticalSection(&m_dcc); diff --git a/protocols/IRCG/src/irclib.h b/protocols/IRCG/src/irclib.h index 7dcb5a4c01..d0efcd6fcf 100644 --- a/protocols/IRCG/src/irclib.h +++ b/protocols/IRCG/src/irclib.h @@ -35,20 +35,20 @@ namespace irc { struct DCCINFO : public MZeroedObject { - DWORD dwAdr; + DWORD dwAdr; unsigned __int64 dwSize; - DWORD iType; + DWORD iType; CMString sToken; - int iPort; - BOOL bTurbo; - BOOL bSSL; - BOOL bSender; - BOOL bReverse; + int iPort; + BOOL bTurbo; + BOOL bSSL; + BOOL bSender; + BOOL bReverse; CMString sPath; CMString sFile; CMString sFileAndPath; CMString sHostmask; - HANDLE hContact; + HCONTACT hContact; CMString sContactName; }; diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 06d2ae0397..e1a26116f4 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -327,7 +327,7 @@ HANDLE __cdecl CIrcProto::AddToList(int, PROTOSEARCHRESULT* psr) id = psr->flags & PSR_UNICODE ? mir_u2t((wchar_t*)id) : mir_a2t((char*)id); CONTACT user = { id, NULL, NULL, true, false, false }; - HANDLE hContact = CList_AddContact(&user, true, false); + HCONTACT hContact = CList_AddContact(&user, true, false); if (hContact) { DBVARIANT dbv1; @@ -383,7 +383,7 @@ int __cdecl CIrcProto::AuthDeny(HANDLE, const TCHAR*) //////////////////////////////////////////////////////////////////////////////////////// // PSR_AUTH -int __cdecl CIrcProto::AuthRecv(HANDLE, PROTORECVEVENT*) +int __cdecl CIrcProto::AuthRecv(HCONTACT, PROTORECVEVENT*) { return 1; } @@ -391,7 +391,7 @@ int __cdecl CIrcProto::AuthRecv(HANDLE, PROTORECVEVENT*) //////////////////////////////////////////////////////////////////////////////////////// // PSS_AUTHREQUEST -int __cdecl CIrcProto::AuthRequest(HANDLE, const TCHAR*) +int __cdecl CIrcProto::AuthRequest(HCONTACT, const TCHAR*) { return 1; } @@ -407,7 +407,7 @@ HANDLE __cdecl CIrcProto::ChangeInfo(int, void*) //////////////////////////////////////////////////////////////////////////////////////// // FileAllow - starts a file transfer -HANDLE __cdecl CIrcProto::FileAllow(HANDLE, HANDLE hTransfer, const TCHAR* szPath) +HANDLE __cdecl CIrcProto::FileAllow(HCONTACT, HANDLE hTransfer, const TCHAR* szPath) { DCCINFO* di = (DCCINFO*)hTransfer; @@ -428,7 +428,7 @@ HANDLE __cdecl CIrcProto::FileAllow(HANDLE, HANDLE hTransfer, const TCHAR* szPat //////////////////////////////////////////////////////////////////////////////////////// // FileCancel - cancels a file transfer -int __cdecl CIrcProto::FileCancel(HANDLE, HANDLE hTransfer) +int __cdecl CIrcProto::FileCancel(HCONTACT, HANDLE hTransfer) { DCCINFO* di = (DCCINFO*)hTransfer; @@ -444,7 +444,7 @@ int __cdecl CIrcProto::FileCancel(HANDLE, HANDLE hTransfer) //////////////////////////////////////////////////////////////////////////////////////// // FileDeny - denies a file transfer -int __cdecl CIrcProto::FileDeny(HANDLE, HANDLE hTransfer, const TCHAR*) +int __cdecl CIrcProto::FileDeny(HCONTACT, HANDLE hTransfer, const TCHAR*) { DCCINFO* di = (DCCINFO*)hTransfer; delete di; @@ -500,7 +500,7 @@ int __cdecl CIrcProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** s //////////////////////////////////////////////////////////////////////////////////////// // GetCaps - return protocol capabilities bits -DWORD_PTR __cdecl CIrcProto::GetCaps(int type, HANDLE) +DWORD_PTR __cdecl CIrcProto::GetCaps(int type, HCONTACT) { switch (type) { case PFLAGNUM_1: @@ -531,7 +531,7 @@ DWORD_PTR __cdecl CIrcProto::GetCaps(int type, HANDLE) //////////////////////////////////////////////////////////////////////////////////////// // GetInfo - retrieves a contact info -int __cdecl CIrcProto::GetInfo(HANDLE, int) +int __cdecl CIrcProto::GetInfo(HCONTACT, int) { return 1; } @@ -599,7 +599,7 @@ HWND __cdecl CIrcProto::SearchAdvanced(HWND) //////////////////////////////////////////////////////////////////////////////////////// // RecvContacts -int __cdecl CIrcProto::RecvContacts(HANDLE, PROTORECVEVENT*) +int __cdecl CIrcProto::RecvContacts(HCONTACT, PROTORECVEVENT*) { return 1; } @@ -607,7 +607,7 @@ int __cdecl CIrcProto::RecvContacts(HANDLE, PROTORECVEVENT*) //////////////////////////////////////////////////////////////////////////////////////// // RecvFile -int __cdecl CIrcProto::RecvFile(HANDLE hContact, PROTORECVFILET* evt) +int __cdecl CIrcProto::RecvFile(HCONTACT hContact, PROTORECVFILET* evt) { return Proto_RecvFile(hContact, evt); } @@ -615,7 +615,7 @@ int __cdecl CIrcProto::RecvFile(HANDLE hContact, PROTORECVFILET* evt) //////////////////////////////////////////////////////////////////////////////////////// // RecvMsg -int __cdecl CIrcProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* evt) +int __cdecl CIrcProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT* evt) { return Proto_RecvMessage(hContact, evt); } @@ -623,7 +623,7 @@ int __cdecl CIrcProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* evt) //////////////////////////////////////////////////////////////////////////////////////// // RecvUrl -int __cdecl CIrcProto::RecvUrl(HANDLE, PROTORECVEVENT*) +int __cdecl CIrcProto::RecvUrl(HCONTACT, PROTORECVEVENT*) { return 1; } @@ -631,7 +631,7 @@ int __cdecl CIrcProto::RecvUrl(HANDLE, PROTORECVEVENT*) //////////////////////////////////////////////////////////////////////////////////////// // SendContacts -int __cdecl CIrcProto::SendContacts(HANDLE, int, int, HANDLE*) +int __cdecl CIrcProto::SendContacts(HCONTACT, int, int, HCONTACT*) { return 1; } @@ -639,7 +639,7 @@ int __cdecl CIrcProto::SendContacts(HANDLE, int, int, HANDLE*) //////////////////////////////////////////////////////////////////////////////////////// // SendFile - sends a file -HANDLE __cdecl CIrcProto::SendFile(HANDLE hContact, const TCHAR*, TCHAR** ppszFiles) +HANDLE __cdecl CIrcProto::SendFile(HCONTACT hContact, const TCHAR*, TCHAR** ppszFiles) { DCCINFO* dci = NULL; int iPort = 0; @@ -780,22 +780,22 @@ HANDLE __cdecl CIrcProto::SendFile(HANDLE hContact, const TCHAR*, TCHAR** ppszFi struct TFakeAckParam { - __inline TFakeAckParam(HANDLE _hContact, int _msgid) : + __inline TFakeAckParam(HCONTACT _hContact, int _msgid) : hContact(_hContact), msgid(_msgid) {} - HANDLE hContact; + HCONTACT hContact; int msgid; }; void __cdecl CIrcProto::AckMessageFail(void *info) { - ProtoBroadcastAck(info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("The protocol is not online")); + ProtoBroadcastAck((HCONTACT)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("The protocol is not online")); } void __cdecl CIrcProto::AckMessageFailDcc(void *info) { - ProtoBroadcastAck(info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("The dcc chat connection is not active")); + ProtoBroadcastAck((HCONTACT)info, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)Translate("The dcc chat connection is not active")); } void __cdecl CIrcProto::AckMessageSuccess(void *info) @@ -805,7 +805,7 @@ void __cdecl CIrcProto::AckMessageSuccess(void *info) delete param; } -int __cdecl CIrcProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc) +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); @@ -846,7 +846,7 @@ int __cdecl CIrcProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc) //////////////////////////////////////////////////////////////////////////////////////// // SendUrl -int __cdecl CIrcProto::SendUrl(HANDLE, int, const char*) +int __cdecl CIrcProto::SendUrl(HCONTACT, int, const char*) { return 1; } @@ -854,7 +854,7 @@ int __cdecl CIrcProto::SendUrl(HANDLE, int, const char*) //////////////////////////////////////////////////////////////////////////////////////// // SetApparentMode - sets the visibility status -int __cdecl CIrcProto::SetApparentMode(HANDLE, int) +int __cdecl CIrcProto::SetApparentMode(HCONTACT, int) { return 0; } @@ -936,7 +936,7 @@ int CIrcProto::SetStatusInternal(int iNewStatus, bool bIsInternal) //////////////////////////////////////////////////////////////////////////////////////// // GetAwayMsg - returns a contact's away message -HANDLE __cdecl CIrcProto::GetAwayMsg(HANDLE hContact) +HANDLE __cdecl CIrcProto::GetAwayMsg(HCONTACT hContact) { WhoisAwayReply = _T(""); DBVARIANT dbv; @@ -963,7 +963,7 @@ HANDLE __cdecl CIrcProto::GetAwayMsg(HANDLE hContact) //////////////////////////////////////////////////////////////////////////////////////// // PSR_AWAYMSG -int __cdecl CIrcProto::RecvAwayMsg(HANDLE, int, PROTORECVEVENT*) +int __cdecl CIrcProto::RecvAwayMsg(HCONTACT, int, PROTORECVEVENT*) { return 1; } @@ -998,7 +998,7 @@ int __cdecl CIrcProto::SetAwayMsg(int status, const TCHAR* msg) ///////////////////////////////////////////////////////////////////////////////////////// // UserIsTyping - sends a UTN notification -int __cdecl CIrcProto::UserIsTyping(HANDLE, int) +int __cdecl CIrcProto::UserIsTyping(HCONTACT, int) { return 0; } diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp index e472e2259f..84dfcc8203 100644 --- a/protocols/IRCG/src/scripting.cpp +++ b/protocols/IRCG/src/scripting.cpp @@ -188,7 +188,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) else if (sRequest == "usercount" && !sChannel.IsEmpty()) { CMString S = MakeWndID(sChannel.c_str()); GC_INFO gci = { 0 }; - gci.Flags = BYID | COUNT; + gci.Flags = GCF_BYID | GCF_COUNT; gci.pszModule = m_szModuleName; gci.pszID = S.c_str(); if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) { @@ -200,7 +200,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) else if (sRequest == "userlist" && !sChannel.IsEmpty()) { CMString S = MakeWndID(sChannel.c_str()); GC_INFO gci = { 0 }; - gci.Flags = BYID | USERS; + gci.Flags = GCF_BYID | GCF_USERS; gci.pszModule = m_szModuleName; gci.pszID = S.c_str(); if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) @@ -213,7 +213,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) int j = 0; while (j < i) { GC_INFO gci = { 0 }; - gci.Flags = BYINDEX | ID; + gci.Flags = GCF_BYINDEX | GCF_ID; gci.pszModule = m_szModuleName; gci.iItem = j; if (!CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) { diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 2fe0fd2c81..8e82c02da0 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -90,7 +90,7 @@ void CIrcProto::InitMainMenus(void) static HGENMENU hUMenuChanSettings, hUMenuWhois, hUMenuDisconnect, hUMenuIgnore; static HANDLE hMenuChanSettings, hMenuWhois, hMenuDisconnect, hMenuIgnore; -static CIrcProto* IrcGetInstanceByHContact(HANDLE hContact) +static CIrcProto* IrcGetInstanceByHContact(HCONTACT hContact) { char* szProto = GetContactProto(hContact); if (szProto == NULL) @@ -105,25 +105,25 @@ static CIrcProto* IrcGetInstanceByHContact(HANDLE hContact) static INT_PTR IrcMenuChanSettings(WPARAM wParam, LPARAM lParam) { - CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam); + CIrcProto *ppro = IrcGetInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->OnMenuChanSettings(wParam, lParam) : 0; } static INT_PTR IrcMenuWhois(WPARAM wParam, LPARAM lParam) { - CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam); + CIrcProto *ppro = IrcGetInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->OnMenuWhois(wParam, lParam) : 0; } static INT_PTR IrcMenuDisconnect(WPARAM wParam, LPARAM lParam) { - CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam); + CIrcProto *ppro = IrcGetInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->OnMenuDisconnect(wParam, lParam) : 0; } static INT_PTR IrcMenuIgnore(WPARAM wParam, LPARAM lParam) { - CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam); + CIrcProto *ppro = IrcGetInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->OnMenuIgnore(wParam, lParam) : 0; } @@ -134,7 +134,7 @@ int IrcPrebuildContactMenu(WPARAM wParam, LPARAM lParam) Menu_ShowItem(hUMenuDisconnect, false); Menu_ShowItem(hUMenuIgnore, false); - CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam); + CIrcProto *ppro = IrcGetInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->OnMenuPreBuild(wParam, lParam) : 0; } @@ -196,7 +196,7 @@ INT_PTR __cdecl CIrcProto::OnDoubleclicked(WPARAM, LPARAM lParam) CLISTEVENT* pcle = (CLISTEVENT*)lParam; - if (getByte((HANDLE)pcle->hContact, "DCC", 0) != 0) { + if (getByte(pcle->hContact, "DCC", 0) != 0) { DCCINFO* pdci = (DCCINFO*)pcle->lParam; CMessageBoxDlg* dlg = new CMessageBoxDlg(this, pdci); dlg->Show(); @@ -213,7 +213,7 @@ INT_PTR __cdecl CIrcProto::OnDoubleclicked(WPARAM, LPARAM lParam) int __cdecl CIrcProto::OnContactDeleted(WPARAM wp, LPARAM) { - HANDLE hContact = (HANDLE)wp; + HCONTACT hContact = (HCONTACT)wp; if (!hContact) return 0; @@ -233,9 +233,9 @@ int __cdecl CIrcProto::OnContactDeleted(WPARAM wp, LPARAM) PostIrcMessage(_T("/PART %s %s"), dbv.ptszVal, m_userInfo); } else { - BYTE bDCC = getByte((HANDLE)wp, "DCC", 0); + BYTE bDCC = getByte((HCONTACT)wp, "DCC", 0); if (bDCC) { - CDccSession* dcc = FindDCCSession((HANDLE)wp); + CDccSession* dcc = FindDCCSession((HCONTACT)wp); if (dcc) dcc->Disconnect(); } @@ -252,8 +252,8 @@ INT_PTR __cdecl CIrcProto::OnJoinChat(WPARAM wp, LPARAM) return 0; DBVARIANT dbv; - if (!getTString((HANDLE)wp, "Nick", &dbv)) { - if (getByte((HANDLE)wp, "ChatRoom", 0) == GCW_CHATROOM) + if (!getTString((HCONTACT)wp, "Nick", &dbv)) { + if (getByte((HCONTACT)wp, "ChatRoom", 0) == GCW_CHATROOM) PostIrcMessage(_T("/JOIN %s"), dbv.ptszVal); db_free(&dbv); } @@ -266,8 +266,8 @@ INT_PTR __cdecl CIrcProto::OnLeaveChat(WPARAM wp, LPARAM) return 0; DBVARIANT dbv; - if (!getTString((HANDLE)wp, "Nick", &dbv)) { - if (getByte((HANDLE)wp, "ChatRoom", 0) == GCW_CHATROOM) { + if (!getTString((HCONTACT)wp, "Nick", &dbv)) { + if (getByte((HCONTACT)wp, "ChatRoom", 0) == GCW_CHATROOM) { PostIrcMessage(_T("/PART %s %s"), dbv.ptszVal, m_userInfo); CMString S = MakeWndID(dbv.ptszVal); @@ -285,7 +285,7 @@ INT_PTR __cdecl CIrcProto::OnMenuChanSettings(WPARAM wp, LPARAM) if (!wp) return 0; - HANDLE hContact = (HANDLE)wp; + HCONTACT hContact = (HCONTACT)wp; DBVARIANT dbv; if (!getTString(hContact, "Nick", &dbv)) { PostIrcMessageWnd(dbv.ptszVal, NULL, _T("/CHANNELMANAGER")); @@ -301,7 +301,7 @@ INT_PTR __cdecl CIrcProto::OnMenuWhois(WPARAM wp, LPARAM) DBVARIANT dbv; - if (!getTString((HANDLE)wp, "Nick", &dbv)) { + if (!getTString((HCONTACT)wp, "Nick", &dbv)) { PostIrcMessage(_T("/WHOIS %s %s"), dbv.ptszVal, dbv.ptszVal); db_free(&dbv); } @@ -310,7 +310,7 @@ INT_PTR __cdecl CIrcProto::OnMenuWhois(WPARAM wp, LPARAM) INT_PTR __cdecl CIrcProto::OnMenuDisconnect(WPARAM wp, LPARAM) { - CDccSession* dcc = FindDCCSession((HANDLE)wp); + CDccSession* dcc = FindDCCSession((HCONTACT)wp); if (dcc) dcc->Disconnect(); return 0; @@ -321,7 +321,7 @@ INT_PTR __cdecl CIrcProto::OnMenuIgnore(WPARAM wp, LPARAM) if (!wp) return 0; - HANDLE hContact = (HANDLE)wp; + HCONTACT hContact = (HCONTACT)wp; DBVARIANT dbv; if (!getTString(hContact, "Nick", &dbv)) { if (!isChatRoom(hContact)) { @@ -865,7 +865,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) if (gcmi->Type == MENU_ON_NICKLIST) { CONTACT user = { (TCHAR*)gcmi->pszUID, NULL, NULL, false, false, false }; - HANDLE hContact = CList_FindContact(&user); + HCONTACT hContact = CList_FindContact(&user); gcmi->nItems = SIZEOF(nickItems); gcmi->Item = nickItems; @@ -934,7 +934,7 @@ int __cdecl CIrcProto::OnPreShutdown(WPARAM, LPARAM) int __cdecl CIrcProto::OnMenuPreBuild(WPARAM wParam, LPARAM) { DBVARIANT dbv; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; @@ -978,7 +978,7 @@ int __cdecl CIrcProto::OnMenuPreBuild(WPARAM wParam, LPARAM) int __cdecl CIrcProto::OnDbSettingChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL || !IsConnected()) return 0; diff --git a/protocols/IRCG/src/ui_utils.cpp b/protocols/IRCG/src/ui_utils.cpp index 2e6943b123..a62a7fbc5d 100644 --- a/protocols/IRCG/src/ui_utils.cpp +++ b/protocols/IRCG/src/ui_utils.cpp @@ -629,7 +629,7 @@ BOOL CCtrlClc::OnNotify(int, NMHDR *pnmh) return FALSE; } -void CCtrlClc::AddContact(HANDLE hContact) +void CCtrlClc::AddContact(HCONTACT hContact) { SendMessage(m_hwnd, CLM_ADDCONTACT, (WPARAM)hContact, 0); } @@ -661,7 +661,7 @@ void CCtrlClc::Expand(HANDLE hItem, DWORD flags) { SendMessage(m_hwnd, CLM_EXPAND, (WPARAM)hItem, flags); } -HANDLE CCtrlClc::FindContact(HANDLE hContact) +HANDLE CCtrlClc::FindContact(HCONTACT hContact) { return (HANDLE)SendMessage(m_hwnd, CLM_FINDCONTACT, (WPARAM)hContact, 0); } diff --git a/protocols/IRCG/src/ui_utils.h b/protocols/IRCG/src/ui_utils.h index b5fe9dadb4..c42ea6a668 100644 --- a/protocols/IRCG/src/ui_utils.h +++ b/protocols/IRCG/src/ui_utils.h @@ -409,7 +409,7 @@ class CCtrlClc: public CCtrlBase public: CCtrlClc( CDlgBase* dlg, int ctrlId ); - void AddContact(HANDLE hContact); + void AddContact(HCONTACT hContact); void AddGroup(HANDLE hGroup); void AutoRebuild(); void DeleteItem(HANDLE hItem); @@ -417,7 +417,7 @@ public: void EndEditLabel(bool save); void EnsureVisible(HANDLE hItem, bool partialOk); void Expand(HANDLE hItem, DWORD flags); - HANDLE FindContact(HANDLE hContact); + HANDLE FindContact(HCONTACT hContact); HANDLE FindGroup(HANDLE hGroup); COLORREF GetBkColor(); bool GetCheck(HANDLE hItem); diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index 7ed1fc12a0..dc4a5c8b14 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -26,13 +26,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct UserDetailsDlgProcParam { - UserDetailsDlgProcParam( CIrcProto* _pro, HANDLE _info ) : - ppro( _pro ), - hContact( _info ) + UserDetailsDlgProcParam(CIrcProto* _pro, HCONTACT _info) : + ppro(_pro), + hContact(_info) {} CIrcProto *ppro; - HANDLE hContact; + HCONTACT hContact; }; #define STR_BASIC LPGEN("Faster! Searches the network for an exact match of the nickname only. The hostmask is optional and provides further security if used. Wildcards (? and *) are allowed.") @@ -45,7 +45,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM UserDetailsDlgProcParam *p = (UserDetailsDlgProcParam*)GetWindowLongPtr(m_hwnd, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: - p = new UserDetailsDlgProcParam(NULL, (HANDLE)lParam); + p = new UserDetailsDlgProcParam(NULL, (HCONTACT)lParam); SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LPARAM)p); break; @@ -188,7 +188,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM int __cdecl CIrcProto::OnInitUserInfo(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)lParam; + HCONTACT hContact = (HCONTACT)lParam; char *szProto = GetContactProto(hContact); if (!hContact || !szProto || lstrcmpiA(szProto, m_szModuleName)) return 0; diff --git a/protocols/IcqOscarJ/src/UI/askauthentication.cpp b/protocols/IcqOscarJ/src/UI/askauthentication.cpp index 818d5ce6de..76e290f704 100644 --- a/protocols/IcqOscarJ/src/UI/askauthentication.cpp +++ b/protocols/IcqOscarJ/src/UI/askauthentication.cpp @@ -32,7 +32,7 @@ struct AskAuthParam { CIcqProto* ppro; - HANDLE hContact; + HCONTACT hContact; }; static INT_PTR CALLBACK AskAuthProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -90,7 +90,7 @@ static INT_PTR CALLBACK AskAuthProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA INT_PTR CIcqProto::RequestAuthorization(WPARAM wParam, LPARAM lParam) { - AskAuthParam param = { this, (HANDLE)wParam }; + AskAuthParam param = { this, (HCONTACT)wParam }; DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_ASKAUTH), NULL, AskAuthProc, (LPARAM)¶m); return 0; } diff --git a/protocols/IcqOscarJ/src/UI/userinfotab.cpp b/protocols/IcqOscarJ/src/UI/userinfotab.cpp index 04c785fc87..1c0bcb67f4 100644 --- a/protocols/IcqOscarJ/src/UI/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/UI/userinfotab.cpp @@ -41,7 +41,7 @@ extern const char *nameXStatus[]; ///////////////////////////////////////////////////////////////////////////////////////// -static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, HANDLE hContact, char* szModule, char* szSetting, int special) +static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, HCONTACT hContact, char* szModule, char* szSetting, int special) { DBVARIANT dbv = {0}; char str[MAX_PATH]; @@ -221,7 +221,7 @@ static INT_PTR CALLBACK IcqDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; char* szProto; - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; if (hContact == NULL) szProto = ppro->m_szModuleName; @@ -284,7 +284,7 @@ static INT_PTR CALLBACK IcqDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) { - if ((!IsICQContact((HANDLE)lParam)) && lParam) + if ((!IsICQContact((HCONTACT)lParam)) && lParam) return 0; OPTIONSDIALOGPAGE odp = { sizeof(odp) }; diff --git a/protocols/IcqOscarJ/src/capabilities.cpp b/protocols/IcqOscarJ/src/capabilities.cpp index e1b8b47a94..91e464b561 100644 --- a/protocols/IcqOscarJ/src/capabilities.cpp +++ b/protocols/IcqOscarJ/src/capabilities.cpp @@ -102,14 +102,14 @@ void NetLog_CapabilityChange(CIcqProto *ppro, const char *szChange, DWORD fdwCap // Deletes all oscar capabilities for a given contact -void CIcqProto::ClearAllContactCapabilities(HANDLE hContact) +void CIcqProto::ClearAllContactCapabilities(HCONTACT hContact) { setDword(hContact, DBSETTING_CAPABILITIES, 0); } // Deletes one or many oscar capabilities for a given contact -void CIcqProto::ClearContactCapabilities(HANDLE hContact, DWORD fdwCapabilities) +void CIcqProto::ClearContactCapabilities(HCONTACT hContact, DWORD fdwCapabilities) { // Get current capability flags DWORD fdwContactCaps = getDword(hContact, DBSETTING_CAPABILITIES, 0); @@ -129,7 +129,7 @@ void CIcqProto::ClearContactCapabilities(HANDLE hContact, DWORD fdwCapabilities) // Sets one or many oscar capabilities for a given contact -void CIcqProto::SetContactCapabilities(HANDLE hContact, DWORD fdwCapabilities) +void CIcqProto::SetContactCapabilities(HCONTACT hContact, DWORD fdwCapabilities) { // Get current capability flags DWORD fdwContactCaps = getDword(hContact, DBSETTING_CAPABILITIES, 0); @@ -149,7 +149,7 @@ void CIcqProto::SetContactCapabilities(HANDLE hContact, DWORD fdwCapabilities) // Returns true if the given contact supports the requested capabilites -BOOL CIcqProto::CheckContactCapabilities(HANDLE hContact, DWORD fdwCapabilities) +BOOL CIcqProto::CheckContactCapabilities(HCONTACT hContact, DWORD fdwCapabilities) { // Get current capability flags DWORD fdwContactCaps = getDword(hContact, DBSETTING_CAPABILITIES, 0); @@ -218,7 +218,7 @@ DWORD GetCapabilitiesFromBuffer(BYTE *pBuffer, int nLength) // Scans a binary buffer for oscar capabilities and adds them to the contact. // You probably want to call ClearAllContactCapabilities() first. -void CIcqProto::AddCapabilitiesFromBuffer(HANDLE hContact, BYTE *pBuffer, int nLength) +void CIcqProto::AddCapabilitiesFromBuffer(HCONTACT hContact, BYTE *pBuffer, int nLength) { // Get current capability flags DWORD fdwContactCaps = getDword(hContact, DBSETTING_CAPABILITIES, 0); @@ -241,7 +241,7 @@ void CIcqProto::AddCapabilitiesFromBuffer(HANDLE hContact, BYTE *pBuffer, int nL // Scans a binary buffer for oscar capabilities and adds them to the contact. // You probably want to call ClearAllContactCapabilities() first. -void CIcqProto::SetCapabilitiesFromBuffer(HANDLE hContact, BYTE *pBuffer, int nLength, BOOL bReset) +void CIcqProto::SetCapabilitiesFromBuffer(HCONTACT hContact, BYTE *pBuffer, int nLength, BOOL bReset) { // Get current capability flags DWORD fdwContactCaps = bReset ? 0 : getDword(hContact, DBSETTING_CAPABILITIES, 0); diff --git a/protocols/IcqOscarJ/src/cookies.cpp b/protocols/IcqOscarJ/src/cookies.cpp index 36aa83c329..f5e7999a77 100644 --- a/protocols/IcqOscarJ/src/cookies.cpp +++ b/protocols/IcqOscarJ/src/cookies.cpp @@ -50,7 +50,7 @@ void CIcqProto::RemoveExpiredCookies() // Generate and allocate cookie -DWORD CIcqProto::AllocateCookie(BYTE bType, WORD wIdent, HANDLE hContact, void *pvExtra) +DWORD CIcqProto::AllocateCookie(BYTE bType, WORD wIdent, HCONTACT hContact, void *pvExtra) { icq_lock l(cookieMutex); @@ -96,13 +96,12 @@ int CIcqProto::GetCookieType(DWORD dwCookie) } -int CIcqProto::FindCookie(DWORD dwCookie, HANDLE *phContact, void **ppvExtra) +int CIcqProto::FindCookie(DWORD dwCookie, HCONTACT *phContact, void **ppvExtra) { icq_lock l(cookieMutex); - int i = cookies.getIndex(( icq_cookie_info* )&dwCookie ); - if (i != INVALID_COOKIE_INDEX) - { + int i = cookies.getIndex((icq_cookie_info*)&dwCookie); + if (i != INVALID_COOKIE_INDEX) { if (phContact) *phContact = cookies[i]->hContact; if (ppvExtra) @@ -116,7 +115,7 @@ int CIcqProto::FindCookie(DWORD dwCookie, HANDLE *phContact, void **ppvExtra) } -int CIcqProto::FindCookieByData(void *pvExtra, DWORD *pdwCookie, HANDLE *phContact) +int CIcqProto::FindCookieByData(void *pvExtra, DWORD *pdwCookie, HCONTACT *phContact) { icq_lock l(cookieMutex); @@ -138,7 +137,7 @@ int CIcqProto::FindCookieByData(void *pvExtra, DWORD *pdwCookie, HANDLE *phConta } -int CIcqProto::FindCookieByType(BYTE bType, DWORD *pdwCookie, HANDLE *phContact, void** ppvExtra) +int CIcqProto::FindCookieByType(BYTE bType, DWORD *pdwCookie, HCONTACT *phContact, void** ppvExtra) { icq_lock l(cookieMutex); @@ -162,7 +161,7 @@ int CIcqProto::FindCookieByType(BYTE bType, DWORD *pdwCookie, HANDLE *phContact, } -int CIcqProto::FindMessageCookie(DWORD dwMsgID1, DWORD dwMsgID2, DWORD *pdwCookie, HANDLE *phContact, cookie_message_data **ppvExtra) +int CIcqProto::FindMessageCookie(DWORD dwMsgID1, DWORD dwMsgID2, DWORD *pdwCookie, HCONTACT *phContact, cookie_message_data **ppvExtra) { icq_lock l(cookieMutex); @@ -278,7 +277,7 @@ cookie_message_data* CIcqProto::CreateMessageCookie(WORD bMsgType, BYTE bAckType } -cookie_message_data* CIcqProto::CreateMessageCookieData(BYTE bMsgType, HANDLE hContact, DWORD dwUin, int bUseSrvRelay) +cookie_message_data* CIcqProto::CreateMessageCookieData(BYTE bMsgType, HCONTACT hContact, DWORD dwUin, int bUseSrvRelay) { BYTE bAckType; WORD wStatus = getContactStatus(hContact); diff --git a/protocols/IcqOscarJ/src/cookies.h b/protocols/IcqOscarJ/src/cookies.h index 05e0d170eb..a6017d174c 100644 --- a/protocols/IcqOscarJ/src/cookies.h +++ b/protocols/IcqOscarJ/src/cookies.h @@ -49,7 +49,7 @@ struct CIcqProto; struct icq_cookie_info { DWORD dwCookie; - HANDLE hContact; + HCONTACT hContact; void *pvExtra; time_t dwTime; BYTE bType; @@ -114,7 +114,7 @@ struct cookie_search struct cookie_avatar { DWORD dwUin; - HANDLE hContact; + HCONTACT hContact; unsigned int hashlen; BYTE *hash; unsigned int cbData; @@ -124,7 +124,7 @@ struct cookie_avatar struct cookie_reverse_connect: public cookie_message_data { - HANDLE hContact; + HCONTACT hContact; DWORD dwUin; int type; void *ft; diff --git a/protocols/IcqOscarJ/src/directpackets.cpp b/protocols/IcqOscarJ/src/directpackets.cpp index d4eb61dbc2..fa42c76c7b 100644 --- a/protocols/IcqOscarJ/src/directpackets.cpp +++ b/protocols/IcqOscarJ/src/directpackets.cpp @@ -75,7 +75,7 @@ void CIcqProto::icq_sendDirectMsgAck(directconnect* dc, WORD wCookie, BYTE bMsgT } -DWORD CIcqProto::icq_sendGetAwayMsgDirect(HANDLE hContact, int type) +DWORD CIcqProto::icq_sendGetAwayMsgDirect(HCONTACT hContact, int type) { icq_packet packet; DWORD dwCookie; @@ -123,7 +123,7 @@ void CIcqProto::icq_sendAwayMsgReplyDirect(directconnect* dc, WORD wCookie, BYTE } -void CIcqProto::icq_sendFileAcceptDirect(HANDLE hContact, filetransfer* ft) +void CIcqProto::icq_sendFileAcceptDirect(HCONTACT hContact, filetransfer* ft) { // v7 packet icq_packet packet; @@ -144,7 +144,7 @@ void CIcqProto::icq_sendFileAcceptDirect(HANDLE hContact, filetransfer* ft) } -void CIcqProto::icq_sendFileDenyDirect(HANDLE hContact, filetransfer *ft, const char *szReason) +void CIcqProto::icq_sendFileDenyDirect(HCONTACT hContact, filetransfer *ft, const char *szReason) { // v7 packet icq_packet packet; @@ -233,7 +233,7 @@ int CIcqProto::icq_sendFileSendDirectv8(filetransfer *ft, const char *pszFiles) } -DWORD CIcqProto::icq_SendDirectMessage(HANDLE hContact, const char *szMessage, int nBodyLength, WORD wPriority, cookie_message_data *pCookieData, char *szCap) +DWORD CIcqProto::icq_SendDirectMessage(HCONTACT hContact, const char *szMessage, int nBodyLength, WORD wPriority, cookie_message_data *pCookieData, char *szCap) { icq_packet packet; DWORD dwCookie = AllocateCookie(CKT_MESSAGE, 0, hContact, (void*)pCookieData); @@ -257,7 +257,7 @@ DWORD CIcqProto::icq_SendDirectMessage(HANDLE hContact, const char *szMessage, i return 0; // Failure } -void CIcqProto::icq_sendXtrazRequestDirect(HANDLE hContact, DWORD dwCookie, char* szBody, int nBodyLen, WORD wType) +void CIcqProto::icq_sendXtrazRequestDirect(HCONTACT hContact, DWORD dwCookie, char* szBody, int nBodyLen, WORD wType) { icq_packet packet; @@ -272,7 +272,7 @@ void CIcqProto::icq_sendXtrazRequestDirect(HANDLE hContact, DWORD dwCookie, char SendDirectMessage(hContact, &packet); } -void CIcqProto::icq_sendXtrazResponseDirect(HANDLE hContact, WORD wCookie, char* szBody, int nBodyLen, WORD wType) +void CIcqProto::icq_sendXtrazResponseDirect(HCONTACT hContact, WORD wCookie, char* szBody, int nBodyLen, WORD wType) { icq_packet packet; diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp index 3314f6bdef..a2f5ec6ac4 100644 --- a/protocols/IcqOscarJ/src/fam_01service.cpp +++ b/protocols/IcqOscarJ/src/fam_01service.cpp @@ -528,10 +528,10 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header } -char* CIcqProto::buildUinList(int subtype, WORD wMaxLen, HANDLE* hContactResume) +char* CIcqProto::buildUinList(int subtype, WORD wMaxLen, HCONTACT *hContactResume) { char* szList; - HANDLE hContact; + HCONTACT hContact; WORD wCurrentLen = 0; DWORD dwUIN; uid_str szUID; @@ -611,7 +611,7 @@ char* CIcqProto::buildUinList(int subtype, WORD wMaxLen, HANDLE* hContactResume) void CIcqProto::sendEntireListServ(WORD wFamily, WORD wSubtype, int listType) { - HANDLE hResumeContact = NULL; + HCONTACT hResumeContact = NULL; do { // server doesn't seem to be able to cope with packets larger than 8k diff --git a/protocols/IcqOscarJ/src/fam_02location.cpp b/protocols/IcqOscarJ/src/fam_02location.cpp index e360b9dc8b..d5d6ec590a 100644 --- a/protocols/IcqOscarJ/src/fam_02location.cpp +++ b/protocols/IcqOscarJ/src/fam_02location.cpp @@ -47,7 +47,7 @@ void CIcqProto::handleLocationFam(BYTE *pBuffer, WORD wBufferLength, snac_header case ICQ_ERROR: { WORD wError; - HANDLE hCookieContact; + HCONTACT hCookieContact; cookie_fam15_data *pCookieData; @@ -101,12 +101,10 @@ static char* AimApplyEncoding(char* pszStr, const char* pszEncoding) void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie) { - HANDLE hContact; DWORD dwUIN; uid_str szUID; WORD wTLVCount; WORD wWarningLevel; - HANDLE hCookieContact; WORD status; cookie_message_data *pCookieData; @@ -126,33 +124,30 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie wLen -= 2; // Determine contact - hContact = HContactFromUID(dwUIN, szUID, NULL); + HCONTACT hContact = HContactFromUID(dwUIN, szUID, NULL); // Ignore away status if the user is not already on our list - if (hContact == INVALID_HANDLE_VALUE) - { + if (hContact == INVALID_HANDLE_VALUE) { #ifdef _DEBUG debugLogA("Ignoring away reply (%s)", strUID(dwUIN, szUID)); #endif return; } - if (!FindCookie(dwCookie, &hCookieContact, (void**)&pCookieData)) - { + HCONTACT hCookieContact; + if (!FindCookie(dwCookie, &hCookieContact, (void**)&pCookieData)) { debugLogA("Error: Received unexpected away reply from %s", strUID(dwUIN, szUID)); return; } - if (hContact != hCookieContact) - { + if (hContact != hCookieContact) { debugLogA("Error: Away reply Contact does not match Cookie Contact(0x%x != 0x%x)", hContact, hCookieContact); ReleaseCookie(dwCookie); // This could be a bad idea, but I think it is safe return; } - switch (GetCookieType(dwCookie)) - { + switch (GetCookieType(dwCookie)) { case CKT_FAMILYSPECIAL: { ReleaseCookie(dwCookie); diff --git a/protocols/IcqOscarJ/src/fam_03buddy.cpp b/protocols/IcqOscarJ/src/fam_03buddy.cpp index 94f5e1c930..d443919e6c 100644 --- a/protocols/IcqOscarJ/src/fam_03buddy.cpp +++ b/protocols/IcqOscarJ/src/fam_03buddy.cpp @@ -196,7 +196,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) wLen -= 2; // Ignore status notification if the user is not already on our list - HANDLE hContact = HContactFromUID(dwUIN, szUID, NULL); + HCONTACT hContact = HContactFromUID(dwUIN, szUID, NULL); if (hContact == INVALID_HANDLE_VALUE) { #ifdef _DEBUG @@ -618,7 +618,7 @@ void CIcqProto::handleUserOffline(BYTE *buf, WORD wLen) } // Determine contact - HANDLE hContact = HContactFromUID(dwUIN, szUID, NULL); + HCONTACT hContact = HContactFromUID(dwUIN, szUID, NULL); // Skip contacts that are not already on our list or are already offline if (hContact != INVALID_HANDLE_VALUE) @@ -666,7 +666,7 @@ void CIcqProto::handleUserOffline(BYTE *buf, WORD wLen) } -void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, HANDLE hContact, oscar_tlv_chain *pChain) +void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, HCONTACT hContact, oscar_tlv_chain *pChain) { DWORD dwStatusNoteTS = time(NULL); BYTE *pStatusNoteTS, *pStatusNote; diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index ed84dad0dc..bd53d9c045 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -200,7 +200,7 @@ void CIcqProto::handleRecvServMsg(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwRef } -char* CIcqProto::convertMsgToUserSpecificUtf(HANDLE hContact, const char *szMsg) +char* CIcqProto::convertMsgToUserSpecificUtf(HCONTACT hContact, const char *szMsg) { WORD wCP = getWord(hContact, "CodePage", m_wAnsiCodepage); char *usMsg = NULL; @@ -268,7 +268,7 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char * PROTORECVEVENT pre = {0}; int bAdded; - HANDLE hContact = HContactFromUID(dwUin, szUID, &bAdded); + HCONTACT hContact = HContactFromUID(dwUin, szUID, &bAdded); while (pMessageTLV = pChain->getTLV(0x0101, wMsgPart)) { // Loop thru all message parts @@ -468,7 +468,7 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * if (CompareGUIDs(q1,q2,q3,q4, MCAP_SRV_RELAY_FMT)) { // we surely have at least 4 bytes for TLV chain - HANDLE hContact = HContactFromUID(dwUin, szUID, NULL); + HCONTACT hContact = HContactFromUID(dwUin, szUID, NULL); if (wCommand == 1) { @@ -575,7 +575,7 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * unpackLEDWord(&buf, &dwUin); - HANDLE hContact = HContactFromUIN(dwUin, NULL); + HCONTACT hContact = HContactFromUIN(dwUin, NULL); if (hContact == INVALID_HANDLE_VALUE) { debugLogA("Error: %s from unknown contact %u", "Reverse Connect Request", dwUin); @@ -648,7 +648,7 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * } -void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wAckType) +void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HCONTACT hContact, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wAckType) { WORD wId; @@ -886,7 +886,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D } -void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wAckType, BYTE bFlags, WORD wStatus, WORD wCookie, WORD wVersion) +void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, WORD wLen, HCONTACT hContact, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wAckType, BYTE bFlags, WORD wStatus, WORD wCookie, WORD wVersion) { int nTypeId; WORD wFunction; @@ -1020,7 +1020,7 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, WORD wLen, HANDLE hCont void CIcqProto::handleRecvServMsgContacts(BYTE *buf, WORD wLen, DWORD dwUin, char *szUID, DWORD dwID1, DWORD dwID2, WORD wCommand) { - HANDLE hContact = HContactFromUID(dwUin, szUID, NULL); + HCONTACT hContact = HContactFromUID(dwUin, szUID, NULL); if (wCommand == 0) { // received contacts @@ -1231,10 +1231,8 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, WORD wLen, DWORD dwUin, cha else if (wCommand == 2) { // acknowledgement DWORD dwCookie; - HANDLE hCookieContact; - - if (FindMessageCookie(dwID1, dwID2, &dwCookie, &hCookieContact, NULL)) - { + HCONTACT hCookieContact; + if (FindMessageCookie(dwID1, dwID2, &dwCookie, &hCookieContact, NULL)) { if (hCookieContact != hContact) debugLogA("Warning: Ack Contact does not match Cookie Contact(0x%x != 0x%x)", hContact, hCookieContact); @@ -1242,8 +1240,7 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, WORD wLen, DWORD dwUin, cha ReleaseCookie(dwCookie); } - else - debugLogA("Warning: Unexpected Contact Transfer ack from %s", strUID(dwUin, szUID)); + else debugLogA("Warning: Unexpected Contact Transfer ack from %s", strUID(dwUin, szUID)); } } @@ -1622,7 +1619,7 @@ void packPluginTypeId(icq_packet *packet, int nTypeID) } -void CIcqProto::handleStatusMsgReply(const char *szPrefix, HANDLE hContact, DWORD dwUin, WORD wVersion, int bMsgType, WORD wCookie, const char *szMsg, int nMsgFlags) +void CIcqProto::handleStatusMsgReply(const char *szPrefix, HCONTACT hContact, DWORD dwUin, WORD wVersion, int bMsgType, WORD wCookie, const char *szMsg, int nMsgFlags) { if (hContact == INVALID_HANDLE_VALUE) { debugLogA("%sIgnoring status message from unknown contact %u", szPrefix, dwUin); @@ -1652,10 +1649,10 @@ HANDLE CIcqProto::handleMessageAck(DWORD dwUin, char *szUID, WORD wCookie, WORD { if (bFlags == 3) { - HANDLE hCookieContact; + HCONTACT hCookieContact; cookie_message_data *pCookieData = NULL; - HANDLE hContact = HContactFromUID(dwUin, szUID, NULL); + HCONTACT hContact = HContactFromUID(dwUin, szUID, NULL); if (!FindCookie(wCookie, &hCookieContact, (void**)&pCookieData)) { @@ -1687,7 +1684,7 @@ HANDLE CIcqProto::handleMessageAck(DWORD dwUin, char *szUID, WORD wCookie, WORD /* this function send all acks from handleMessageTypes */ -void CIcqProto::sendMessageTypesAck(HANDLE hContact, int bUnicode, message_ack_params *pArgs) +void CIcqProto::sendMessageTypesAck(HCONTACT hContact, int bUnicode, message_ack_params *pArgs) { if (pArgs) { @@ -1712,7 +1709,7 @@ void CIcqProto::sendMessageTypesAck(HANDLE hContact, int bUnicode, message_ack_p /* pMsg points to the beginning of the message */ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, DWORD dwMsgID, DWORD dwMsgID2, WORD wCookie, WORD wVersion, int type, int flags, WORD wAckType, DWORD dwDataLen, WORD wMsgLen, char *pMsg, int nMsgFlags, message_ack_params *pAckParams) { - HANDLE hContact = INVALID_HANDLE_VALUE; + HCONTACT hContact = (HCONTACT)INVALID_HANDLE_VALUE; BOOL bThruDC = (nMsgFlags & MTF_DIRECT) == MTF_DIRECT; int bAdded; @@ -2189,7 +2186,6 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d WORD bMsgType = 0; BYTE bFlags; WORD wLength; - HANDLE hCookieContact; DWORD dwMsgID1, dwMsgID2; WORD wVersion = 0; cookie_message_data *pCookieData = NULL; @@ -2209,40 +2205,38 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d if (!unpackUID(&buf, &wLen, &dwUin, &szUid)) return; - HANDLE hContact = HContactFromUID(dwUin, szUid, NULL); + HCONTACT hContact = HContactFromUID(dwUin, szUid, NULL); buf += 2; // 3. unknown wLen -= 2; - if (!FindMessageCookie(dwMsgID1, dwMsgID2, &dwCookie, &hCookieContact, &pCookieData)) - { + HCONTACT hCookieContact; + if (!FindMessageCookie(dwMsgID1, dwMsgID2, &dwCookie, &hCookieContact, &pCookieData)) { debugLogA("SNAC(4.B) Received an ack that I did not ask for from (%u)", dwUin); return; } - if (IsValidOscarTransfer(pCookieData)) - { // it is OFT response + if (IsValidOscarTransfer(pCookieData)) { + // it is OFT response handleRecvServResponseOFT(buf, wLen, dwUin, szUid, pCookieData); return; } - if (!dwUin) - { // AIM cannot send this - just sanity + if (!dwUin) { + // AIM cannot send this - just sanity debugLogA("Error: Invalid UID in message response."); return; } // Length of sub chunk? - if (wLen >= 2) - { + if (wLen >= 2) { unpackLEWord(&buf, &wLength); wLen -= 2; } - else - wLength = 0; + else wLength = 0; - if (wLength == 0x1b && pCookieData->bMessageType != MTYPE_REVERSE_REQUEST) - { // this can be v8 greeting message reply + if (wLength == 0x1b && pCookieData->bMessageType != MTYPE_REVERSE_REQUEST) { + // this can be v8 greeting message reply WORD wCookie; unpackLEWord(&buf, &wVersion); @@ -2270,8 +2264,8 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d buf += 2; wLen -= 2; - if (!FindCookie(wCookie, &hCookieContact, (void**)&pCookieData)) - { // use old reliable method + if (!FindCookie(wCookie, &hCookieContact, (void**)&pCookieData)) { + // use old reliable method debugLogA("Warning: Invalid cookie in %s from (%u)", "message response", dwUin); if (pCookieData->bMessageType != MTYPE_AUTOAWAY && bFlags == 3) @@ -2282,8 +2276,8 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d debugLogA("Warning: Invalid message type in %s from (%u)", "message response", dwUin); } } - else if (bMsgType != MTYPE_PLUGIN && pCookieData->bMessageType != MTYPE_AUTOAWAY) - { // just because some clients break it... + else if (bMsgType != MTYPE_PLUGIN && pCookieData->bMessageType != MTYPE_AUTOAWAY) { + // just because some clients break it... dwCookie = wCookie; if (bMsgType != pCookieData->bMessageType) @@ -2291,45 +2285,35 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d bMsgType = pCookieData->bMessageType; } - else if (pCookieData->bMessageType == MTYPE_AUTOAWAY && bMsgType != MTYPE_PLUGIN) - { + else if (pCookieData->bMessageType == MTYPE_AUTOAWAY && bMsgType != MTYPE_PLUGIN) { if (bMsgType != pCookieData->nAckType) debugLogA("Warning: Invalid message type in %s from (%u)", "message response", dwUin); } } - else - { + else { bMsgType = pCookieData->bMessageType; bFlags = 0; } - if (hCookieContact != hContact) - { + if (hCookieContact != hContact) { debugLogA("SNAC(4.B) Ack Contact does not match Cookie Contact(0x%x != 0x%x)", hContact, hCookieContact); - ReleaseCookie(dwCookie); // This could be a bad idea, but I think it is safe return; } if (bFlags == 3) // A status message reply - { handleStatusMsgReply("SNAC(4.B) ", hContact, dwUin, wVersion, bMsgType, (WORD)dwCookie, (char*)(buf + 2), 0); - } - else - { // An ack of some kind + else { + // An ack of some kind int ackType; - - if (hContact == NULL || hContact == INVALID_HANDLE_VALUE) - { + if (hContact == NULL || hContact == INVALID_HANDLE_VALUE) { debugLogA("SNAC(4.B) Message from unknown contact (%u)", dwUin); - ReleaseCookie(dwCookie); // This could be a bad idea, but I think it is safe return; } switch (bMsgType) { - case MTYPE_FILEREQ: { char* szMsg; @@ -2340,8 +2324,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d wLen -= 2; szMsg = (char *)_alloca(wMsgLen + 1); szMsg[wMsgLen] = '\0'; - if (wMsgLen > 0) - { + if (wMsgLen > 0) { memcpy(szMsg, buf, wMsgLen); buf += wMsgLen; wLen -= wMsgLen; @@ -2361,8 +2344,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d WORD wFunctionId; - if (wLength != 0x1B) - { + if (wLength != 0x1B) { debugLogA("Invalid Greeting %s", "message response"); ReleaseCookie(dwCookie); @@ -2378,22 +2360,18 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d wLen -= wMsgLen; // This packet is malformed. Possibly a file accept from Miranda IM 0.1.2.1 - if (wLen < 20) - { + if (wLen < 20) { ReleaseCookie(dwCookie); return; } - if (!unpackPluginTypeId(&buf, &wLen, &typeId, &wFunctionId, FALSE)) - { + if (!unpackPluginTypeId(&buf, &wLen, &typeId, &wFunctionId, FALSE)) { ReleaseCookie(dwCookie); return; } - if (wLen < 4) - { + if (wLen < 4) { debugLogA("Error: Invalid greeting %s", "message response"); - ReleaseCookie(dwCookie); return; } @@ -2407,12 +2385,10 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d else dwDataLen = 0; - - switch (typeId) - { + switch (typeId) { case MTYPE_PLAIN: - if (pCookieData && pCookieData->bMessageType == MTYPE_AUTOAWAY && dwLengthToEnd >= 4) - { // ICQ 6 invented this + if (pCookieData && pCookieData->bMessageType == MTYPE_AUTOAWAY && dwLengthToEnd >= 4) { + // ICQ 6 invented this char *szMsg = (char*)_alloca(dwDataLen + 1); if (dwDataLen > 0) @@ -2423,8 +2399,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d ReleaseCookie(dwCookie); return; } - else - ackType = ACKTYPE_MESSAGE; + ackType = ACKTYPE_MESSAGE; break; case MTYPE_URL: @@ -2436,9 +2411,8 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d break; case MTYPE_FILEREQ: + debugLogA("This is file ack"); { - debugLogA("This is file ack"); - char *szMsg = (char *)_alloca(dwDataLen + 1); if (dwDataLen > 0) @@ -2537,21 +2511,18 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d } if ((ackType == MTYPE_PLAIN && pCookieData && (pCookieData->nAckType == ACKTYPE_CLIENT)) || ackType != MTYPE_PLAIN) - { ProtoBroadcastAck(hContact, ackType, ACKRESULT_SUCCESS, (HANDLE)(WORD)dwCookie, 0); - } } ReleaseCookie(dwCookie); } - // A response to a CLI_SENDMSG void CIcqProto::handleRecvServMsgError(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwSequence) { WORD wError; char *pszErrorMessage; - HANDLE hContact; + HCONTACT hContact; cookie_message_data *pCookieData = NULL; int nMessageType; @@ -2559,13 +2530,13 @@ void CIcqProto::handleRecvServMsgError(BYTE *buf, WORD wLen, WORD wFlags, DWORD if (wLen < 2) return; - if (FindCookie((WORD)dwSequence, &hContact, (void**)&pCookieData)) - { // all packet cookies from msg family has command 0 in the queue + if (FindCookie((WORD)dwSequence, &hContact, (void**)&pCookieData)) { + // all packet cookies from msg family has command 0 in the queue DWORD dwUin; uid_str szUid; - if (getContactUid(hContact, &dwUin, &szUid)) - { // Invalid contact + if (getContactUid(hContact, &dwUin, &szUid)) { + // Invalid contact FreeCookie((WORD)dwSequence); return; } @@ -2573,8 +2544,8 @@ void CIcqProto::handleRecvServMsgError(BYTE *buf, WORD wLen, WORD wFlags, DWORD // Error code unpackWord(&buf, &wError); - if (wError == 9 && pCookieData->bMessageType == MTYPE_AUTOAWAY) - { // we failed to request away message the normal way, try it AIM way + if (wError == 9 && pCookieData->bMessageType == MTYPE_AUTOAWAY) { + // we failed to request away message the normal way, try it AIM way icq_packet packet; serverPacketInit(&packet, (WORD)(13 + getUINLen(dwUin))); @@ -2589,7 +2560,6 @@ void CIcqProto::handleRecvServMsgError(BYTE *buf, WORD wLen, WORD wFlags, DWORD // Not all of these are actually used in family 4 // This will be moved into a special error handling function later switch (wError) { - case 0x0002: // Server rate limit exceeded pszErrorMessage = Translate("You are sending too fast. Wait a while and try again.\r\nSNAC(4.1) Error x02"); break; @@ -2599,10 +2569,9 @@ void CIcqProto::handleRecvServMsgError(BYTE *buf, WORD wLen, WORD wFlags, DWORD break; case 0x0004: // Recipient is not logged in (resend in a offline message) - if (pCookieData->bMessageType == MTYPE_PLAIN) - { - if (pCookieData->isOffline) - { // offline failed - most probably to AIM contact + if (pCookieData->bMessageType == MTYPE_PLAIN) { + if (pCookieData->isOffline) { + // offline failed - most probably to AIM contact pszErrorMessage = Translate("The contact does not support receiving offline messages."); break; } @@ -2683,23 +2652,17 @@ void CIcqProto::handleRecvServMsgError(BYTE *buf, WORD wLen, WORD wFlags, DWORD } if (nMessageType != -1) - { ProtoBroadcastAck(hContact, nMessageType, ACKRESULT_FAILED, (HANDLE)(WORD)dwSequence, (LPARAM)pszErrorMessage); - } else - { debugLogA("Error: Message delivery to %u failed: %s", dwUin, pszErrorMessage); - } FreeCookie((WORD)dwSequence); if (pCookieData->bMessageType != MTYPE_FILEREQ) SAFE_FREE((void**)&pCookieData); } - else - { + else { unpackWord(&buf, &wError); - LogFamilyError(ICQ_MSG_FAMILY, wError); } } @@ -2712,9 +2675,7 @@ void CIcqProto::handleServerAck(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwSeque WORD wChannel; cookie_message_data *pCookieData; - - if (wLen < 13) - { + if (wLen < 13) { debugLogA("Ignoring SNAC(4,C) Packet to short"); return; } @@ -2729,7 +2690,7 @@ void CIcqProto::handleServerAck(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwSeque // Sender if (!unpackUID(&buf, &wLen, &dwUin, &szUID)) return; - HANDLE hContact = HContactFromUID(dwUin, szUID, NULL); + HCONTACT hContact = HContactFromUID(dwUin, szUID, NULL); if (FindCookie((WORD)dwSequence, NULL, (void**)&pCookieData)) { @@ -2928,7 +2889,7 @@ void CIcqProto::handleTypingNotification(BYTE *buf, WORD wLen, WORD wFlags, DWOR // Sender if (!unpackUID(&buf, &wLen, &dwUin, &szUid)) return; - HANDLE hContact = HContactFromUID(dwUin, szUid, NULL); + HCONTACT hContact = HContactFromUID(dwUin, szUid, NULL); if (hContact == INVALID_HANDLE_VALUE) return; @@ -2973,7 +2934,7 @@ void CIcqProto::handleTypingNotification(BYTE *buf, WORD wLen, WORD wFlags, DWOR } -void CIcqProto::sendTypingNotification(HANDLE hContact, WORD wMTNCode) +void CIcqProto::sendTypingNotification(HCONTACT hContact, WORD wMTNCode) { _ASSERTE((wMTNCode == MTN_FINISHED) || (wMTNCode == MTN_TYPED) || (wMTNCode == MTN_BEGUN) || (wMTNCode == MTN_WINDOW_CLOSED)); diff --git a/protocols/IcqOscarJ/src/fam_09bos.cpp b/protocols/IcqOscarJ/src/fam_09bos.cpp index 882ded41aa..203ba13b00 100644 --- a/protocols/IcqOscarJ/src/fam_09bos.cpp +++ b/protocols/IcqOscarJ/src/fam_09bos.cpp @@ -85,7 +85,7 @@ void CIcqProto::handlePrivacyRightsReply(unsigned char *pBuffer, WORD wBufferLen debugLogA("Warning: Malformed SRV_PRIVACY_RIGHTS_REPLY"); } -void CIcqProto::makeContactTemporaryVisible(HANDLE hContact) +void CIcqProto::makeContactTemporaryVisible(HCONTACT hContact) { DWORD dwUin; uid_str szUid; diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp index 049d3c1cab..fa83b408cd 100644 --- a/protocols/IcqOscarJ/src/fam_13servclist.cpp +++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp @@ -772,9 +772,9 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) } -HANDLE CIcqProto::HContactFromRecordName(const char* szRecordName, int *bAdded) +HCONTACT CIcqProto::HContactFromRecordName(const char* szRecordName, int *bAdded) { - HANDLE hContact = INVALID_HANDLE_VALUE; + HCONTACT hContact = (HCONTACT)INVALID_HANDLE_VALUE; if (!IsStringUIN(szRecordName)) { // probably AIM contact @@ -904,7 +904,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server case SSI_ITEM_BUDDY: { /* this is a contact */ - HANDLE hContact; + HCONTACT hContact; int bAdded; hContact = HContactFromRecordName(szRecordName, &bAdded); @@ -1172,7 +1172,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server /* item on visible list */ /* wItemId not related to contact ID */ /* pszRecordName is the UIN */ - HANDLE hContact; + HCONTACT hContact; int bAdded; hContact = HContactFromRecordName(szRecordName, &bAdded); @@ -1211,7 +1211,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server /* Item on invisible list */ /* wItemId not related to contact ID */ /* pszRecordName is the UIN */ - HANDLE hContact; + HCONTACT hContact; int bAdded; hContact = HContactFromRecordName(szRecordName, &bAdded); @@ -1269,7 +1269,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server /* item on ignore list */ /* wItemId not related to contact ID */ /* pszRecordName is the UIN */ - HANDLE hContact; + HCONTACT hContact; int bAdded; hContact = HContactFromRecordName(szRecordName, &bAdded); @@ -1471,7 +1471,7 @@ void CIcqProto::handleServerCListItemAdd(const char *szRecordName, WORD wGroupId void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGroupId, WORD wItemId, WORD wItemType, oscar_tlv_chain *pItemData) { - HANDLE hContact = (wItemType == SSI_ITEM_BUDDY || wItemType == SSI_ITEM_DENY || wItemType == SSI_ITEM_PERMIT || wItemType == SSI_ITEM_IGNORE) ? HContactFromRecordName(szRecordName, NULL) : NULL; + HCONTACT hContact = (wItemType == SSI_ITEM_BUDDY || wItemType == SSI_ITEM_DENY || wItemType == SSI_ITEM_PERMIT || wItemType == SSI_ITEM_IGNORE) ? HContactFromRecordName(szRecordName, NULL) : NULL; if (hContact != INVALID_HANDLE_VALUE && wItemType == SSI_ITEM_BUDDY) { // a contact was updated on server @@ -1586,7 +1586,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou void CIcqProto::handleServerCListItemDelete(const char *szRecordName, WORD wGroupId, WORD wItemId, WORD wItemType, oscar_tlv_chain *pItemData) { - HANDLE hContact = (wItemType == SSI_ITEM_BUDDY || wItemType == SSI_ITEM_DENY || wItemType == SSI_ITEM_PERMIT || wItemType == SSI_ITEM_IGNORE) ? HContactFromRecordName(szRecordName, NULL) : NULL; + HCONTACT hContact = (wItemType == SSI_ITEM_BUDDY || wItemType == SSI_ITEM_DENY || wItemType == SSI_ITEM_PERMIT || wItemType == SSI_ITEM_IGNORE) ? HContactFromRecordName(szRecordName, NULL) : NULL; if (hContact != INVALID_HANDLE_VALUE && wItemType == SSI_ITEM_BUDDY) { // a contact was removed from our list @@ -1632,7 +1632,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen) if (wReasonLen > wLen) return; - HANDLE hContact = HContactFromUID(dwUin, szUid, &bAdded); + HCONTACT hContact = HContactFromUID(dwUin, szUid, &bAdded); PROTORECVEVENT pre = { 0 }; pre.timestamp = time(NULL); @@ -1720,7 +1720,7 @@ void CIcqProto::handleRecvAdded(unsigned char *buf, WORD wLen) return; } - HANDLE hContact = HContactFromUID(dwUin, szUid, &bAdded); + HCONTACT hContact = HContactFromUID(dwUin, szUid, &bAdded); cbBlob=sizeof(DWORD)*2+4; @@ -1782,7 +1782,7 @@ void CIcqProto::handleRecvAuthResponse(unsigned char *buf, WORD wLen) return; } - HANDLE hContact = HContactFromUID(dwUin, szUid, &bAdded); + HCONTACT hContact = HContactFromUID(dwUin, szUid, &bAdded); if (hContact != INVALID_HANDLE_VALUE) szNick = NickFromHandle(hContact); diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp index 327e6cbc35..78759c03d8 100644 --- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp +++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp @@ -88,7 +88,7 @@ void CIcqProto::handleExtensionError(BYTE *buf, WORD wPackLen) // more sofisticated detection, send ack if (wSubType == META_REQUEST_FULL_INFO) { - HANDLE hContact; + HCONTACT hContact; cookie_fam15_data *pCookieData = NULL; int foundCookie = FindCookie(wCookie, &hContact, (void**)&pCookieData); @@ -578,7 +578,7 @@ UserInfoRecordItem rInterest[] = { }; -int CIcqProto::parseUserInfoRecord(HANDLE hContact, oscar_tlv *pData, UserInfoRecordItem pRecordDef[], int nRecordDef, int nMaxRecords) +int CIcqProto::parseUserInfoRecord(HCONTACT hContact, oscar_tlv *pData, UserInfoRecordItem pRecordDef[], int nRecordDef, int nMaxRecords) { int nRecords = 0; @@ -648,7 +648,7 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, WORD wPacketLen, WOR } cookie_directory_data *pCookieData; - HANDLE hContact; + HCONTACT hContact; // check request cookie if (!FindCookie(wCookie, &hContact, (void**)&pCookieData) || !pCookieData) { @@ -843,7 +843,7 @@ static int calcAgeFromBirthDate(double dDate) } -void CIcqProto::parseDirectoryUserDetailsData(HANDLE hContact, oscar_tlv_chain *cDetails, DWORD dwCookie, cookie_directory_data *pCookieData, WORD wReplySubType) +void CIcqProto::parseDirectoryUserDetailsData(HCONTACT hContact, oscar_tlv_chain *cDetails, DWORD dwCookie, cookie_directory_data *pCookieData, WORD wReplySubType) { oscar_tlv *pTLV; WORD wRecordCount; @@ -1152,7 +1152,7 @@ void CIcqProto::handleDirectoryUpdateResponse(BYTE *databuf, WORD wPacketLen, WO } cookie_directory_data *pCookieData; - HANDLE hContact; + HCONTACT hContact; // check request cookie if (!FindCookie(wCookie, &hContact, (void**)&pCookieData) || !pCookieData) { diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index f5eb6ce4e0..a8eba258f9 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -205,7 +205,7 @@ BYTE* calcMD5HashOfFile(const TCHAR *tszFile) } -int CIcqProto::IsAvatarChanged(HANDLE hContact, const BYTE *pHash, int nHashLen) +int CIcqProto::IsAvatarChanged(HCONTACT hContact, const BYTE *pHash, int nHashLen) { DBVARIANT dbvSaved = {0}; @@ -451,7 +451,7 @@ void CIcqProto::handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, BY // handle Contact's avatar hash -void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContact, BYTE *pHash, int nHashLen, WORD wOldStatus) +void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HCONTACT hContact, BYTE *pHash, int nHashLen, WORD wOldStatus) { int bJob = FALSE; BOOL avatarInfoPresent = FALSE; @@ -696,7 +696,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac // request avatar data from server -int CIcqProto::GetAvatarData(HANDLE hContact, DWORD dwUin, const char *szUid, const BYTE *hash, unsigned int hashlen, const TCHAR *file) +int CIcqProto::GetAvatarData(HCONTACT hContact, DWORD dwUin, const char *szUid, const BYTE *hash, unsigned int hashlen, const TCHAR *file) { uid_str szUidData; char *pszUid = NULL; @@ -803,7 +803,7 @@ int CIcqProto::GetAvatarData(HANDLE hContact, DWORD dwUin, const char *szUid, co // upload avatar data to server -int CIcqProto::SetAvatarData(HANDLE hContact, WORD wRef, const BYTE *data, unsigned int datalen) +int CIcqProto::SetAvatarData(HCONTACT hContact, WORD wRef, const BYTE *data, unsigned int datalen) { m_avatarsMutex->Enter(); @@ -958,7 +958,7 @@ void avatars_server_connection::shutdownConnection() Netlib_Shutdown(hConnection); } -DWORD avatars_server_connection::sendGetAvatarRequest(HANDLE hContact, DWORD dwUin, char *szUid, const BYTE *hash, unsigned int hashlen, const TCHAR *file) +DWORD avatars_server_connection::sendGetAvatarRequest(HCONTACT hContact, DWORD dwUin, char *szUid, const BYTE *hash, unsigned int hashlen, const TCHAR *file) { int i; DWORD dwNow = GetTickCount(); @@ -1055,7 +1055,7 @@ DWORD avatars_server_connection::sendGetAvatarRequest(HANDLE hContact, DWORD dwU } -DWORD avatars_server_connection::sendUploadAvatarRequest(HANDLE hContact, WORD wRef, const BYTE *data, unsigned int datalen) +DWORD avatars_server_connection::sendUploadAvatarRequest(HCONTACT hContact, WORD wRef, const BYTE *data, unsigned int datalen) { cookie_avatar *ack = (cookie_avatar*)SAFE_MALLOC(sizeof(cookie_avatar)); if (!ack) return 0; // Failure: out of memory diff --git a/protocols/IcqOscarJ/src/icq_avatar.h b/protocols/IcqOscarJ/src/icq_avatar.h index 26d805d397..e989640d93 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.h +++ b/protocols/IcqOscarJ/src/icq_avatar.h @@ -85,8 +85,8 @@ public: __inline BOOL isPending() { return !isLoggedIn; }; __inline BOOL isReady() { return isLoggedIn && isActive && !stopThread; }; - DWORD sendGetAvatarRequest(HANDLE hContact, DWORD dwUin, char *szUid, const BYTE *hash, unsigned int hashlen, const TCHAR *file); - DWORD sendUploadAvatarRequest(HANDLE hContact, WORD wRef, const BYTE *data, unsigned int datalen); + DWORD sendGetAvatarRequest(HCONTACT hContact, DWORD dwUin, char *szUid, const BYTE *hash, unsigned int hashlen, const TCHAR *file); + DWORD sendUploadAvatarRequest(HCONTACT hContact, WORD wRef, const BYTE *data, unsigned int datalen); }; __inline static void SAFE_DELETE(avatars_server_connection **p) { SAFE_DELETE((lockable_struct**)p); }; @@ -95,7 +95,7 @@ __inline static void SAFE_DELETE(avatars_server_connection **p) { SAFE_DELETE((l struct avatars_request : public MZeroedObject { int type; - HANDLE hContact; + HCONTACT hContact; DWORD dwUin; uid_str szUid; BYTE *hash; diff --git a/protocols/IcqOscarJ/src/icq_clients.cpp b/protocols/IcqOscarJ/src/icq_clients.cpp index c836b16e3c..2ea61ae5e2 100644 --- a/protocols/IcqOscarJ/src/icq_clients.cpp +++ b/protocols/IcqOscarJ/src/icq_clients.cpp @@ -186,7 +186,7 @@ const char* cliQip = "QIP %s"; const char* cliIM2 = "IM2"; const char* cliSpamBot = "Spam Bot"; -const char* CIcqProto::detectUserClient(HANDLE hContact, int nIsICQ, WORD wUserClass, DWORD dwOnlineSince, const char *szCurrentClient, +const char* CIcqProto::detectUserClient(HCONTACT hContact, int nIsICQ, WORD wUserClass, DWORD dwOnlineSince, const char *szCurrentClient, WORD wVersion, DWORD dwFT1, DWORD dwFT2, DWORD dwFT3, BYTE bDirectFlag, DWORD dwDirectCookie, DWORD dwWebPort, /* ICQ specific */ BYTE *caps, WORD wLen, /* Client capabilities */ BYTE *bClientId, /* Output: detected client-type */ diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp index 8841ce24fc..c54d389a53 100644 --- a/protocols/IcqOscarJ/src/icq_db.cpp +++ b/protocols/IcqOscarJ/src/icq_db.cpp @@ -29,12 +29,12 @@ // ----------------------------------------------------------------------------- #include "icqoscar.h" -int CIcqProto::getSetting(HANDLE hContact, const char *szSetting, DBVARIANT *dbv) +int CIcqProto::getSetting(HCONTACT hContact, const char *szSetting, DBVARIANT *dbv) { return db_get_s(hContact, m_szModuleName, szSetting, dbv, 0); } -double CIcqProto::getSettingDouble(HANDLE hContact, const char *szSetting, double dDef) +double CIcqProto::getSettingDouble(HCONTACT hContact, const char *szSetting, double dDef) { DBVARIANT dbv = {DBVT_DELETED}; double dRes; @@ -51,12 +51,12 @@ double CIcqProto::getSettingDouble(HANDLE hContact, const char *szSetting, doubl return dRes; } -DWORD CIcqProto::getContactUin(HANDLE hContact) +DWORD CIcqProto::getContactUin(HCONTACT hContact) { return getDword(hContact, UNIQUEIDSETTING, 0); } -int CIcqProto::getContactUid(HANDLE hContact, DWORD *pdwUin, uid_str *ppszUid) +int CIcqProto::getContactUid(HCONTACT hContact, DWORD *pdwUin, uid_str *ppszUid) { DBVARIANT dbv = {DBVT_DELETED}; int iRes = 1; @@ -82,7 +82,7 @@ int CIcqProto::getContactUid(HANDLE hContact, DWORD *pdwUin, uid_str *ppszUid) return iRes; } -char* CIcqProto::getSettingStringUtf(HANDLE hContact, const char *szModule, const char *szSetting, char *szDef) +char* CIcqProto::getSettingStringUtf(HCONTACT hContact, const char *szModule, const char *szSetting, char *szDef) { DBVARIANT dbv = {DBVT_DELETED}; if ( db_get_utf(hContact, szModule, szSetting, &dbv)) { @@ -95,17 +95,17 @@ char* CIcqProto::getSettingStringUtf(HANDLE hContact, const char *szModule, cons return szRes; } -char* CIcqProto::getSettingStringUtf(HANDLE hContact, const char *szSetting, char *szDef) +char* CIcqProto::getSettingStringUtf(HCONTACT hContact, const char *szSetting, char *szDef) { return getSettingStringUtf(hContact, m_szModuleName, szSetting, szDef); } -WORD CIcqProto::getContactStatus(HANDLE hContact) +WORD CIcqProto::getContactStatus(HCONTACT hContact) { return getWord(hContact, "Status", ID_STATUS_OFFLINE); } -int CIcqProto::getSettingStringStatic(HANDLE hContact, const char *szSetting, char *dest, int dest_len) +int CIcqProto::getSettingStringStatic(HCONTACT hContact, const char *szSetting, char *dest, int dest_len) { if (!db_get_static(hContact, m_szModuleName, szSetting, dest, dest_len)) return 0; @@ -113,17 +113,17 @@ int CIcqProto::getSettingStringStatic(HANDLE hContact, const char *szSetting, ch return db_get_static_utf(hContact, m_szModuleName, szSetting, dest, dest_len); } -int CIcqProto::setSettingDouble(HANDLE hContact, const char *szSetting, double dValue) +int CIcqProto::setSettingDouble(HCONTACT hContact, const char *szSetting, double dValue) { return setSettingBlob(hContact, szSetting, (BYTE*)&dValue, sizeof(double)); } -int CIcqProto::setSettingBlob(HANDLE hContact, const char *szSetting, const BYTE *pValue, const int cbValue) +int CIcqProto::setSettingBlob(HCONTACT hContact, const char *szSetting, const BYTE *pValue, const int cbValue) { return db_set_blob(hContact, m_szModuleName, szSetting, (void*)pValue, cbValue); } -int CIcqProto::setContactHidden(HANDLE hContact, BYTE bHidden) +int CIcqProto::setContactHidden(HCONTACT hContact, BYTE bHidden) { int nResult = db_set_b(hContact, "CList", "Hidden", bHidden); if (!bHidden) // clear zero setting @@ -132,7 +132,7 @@ int CIcqProto::setContactHidden(HANDLE hContact, BYTE bHidden) return nResult; } -void CIcqProto::setStatusMsgVar(HANDLE hContact, char* szStatusMsg, bool isAnsi) +void CIcqProto::setStatusMsgVar(HCONTACT hContact, char* szStatusMsg, bool isAnsi) { if (szStatusMsg && szStatusMsg[0]) { if (isAnsi) { @@ -171,14 +171,14 @@ void CIcqProto::setStatusMsgVar(HANDLE hContact, char* szStatusMsg, bool isAnsi) else db_unset(hContact, "CList", "StatusMsg"); } -int CIcqProto::IsICQContact(HANDLE hContact) +int CIcqProto::IsICQContact(HCONTACT hContact) { char* szProto = GetContactProto(hContact); return !strcmpnull(szProto, m_szModuleName); } -HANDLE CIcqProto::AddEvent(HANDLE hContact, WORD wType, DWORD dwTime, DWORD flags, DWORD cbBlob, PBYTE pBlob) +HANDLE CIcqProto::AddEvent(HCONTACT hContact, WORD wType, DWORD dwTime, DWORD flags, DWORD cbBlob, PBYTE pBlob) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.szModule = m_szModuleName; @@ -190,9 +190,9 @@ HANDLE CIcqProto::AddEvent(HANDLE hContact, WORD wType, DWORD dwTime, DWORD flag return db_event_add(hContact, &dbei); } -HANDLE CIcqProto::FindFirstContact() +HCONTACT CIcqProto::FindFirstContact() { - HANDLE hContact = db_find_first(m_szModuleName); + HCONTACT hContact = db_find_first(m_szModuleName); if (IsICQContact(hContact)) return hContact; @@ -200,7 +200,7 @@ HANDLE CIcqProto::FindFirstContact() return FindNextContact(hContact); } -HANDLE CIcqProto::FindNextContact(HANDLE hContact) +HCONTACT CIcqProto::FindNextContact(HCONTACT hContact) { hContact = db_find_next(hContact, m_szModuleName); while (hContact != NULL) @@ -212,7 +212,7 @@ HANDLE CIcqProto::FindNextContact(HANDLE hContact) return hContact; } -char* CIcqProto::getContactCListGroup(HANDLE hContact) +char* CIcqProto::getContactCListGroup(HCONTACT hContact) { return getSettingStringUtf(hContact, "CList", "Group", NULL); } diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp index 69a610f1b4..4229777b5a 100644 --- a/protocols/IcqOscarJ/src/icq_direct.cpp +++ b/protocols/IcqOscarJ/src/icq_direct.cpp @@ -34,7 +34,7 @@ struct directthreadstartinfo int type; // Only valid for outgoing connections int incoming; // 1=incoming, 0=outgoing HANDLE hConnection; // only valid for incoming connections, handle to the connection - HANDLE hContact; // Only valid for outgoing connections + HCONTACT hContact; // Only valid for outgoing connections void* pvExtra; // Only valid for outgoing connections }; @@ -48,7 +48,7 @@ static char client_check_data[] = { "ICQ Service and Information may\0" }; -void CIcqProto::CloseContactDirectConns(HANDLE hContact) +void CIcqProto::CloseContactDirectConns(HCONTACT hContact) { icq_lock l(directConnListMutex); @@ -116,7 +116,7 @@ int CIcqProto::sendDirectPacket(directconnect* dc, icq_packet* pkt) return nResult; } -directthreadstartinfo* CreateDTSI(HANDLE hContact, HANDLE hConnection, int type) +directthreadstartinfo* CreateDTSI(HCONTACT hContact, HANDLE hConnection, int type) { directthreadstartinfo* dtsi = (directthreadstartinfo*)SAFE_MALLOC(sizeof(directthreadstartinfo)); dtsi->hContact = hContact; @@ -131,7 +131,7 @@ directthreadstartinfo* CreateDTSI(HANDLE hContact, HANDLE hConnection, int type) // Check if we have an open and initialized DC with type // 'type' to the specified contact -BOOL CIcqProto::IsDirectConnectionOpen(HANDLE hContact, int type, int bPassive) +BOOL CIcqProto::IsDirectConnectionOpen(HCONTACT hContact, int type, int bPassive) { BOOL bIsOpen = FALSE, bIsCreated = FALSE; @@ -182,7 +182,7 @@ void icq_newConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, void *pE } // Opens direct connection of specified type to specified contact -void CIcqProto::OpenDirectConnection(HANDLE hContact, int type, void* pvExtra) +void CIcqProto::OpenDirectConnection(HCONTACT hContact, int type, void* pvExtra) { // Create a new connection directthreadstartinfo* dtsi = CreateDTSI(hContact, NULL, type); @@ -596,7 +596,7 @@ void CIcqProto::handleDirectPacket(directconnect* dc, PBYTE buf, WORD wLen) DWORD dwUin; DWORD dwPort; DWORD dwCookie; - HANDLE hContact; + HCONTACT hContact; if (wLen != 0x30) { @@ -1009,7 +1009,7 @@ int DecryptDirectPacket(directconnect* dc, PBYTE buf, WORD wLen) } // This should be called only if connection already exists -int CIcqProto::SendDirectMessage(HANDLE hContact, icq_packet *pkt) +int CIcqProto::SendDirectMessage(HCONTACT hContact, icq_packet *pkt) { icq_lock l(directConnListMutex); diff --git a/protocols/IcqOscarJ/src/icq_direct.h b/protocols/IcqOscarJ/src/icq_direct.h index 3cf91cb493..76ccd0d2dc 100644 --- a/protocols/IcqOscarJ/src/icq_direct.h +++ b/protocols/IcqOscarJ/src/icq_direct.h @@ -39,7 +39,7 @@ struct filetransfer: public basic_filetransfer DWORD dwCookie; DWORD dwUin; DWORD dwRemotePort; - HANDLE hContact; + HCONTACT hContact; char *szFilename; char *szDescription; char *szSavePath; @@ -68,7 +68,7 @@ struct filetransfer: public basic_filetransfer struct directconnect { - HANDLE hContact; + HCONTACT hContact; HANDLE hConnection; DWORD dwConnectionCookie; int type; diff --git a/protocols/IcqOscarJ/src/icq_directmsg.cpp b/protocols/IcqOscarJ/src/icq_directmsg.cpp index ecf9f24af6..d5a4ccdced 100644 --- a/protocols/IcqOscarJ/src/icq_directmsg.cpp +++ b/protocols/IcqOscarJ/src/icq_directmsg.cpp @@ -165,7 +165,7 @@ void CIcqProto::handleDirectMessage(directconnect* dc, PBYTE buf, WORD wLen) } else { - HANDLE hCookieContact; + HCONTACT hCookieContact; cookie_message_data *pCookieData = NULL; if (!FindCookie(wCookie, &hCookieContact, (void**)&pCookieData)) @@ -303,7 +303,7 @@ void CIcqProto::handleDirectGreetingMessage(directconnect* dc, PBYTE buf, WORD w } else if (typeId && wCommand == DIRECT_ACK) { - HANDLE hCookieContact; + HCONTACT hCookieContact; cookie_message_data *pCookieData = NULL; if (!FindCookie(wCookie, &hCookieContact, (void**)&pCookieData)) diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp index 2d426a5fb5..fa4c3942d1 100644 --- a/protocols/IcqOscarJ/src/icq_filerequests.cpp +++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp @@ -33,7 +33,7 @@ void CIcqProto::handleFileAck(PBYTE buf, WORD wLen, DWORD dwUin, DWORD dwCookie, { char* pszFileName = NULL; DWORD dwFileSize; - HANDLE hCookieContact; + HCONTACT hCookieContact; WORD wPort; WORD wFilenameLength; filetransfer* ft; @@ -107,7 +107,7 @@ void CIcqProto::handleFileAck(PBYTE buf, WORD wLen, DWORD dwUin, DWORD dwCookie, OpenDirectConnection(ft->hContact, DIRECTCONN_FILE, ft); } -filetransfer* CIcqProto::CreateFileTransfer(HANDLE hContact, DWORD dwUin, int nVersion) +filetransfer* CIcqProto::CreateFileTransfer(HCONTACT hContact, DWORD dwUin, int nVersion) { filetransfer *ft = CreateIcqFileTransfer(); @@ -154,7 +154,7 @@ void CIcqProto::handleFileRequest(PBYTE buf, WORD wLen, DWORD dwUin, DWORD dwCoo wLen -= 4; int bAdded; - HANDLE hContact = HContactFromUIN(dwUin, &bAdded); + HCONTACT hContact = HContactFromUIN(dwUin, &bAdded); // Initialize a filetransfer struct filetransfer *ft = CreateFileTransfer(hContact, dwUin, nVersion); @@ -191,7 +191,7 @@ void CIcqProto::handleDirectCancel(directconnect *dc, PBYTE buf, WORD wLen, WORD // ******************************************************************************* -void CIcqProto::icq_CancelFileTransfer(HANDLE hContact, filetransfer* ft) +void CIcqProto::icq_CancelFileTransfer(HCONTACT hContact, filetransfer* ft) { DWORD dwCookie; diff --git a/protocols/IcqOscarJ/src/icq_infoupdate.cpp b/protocols/IcqOscarJ/src/icq_infoupdate.cpp index 58ed0ec592..969607b6be 100644 --- a/protocols/IcqOscarJ/src/icq_infoupdate.cpp +++ b/protocols/IcqOscarJ/src/icq_infoupdate.cpp @@ -55,7 +55,7 @@ void CIcqProto::icq_InitInfoUpdate(void) // Returns TRUE if user was queued // Returns FALSE if the list was full -BOOL CIcqProto::icq_QueueUser(HANDLE hContact) +BOOL CIcqProto::icq_QueueUser(HCONTACT hContact) { if ( !infoUpdateMutex ) return FALSE; @@ -155,7 +155,7 @@ void CIcqProto::icq_RescanInfoUpdate() bInfoUpdateEnabled = 0; // freeze thread // Queue all outdated users - HANDLE hContact = FindFirstContact(); + HCONTACT hContact = FindFirstContact(); while (hContact != NULL) { if (IsMetaInfoChanged(hContact)) diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp index 93e85a6965..5538103a41 100644 --- a/protocols/IcqOscarJ/src/icq_menu.cpp +++ b/protocols/IcqOscarJ/src/icq_menu.cpp @@ -39,7 +39,7 @@ static int sttCompareProtocols(const CIcqProto *p1, const CIcqProto *p2) LIST g_Instances(1, sttCompareProtocols); -static CIcqProto* IcqGetInstanceByHContact(HANDLE hContact) +static CIcqProto* IcqGetInstanceByHContact(HCONTACT hContact) { char* szProto = GetContactProto(hContact); if (szProto == NULL) @@ -54,37 +54,37 @@ static CIcqProto* IcqGetInstanceByHContact(HANDLE hContact) static INT_PTR IcqMenuHandleRequestAuth(WPARAM wParam, LPARAM lParam) { - CIcqProto* ppro = IcqGetInstanceByHContact((HANDLE)wParam); + CIcqProto* ppro = IcqGetInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->RequestAuthorization(wParam, lParam) : 0; } static INT_PTR IcqMenuHandleGrantAuth(WPARAM wParam, LPARAM lParam) { - CIcqProto* ppro = IcqGetInstanceByHContact((HANDLE)wParam); + CIcqProto* ppro = IcqGetInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->GrantAuthorization(wParam, lParam) : 0; } static INT_PTR IcqMenuHandleRevokeAuth(WPARAM wParam, LPARAM lParam) { - CIcqProto* ppro = IcqGetInstanceByHContact((HANDLE)wParam); + CIcqProto* ppro = IcqGetInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->RevokeAuthorization(wParam, lParam) : 0; } static INT_PTR IcqMenuHandleAddServContact(WPARAM wParam, LPARAM lParam) { - CIcqProto* ppro = IcqGetInstanceByHContact((HANDLE)wParam); + CIcqProto* ppro = IcqGetInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->AddServerContact(wParam, lParam) : 0; } static INT_PTR IcqMenuHandleXStatusDetails(WPARAM wParam, LPARAM lParam) { - CIcqProto* ppro = IcqGetInstanceByHContact((HANDLE)wParam); + CIcqProto* ppro = IcqGetInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->ShowXStatusDetails(wParam, lParam) : 0; } static INT_PTR IcqMenuHandleOpenProfile(WPARAM wParam, LPARAM lParam) { - CIcqProto* ppro = IcqGetInstanceByHContact((HANDLE)wParam); + CIcqProto* ppro = IcqGetInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->OpenWebProfile(wParam, lParam) : 0; } @@ -97,7 +97,7 @@ static int IcqPrebuildContactMenu( WPARAM wParam, LPARAM lParam ) Menu_ShowItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], FALSE); Menu_ShowItem(g_hContactMenuItems[ICMI_OPEN_PROFILE], FALSE); - CIcqProto* ppro = IcqGetInstanceByHContact((HANDLE)wParam); + CIcqProto* ppro = IcqGetInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->OnPreBuildContactMenu(wParam, lParam) : 0; } @@ -177,7 +177,7 @@ void g_MenuUninit(void) INT_PTR CIcqProto::OpenWebProfile(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DWORD dwUin = getContactUin(hContact); char url[256]; mir_snprintf(url, sizeof(url), "http://www.icq.com/people/%d",dwUin); @@ -187,7 +187,7 @@ INT_PTR CIcqProto::OpenWebProfile(WPARAM wParam, LPARAM lParam) int CIcqProto::OnPreBuildContactMenu(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; @@ -197,18 +197,18 @@ int CIcqProto::OnPreBuildContactMenu(WPARAM wParam, LPARAM) DWORD dwUin = getContactUin(hContact); Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REQUEST], - dwUin && (bCtrlPressed || (getByte((HANDLE)wParam, "Auth", 0) && getWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0)))); - Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_GRANT], dwUin && (bCtrlPressed || getByte((HANDLE)wParam, "Grant", 0))); + dwUin && (bCtrlPressed || (getByte(hContact, "Auth", 0) && getWord(hContact, DBSETTING_SERVLIST_ID, 0)))); + Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_GRANT], dwUin && (bCtrlPressed || getByte(hContact, "Grant", 0))); Menu_ShowItem(g_hContactMenuItems[ICMI_AUTH_REVOKE], - dwUin && (bCtrlPressed || (getByte("PrivacyItems", 0) && !getByte((HANDLE)wParam, "Grant", 0)))); + dwUin && (bCtrlPressed || (getByte("PrivacyItems", 0) && !getByte(hContact, "Grant", 0)))); Menu_ShowItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST], - m_bSsiEnabled && !getWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0) && - !getWord((HANDLE)wParam, DBSETTING_SERVLIST_IGNORE, 0) && + m_bSsiEnabled && !getWord(hContact, DBSETTING_SERVLIST_ID, 0) && + !getWord(hContact, DBSETTING_SERVLIST_IGNORE, 0) && !db_get_b(hContact, "CList", "NotOnList", 0)); } Menu_ShowItem(g_hContactMenuItems[ICMI_OPEN_PROFILE],getContactUin(hContact) != 0); - BYTE bXStatus = getContactXStatus((HANDLE)wParam); + BYTE bXStatus = getContactXStatus(hContact); Menu_ShowItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], m_bHideXStatusUI ? 0 : bXStatus != 0); if (bXStatus && !m_bHideXStatusUI) { diff --git a/protocols/IcqOscarJ/src/icq_popups.cpp b/protocols/IcqOscarJ/src/icq_popups.cpp index fdaa77cb30..ba3572b61f 100644 --- a/protocols/IcqOscarJ/src/icq_popups.cpp +++ b/protocols/IcqOscarJ/src/icq_popups.cpp @@ -200,7 +200,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return FALSE; } -int CIcqProto::ShowPopupMsg(HANDLE hContact, const char *szTitle, const char *szMsg, BYTE bType) +int CIcqProto::ShowPopupMsg(HCONTACT hContact, const char *szTitle, const char *szMsg, BYTE bType) { if (bPopupService && getByte("PopupsEnabled", DEFAULT_POPUPS_ENABLED)) { diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index e23420b326..d347223323 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -291,7 +291,7 @@ int CIcqProto::OnModulesLoaded(WPARAM wParam, LPARAM lParam) ModuleLoad(0, 0); InitXStatusItems(FALSE); - HANDLE hContact = FindFirstContact(); + HCONTACT hContact = FindFirstContact(); while (hContact != NULL) { DWORD bXStatus = getContactXStatus(hContact); if (bXStatus > 0) @@ -420,7 +420,7 @@ HANDLE __cdecl CIcqProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEv int CIcqProto::Authorize(HANDLE hDbEvent) { if (icqOnline() && hDbEvent) { - HANDLE hContact = HContactFromAuthEvent(hDbEvent); + HCONTACT hContact = HContactFromAuthEvent(hDbEvent); if (hContact == INVALID_HANDLE_VALUE) return 1; @@ -446,7 +446,7 @@ int CIcqProto::Authorize(HANDLE hDbEvent) int CIcqProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) { if (icqOnline() && hDbEvent) { - HANDLE hContact = HContactFromAuthEvent(hDbEvent); + HCONTACT hContact = HContactFromAuthEvent(hDbEvent); if (hContact == INVALID_HANDLE_VALUE) return 1; @@ -470,7 +470,7 @@ int CIcqProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) //////////////////////////////////////////////////////////////////////////////////////// // PSR_AUTH -int __cdecl CIcqProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) +int __cdecl CIcqProto::AuthRecv(HCONTACT hContact, PROTORECVEVENT* pre) { setContactHidden(hContact, 0); ICQAddRecvEvent(NULL, EVENTTYPE_AUTHREQUEST, pre, pre->lParam, (PBYTE)pre->szMessage, 0); @@ -480,7 +480,7 @@ int __cdecl CIcqProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) //////////////////////////////////////////////////////////////////////////////////////// // PSS_AUTHREQUEST -int __cdecl CIcqProto::AuthRequest(HANDLE hContact, const TCHAR* szMessage) +int __cdecl CIcqProto::AuthRequest(HCONTACT hContact, const TCHAR* szMessage) { if (!icqOnline()) return 1; @@ -515,7 +515,7 @@ HANDLE __cdecl CIcqProto::ChangeInfo(int iInfoType, void* pInfoData) //////////////////////////////////////////////////////////////////////////////////////// // PS_FileAllow - starts a file transfer -HANDLE __cdecl CIcqProto::FileAllow(HANDLE hContact, HANDLE hTransfer, const TCHAR* szPath) +HANDLE __cdecl CIcqProto::FileAllow(HCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath) { DWORD dwUin; uid_str szUid; @@ -558,7 +558,7 @@ HANDLE __cdecl CIcqProto::FileAllow(HANDLE hContact, HANDLE hTransfer, const TCH //////////////////////////////////////////////////////////////////////////////////////// // PS_FileCancel - cancels a file transfer -int __cdecl CIcqProto::FileCancel(HANDLE hContact, HANDLE hTransfer) +int __cdecl CIcqProto::FileCancel(HCONTACT hContact, HANDLE hTransfer) { DWORD dwUin; uid_str szUid; @@ -588,7 +588,7 @@ int __cdecl CIcqProto::FileCancel(HANDLE hContact, HANDLE hTransfer) //////////////////////////////////////////////////////////////////////////////////////// // PS_FileDeny - denies a file transfer -int __cdecl CIcqProto::FileDeny(HANDLE hContact, HANDLE hTransfer, const TCHAR* szReason) +int __cdecl CIcqProto::FileDeny(HCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason) { int nReturnValue = 1; DWORD dwUin; @@ -657,7 +657,7 @@ int __cdecl CIcqProto::FileResume(HANDLE hTransfer, int* action, const TCHAR** s //////////////////////////////////////////////////////////////////////////////////////// // GetCaps - return protocol capabilities bits -DWORD_PTR __cdecl CIcqProto::GetCaps(int type, HANDLE hContact) +DWORD_PTR __cdecl CIcqProto::GetCaps(int type, HCONTACT hContact) { DWORD_PTR nReturn = 0; @@ -742,7 +742,7 @@ DWORD_PTR __cdecl CIcqProto::GetCaps(int type, HANDLE hContact) //////////////////////////////////////////////////////////////////////////////////////// // GetInfo - retrieves a contact info -int __cdecl CIcqProto::GetInfo(HANDLE hContact, int infoType) +int __cdecl CIcqProto::GetInfo(HCONTACT hContact, int infoType) { if (icqOnline()) { DWORD dwUin; @@ -923,7 +923,7 @@ HWND __cdecl CIcqProto::SearchAdvanced(HWND hwndDlg) //////////////////////////////////////////////////////////////////////////////////////// // RecvContacts -int __cdecl CIcqProto::RecvContacts(HANDLE hContact, PROTORECVEVENT* pre) +int __cdecl CIcqProto::RecvContacts(HCONTACT hContact, PROTORECVEVENT* pre) { ICQSEARCHRESULT **isrList = (ICQSEARCHRESULT**)pre->szMessage; int i; @@ -974,7 +974,7 @@ int __cdecl CIcqProto::RecvContacts(HANDLE hContact, PROTORECVEVENT* pre) //////////////////////////////////////////////////////////////////////////////////////// // RecvFile -int __cdecl CIcqProto::RecvFile(HANDLE hContact, PROTORECVFILET* evt) +int __cdecl CIcqProto::RecvFile(HCONTACT hContact, PROTORECVFILET* evt) { return Proto_RecvFile(hContact, evt); } @@ -983,7 +983,7 @@ int __cdecl CIcqProto::RecvFile(HANDLE hContact, PROTORECVFILET* evt) //////////////////////////////////////////////////////////////////////////////////////// // RecvMsg -int __cdecl CIcqProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) +int __cdecl CIcqProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT* pre) { DWORD cbBlob; DWORD flags = 0; @@ -1009,7 +1009,7 @@ int __cdecl CIcqProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) //////////////////////////////////////////////////////////////////////////////////////// // RecvUrl -int __cdecl CIcqProto::RecvUrl(HANDLE hContact, PROTORECVEVENT*) +int __cdecl CIcqProto::RecvUrl(HCONTACT hContact, PROTORECVEVENT*) { return 1; } @@ -1018,7 +1018,7 @@ int __cdecl CIcqProto::RecvUrl(HANDLE hContact, PROTORECVEVENT*) //////////////////////////////////////////////////////////////////////////////////////// // SendContacts -int __cdecl CIcqProto::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList) +int __cdecl CIcqProto::SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) { if (hContact && hContactsList) { int i; @@ -1289,7 +1289,7 @@ int __cdecl CIcqProto::SendContacts(HANDLE hContact, int flags, int nContacts, H //////////////////////////////////////////////////////////////////////////////////////// // SendFile - sends a file -HANDLE __cdecl CIcqProto::SendFile(HANDLE hContact, const TCHAR* szDescription, TCHAR** ppszFiles) +HANDLE __cdecl CIcqProto::SendFile(HCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles) { if (!icqOnline()) return 0; @@ -1391,7 +1391,7 @@ HANDLE __cdecl CIcqProto::SendFile(HANDLE hContact, const TCHAR* szDescription, //////////////////////////////////////////////////////////////////////////////////////// // PS_SendMessage - sends a message -int __cdecl CIcqProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc) +int __cdecl CIcqProto::SendMsg(HCONTACT hContact, int flags, const char* pszSrc) { if (hContact == NULL || pszSrc == NULL) return NULL; @@ -1581,7 +1581,7 @@ int __cdecl CIcqProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc) //////////////////////////////////////////////////////////////////////////////////////// // SendUrl -int __cdecl CIcqProto::SendUrl(HANDLE hContact, int flags, const char* url) +int __cdecl CIcqProto::SendUrl(HCONTACT hContact, int flags, const char* url) { if (hContact == NULL || url == NULL) return 0; @@ -1646,7 +1646,7 @@ int __cdecl CIcqProto::SendUrl(HANDLE hContact, int flags, const char* url) //////////////////////////////////////////////////////////////////////////////////////// // PS_SetApparentMode - sets the visibility status -int __cdecl CIcqProto::SetApparentMode(HANDLE hContact, int mode) +int __cdecl CIcqProto::SetApparentMode(HCONTACT hContact, int mode) { DWORD uin; uid_str uid; @@ -1840,7 +1840,7 @@ int __cdecl CIcqProto::SetStatus(int iNewStatus) struct status_message_thread_data { - HANDLE hContact; + HCONTACT hContact; char *szMessage; HANDLE hProcess; }; @@ -1866,7 +1866,7 @@ void __cdecl CIcqProto::GetAwayMsgThread(void *pStatusData) //////////////////////////////////////////////////////////////////////////////////////// // PS_GetAwayMsg - returns a contact's away message -HANDLE __cdecl CIcqProto::GetAwayMsg(HANDLE hContact) +HANDLE __cdecl CIcqProto::GetAwayMsg(HCONTACT hContact) { DWORD dwUin; uid_str szUID; @@ -1949,7 +1949,7 @@ HANDLE __cdecl CIcqProto::GetAwayMsg(HANDLE hContact) //////////////////////////////////////////////////////////////////////////////////////// // PSR_AWAYMSG - processes received status mode message -int __cdecl CIcqProto::RecvAwayMsg(HANDLE hContact, int statusMode, PROTORECVEVENT* evt) +int __cdecl CIcqProto::RecvAwayMsg(HCONTACT hContact, int statusMode, PROTORECVEVENT* evt) { if (evt->flags & PREF_UTF) { setStatusMsgVar(hContact, evt->szMessage, false); @@ -2039,7 +2039,7 @@ INT_PTR CIcqProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // PS_UserIsTyping - sends a UTN notification -int __cdecl CIcqProto::UserIsTyping(HANDLE hContact, int type) +int __cdecl CIcqProto::UserIsTyping(HCONTACT hContact, int type) { if (hContact && icqOnline()) { if (CheckContactCapabilities(hContact, CAPF_TYPING)) { diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index 836eaafb51..9b9986d06d 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -41,7 +41,7 @@ struct userinfo { DWORD dwUin; - HANDLE hContact; + HCONTACT hContact; time_t queued; }; @@ -54,50 +54,50 @@ struct CIcqProto : public PROTO // PROTO_INTERFACE //==================================================================================== - virtual HANDLE __cdecl AddToList( int flags, PROTOSEARCHRESULT* psr ); - virtual HANDLE __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent ); + virtual HANDLE __cdecl AddToList( int flags, PROTOSEARCHRESULT *psr); + virtual HANDLE __cdecl AddToListByEvent( int flags, int iContact, HANDLE hDbEvent); - virtual int __cdecl Authorize( HANDLE hContact ); - virtual int __cdecl AuthDeny( HANDLE hContact, const TCHAR* szReason ); - virtual int __cdecl AuthRecv( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl AuthRequest( HANDLE hContact, const TCHAR* szMessage ); + virtual int __cdecl Authorize(HANDLE hDbEvent); + virtual int __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR *szReason); + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl AuthRequest(HCONTACT hContact, const TCHAR *szMessage); - virtual HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData ); + virtual HANDLE __cdecl ChangeInfo( int iInfoType, void *pInfoData); - virtual HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const TCHAR* szPath ); - virtual int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer ); - virtual int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const TCHAR* szReason ); - virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const TCHAR** szFilename ); + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath); + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer); + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason); + virtual int __cdecl FileResume( HANDLE hTransfer, int *action, const TCHAR **szFilename); - virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL ); - virtual int __cdecl GetInfo( HANDLE hContact, int infoType ); + virtual DWORD_PTR __cdecl GetCaps(int type, HCONTACT hContact = NULL); + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType); - virtual HANDLE __cdecl SearchBasic( const PROTOCHAR *id ); - virtual HANDLE __cdecl SearchByEmail( const PROTOCHAR *email ); + virtual HANDLE __cdecl SearchBasic(const PROTOCHAR *id); + virtual HANDLE __cdecl SearchByEmail(const PROTOCHAR *email); virtual HANDLE __cdecl SearchByName(const PROTOCHAR *nick, const PROTOCHAR *firstName, const PROTOCHAR *lastName); - virtual HWND __cdecl SearchAdvanced( HWND owner ); - virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ); + virtual HWND __cdecl SearchAdvanced(HWND owner); + virtual HWND __cdecl CreateExtendedSearchUI(HWND owner); - virtual int __cdecl RecvContacts( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvFile( HANDLE hContact, PROTORECVFILET* ); - virtual int __cdecl RecvMsg( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvUrl( HANDLE hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvFile(HCONTACT hContact, PROTORECVFILET*); + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT*); - virtual int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ); - virtual HANDLE __cdecl SendFile( HANDLE hContact, const TCHAR* szDescription, TCHAR** ppszFiles ); - virtual int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg ); - virtual int __cdecl SendUrl( HANDLE hContact, int flags, const char* url ); + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList); + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles); + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char *msg); + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char *url); - virtual int __cdecl SetApparentMode( HANDLE hContact, int mode ); - virtual int __cdecl SetStatus( int iNewStatus ); + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode); + virtual int __cdecl SetStatus(int iNewStatus); - virtual HANDLE __cdecl GetAwayMsg( HANDLE hContact ); - virtual int __cdecl RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVENT* evt ); - virtual int __cdecl SetAwayMsg( int m_iStatus, const TCHAR* msg ); + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact); + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT *evt); + virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR *msg); - virtual int __cdecl UserIsTyping( HANDLE hContact, int type ); + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type); - virtual int __cdecl OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam ); + virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam); //====| Services |==================================================================== INT_PTR __cdecl AddServerContact(WPARAM wParam, LPARAM lParam); @@ -127,22 +127,22 @@ struct CIcqProto : public PROTO INT_PTR __cdecl OnCreateAccMgrUI(WPARAM, LPARAM); //====| Events |====================================================================== - void __cdecl OnAddContactForever( DBCONTACTWRITESETTING* cws, HANDLE hContact ); - int __cdecl OnIdleChanged( WPARAM, LPARAM ); - int __cdecl OnModernOptInit( WPARAM, LPARAM ); - int __cdecl OnModulesLoaded( WPARAM, LPARAM ); - int __cdecl OnOptionsInit( WPARAM, LPARAM ); - int __cdecl OnPreShutdown( WPARAM, LPARAM ); - int __cdecl OnPreBuildContactMenu( WPARAM, LPARAM ); - int __cdecl OnMsgUserTyping( WPARAM, LPARAM ); - int __cdecl OnProcessSrmmIconClick( WPARAM, LPARAM ); - int __cdecl OnProcessSrmmEvent( WPARAM, LPARAM ); - int __cdecl OnReloadIcons( WPARAM, LPARAM ); - void __cdecl OnRenameContact( DBCONTACTWRITESETTING* cws, HANDLE hContact ); - void __cdecl OnRenameGroup( DBCONTACTWRITESETTING* cws, HANDLE hContact ); - int __cdecl OnUserInfoInit( WPARAM, LPARAM ); - - int __cdecl OnPreBuildStatusMenu( WPARAM, LPARAM ); + void __cdecl OnAddContactForever(DBCONTACTWRITESETTING *cws, HCONTACT hContact); + int __cdecl OnIdleChanged(WPARAM, LPARAM); + int __cdecl OnModernOptInit(WPARAM, LPARAM); + int __cdecl OnModulesLoaded(WPARAM, LPARAM); + int __cdecl OnOptionsInit(WPARAM, LPARAM); + int __cdecl OnPreShutdown(WPARAM, LPARAM); + int __cdecl OnPreBuildContactMenu(WPARAM, LPARAM); + int __cdecl OnMsgUserTyping(WPARAM, LPARAM); + int __cdecl OnProcessSrmmIconClick(WPARAM, LPARAM); + int __cdecl OnProcessSrmmEvent(WPARAM, LPARAM); + int __cdecl OnReloadIcons(WPARAM, LPARAM); + void __cdecl OnRenameContact(DBCONTACTWRITESETTING *cws, HCONTACT hContact); + void __cdecl OnRenameGroup( DBCONTACTWRITESETTING *cws, HCONTACT hContact); + int __cdecl OnUserInfoInit(WPARAM, LPARAM); + + int __cdecl OnPreBuildStatusMenu(WPARAM, LPARAM); //====| Data |======================================================================== HANDLE m_hDirectNetlibUser; @@ -182,22 +182,22 @@ struct CIcqProto : public PROTO //----| capabilities.cpp |------------------------------------------------------------ // Deletes all oscar capabilities for a given contact. - void ClearAllContactCapabilities(HANDLE hContact); + void ClearAllContactCapabilities(HCONTACT hContact); // Deletes one or many oscar capabilities for a given contact. - void ClearContactCapabilities(HANDLE hContact, DWORD fdwCapabilities); + void ClearContactCapabilities(HCONTACT hContact, DWORD fdwCapabilities); // Sets one or many oscar capabilities for a given contact. - void SetContactCapabilities(HANDLE hContact, DWORD fdwCapabilities); + void SetContactCapabilities(HCONTACT hContact, DWORD fdwCapabilities); // Returns true if the given contact supports the requested capabilites. - BOOL CheckContactCapabilities(HANDLE hContact, DWORD fdwCapabilities); + BOOL CheckContactCapabilities(HCONTACT hContact, DWORD fdwCapabilities); // Scans a binary buffer for oscar capabilities and adds them to the contact. - void AddCapabilitiesFromBuffer(HANDLE hContact, BYTE *pBuffer, int nLength); + void AddCapabilitiesFromBuffer(HCONTACT hContact, BYTE *pBuffer, int nLength); // Scans a binary buffer for oscar capabilities and sets them to the contact. - void SetCapabilitiesFromBuffer(HANDLE hContact, BYTE *pBuffer, int nLength, BOOL bReset); + void SetCapabilitiesFromBuffer(HCONTACT hContact, BYTE *pBuffer, int nLength, BOOL bReset); //----| chan_01login.cpp |------------------------------------------------------------ void handleLoginChannel(BYTE *buf, WORD datalen, serverthread_info *info); @@ -231,7 +231,7 @@ struct CIcqProto : public PROTO LIST cookies; WORD wCookieSeq; - DWORD AllocateCookie(BYTE bType, WORD wIdent, HANDLE hContact, void *pvExtra); + DWORD AllocateCookie(BYTE bType, WORD wIdent, HCONTACT hContact, void *pvExtra); void FreeCookie(DWORD dwCookie); void FreeCookieByData(BYTE bType, void *pvExtra); void ReleaseCookie(DWORD dwCookie); @@ -239,32 +239,32 @@ struct CIcqProto : public PROTO int GetCookieType(DWORD dwCookie); - int FindCookie(DWORD wCookie, HANDLE *phContact, void **ppvExtra); - int FindCookieByData(void *pvExtra, DWORD *pdwCookie, HANDLE *phContact); - int FindCookieByType(BYTE bType, DWORD *pdwCookie, HANDLE *phContact, void **ppvExtra); - int FindMessageCookie(DWORD dwMsgID1, DWORD dwMsgID2, DWORD *pdwCookie, HANDLE *phContact, cookie_message_data **ppvExtra); + int FindCookie(DWORD wCookie, HCONTACT *phContact, void **ppvExtra); + int FindCookieByData(void *pvExtra, DWORD *pdwCookie, HCONTACT *phContact); + int FindCookieByType(BYTE bType, DWORD *pdwCookie, HCONTACT *phContact, void **ppvExtra); + int FindMessageCookie(DWORD dwMsgID1, DWORD dwMsgID2, DWORD *pdwCookie, HCONTACT *phContact, cookie_message_data **ppvExtra); void InitMessageCookie(cookie_message_data *pCookie); cookie_message_data* CreateMessageCookie(WORD bMsgType, BYTE bAckType); - cookie_message_data* CreateMessageCookieData(BYTE bMsgType, HANDLE hContact, DWORD dwUin, int bUseSrvRelay); + cookie_message_data* CreateMessageCookieData(BYTE bMsgType, HCONTACT hContact, DWORD dwUin, int bUseSrvRelay); void RemoveExpiredCookies(void); //----| directpackets.cpp |----------------------------------------------------------- void icq_sendDirectMsgAck(directconnect* dc, WORD wCookie, BYTE bMsgType, BYTE bMsgFlags, char* szCap); - DWORD icq_sendGetAwayMsgDirect(HANDLE hContact, int type); + DWORD icq_sendGetAwayMsgDirect(HCONTACT hContact, int type); void icq_sendAwayMsgReplyDirect(directconnect *dc, WORD wCookie, BYTE msgType, const char** szMsg); - void icq_sendFileAcceptDirect(HANDLE hContact, filetransfer *ft); - void icq_sendFileDenyDirect(HANDLE hContact, filetransfer *ft, const char *szReason); + void icq_sendFileAcceptDirect(HCONTACT hContact, filetransfer *ft); + void icq_sendFileDenyDirect(HCONTACT hContact, filetransfer *ft, const char *szReason); int icq_sendFileSendDirectv7(filetransfer *ft, const char *pszFiles); int icq_sendFileSendDirectv8(filetransfer *ft, const char *pszFiles); - DWORD icq_SendDirectMessage(HANDLE hContact, const char *szMessage, int nBodyLength, WORD wPriority, cookie_message_data *pCookieData, char *szCap); - void icq_sendXtrazRequestDirect(HANDLE hContact, DWORD dwCookie, char* szBody, int nBodyLen, WORD wType); - void icq_sendXtrazResponseDirect(HANDLE hContact, WORD wCookie, char* szBody, int nBodyLen, WORD wType); + DWORD icq_SendDirectMessage(HCONTACT hContact, const char *szMessage, int nBodyLength, WORD wPriority, cookie_message_data *pCookieData, char *szCap); + void icq_sendXtrazRequestDirect(HCONTACT hContact, DWORD dwCookie, char* szBody, int nBodyLen, WORD wType); + void icq_sendXtrazResponseDirect(HCONTACT hContact, WORD wCookie, char* szBody, int nBodyLen, WORD wType); //----| fam_01service.cpp |----------------------------------------------------------- void handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header *pSnacHeader, serverthread_info *info); - char* buildUinList(int subtype, WORD wMaxLen, HANDLE *hContactResume); + char* buildUinList(int subtype, WORD wMaxLen, HCONTACT *hContactResume); void sendEntireListServ(WORD wFamily, WORD wSubtype, int listType); void setUserInfo(void); void handleServUINSettings(int nPort, serverthread_info *info); @@ -278,7 +278,7 @@ struct CIcqProto : public PROTO void handleReplyBuddy(BYTE *buf, WORD wPackLen); void handleUserOffline(BYTE *buf, WORD wPackLen); void handleUserOnline(BYTE *buf, WORD wPackLen, serverthread_info *info); - void parseStatusNote(DWORD dwUin, char *szUid, HANDLE hContact, oscar_tlv_chain *pChain); + void parseStatusNote(DWORD dwUin, char *szUid, HCONTACT hContact, oscar_tlv_chain *pChain); void handleNotifyRejected(BYTE *buf, WORD wPackLen); //----| fam_04message.cpp |----------------------------------------------------------- @@ -296,29 +296,29 @@ struct CIcqProto : public PROTO void handleRecvServMsgError(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwRef); void handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwRef); void handleServerAck(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwRef); - void handleStatusMsgReply(const char *szPrefix, HANDLE hContact, DWORD dwUin, WORD wVersion, int bMsgType, WORD wCookie, const char *szMsg, int nMsgFlags); + void handleStatusMsgReply(const char *szPrefix, HCONTACT hContact, DWORD dwUin, WORD wVersion, int bMsgType, WORD wCookie, const char *szMsg, int nMsgFlags); void handleTypingNotification(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwRef); void handleMissedMsg(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwRef); void handleOffineMessagesReply(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwRef); void handleRecvServMsgContacts(BYTE *buf, WORD wLen, DWORD dwUin, char *szUID, DWORD dwID1, DWORD dwID2, WORD wCommand); void handleRuntimeError(WORD wError); - void parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wAckType); - void parseServRelayPluginData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wAckType, BYTE bFlags, WORD wStatus, WORD wCookie, WORD wVersion); + void parseServRelayData(BYTE *pDataBuf, WORD wLen, HCONTACT hContact, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wAckType); + void parseServRelayPluginData(BYTE *pDataBuf, WORD wLen, HCONTACT hContact, DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wAckType, BYTE bFlags, WORD wStatus, WORD wCookie, WORD wVersion); HANDLE handleMessageAck(DWORD dwUin, char *szUID, WORD wCookie, WORD wVersion, int type, WORD wMsgLen, PBYTE buf, BYTE bFlags, int nMsgFlags); void handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, DWORD dwMsgID, DWORD dwMsgID2, WORD wCookie, WORD wVersion, int type, int flags, WORD wAckType, DWORD dwDataLen, WORD wMsgLen, char *pMsg, int nMsgFlags, message_ack_params *pAckParams); - void sendMessageTypesAck(HANDLE hContact, int bUnicode, message_ack_params *pArgs); - void sendTypingNotification(HANDLE hContact, WORD wMTNCode); + void sendMessageTypesAck(HCONTACT hContact, int bUnicode, message_ack_params *pArgs); + void sendTypingNotification(HCONTACT hContact, WORD wMTNCode); int unpackPluginTypeId(BYTE **pBuffer, WORD *pwLen, int *pTypeId, WORD *pFunctionId, BOOL bThruDC); - char* convertMsgToUserSpecificUtf(HANDLE hContact, const char *szMsg); + char* convertMsgToUserSpecificUtf(HCONTACT hContact, const char *szMsg); //----| fam_09bos.cpp |--------------------------------------------------------------- void handleBosFam(unsigned char *pBuffer, WORD wBufferLength, snac_header* pSnacHeader); void handlePrivacyRightsReply(unsigned char *pBuffer, WORD wBufferLength); - void makeContactTemporaryVisible(HANDLE hContact); + void makeContactTemporaryVisible(HCONTACT hContact); //----| fam_0alookup.cpp |------------------------------------------------------------ void handleLookupFam(unsigned char *pBuffer, WORD wBufferLength, snac_header* pSnacHeader); @@ -347,7 +347,7 @@ struct CIcqProto : public PROTO void handleRecvAuthResponse(BYTE *buf, WORD wLen); void handleRecvAdded(BYTE *buf, WORD wLen); - HANDLE HContactFromRecordName(const char *szRecordName, int *bAdded); + HCONTACT HContactFromRecordName(const char *szRecordName, int *bAdded); void processCListReply(const char *szRecordName, WORD wGroupId, WORD wItemId, WORD wItemType, oscar_tlv_chain *pItemData); @@ -367,12 +367,12 @@ struct CIcqProto : public PROTO void handleExtensionServerInfo(BYTE *buf, WORD wPackLen, WORD wFlags); void handleExtensionMetaResponse(BYTE *databuf, WORD wPacketLen, WORD wCookie, WORD wFlags); - int parseUserInfoRecord(HANDLE hContact, oscar_tlv *pData, UserInfoRecordItem pRecordDef[], int nRecordDef, int nMaxRecords); + int parseUserInfoRecord(HCONTACT hContact, oscar_tlv *pData, UserInfoRecordItem pRecordDef[], int nRecordDef, int nMaxRecords); void handleDirectoryQueryResponse(BYTE *databuf, WORD wPacketLen, WORD wCookie, WORD wReplySubtype, WORD wFlags); void handleDirectoryUpdateResponse(BYTE *databuf, WORD wPacketLen, WORD wCookie, WORD wReplySubtype); - void parseDirectoryUserDetailsData(HANDLE hContact, oscar_tlv_chain *cDetails, DWORD dwCookie, cookie_directory_data *pCookieData, WORD wReplySubType); + void parseDirectoryUserDetailsData(HCONTACT hContact, oscar_tlv_chain *cDetails, DWORD dwCookie, cookie_directory_data *pCookieData, WORD wReplySubType); void parseDirectorySearchData(oscar_tlv_chain *cDetails, DWORD dwCookie, cookie_directory_data *pCookieData, WORD wReplySubType); void parseSearchReplies(unsigned char *databuf, WORD wPacketLen, WORD wCookie, WORD wReplySubtype, BYTE bResultCode); @@ -397,44 +397,45 @@ struct CIcqProto : public PROTO void __cdecl AvatarThread(avatars_server_connection *pInfo); void handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, BYTE nDataLen); - void handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContact, BYTE *pHash, int nHashLen, WORD wOldStatus); + void handleAvatarContactHash(DWORD dwUIN, char *szUID, HCONTACT hContact, BYTE *pHash, int nHashLen, WORD wOldStatus); avatars_request *ReleaseAvatarRequestInQueue(avatars_request *request); TCHAR* GetOwnAvatarFileName(); void GetFullAvatarFileName(int dwUin, const char *szUid, int dwFormat, TCHAR *pszDest, int cbLen); void GetAvatarFileName(int dwUin, const char *szUid, TCHAR *pszDest, int cbLen); - int IsAvatarChanged(HANDLE hContact, const BYTE *pHash, int nHashLen); + int IsAvatarChanged(HCONTACT hContact, const BYTE *pHash, int nHashLen); - int GetAvatarData(HANDLE hContact, DWORD dwUin, const char *szUid, const BYTE *hash, unsigned int hashlen, const TCHAR *file); - int SetAvatarData(HANDLE hContact, WORD wRef, const BYTE *data, unsigned int datalen); + int GetAvatarData(HCONTACT hContact, DWORD dwUin, const char *szUid, const BYTE *hash, unsigned int hashlen, const TCHAR *file); + int SetAvatarData(HCONTACT hContact, WORD wRef, const BYTE *data, unsigned int datalen); void StartAvatarThread(HANDLE hConn, char* cookie, WORD cookieLen); void StopAvatarThread(); //----| icq_clients.cpp |------------------------------------------------------------- - const char* detectUserClient(HANDLE hContact, int nIsICQ, WORD wUserClass, DWORD dwOnlineSince, const char *szCurrentClient, WORD wVersion, DWORD dwFT1, DWORD dwFT2, DWORD dwFT3, BYTE bDirectFlag, DWORD dwDirectCookie, DWORD dwWebPort, BYTE *caps, WORD wLen, BYTE *bClientId, char *szClientBuf); + const char* detectUserClient(HCONTACT hContact, int nIsICQ, WORD wUserClass, DWORD dwOnlineSince, const char *szCurrentClient, WORD wVersion, DWORD dwFT1, DWORD dwFT2, DWORD dwFT3, BYTE bDirectFlag, DWORD dwDirectCookie, DWORD dwWebPort, BYTE *caps, WORD wLen, BYTE *bClientId, char *szClientBuf); //----| icq_db.cpp |------------------------------------------------------------------ - HANDLE AddEvent(HANDLE hContact, WORD wType, DWORD dwTime, DWORD flags, DWORD cbBlob, PBYTE pBlob); - HANDLE FindFirstContact(); - HANDLE FindNextContact(HANDLE hContact); - int IsICQContact(HANDLE hContact); - - int getSetting(HANDLE hContact, const char *szSetting, DBVARIANT *dbv); - double getSettingDouble(HANDLE hContact, const char *szSetting, double dDef); - int getSettingStringStatic(HANDLE hContact, const char *szSetting, char *dest, int dest_len); - char* getSettingStringUtf(HANDLE hContact, const char *szModule, const char *szSetting, char *szDef); - char* getSettingStringUtf(HANDLE hContact, const char *szSetting, char *szDef); - int getContactUid(HANDLE hContact, DWORD *pdwUin, uid_str *ppszUid); - DWORD getContactUin(HANDLE hContact); - WORD getContactStatus(HANDLE hContact); - char* getContactCListGroup(HANDLE hContact); - - int setSettingDouble(HANDLE hContact, const char *szSetting, double dValue); - int setSettingBlob(HANDLE hContact, const char *szSetting, const BYTE *pValue, const int cbValue); - int setContactHidden(HANDLE hContact, BYTE bHidden); - void setStatusMsgVar(HANDLE hContact, char* szStatusMsg, bool isAnsi); + HANDLE AddEvent(HCONTACT hContact, WORD wType, DWORD dwTime, DWORD flags, DWORD cbBlob, PBYTE pBlob); + int IsICQContact(HCONTACT hContact); + + HCONTACT FindFirstContact(); + HCONTACT FindNextContact(HCONTACT hContact); + + int getSetting(HCONTACT hContact, const char *szSetting, DBVARIANT *dbv); + double getSettingDouble(HCONTACT hContact, const char *szSetting, double dDef); + int getSettingStringStatic(HCONTACT hContact, const char *szSetting, char *dest, int dest_len); + char* getSettingStringUtf(HCONTACT hContact, const char *szModule, const char *szSetting, char *szDef); + char* getSettingStringUtf(HCONTACT hContact, const char *szSetting, char *szDef); + int getContactUid(HCONTACT hContact, DWORD *pdwUin, uid_str *ppszUid); + DWORD getContactUin(HCONTACT hContact); + WORD getContactStatus(HCONTACT hContact); + char* getContactCListGroup(HCONTACT hContact); + + int setSettingDouble(HCONTACT hContact, const char *szSetting, double dValue); + int setSettingBlob(HCONTACT hContact, const char *szSetting, const BYTE *pValue, const int cbValue); + int setContactHidden(HCONTACT hContact, BYTE bHidden); + void setStatusMsgVar(HCONTACT hContact, char* szStatusMsg, bool isAnsi); //----| icq_direct.cpp |-------------------------------------------------------------- icq_critical_section *directConnListMutex; @@ -452,29 +453,29 @@ struct CIcqProto : public PROTO void sendPeerFileInit(directconnect* dc); int sendDirectPacket(directconnect* dc, icq_packet* pkt); - void CloseContactDirectConns(HANDLE hContact); + void CloseContactDirectConns(HCONTACT hContact); directconnect* FindFileTransferDC(filetransfer* ft); filetransfer* FindExpectedFileRecv(DWORD dwUin, DWORD dwTotalSize); - BOOL IsDirectConnectionOpen(HANDLE hContact, int type, int bPassive); - void OpenDirectConnection(HANDLE hContact, int type, void* pvExtra); + BOOL IsDirectConnectionOpen(HCONTACT hContact, int type, int bPassive); + void OpenDirectConnection(HCONTACT hContact, int type, void* pvExtra); void CloseDirectConnection(directconnect *dc); - int SendDirectMessage(HANDLE hContact, icq_packet *pkt); + int SendDirectMessage(HCONTACT hContact, icq_packet *pkt); //----| icq_directmsg.cpp |----------------------------------------------------------- void handleDirectMessage(directconnect* dc, PBYTE buf, WORD wLen); void handleDirectGreetingMessage(directconnect* dc, PBYTE buf, WORD wLen, WORD wCommand, WORD wCookie, BYTE bMsgType, BYTE bMsgFlags, WORD wStatus, WORD wFlags, char* pszText); //----| icq_filerequests.cpp |-------------------------------------------------------- - filetransfer* CreateFileTransfer(HANDLE hContact, DWORD dwUin, int nVersion); + filetransfer* CreateFileTransfer(HCONTACT hContact, DWORD dwUin, int nVersion); void handleFileAck(PBYTE buf, WORD wLen, DWORD dwUin, DWORD dwCookie, WORD wStatus, char* pszText); void handleFileRequest(PBYTE buf, WORD wLen, DWORD dwUin, DWORD dwCookie, DWORD dwID1, DWORD dwID2, char* pszDescription, int nVersion, BOOL bDC); void handleDirectCancel(directconnect *dc, PBYTE buf, WORD wLen, WORD wCommand, DWORD dwCookie, WORD wMessageType, WORD wStatus, WORD wFlags, char* pszText); - void icq_CancelFileTransfer(HANDLE hContact, filetransfer* ft); + void icq_CancelFileTransfer(HCONTACT hContact, filetransfer* ft); //----| icq_filetransfer.cpp |-------------------------------------------------------- - void icq_AcceptFileTransfer(HANDLE hContact, filetransfer *ft); + void icq_AcceptFileTransfer(HCONTACT hContact, filetransfer *ft); void icq_sendFileResume(filetransfer *ft, int action, const char *szFilename); void icq_InitFileSend(filetransfer *ft); @@ -495,7 +496,7 @@ struct CIcqProto : public PROTO void __cdecl InfoUpdateThread(void*); void icq_InitInfoUpdate(void); // Queues all outdated users - BOOL icq_QueueUser(HANDLE hContact); // Queue one UIN to the list for updating + BOOL icq_QueueUser(HCONTACT hContact); // Queue one UIN to the list for updating void icq_DequeueUser(DWORD dwUin); // Remove one UIN from the list void icq_RescanInfoUpdate(); // Add all outdated contacts to the list void icq_InfoUpdateCleanup(void); // Clean up on exit @@ -525,7 +526,7 @@ struct CIcqProto : public PROTO BOOL unpackUID(BYTE **ppBuf, WORD *pwLen, DWORD *pdwUIN, uid_str *ppszUID); //----| icq_popups.cpp |-------------------------------------------------------------- - int ShowPopupMsg(HANDLE hContact, const char *szTitle, const char *szMsg, BYTE bType); + int ShowPopupMsg(HCONTACT hContact, const char *szTitle, const char *szMsg, BYTE bType); //----| icq_proto.cpp |-------------------------------------------------------------- void __cdecl CheekySearchThread( void* ); @@ -604,15 +605,15 @@ struct CIcqProto : public PROTO int servlistPendingSize; servlistpendingitem** servlistPendingList; - int servlistPendingFindItem(int nType, HANDLE hContact, const char *pszGroup); + int servlistPendingFindItem(int nType, HCONTACT hContact, const char *pszGroup); void servlistPendingAddItem(servlistpendingitem* pItem); - servlistpendingitem* servlistPendingRemoveItem(int nType, HANDLE hContact, const char *pszGroup); + servlistpendingitem* servlistPendingRemoveItem(int nType, HCONTACT hContact, const char *pszGroup); - void servlistPendingAddContactOperation(HANDLE hContact, LPARAM param, PENDING_CONTACT_CALLBACK callback, DWORD flags); + void servlistPendingAddContactOperation(HCONTACT hContact, LPARAM param, PENDING_CONTACT_CALLBACK callback, DWORD flags); void servlistPendingAddGroupOperation(const char *pszGroup, LPARAM param, PENDING_GROUP_CALLBACK callback, DWORD flags); - int servlistPendingAddContact(HANDLE hContact, WORD wContactID, WORD wGroupID, LPARAM param, PENDING_CONTACT_CALLBACK callback, int bDoInline, LPARAM operationParam = 0, PENDING_CONTACT_CALLBACK operationCallback = NULL); + int servlistPendingAddContact(HCONTACT hContact, WORD wContactID, WORD wGroupID, LPARAM param, PENDING_CONTACT_CALLBACK callback, int bDoInline, LPARAM operationParam = 0, PENDING_CONTACT_CALLBACK operationCallback = NULL); int servlistPendingAddGroup(const char *pszGroup, WORD wGroupID, LPARAM param, PENDING_GROUP_CALLBACK callback, int bDoInline, LPARAM operationParam = 0, PENDING_GROUP_CALLBACK operationCallback = NULL); - void servlistPendingRemoveContact(HANDLE hContact, WORD wContactID, WORD wGroupID, int nResult); + void servlistPendingRemoveContact(HCONTACT hContact, WORD wContactID, WORD wGroupID, int nResult); void servlistPendingRemoveGroup(const char *pszGroup, WORD wGroupID, int nResult); void servlistPendingFlushOperations(); @@ -621,8 +622,8 @@ struct CIcqProto : public PROTO int nJustAddedSize; HANDLE* pdwJustAddedList; - void AddJustAddedContact(HANDLE hContact); - BOOL IsContactJustAdded(HANDLE hContact); + void AddJustAddedContact(HCONTACT hContact); + BOOL IsContactJustAdded(HCONTACT hContact); void FlushJustAddedContacts(); WORD GenerateServerID(int bGroupType, int bFlags, int wCount = 0); @@ -648,18 +649,18 @@ struct CIcqProto : public PROTO void servlistCreateGroup(const char *szGroupPath, LPARAM param, PENDING_GROUP_CALLBACK callback); int __cdecl servlistAddContact_gotGroup(const char *szGroup, WORD wGroupID, LPARAM lParam, int nResult); - int __cdecl servlistAddContact_Ready(HANDLE hContact, WORD wContactID, WORD wGroupID, LPARAM lParam, int nResult); - void servlistAddContact(HANDLE hContact, const char *pszGroup); + int __cdecl servlistAddContact_Ready(HCONTACT hContact, WORD wContactID, WORD wGroupID, LPARAM lParam, int nResult); + void servlistAddContact(HCONTACT hContact, const char *pszGroup); - int __cdecl servlistRemoveContact_Ready(HANDLE hContact, WORD contactID, WORD groupID, LPARAM lParam, int nResult); - void servlistRemoveContact(HANDLE hContact); + int __cdecl servlistRemoveContact_Ready(HCONTACT hContact, WORD contactID, WORD groupID, LPARAM lParam, int nResult); + void servlistRemoveContact(HCONTACT hContact); int __cdecl servlistMoveContact_gotTargetGroup(const char *szGroup, WORD wNewGroupID, LPARAM lParam, int nResult); - int __cdecl servlistMoveContact_Ready(HANDLE hContact, WORD contactID, WORD groupID, LPARAM lParam, int nResult); - void servlistMoveContact(HANDLE hContact, const char *pszNewGroup); + int __cdecl servlistMoveContact_Ready(HCONTACT hContact, WORD contactID, WORD groupID, LPARAM lParam, int nResult); + void servlistMoveContact(HCONTACT hContact, const char *pszNewGroup); - int __cdecl servlistUpdateContact_Ready(HANDLE hContact, WORD contactID, WORD groupID, LPARAM lParam, int nResult); - void servlistUpdateContact(HANDLE hContact); + int __cdecl servlistUpdateContact_Ready(HCONTACT hContact, WORD contactID, WORD groupID, LPARAM lParam, int nResult); + void servlistUpdateContact(HCONTACT hContact); int __cdecl servlistRenameGroup_Ready(const char *szGroup, WORD wGroupID, LPARAM lParam, int nResult); void servlistRenameGroup(char *szGroup, WORD wGroupId, char *szNewGroup); @@ -670,20 +671,20 @@ struct CIcqProto : public PROTO void removeGroupPathLinks(WORD wGroupID); int getServListGroupLevel(WORD wGroupId); - void resetServContactAuthState(HANDLE hContact, DWORD dwUin); + void resetServContactAuthState(HCONTACT hContact, DWORD dwUin); void FlushSrvGroupsCache(); int getCListGroupExists(const char *szGroup); - int moveContactToCListGroup(HANDLE hContact, const char *szGroup); /// TODO: this should be DB function + int moveContactToCListGroup(HCONTACT hContact, const char *szGroup); /// TODO: this should be DB function DWORD icq_sendServerItem(DWORD dwCookie, WORD wAction, WORD wGroupId, WORD wItemId, const char *szName, BYTE *pTLVs, int nTlvLength, WORD wItemType, DWORD dwOperation, DWORD dwTimeout, void **doubleObject); - DWORD icq_sendServerContact(HANDLE hContact, DWORD dwCookie, WORD wAction, WORD wGroupId, WORD wContactId, DWORD dwOperation, DWORD dwTimeout, void **doubleObject); + DWORD icq_sendServerContact(HCONTACT hContact, DWORD dwCookie, WORD wAction, WORD wGroupId, WORD wContactId, DWORD dwOperation, DWORD dwTimeout, void **doubleObject); DWORD icq_sendSimpleItem(DWORD dwCookie, WORD wAction, DWORD dwUin, char* szUID, WORD wGroupId, WORD wItemId, WORD wItemType, DWORD dwOperation, DWORD dwTimeout); DWORD icq_sendServerGroup(DWORD dwCookie, WORD wAction, WORD wGroupId, const char *szName, void *pContent, int cbContent, DWORD dwOperationFlags); - DWORD icq_modifyServerPrivacyItem(HANDLE hContact, DWORD dwUin, char *szUid, WORD wAction, DWORD dwOperation, WORD wItemId, WORD wType); - DWORD icq_removeServerPrivacyItem(HANDLE hContact, DWORD dwUin, char *szUid, WORD wItemId, WORD wType); - DWORD icq_addServerPrivacyItem(HANDLE hContact, DWORD dwUin, char *szUid, WORD wItemId, WORD wType); + DWORD icq_modifyServerPrivacyItem(HCONTACT hContact, DWORD dwUin, char *szUid, WORD wAction, DWORD dwOperation, WORD wItemId, WORD wType); + DWORD icq_removeServerPrivacyItem(HCONTACT hContact, DWORD dwUin, char *szUid, WORD wItemId, WORD wType); + DWORD icq_addServerPrivacyItem(HCONTACT hContact, DWORD dwUin, char *szUid, WORD wItemId, WORD wType); int __cdecl ServListDbSettingChanged(WPARAM wParam, LPARAM lParam); int __cdecl ServListDbContactDeleted(WPARAM wParam, LPARAM lParam); @@ -696,11 +697,11 @@ struct CIcqProto : public PROTO void icq_setidle(int bAllow); void icq_setstatus(WORD wStatus, const char *szStatusNote = NULL); - DWORD icq_sendGetInfoServ(HANDLE, DWORD, int); - DWORD icq_sendGetAimProfileServ(HANDLE hContact, char *szUid); - DWORD icq_sendGetAwayMsgServ(HANDLE, DWORD, int, WORD); - DWORD icq_sendGetAwayMsgServExt(HANDLE hContact, DWORD dwUin, char *szUID, int type, WORD wVersion); - DWORD icq_sendGetAimAwayMsgServ(HANDLE hContact, char *szUID, int type); + DWORD icq_sendGetInfoServ(HCONTACT hContact, DWORD, int); + DWORD icq_sendGetAimProfileServ(HCONTACT hContact, char *szUid); + DWORD icq_sendGetAwayMsgServ(HCONTACT hContact, DWORD, int, WORD); + DWORD icq_sendGetAwayMsgServExt(HCONTACT hContact, DWORD dwUin, char *szUID, int type, WORD wVersion); + DWORD icq_sendGetAimAwayMsgServ(HCONTACT hContact, char *szUID, int type); void icq_sendSetAimAwayMsgServ(const char *szMsg); void icq_sendFileSendServv7(filetransfer* ft, const char *szFiles); @@ -718,7 +719,7 @@ struct CIcqProto : public PROTO void icq_sendGenericContact(DWORD dwUin, const char *szUid, WORD wFamily, WORD wSubType); void icq_sendNewContact(DWORD dwUin, const char *szUid); void icq_sendRemoveContact(DWORD dwUin, const char *szUid); - void icq_sendChangeVisInvis(HANDLE hContact, DWORD dwUin, char* szUID, int list, int add); + void icq_sendChangeVisInvis(HCONTACT hContact, DWORD dwUin, char* szUID, int list, int add); void icq_sendEntireVisInvisList(int); void icq_sendAwayMsgReplyServ(DWORD, DWORD, DWORD, WORD, WORD, BYTE, char **); void icq_sendAwayMsgReplyServExt(DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wCookie, WORD wVersion, BYTE msgType, char **szMsg); @@ -736,11 +737,11 @@ struct CIcqProto : public PROTO void sendOwnerInfoRequest(void); DWORD sendUserInfoMultiRequest(BYTE *pRequestData, WORD wDataLen, int nItems); - DWORD icq_SendChannel1Message(DWORD dwUin, char *szUID, HANDLE hContact, char *pszText, cookie_message_data *pCookieData); - DWORD icq_SendChannel1MessageW(DWORD dwUin, char *szUID, HANDLE hContact, WCHAR *pszText, cookie_message_data *pCookieData); // UTF-16 - DWORD icq_SendChannel2Message(DWORD dwUin, HANDLE hContact, const char *szMessage, int nBodyLength, WORD wPriority, cookie_message_data *pCookieData, char *szCap); - DWORD icq_SendChannel2Contacts(DWORD dwUin, char *szUid, HANDLE hContact, const char *pData, WORD wDataLen, const char *pNames, WORD wNamesLen, cookie_message_data *pCookieData); - DWORD icq_SendChannel4Message(DWORD dwUin, HANDLE hContact, BYTE bMsgType, WORD wMsgLen, const char *szMsg, cookie_message_data *pCookieData); + DWORD icq_SendChannel1Message(DWORD dwUin, char *szUID, HCONTACT hContact, char *pszText, cookie_message_data *pCookieData); + DWORD icq_SendChannel1MessageW(DWORD dwUin, char *szUID, HCONTACT hContact, WCHAR *pszText, cookie_message_data *pCookieData); // UTF-16 + DWORD icq_SendChannel2Message(DWORD dwUin, HCONTACT hContact, const char *szMessage, int nBodyLength, WORD wPriority, cookie_message_data *pCookieData, char *szCap); + DWORD icq_SendChannel2Contacts(DWORD dwUin, char *szUid, HCONTACT hContact, const char *pData, WORD wDataLen, const char *pNames, WORD wNamesLen, cookie_message_data *pCookieData); + DWORD icq_SendChannel4Message(DWORD dwUin, HCONTACT hContact, BYTE bMsgType, WORD wMsgLen, const char *szMsg, cookie_message_data *pCookieData); void icq_sendAdvancedMsgAck(DWORD, DWORD, DWORD, WORD, BYTE, BYTE); void icq_sendContactsAck(DWORD dwUin, char *szUid, DWORD dwMsgID1, DWORD dwMsgID2); @@ -768,7 +769,7 @@ struct CIcqProto : public PROTO HANDLE AddToListByUIN(DWORD dwUin, DWORD dwFlags); HANDLE AddToListByUID(const char *szUID, DWORD dwFlags); - void ICQAddRecvEvent(HANDLE hContact, WORD wType, PROTORECVEVENT* pre, DWORD cbBlob, PBYTE pBlob, DWORD flags); + void ICQAddRecvEvent(HCONTACT hContact, WORD wType, PROTORECVEVENT* pre, DWORD cbBlob, PBYTE pBlob, DWORD flags); INT_PTR __cdecl IcqAddCapability(WPARAM wParam, LPARAM lParam); INT_PTR __cdecl IcqCheckCapability(WPARAM wParam, LPARAM lParam); @@ -787,22 +788,22 @@ struct CIcqProto : public PROTO HGENMENU hXStatusItems[XSTATUS_COUNT + 1]; void InitXStatusItems(BOOL bAllowStatus); - BYTE getContactXStatus(HANDLE hContact); - DWORD sendXStatusDetailsRequest(HANDLE hContact, int bForced); - DWORD requestXStatusDetails(HANDLE hContact, BOOL bAllowDelay); + BYTE getContactXStatus(HCONTACT hContact); + DWORD sendXStatusDetailsRequest(HCONTACT hContact, int bForced); + DWORD requestXStatusDetails(HCONTACT hContact, BOOL bAllowDelay); HICON getXStatusIcon(int bStatus, UINT flags); void setXStatusEx(BYTE bXStatus, BYTE bQuiet); - void handleXStatusCaps(DWORD dwUIN, char *szUID, HANDLE hContact, BYTE *caps, int capsize, char *moods, int moodsize); + void handleXStatusCaps(DWORD dwUIN, char *szUID, HCONTACT hContact, BYTE *caps, int capsize, char *moods, int moodsize); void updateServerCustomStatus(int fullUpdate); //----| icq_xtraz.cpp |--------------------------------------------------------------- void handleXtrazNotify(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char* szMsg, int nMsgLen, BOOL bThruDC); - void handleXtrazNotifyResponse(DWORD dwUin, HANDLE hContact, WORD wCookie, char* szMsg, int nMsgLen); + void handleXtrazNotifyResponse(DWORD dwUin, HCONTACT hContact, WORD wCookie, char* szMsg, int nMsgLen); void handleXtrazInvitation(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char* szMsg, int nMsgLen, BOOL bThruDC); void handleXtrazData(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char* szMsg, int nMsgLen, BOOL bThruDC); - DWORD SendXtrazNotifyRequest(HANDLE hContact, char* szQuery, char* szNotify, int bForced); + DWORD SendXtrazNotifyRequest(HCONTACT hContact, char* szQuery, char* szNotify, int bForced); void SendXtrazNotifyResponse(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char* szResponse, int nResponseLen, BOOL bThruDC); //----| init.cpp |-------------------------------------------------------------------- @@ -820,12 +821,12 @@ struct CIcqProto : public PROTO filetransfer *CreateIcqFileTransfer(); void ReleaseFileTransfer(void *ft); void SafeReleaseFileTransfer(void **ft); - oscar_filetransfer* FindOscarTransfer(HANDLE hContact, DWORD dwID1, DWORD dwID2); + oscar_filetransfer* FindOscarTransfer(HCONTACT hContact, DWORD dwID1, DWORD dwID2); oscar_listener* CreateOscarListener(oscar_filetransfer *ft, NETLIBNEWCONNECTIONPROC_V2 handler); void ReleaseOscarListener(oscar_listener **pListener); - void OpenOscarConnection(HANDLE hContact, oscar_filetransfer *ft, int type); + void OpenOscarConnection(HCONTACT hContact, oscar_filetransfer *ft, int type); void CloseOscarConnection(oscar_connection *oc); int CreateOscarProxyConnection(oscar_connection *oc); @@ -836,10 +837,10 @@ struct CIcqProto : public PROTO void handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *szUID, DWORD dwID1, DWORD dwID2, WORD wCommand); void handleRecvServResponseOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *szUID, void* ft); - HANDLE oftInitTransfer(HANDLE hContact, DWORD dwUin, char *szUid, const TCHAR **pszFiles, const TCHAR *szDescription); - HANDLE oftFileAllow(HANDLE hContact, HANDLE hTransfer, const TCHAR *szPath); - DWORD oftFileDeny(HANDLE hContact, HANDLE hTransfer, const TCHAR *szReason); - DWORD oftFileCancel(HANDLE hContact, HANDLE hTransfer); + HANDLE oftInitTransfer(HCONTACT hContact, DWORD dwUin, char *szUid, const TCHAR **pszFiles, const TCHAR *szDescription); + HANDLE oftFileAllow(HCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath); + DWORD oftFileDeny(HCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason); + DWORD oftFileCancel(HCONTACT hContact, HANDLE hTransfer); void oftFileResume(oscar_filetransfer *ft, int action, const TCHAR *szFilename); void sendOscarPacket(oscar_connection *oc, icq_packet *packet); @@ -863,17 +864,17 @@ struct CIcqProto : public PROTO int StringToListItemId(const char *szSetting,int def); //----| utilities.cpp |--------------------------------------------------------------- - char* ConvertMsgToUserSpecificAnsi(HANDLE hContact, const char* szMsg); + char* ConvertMsgToUserSpecificAnsi(HCONTACT hContact, const char* szMsg); char* GetUserStoredPassword(char *szBuffer, int cbSize); char* GetUserPassword(BOOL bAlways); WORD GetMyStatusFlags(); - DWORD ReportGenericSendError(HANDLE hContact, int nType, const char* szErrorMsg); + DWORD ReportGenericSendError(HCONTACT hContact, int nType, const char* szErrorMsg); void SetCurrentStatus(int nStatus); void __cdecl ProtocolAckThread(icq_ack_args* pArguments); - void SendProtoAck(HANDLE hContact, DWORD dwCookie, int nAckResult, int nAckType, char* pszMessage); + void SendProtoAck(HCONTACT hContact, DWORD dwCookie, int nAckResult, int nAckType, char* pszMessage); int NetLog_Direct(const char *fmt,...); int NetLog_Uni(BOOL bDC, const char *fmt,...); @@ -881,8 +882,8 @@ struct CIcqProto : public PROTO icq_critical_section *contactsCacheMutex; LIST contactsCache; - void AddToContactsCache(HANDLE hContact, DWORD dwUin, const char *szUid); - void DeleteFromContactsCache(HANDLE hContact); + void AddToContactsCache(HCONTACT hContact, DWORD dwUin, const char *szUid); + void DeleteFromContactsCache(HCONTACT hContact); void InitContactsCache(); void UninitContactsCache(); @@ -891,38 +892,38 @@ struct CIcqProto : public PROTO HANDLE NetLib_BindPort(NETLIBNEWCONNECTIONPROC_V2 pFunc, void* lParam, WORD* pwPort, DWORD* pdwIntIP); - HANDLE HandleFromCacheByUid(DWORD dwUin, const char *szUid); - HANDLE HContactFromUIN(DWORD dwUin, int *Added); - HANDLE HContactFromUID(DWORD dwUin, const char *szUid, int *Added); - HANDLE HContactFromAuthEvent(HANDLE hEvent); + HCONTACT HandleFromCacheByUid(DWORD dwUin, const char *szUid); + HCONTACT HContactFromUIN(DWORD dwUin, int *Added); + HCONTACT HContactFromUID(DWORD dwUin, const char *szUid, int *Added); + HCONTACT HContactFromAuthEvent(HANDLE hEvent); void ResetSettingsOnListReload(); void ResetSettingsOnConnect(); void ResetSettingsOnLoad(); - int IsMetaInfoChanged(HANDLE hContact); + int IsMetaInfoChanged(HCONTACT hContact); char *setStatusNoteText, *setStatusMoodData; void __cdecl SetStatusNoteThread(void *pArguments); int SetStatusNote(const char *szStatusNote, DWORD dwDelay, int bForced); int SetStatusMood(const char *szMoodData, DWORD dwDelay); - BOOL writeDbInfoSettingString(HANDLE hContact, const char* szSetting, char** buf, WORD* pwLength); - BOOL writeDbInfoSettingWord(HANDLE hContact, const char *szSetting, char **buf, WORD* pwLength); - BOOL writeDbInfoSettingWordWithTable(HANDLE hContact, const char *szSetting, const FieldNamesItem *table, char **buf, WORD* pwLength); - BOOL writeDbInfoSettingByte(HANDLE hContact, const char *pszSetting, char **buf, WORD* pwLength); - BOOL writeDbInfoSettingByteWithTable(HANDLE hContact, const char *szSetting, const FieldNamesItem *table, char **buf, WORD* pwLength); + BOOL writeDbInfoSettingString(HCONTACT hContact, const char* szSetting, char** buf, WORD* pwLength); + BOOL writeDbInfoSettingWord(HCONTACT hContact, const char *szSetting, char **buf, WORD* pwLength); + BOOL writeDbInfoSettingWordWithTable(HCONTACT hContact, const char *szSetting, const FieldNamesItem *table, char **buf, WORD* pwLength); + BOOL writeDbInfoSettingByte(HCONTACT hContact, const char *pszSetting, char **buf, WORD* pwLength); + BOOL writeDbInfoSettingByteWithTable(HCONTACT hContact, const char *szSetting, const FieldNamesItem *table, char **buf, WORD* pwLength); - void writeDbInfoSettingTLVStringUtf(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv); - void writeDbInfoSettingTLVWord(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv); - void writeDbInfoSettingTLVByte(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv); - void writeDbInfoSettingTLVDouble(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv); - void writeDbInfoSettingTLVDate(HANDLE hContact, const char *szSettingYear, const char *szSettingMonth, const char *szSettingDay, oscar_tlv_chain *chain, WORD wTlv); - void writeDbInfoSettingTLVBlob(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv); + void writeDbInfoSettingTLVStringUtf(HCONTACT hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv); + void writeDbInfoSettingTLVWord(HCONTACT hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv); + void writeDbInfoSettingTLVByte(HCONTACT hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv); + void writeDbInfoSettingTLVDouble(HCONTACT hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv); + void writeDbInfoSettingTLVDate(HCONTACT hContact, const char *szSettingYear, const char *szSettingMonth, const char *szSettingDay, oscar_tlv_chain *chain, WORD wTlv); + void writeDbInfoSettingTLVBlob(HCONTACT hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv); char** MirandaStatusToAwayMsg(int nStatus); - bool validateStatusMessageRequest(HANDLE hContact, WORD byMessageType); + bool validateStatusMessageRequest(HCONTACT hContact, WORD byMessageType); }; #endif diff --git a/protocols/IcqOscarJ/src/icq_rates.h b/protocols/IcqOscarJ/src/icq_rates.h index ab16e74007..7583bf9cb7 100644 --- a/protocols/IcqOscarJ/src/icq_rates.h +++ b/protocols/IcqOscarJ/src/icq_rates.h @@ -108,7 +108,7 @@ public: virtual void execute(); - HANDLE hContact; + HCONTACT hContact; DWORD dwUin; char *szUid; }; diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp index 5084742a9c..3de47b821b 100644 --- a/protocols/IcqOscarJ/src/icq_server.cpp +++ b/protocols/IcqOscarJ/src/icq_server.cpp @@ -192,7 +192,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) StopAvatarThread(); // Offline all contacts - HANDLE hContact = FindFirstContact(); + HCONTACT hContact = FindFirstContact(); while (hContact) { DWORD dwUIN; diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 5eac04a78b..fa866116bc 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -463,7 +463,7 @@ void CIcqProto::servlistProcessLogin() #define SPOF_AUTO_CREATE_ITEM 0x01 -int CIcqProto::servlistPendingFindItem(int nType, HANDLE hContact, const char *pszGroup) +int CIcqProto::servlistPendingFindItem(int nType, HCONTACT hContact, const char *pszGroup) { if (servlistPendingList) for (int i = 0; i < servlistPendingCount; i++) @@ -489,7 +489,7 @@ void CIcqProto::servlistPendingAddItem(servlistpendingitem *pItem) } -servlistpendingitem* CIcqProto::servlistPendingRemoveItem(int nType, HANDLE hContact, const char *pszGroup) +servlistpendingitem* CIcqProto::servlistPendingRemoveItem(int nType, HCONTACT hContact, const char *pszGroup) { // unregister pending item, trigger pending operations int iItem; servlistpendingitem *pItem = NULL; @@ -546,7 +546,7 @@ servlistpendingitem* CIcqProto::servlistPendingRemoveItem(int nType, HANDLE hCon } -void CIcqProto::servlistPendingAddContactOperation(HANDLE hContact, LPARAM param, PENDING_CONTACT_CALLBACK callback, DWORD flags) +void CIcqProto::servlistPendingAddContactOperation(HCONTACT hContact, LPARAM param, PENDING_CONTACT_CALLBACK callback, DWORD flags) { // add postponed operation (add contact, update contact, regroup resume, etc.) // - after contact is added int iItem; @@ -599,7 +599,7 @@ void CIcqProto::servlistPendingAddGroupOperation(const char *pszGroup, LPARAM pa } -int CIcqProto::servlistPendingAddContact(HANDLE hContact, WORD wContactID, WORD wGroupID, LPARAM param, PENDING_CONTACT_CALLBACK callback, int bDoInline, LPARAM operationParam, PENDING_CONTACT_CALLBACK operationCallback) +int CIcqProto::servlistPendingAddContact(HCONTACT hContact, WORD wContactID, WORD wGroupID, LPARAM param, PENDING_CONTACT_CALLBACK callback, int bDoInline, LPARAM operationParam, PENDING_CONTACT_CALLBACK operationCallback) { int iItem; servlistpendingitem *pItem = NULL; @@ -700,7 +700,7 @@ int CIcqProto::servlistPendingAddGroup(const char *pszGroup, WORD wGroupID, LPAR } -void CIcqProto::servlistPendingRemoveContact(HANDLE hContact, WORD wContactID, WORD wGroupID, int nResult) +void CIcqProto::servlistPendingRemoveContact(HCONTACT hContact, WORD wContactID, WORD wGroupID, int nResult) { #ifdef _DEBUG debugLogA("Server-List: %s contact %x operation.", (nResult != PENDING_RESULT_PURGE) ? "Ending" : "Purging", hContact); @@ -800,7 +800,7 @@ void CIcqProto::servlistPendingFlushOperations() // used for adding new contacts to list - sync with visible items -void CIcqProto::AddJustAddedContact(HANDLE hContact) +void CIcqProto::AddJustAddedContact(HCONTACT hContact) { icq_lock l(servlistMutex); @@ -816,7 +816,7 @@ void CIcqProto::AddJustAddedContact(HANDLE hContact) // was the contact added during this serv-list load -BOOL CIcqProto::IsContactJustAdded(HANDLE hContact) +BOOL CIcqProto::IsContactJustAdded(HCONTACT hContact) { icq_lock l(servlistMutex); @@ -975,7 +975,7 @@ void CIcqProto::LoadServerIDs() nGroups = nServerIDListCount - nStart; - HANDLE hContact = FindFirstContact(); + HCONTACT hContact = FindFirstContact(); while (hContact) { // search all our contacts, reserve their server IDs @@ -1147,7 +1147,7 @@ DWORD CIcqProto::icq_sendServerItem(DWORD dwCookie, WORD wAction, WORD wGroupId, } -DWORD CIcqProto::icq_sendServerContact(HANDLE hContact, DWORD dwCookie, WORD wAction, WORD wGroupId, WORD wContactId, DWORD dwOperation, DWORD dwTimeout, void **doubleObject) +DWORD CIcqProto::icq_sendServerContact(HCONTACT hContact, DWORD dwCookie, WORD wAction, WORD wGroupId, WORD wContactId, DWORD dwOperation, DWORD dwTimeout, void **doubleObject) { DWORD dwUin; uid_str szUid; @@ -1286,7 +1286,7 @@ DWORD CIcqProto::icq_sendServerGroup(DWORD dwCookie, WORD wAction, WORD wGroupId } -DWORD CIcqProto::icq_modifyServerPrivacyItem(HANDLE hContact, DWORD dwUin, char *szUid, WORD wAction, DWORD dwOperation, WORD wItemId, WORD wType) +DWORD CIcqProto::icq_modifyServerPrivacyItem(HCONTACT hContact, DWORD dwUin, char *szUid, WORD wAction, DWORD dwOperation, WORD wItemId, WORD wType) { cookie_servlist_action *ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action)); DWORD dwCookie; @@ -1306,13 +1306,13 @@ DWORD CIcqProto::icq_modifyServerPrivacyItem(HANDLE hContact, DWORD dwUin, char } -DWORD CIcqProto::icq_removeServerPrivacyItem(HANDLE hContact, DWORD dwUin, char *szUid, WORD wItemId, WORD wType) +DWORD CIcqProto::icq_removeServerPrivacyItem(HCONTACT hContact, DWORD dwUin, char *szUid, WORD wItemId, WORD wType) { return icq_modifyServerPrivacyItem(hContact, dwUin, szUid, ICQ_LISTS_REMOVEFROMLIST, SSA_PRIVACY_REMOVE, wItemId, wType); } -DWORD CIcqProto::icq_addServerPrivacyItem(HANDLE hContact, DWORD dwUin, char *szUid, WORD wItemId, WORD wType) +DWORD CIcqProto::icq_addServerPrivacyItem(HCONTACT hContact, DWORD dwUin, char *szUid, WORD wItemId, WORD wType) { return icq_modifyServerPrivacyItem(hContact, dwUin, szUid, ICQ_LISTS_ADDTOLIST, SSA_PRIVACY_ADD, wItemId, wType); } @@ -1360,7 +1360,7 @@ void* CIcqProto::collectBuddyGroup(WORD wGroupID, int *count) { WORD* buf = NULL; int cnt = 0; - HANDLE hContact; + HCONTACT hContact; WORD wItemID; hContact = FindFirstContact(); @@ -1395,7 +1395,7 @@ void* CIcqProto::collectGroups(int *count) WORD* buf = NULL; int cnt = 0; int i; - HANDLE hContact; + HCONTACT hContact; WORD wGroupID; hContact = FindFirstContact(); @@ -1578,7 +1578,7 @@ int CIcqProto::getCListGroupExists(const char *szGroup) } -int CIcqProto::moveContactToCListGroup(HANDLE hContact, const char *szGroup) +int CIcqProto::moveContactToCListGroup(HCONTACT hContact, const char *szGroup) { HANDLE hGroup = Clist_CreateGroup(0, ptrT( mir_utf8decodeT(szGroup))); @@ -2009,7 +2009,7 @@ int CIcqProto::servlistAddContact_gotGroup(const char *szGroup, WORD wGroupID, L // Need to be called when Pending Contact is active -int CIcqProto::servlistAddContact_Ready(HANDLE hContact, WORD wContactID, WORD wGroupID, LPARAM lParam, int nResult) +int CIcqProto::servlistAddContact_Ready(HCONTACT hContact, WORD wContactID, WORD wGroupID, LPARAM lParam, int nResult) { cookie_servlist_action* ack = (cookie_servlist_action*)lParam; @@ -2039,7 +2039,7 @@ int CIcqProto::servlistAddContact_Ready(HANDLE hContact, WORD wContactID, WORD w // Called when contact should be added to server list, if group does not exist, create one -void CIcqProto::servlistAddContact(HANDLE hContact, const char *pszGroup) +void CIcqProto::servlistAddContact(HCONTACT hContact, const char *pszGroup) { DWORD dwUin; uid_str szUid; @@ -2068,7 +2068,7 @@ void CIcqProto::servlistAddContact(HANDLE hContact, const char *pszGroup) } -int CIcqProto::servlistRemoveContact_Ready(HANDLE hContact, WORD contactID, WORD groupID, LPARAM lParam, int nResult) +int CIcqProto::servlistRemoveContact_Ready(HCONTACT hContact, WORD contactID, WORD groupID, LPARAM lParam, int nResult) { WORD wGroupID; WORD wItemID; @@ -2115,7 +2115,7 @@ int CIcqProto::servlistRemoveContact_Ready(HANDLE hContact, WORD contactID, WORD // Called when contact should be removed from server list, remove group if it remain empty -void CIcqProto::servlistRemoveContact(HANDLE hContact) +void CIcqProto::servlistRemoveContact(HCONTACT hContact) { DWORD dwUin; uid_str szUid; @@ -2201,7 +2201,7 @@ int CIcqProto::servlistMoveContact_gotTargetGroup(const char *szGroup, WORD wNew } -int CIcqProto::servlistMoveContact_Ready(HANDLE hContact, WORD contactID, WORD groupID, LPARAM lParam, int nResult) +int CIcqProto::servlistMoveContact_Ready(HCONTACT hContact, WORD contactID, WORD groupID, LPARAM lParam, int nResult) { cookie_servlist_action *ack = (cookie_servlist_action*)lParam; @@ -2233,7 +2233,7 @@ int CIcqProto::servlistMoveContact_Ready(HANDLE hContact, WORD contactID, WORD g // Called when contact should be moved from one group to another, create new, remove empty -void CIcqProto::servlistMoveContact(HANDLE hContact, const char *pszNewGroup) +void CIcqProto::servlistMoveContact(HCONTACT hContact, const char *pszNewGroup) { DWORD dwUin; uid_str szUid; @@ -2277,7 +2277,7 @@ void CIcqProto::servlistMoveContact(HANDLE hContact, const char *pszNewGroup) } -int CIcqProto::servlistUpdateContact_Ready(HANDLE hContact, WORD contactID, WORD groupID, LPARAM lParam, int nResult) +int CIcqProto::servlistUpdateContact_Ready(HCONTACT hContact, WORD contactID, WORD groupID, LPARAM lParam, int nResult) { cookie_servlist_action *ack = (cookie_servlist_action*)lParam; @@ -2326,7 +2326,7 @@ int CIcqProto::servlistUpdateContact_Ready(HANDLE hContact, WORD contactID, WORD // Is called when a contact' details has been changed locally to update // the server side details. -void CIcqProto::servlistUpdateContact(HANDLE hContact) +void CIcqProto::servlistUpdateContact(HCONTACT hContact) { DWORD dwUin; uid_str szUid; @@ -2533,7 +2533,7 @@ void CIcqProto::servlistRemoveGroup(const char *szGroup, WORD wGroupId) }*/ -void CIcqProto::resetServContactAuthState(HANDLE hContact, DWORD dwUin) +void CIcqProto::resetServContactAuthState(HCONTACT hContact, DWORD dwUin) { WORD wContactId = getWord(hContact, DBSETTING_SERVLIST_ID, 0); WORD wGroupId = getWord(hContact, DBSETTING_SERVLIST_GROUP, 0); @@ -2593,14 +2593,14 @@ int CIcqProto::ServListDbSettingChanged(WPARAM wParam, LPARAM lParam) if (!strcmpnull(cws->szSetting, "MyHandle") && getByte("StoreServerDetails", DEFAULT_SS_STORE)) { // Update contact's details in server-list - servlistUpdateContact((HANDLE)wParam); + servlistUpdateContact((HCONTACT)wParam); } // Has contact been moved to another group? if (!strcmpnull(cws->szSetting, "Group") && getByte("StoreServerDetails", DEFAULT_SS_STORE)) { // Read group from DB - char* szNewGroup = getContactCListGroup((HANDLE)wParam); + char* szNewGroup = getContactCListGroup((HCONTACT)wParam); SAFE_FREE(&szNewGroup); } @@ -2610,7 +2610,7 @@ int CIcqProto::ServListDbSettingChanged(WPARAM wParam, LPARAM lParam) if (!strcmpnull(cws->szSetting, "MyNotes") && getByte("StoreServerDetails", DEFAULT_SS_STORE)) { // Update contact's details in server-list - servlistUpdateContact((HANDLE)wParam); + servlistUpdateContact((HCONTACT)wParam); } } @@ -2624,57 +2624,48 @@ int CIcqProto::ServListDbContactDeleted(WPARAM wParam, LPARAM lParam) debugLogA("DB-Events: Contact %x deleted.", wParam); #endif - DeleteFromContactsCache((HANDLE)wParam); + DeleteFromContactsCache((HCONTACT)wParam); if ( !icqOnline() && m_bSsiEnabled) { // contact was deleted only locally - retrieve full list on next connect - setWord((HANDLE)wParam, "SrvRecordCount", 0); + setWord((HCONTACT)wParam, "SrvRecordCount", 0); } if ( !icqOnline() || !m_bSsiEnabled) return 0; - { // we need all server contacts on local buddy list - DWORD dwUIN; - uid_str szUID; + HCONTACT hContact = (HCONTACT)wParam; - if (getContactUid((HANDLE)wParam, &dwUIN, &szUID)) - return 0; + // we need all server contacts on local buddy list + DWORD dwUIN; + uid_str szUID; + if (getContactUid(hContact, &dwUIN, &szUID)) + return 0; - WORD wContactID = getWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0); - WORD wGroupID = getWord((HANDLE)wParam, DBSETTING_SERVLIST_GROUP, 0); - WORD wVisibleID = getWord((HANDLE)wParam, DBSETTING_SERVLIST_PERMIT, 0); - WORD wInvisibleID = getWord((HANDLE)wParam, DBSETTING_SERVLIST_DENY, 0); - WORD wIgnoreID = getWord((HANDLE)wParam, DBSETTING_SERVLIST_IGNORE, 0); + WORD wContactID = getWord(hContact, DBSETTING_SERVLIST_ID, 0); + WORD wGroupID = getWord(hContact, DBSETTING_SERVLIST_GROUP, 0); + WORD wVisibleID = getWord(hContact, DBSETTING_SERVLIST_PERMIT, 0); + WORD wInvisibleID = getWord(hContact, DBSETTING_SERVLIST_DENY, 0); + WORD wIgnoreID = getWord(hContact, DBSETTING_SERVLIST_IGNORE, 0); - // Remove from queue for user details request - icq_DequeueUser(dwUIN); + // Remove from queue for user details request + icq_DequeueUser(dwUIN); - // Close all opened peer connections - CloseContactDirectConns((HANDLE)wParam); + // Close all opened peer connections + CloseContactDirectConns(hContact); - if ((wGroupID && wContactID) || wVisibleID || wInvisibleID || wIgnoreID) - { - if (wContactID) - { // delete contact from server - servlistRemoveContact((HANDLE)wParam); - } + if ((wGroupID && wContactID) || wVisibleID || wInvisibleID || wIgnoreID) { + if (wContactID) // delete contact from server + servlistRemoveContact(hContact); - if (wVisibleID) - { // detete permit record - icq_removeServerPrivacyItem((HANDLE)wParam, dwUIN, szUID, wVisibleID, SSI_ITEM_PERMIT); - } + if (wVisibleID) // detete permit record + icq_removeServerPrivacyItem(hContact, dwUIN, szUID, wVisibleID, SSI_ITEM_PERMIT); - if (wInvisibleID) - { // delete deny record - icq_removeServerPrivacyItem((HANDLE)wParam, dwUIN, szUID, wInvisibleID, SSI_ITEM_DENY); - } + if (wInvisibleID) // delete deny record + icq_removeServerPrivacyItem(hContact, dwUIN, szUID, wInvisibleID, SSI_ITEM_DENY); - if (wIgnoreID) - { // delete ignore record - icq_removeServerPrivacyItem((HANDLE)wParam, dwUIN, szUID, wIgnoreID, SSI_ITEM_IGNORE); - } - } + if (wIgnoreID) // delete ignore record + icq_removeServerPrivacyItem(hContact, dwUIN, szUID, wIgnoreID, SSI_ITEM_IGNORE); } return 0; @@ -2683,7 +2674,7 @@ int CIcqProto::ServListDbContactDeleted(WPARAM wParam, LPARAM lParam) int CIcqProto::ServListCListGroupChange(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; CLISTGROUPCHANGE *grpchg = (CLISTGROUPCHANGE*)lParam; if (!icqOnline() || !m_bSsiEnabled || bIsSyncingCL) diff --git a/protocols/IcqOscarJ/src/icq_servlist.h b/protocols/IcqOscarJ/src/icq_servlist.h index 76118ce3c0..3325a16538 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.h +++ b/protocols/IcqOscarJ/src/icq_servlist.h @@ -53,12 +53,12 @@ struct CIcqProto; // callback prototypes for pending operation mechanism: typedef int (__cdecl CIcqProto::*PENDING_GROUP_CALLBACK)(const char* pszGroup, WORD wGroupId, LPARAM lParam, int nResult); -typedef int (__cdecl CIcqProto::*PENDING_CONTACT_CALLBACK)(HANDLE hContact, WORD wContactId, WORD wGroupId, LPARAM lParam, int nResult); +typedef int (__cdecl CIcqProto::*PENDING_CONTACT_CALLBACK)(HCONTACT hContact, WORD wContactId, WORD wGroupId, LPARAM lParam, int nResult); // cookie struct for SSI actions struct cookie_servlist_action { - HANDLE hContact; + HCONTACT hContact; char *szGroup; WORD wContactId; WORD wGroupId; @@ -159,7 +159,7 @@ struct servlistpendingoperation struct servlistpendingitem { int nType; - HANDLE hContact; + HCONTACT hContact; char* szGroup; WORD wContactID; WORD wGroupID; diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp index 7b4aa7d4ba..ac6b56a295 100644 --- a/protocols/IcqOscarJ/src/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp @@ -62,7 +62,7 @@ static void UpdateAllContactsCheckmark(HWND hwndList, CIcqProto* ppro, HANDLE ph { int check = 1; - HANDLE hContact = ppro->FindFirstContact(); + HCONTACT hContact = ppro->FindFirstContact(); while (hContact) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); @@ -87,7 +87,7 @@ static int UpdateCheckmarks(HWND hwndList, CIcqProto* ppro, HANDLE phItemAll) int bAll = 1; bListInit = 1; // lock CLC events - HANDLE hContact = ppro->FindFirstContact(); + HCONTACT hContact = ppro->FindFirstContact(); while (hContact) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); @@ -112,7 +112,7 @@ static int UpdateCheckmarks(HWND hwndList, CIcqProto* ppro, HANDLE phItemAll) static void DeleteOtherContactsFromControl(HWND hCtrl, CIcqProto* ppro) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hCtrl, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) if (!ppro->IsICQContact(hContact)) @@ -191,7 +191,7 @@ static DWORD sendUploadGroup(CIcqProto* ppro, WORD wAction, WORD wGroupId, char* return 0; } -static DWORD sendUploadBuddy(CIcqProto* ppro, HANDLE hContact, WORD wAction, DWORD dwUin, char *szUID, WORD wContactId, WORD wGroupId, WORD wItemType) +static DWORD sendUploadBuddy(CIcqProto* ppro, HCONTACT hContact, WORD wAction, DWORD dwUin, char *szUID, WORD wContactId, WORD wGroupId, WORD wItemType) { DWORD dwCookie; cookie_servlist_action* ack; @@ -260,7 +260,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara static int currentSequence; static int currentAction; static int currentState; - static HANDLE hCurrentContact; + static HCONTACT hCurrentContact; static int lastAckResult = 0; static WORD wNewContactId; static WORD wNewGroupId; @@ -511,7 +511,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara // and every time an ack from the server has been taken care of. case M_UPLOADMORE: { - HANDLE hContact; + HCONTACT hContact; HANDLE hItem; DWORD dwUin; uid_str szUid; @@ -933,7 +933,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara case CLN_CHECKCHANGED: { NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam; - HANDLE hContact; + HCONTACT hContact; HANDLE hItem; if (bListInit) break; diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index 946191403c..612b970c50 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -42,7 +42,7 @@ int OnReloadIcons(WPARAM wParam, LPARAM lParam) return 0; } -BYTE CIcqProto::getContactXStatus(HANDLE hContact) +BYTE CIcqProto::getContactXStatus(HCONTACT hContact) { if (!m_bXStatusEnabled && !m_bMoodsEnabled) return 0; @@ -51,7 +51,7 @@ BYTE CIcqProto::getContactXStatus(HANDLE hContact) return (bXStatus < 1 || bXStatus > XSTATUS_COUNT) ? 0 : bXStatus; } -DWORD CIcqProto::sendXStatusDetailsRequest(HANDLE hContact, int bForced) +DWORD CIcqProto::sendXStatusDetailsRequest(HCONTACT hContact, int bForced) { DWORD dwCookie = 0; @@ -67,7 +67,7 @@ DWORD CIcqProto::sendXStatusDetailsRequest(HANDLE hContact, int bForced) return dwCookie; } -DWORD CIcqProto::requestXStatusDetails(HANDLE hContact, BOOL bAllowDelay) +DWORD CIcqProto::requestXStatusDetails(HCONTACT hContact, BOOL bAllowDelay) { if (!validateStatusMessageRequest(hContact, MTYPE_SCRIPT_NOTIFY)) return 0; // apply privacy rules @@ -169,7 +169,7 @@ HICON CIcqProto::getXStatusIcon(int bStatus, UINT flags) return (flags & LR_SHARED || !icon) ? icon : CopyIcon(icon); } -void setContactExtraIcon(HANDLE hContact, int xstatus) +void setContactExtraIcon(HCONTACT hContact, int xstatus) { ExtraIcon_SetIcon(hExtraXStatus, hContact, (xstatus > 0) ? hXStatusIcons[xstatus-1] : NULL); } @@ -393,7 +393,7 @@ const int moodXStatus[XSTATUS_COUNT] = { 81, 84}; -void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, HANDLE hContact, BYTE *caps, int capsize, char *moods, int moodsize) +void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, HCONTACT hContact, BYTE *caps, int capsize, char *moods, int moodsize) { int bChanged = FALSE; int nCustomStatusID = 0, nMoodID = 0; @@ -579,7 +579,7 @@ struct SetXStatusData CIcqProto* ppro; BYTE bAction; BYTE bXStatus; - HANDLE hContact; + HCONTACT hContact; HANDLE hEvent; DWORD iEvent; int countdown; @@ -593,7 +593,7 @@ struct InitXStatusData BYTE bXStatus; char* szXStatusName; char* szXStatusMsg; - HANDLE hContact; + HCONTACT hContact; }; #define HM_PROTOACK (WM_USER+10) @@ -912,7 +912,7 @@ INT_PTR CIcqProto::ShowXStatusDetails(WPARAM wParam, LPARAM lParam) InitXStatusData init; init.ppro = this; init.bAction = 1; // retrieve - init.hContact = (HANDLE)wParam; + init.hContact = (HCONTACT)wParam; CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SETXSTATUS), NULL, SetXStatusDlgProc, (LPARAM)&init); return 0; @@ -971,7 +971,7 @@ INT_PTR CIcqProto::SetXStatusEx(WPARAM wParam, LPARAM lParam) INT_PTR CIcqProto::GetXStatusEx(WPARAM wParam, LPARAM lParam) { CUSTOM_STATUS *pData = (CUSTOM_STATUS*)lParam; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!m_bXStatusEnabled && !m_bMoodsEnabled) return 1; @@ -1088,7 +1088,7 @@ INT_PTR CIcqProto::GetXStatusIcon(WPARAM wParam, LPARAM lParam) INT_PTR CIcqProto::RequestXStatusDetails(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!m_bXStatusEnabled) return 0; @@ -1105,7 +1105,7 @@ INT_PTR CIcqProto::RequestAdvStatusIconIdx(WPARAM wParam, LPARAM lParam) if (!m_bXStatusEnabled && !m_bMoodsEnabled) return -1; - BYTE bXStatus = getContactXStatus((HANDLE)wParam); + BYTE bXStatus = getContactXStatus((HCONTACT)wParam); if (bXStatus) { if (!bXStatusCListIconsValid[bXStatus-1]) { // adding icon int idx = hXStatusCListIcons[bXStatus-1]; diff --git a/protocols/IcqOscarJ/src/icq_xtraz.cpp b/protocols/IcqOscarJ/src/icq_xtraz.cpp index 58e8230804..45ff2829fe 100644 --- a/protocols/IcqOscarJ/src/icq_xtraz.cpp +++ b/protocols/IcqOscarJ/src/icq_xtraz.cpp @@ -35,7 +35,7 @@ void CIcqProto::handleXtrazNotify(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD w char *szNotify = strstrnull(szMsg, ""); char *szQuery = strstrnull(szMsg, ""); - HANDLE hContact = HContactFromUIN(dwUin, NULL); + HCONTACT hContact = HContactFromUIN(dwUin, NULL); if (hContact) // user sent us xtraz, he supports it SetContactCapabilities(hContact, CAPF_XTRAZ); @@ -174,7 +174,7 @@ void CIcqProto::handleXtrazNotify(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD w } -void CIcqProto::handleXtrazNotifyResponse(DWORD dwUin, HANDLE hContact, WORD wCookie, char* szMsg, int nMsgLen) +void CIcqProto::handleXtrazNotifyResponse(DWORD dwUin, HCONTACT hContact, WORD wCookie, char* szMsg, int nMsgLen) { char *szMem, *szRes, *szEnd; int nResLen; @@ -294,7 +294,7 @@ static char* getXmlPidItem(const char* szData, int nLen) void CIcqProto::handleXtrazInvitation(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char* szMsg, int nMsgLen, BOOL bThruDC) { - HANDLE hContact = HContactFromUIN(dwUin, NULL); + HCONTACT hContact = HContactFromUIN(dwUin, NULL); if (hContact) // user sent us xtraz, he supports it SetContactCapabilities(hContact, CAPF_XTRAZ); @@ -310,7 +310,7 @@ void CIcqProto::handleXtrazInvitation(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WO void CIcqProto::handleXtrazData(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCookie, char* szMsg, int nMsgLen, BOOL bThruDC) { - HANDLE hContact; + HCONTACT hContact; char* szPluginID; hContact = HContactFromUIN(dwUin, NULL); @@ -367,7 +367,7 @@ void CIcqProto::handleXtrazData(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD wCo // Functions really sending Xtraz stuff -DWORD CIcqProto::SendXtrazNotifyRequest(HANDLE hContact, char* szQuery, char* szNotify, int bForced) +DWORD CIcqProto::SendXtrazNotifyRequest(HCONTACT hContact, char* szQuery, char* szNotify, int bForced) { char *szQueryBody; char *szNotifyBody; @@ -409,7 +409,7 @@ void CIcqProto::SendXtrazNotifyResponse(DWORD dwUin, DWORD dwMID, DWORD dwMID2, char *szResBody = MangleXml(szResponse, nResponseLen); int nBodyLen = strlennull(szResBody) + 21; char *szBody = (char*)_alloca(nBodyLen); - HANDLE hContact = HContactFromUIN(dwUin, NULL); + HCONTACT hContact = HContactFromUIN(dwUin, NULL); if (hContact != INVALID_HANDLE_VALUE && !CheckContactCapabilities(hContact, CAPF_XTRAZ)) { SAFE_FREE(&szResBody); diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index 4b2003650d..c0077c9c89 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -38,12 +38,12 @@ INT_PTR CIcqProto::AddServerContact(WPARAM wParam, LPARAM lParam) if (!m_bSsiEnabled) return 0; // Does this contact have a UID? - if (!getContactUid((HANDLE)wParam, &dwUin, &szUid) && !getWord((HANDLE)wParam, DBSETTING_SERVLIST_ID, 0) && !getWord((HANDLE)wParam, DBSETTING_SERVLIST_IGNORE, 0)) + if (!getContactUid((HCONTACT)wParam, &dwUin, &szUid) && !getWord((HCONTACT)wParam, DBSETTING_SERVLIST_ID, 0) && !getWord((HCONTACT)wParam, DBSETTING_SERVLIST_IGNORE, 0)) { /// TODO: remove possible 0x6A TLV in contact server-list data!!! // Read group from DB - char *pszGroup = getContactCListGroup((HANDLE)wParam); + char *pszGroup = getContactCListGroup((HCONTACT)wParam); - servlistAddContact((HANDLE)wParam, pszGroup); + servlistAddContact((HCONTACT)wParam, pszGroup); SAFE_FREE((void**)&pszGroup); } return 0; @@ -88,7 +88,7 @@ INT_PTR CIcqProto::GetInfoSetting(WPARAM wParam, LPARAM lParam) { DBCONTACTGETSETTING *cgs = (DBCONTACTGETSETTING*)lParam; BYTE type = cgs->pValue->type; - INT_PTR rc = db_get_s((HANDLE)wParam, cgs->szModule, cgs->szSetting, cgs->pValue, 0); + INT_PTR rc = db_get_s((HCONTACT)wParam, cgs->szModule, cgs->szSetting, cgs->pValue, 0); if (rc) return rc; @@ -458,13 +458,13 @@ INT_PTR CIcqProto::GrantAuthorization(WPARAM wParam, LPARAM lParam) DWORD dwUin; uid_str szUid; - if (getContactUid((HANDLE)wParam, &dwUin, &szUid)) + if (getContactUid((HCONTACT)wParam, &dwUin, &szUid)) return 0; // Invalid contact // send without reason, do we need any ? icq_sendGrantAuthServ(dwUin, szUid, NULL); // auth granted, remove contact menu item - delSetting((HANDLE)wParam, "Grant"); + delSetting((HCONTACT)wParam, "Grant"); } return 0; @@ -494,7 +494,7 @@ INT_PTR CIcqProto::RevokeAuthorization(WPARAM wParam, LPARAM lParam) DWORD dwUin; uid_str szUid; - if (getContactUid((HANDLE)wParam, &dwUin, &szUid)) + if (getContactUid((HCONTACT)wParam, &dwUin, &szUid)) return 0; // Invalid contact if (MessageBox(NULL, TranslateT("Are you sure you want to revoke user's authorization?\nThis will remove you from his/her list on some clients."), TranslateT("Confirmation"), MB_ICONQUESTION | MB_YESNO) != IDYES) @@ -636,7 +636,7 @@ INT_PTR CIcqProto::SetPassword(WPARAM wParam, LPARAM lParam) HANDLE CIcqProto::AddToListByUIN(DWORD dwUin, DWORD dwFlags) { int bAdded; - HANDLE hContact = HContactFromUIN(dwUin, &bAdded); + HCONTACT hContact = HContactFromUIN(dwUin, &bAdded); if (hContact) { if (!(dwFlags & PALF_TEMPORARY) && db_get_b(hContact, "CList", "NotOnList", 0)) @@ -655,7 +655,7 @@ HANDLE CIcqProto::AddToListByUIN(DWORD dwUin, DWORD dwFlags) HANDLE CIcqProto::AddToListByUID(const char *szUID, DWORD dwFlags) { int bAdded; - HANDLE hContact = HContactFromUID(0, szUID, &bAdded); + HCONTACT hContact = HContactFromUID(0, szUID, &bAdded); if (hContact) { if (!(dwFlags & PALF_TEMPORARY) && db_get_b(hContact, "CList", "NotOnList", 0)) @@ -673,7 +673,7 @@ HANDLE CIcqProto::AddToListByUID(const char *szUID, DWORD dwFlags) ///////////////////////////////////////////////////////////////////////////////////////// -void CIcqProto::ICQAddRecvEvent(HANDLE hContact, WORD wType, PROTORECVEVENT* pre, DWORD cbBlob, PBYTE pBlob, DWORD flags) +void CIcqProto::ICQAddRecvEvent(HCONTACT hContact, WORD wType, PROTORECVEVENT* pre, DWORD cbBlob, PBYTE pBlob, DWORD flags) { if (pre->flags & PREF_CREATEREAD) flags |= DBEF_READ; @@ -714,7 +714,7 @@ INT_PTR __cdecl CIcqProto::IcqCheckCapability(WPARAM wParam, LPARAM lParam) { int res = 0; DBVARIANT dbvariant; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ICQ_CUSTOMCAP *icqCustomCap = (ICQ_CUSTOMCAP *)lParam; db_get(hContact, m_szModuleName, "CapBuf", &dbvariant); diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index bb764f6efa..b9d112dff3 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -33,7 +33,7 @@ struct oscarthreadstartinfo { int type; int incoming; - HANDLE hContact; + HCONTACT hContact; HANDLE hConnection; DWORD dwRemoteIP; oscar_filetransfer *ft; @@ -171,7 +171,7 @@ int CIcqProto::IsValidOscarTransfer(void *ft) } -oscar_filetransfer* CIcqProto::FindOscarTransfer(HANDLE hContact, DWORD dwID1, DWORD dwID2) +oscar_filetransfer* CIcqProto::FindOscarTransfer(HCONTACT hContact, DWORD dwID1, DWORD dwID2) { icq_lock l(oftMutex); @@ -377,7 +377,7 @@ void CIcqProto::ReleaseOscarListener(oscar_listener **pListener) void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *szUID, DWORD dwID1, DWORD dwID2, WORD wCommand) { - HANDLE hContact = HContactFromUID(dwUin, szUID, NULL); + HCONTACT hContact = HContactFromUID(dwUin, szUID, NULL); if (wCommand == 0) { // this is OFT request @@ -559,7 +559,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz } } int bAdded; - HANDLE hContact = HContactFromUID(dwUin, szUID, &bAdded); + HCONTACT hContact = HContactFromUID(dwUin, szUID, &bAdded); ft->hContact = hContact; ft->fileId = -1; @@ -838,7 +838,7 @@ static char *oftGetFileContainer(oscar_filetransfer* oft, const char** files, in } -HANDLE CIcqProto::oftInitTransfer(HANDLE hContact, DWORD dwUin, char* szUid, const TCHAR** files, const TCHAR* pszDesc) +HANDLE CIcqProto::oftInitTransfer(HCONTACT hContact, DWORD dwUin, char* szUid, const TCHAR** files, const TCHAR* pszDesc) { int i, filesCount; struct _stati64 statbuf; @@ -992,7 +992,7 @@ HANDLE CIcqProto::oftInitTransfer(HANDLE hContact, DWORD dwUin, char* szUid, con } -HANDLE CIcqProto::oftFileAllow(HANDLE hContact, HANDLE hTransfer, const TCHAR *szPath) +HANDLE CIcqProto::oftFileAllow(HCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath) { oscar_filetransfer *ft = (oscar_filetransfer*)hTransfer; DWORD dwUin; @@ -1025,7 +1025,7 @@ HANDLE CIcqProto::oftFileAllow(HANDLE hContact, HANDLE hTransfer, const TCHAR *s } -DWORD CIcqProto::oftFileDeny(HANDLE hContact, HANDLE hTransfer, const TCHAR *szReason) +DWORD CIcqProto::oftFileDeny(HCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason) { oscar_filetransfer *ft = (oscar_filetransfer*)hTransfer; DWORD dwUin; @@ -1054,7 +1054,7 @@ DWORD CIcqProto::oftFileDeny(HANDLE hContact, HANDLE hTransfer, const TCHAR *szR } -DWORD CIcqProto::oftFileCancel(HANDLE hContact, HANDLE hTransfer) +DWORD CIcqProto::oftFileCancel(HCONTACT hContact, HANDLE hTransfer) { oscar_filetransfer* ft = (oscar_filetransfer*)hTransfer; DWORD dwUin; @@ -1231,7 +1231,7 @@ void CIcqProto::CloseOscarConnection(oscar_connection *oc) ///////////////////////////////////////////////////////////////////////////////////////// -void CIcqProto::OpenOscarConnection(HANDLE hContact, oscar_filetransfer *ft, int type) +void CIcqProto::OpenOscarConnection(HCONTACT hContact, oscar_filetransfer *ft, int type) { oscarthreadstartinfo *otsi = (oscarthreadstartinfo*)SAFE_MALLOC(sizeof(oscarthreadstartinfo)); diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.h b/protocols/IcqOscarJ/src/oscar_filetransfer.h index fa6ec9169e..bf4162b50b 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.h +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.h @@ -62,7 +62,7 @@ char *FindFilePathContainer(const char **files, int iFile, char *szContainer); struct oscar_filetransfer: public basic_filetransfer { - HANDLE hContact; + HCONTACT hContact; int flags; // combination of OFTF_* int containerCount; char **file_containers; @@ -123,7 +123,7 @@ void SafeReleaseFileTransfer(void **ft); struct oscar_connection { - HANDLE hContact; + HCONTACT hContact; HANDLE hConnection; int status; DWORD dwUin; diff --git a/protocols/IcqOscarJ/src/stdpackets.cpp b/protocols/IcqOscarJ/src/stdpackets.cpp index e1e573cc9f..eb36b3277c 100644 --- a/protocols/IcqOscarJ/src/stdpackets.cpp +++ b/protocols/IcqOscarJ/src/stdpackets.cpp @@ -310,7 +310,7 @@ void CIcqProto::icq_setstatus(WORD wStatus, const char *szStatusNote) } -DWORD CIcqProto::icq_SendChannel1Message(DWORD dwUin, char *szUID, HANDLE hContact, char *pszText, cookie_message_data *pCookieData) +DWORD CIcqProto::icq_SendChannel1Message(DWORD dwUin, char *szUID, HCONTACT hContact, char *pszText, cookie_message_data *pCookieData) { icq_packet packet; WORD wPacketLength; @@ -355,7 +355,7 @@ DWORD CIcqProto::icq_SendChannel1Message(DWORD dwUin, char *szUID, HANDLE hConta } -DWORD CIcqProto::icq_SendChannel1MessageW(DWORD dwUin, char *szUID, HANDLE hContact, WCHAR *pszText, cookie_message_data *pCookieData) +DWORD CIcqProto::icq_SendChannel1MessageW(DWORD dwUin, char *szUID, HCONTACT hContact, WCHAR *pszText, cookie_message_data *pCookieData) { icq_packet packet; WORD wMessageLen; @@ -405,7 +405,7 @@ DWORD CIcqProto::icq_SendChannel1MessageW(DWORD dwUin, char *szUID, HANDLE hCont } -DWORD CIcqProto::icq_SendChannel2Message(DWORD dwUin, HANDLE hContact, const char *szMessage, int nBodyLen, WORD wPriority, cookie_message_data *pCookieData, char *szCap) +DWORD CIcqProto::icq_SendChannel2Message(DWORD dwUin, HCONTACT hContact, const char *szMessage, int nBodyLen, WORD wPriority, cookie_message_data *pCookieData, char *szCap) { icq_packet packet; @@ -433,7 +433,7 @@ DWORD CIcqProto::icq_SendChannel2Message(DWORD dwUin, HANDLE hContact, const cha } -DWORD CIcqProto::icq_SendChannel2Contacts(DWORD dwUin, char *szUid, HANDLE hContact, const char *pData, WORD wDataLen, const char *pNames, WORD wNamesLen, cookie_message_data *pCookieData) +DWORD CIcqProto::icq_SendChannel2Contacts(DWORD dwUin, char *szUid, HCONTACT hContact, const char *pData, WORD wDataLen, const char *pNames, WORD wNamesLen, cookie_message_data *pCookieData) { icq_packet packet; @@ -462,7 +462,7 @@ DWORD CIcqProto::icq_SendChannel2Contacts(DWORD dwUin, char *szUid, HANDLE hCont } -DWORD CIcqProto::icq_SendChannel4Message(DWORD dwUin, HANDLE hContact, BYTE bMsgType, WORD wMsgLen, const char *szMsg, cookie_message_data *pCookieData) +DWORD CIcqProto::icq_SendChannel4Message(DWORD dwUin, HCONTACT hContact, BYTE bMsgType, WORD wMsgLen, const char *szMsg, cookie_message_data *pCookieData) { icq_packet packet; WORD wPacketLength; @@ -552,7 +552,7 @@ DWORD CIcqProto::sendUserInfoMultiRequest(BYTE *pRequestData, WORD wDataLen, int } -DWORD CIcqProto::icq_sendGetInfoServ(HANDLE hContact, DWORD dwUin, int bManual) +DWORD CIcqProto::icq_sendGetInfoServ(HCONTACT hContact, DWORD dwUin, int bManual) { icq_packet packet; DWORD dwCookie = 0; @@ -607,7 +607,7 @@ DWORD CIcqProto::icq_sendGetInfoServ(HANDLE hContact, DWORD dwUin, int bManual) } -DWORD CIcqProto::icq_sendGetAimProfileServ(HANDLE hContact, char* szUid) +DWORD CIcqProto::icq_sendGetAimProfileServ(HCONTACT hContact, char* szUid) { icq_packet packet; BYTE bUIDlen = strlennull(szUid); @@ -632,7 +632,7 @@ DWORD CIcqProto::icq_sendGetAimProfileServ(HANDLE hContact, char* szUid) } -DWORD CIcqProto::icq_sendGetAwayMsgServ(HANDLE hContact, DWORD dwUin, int type, WORD wVersion) +DWORD CIcqProto::icq_sendGetAwayMsgServ(HCONTACT hContact, DWORD dwUin, int type, WORD wVersion) { icq_packet packet; @@ -650,7 +650,7 @@ DWORD CIcqProto::icq_sendGetAwayMsgServ(HANDLE hContact, DWORD dwUin, int type, } -DWORD CIcqProto::icq_sendGetAwayMsgServExt(HANDLE hContact, DWORD dwUin, char *szUID, int type, WORD wVersion) +DWORD CIcqProto::icq_sendGetAwayMsgServExt(HCONTACT hContact, DWORD dwUin, char *szUID, int type, WORD wVersion) { icq_packet packet; @@ -684,7 +684,7 @@ DWORD CIcqProto::icq_sendGetAwayMsgServExt(HANDLE hContact, DWORD dwUin, char *s } -DWORD CIcqProto::icq_sendGetAimAwayMsgServ(HANDLE hContact, char *szUID, int type) +DWORD CIcqProto::icq_sendGetAimAwayMsgServ(HCONTACT hContact, char *szUID, int type) { icq_packet packet; BYTE bUIDlen = strlennull(szUID); @@ -988,7 +988,7 @@ void CIcqProto::icq_sendFileDenyServ(DWORD dwUin, filetransfer *ft, const char * void CIcqProto::icq_sendAwayMsgReplyServ(DWORD dwUin, DWORD dwMsgID1, DWORD dwMsgID2, WORD wCookie, WORD wVersion, BYTE msgType, char** szMsg) { - HANDLE hContact = HContactFromUIN(dwUin, NULL); + HCONTACT hContact = HContactFromUIN(dwUin, NULL); if (validateStatusMessageRequest(hContact, msgType)) { NotifyEventHooks(m_modeMsgsEvent, (WPARAM)msgType, (LPARAM)dwUin); @@ -1032,7 +1032,7 @@ void CIcqProto::icq_sendAwayMsgReplyServ(DWORD dwUin, DWORD dwMsgID1, DWORD dwMs void CIcqProto::icq_sendAwayMsgReplyServExt(DWORD dwUin, char *szUID, DWORD dwMsgID1, DWORD dwMsgID2, WORD wCookie, WORD wVersion, BYTE msgType, char **szMsg) { - HANDLE hContact = HContactFromUID(dwUin, szUID, NULL); + HCONTACT hContact = HContactFromUID(dwUin, szUID, NULL); if (validateStatusMessageRequest(hContact, msgType)) { NotifyEventHooks(m_modeMsgsEvent, (WPARAM)msgType, (LPARAM)dwUin); @@ -1551,7 +1551,7 @@ void CIcqProto::icq_sendRemoveContact(DWORD dwUin, const char *szUid) // list==0: visible list // list==1: invisible list -void CIcqProto::icq_sendChangeVisInvis(HANDLE hContact, DWORD dwUin, char* szUID, int list, int add) +void CIcqProto::icq_sendChangeVisInvis(HCONTACT hContact, DWORD dwUin, char* szUID, int list, int add) { // TODO: This needs grouping & rate management // Tell server to change our server-side contact visbility list if (m_bSsiEnabled) { diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index a3e8064992..57b3f9ac4f 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -340,7 +340,7 @@ BOOL CIcqProto::IsOnSpammerList(DWORD dwUIN) // ICQ contacts cache -void CIcqProto::AddToContactsCache(HANDLE hContact, DWORD dwUin, const char *szUid) +void CIcqProto::AddToContactsCache(HCONTACT hContact, DWORD dwUin, const char *szUid) { if (!hContact || (!dwUin && !szUid)) return; @@ -372,7 +372,7 @@ void CIcqProto::InitContactsCache() // build cache icq_lock l(contactsCacheMutex); - HANDLE hContact = FindFirstContact(); + HCONTACT hContact = FindFirstContact(); while (hContact) { DWORD dwUin; @@ -411,7 +411,7 @@ void CIcqProto::UninitContactsCache(void) } -void CIcqProto::DeleteFromContactsCache(HANDLE hContact) +void CIcqProto::DeleteFromContactsCache(HCONTACT hContact) { icq_lock l(contactsCacheMutex); @@ -432,7 +432,7 @@ void CIcqProto::DeleteFromContactsCache(HANDLE hContact) } -HANDLE CIcqProto::HandleFromCacheByUid(DWORD dwUin, const char *szUid) +HCONTACT CIcqProto::HandleFromCacheByUid(DWORD dwUin, const char *szUid) { icq_contacts_cache cache_item = { NULL, dwUin, szUid }; @@ -446,12 +446,13 @@ HANDLE CIcqProto::HandleFromCacheByUid(DWORD dwUin, const char *szUid) } -HANDLE CIcqProto::HContactFromUIN(DWORD dwUin, int *Added) +HCONTACT CIcqProto::HContactFromUIN(DWORD dwUin, int *Added) { if (Added) *Added = 0; - HANDLE hContact = HandleFromCacheByUid(dwUin, NULL); - if (hContact) return hContact; + HCONTACT hContact = HandleFromCacheByUid(dwUin, NULL); + if (hContact) + return hContact; hContact = FindFirstContact(); while (hContact) { @@ -468,17 +469,17 @@ HANDLE CIcqProto::HContactFromUIN(DWORD dwUin, int *Added) //not present: add if (Added) { - hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if (!hContact) { debugLogA("Failed to create ICQ contact %u", dwUin); - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; } if (CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName) != 0) { // For some reason we failed to register the protocol to this contact CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); debugLogA("Failed to register ICQ contact %u", dwUin); - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; } setDword(hContact, UNIQUEIDSETTING, dwUin); @@ -504,20 +505,21 @@ HANDLE CIcqProto::HContactFromUIN(DWORD dwUin, int *Added) if (getContactUin(NULL) == dwUin) return NULL; - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; } -HANDLE CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added) +HCONTACT CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added) { if (dwUin) return HContactFromUIN(dwUin, Added); if (Added) *Added = 0; - if (!m_bAimEnabled) return INVALID_HANDLE_VALUE; + if (!m_bAimEnabled) + return (HCONTACT)INVALID_HANDLE_VALUE; - HANDLE hContact = HandleFromCacheByUid(dwUin, szUid); + HCONTACT hContact = HandleFromCacheByUid(dwUin, szUid); if (hContact) return hContact; hContact = FindFirstContact(); @@ -538,7 +540,7 @@ HANDLE CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added) //not present: add if (Added) { - hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName); setString(hContact, UNIQUEIDSETTING, szUid); @@ -558,11 +560,11 @@ HANDLE CIcqProto::HContactFromUID(DWORD dwUin, const char *szUid, int *Added) return hContact; } - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; } -HANDLE CIcqProto::HContactFromAuthEvent(HANDLE hEvent) +HCONTACT CIcqProto::HContactFromAuthEvent(HANDLE hEvent) { DBEVENTINFO dbei = { sizeof(dbei) }; DWORD body[3]; @@ -571,28 +573,28 @@ HANDLE CIcqProto::HContactFromAuthEvent(HANDLE hEvent) dbei.pBlob = (PBYTE)&body; if (db_event_get(hEvent, &dbei)) - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; if (dbei.eventType != EVENTTYPE_AUTHREQUEST) - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; if (strcmpnull(dbei.szModule, m_szModuleName)) - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; return DbGetAuthEventContact(&dbei); } -char *NickFromHandle(HANDLE hContact) +char *NickFromHandle(HCONTACT hContact) { - if (hContact == INVALID_HANDLE_VALUE) + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) return null_strdup(Translate("")); return null_strdup((char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0)); } -char *NickFromHandleUtf(HANDLE hContact) +char *NickFromHandleUtf(HCONTACT hContact) { - if (hContact == INVALID_HANDLE_VALUE) + if (hContact == (HCONTACT)INVALID_HANDLE_VALUE) return ICQTranslateUtf(LPGEN("")); return tchar_to_utf8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)); @@ -886,7 +888,7 @@ void CIcqProto::ResetSettingsOnListReload() setWord("SrvRecordCount", 0); delSetting(DBSETTING_SERVLIST_UNHANDLED); - HANDLE hContact = FindFirstContact(); + HCONTACT hContact = FindFirstContact(); while (hContact) { // All these values will be restored during the serv-list receive @@ -910,7 +912,7 @@ void CIcqProto::ResetSettingsOnConnect() setByte("SrvVisibility", 0); setDword("IdleTS", 0); - HANDLE hContact = FindFirstContact(); + HCONTACT hContact = FindFirstContact(); while (hContact) { setDword(hContact, "LogonTS", 0); @@ -931,7 +933,7 @@ void CIcqProto::ResetSettingsOnLoad() setDword("IdleTS", 0); setDword("LogonTS", 0); - HANDLE hContact = FindFirstContact(); + HCONTACT hContact = FindFirstContact(); while (hContact) { setDword(hContact, "LogonTS", 0); @@ -987,7 +989,7 @@ void __cdecl CIcqProto::ProtocolAckThread(icq_ack_args* pArguments) SAFE_FREE((void**)&pArguments); } -void CIcqProto::SendProtoAck(HANDLE hContact, DWORD dwCookie, int nAckResult, int nAckType, char* pszMessage) +void CIcqProto::SendProtoAck(HCONTACT hContact, DWORD dwCookie, int nAckResult, int nAckType, char* pszMessage) { icq_ack_args* pArgs = (icq_ack_args*)SAFE_MALLOC(sizeof(icq_ack_args)); // This will be freed in the new thread pArgs->hContact = hContact; @@ -1008,7 +1010,7 @@ void CIcqProto::SetCurrentStatus(int nStatus) } -int CIcqProto::IsMetaInfoChanged(HANDLE hContact) +int CIcqProto::IsMetaInfoChanged(HCONTACT hContact) { DBVARIANT infoToken = { DBVT_DELETED }; int res = 0; @@ -1248,7 +1250,7 @@ int CIcqProto::SetStatusMood(const char *szMoodData, DWORD dwDelay) } -void CIcqProto::writeDbInfoSettingTLVStringUtf(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv) +void CIcqProto::writeDbInfoSettingTLVStringUtf(HCONTACT hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv) { oscar_tlv *pTLV = chain->getTLV(wTlv, 1); @@ -1263,7 +1265,7 @@ void CIcqProto::writeDbInfoSettingTLVStringUtf(HANDLE hContact, const char *szSe } -void CIcqProto::writeDbInfoSettingTLVWord(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv) +void CIcqProto::writeDbInfoSettingTLVWord(HCONTACT hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv) { int num = chain->getNumber(wTlv, 1); if (num > 0) @@ -1273,7 +1275,7 @@ void CIcqProto::writeDbInfoSettingTLVWord(HANDLE hContact, const char *szSetting } -void CIcqProto::writeDbInfoSettingTLVByte(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv) +void CIcqProto::writeDbInfoSettingTLVByte(HCONTACT hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv) { int num = chain->getNumber(wTlv, 1); @@ -1284,7 +1286,7 @@ void CIcqProto::writeDbInfoSettingTLVByte(HANDLE hContact, const char *szSetting } -void CIcqProto::writeDbInfoSettingTLVDouble(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv) +void CIcqProto::writeDbInfoSettingTLVDouble(HCONTACT hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv) { double num = chain->getDouble(wTlv, 1); if (num > 0) @@ -1293,7 +1295,7 @@ void CIcqProto::writeDbInfoSettingTLVDouble(HANDLE hContact, const char *szSetti delSetting(hContact, szSetting); } -void CIcqProto::writeDbInfoSettingTLVDate(HANDLE hContact, const char* szSettingYear, const char* szSettingMonth, const char* szSettingDay, oscar_tlv_chain* chain, WORD wTlv) +void CIcqProto::writeDbInfoSettingTLVDate(HCONTACT hContact, const char* szSettingYear, const char* szSettingMonth, const char* szSettingDay, oscar_tlv_chain* chain, WORD wTlv) { double time = chain->getDouble(wTlv, 1); @@ -1318,7 +1320,7 @@ void CIcqProto::writeDbInfoSettingTLVDate(HANDLE hContact, const char* szSetting } -void CIcqProto::writeDbInfoSettingTLVBlob(HANDLE hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv) +void CIcqProto::writeDbInfoSettingTLVBlob(HCONTACT hContact, const char *szSetting, oscar_tlv_chain *chain, WORD wTlv) { oscar_tlv *pTLV = chain->getTLV(wTlv, 1); @@ -1329,7 +1331,7 @@ void CIcqProto::writeDbInfoSettingTLVBlob(HANDLE hContact, const char *szSetting } -BOOL CIcqProto::writeDbInfoSettingString(HANDLE hContact, const char* szSetting, char** buf, WORD* pwLength) +BOOL CIcqProto::writeDbInfoSettingString(HCONTACT hContact, const char* szSetting, char** buf, WORD* pwLength) { if (*pwLength < 2) return FALSE; @@ -1362,7 +1364,7 @@ BOOL CIcqProto::writeDbInfoSettingString(HANDLE hContact, const char* szSetting, return TRUE; } -BOOL CIcqProto::writeDbInfoSettingWord(HANDLE hContact, const char *szSetting, char **buf, WORD* pwLength) +BOOL CIcqProto::writeDbInfoSettingWord(HCONTACT hContact, const char *szSetting, char **buf, WORD* pwLength) { if (*pwLength < 2) return FALSE; @@ -1379,7 +1381,7 @@ BOOL CIcqProto::writeDbInfoSettingWord(HANDLE hContact, const char *szSetting, c return TRUE; } -BOOL CIcqProto::writeDbInfoSettingWordWithTable(HANDLE hContact, const char *szSetting, const FieldNamesItem *table, char **buf, WORD* pwLength) +BOOL CIcqProto::writeDbInfoSettingWordWithTable(HCONTACT hContact, const char *szSetting, const FieldNamesItem *table, char **buf, WORD* pwLength) { if (*pwLength < 2) return FALSE; @@ -1398,7 +1400,7 @@ BOOL CIcqProto::writeDbInfoSettingWordWithTable(HANDLE hContact, const char *szS return TRUE; } -BOOL CIcqProto::writeDbInfoSettingByte(HANDLE hContact, const char *pszSetting, char **buf, WORD* pwLength) +BOOL CIcqProto::writeDbInfoSettingByte(HCONTACT hContact, const char *pszSetting, char **buf, WORD* pwLength) { if (*pwLength < 1) return FALSE; @@ -1415,7 +1417,7 @@ BOOL CIcqProto::writeDbInfoSettingByte(HANDLE hContact, const char *pszSetting, return TRUE; } -BOOL CIcqProto::writeDbInfoSettingByteWithTable(HANDLE hContact, const char *szSetting, const FieldNamesItem *table, char **buf, WORD* pwLength) +BOOL CIcqProto::writeDbInfoSettingByteWithTable(HCONTACT hContact, const char *szSetting, const FieldNamesItem *table, char **buf, WORD* pwLength) { if (*pwLength < 1) return FALSE; @@ -1448,7 +1450,7 @@ char* time2text(time_t time) } -bool CIcqProto::validateStatusMessageRequest(HANDLE hContact, WORD byMessageType) +bool CIcqProto::validateStatusMessageRequest(HCONTACT hContact, WORD byMessageType) { // Privacy control if (getByte("StatusMsgReplyCList", 0)) { @@ -1902,7 +1904,7 @@ int MessageBoxUtf(HWND hWnd, const char *szText, const char *szCaption, UINT uTy return res; } -char* CIcqProto::ConvertMsgToUserSpecificAnsi(HANDLE hContact, const char* szMsg) +char* CIcqProto::ConvertMsgToUserSpecificAnsi(HCONTACT hContact, const char* szMsg) { // this takes utf-8 encoded message WORD wCP = getWord(hContact, "CodePage", m_wAnsiCodepage); char* szAnsi = NULL; @@ -1915,7 +1917,7 @@ char* CIcqProto::ConvertMsgToUserSpecificAnsi(HANDLE hContact, const char* szMsg } // just broadcast generic send error with dummy cookie and return that cookie -DWORD CIcqProto::ReportGenericSendError(HANDLE hContact, int nType, const char* szErrorMsg) +DWORD CIcqProto::ReportGenericSendError(HCONTACT hContact, int nType, const char* szErrorMsg) { DWORD dwCookie = GenerateCookie(0); SendProtoAck(hContact, dwCookie, ACKRESULT_FAILED, nType, Translate(szErrorMsg)); diff --git a/protocols/IcqOscarJ/src/utilities.h b/protocols/IcqOscarJ/src/utilities.h index 25387d7ef3..c229feac2a 100644 --- a/protocols/IcqOscarJ/src/utilities.h +++ b/protocols/IcqOscarJ/src/utilities.h @@ -33,7 +33,7 @@ struct icq_ack_args { - HANDLE hContact; + HCONTACT hContact; int nAckType; int nAckResult; HANDLE hSequence; @@ -42,7 +42,7 @@ struct icq_ack_args struct icq_contacts_cache { - HANDLE hContact; + HCONTACT hContact; DWORD dwUin; const char *szUid; }; @@ -66,8 +66,8 @@ void SetGatewayIndex(HANDLE hConn, DWORD dwIndex); DWORD GetGatewayIndex(HANDLE hConn); void FreeGatewayIndex(HANDLE hConn); -char *NickFromHandle(HANDLE hContact); -char *NickFromHandleUtf(HANDLE hContact); +char *NickFromHandle(HCONTACT hContact); +char *NickFromHandleUtf(HCONTACT hContact); char *strUID(DWORD dwUIN, char *pszUID); int __fastcall strlennull(const char *string); @@ -181,7 +181,7 @@ int ListBoxAddStringUtf(HWND hList, const char *szString); int MessageBoxUtf(HWND hWnd, const char *szText, const char *szCaption, UINT uType); void InitXStatusIcons(); -void setContactExtraIcon(HANDLE hContact, int xstatus); +void setContactExtraIcon(HCONTACT hContact, int xstatus); int OnReloadIcons(WPARAM wParam, LPARAM lParam); #endif /* __UTILITIES_H */ diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h index debcb70949..bf7839a11e 100644 --- a/protocols/JabberG/src/jabber.h +++ b/protocols/JabberG/src/jabber.h @@ -362,8 +362,8 @@ struct ThreadData int zlibRecv(char* data, long datalen); // for nick names resolving - int resolveID; - HANDLE resolveContact; + int resolveID; + HCONTACT resolveContact; // features & registration HWND reg_hwndDlg; @@ -760,7 +760,7 @@ void strdel(char* parBuffer, int len); //---- jabber_userinfo.cpp -------------------------------------------------------------- -void JabberUserInfoUpdate(HANDLE hContact); +void JabberUserInfoUpdate(HCONTACT hContact); //---- jabber_iq_handlers.cpp BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE); diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index 1f4f55acf7..f3777d0ff9 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -510,7 +510,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; int res = -1; if ((hContact != NULL || lParam != 0) && m_bJabberOnline) { diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp index 7cacaa4c21..fa057d002b 100644 --- a/protocols/JabberG/src/jabber_api.cpp +++ b/protocols/JabberG/src/jabber_api.cpp @@ -56,13 +56,13 @@ int CJabberProto::CompareJIDs(LPCTSTR jid1, LPCTSTR jid2) return JabberCompareJids(jid1, jid2); } -HANDLE CJabberProto::ContactFromJID(LPCTSTR jid) +HCONTACT CJabberProto::ContactFromJID(LPCTSTR jid) { if (jid == NULL) return NULL; return HContactFromJID(jid); } -LPTSTR CJabberProto::ContactToJID(HANDLE hContact) +LPTSTR CJabberProto::ContactToJID(HCONTACT hContact) { return getTStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid"); } diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index d2faf4fd8e..0786b363bf 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -32,7 +32,7 @@ void CJabberProto::EnableArchive(bool bEnable) << XCHILDNS( _T("auto"), JABBER_FEAT_ARCHIVE) << XATTR(_T("save"), (bEnable) ? _T("true") : _T("false"))); } -void CJabberProto::RetrieveMessageArchive(HANDLE hContact, JABBER_LIST_ITEM *pItem) +void CJabberProto::RetrieveMessageArchive(HCONTACT hContact, JABBER_LIST_ITEM *pItem) { if (pItem->bHistoryRead) return; @@ -60,7 +60,7 @@ void CJabberProto::OnIqResultGetCollectionList(HXML iqNode, CJabberIqInfo*) if (!list || lstrcmp( xmlGetAttrValue(list, _T("xmlns")), JABBER_FEAT_ARCHIVE)) return; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; time_t tmLast = 0; for (int nodeIdx = 1; ; nodeIdx++) { @@ -99,7 +99,7 @@ static HANDLE hPreviousContact = INVALID_HANDLE_VALUE; static HANDLE hPreviousDbEvent = NULL; // Returns TRUE if the event already exist in the database -BOOL IsDuplicateEvent(HANDLE hContact, DBEVENTINFO& dbei) +BOOL IsDuplicateEvent(HCONTACT hContact, DBEVENTINFO& dbei) { HANDLE hExistingDbEvent; DWORD dwEventTimeStamp; @@ -258,7 +258,7 @@ void CJabberProto::OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*) if (!start || !with) return; - HANDLE hContact = HContactFromJID(with); + HCONTACT hContact = HContactFromJID(with); time_t tmStart = str2time(start); if (hContact == 0 || tmStart == 0) return; diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index 20e7714bc8..d43a3b85ff 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -132,7 +132,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) gcw.ptszID = item->jid; CallServiceSync(MS_GC_NEWSESSION, NULL, (LPARAM)&gcw); - HANDLE hContact = HContactFromJID(item->jid); + HCONTACT hContact = HContactFromJID(item->jid); if (hContact != NULL) { if (JABBER_LIST_ITEM *bookmark = ListGetItemPtr(LIST_BOOKMARK, item->jid)) if (bookmark->name) { @@ -600,7 +600,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) mir_sntprintf(sttRJidBuf, SIZEOF(sttRJidBuf), TranslateT("Real &JID: %s"), him->m_tszRealJid); if (TCHAR *tmp = _tcschr(sttRJidBuf, _T('/'))) *tmp = 0; - if (HANDLE hContact = HContactFromJID(him->m_tszRealJid)) { + if (HCONTACT hContact = HContactFromJID(him->m_tszRealJid)) { gcmi->Item[3].uType = MENU_HMENU; gcmi->Item[3].dwID = CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)hContact, 0); sttShowGcMenuItems(gcmi, sttRJidItems, 0); @@ -662,7 +662,7 @@ class CGroupchatInviteDlg : public CJabberDlgBase void FilterList(CCtrlClc *) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *proto = GetContactProto(hContact); if (lstrcmpA(proto, m_proto->m_szModuleName) || m_proto->isChatRoom(hContact)) if (HANDLE hItem = m_clc.FindContact(hContact)) @@ -740,7 +740,7 @@ public: m_txtNewJid.GetText(buf, SIZEOF(buf)); m_txtNewJid.SetTextA(""); - HANDLE hContact = m_proto->HContactFromJID(buf); + HCONTACT hContact = m_proto->HContactFromJID(buf); if (hContact) { int hItem = SendDlgItemMessage(m_hwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); @@ -776,7 +776,7 @@ public: HWND hwndList = GetDlgItem(m_hwnd, IDC_CLIST); // invite users from roster - for (HANDLE hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName)) { if (m_proto->isChatRoom(hContact)) continue; @@ -1003,7 +1003,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if ((gch->dwData >= CLISTMENUIDMIN) && (gch->dwData <= CLISTMENUIDMAX)) { if (him->m_tszRealJid && *him->m_tszRealJid) - if (HANDLE hContact = ppro->HContactFromJID(him->m_tszRealJid)) + if (HCONTACT hContact = ppro->HContactFromJID(him->m_tszRealJid)) CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(gch->dwData, MPCF_CONTACTMENU), (LPARAM)hContact); return; } @@ -1039,7 +1039,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* JABBER_LIST_ITEM *item = ppro->ListAdd(LIST_VCARD_TEMP, jsr.jid); ppro->ListAddResource(LIST_VCARD_TEMP, jsr.jid, him->m_iStatus, him->m_tszStatusMessage, him->m_iPriority); - HANDLE hContact = (HANDLE)CallProtoService(ppro->m_szModuleName, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&jsr); + HCONTACT hContact = (HCONTACT)CallProtoService(ppro->m_szModuleName, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&jsr); CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); } break; @@ -1202,7 +1202,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* case IDM_RJID_VCARD: if (him->m_tszRealJid && *him->m_tszRealJid) { - HANDLE hContact; + HCONTACT hContact; JABBER_SEARCH_RESULT jsr = { 0 }; jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT); mir_sntprintf(jsr.jid, SIZEOF(jsr.jid), _T("%s"), him->m_tszRealJid); @@ -1211,7 +1211,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* JABBER_LIST_ITEM *item = ppro->ListAdd(LIST_VCARD_TEMP, jsr.jid); ppro->ListAddResource(LIST_VCARD_TEMP, jsr.jid, him->m_iStatus, him->m_tszStatusMessage, him->m_iPriority); - hContact = (HANDLE)CallProtoService(ppro->m_szModuleName, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&jsr); + hContact = (HCONTACT)CallProtoService(ppro->m_szModuleName, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&jsr); CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); } break; @@ -1305,7 +1305,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g item = ppro->ListGetItemPtr(LIST_CHATROOM, gch->pDest->ptszID); if (item != NULL) { item->type = _T("conference"); - HANDLE hContact = ppro->HContactFromJID(item->jid); + HCONTACT hContact = ppro->HContactFromJID(item->jid); item->name = pcli->pfnGetContactDisplayName(hContact, 0); ppro->AddEditBookmark(item); } @@ -1369,7 +1369,7 @@ static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, co { TCHAR szFullJid[JABBER_MAX_JID_LEN]; mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), item->jid, nick); - HANDLE hContact = ppro->DBCreateContact(szFullJid, NULL, TRUE, FALSE); + HCONTACT hContact = ppro->DBCreateContact(szFullJid, NULL, TRUE, FALSE); if (hContact != NULL) { pResourceStatus r(item->findResource(nick)); if (r) diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 9b0ad50aad..1453e9f40f 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -406,7 +406,7 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) { if ((item=ListGetItemPtrFromIndex(i)) != NULL) { if (_tcschr(item->jid, '@') == NULL && _tcschr(item->jid, '/') == NULL && item->subscription!=SUB_NONE) { - HANDLE hContact = HContactFromJID(item->jid); + HCONTACT hContact = HContactFromJID(item->jid); if (hContact != NULL) setByte(hContact, "IsTransport", TRUE); @@ -1237,7 +1237,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM if (!items[i].feature) { if (items[i].title) { - HANDLE hContact; + HCONTACT hContact; if ((items[i].action == SD_ACT_USERMENU) && (hContact = HContactFromJID(pNode->GetJid()))) { HMENU hContactMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)hContact, 0); AppendMenu(hMenu, MF_STRING|MF_POPUP, (UINT_PTR)hContactMenu, TranslateTS(items[i].title)); @@ -1397,7 +1397,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM case SD_ACT_USERMENU: { - HANDLE hContact = HContactFromJID(pNode->GetJid()); + HCONTACT hContact = HContactFromJID(pNode->GetJid()); if (!hContact) { hContact = DBCreateContact(pNode->GetJid(), pNode->GetName(), TRUE, FALSE); JABBER_LIST_ITEM *item = ListAdd(LIST_VCARD_TEMP, pNode->GetJid()); @@ -1413,12 +1413,12 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM case SD_ACT_VCARD: { TCHAR *jid = pNode->GetJid(); - HANDLE hContact = HContactFromJID(pNode->GetJid()); + HCONTACT hContact = HContactFromJID(pNode->GetJid()); if (!hContact) { JABBER_SEARCH_RESULT jsr={0}; mir_sntprintf(jsr.jid, SIZEOF(jsr.jid), _T("%s"), jid); jsr.hdr.cbSize = sizeof(JABBER_SEARCH_RESULT); - hContact = (HANDLE)CallProtoService(m_szModuleName, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&jsr); + hContact = (HCONTACT)CallProtoService(m_szModuleName, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&jsr); } if (ListGetItemPtr(LIST_VCARD_TEMP, pNode->GetJid()) == NULL) { JABBER_LIST_ITEM *item = ListAdd(LIST_VCARD_TEMP, pNode->GetJid()); @@ -1432,7 +1432,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM case SD_ACT_ROSTER: { - HANDLE hContact = DBCreateContact(pNode->GetJid(), pNode->GetName(), FALSE, FALSE); + HCONTACT hContact = DBCreateContact(pNode->GetJid(), pNode->GetName(), FALSE, FALSE); db_unset(hContact, "CList", "NotOnList"); JABBER_LIST_ITEM *item = ListAdd(LIST_VCARD_TEMP, pNode->GetJid()); item->bUseResource = TRUE; @@ -1453,7 +1453,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM default: if ((res >= CLISTMENUIDMIN) && (res <= CLISTMENUIDMAX)) { - HANDLE hContact = HContactFromJID(pNode->GetJid()); + HCONTACT hContact = HContactFromJID(pNode->GetJid()); if (hContact) CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(res, MPCF_CONTACTMENU), (LPARAM)hContact); } diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index d9a46a9d11..f9795c7ac9 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -36,7 +36,7 @@ int CJabberProto::OnContactDeleted(WPARAM wParam, LPARAM) if (!m_bJabberOnline) // should never happen return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ptrT jid(getTStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : "jid")); if (jid == NULL) return 0; @@ -75,7 +75,7 @@ static TCHAR* sttSettingToTchar(DBCONTACTWRITESETTING *cws) return NULL; } -void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, HANDLE hContact) +void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, HCONTACT hContact) { JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrT(getTStringA(hContact, "jid"))); if (item == NULL) @@ -106,7 +106,7 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING *cws, HANDLE hCon } } -void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, HANDLE hContact) +void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, HCONTACT hContact) { JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, ptrT( getTStringA(hContact, "jid"))); if (item == NULL) @@ -126,7 +126,7 @@ void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING *cws, HANDLE hC } } -void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING *cws, HANDLE hContact) +void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING *cws, HCONTACT hContact) { if (cws->value.type != DBVT_DELETED && !(cws->value.type == DBVT_BYTE && cws->value.bVal == 0)) return; @@ -159,7 +159,7 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING *cws, HANDL int __cdecl CJabberProto::OnDbSettingChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL || !m_bJabberOnline) return 0; diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index d6d9fb29b5..c36d2cdc77 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -185,7 +185,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleJoinGroupchat(WPARAM, LPARAM) INT_PTR __cdecl CJabberProto::OnJoinChat(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ptrT jid( getTStringA(hContact, "ChatRoomID")); if (jid == NULL) return 0; @@ -210,7 +210,7 @@ INT_PTR __cdecl CJabberProto::OnJoinChat(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnLeaveChat(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ptrT jid(getTStringA(hContact, "ChatRoomID")); if (jid != NULL) { if (getWord(hContact, "Status", 0) != ID_STATUS_OFFLINE) { @@ -791,7 +791,7 @@ void CJabberProto::RenameParticipantNick(JABBER_LIST_ITEM *item, const TCHAR *ol if (!lstrcmp(item->nick, oldNick)) { replaceStrT(item->nick, newNick); - HANDLE hContact = HContactFromJID(item->jid); + HCONTACT hContact = HContactFromJID(item->jid); if (hContact != NULL) setTString(hContact, "MyNick", newNick); } @@ -931,7 +931,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) if (r && bRoleChanged) GcLogShowInformation(item, r, INFO_ROLE); // update clist status - HANDLE hContact = HContactFromJID(from); + HCONTACT hContact = HContactFromJID(from); if (hContact != NULL) setWord(hContact, "Status", status); @@ -992,7 +992,7 @@ void CJabberProto::GroupchatProcessPresence(HXML node) GcLogUpdateMemberStatus(item, resource, nick, str, GC_EVENT_PART, statusNode); ListRemoveResource(LIST_CHATROOM, from); - HANDLE hContact = HContactFromJID(from); + HCONTACT hContact = HContactFromJID(from); if (hContact != NULL) setWord(hContact, "Status", ID_STATUS_OFFLINE); } diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index df3c3ced7b..8c36b3d02b 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -393,7 +393,7 @@ int CJabberProto::OnReloadIcons(WPARAM, LPARAM) INT_PTR __cdecl CJabberProto::JGetAdvancedStatusIcon(WPARAM wParam, LPARAM) { - HANDLE hContact=(HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!hContact) return -1; @@ -415,7 +415,7 @@ INT_PTR __cdecl CJabberProto::JGetAdvancedStatusIcon(WPARAM wParam, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// // Transport check functions -BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, HANDLE hContact) +BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, HCONTACT hContact) { // check if transport is already set if (!jid || !hContact) @@ -455,7 +455,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, HANDLE hContact void CJabberProto::CheckAllContactsAreTransported() { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { ptrT jid( getTStringA(hContact, "jid")); if (jid) DBCheckIsTransportedContact(jid, hContact); diff --git a/protocols/JabberG/src/jabber_iq.h b/protocols/JabberG/src/jabber_iq.h index c2c3dc960d..3eece1ec6e 100644 --- a/protocols/JabberG/src/jabber_iq.h +++ b/protocols/JabberG/src/jabber_iq.h @@ -70,7 +70,7 @@ public: TCHAR *m_szChildTagXmlns; TCHAR *m_szChildTagName; HXML m_pChildNode; - HANDLE m_hContact; + HCONTACT m_hContact; TCHAR *m_szTo; TCHAR *m_szId; @@ -117,7 +117,7 @@ public: __forceinline TCHAR* GetIdStr() { return m_szId; } - __forceinline HANDLE GetHContact() + __forceinline HCONTACT GetHContact() { return m_hContact; } __forceinline HXML GetChildNode() diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index e83ad340ea..bd360cd167 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -525,7 +525,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo) } JABBER_LIST_ITEM *item; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; const TCHAR *jid, *str, *name; TCHAR *nick; diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 5e3cb859eb..c069d7fb31 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -313,7 +313,7 @@ void CJabberProto::OnIqResultSession(HXML iqNode, CJabberIqInfo *pInfo) OnLoggedIn(); } -void CJabberProto::GroupchatJoinByHContact(HANDLE hContact, bool autojoin) +void CJabberProto::GroupchatJoinByHContact(HCONTACT hContact, bool autojoin) { ptrT roomjid( getTStringA(hContact, "ChatRoomID")); if (roomjid == NULL) @@ -425,7 +425,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) } } - HANDLE hContact = HContactFromJID(jid); + HCONTACT hContact = HContactFromJID(jid); if (hContact == NULL) { // Received roster has a new JID. // Add the jid (with empty resource) to Miranda contact list. @@ -496,8 +496,8 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) // Delete orphaned contacts (if roster sync is enabled) if (m_options.RosterSync == TRUE) { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; ) { - HANDLE hNext = db_find_next(hContact, m_szModuleName); + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; ) { + HCONTACT hNext = db_find_next(hContact, m_szModuleName); ptrT jid( getTStringA(hContact, "jid")); if (jid != NULL && !ListGetItemPtr(LIST_ROSTER, jid)) { debugLogA("Syncing roster: preparing to delete %S (hContact=0x%x)", jid, hContact); @@ -515,7 +515,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo) if (m_options.AutoJoinConferences) for (i=0; i < chatRooms.getCount(); i++) - GroupchatJoinByHContact((HANDLE)chatRooms[i], true); + GroupchatJoinByHContact((HCONTACT)chatRooms[i], true); //UI_SAFE_NOTIFY(m_pDlgJabberJoinGroupchat, WM_JABBER_CHECK_ONLINE); //UI_SAFE_NOTIFY(m_pDlgBookmarks, WM_JABBER_CHECK_ONLINE); @@ -565,7 +565,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*) if ((from = xmlGetAttrValue(iqNode, _T("from"))) == NULL) return; if (!lstrcmp(type, _T("result"))) { - HANDLE hContact = HContactFromJID(from); + HCONTACT hContact = HContactFromJID(from); if (hContact != NULL) setByte(hContact, "IsTransport", TRUE); @@ -583,7 +583,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*) ///////////////////////////////////////////////////////////////////////////////////////// // JabberIqResultGetVcard - processes the server-side v-card -void CJabberProto::OnIqResultGetVcardPhoto(const TCHAR *jid, HXML n, HANDLE hContact, bool &hasPhoto) +void CJabberProto::OnIqResultGetVcardPhoto(const TCHAR *jid, HXML n, HCONTACT hContact, bool &hasPhoto) { debugLogA("JabberIqResultGetVcardPhoto: %d", hasPhoto); if (hasPhoto) @@ -661,7 +661,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) { HXML vCardNode, m, n, o; const TCHAR *type, *jid; - HANDLE hContact; + HCONTACT hContact; TCHAR text[128]; DBVARIANT dbv; @@ -1284,7 +1284,7 @@ void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo*) if (from == NULL) return; - HANDLE hContact = HContactFromJID(from); + HCONTACT hContact = HContactFromJID(from); if (hContact == NULL) return; @@ -1324,7 +1324,7 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*) const TCHAR *from = xmlGetAttrValue(iqNode, _T("from")); if (from == NULL) return; - HANDLE hContact = HContactFromJID(from); + HCONTACT hContact = HContactFromJID(from); if (hContact == NULL) return; @@ -1363,7 +1363,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo *pInfo) if (from == NULL) return; - HANDLE hContact = HContactFromJID(from); + HCONTACT hContact = HContactFromJID(from); if (hContact == NULL) return; @@ -1396,7 +1396,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo *pInfo) } -void CJabberProto::OnIqResultGotAvatar(HANDLE hContact, HXML n, const TCHAR *mimeType) +void CJabberProto::OnIqResultGotAvatar(HCONTACT hContact, HXML n, const TCHAR *mimeType) { unsigned resultLen; ptrA body((char*)mir_base64_decode( _T2A(xmlGetText(n)), &resultLen)); diff --git a/protocols/JabberG/src/jabber_list.h b/protocols/JabberG/src/jabber_list.h index 4c4c8358dc..eaddb149eb 100644 --- a/protocols/JabberG/src/jabber_list.h +++ b/protocols/JabberG/src/jabber_list.h @@ -212,9 +212,9 @@ struct JABBER_LIST_ITEM : public MZeroedObject struct JABBER_HTTP_AVATARS { char * Url; - HANDLE hContact; + HCONTACT hContact; - JABBER_HTTP_AVATARS(const TCHAR *tUrl, HANDLE thContact) + JABBER_HTTP_AVATARS(const TCHAR *tUrl, HCONTACT thContact) : Url(mir_t2a(tUrl)), hContact(thContact) {} ~JABBER_HTTP_AVATARS() { mir_free(Url); } diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 2d0f0beb0b..b644efbbd8 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -73,7 +73,7 @@ static INT_PTR JabberMenuChooseService(WPARAM wParam, LPARAM lParam) return 0; } -static CJabberProto* JabberGetInstanceByHContact(HANDLE hContact) +static CJabberProto* JabberGetInstanceByHContact(HCONTACT hContact) { char *szProto = GetContactProto(hContact); if (szProto == NULL) @@ -88,73 +88,73 @@ static CJabberProto* JabberGetInstanceByHContact(HANDLE hContact) static INT_PTR JabberMenuHandleRequestAuth(WPARAM wParam, LPARAM lParam) { - CJabberProto *ppro = JabberGetInstanceByHContact((HANDLE)wParam); + CJabberProto *ppro = JabberGetInstanceByHContact((HCONTACT)wParam); return(ppro) ? ppro->OnMenuHandleRequestAuth(wParam, lParam) : 0; } static INT_PTR JabberMenuHandleGrantAuth(WPARAM wParam, LPARAM lParam) { - CJabberProto *ppro = JabberGetInstanceByHContact((HANDLE)wParam); + CJabberProto *ppro = JabberGetInstanceByHContact((HCONTACT)wParam); return(ppro) ? ppro->OnMenuHandleGrantAuth(wParam, lParam) : 0; } static INT_PTR JabberMenuRevokeAuth(WPARAM wParam, LPARAM lParam) { - CJabberProto *ppro = JabberGetInstanceByHContact((HANDLE)wParam); + CJabberProto *ppro = JabberGetInstanceByHContact((HCONTACT)wParam); return(ppro) ? ppro->OnMenuRevokeAuth(wParam, lParam) : 0; } static INT_PTR JabberMenuConvertChatContact(WPARAM wParam, LPARAM lParam) { - CJabberProto *ppro = JabberGetInstanceByHContact((HANDLE)wParam); + CJabberProto *ppro = JabberGetInstanceByHContact((HCONTACT)wParam); return(ppro) ? ppro->OnMenuConvertChatContact(wParam, lParam) : 0; } static INT_PTR JabberMenuRosterAdd(WPARAM wParam, LPARAM lParam) { - CJabberProto *ppro = JabberGetInstanceByHContact((HANDLE)wParam); + CJabberProto *ppro = JabberGetInstanceByHContact((HCONTACT)wParam); return(ppro) ? ppro->OnMenuRosterAdd(wParam, lParam) : 0; } static INT_PTR JabberMenuBookmarkAdd(WPARAM wParam, LPARAM lParam) { - CJabberProto *ppro = JabberGetInstanceByHContact((HANDLE)wParam); + CJabberProto *ppro = JabberGetInstanceByHContact((HCONTACT)wParam); return(ppro) ? ppro->OnMenuBookmarkAdd(wParam, lParam) : 0; } static INT_PTR JabberMenuTransportLogin(WPARAM wParam, LPARAM lParam) { - CJabberProto *ppro = JabberGetInstanceByHContact((HANDLE)wParam); + CJabberProto *ppro = JabberGetInstanceByHContact((HCONTACT)wParam); return(ppro) ? ppro->OnMenuTransportLogin(wParam, lParam) : 0; } static INT_PTR JabberMenuTransportResolve(WPARAM wParam, LPARAM lParam) { - CJabberProto *ppro = JabberGetInstanceByHContact((HANDLE)wParam); + CJabberProto *ppro = JabberGetInstanceByHContact((HCONTACT)wParam); return(ppro) ? ppro->OnMenuTransportResolve(wParam, lParam) : 0; } static INT_PTR JabberContactMenuRunCommands(WPARAM wParam, LPARAM lParam) { - CJabberProto *ppro = JabberGetInstanceByHContact((HANDLE)wParam); + CJabberProto *ppro = JabberGetInstanceByHContact((HCONTACT)wParam); return(ppro) ? ppro->ContactMenuRunCommands(wParam, lParam) : 0; } static INT_PTR JabberMenuSendNote(WPARAM wParam, LPARAM lParam) { - CJabberProto *ppro = JabberGetInstanceByHContact((HANDLE)wParam); + CJabberProto *ppro = JabberGetInstanceByHContact((HCONTACT)wParam); return(ppro) ? ppro->OnMenuSendNote(wParam, lParam) : 0; } static INT_PTR JabberMenuHandleResource(WPARAM wParam, LPARAM lParam, LPARAM lRes) { - CJabberProto *ppro = JabberGetInstanceByHContact((HANDLE)wParam); + CJabberProto *ppro = JabberGetInstanceByHContact((HCONTACT)wParam); return(ppro) ? ppro->OnMenuHandleResource(wParam, lParam, lRes) : 0; } static INT_PTR JabberMenuHandleDirectPresence(WPARAM wParam, LPARAM lParam, LPARAM lRes) { - CJabberProto *ppro = JabberGetInstanceByHContact((HANDLE)wParam); + CJabberProto *ppro = JabberGetInstanceByHContact((HCONTACT)wParam); return(ppro) ? ppro->OnMenuHandleDirectPresence(wParam, lParam, lRes) : 0; } @@ -173,7 +173,7 @@ static int JabberPrebuildContactMenu(WPARAM wParam, LPARAM lParam) Menu_ShowItem(g_hMenuResourcesRoot, FALSE); Menu_ShowItem(g_hMenuDirectPresence[0], FALSE); - CJabberProto *ppro = JabberGetInstanceByHContact((HANDLE)wParam); + CJabberProto *ppro = JabberGetInstanceByHContact((HCONTACT)wParam); return(ppro) ? ppro->OnPrebuildContactMenu(wParam, lParam) : 0; } @@ -347,7 +347,7 @@ void g_MenuUninit(void) int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; @@ -479,7 +479,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuConvertChatContact(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; BYTE bIsChatRoom = isChatRoom(hContact); const char *szSetting = (bIsChatRoom) ? "ChatRoomID" : "jid"; @@ -494,14 +494,17 @@ INT_PTR __cdecl CJabberProto::OnMenuConvertChatContact(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM wParam, LPARAM) { - if (!wParam) return 0; // we do not add ourself to the roster. (buggy situation - should not happen) + HCONTACT hContact = (HCONTACT)wParam; + if (!hContact) + return 0; // we do not add ourself to the roster. (buggy situation - should not happen) - ptrT roomID(getTStringA((HANDLE)wParam, "ChatRoomID")); - if (roomID == NULL) return 0; + ptrT roomID(getTStringA(hContact, "ChatRoomID")); + if (roomID == NULL) + return 0; if (ListGetItemPtr(LIST_ROSTER, roomID) == NULL) { - ptrT group(db_get_tsa((HANDLE)wParam, "CList", "Group")); - ptrT nick(getTStringA((HANDLE)wParam, "Nick")); + ptrT group(db_get_tsa(hContact, "CList", "Group")); + ptrT nick(getTStringA(hContact, "Nick")); AddContactToRoster(roomID, nick, group); if (m_options.AddRoster2Bookmarks == TRUE) { @@ -510,7 +513,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM wParam, LPARAM) item = new JABBER_LIST_ITEM(); item->jid = mir_tstrdup(roomID); item->name = mir_tstrdup(nick); - item->nick = getTStringA((HANDLE)wParam, "MyNick"); + item->nick = getTStringA(hContact, "MyNick"); AddEditBookmark(item); delete item; } @@ -521,7 +524,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRosterAdd(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuHandleRequestAuth(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact != NULL && m_bJabberOnline) { ptrT jid(getTStringA(hContact, "jid")); if (jid != NULL) @@ -532,7 +535,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleRequestAuth(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuHandleGrantAuth(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact != NULL && m_bJabberOnline) { ptrT jid(getTStringA(hContact, "jid")); if (jid != NULL) @@ -543,7 +546,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleGrantAuth(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuRevokeAuth(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact != NULL && m_bJabberOnline) { ptrT jid(getTStringA(hContact, "jid")); if (jid != NULL) @@ -554,7 +557,7 @@ INT_PTR __cdecl CJabberProto::OnMenuRevokeAuth(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuTransportLogin(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!getByte(hContact, "IsTransport", 0)) return 0; @@ -570,7 +573,7 @@ INT_PTR __cdecl CJabberProto::OnMenuTransportLogin(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuTransportResolve(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!getByte(hContact, "IsTransport", 0)) return 0; @@ -582,7 +585,7 @@ INT_PTR __cdecl CJabberProto::OnMenuTransportResolve(WPARAM wParam, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!hContact) return 0; // we do not add ourself to the roster. (buggy situation - should not happen) @@ -974,7 +977,7 @@ void CJabberProto::MenuUpdateSrmmIcon(JABBER_LIST_ITEM *item) if (item->list != LIST_ROSTER) return; - HANDLE hContact = HContactFromJID(item->jid); + HCONTACT hContact = HContactFromJID(item->jid); if (!hContact) return; @@ -1040,7 +1043,7 @@ int CJabberProto::OnProcessSrmmIconClick(WPARAM wParam, LPARAM lParam) if (lstrcmpA(sicd->szModule, m_szModuleName)) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!hContact) return 0; @@ -1094,7 +1097,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleResource(WPARAM wParam, LPARAM, LPARAM if (!m_bJabberOnline || !wParam) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ptrT tszJid(getTStringA(hContact, "jid")); if (tszJid == NULL) return 0; @@ -1126,7 +1129,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleDirectPresence(WPARAM wParam, LPARAM l if (!m_bJabberOnline || !wParam) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; TCHAR *jid, text[1024]; ptrT tszJid(getTStringA(hContact, "jid")); diff --git a/protocols/JabberG/src/jabber_message_manager.h b/protocols/JabberG/src/jabber_message_manager.h index b3815d7c8e..e2bc848e2b 100644 --- a/protocols/JabberG/src/jabber_message_manager.h +++ b/protocols/JabberG/src/jabber_message_manager.h @@ -57,7 +57,7 @@ public: LPCTSTR m_szChildTagXmlns; LPCTSTR m_szChildTagName; HXML m_hChildNode; - HANDLE m_hContact; + HCONTACT m_hContact; LPCTSTR m_szTo; LPCTSTR m_szId; @@ -77,7 +77,7 @@ public: __forceinline LPCTSTR GetIdStr() { return m_szId; } - __forceinline HANDLE GetHContact() + __forceinline HCONTACT GetHContact() { return m_hContact; } __forceinline HXML GetChildNode() diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 7bc90fd9f1..04af56aec0 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -70,7 +70,7 @@ int JabberCompareJids(const TCHAR *jid1, const TCHAR *jid2) void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick) { - HANDLE hContact = DBCreateContact(jid, nick, TRUE, TRUE); + HCONTACT hContact = DBCreateContact(jid, nick, TRUE, TRUE); delSetting(hContact, "Hidden"); char* szJid = mir_utf8encodeT(jid); @@ -103,7 +103,7 @@ void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick) /////////////////////////////////////////////////////////////////////////////// // JabberDBCreateContact() -HANDLE CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL temporary, BOOL stripResource) +HCONTACT CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL temporary, BOOL stripResource) { if (jid == NULL || jid[0]=='\0') return NULL; @@ -120,7 +120,7 @@ HANDLE CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL t // We can't use JabberHContactFromJID() here because of the stripResource option size_t len = _tcslen(s); - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { ptrT jid( getTStringA(hContact, "jid")); if (jid == NULL) continue; @@ -130,7 +130,7 @@ HANDLE CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL t return hContact; } - HANDLE hNewContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + HCONTACT hNewContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hNewContact, (LPARAM)m_szModuleName); setTString(hNewContact, "jid", s); if (nick != NULL && *nick != '\0') @@ -144,7 +144,7 @@ HANDLE CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL t return hNewContact; } -BOOL CJabberProto::AddDbPresenceEvent(HANDLE hContact, BYTE btEventType) +BOOL CJabberProto::AddDbPresenceEvent(HCONTACT hContact, BYTE btEventType) { if (!hContact) return FALSE; @@ -179,7 +179,7 @@ BOOL CJabberProto::AddDbPresenceEvent(HANDLE hContact, BYTE btEventType) /////////////////////////////////////////////////////////////////////////////// // JabberGetAvatarFileName() - gets a file name for the avatar image -void CJabberProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen) +void CJabberProto::GetAvatarFileName(HCONTACT hContact, TCHAR* pszDest, size_t cbLen) { int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName); @@ -219,9 +219,9 @@ void CJabberProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbL void CJabberProto::ResolveTransportNicks(const TCHAR *jid) { // Set all contacts to offline - HANDLE hContact = m_ThreadInfo->resolveContact; + HCONTACT hContact = m_ThreadInfo->resolveContact; if (hContact == NULL) - hContact = (HANDLE)db_find_first(m_szModuleName); + hContact = db_find_first(m_szModuleName); for (; hContact != NULL; hContact = db_find_next(hContact, m_szModuleName)) { if (!getByte(hContact, "IsTransported", 0)) @@ -320,7 +320,7 @@ static sttCapsNodeToName_Map[] = void CJabberProto::UpdateMirVer(JABBER_LIST_ITEM *item) { - HANDLE hContact = HContactFromJID(item->jid); + HCONTACT hContact = HContactFromJID(item->jid); if (!hContact) return; @@ -396,7 +396,7 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res) } -void CJabberProto::UpdateMirVer(HANDLE hContact, pResourceStatus &resource) +void CJabberProto::UpdateMirVer(HCONTACT hContact, pResourceStatus &resource) { CMString tszMirVer; FormatMirVer(resource, tszMirVer); @@ -415,7 +415,7 @@ void CJabberProto::UpdateMirVer(HANDLE hContact, pResourceStatus &resource) setTString(hContact, DBSETTING_DISPLAY_UID, szFullJid); } -void CJabberProto::UpdateSubscriptionInfo(HANDLE hContact, JABBER_LIST_ITEM *item) +void CJabberProto::UpdateSubscriptionInfo(HCONTACT hContact, JABBER_LIST_ITEM *item) { switch (item->subscription) { case SUB_TO: @@ -445,7 +445,7 @@ void CJabberProto::UpdateSubscriptionInfo(HANDLE hContact, JABBER_LIST_ITEM *ite } } -void CJabberProto::SetContactOfflineStatus(HANDLE hContact) +void CJabberProto::SetContactOfflineStatus(HCONTACT hContact) { if (getWord(hContact, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) setWord(hContact, "Status", ID_STATUS_OFFLINE); @@ -482,7 +482,7 @@ void CJabberProto::InitPopups(void) Skin_ReleaseIcon(ppc.hIcon); } -void CJabberProto::MsgPopup(HANDLE hContact, const TCHAR *szMsg, const TCHAR *szTitle) +void CJabberProto::MsgPopup(HCONTACT hContact, const TCHAR *szMsg, const TCHAR *szTitle) { if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { char name[256]; diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index 33a183be41..db49f4d08e 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -813,7 +813,7 @@ INT_PTR __cdecl CJabberProto::OnMenuHandleNotes(WPARAM, LPARAM) INT_PTR __cdecl CJabberProto::OnMenuSendNote(WPARAM wParam, LPARAM) { if (wParam) { - CNoteItem *pItem = new CNoteItem(NULL, ptrT(getTStringA((HANDLE)wParam, "jid"))); + CNoteItem *pItem = new CNoteItem(NULL, ptrT(getTStringA((HCONTACT)wParam, "jid"))); CJabberDlgBase *pDlg = new CJabberDlgNoteItem(this, pItem, &CJabberProto::ProcessOutgoingNote); pDlg->Show(); } diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 65ea059fc9..d6720c5a84 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -858,7 +858,7 @@ public: JABBER_LIST_ITEM *item = m_proto->ListGetItemPtrFromIndex(index); if (item != NULL) { if (_tcschr(item->jid, '@') == NULL) { - HANDLE hContact = m_proto->HContactFromJID(item->jid); + HCONTACT hContact = m_proto->HContactFromJID(item->jid); if (hContact != NULL) { if (bChecked) { if (item->getTemp()->m_iStatus != m_proto->getWord(hContact, "Status", ID_STATUS_OFFLINE)) { @@ -1039,7 +1039,7 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) } // now it is require to process whole contact list to add not in roster contacts - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { ptrT tszJid( getTStringA(hContact, "jid")); if (tszJid == NULL) continue; diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 910aff524b..f5cb1785c9 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -418,7 +418,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_RESETCONTENT, 0, 0); { - for (HANDLE hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_proto->m_szModuleName); hContact; hContact = db_find_next(hContact, m_proto->m_szModuleName)) { ptrT jid( m_proto->getTStringA(hContact, "jid")); if (jid != NULL) SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUES, CB_ADDSTRING, 0, jid); @@ -1153,7 +1153,7 @@ void CJabberDlgPrivacyLists::DrawRulesList(LPDRAWITEMSTRUCT lpdis) DrawNextRulePart(lpdis->hDC, clLine1, pRule->GetValue(), &rc); DrawNextRulePart(lpdis->hDC, clLine2, TranslateT("'"), &rc); - if (HANDLE hContact = m_proto->HContactFromJID(pRule->GetValue())) { + if (HCONTACT hContact = m_proto->HContactFromJID(pRule->GetValue())) { TCHAR *szName = pcli->pfnGetContactDisplayName(hContact, 0); if (szName) { DrawNextRulePart(lpdis->hDC, clLine2, TranslateT(" (nickname: "), &rc); @@ -1300,7 +1300,7 @@ void CJabberDlgPrivacyLists::CListResetOptions(HWND) void CJabberDlgPrivacyLists::CListFilter(HWND) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *proto = GetContactProto(hContact); if (!proto || lstrcmpA(proto, m_proto->m_szModuleName)) if (HANDLE hItem = m_clcClist.FindContact(hContact)) @@ -1322,7 +1322,7 @@ void CJabberDlgPrivacyLists::CListSetupIcons(HWND, HANDLE hItem, int iSlot, DWOR HANDLE CJabberDlgPrivacyLists::CListAddContact(HWND hwndList, TCHAR *jid) { - HANDLE hContact = m_proto->HContactFromJID(jid); + HCONTACT hContact = m_proto->HContactFromJID(jid); if (hContact) return m_clcClist.FindContact(hContact); @@ -1357,7 +1357,7 @@ void CJabberDlgPrivacyLists::CListApplyList(HWND hwndList, CPrivacyList *pList) CListResetIcons(hwndList, hItem, bHideIcons); } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = m_clcClist.FindContact(hContact); if (hItem) CListResetIcons(hwndList, hItem, bHideIcons); @@ -1455,7 +1455,7 @@ void CJabberDlgPrivacyLists::CListBuildList(HWND hwndList, CPrivacyList *pList) pList->AddRule(Jid, szJid, FALSE, dwOrder++, dwPackets); } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { hItem = m_clcClist.FindContact(hContact); ptrT jid( m_proto->getTStringA(hContact, "jid")); diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 3c1581a46f..2af1d877fe 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -257,7 +257,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) ConvertPasswords(); // Set all contacts to offline - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { SetContactOfflineStatus(hContact); if (!getByte(hContact, "IsTransport", 0)) @@ -314,9 +314,9 @@ int __cdecl CJabberProto::OnPreShutdown(WPARAM, LPARAM) //////////////////////////////////////////////////////////////////////////////////////// // JabberAddToList - adds a contact to the contact list -HANDLE CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags) +HCONTACT CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags) { - HANDLE hContact; + HCONTACT hContact; TCHAR *jid, *nick; debugLogA("AddToListByJID jid = %S", newJid); @@ -325,7 +325,7 @@ HANDLE CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags) // not already there: add jid = mir_tstrdup(newJid); debugLogA("Add new jid to contact jid = %S", jid); - hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName); setTString(hContact, "jid", jid); if ((nick=JabberNickFromJID(newJid)) == NULL) @@ -398,7 +398,7 @@ HANDLE __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, HANDL char *jid = lastName + strlen(lastName) + 1; TCHAR *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid); - HANDLE hContact = (HANDLE)AddToListByJID(newJid, flags); + HCONTACT hContact = (HCONTACT)AddToListByJID(newJid, flags); mir_free(newJid); return hContact; } @@ -436,12 +436,11 @@ int CJabberProto::Authorize(HANDLE hDbEvent) // Automatically add this user to my roster if option is enabled if (m_options.AutoAdd == TRUE) { - HANDLE hContact; JABBER_LIST_ITEM *item; if ((item = ListGetItemPtr(LIST_ROSTER, newJid)) == NULL || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) { debugLogA("Try adding contact automatically jid = %S", jid); - if ((hContact = AddToListByJID(newJid, 0)) != NULL) { + if (HCONTACT hContact = AddToListByJID(newJid, 0)) { // Trigger actual add by removing the "NotOnList" added by AddToListByJID() // See AddToListByJID() and JabberDbSettingChanged(). db_unset(hContact, "CList", "NotOnList"); @@ -493,7 +492,7 @@ int CJabberProto::AuthDeny(HANDLE hDbEvent, const TCHAR*) //////////////////////////////////////////////////////////////////////////////////////// // PSR_AUTH -int __cdecl CJabberProto::AuthRecv(HANDLE, PROTORECVEVENT*) +int __cdecl CJabberProto::AuthRecv(HCONTACT, PROTORECVEVENT*) { return 1; } @@ -501,7 +500,7 @@ int __cdecl CJabberProto::AuthRecv(HANDLE, PROTORECVEVENT*) //////////////////////////////////////////////////////////////////////////////////////// // PSS_AUTHREQUEST -int __cdecl CJabberProto::AuthRequest(HANDLE, const TCHAR*) +int __cdecl CJabberProto::AuthRequest(HCONTACT, const TCHAR*) { return 1; } @@ -517,7 +516,7 @@ HANDLE __cdecl CJabberProto::ChangeInfo(int /*iInfoType*/, void*) //////////////////////////////////////////////////////////////////////////////////////// // JabberFileAllow - starts a file transfer -HANDLE __cdecl CJabberProto::FileAllow(HANDLE /*hContact*/, HANDLE hTransfer, const TCHAR *szPath) +HANDLE __cdecl CJabberProto::FileAllow(HCONTACT /*hContact*/, HANDLE hTransfer, const TCHAR *szPath) { if (!m_bJabberOnline) return 0; @@ -545,7 +544,7 @@ HANDLE __cdecl CJabberProto::FileAllow(HANDLE /*hContact*/, HANDLE hTransfer, co //////////////////////////////////////////////////////////////////////////////////////// // JabberFileCancel - cancels a file transfer -int __cdecl CJabberProto::FileCancel(HANDLE /*hContact*/, HANDLE hTransfer) +int __cdecl CJabberProto::FileCancel(HCONTACT, HANDLE hTransfer) { filetransfer *ft = (filetransfer*)hTransfer; HANDLE hEvent; @@ -573,7 +572,7 @@ int __cdecl CJabberProto::FileCancel(HANDLE /*hContact*/, HANDLE hTransfer) //////////////////////////////////////////////////////////////////////////////////////// // JabberFileDeny - denies a file transfer -int __cdecl CJabberProto::FileDeny(HANDLE, HANDLE hTransfer, const TCHAR *) +int __cdecl CJabberProto::FileDeny(HCONTACT, HANDLE hTransfer, const TCHAR *) { if (!m_bJabberOnline) return 1; @@ -617,7 +616,7 @@ int __cdecl CJabberProto::FileResume(HANDLE hTransfer, int *action, const TCHAR //////////////////////////////////////////////////////////////////////////////////////// // GetCaps - return protocol capabilities bits -DWORD_PTR __cdecl CJabberProto::GetCaps(int type, HANDLE hContact) +DWORD_PTR __cdecl CJabberProto::GetCaps(int type, HCONTACT hContact) { switch(type) { case PFLAGNUM_1: @@ -645,7 +644,7 @@ DWORD_PTR __cdecl CJabberProto::GetCaps(int type, HANDLE hContact) //////////////////////////////////////////////////////////////////////////////////////// // GetInfo - retrieves a contact info -int __cdecl CJabberProto::GetInfo(HANDLE hContact, int /*infoType*/) +int __cdecl CJabberProto::GetInfo(HCONTACT hContact, int /*infoType*/) { if (!m_bJabberOnline || isChatRoom(hContact)) return 1; @@ -859,7 +858,7 @@ HANDLE __cdecl CJabberProto::SearchByName(const TCHAR *nick, const TCHAR *firstN //////////////////////////////////////////////////////////////////////////////////////// // RecvContacts -int __cdecl CJabberProto::RecvContacts(HANDLE /*hContact*/, PROTORECVEVENT*) +int __cdecl CJabberProto::RecvContacts(HCONTACT, PROTORECVEVENT*) { return 1; } @@ -867,7 +866,7 @@ int __cdecl CJabberProto::RecvContacts(HANDLE /*hContact*/, PROTORECVEVENT*) //////////////////////////////////////////////////////////////////////////////////////// // RecvFile -int __cdecl CJabberProto::RecvFile(HANDLE hContact, PROTORECVFILET *evt) +int __cdecl CJabberProto::RecvFile(HCONTACT hContact, PROTORECVFILET *evt) { return Proto_RecvFile(hContact, evt); } @@ -875,7 +874,7 @@ int __cdecl CJabberProto::RecvFile(HANDLE hContact, PROTORECVFILET *evt) //////////////////////////////////////////////////////////////////////////////////////// // RecvMsg -int __cdecl CJabberProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *evt) +int __cdecl CJabberProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT *evt) { ptrA szResUtf( mir_utf8encodeT((LPCTSTR)evt->lParam)); evt->pCustomData = szResUtf; @@ -887,7 +886,7 @@ int __cdecl CJabberProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *evt) //////////////////////////////////////////////////////////////////////////////////////// // RecvUrl -int __cdecl CJabberProto::RecvUrl(HANDLE /*hContact*/, PROTORECVEVENT*) +int __cdecl CJabberProto::RecvUrl(HCONTACT, PROTORECVEVENT*) { return 1; } @@ -895,7 +894,7 @@ int __cdecl CJabberProto::RecvUrl(HANDLE /*hContact*/, PROTORECVEVENT*) //////////////////////////////////////////////////////////////////////////////////////// // SendContacts -int __cdecl CJabberProto::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList) +int __cdecl CJabberProto::SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) { if (!m_bJabberOnline) return 0; @@ -925,7 +924,7 @@ int __cdecl CJabberProto::SendContacts(HANDLE hContact, int flags, int nContacts //////////////////////////////////////////////////////////////////////////////////////// // SendFile - sends a file -HANDLE __cdecl CJabberProto::SendFile(HANDLE hContact, const TCHAR *szDescription, TCHAR** ppszFiles) +HANDLE __cdecl CJabberProto::SendFile(HCONTACT hContact, const TCHAR *szDescription, TCHAR** ppszFiles) { if (!m_bJabberOnline) return 0; @@ -1012,10 +1011,10 @@ HANDLE __cdecl CJabberProto::SendFile(HANDLE hContact, const TCHAR *szDescriptio struct TFakeAckParams { - inline TFakeAckParams(HANDLE _hContact, const char* _msg, int _msgid = 0) + inline TFakeAckParams(HCONTACT _hContact, const char* _msg, int _msgid = 0) : hContact(_hContact), msg(_msg), msgid(_msgid) {} - HANDLE hContact; + HCONTACT hContact; const char *msg; int msgid; }; @@ -1035,7 +1034,7 @@ void __cdecl CJabberProto::SendMessageAckThread(void* param) static char PGP_PROLOG[] = "-----BEGIN PGP MESSAGE-----\r\n\r\n"; static char PGP_EPILOG[] = "\r\n-----END PGP MESSAGE-----\r\n"; -int __cdecl CJabberProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc) +int __cdecl CJabberProto::SendMsg(HCONTACT hContact, int flags, const char* pszSrc) { TCHAR szClientJid[JABBER_MAX_JID_LEN]; if (!m_bJabberOnline || !GetClientJID(hContact, szClientJid, SIZEOF(szClientJid))) { @@ -1135,7 +1134,7 @@ int __cdecl CJabberProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc //////////////////////////////////////////////////////////////////////////////////////// // SendUrl -int __cdecl CJabberProto::SendUrl(HANDLE /*hContact*/, int /*flags*/, const char* /*url*/) +int __cdecl CJabberProto::SendUrl(HCONTACT, int /*flags*/, const char* /*url*/) { return 1; } @@ -1143,7 +1142,7 @@ int __cdecl CJabberProto::SendUrl(HANDLE /*hContact*/, int /*flags*/, const char //////////////////////////////////////////////////////////////////////////////////////// // JabberSetApparentMode - sets the visibility status -int __cdecl CJabberProto::SetApparentMode(HANDLE hContact, int mode) +int __cdecl CJabberProto::SetApparentMode(HCONTACT hContact, int mode) { if (mode != 0 && mode != ID_STATUS_ONLINE && mode != ID_STATUS_OFFLINE) return 1; @@ -1223,8 +1222,10 @@ int __cdecl CJabberProto::SetStatus(int iNewStatus) //////////////////////////////////////////////////////////////////////////////////////// // JabberGetAwayMsg - returns a contact's away message -void __cdecl CJabberProto::GetAwayMsgThread(void* hContact) +void __cdecl CJabberProto::GetAwayMsgThread(void *param) { + HCONTACT hContact = (HCONTACT)param; + ptrT jid( getTStringA(hContact, "jid")); if (jid != NULL) { JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid); @@ -1271,7 +1272,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void* hContact) ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)0); } -HANDLE __cdecl CJabberProto::GetAwayMsg(HANDLE hContact) +HANDLE __cdecl CJabberProto::GetAwayMsg(HCONTACT hContact) { debugLogA("GetAwayMsg called, hContact=%08X", hContact); @@ -1282,7 +1283,7 @@ HANDLE __cdecl CJabberProto::GetAwayMsg(HANDLE hContact) //////////////////////////////////////////////////////////////////////////////////////// // PSR_AWAYMSG -int __cdecl CJabberProto::RecvAwayMsg(HANDLE /*hContact*/, int /*statusMode*/, PROTORECVEVENT*) +int __cdecl CJabberProto::RecvAwayMsg(HCONTACT, int /*statusMode*/, PROTORECVEVENT*) { return 1; } @@ -1343,7 +1344,7 @@ int __cdecl CJabberProto::SetAwayMsg(int status, const TCHAR *msg) ///////////////////////////////////////////////////////////////////////////////////////// // JabberUserIsTyping - sends a UTN notification -int __cdecl CJabberProto::UserIsTyping(HANDLE hContact, int type) +int __cdecl CJabberProto::UserIsTyping(HCONTACT hContact, int type) { if (!m_bJabberOnline) return 0; @@ -1425,7 +1426,7 @@ void CJabberProto::InfoFrame_OnSetup(CJabberInfoFrame_Event*) void CJabberProto::InfoFrame_OnTransport(CJabberInfoFrame_Event *evt) { if (evt->m_event == CJabberInfoFrame_Event::CLICK) { - HANDLE hContact = (HANDLE)evt->m_pUserData; + HCONTACT hContact = (HCONTACT)evt->m_pUserData; HMENU hContactMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)hContact, 0); POINT pt; GetCursorPos(&pt); diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 1bbf639c5d..6c90985d43 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -87,18 +87,18 @@ struct CJabberProto : public PROTO, public IJabberInterface virtual int __cdecl Authorize(HANDLE hDbEvent); virtual int __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR *szReason); - virtual int __cdecl AuthRecv(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl AuthRequest(HANDLE hContact, const TCHAR *szMessage); + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl AuthRequest(HCONTACT hContact, const TCHAR *szMessage); virtual HANDLE __cdecl ChangeInfo(int iInfoType, void* pInfoData); - virtual HANDLE __cdecl FileAllow(HANDLE hContact, HANDLE hTransfer, const TCHAR *szPath); - virtual int __cdecl FileCancel(HANDLE hContact, HANDLE hTransfer); - virtual int __cdecl FileDeny(HANDLE hContact, HANDLE hTransfer, const TCHAR *szReason); + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath); + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer); + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason); virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename); - virtual DWORD_PTR __cdecl GetCaps(int type, HANDLE hContact = NULL); - virtual int __cdecl GetInfo(HANDLE hContact, int infoType); + virtual DWORD_PTR __cdecl GetCaps(int type, HCONTACT hContact = NULL); + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType); virtual HANDLE __cdecl SearchBasic(const TCHAR *id); virtual HANDLE __cdecl SearchByEmail(const TCHAR *email); @@ -106,24 +106,24 @@ struct CJabberProto : public PROTO, public IJabberInterface virtual HWND __cdecl SearchAdvanced(HWND owner); virtual HWND __cdecl CreateExtendedSearchUI(HWND owner); - virtual int __cdecl RecvContacts(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl RecvFile(HANDLE hContact, PROTORECVFILET*); - virtual int __cdecl RecvMsg(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl RecvUrl(HANDLE hContact, PROTORECVEVENT*); + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvFile(HCONTACT hContact, PROTORECVFILET*); + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT*); - virtual int __cdecl SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList); - virtual HANDLE __cdecl SendFile(HANDLE hContact, const TCHAR *szDescription, TCHAR** ppszFiles); - virtual int __cdecl SendMsg(HANDLE hContact, int flags, const char* msg); - virtual int __cdecl SendUrl(HANDLE hContact, int flags, const char* url); + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList); + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles); + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char *msg); + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char *url); - virtual int __cdecl SetApparentMode(HANDLE hContact, int mode); + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode); virtual int __cdecl SetStatus(int iNewStatus); - virtual HANDLE __cdecl GetAwayMsg(HANDLE hContact); - virtual int __cdecl RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT* evt); + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact); + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt); virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR *msg); - virtual int __cdecl UserIsTyping(HANDLE hContact, int type); + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type); virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam); @@ -132,7 +132,7 @@ struct CJabberProto : public PROTO, public IJabberInterface INT_PTR __cdecl GetMyAwayMsg(WPARAM wParam, LPARAM lParam); //====| Events |====================================================================== - void __cdecl OnAddContactForever(DBCONTACTWRITESETTING* cws, HANDLE hContact); + void __cdecl OnAddContactForever(DBCONTACTWRITESETTING* cws, HCONTACT hContact); int __cdecl OnContactDeleted(WPARAM, LPARAM); int __cdecl OnDbSettingChanged(WPARAM, LPARAM); int __cdecl OnIdleChanged(WPARAM, LPARAM); @@ -145,8 +145,8 @@ struct CJabberProto : public PROTO, public IJabberInterface int __cdecl OnProcessSrmmIconClick(WPARAM, LPARAM); int __cdecl OnProcessSrmmEvent(WPARAM, LPARAM); int __cdecl OnReloadIcons(WPARAM, LPARAM); - void __cdecl OnRenameContact(DBCONTACTWRITESETTING* cws, HANDLE hContact); - void __cdecl OnRenameGroup(DBCONTACTWRITESETTING* cws, HANDLE hContact); + void __cdecl OnRenameContact(DBCONTACTWRITESETTING* cws, HCONTACT hContact); + void __cdecl OnRenameGroup(DBCONTACTWRITESETTING* cws, HCONTACT hContact); int __cdecl OnUserInfoInit(WPARAM, LPARAM); int __cdecl JabberGcEventHook(WPARAM, LPARAM); @@ -294,7 +294,7 @@ struct CJabberProto : public PROTO, public IJabberInterface //---- jabber_archive.c -------------------------------------------------------------- void EnableArchive(bool bEnable); - void RetrieveMessageArchive(HANDLE hContact, JABBER_LIST_ITEM *pItem); + void RetrieveMessageArchive(HCONTACT hContact, JABBER_LIST_ITEM *pItem); void OnIqResultGetCollection(HXML iqNode, CJabberIqInfo*); void OnIqResultGetCollectionList(HXML iqNode, CJabberIqInfo*); @@ -451,7 +451,7 @@ struct CJabberProto : public PROTO, public IJabberInterface int LoadAdvancedIcons(int iID); int GetTransportProtoID(TCHAR* TransportDomain); int GetTransportStatusIconIndex(int iID, int Status); - BOOL DBCheckIsTransportedContact(const TCHAR *jid, HANDLE hContact); + BOOL DBCheckIsTransportedContact(const TCHAR *jid, HCONTACT hContact); void CheckAllContactsAreTransported(void); INT_PTR __cdecl JGetAdvancedStatusIcon(WPARAM wParam, LPARAM lParam); @@ -472,7 +472,7 @@ struct CJabberProto : public PROTO, public IJabberInterface void OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo *pInfo); void OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo *pInfo); void OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo *pInfo); - void OnIqResultGotAvatar(HANDLE hContact, HXML n, const TCHAR *mimeType); + void OnIqResultGotAvatar(HCONTACT hContact, HXML n, const TCHAR *mimeType); void OnIqResultGetMuc(HXML iqNode, CJabberIqInfo *pInfo); void OnIqResultGetRegister(HXML iqNode, CJabberIqInfo *pInfo); void OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo); @@ -528,7 +528,7 @@ struct CJabberProto : public PROTO, public IJabberInterface //---- jabber_iqid.cpp --------------------------------------------------------------- - void GroupchatJoinByHContact(HANDLE hContact, bool autojoin=false); + void GroupchatJoinByHContact(HCONTACT hContact, bool autojoin=false); //---- jabber_message_handlers.cpp --------------------------------------------------- @@ -560,7 +560,7 @@ struct CJabberProto : public PROTO, public IJabberInterface void OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE listType); void OnIqResultServerDiscoInfo(HXML iqNode, CJabberIqInfo *pInfo); - void OnIqResultGetVcardPhoto(const TCHAR *jid, HXML n, HANDLE hContact, bool &hasPhoto); + void OnIqResultGetVcardPhoto(const TCHAR *jid, HXML n, HCONTACT hContact, bool &hasPhoto); void SetBookmarkRequest (XmlNodeIq& iqId); //---- jabber_menu.cpp --------------------------------------------------------------- @@ -584,7 +584,7 @@ struct CJabberProto : public PROTO, public IJabberInterface void MenuInit(void); void MenuUpdateSrmmIcon(JABBER_LIST_ITEM *item); - void AuthWorker(HANDLE hContact, char* authReqType); + void AuthWorker(HCONTACT hContact, char* authReqType); void UpdatePriorityMenu(short priority); @@ -599,18 +599,18 @@ struct CJabberProto : public PROTO, public IJabberInterface void AddContactToRoster(const TCHAR *jid, const TCHAR *nick, const TCHAR *grpName); void DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick); - BOOL AddDbPresenceEvent(HANDLE hContact, BYTE btEventType); - HANDLE DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL temporary, BOOL stripResource); - void GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen); + BOOL AddDbPresenceEvent(HCONTACT hContact, BYTE btEventType); + HCONTACT DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL temporary, BOOL stripResource); + void GetAvatarFileName(HCONTACT hContact, TCHAR* pszDest, size_t cbLen); void ResolveTransportNicks(const TCHAR *jid); void SetServerStatus(int iNewStatus); void FormatMirVer(pResourceStatus &resource, CMString&); void UpdateMirVer(JABBER_LIST_ITEM *item); - void UpdateMirVer(HANDLE hContact, pResourceStatus &resource); - void UpdateSubscriptionInfo(HANDLE hContact, JABBER_LIST_ITEM *item); - void SetContactOfflineStatus(HANDLE hContact); + void UpdateMirVer(HCONTACT hContact, pResourceStatus &resource); + void UpdateSubscriptionInfo(HCONTACT hContact, JABBER_LIST_ITEM *item); + void SetContactOfflineStatus(HCONTACT hContact); void InitPopups(void); - void MsgPopup(HANDLE hContact, const TCHAR *szMsg, const TCHAR *szTitle); + void MsgPopup(HCONTACT hContact, const TCHAR *szMsg, const TCHAR *szTitle); //---- jabber_opt.cpp ---------------------------------------------------------------- @@ -653,7 +653,7 @@ struct CJabberProto : public PROTO, public IJabberInterface void __cdecl GetAwayMsgThread(void* hContact); void __cdecl SendMessageAckThread(void* hContact); - HANDLE AddToListByJID(const TCHAR *newJid, DWORD flags); + HCONTACT AddToListByJID(const TCHAR *newJid, DWORD flags); void WindowSubscribe(HWND hwnd); void WindowUnsubscribe(HWND hwnd); void WindowNotify(UINT msg, bool async = false); @@ -739,7 +739,7 @@ struct CJabberProto : public PROTO, public IJabberInterface void OnProcessProtocol(HXML node, ThreadData *info); void UpdateJidDbSettings(const TCHAR *jid); - HANDLE CreateTemporaryContact(const TCHAR *szJid, JABBER_LIST_ITEM* chatItem); + HCONTACT CreateTemporaryContact(const TCHAR *szJid, JABBER_LIST_ITEM* chatItem); void PerformRegistration(ThreadData* info); void PerformIqAuth(ThreadData* info); @@ -759,8 +759,8 @@ struct CJabberProto : public PROTO, public IJabberInterface //---- jabber_util.c ----------------------------------------------------------------- pResourceStatus ResourceInfoFromJID(const TCHAR *jid); - HANDLE HContactFromJID(const TCHAR *jid , BOOL bStripResource = 3); - HANDLE ChatRoomHContactFromJID(const TCHAR *jid); + HCONTACT HContactFromJID(const TCHAR *jid, BOOL bStripResource = 3); + HCONTACT ChatRoomHContactFromJID(const TCHAR *jid); void SendVisibleInvisiblePresence(BOOL invisible); void SendPresenceTo(int status, const TCHAR* to, HXML extra, const TCHAR *msg = NULL); void SendPresence(int m_iStatus, bool bSendToAll); @@ -768,7 +768,7 @@ struct CJabberProto : public PROTO, public IJabberInterface void RebuildInfoFrame(void); // returns buf or NULL on error - TCHAR* GetClientJID(HANDLE hContact, TCHAR *dest, size_t destLen); + TCHAR* GetClientJID(HCONTACT hContact, TCHAR *dest, size_t destLen); TCHAR* GetClientJID(const TCHAR *jid, TCHAR *dest, size_t destLen); void ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *param, int recentCount=JABBER_DEFAULT_RECENT_COUNT); @@ -819,16 +819,16 @@ struct CJabberProto : public PROTO, public IJabberInterface HICON GetXStatusIcon(int bStatus, UINT flags); void RegisterAdvStatusSlot(const char *pszSlot); - void ResetAdvStatus(HANDLE hContact, const char *pszSlot); - void WriteAdvStatus(HANDLE hContact, const char *pszSlot, const TCHAR *pszMode, const char *pszIcon, const TCHAR *pszTitle, const TCHAR *pszText); - char* ReadAdvStatusA(HANDLE hContact, const char *pszSlot, const char *pszValue); - TCHAR* ReadAdvStatusT(HANDLE hContact, const char *pszSlot, const char *pszValue); + void ResetAdvStatus(HCONTACT hContact, const char *pszSlot); + void WriteAdvStatus(HCONTACT hContact, const char *pszSlot, const TCHAR *pszMode, const char *pszIcon, const TCHAR *pszTitle, const TCHAR *pszText); + char* ReadAdvStatusA(HCONTACT hContact, const char *pszSlot, const char *pszValue); + TCHAR* ReadAdvStatusT(HCONTACT hContact, const char *pszSlot, const char *pszValue); BOOL SendPepTune(TCHAR* szArtist, TCHAR* szLength, TCHAR* szSource, TCHAR* szTitle, TCHAR* szTrack, TCHAR* szUri); void XStatusInit(void); - void SetContactTune(HANDLE hContact, LPCTSTR szArtist, LPCTSTR szLength, LPCTSTR szSource, LPCTSTR szTitle, LPCTSTR szTrack); + void SetContactTune(HCONTACT hContact, LPCTSTR szArtist, LPCTSTR szLength, LPCTSTR szSource, LPCTSTR szTitle, LPCTSTR szTrack); void InfoFrame_OnUserMood(CJabberInfoFrame_Event *evt); void InfoFrame_OnUserActivity(CJabberInfoFrame_Event *evt); @@ -857,8 +857,8 @@ public: DWORD STDMETHODCALLTYPE GetJabberVersion() const; // Returns Jabber plugin version. int STDMETHODCALLTYPE CompareJIDs(LPCTSTR jid1, LPCTSTR jid2); // Strips resource names from given JIDs and returns result of comparison for these JIDs. - HANDLE STDMETHODCALLTYPE ContactFromJID(LPCTSTR jid); // Returns contact handle for given JID. - LPTSTR STDMETHODCALLTYPE ContactToJID(HANDLE hContact); // Returns JID of hContact. You must free the result using mir_free(). + HCONTACT STDMETHODCALLTYPE ContactFromJID(LPCTSTR jid); // Returns contact handle for given JID. + LPTSTR STDMETHODCALLTYPE ContactToJID(HCONTACT hContact); // Returns JID of hContact. You must free the result using mir_free(). LPTSTR STDMETHODCALLTYPE GetBestResourceName(LPCTSTR jid); // Returns best resource name for given JID. You must free the result using mir_free(). LPTSTR STDMETHODCALLTYPE GetResourceList(LPCTSTR jid); // Returns all resource names for a given JID in format "resource1\0resource2\0resource3\0\0" (all resources are separated by \0 character and the whole string is terminated with two \0 characters). You must free the string using mir_free(). char* STDMETHODCALLTYPE GetModuleName() const; // Returns Jabber module name. diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 6c53d6b819..5df492cb82 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -466,7 +466,7 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe int CJabberProto::RcGetUnreadEventsCount() { int nEventsSent = 0; - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { ptrT jid( getTStringA(hContact, "jid")); if (jid == NULL) continue; @@ -552,7 +552,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe m_options.RcMarkMessagesAsRead = bRemoveCListEvents ? 1 : 0; int nEventsSent = 0; - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { ptrT tszJid( getTStringA(hContact, "jid")); if (tszJid == NULL) continue; diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp index ed66f07226..985030607f 100644 --- a/protocols/JabberG/src/jabber_std.cpp +++ b/protocols/JabberG/src/jabber_std.cpp @@ -41,7 +41,7 @@ void __forceinline sttCryptString(char *str) } } -static TCHAR* JSetStringCrypt(LPCSTR szModule, HANDLE hContact, char *valueName) +static TCHAR* JSetStringCrypt(LPCSTR szModule, HCONTACT hContact, char *valueName) { DBVARIANT dbv; if (db_get_s(hContact, szModule, valueName, &dbv)) @@ -62,7 +62,7 @@ void CJabberProto::ConvertPasswords() setTString("Password", passw); delSetting("LoginPassword"); - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if ((passw = JSetStringCrypt(m_szModuleName, hContact, "LoginPassword")) == NULL) continue; diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index ee0b58dc2e..6741a69007 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -449,7 +449,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) return 1; TCHAR *szMsgBody = NULL; - HANDLE hContact = HContactFromJID(szJid, TRUE); + HCONTACT hContact = HContactFromJID(szJid, TRUE); if (hContact == NULL) hContact = DBCreateContact(szJid, szJid, TRUE, TRUE); if (hContact == NULL) @@ -520,7 +520,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI(WPARAM, LPARAM lParam) if (!ServiceExists(MS_FILE_SENDFILE)) return 1; - HANDLE hContact = HContactFromJID(szJid, TRUE); + HCONTACT hContact = HContactFromJID(szJid, TRUE); if (hContact == NULL) hContact = DBCreateContact(szJid, szJid, TRUE, TRUE); if (hContact == NULL) @@ -538,7 +538,7 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM wParam, LPARAM) if (!m_bJabberOnline) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; ptrT jid( getTStringA(hContact, "jid")); if (jid == NULL) return 0; diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 4449c0d2bf..eed8b47784 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -559,7 +559,7 @@ recvRest: ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus); // Set all contacts to offline - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) SetContactOfflineStatus(hContact); mir_free(m_szJabberJID); @@ -995,7 +995,7 @@ void CJabberProto::OnProcessPubsubEvent(HXML node) m_pepServices.ProcessEvent(from, eventNode); - HANDLE hContact = HContactFromJID(from); + HCONTACT hContact = HContactFromJID(from); if (!hContact) return; @@ -1030,7 +1030,7 @@ void CJabberProto::OnProcessPubsubEvent(HXML node) } // returns 0, if error or no events -DWORD JabberGetLastContactMessageTime(HANDLE hContact) +DWORD JabberGetLastContactMessageTime(HCONTACT hContact) { // TODO: time cache can improve performance HANDLE hDbEvent = db_event_last(hContact); @@ -1051,9 +1051,9 @@ DWORD JabberGetLastContactMessageTime(HANDLE hContact) return dwTime; } -HANDLE CJabberProto::CreateTemporaryContact(const TCHAR *szJid, JABBER_LIST_ITEM* chatItem) +HCONTACT CJabberProto::CreateTemporaryContact(const TCHAR *szJid, JABBER_LIST_ITEM* chatItem) { - HANDLE hContact = NULL; + HCONTACT hContact = NULL; if (chatItem) { const TCHAR *p = _tcschr(szJid, '/'); if (p != NULL && p[1] != '\0') @@ -1101,7 +1101,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info) if (m_messageManager.HandleMessagePermanent(node, info)) return; - HANDLE hContact = HContactFromJID(from); + HCONTACT hContact = HContactFromJID(from); JABBER_LIST_ITEM *chatItem = ListGetItemPtr(LIST_CHATROOM, from); if (chatItem) { HXML xCaptcha = xmlGetChild(node, "captcha"); @@ -1353,12 +1353,12 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData* info) const TCHAR *group = xmlGetText(xmlGetChild(iNode, _T("group"))); if (action && jid && _tcsstr(jid, chkJID)) { if (!_tcscmp(action, _T("add"))) { - HANDLE hContact = DBCreateContact(jid, nick, FALSE, FALSE); + HCONTACT hContact = DBCreateContact(jid, nick, FALSE, FALSE); if (group) db_set_ts(hContact, "CList", "Group", group); } else if (!_tcscmp(action, _T("delete"))) { - HANDLE hContact = HContactFromJID(jid); + HCONTACT hContact = HContactFromJID(jid); if (hContact) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); } @@ -1462,7 +1462,7 @@ void CJabberProto::OnProcessPresenceCapabilites(HXML node) r->m_tszCapsNode = mir_tstrdup(szNode); r->m_tszCapsVer = mir_tstrdup(szVer); r->m_tszCapsExt = mir_tstrdup(szExt); - HANDLE hContact = HContactFromJID(from); + HCONTACT hContact = HContactFromJID(from); if (hContact) UpdateMirVer(hContact, r); } @@ -1477,7 +1477,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid); if (item == NULL) return; - HANDLE hContact = HContactFromJID(jid); + HCONTACT hContact = HContactFromJID(jid); if (hContact == NULL) return; @@ -1535,7 +1535,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid) void CJabberProto::OnProcessPresence(HXML node, ThreadData* info) { - HANDLE hContact; + HCONTACT hContact; HXML showNode; JABBER_LIST_ITEM *item; LPCTSTR from, show; diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index bb85ac1f74..adb80356f6 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -74,10 +74,10 @@ struct UserInfoStringBuf struct JabberUserInfoDlgData { - CJabberProto* ppro; - HANDLE hContact; + HCONTACT hContact; + CJabberProto *ppro; JABBER_LIST_ITEM *item; - int resourcesCount; + int resourcesCount; }; enum @@ -311,7 +311,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti sttFillInfoLine(hwndTree, htiSoftwareInfo, NULL, TranslateT("Miranda core version"), r->m_tszXMirandaCoreVersion, sttInfoLineId(resource, INFOLINE_SOFTWARE_INFORMATION, nLineId++)); } -static void sttFillAdvStatusInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM htiRoot, DWORD dwInfoLine, HANDLE hContact, TCHAR *szTitle, char *pszSlot) +static void sttFillAdvStatusInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM htiRoot, DWORD dwInfoLine, HCONTACT hContact, TCHAR *szTitle, char *pszSlot) { char *szAdvStatusIcon = ppro->ReadAdvStatusA(hContact, pszSlot, ADVSTATUS_VAL_ICON); TCHAR *szAdvStatusTitle = ppro->ReadAdvStatusT(hContact, pszSlot, ADVSTATUS_VAL_TITLE); @@ -340,7 +340,7 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM HTREEITEM htiRoot = sttFillInfoLine(hwndTree, NULL, ppro->LoadIconEx("main"), _T("JID"), item->jid, sttInfoLineId(0, INFOLINE_NAME), true); TCHAR buf[256]; - if (HANDLE hContact = ppro->HContactFromJID(item->jid)) { + if (HCONTACT hContact = ppro->HContactFromJID(item->jid)) { sttFillAdvStatusInfo(ppro, hwndTree, htiRoot, sttInfoLineId(0, INFOLINE_MOOD), hContact, TranslateT("Mood"), ADVSTATUS_MOOD); sttFillAdvStatusInfo(ppro, hwndTree, htiRoot, sttInfoLineId(0, INFOLINE_ACTIVITY), hContact, TranslateT("Activity"), ADVSTATUS_ACTIVITY); sttFillAdvStatusInfo(ppro, hwndTree, htiRoot, sttInfoLineId(0, INFOLINE_TUNE), hContact, TranslateT("Tune"), ADVSTATUS_TUNE); @@ -445,7 +445,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa dat->resourcesCount = -1; if (CallService(MS_DB_CONTACT_IS, (WPARAM)lParam, 0)) - dat->hContact = (HANDLE)lParam; + dat->hContact = (HCONTACT)lParam; else if (!IsBadReadPtr((void*)lParam, sizeof(JABBER_LIST_ITEM))) { dat->hContact = NULL; dat->item = (JABBER_LIST_ITEM *)lParam; @@ -550,7 +550,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa switch (((LPNMHDR)lParam)->code) { case PSN_INFOCHANGED: { - HANDLE hContact = (HANDLE)((LPPSHNOTIFY) lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; SendMessage(hwndDlg, WM_JABBER_REFRESH, 0, (LPARAM)hContact); } break; @@ -589,8 +589,8 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa struct USER_PHOTO_INFO { - HANDLE hContact; - HBITMAP hBitmap; + HCONTACT hContact; + HBITMAP hBitmap; CJabberProto *ppro; }; @@ -605,7 +605,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP // lParam is hContact TranslateDialogDefault(hwndDlg); photoInfo = (USER_PHOTO_INFO *) mir_alloc(sizeof(USER_PHOTO_INFO)); - photoInfo->hContact = (HANDLE)lParam; + photoInfo->hContact = (HCONTACT)lParam; photoInfo->ppro = NULL; photoInfo->hBitmap = NULL; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) photoInfo); @@ -800,7 +800,7 @@ int CJabberProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) if (!CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)m_szModuleName)) return 0; - HANDLE hContact = (HANDLE)lParam; + HCONTACT hContact = (HCONTACT)lParam; if (hContact == NULL) { // Show our vcard OnUserInfoInit_VCard(wParam, lParam); @@ -844,7 +844,7 @@ void JabberUserInfoUninit() ///////////////////////////////////////////////////////////////////////////////////////// // JabberUserInfoUpdate -void JabberUserInfoUpdate(HANDLE hContact) +void JabberUserInfoUpdate(HCONTACT hContact) { if (!hContact) WindowList_BroadcastAsync(hUserInfoList, WM_JABBER_REFRESH, 0, 0); diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index d73ff4cce4..9a881deafb 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -34,12 +34,12 @@ int CJabberProto::SerialNext(void) /////////////////////////////////////////////////////////////////////////////// // JabberChatRoomHContactFromJID - looks for the char room HCONTACT with required JID -HANDLE CJabberProto::ChatRoomHContactFromJID(const TCHAR *jid) +HCONTACT CJabberProto::ChatRoomHContactFromJID(const TCHAR *jid) { if (jid == NULL) return NULL; - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { ptrT dbJid( getTStringA(hContact, "ChatRoomID")); if (dbJid == NULL) if ((dbJid = getTStringA(hContact, "jid")) == NULL) @@ -55,14 +55,14 @@ HANDLE CJabberProto::ChatRoomHContactFromJID(const TCHAR *jid) /////////////////////////////////////////////////////////////////////////////// // JabberHContactFromJID - looks for the HCONTACT with required JID -HANDLE CJabberProto::HContactFromJID(const TCHAR *jid , BOOL bStripResource) +HCONTACT CJabberProto::HContactFromJID(const TCHAR *jid, BOOL bStripResource) { if (jid == NULL) return NULL; JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_CHATROOM, jid); - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { bool bIsChat = isChatRoom(hContact); ptrT dbJid( getTStringA(hContact, bIsChat ? "ChatRoomID" : "jid")); @@ -513,7 +513,7 @@ void CJabberProto::SendVisibleInvisiblePresence(BOOL invisible) if (item == NULL) continue; - HANDLE hContact = HContactFromJID(item->jid); + HCONTACT hContact = HContactFromJID(item->jid); if (hContact == NULL) continue; @@ -727,7 +727,7 @@ int __stdcall JabberGetPacketID(HXML n) /////////////////////////////////////////////////////////////////////////////// // JabberGetClientJID - adds a resource postfix to a JID -TCHAR* CJabberProto::GetClientJID(HANDLE hContact, TCHAR *dest, size_t destLen) +TCHAR* CJabberProto::GetClientJID(HCONTACT hContact, TCHAR *dest, size_t destLen) { if (hContact == NULL) return NULL; @@ -932,7 +932,7 @@ static VOID CALLBACK sttRebuildInfoFrameApcProc(void* param) { if ((item=ppro->ListGetItemPtrFromIndex(i)) != NULL) { if (_tcschr(item->jid, '@') == NULL && _tcschr(item->jid, '/') == NULL && item->subscription!=SUB_NONE) { - HANDLE hContact = ppro->HContactFromJID(item->jid); + HCONTACT hContact = ppro->HContactFromJID(item->jid); if (hContact == NULL) continue; char name[128]; diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 4f8eb9c674..28d8b2a416 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -616,7 +616,7 @@ CPepMood::~CPepMood() void CPepMood::ProcessItems(const TCHAR *from, HXML itemsNode) { - HANDLE hContact = NULL, hSelfContact = NULL; + HCONTACT hContact = NULL, hSelfContact = NULL; if (!m_proto->IsMyOwnJID(from)) { hContact = m_proto->HContactFromJID(from); if (!hContact) return; @@ -659,19 +659,19 @@ void CPepMood::CreateData(HXML n) moodNode << XCHILD(_T("text"), m_text); } -void CPepMood::ResetExtraIcon(HANDLE hContact) +void CPepMood::ResetExtraIcon(HCONTACT hContact) { char *szMood = m_proto->ReadAdvStatusA(hContact, ADVSTATUS_MOOD, "id"); SetExtraIcon(hContact, szMood); mir_free(szMood); } -void CPepMood::SetExtraIcon(HANDLE hContact, char *szMood) +void CPepMood::SetExtraIcon(HCONTACT hContact, char *szMood) { ExtraIcon_SetIcon(hExtraMood, hContact, szMood == NULL ? NULL : g_MoodIcons.GetIcolibHandle(szMood)); } -void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText) +void CPepMood::SetMood(HCONTACT hContact, const TCHAR *szMood, const TCHAR *szText) { int mood = -1; if (szMood) { @@ -994,7 +994,7 @@ CPepActivity::~CPepActivity() void CPepActivity::ProcessItems(const TCHAR *from, HXML itemsNode) { - HANDLE hContact = NULL, hSelfContact = NULL; + HCONTACT hContact = NULL, hSelfContact = NULL; if (!m_proto->IsMyOwnJID(from)) { hContact = m_proto->HContactFromJID(from); if (!hContact) return; @@ -1051,19 +1051,19 @@ void CPepActivity::CreateData(HXML n) activityNode << XCHILD(_T("text"), m_text); } -void CPepActivity::ResetExtraIcon(HANDLE hContact) +void CPepActivity::ResetExtraIcon(HCONTACT hContact) { char *szActivity = m_proto->ReadAdvStatusA(hContact, ADVSTATUS_ACTIVITY, "id"); SetExtraIcon(hContact, szActivity); mir_free(szActivity); } -void CPepActivity::SetExtraIcon(HANDLE hContact, char *szActivity) +void CPepActivity::SetExtraIcon(HCONTACT hContact, char *szActivity) { ExtraIcon_SetIcon(hExtraActivity, hContact, szActivity == NULL ? NULL : g_ActivityIcons.GetIcolibHandle(szActivity)); } -void CPepActivity::SetActivity(HANDLE hContact, LPCTSTR szFirst, LPCTSTR szSecond, LPCTSTR szText) +void CPepActivity::SetActivity(HCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSecond, LPCTSTR szText) { int activity = -1; if (szFirst || szSecond) { @@ -1194,7 +1194,7 @@ BOOL CJabberProto::SendPepTune(TCHAR* szArtist, TCHAR* szLength, TCHAR* szSource return TRUE; } -void CJabberProto::SetContactTune(HANDLE hContact, LPCTSTR szArtist, LPCTSTR szLength, LPCTSTR szSource, LPCTSTR szTitle, LPCTSTR szTrack) +void CJabberProto::SetContactTune(HCONTACT hContact, LPCTSTR szArtist, LPCTSTR szLength, LPCTSTR szSource, LPCTSTR szTitle, LPCTSTR szTrack) { if (!szArtist && !szTitle) { delSetting(hContact, "ListeningTo"); @@ -1342,7 +1342,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM wParam, LPARAM lParam) if (pepMood == NULL) return 1; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; // fill status member if (pData->flags & CSSF_MASK_STATUS) @@ -1451,7 +1451,7 @@ void CJabberProto::RegisterAdvStatusSlot(const char *pszSlot) db_set_resident(szSetting, "text"); } -void CJabberProto::ResetAdvStatus(HANDLE hContact, const char *pszSlot) +void CJabberProto::ResetAdvStatus(HCONTACT hContact, const char *pszSlot) { char szSetting[128]; mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/id", m_szModuleName, pszSlot); @@ -1467,7 +1467,7 @@ void CJabberProto::ResetAdvStatus(HANDLE hContact, const char *pszSlot) db_unset(hContact, "AdvStatus", szSetting); } -void CJabberProto::WriteAdvStatus(HANDLE hContact, const char *pszSlot, const TCHAR *pszMode, const char *pszIcon, const TCHAR *pszTitle, const TCHAR *pszText) +void CJabberProto::WriteAdvStatus(HCONTACT hContact, const char *pszSlot, const TCHAR *pszMode, const char *pszIcon, const TCHAR *pszTitle, const TCHAR *pszText) { char szSetting[128]; @@ -1490,14 +1490,14 @@ void CJabberProto::WriteAdvStatus(HANDLE hContact, const char *pszSlot, const TC } } -char* CJabberProto::ReadAdvStatusA(HANDLE hContact, const char *pszSlot, const char *pszValue) +char* CJabberProto::ReadAdvStatusA(HCONTACT hContact, const char *pszSlot, const char *pszValue) { char szSetting[128]; mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", m_szModuleName, pszSlot, pszValue); return db_get_sa(hContact, "AdvStatus", szSetting); } -TCHAR* CJabberProto::ReadAdvStatusT(HANDLE hContact, const char *pszSlot, const char *pszValue) +TCHAR* CJabberProto::ReadAdvStatusT(HCONTACT hContact, const char *pszSlot, const char *pszValue) { char szSetting[128]; mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", m_szModuleName, pszSlot, pszValue); diff --git a/protocols/JabberG/src/jabber_xstatus.h b/protocols/JabberG/src/jabber_xstatus.h index 6caa4117b4..f0ebf5429a 100644 --- a/protocols/JabberG/src/jabber_xstatus.h +++ b/protocols/JabberG/src/jabber_xstatus.h @@ -45,7 +45,7 @@ public: virtual void InitGui() {} virtual void RebuildMenu() {} - virtual void ResetExtraIcon(HANDLE /*hContact*/) {} + virtual void ResetExtraIcon(HCONTACT) {} virtual bool LaunchSetGui() { return false; } protected: @@ -88,7 +88,7 @@ public: (*this)[i].RebuildMenu(); } - void ResetExtraIcon(HANDLE hContact) + void ResetExtraIcon(HCONTACT hContact) { for (int i=0; i < getCount(); i++) (*this)[i].ResetExtraIcon(hContact); @@ -152,7 +152,7 @@ public: CPepMood(CJabberProto *proto); ~CPepMood(); void ProcessItems(const TCHAR *from, HXML items); - void ResetExtraIcon(HANDLE hContact); + void ResetExtraIcon(HCONTACT hContact); public: TCHAR *m_text; @@ -161,9 +161,9 @@ public: protected: void CreateData(HXML); void ShowSetDialog(BYTE bQuiet); - void SetExtraIcon(HANDLE hContact, char *szMood); + void SetExtraIcon(HCONTACT hContact, char *szMood); - void SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText); + void SetMood(HCONTACT hContact, const TCHAR *szMood, const TCHAR *szText); }; class CPepActivity: public CPepGuiService @@ -173,7 +173,7 @@ public: CPepActivity(CJabberProto *proto); ~CPepActivity(); void ProcessItems(const TCHAR *from, HXML items); - void ResetExtraIcon(HANDLE hContact); + void ResetExtraIcon(HCONTACT hContact); protected: TCHAR *m_text; @@ -181,9 +181,9 @@ protected: void CreateData(HXML); void ShowSetDialog(BYTE bQuiet); - void SetExtraIcon(HANDLE hContact, char *szActivity); + void SetExtraIcon(HCONTACT hContact, char *szActivity); - void SetActivity(HANDLE hContact, LPCTSTR szFirst, LPCTSTR szSecond, LPCTSTR szText); + void SetActivity(HCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSecond, LPCTSTR szText); }; #endif // _JABBER_XSTATUS_H_ diff --git a/protocols/JabberG/src/ui_utils.cpp b/protocols/JabberG/src/ui_utils.cpp index 1005903432..d48e881578 100644 --- a/protocols/JabberG/src/ui_utils.cpp +++ b/protocols/JabberG/src/ui_utils.cpp @@ -601,7 +601,7 @@ BOOL CCtrlClc::OnNotify(int, NMHDR *pnmh) return FALSE; } -void CCtrlClc::AddContact(HANDLE hContact) +void CCtrlClc::AddContact(HCONTACT hContact) { SendMessage(m_hwnd, CLM_ADDCONTACT, (WPARAM)hContact, 0); } @@ -633,7 +633,7 @@ void CCtrlClc::Expand(HANDLE hItem, DWORD flags) { SendMessage(m_hwnd, CLM_EXPAND, (WPARAM)hItem, flags); } -HANDLE CCtrlClc::FindContact(HANDLE hContact) +HANDLE CCtrlClc::FindContact(HCONTACT hContact) { return (HANDLE)SendMessage(m_hwnd, CLM_FINDCONTACT, (WPARAM)hContact, 0); } diff --git a/protocols/JabberG/src/ui_utils.h b/protocols/JabberG/src/ui_utils.h index 50de45fa73..7e0b4792ad 100644 --- a/protocols/JabberG/src/ui_utils.h +++ b/protocols/JabberG/src/ui_utils.h @@ -458,7 +458,7 @@ class CCtrlClc: public CCtrlBase public: CCtrlClc(CDlgBase* dlg, int ctrlId); - void AddContact(HANDLE hContact); + void AddContact(HCONTACT hContact); void AddGroup(HANDLE hGroup); void AutoRebuild(); void DeleteItem(HANDLE hItem); @@ -466,7 +466,7 @@ public: void EndEditLabel(bool save); void EnsureVisible(HANDLE hItem, bool partialOk); void Expand(HANDLE hItem, DWORD flags); - HANDLE FindContact(HANDLE hContact); + HANDLE FindContact(HCONTACT hContact); HANDLE FindGroup(HANDLE hGroup); COLORREF GetBkColor(); bool GetCheck(HANDLE hItem); diff --git a/protocols/MRA/src/Mra.h b/protocols/MRA/src/Mra.h index ae925a8471..59063cbba3 100644 --- a/protocols/MRA/src/Mra.h +++ b/protocols/MRA/src/Mra.h @@ -146,16 +146,16 @@ __forceinline BinBuffer& operator >>(BinBuffer& buf, CMStringW &sVar) { buf.get ///////////////////////////////////////////////////////////////////////////// -bool DB_GetStaticStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPSTR lpszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize); -bool DB_GetStaticStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPWSTR lpszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize); +bool DB_GetStaticStringA(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPSTR lpszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize); +bool DB_GetStaticStringW(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPWSTR lpszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize); -bool DB_GetStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringA &Ret); -bool DB_GetStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringW &Ret); +bool DB_GetStringA(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringA &Ret); +bool DB_GetStringW(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringW &Ret); -bool DB_SetStringExA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringA &value); -bool DB_SetStringExW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringW &value); +bool DB_SetStringExA(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringA &value); +bool DB_SetStringExW(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringW &value); -bool DB_GetContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize); +bool DB_GetContactSettingBlob(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize); #include "MraConstans.h" #include "MraProto.h" @@ -227,16 +227,16 @@ CMStringW DecodeXML(const CMStringW &lptszMessage); CMStringW EncodeXML(const CMStringW &lptszMessage); bool IsHTTPSProxyUsed(HANDLE m_hNetlibUser); -bool IsContactMraProto(HANDLE hContact); +bool IsContactMraProto(HCONTACT hContact); bool IsEMailMR(const CMStringA& szEmail); bool GetEMailFromString(const CMStringA& szBuff, CMStringA& szEmail); bool IsPhone(LPSTR lpszString, size_t dwStringSize); -bool IsContactPhone(HANDLE hContact, LPSTR lpszPhone, size_t dwPhoneSize); +bool IsContactPhone(HCONTACT hContact, LPSTR lpszPhone, size_t dwPhoneSize); HANDLE MraHContactFromPhone(LPSTR lpszPhone, size_t dwPhoneSize, BOOL bAddIfNeeded, BOOL bTemporary, BOOL *pbAdded); void EnableControlsArray(HWND hWndDlg, WORD *pwControlsList, size_t dwControlsListCount, BOOL bEnabled); bool MraRequestXStatusDetails(DWORD dwXStatus); -bool MraSendReplyBlogStatus(HANDLE hContact); +bool MraSendReplyBlogStatus(HCONTACT hContact); DWORD GetYears(CONST PSYSTEMTIME pcstSystemTime); DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD dwFileNameLen, LPWSTR lpszRetFilePathName, DWORD dwRetFilePathLen, DWORD *pdwRetFilePathLen); DWORD MemFillRandom(LPVOID lpBuff, size_t dwBuffSize); diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index 3439efd420..9ae3ee41dc 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -30,7 +30,7 @@ struct MRA_AVATARS_QUEUE_ITEM : public FIFO_MT_ITEM { DWORD dwAvatarsQueueID; DWORD dwFlags; - HANDLE hContact; + HCONTACT hContact; }; #define FILETIME_SECOND ((DWORDLONG)10000000) @@ -137,7 +137,7 @@ void CMraProto::MraAvatarsQueueDestroy(HANDLE hAvatarsQueueHandle) mir_free(pmraaqAvatarsQueue); } -DWORD CMraProto::MraAvatarsQueueAdd(HANDLE hAvatarsQueueHandle, DWORD dwFlags, HANDLE hContact, DWORD *pdwAvatarsQueueID) +DWORD CMraProto::MraAvatarsQueueAdd(HANDLE hAvatarsQueueHandle, DWORD dwFlags, HCONTACT hContact, DWORD *pdwAvatarsQueueID) { if (!hAvatarsQueueHandle) return ERROR_INVALID_HANDLE; @@ -453,7 +453,7 @@ DWORD MraAvatarsHttpTransaction(HANDLE m_hConnection, DWORD dwRequestType, LPCST return 0; } -bool CMraProto::MraAvatarsGetContactTime(HANDLE hContact, LPSTR lpszValueName, SYSTEMTIME *pstTime) +bool CMraProto::MraAvatarsGetContactTime(HCONTACT hContact, LPSTR lpszValueName, SYSTEMTIME *pstTime) { if (lpszValueName && pstTime) { INTERNET_TIME itAvatarLastModifiedTimeLocal; @@ -468,7 +468,7 @@ bool CMraProto::MraAvatarsGetContactTime(HANDLE hContact, LPSTR lpszValueName, S } -void CMraProto::MraAvatarsSetContactTime(HANDLE hContact, LPSTR lpszValueName, SYSTEMTIME *pstTime) +void CMraProto::MraAvatarsSetContactTime(HCONTACT hContact, LPSTR lpszValueName, SYSTEMTIME *pstTime) { if (!lpszValueName) return; @@ -486,7 +486,7 @@ void CMraProto::MraAvatarsSetContactTime(HANDLE hContact, LPSTR lpszValueName, S delSetting(hContact, lpszValueName); } -DWORD CMraProto::MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, HANDLE hContact, DWORD dwFormat, CMStringW &res) +DWORD CMraProto::MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, HCONTACT hContact, DWORD dwFormat, CMStringW &res) { res.Empty(); if (hAvatarsQueueHandle == NULL) @@ -523,7 +523,7 @@ DWORD CMraProto::MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, HANDLE hConta return ERROR_INSUFFICIENT_BUFFER; } -DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFlags, HANDLE hContact, DWORD *pdwAvatarsQueueID, DWORD *pdwFormat, LPTSTR lpszPath) +DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFlags, HCONTACT hContact, DWORD *pdwAvatarsQueueID, DWORD *pdwFormat, LPTSTR lpszPath) { DWORD dwRetCode = GAIR_NOAVATAR; @@ -570,7 +570,7 @@ DWORD CMraProto::MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFl return dwRetCode; } -DWORD CMraProto::MraAvatarsQueueGetAvatarSimple(HANDLE hAvatarsQueueHandle, DWORD dwFlags, HANDLE hContact, DWORD dwSourceID) +DWORD CMraProto::MraAvatarsQueueGetAvatarSimple(HANDLE hAvatarsQueueHandle, DWORD dwFlags, HCONTACT hContact, DWORD dwSourceID) { DWORD dwRetCode = GAIR_NOAVATAR; @@ -662,7 +662,7 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara } -DWORD CMraProto::MraAvatarsDeleteContactAvatarFile(HANDLE hAvatarsQueueHandle, HANDLE hContact) +DWORD CMraProto::MraAvatarsDeleteContactAvatarFile(HANDLE hAvatarsQueueHandle, HCONTACT hContact) { if (hAvatarsQueueHandle == NULL) return ERROR_INVALID_HANDLE; diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index c6363029ad..7cf8571652 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -27,7 +27,7 @@ bool CMraProto::MraChatRegister() return TRUE; } -INT_PTR CMraProto::MraChatSessionNew(HANDLE hContact) +INT_PTR CMraProto::MraChatSessionNew(HCONTACT hContact) { if (bChatExists) if (hContact) { @@ -63,7 +63,7 @@ INT_PTR CMraProto::MraChatSessionNew(HANDLE hContact) return 1; } -void CMraProto::MraChatSessionDestroy(HANDLE hContact) +void CMraProto::MraChatSessionDestroy(HCONTACT hContact) { if (!bChatExists || hContact == NULL) return; @@ -79,7 +79,7 @@ void CMraProto::MraChatSessionDestroy(HANDLE hContact) CallServiceSync(MS_GC_EVENT, WINDOW_CLEARLOG, (LPARAM)&gce); } -INT_PTR CMraProto::MraChatSessionEventSendByHandle(HANDLE hContactChatSession, DWORD dwType, DWORD dwFlags, const CMStringA &lpszUID, LPCWSTR lpwszStatus, LPCWSTR lpwszMessage, DWORD_PTR dwItemData, DWORD dwTime) +INT_PTR CMraProto::MraChatSessionEventSendByHandle(HCONTACT hContactChatSession, DWORD dwType, DWORD dwFlags, const CMStringA &lpszUID, LPCWSTR lpwszStatus, LPCWSTR lpwszMessage, DWORD_PTR dwItemData, DWORD dwTime) { if (!bChatExists) return 1; @@ -122,7 +122,7 @@ INT_PTR CMraProto::MraChatSessionEventSendByHandle(HANDLE hContactChatSession, D return CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce); } -INT_PTR CMraProto::MraChatSessionInvite(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime) +INT_PTR CMraProto::MraChatSessionInvite(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime) { if (!hContactChatSession) return 1; @@ -132,7 +132,7 @@ INT_PTR CMraProto::MraChatSessionInvite(HANDLE hContactChatSession, const CMStri return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_ACTION, GCEF_ADDTOLOG, lpszEMailInMultiChat, NULL, wszBuff, 0, dwTime); } -INT_PTR CMraProto::MraChatSessionMembersAdd(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime) +INT_PTR CMraProto::MraChatSessionMembersAdd(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime) { if (!hContactChatSession) return 1; @@ -142,7 +142,7 @@ INT_PTR CMraProto::MraChatSessionMembersAdd(HANDLE hContactChatSession, const CM return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_ACTION, GCEF_ADDTOLOG, lpszEMailInMultiChat, NULL, wszBuff, 0, dwTime); } -INT_PTR CMraProto::MraChatSessionJoinUser(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime) +INT_PTR CMraProto::MraChatSessionJoinUser(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime) { if (hContactChatSession) return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_JOIN, GCEF_ADDTOLOG, lpszEMailInMultiChat, lpwszStatuses[MRA_CHAT_STATUS_VISITOR], _T(""), 0, dwTime); @@ -150,7 +150,7 @@ INT_PTR CMraProto::MraChatSessionJoinUser(HANDLE hContactChatSession, const CMSt return 1; } -INT_PTR CMraProto::MraChatSessionLeftUser(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime) +INT_PTR CMraProto::MraChatSessionLeftUser(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime) { if (hContactChatSession) return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_PART, GCEF_ADDTOLOG, lpszEMailInMultiChat, NULL, NULL, 0, dwTime); @@ -158,7 +158,7 @@ INT_PTR CMraProto::MraChatSessionLeftUser(HANDLE hContactChatSession, const CMSt return 1; } -INT_PTR CMraProto::MraChatSessionSetIviter(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat) +INT_PTR CMraProto::MraChatSessionSetIviter(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat) { if (hContactChatSession && !lpszEMailInMultiChat.IsEmpty()) return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_ADDSTATUS, 0, lpszEMailInMultiChat, lpwszStatuses[MRA_CHAT_STATUS_INVITER], NULL, 0, 0); @@ -166,7 +166,7 @@ INT_PTR CMraProto::MraChatSessionSetIviter(HANDLE hContactChatSession, const CMS return 1; } -INT_PTR CMraProto::MraChatSessionSetOwner(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat) +INT_PTR CMraProto::MraChatSessionSetOwner(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat) { if (hContactChatSession && !lpszEMailInMultiChat.IsEmpty()) return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_ADDSTATUS, 0, lpszEMailInMultiChat, lpwszStatuses[MRA_CHAT_STATUS_OWNER], NULL, 0, 0); @@ -175,7 +175,7 @@ INT_PTR CMraProto::MraChatSessionSetOwner(HANDLE hContactChatSession, const CMSt } -INT_PTR CMraProto::MraChatSessionMessageAdd(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat, const CMStringW &lpwszMessage, DWORD dwTime) +INT_PTR CMraProto::MraChatSessionMessageAdd(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, const CMStringW &lpwszMessage, DWORD dwTime) { if (hContactChatSession) return MraChatSessionEventSendByHandle(hContactChatSession, GC_EVENT_MESSAGE, GCEF_ADDTOLOG, lpszEMailInMultiChat, NULL, lpwszMessage, 0, dwTime); @@ -195,7 +195,7 @@ int CMraProto::MraChatGcEventHook(WPARAM, LPARAM lParam) if (gch->ptszText && lstrlen(gch->ptszText)) { size_t dwMessageSize = lstrlenW(gch->ptszText); CMStringA szEmail = gch->pDest->ptszID; - HANDLE hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL); + HCONTACT hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL); BOOL bSlowSend = getByte("SlowSend", MRA_DEFAULT_SLOW_SEND); DWORD dwFlags = 0; @@ -236,7 +236,7 @@ int CMraProto::MraChatGcEventHook(WPARAM, LPARAM lParam) void CMraProto::MraChatSendPrivateMessage(LPSTR lpszEMail) { BOOL bAdded; - HANDLE hContact = MraHContactFromEmail(lpszEMail, TRUE, TRUE, &bAdded); + HCONTACT hContact = MraHContactFromEmail(lpszEMail, TRUE, TRUE, &bAdded); if (bAdded) db_set_b(hContact, "CList", "Hidden", 1); diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index f4cb2918ee..3f4ec7213f 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -27,7 +27,7 @@ struct MRA_FILES_QUEUE_ITEM : public LIST_MT_ITEM CMraProto *ppro; DWORD dwIDRequest; DWORD dwFlags; - HANDLE hContact; + HCONTACT hContact; DWORDLONG dwFilesCount; DWORDLONG dwFilesTotalSize; MRA_FILES_QUEUE_FILE *pmfqfFiles; @@ -622,7 +622,7 @@ void MraFilesQueueConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, vo ///////////////////////////////////////////////////////////////////////////////////////// // Receive files -DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags, HANDLE hContact, DWORD dwIDRequest, const CMStringW &lpwszFiles, const CMStringA &szAddresses) +DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags, HCONTACT hContact, DWORD dwIDRequest, const CMStringW &lpwszFiles, const CMStringA &szAddresses) { if (!hFilesQueueHandle || !dwIDRequest) return ERROR_INVALID_HANDLE; @@ -919,7 +919,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) ///////////////////////////////////////////////////////////////////////////////////////// // Send files -DWORD CMraProto::MraFilesQueueAddSend(HANDLE hFilesQueueHandle, DWORD dwFlags, HANDLE hContact, LPWSTR *plpwszFiles, size_t dwFilesCount, DWORD *pdwIDRequest) +DWORD CMraProto::MraFilesQueueAddSend(HANDLE hFilesQueueHandle, DWORD dwFlags, HCONTACT hContact, LPWSTR *plpwszFiles, size_t dwFilesCount, DWORD *pdwIDRequest) { if (!hFilesQueueHandle) return ERROR_INVALID_HANDLE; diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp index d0f219200d..29da89b58f 100644 --- a/protocols/MRA/src/MraPopUp.cpp +++ b/protocols/MRA/src/MraPopUp.cpp @@ -198,7 +198,7 @@ LRESULT CALLBACK MraPopupDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM l return DefWindowProc(hWndDlg, msg, wParam, lParam); } -void CMraProto::MraPopupShowFromContactW(HANDLE hContact, DWORD dwType, DWORD dwFlags, LPCWSTR lpszMessage) +void CMraProto::MraPopupShowFromContactW(HCONTACT hContact, DWORD dwType, DWORD dwFlags, LPCWSTR lpszMessage) { WCHAR szTitle[MAX_CONTACTNAME]; CMStringW szNick, szEmail; @@ -212,7 +212,7 @@ void CMraProto::MraPopupShowFromContactW(HANDLE hContact, DWORD dwType, DWORD dw MraPopupShowW(hContact, dwType, dwFlags, szTitle, lpszMessage); } -void CMraProto::MraPopupShowW(HANDLE hContact, DWORD dwType, DWORD dwFlags, LPWSTR lpszTitle, LPCWSTR lpszMessage) +void CMraProto::MraPopupShowW(HCONTACT hContact, DWORD dwType, DWORD dwFlags, LPWSTR lpszTitle, LPCWSTR lpszMessage) { if (getByte("PopupsEnabled", MRA_DEFAULT_POPUPS_ENABLED)) if (GetBit(getDword("PopupsEventFilter", MRA_DEFAULT_POPUPS_EVENT_FILTER), dwType)) diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 2c9deba976..a8686a95ee 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -93,7 +93,7 @@ int CMraProto::OnModulesLoaded(WPARAM, LPARAM) HookProtoEvent(ME_CLIST_GROUPCHANGE, &CMraProto::OnGroupChanged); // âñåõ â offline // òê unsaved values ñîõðàíÿþòñÿ èõ íóæíî èíèöèàëèçèðîâàòü - for (HANDLE hContact = db_find_first(m_szModuleName); hContact != NULL; hContact = db_find_next(hContact, m_szModuleName)) + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact != NULL; hContact = db_find_next(hContact, m_szModuleName)) SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID|SCBIF_GROUP_ID|SCBIF_SERVER_FLAG|SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, 0, 0, 0); // unsaved values @@ -132,7 +132,7 @@ HANDLE CMraProto::AddToListByEmail(LPCTSTR plpsEMail, LPCTSTR plpsNick, LPCTSTR return NULL; BOOL bAdded; - HANDLE hContact = MraHContactFromEmail(plpsEMail, TRUE, TRUE, &bAdded); + HCONTACT hContact = MraHContactFromEmail(plpsEMail, TRUE, TRUE, &bAdded); if (hContact == NULL) return NULL; @@ -186,9 +186,9 @@ HANDLE CMraProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent) HANDLE CMraProto::ChangeInfo(int, void*) { return NULL; } int CMraProto::FileResume(HANDLE, int*, const TCHAR**) { return 1; } -int CMraProto::RecvAwayMsg(HANDLE, int, PROTORECVEVENT*) { return 1; } -int CMraProto::RecvUrl(HANDLE, PROTORECVEVENT*) { return 1; } -int CMraProto::SendUrl(HANDLE, int, const char*) { return 1; } +int CMraProto::RecvAwayMsg(HCONTACT, int, PROTORECVEVENT*) { return 1; } +int CMraProto::RecvUrl(HCONTACT, PROTORECVEVENT*) { return 1; } +int CMraProto::SendUrl(HCONTACT, int, const char*) { return 1; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -234,20 +234,20 @@ int CMraProto::AuthDeny(HANDLE hDBEvent, const TCHAR* szReason) return 0; } -int CMraProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) +int CMraProto::AuthRecv(HCONTACT hContact, PROTORECVEVENT* pre) { Proto_AuthRecv(m_szModuleName, pre); return 0; } -int CMraProto::AuthRequest(HANDLE hContact, const TCHAR *lptszMessage) +int CMraProto::AuthRequest(HCONTACT hContact, const TCHAR *lptszMessage) { return 1; } ///////////////////////////////////////////////////////////////////////////////////////// -HANDLE CMraProto::FileAllow(HANDLE hContact, HANDLE hTransfer, const TCHAR *szPath) +HANDLE CMraProto::FileAllow(HCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath) { if (szPath != NULL) if ( MraFilesQueueAccept(hFilesQueueHandle, (DWORD)hTransfer, szPath, lstrlen(szPath)) == NO_ERROR) @@ -256,7 +256,7 @@ HANDLE CMraProto::FileAllow(HANDLE hContact, HANDLE hTransfer, const TCHAR *szPa return NULL; } -int CMraProto::FileCancel(HANDLE hContact, HANDLE hTransfer) +int CMraProto::FileCancel(HCONTACT hContact, HANDLE hTransfer) { if (hContact && hTransfer) { MraFilesQueueCancel(hFilesQueueHandle, (DWORD)hTransfer, TRUE); @@ -266,14 +266,14 @@ int CMraProto::FileCancel(HANDLE hContact, HANDLE hTransfer) return 1; } -int CMraProto::FileDeny(HANDLE hContact, HANDLE hTransfer, const TCHAR*) +int CMraProto::FileDeny(HCONTACT hContact, HANDLE hTransfer, const TCHAR*) { return FileCancel(hContact, hTransfer); } ///////////////////////////////////////////////////////////////////////////////////////// -DWORD_PTR CMraProto::GetCaps(int type, HANDLE hContact) +DWORD_PTR CMraProto::GetCaps(int type, HCONTACT hContact) { switch ( type ) { case PFLAGNUM_1: @@ -310,7 +310,7 @@ DWORD_PTR CMraProto::GetCaps(int type, HANDLE hContact) } } -int CMraProto::GetInfo(HANDLE hContact, int infoType) +int CMraProto::GetInfo(HCONTACT hContact, int infoType) { return MraUpdateContactInfo(hContact) != 0; } @@ -347,7 +347,7 @@ HANDLE CMraProto::SearchByName(const TCHAR *pszNick, const TCHAR *pszFirstName, ///////////////////////////////////////////////////////////////////////////////////////// -int CMraProto::RecvContacts(HANDLE hContact, PROTORECVEVENT* pre) +int CMraProto::RecvContacts(HCONTACT hContact, PROTORECVEVENT* pre) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.szModule = m_szModuleName; @@ -360,19 +360,19 @@ int CMraProto::RecvContacts(HANDLE hContact, PROTORECVEVENT* pre) return 0; } -int CMraProto::RecvFile(HANDLE hContact, PROTORECVFILET *pre) +int CMraProto::RecvFile(HCONTACT hContact, PROTORECVFILET *pre) { return Proto_RecvFile(hContact, pre); } -int CMraProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) +int CMraProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT *pre) { return Proto_RecvMessage(hContact, pre); } ///////////////////////////////////////////////////////////////////////////////////////// -int CMraProto::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList) +int CMraProto::SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) { INT_PTR iRet = 0; @@ -398,7 +398,7 @@ int CMraProto::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* h return iRet; } -HANDLE CMraProto::SendFile(HANDLE hContact, const TCHAR* szDescription, TCHAR** ppszFiles) +HANDLE CMraProto::SendFile(HCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles) { INT_PTR iRet = 0; @@ -410,7 +410,7 @@ HANDLE CMraProto::SendFile(HANDLE hContact, const TCHAR* szDescription, TCHAR** return (HANDLE)iRet; } -int CMraProto::SendMsg(HANDLE hContact, int flags, const char *lpszMessage) +int CMraProto::SendMsg(HCONTACT hContact, int flags, const char *lpszMessage) { if (!m_bLoggedIn) { ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, NULL, (LPARAM)"You cannot send when you are offline."); @@ -450,7 +450,7 @@ int CMraProto::SendMsg(HANDLE hContact, int flags, const char *lpszMessage) ///////////////////////////////////////////////////////////////////////////////////////// -int CMraProto::SetApparentMode(HANDLE hContact, int mode) +int CMraProto::SetApparentMode(HCONTACT hContact, int mode) { if (!m_bLoggedIn || !hContact) return 1; @@ -509,7 +509,7 @@ int CMraProto::SetStatus(int iNewStatus) // âñåõ â offline, òîëüêî åñëè ìû áûâàëè ïîäêëþ÷åíû if (dwOldStatusMode > ID_STATUS_OFFLINE) - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID|SCBIF_GROUP_ID|SCBIF_SERVER_FLAG|SCBIF_STATUS), -1, -1, 0, 0, ID_STATUS_OFFLINE, 0, 0, 0); Netlib_CloseHandle(m_hConnection); @@ -547,7 +547,7 @@ int CMraProto::SetStatus(int iNewStatus) return 0; } -HANDLE CMraProto::GetAwayMsg(HANDLE hContact) +HANDLE CMraProto::GetAwayMsg(HCONTACT hContact) { if (!m_bLoggedIn || ! hContact) return 0; @@ -589,7 +589,7 @@ int CMraProto::SetAwayMsg(int m_iStatus, const TCHAR* msg) return 0; } -int CMraProto::UserIsTyping(HANDLE hContact, int type) +int CMraProto::UserIsTyping(HCONTACT hContact, int type) { if (!m_bLoggedIn || !hContact || type == PROTOTYPE_SELFTYPING_OFF) return 1; diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index c7082bd23f..d0a73ab7af 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -42,19 +42,19 @@ struct CMraProto : public PROTO virtual HANDLE __cdecl AddToListByEvent(int flags, int iContact, HANDLE hDbEvent); virtual int __cdecl Authorize(HANDLE hDBEvent); - virtual int __cdecl AuthDeny(HANDLE hContact, const TCHAR* szReason); - virtual int __cdecl AuthRecv(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl AuthRequest(HANDLE hContact, const TCHAR* szMessage); + virtual int __cdecl AuthDeny(HANDLE hDBEvent, const TCHAR* szReason); + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl AuthRequest(HCONTACT hContact, const TCHAR* szMessage); virtual HANDLE __cdecl ChangeInfo(int iInfoType, void* pInfoData); - virtual HANDLE __cdecl FileAllow(HANDLE hContact, HANDLE hTransfer, const TCHAR* szPath); - virtual int __cdecl FileCancel(HANDLE hContact, HANDLE hTransfer); - virtual int __cdecl FileDeny(HANDLE hContact, HANDLE hTransfer, const TCHAR* szReason); + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath); + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer); + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason); virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename); - virtual DWORD_PTR __cdecl GetCaps(int type, HANDLE hContact = NULL); - virtual int __cdecl GetInfo(HANDLE hContact, int infoType); + virtual DWORD_PTR __cdecl GetCaps(int type, HCONTACT hContact = NULL); + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType); virtual HANDLE __cdecl SearchBasic(const TCHAR* id); virtual HANDLE __cdecl SearchByEmail(const TCHAR* email); @@ -62,56 +62,56 @@ struct CMraProto : public PROTO virtual HWND __cdecl SearchAdvanced(HWND owner); virtual HWND __cdecl CreateExtendedSearchUI(HWND owner); - virtual int __cdecl RecvContacts(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl RecvFile(HANDLE hContact, PROTORECVFILET*); - virtual int __cdecl RecvMsg(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl RecvUrl(HANDLE hContact, PROTORECVEVENT*); + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvFile(HCONTACT hContact, PROTORECVFILET*); + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT*); - virtual int __cdecl SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList); - virtual HANDLE __cdecl SendFile(HANDLE hContact, const TCHAR* szDescription, TCHAR** ppszFiles); - virtual int __cdecl SendMsg(HANDLE hContact, int flags, const char* msg); - virtual int __cdecl SendUrl(HANDLE hContact, int flags, const char* url); + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList); + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles); + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg); + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url); - virtual int __cdecl SetApparentMode(HANDLE hContact, int mode); + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode); virtual int __cdecl SetStatus(int iNewStatus); - virtual HANDLE __cdecl GetAwayMsg(HANDLE hContact); - virtual int __cdecl RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT* evt); + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact); + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt); virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR* msg); - virtual int __cdecl UserIsTyping(HANDLE hContact, int type); + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type); virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam); void ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode); - void MraPopupShowW(HANDLE hContact, DWORD dwType, DWORD dwFlags, LPWSTR lpszTitle, LPCWSTR lpszMessage); - void MraPopupShowFromContactW(HANDLE hContact, DWORD dwType, DWORD dwFlags, LPCWSTR lpszMessage); + void MraPopupShowW(HCONTACT hContact, DWORD dwType, DWORD dwFlags, LPWSTR lpszTitle, LPCWSTR lpszMessage); + void MraPopupShowFromContactW(HCONTACT hContact, DWORD dwType, DWORD dwFlags, LPCWSTR lpszMessage); __forceinline void MraPopupShowFromAgentW(DWORD dwType, DWORD dwFlags, LPCWSTR lpszMessage) { MraPopupShowFromContactW(NULL, dwType, dwFlags, lpszMessage); } - __forceinline bool mraGetStaticStringA(HANDLE Contact, const char *ValueName, char *Ret, size_t RetBuffSize, size_t *pRetBuffSize) { + __forceinline bool mraGetStaticStringA(HCONTACT Contact, const char *ValueName, char *Ret, size_t RetBuffSize, size_t *pRetBuffSize) { return DB_GetStaticStringA(Contact, m_szModuleName, ValueName, Ret, RetBuffSize, pRetBuffSize); } - __forceinline bool mraGetStaticStringW(HANDLE Contact, const char *ValueName, WCHAR *Ret, size_t RetBuffSize, size_t *pRetBuffSize) { + __forceinline bool mraGetStaticStringW(HCONTACT Contact, const char *ValueName, WCHAR *Ret, size_t RetBuffSize, size_t *pRetBuffSize) { return DB_GetStaticStringW(Contact, m_szModuleName, ValueName, Ret, RetBuffSize, pRetBuffSize); } - __forceinline bool mraGetStringA(HANDLE Contact, const char *ValueName, CMStringA &Ret) { + __forceinline bool mraGetStringA(HCONTACT Contact, const char *ValueName, CMStringA &Ret) { return DB_GetStringA(Contact, m_szModuleName, ValueName, Ret); } - __forceinline bool mraGetStringW(HANDLE Contact, const char *ValueName, CMStringW &Ret) { + __forceinline bool mraGetStringW(HCONTACT Contact, const char *ValueName, CMStringW &Ret) { return DB_GetStringW(Contact, m_szModuleName, ValueName, Ret); } - __forceinline bool mraSetStringA(HANDLE Contact, const char *valueName, const CMStringA &parValue) { + __forceinline bool mraSetStringA(HCONTACT Contact, const char *valueName, const CMStringA &parValue) { return DB_SetStringExA(Contact, m_szModuleName, valueName, parValue); } - __forceinline bool mraSetStringW(HANDLE Contact, const char *valueName, const CMStringW &parValue) { + __forceinline bool mraSetStringW(HCONTACT Contact, const char *valueName, const CMStringW &parValue) { return DB_SetStringExW(Contact, m_szModuleName, valueName, parValue); } - __forceinline bool mraSetStringExA(HANDLE Contact, const char *valueName, const CMStringA &parValue) { + __forceinline bool mraSetStringExA(HCONTACT Contact, const char *valueName, const CMStringA &parValue) { return DB_SetStringExA(Contact, m_szModuleName, valueName, parValue); } - __forceinline bool mraSetStringExW(HANDLE Contact, const char *valueName, const CMStringW &parValue) { + __forceinline bool mraSetStringExW(HCONTACT Contact, const char *valueName, const CMStringW &parValue) { return DB_SetStringExW(Contact, m_szModuleName, valueName, parValue); } - __forceinline bool mraWriteContactSettingBlob(HANDLE hContact, const char *lpszValueName, LPVOID lpbValue, size_t dwValueSize) { + __forceinline bool mraWriteContactSettingBlob(HCONTACT hContact, const char *lpszValueName, LPVOID lpbValue, size_t dwValueSize) { return db_set_blob(hContact, m_szModuleName, lpszValueName, lpbValue, dwValueSize) != 0; } - __forceinline bool mraGetContactSettingBlob(HANDLE hContact, const char *lpszValueName, LPVOID lpbRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize) { + __forceinline bool mraGetContactSettingBlob(HCONTACT hContact, const char *lpszValueName, LPVOID lpbRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize) { return DB_GetContactSettingBlob(hContact, m_szModuleName, lpszValueName, lpbRet, dwRetBuffSize, pdwRetBuffSize); } // ====| Services |==================================================================== @@ -198,54 +198,54 @@ struct CMraProto : public PROTO HANDLE AddToListByEmail(LPCTSTR plpsEMail, LPCTSTR plpsNick, LPCTSTR plpsFirstName, LPCTSTR plpsLastName, DWORD dwFlags); - DWORD MraMessage(BOOL bAddToQueue, HANDLE hContact, DWORD dwAckType, DWORD dwFlags, const CMStringA &szEmail, const CMStringW &wszMessage, LPBYTE lpbMultiChatData, size_t dwMultiChatDataSize); + DWORD MraMessage(BOOL bAddToQueue, HCONTACT hContact, DWORD dwAckType, DWORD dwFlags, const CMStringA &szEmail, const CMStringW &wszMessage, LPBYTE lpbMultiChatData, size_t dwMultiChatDataSize); DWORD MraMessageAsk(DWORD dwMsgID, DWORD dwFlags, const CMStringA &szEmail, const CMStringW &wszMessage, const CMStringW &wszMessageRTF); DWORD MraMessageRecv(const CMStringA &szFrom, DWORD dwMsgID); - DWORD MraAddContact(HANDLE hContact, DWORD dwContactFlag, DWORD dwGroupID, const CMStringA &szEmail, const CMStringW &wszCustomName, const CMStringA *szPhones = 0, const CMStringW *wszAuthMessage = 0); - DWORD MraModifyContact(HANDLE hContact, DWORD *pdwID = 0, DWORD *pdwContactFlag = 0, DWORD *pdwGroupID = 0, const CMStringA *pszEmail = 0, const CMStringW *pwszCustomName = 0, const CMStringA *pszPhones = 0); + DWORD MraAddContact(HCONTACT hContact, DWORD dwContactFlag, DWORD dwGroupID, const CMStringA &szEmail, const CMStringW &wszCustomName, const CMStringA *szPhones = 0, const CMStringW *wszAuthMessage = 0); + DWORD MraModifyContact(HCONTACT hContact, DWORD *pdwID = 0, DWORD *pdwContactFlag = 0, DWORD *pdwGroupID = 0, const CMStringA *pszEmail = 0, const CMStringW *pwszCustomName = 0, const CMStringA *pszPhones = 0); DWORD MraOfflineMessageDel(DWORDLONG dwMsgUIDL); - DWORD MraMoveContactToGroup(HANDLE hContact, DWORD dwGroupID, LPCTSTR ptszGroup); + DWORD MraMoveContactToGroup(HCONTACT hContact, DWORD dwGroupID, LPCTSTR ptszGroup); DWORD MraAuthorize(const CMStringA &szEmail); DWORD MraChangeStatus(DWORD dwStatus, const CMStringA &szStatusUri, const CMStringW &wszStatusTitle, const CMStringW &wszStatusDesc, DWORD dwFutureFlags); DWORD MraFileTransfer(const CMStringA &szEmail, DWORD dwIdRequest, DWORD dwFilesTotalSize, const CMStringW &lpwszFiles, const CMStringA &szAddresses); DWORD MraFileTransferAck(DWORD dwStatus, const CMStringA &szEmail, DWORD dwIdRequest, LPBYTE lpbDescription, size_t dwDescriptionSize); - HANDLE MraWPRequestW(HANDLE hContact, DWORD dwAckType, DWORD dwRequestFlags, const CMStringA &szUser, const CMStringA &szDomain, const CMStringW &wszNickName, const CMStringW &wszFirstName, const CMStringW &wszLastName, DWORD dwSex, DWORD dwDate1, DWORD dwDate2, DWORD dwCityID, DWORD dwZodiak, DWORD dwBirthdayMonth, DWORD dwBirthdayDay, DWORD dwCountryID, DWORD dwOnline); - HANDLE MraWPRequestByEMail(HANDLE hContact, DWORD dwAckType, CMStringA &szEmail); + HANDLE MraWPRequestW(HCONTACT hContact, DWORD dwAckType, DWORD dwRequestFlags, const CMStringA &szUser, const CMStringA &szDomain, const CMStringW &wszNickName, const CMStringW &wszFirstName, const CMStringW &wszLastName, DWORD dwSex, DWORD dwDate1, DWORD dwDate2, DWORD dwCityID, DWORD dwZodiak, DWORD dwBirthdayMonth, DWORD dwBirthdayDay, DWORD dwCountryID, DWORD dwOnline); + HANDLE MraWPRequestByEMail(HCONTACT hContact, DWORD dwAckType, CMStringA &szEmail); DWORD MraGame(const CMStringA &szEmail, DWORD dwGameSessionID, DWORD dwGameMsg, DWORD dwGameMsgID, const CMStringA &lpszData); DWORD MraLogin2W(CMStringA &szLogin, CMStringA &szPassword, DWORD dwStatus, CMStringA &szStatusUri, CMStringW &wszStatusTitle, CMStringW &wszStatusDesc, DWORD dwFutureFlags, CMStringA &szUserAgentFormatted, CMStringA &szUserAgent); - DWORD MraSMSW(HANDLE hContact, const CMStringA &lpszPhone, const CMStringW &lpwszMessage); + DWORD MraSMSW(HCONTACT hContact, const CMStringA &lpszPhone, const CMStringW &lpwszMessage); DWORD MraProxy(const CMStringA &szEmail, DWORD dwIDRequest, DWORD dwDataType, const CMStringA &lpszData, const CMStringA &szAddresses, MRA_GUID mguidSessionID); DWORD MraProxyAck(DWORD dwStatus, const CMStringA &szEmail, DWORD dwIDRequest, DWORD dwDataType, const CMStringA &lpszData, const CMStringA &szAddresses, MRA_GUID mguidSessionID); DWORD MraChangeUserBlogStatus(DWORD dwFlags, const CMStringW &wszText, DWORDLONG dwBlogStatusID); DWORD MraSendPacket(HANDLE m_hConnection, DWORD dwCMDNum, DWORD dwType, LPVOID lpData, size_t dwDataSize); DWORD MraSendCMD(DWORD dwType, LPVOID lpData, size_t dwDataSize); - DWORD MraSendQueueCMD(HANDLE hSendQueueHandle, DWORD dwFlags, HANDLE hContact, DWORD dwAckType, LPBYTE lpbDataQueue, size_t dwDataQueueSize, DWORD dwType, LPVOID lpData, size_t dwDataSize); + DWORD MraSendQueueCMD(HANDLE hSendQueueHandle, DWORD dwFlags, HCONTACT hContact, DWORD dwAckType, LPBYTE lpbDataQueue, size_t dwDataQueueSize, DWORD dwType, LPVOID lpData, size_t dwDataSize); DWORD MraSendNewStatus(DWORD dwStatusMir, DWORD dwXStatusMir, const CMStringW &wszStatusTitle, const CMStringW &wszStatusDesc); - void MraAddrListStoreToContact(HANDLE hContact, MRA_ADDR_LIST *pmalAddrList); + void MraAddrListStoreToContact(HCONTACT hContact, MRA_ADDR_LIST *pmalAddrList); - DWORD GetContactFlags(HANDLE hContact); - DWORD SetContactFlags(HANDLE hContact, DWORD dwContactFlag); - DWORD GetContactBasicInfoW(HANDLE hContact, DWORD *pdwID, DWORD *pdwGroupID, DWORD *pdwContactFlag, DWORD *pdwContactSeverFlags, DWORD *pdwStatus, CMStringA *szEmail, CMStringW *wszNick, CMStringA *szPhones); - DWORD SetContactBasicInfoW(HANDLE hContact, DWORD dwSetInfoFlags, DWORD dwFlags, DWORD dwID, DWORD dwGroupID, DWORD dwContactFlag, DWORD dwContactSeverFlags, DWORD dwStatus, const CMStringA *szEmail, const CMStringW *wszNick, const CMStringA *szPhones); + DWORD GetContactFlags(HCONTACT hContact); + DWORD SetContactFlags(HCONTACT hContact, DWORD dwContactFlag); + DWORD GetContactBasicInfoW(HCONTACT hContact, DWORD *pdwID, DWORD *pdwGroupID, DWORD *pdwContactFlag, DWORD *pdwContactSeverFlags, DWORD *pdwStatus, CMStringA *szEmail, CMStringW *wszNick, CMStringA *szPhones); + DWORD SetContactBasicInfoW(HCONTACT hContact, DWORD dwSetInfoFlags, DWORD dwFlags, DWORD dwID, DWORD dwGroupID, DWORD dwContactFlag, DWORD dwContactSeverFlags, DWORD dwStatus, const CMStringA *szEmail, const CMStringW *wszNick, const CMStringA *szPhones); - DWORD GetContactEMailCount(HANDLE hContact, BOOL bMRAOnly); - bool GetContactFirstEMail(HANDLE hContact, BOOL bMRAOnly, CMStringA &szRetBuff); + DWORD GetContactEMailCount(HCONTACT hContact, BOOL bMRAOnly); + bool GetContactFirstEMail(HCONTACT hContact, BOOL bMRAOnly, CMStringA &szRetBuff); - bool IsContactMra(HANDLE hContact); + bool IsContactMra(HCONTACT hContact); bool IsEMailMy(const CMStringA &szEmail); bool IsEMailChatAgent(const CMStringA &szEmail); - bool IsContactChatAgent(HANDLE hContact); + bool IsContactChatAgent(HCONTACT hContact); - HANDLE MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNeeded, BOOL bTemporary, BOOL *pbAdded); - bool MraUpdateContactInfo(HANDLE hContact); + HCONTACT MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNeeded, BOOL bTemporary, BOOL *pbAdded); + bool MraUpdateContactInfo(HCONTACT hContact); DWORD MraSetXStatusInternal(DWORD dwXStatus); - DWORD MraGetContactStatus(HANDLE hContact); - DWORD MraSetContactStatus(HANDLE hContact, DWORD dwNewStatus); - DWORD MraContactCapabilitiesGet(HANDLE hContact); - void MraContactCapabilitiesSet(HANDLE hContact, DWORD dwFutureFlags); + DWORD MraGetContactStatus(HCONTACT hContact); + DWORD MraSetContactStatus(HCONTACT hContact, DWORD dwNewStatus); + DWORD MraContactCapabilitiesGet(HCONTACT hContact); + void MraContactCapabilitiesSet(HCONTACT hContact, DWORD dwFutureFlags); void MraUpdateEmailStatus(const CMStringA &szFrom, const CMStringA &szSubject, DWORD dwDate, DWORD dwUIDL); DWORD MraConvertToRTFW(const CMStringW &wszMessage, CMStringA &szMessageRTF); @@ -278,19 +278,19 @@ struct CMraProto : public PROTO DWORD MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA &plpsFrom, CMStringA &plpsText, CMStringA &plpsRFTText, CMStringA &plpsMultiChatData); - void SetExtraIcons(HANDLE hContact); + void SetExtraIcons(HCONTACT hContact); void InitMenus(void); HGENMENU CListCreateMenu(LONG lPosition, LONG lPopupPosition, BOOL bIsStatus, const IconItem *pgdiItems, size_t dwCount, HGENMENU *hResult); - DWORD ProtoBroadcastAckAsync(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam); - CMStringA CreateBlobFromContact(HANDLE hContact, const CMStringW &wszRequestReason); + DWORD ProtoBroadcastAckAsync(HCONTACT hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam); + CMStringA CreateBlobFromContact(HCONTACT hContact, const CMStringW &wszRequestReason); bool GetPassDB(CMStringA& pass); bool MraRequestXStatusDetails(DWORD dwXStatus); - bool MraSendReplyBlogStatus(HANDLE hContact); - DWORD MraSelectEMailDlgShow(HANDLE hContact, DWORD dwType); + bool MraSendReplyBlogStatus(HCONTACT hContact); + DWORD MraSelectEMailDlgShow(HCONTACT hContact, DWORD dwType); DWORD MraMrimProxyConnect(HANDLE hMraMrimProxyData, HANDLE *phConnection); @@ -300,8 +300,8 @@ struct CMraProto : public PROTO void MraMPopSessionQueueFlush(HANDLE hMPopSessionQueue); size_t MraFilesQueueGetLocalAddressesList(LPSTR lpszBuff, size_t dwBuffSize, DWORD dwPort); - DWORD MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags, HANDLE hContact, DWORD dwIDRequest, const CMStringW &wszFiles, const CMStringA &szAddresses); - DWORD MraFilesQueueAddSend(HANDLE hFilesQueueHandle, DWORD dwFlags, HANDLE hContact, LPWSTR *plpwszFiles, size_t dwFilesCount, DWORD *pdwIDRequest); + DWORD MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags, HCONTACT hContact, DWORD dwIDRequest, const CMStringW &wszFiles, const CMStringA &szAddresses); + DWORD MraFilesQueueAddSend(HANDLE hFilesQueueHandle, DWORD dwFlags, HCONTACT hContact, LPWSTR *plpwszFiles, size_t dwFilesCount, DWORD *pdwIDRequest); DWORD MraFilesQueueCancel(HANDLE hFilesQueueHandle, DWORD dwIDRequest, BOOL bSendDecline); DWORD MraFilesQueueStartMrimProxy(HANDLE hFilesQueueHandle, DWORD dwIDRequest); DWORD MraFilesQueueSendMirror(HANDLE hFilesQueueHandle, DWORD dwIDRequest, const CMStringA &szAddresses); @@ -316,30 +316,30 @@ struct CMraProto : public PROTO bool bChatExists; void MraChatDllError(); bool MraChatRegister(); - INT_PTR MraChatSessionNew(HANDLE hContactChatSession); - void MraChatSessionDestroy(HANDLE hContactChatSession); + INT_PTR MraChatSessionNew(HCONTACT hContactChatSession); + void MraChatSessionDestroy(HCONTACT hContactChatSession); void MraChatSendPrivateMessage(LPSTR lpwszEMail); - INT_PTR MraChatSessionEventSendByHandle(HANDLE hContactChatSession, DWORD dwType, DWORD dwFlags, const CMStringA &szUID, LPCWSTR lpwszStatus, LPCWSTR lpwszMessage, DWORD_PTR dwItemData, DWORD dwTime); - INT_PTR MraChatSessionInvite(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime); - INT_PTR MraChatSessionMembersAdd(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime); - INT_PTR MraChatSessionJoinUser(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime); - INT_PTR MraChatSessionLeftUser(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime); - INT_PTR MraChatSessionSetIviter(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat); - INT_PTR MraChatSessionSetOwner(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat); - INT_PTR MraChatSessionMessageAdd(HANDLE hContactChatSession, const CMStringA &lpszEMailInMultiChat, const CMStringW &wszMessage, DWORD dwTime); + INT_PTR MraChatSessionEventSendByHandle(HCONTACT hContactChatSession, DWORD dwType, DWORD dwFlags, const CMStringA &szUID, LPCWSTR lpwszStatus, LPCWSTR lpwszMessage, DWORD_PTR dwItemData, DWORD dwTime); + INT_PTR MraChatSessionInvite(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime); + INT_PTR MraChatSessionMembersAdd(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime); + INT_PTR MraChatSessionJoinUser(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime); + INT_PTR MraChatSessionLeftUser(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, DWORD dwTime); + INT_PTR MraChatSessionSetIviter(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat); + INT_PTR MraChatSessionSetOwner(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat); + INT_PTR MraChatSessionMessageAdd(HCONTACT hContactChatSession, const CMStringA &lpszEMailInMultiChat, const CMStringW &wszMessage, DWORD dwTime); DWORD MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle); void MraAvatarsQueueClear(HANDLE hAvatarsQueueHandle); void MraAvatarsQueueSuspend(HANDLE hAvatarsQueueHandle); void MraAvatarsQueueDestroy(HANDLE hAvatarsQueueHandle); - DWORD MraAvatarsQueueAdd(HANDLE hAvatarsQueueHandle, DWORD dwFlags, HANDLE hContact, DWORD *pdwAvatarsQueueID); - bool MraAvatarsGetContactTime (HANDLE hContact, LPSTR lpszValueName, SYSTEMTIME *pstTime); - void MraAvatarsSetContactTime (HANDLE hContact, LPSTR lpszValueName, SYSTEMTIME *pstTime); - DWORD MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, HANDLE hContact, DWORD dwFormat, CMStringW &res); - DWORD MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFlags, HANDLE hContact, DWORD *pdwAvatarsQueueID, DWORD *pdwFormat, LPTSTR lpszPath); - DWORD MraAvatarsQueueGetAvatarSimple(HANDLE hAvatarsQueueHandle, DWORD dwFlags, HANDLE hContact, DWORD dwSourceID); - DWORD MraAvatarsDeleteContactAvatarFile(HANDLE hAvatarsQueueHandle, HANDLE hContact); + DWORD MraAvatarsQueueAdd(HANDLE hAvatarsQueueHandle, DWORD dwFlags, HCONTACT hContact, DWORD *pdwAvatarsQueueID); + bool MraAvatarsGetContactTime (HCONTACT hContact, LPSTR lpszValueName, SYSTEMTIME *pstTime); + void MraAvatarsSetContactTime (HCONTACT hContact, LPSTR lpszValueName, SYSTEMTIME *pstTime); + DWORD MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, HCONTACT hContact, DWORD dwFormat, CMStringW &res); + DWORD MraAvatarsQueueGetAvatar(HANDLE hAvatarsQueueHandle, DWORD dwFlags, HCONTACT hContact, DWORD *pdwAvatarsQueueID, DWORD *pdwFormat, LPTSTR lpszPath); + DWORD MraAvatarsQueueGetAvatarSimple(HANDLE hAvatarsQueueHandle, DWORD dwFlags, HCONTACT hContact, DWORD dwSourceID); + DWORD MraAvatarsDeleteContactAvatarFile(HANDLE hAvatarsQueueHandle, HCONTACT hContact); void __cdecl MraAvatarsThreadProc(LPVOID lpParameter); }; diff --git a/protocols/MRA/src/MraSelectEMail.cpp b/protocols/MRA/src/MraSelectEMail.cpp index 6081d902c0..fc889d5058 100644 --- a/protocols/MRA/src/MraSelectEMail.cpp +++ b/protocols/MRA/src/MraSelectEMail.cpp @@ -4,11 +4,11 @@ struct MraSelectEMailDlgData { CMraProto *ppro; - HANDLE hContact; + HCONTACT hContact; DWORD dwType; }; -void AddContactEMailToListParam(HANDLE hContact, BOOL bMRAOnly, LPSTR lpszModule, LPSTR lpszValueName, HWND hWndList) +void AddContactEMailToListParam(HCONTACT hContact, BOOL bMRAOnly, LPSTR lpszModule, LPSTR lpszValueName, HWND hWndList) { CMStringA szEmail; if (DB_GetStringA(hContact, lpszModule, lpszValueName, szEmail)) { @@ -139,7 +139,7 @@ INT_PTR CALLBACK MraSelectEMailDlgProc(HWND hWndDlg, UINT message, WPARAM wParam return FALSE; } -DWORD CMraProto::MraSelectEMailDlgShow(HANDLE hContact, DWORD dwType) +DWORD CMraProto::MraSelectEMailDlgShow(HCONTACT hContact, DWORD dwType) { MraSelectEMailDlgData *dat = (MraSelectEMailDlgData*)mir_calloc(sizeof(MraSelectEMailDlgData)); if (dat) { diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp index 74ab849a29..e673e2e4b8 100644 --- a/protocols/MRA/src/MraSendCommand.cpp +++ b/protocols/MRA/src/MraSendCommand.cpp @@ -71,7 +71,7 @@ public: ///////////////////////////////////////////////////////////////////////////////////////// -DWORD CMraProto::MraMessage(BOOL bAddToQueue, HANDLE hContact, DWORD dwAckType, DWORD dwFlags, const CMStringA &szEmail, const CMStringW &lpwszMessage, LPBYTE lpbMultiChatData, size_t dwMultiChatDataSize) +DWORD CMraProto::MraMessage(BOOL bAddToQueue, HCONTACT hContact, DWORD dwAckType, DWORD dwFlags, const CMStringA &szEmail, const CMStringW &lpwszMessage, LPBYTE lpbMultiChatData, size_t dwMultiChatDataSize) { debugLogA("Sending message: flags %08x, to '%S', message '%S'\n", dwFlags, szEmail, lpwszMessage); @@ -184,7 +184,7 @@ DWORD CMraProto::MraMessageRecv(const CMStringA &szFrom, DWORD dwMsgID) } // Adds new contact -DWORD CMraProto::MraAddContact(HANDLE hContact, DWORD dwContactFlag, DWORD dwGroupID, const CMStringA &szEmail, const CMStringW &wszCustomName, const CMStringA *szPhones, const CMString* wszAuthMessage) +DWORD CMraProto::MraAddContact(HCONTACT hContact, DWORD dwContactFlag, DWORD dwGroupID, const CMStringA &szEmail, const CMStringW &wszCustomName, const CMStringA *szPhones, const CMString* wszAuthMessage) { if (szEmail.GetLength() <= 4 && !(dwContactFlag & CONTACT_FLAG_GROUP)) return 0; @@ -213,7 +213,7 @@ DWORD CMraProto::MraAddContact(HANDLE hContact, DWORD dwContactFlag, DWORD dwGro } // change contact -DWORD CMraProto::MraModifyContact(HANDLE hContact, DWORD *pdwID, DWORD *pdwContactFlag, DWORD *pdwGroupID, const CMStringA *pszEmail, const CMStringW *pwszCustomName, const CMStringA *pszPhones) +DWORD CMraProto::MraModifyContact(HCONTACT hContact, DWORD *pdwID, DWORD *pdwContactFlag, DWORD *pdwGroupID, const CMStringA *pszEmail, const CMStringW *pwszCustomName, const CMStringA *pszPhones) { CMStringA szEmail, szPhones; CMStringW wszNick, wszCustomName; @@ -312,7 +312,7 @@ DWORD CMraProto::MraFileTransferAck(DWORD dwStatus, const CMStringA &szEmail, DW } // Ïîèñê êîíòàêòà -HANDLE CMraProto::MraWPRequestW(HANDLE hContact, DWORD dwAckType, DWORD dwRequestFlags, const CMStringA &szUser, const CMStringA &szDomain, const CMStringW &wszNickName, const CMStringW &wszFirstName, const CMStringW &wszLastName, DWORD dwSex, DWORD dwDate1, DWORD dwDate2, DWORD dwCityID, DWORD dwZodiak, DWORD dwBirthdayMonth, DWORD dwBirthdayDay, DWORD dwCountryID, DWORD dwOnline) +HANDLE CMraProto::MraWPRequestW(HCONTACT hContact, DWORD dwAckType, DWORD dwRequestFlags, const CMStringA &szUser, const CMStringA &szDomain, const CMStringW &wszNickName, const CMStringW &wszFirstName, const CMStringW &wszLastName, DWORD dwSex, DWORD dwDate1, DWORD dwDate2, DWORD dwCityID, DWORD dwZodiak, DWORD dwBirthdayMonth, DWORD dwBirthdayDay, DWORD dwCountryID, DWORD dwOnline) { OutBuffer buf; CMStringA tmp; @@ -381,7 +381,7 @@ HANDLE CMraProto::MraWPRequestW(HANDLE hContact, DWORD dwAckType, DWORD dwReques } // Ïîèñê êîíòàêòà ïî EMail -HANDLE CMraProto::MraWPRequestByEMail(HANDLE hContact, DWORD dwAckType, CMStringA &szEmail) +HANDLE CMraProto::MraWPRequestByEMail(HCONTACT hContact, DWORD dwAckType, CMStringA &szEmail) { if (szEmail.GetLength() <= 4) return 0; @@ -439,7 +439,7 @@ DWORD CMraProto::MraLogin2W(CMStringA &szLogin, CMStringA &szPassword, DWORD dwS } // Îòïðàâêà SMS -DWORD CMraProto::MraSMSW(HANDLE hContact, const CMStringA &lpszPhone, const CMStringW &lpwszMessage) +DWORD CMraProto::MraSMSW(HCONTACT hContact, const CMStringA &lpszPhone, const CMStringW &lpwszMessage) { CMStringA szPhoneLocal = "+" + CopyNumber(lpszPhone); @@ -523,7 +523,7 @@ DWORD CMraProto::MraSendCMD(DWORD dwType, LPVOID lpData, size_t dwDataSize) } -DWORD CMraProto::MraSendQueueCMD(HANDLE hSendQueueHandle, DWORD dwFlags, HANDLE hContact, DWORD dwAckType, LPBYTE lpbDataQueue, size_t dwDataQueueSize, DWORD dwType, LPVOID lpData, size_t dwDataSize) +DWORD CMraProto::MraSendQueueCMD(HANDLE hSendQueueHandle, DWORD dwFlags, HCONTACT hContact, DWORD dwAckType, LPBYTE lpbDataQueue, size_t dwDataQueueSize, DWORD dwType, LPVOID lpData, size_t dwDataSize) { DWORD dwRet = InterlockedIncrement((LONG volatile*)&dwCMDNum); if ( !MraSendQueueAdd(hSendQueueHandle, dwRet, dwFlags, hContact, dwAckType, lpbDataQueue, dwDataQueueSize)) { diff --git a/protocols/MRA/src/MraSendQueue.cpp b/protocols/MRA/src/MraSendQueue.cpp index 496468c646..08146fe8b2 100644 --- a/protocols/MRA/src/MraSendQueue.cpp +++ b/protocols/MRA/src/MraSendQueue.cpp @@ -14,7 +14,7 @@ struct MRA_SEND_QUEUE_ITEM : public LIST_MT_ITEM // external DWORD dwCMDNum; DWORD dwFlags; - HANDLE hContact; + HCONTACT hContact; DWORD dwAckType; LPBYTE lpbData; size_t dwDataSize; @@ -59,7 +59,7 @@ void MraSendQueueDestroy(HANDLE hSendQueueHandle) } -DWORD MraSendQueueAdd(HANDLE hSendQueueHandle, DWORD dwCMDNum, DWORD dwFlags, HANDLE hContact, DWORD dwAckType, LPBYTE lpbData, size_t dwDataSize) +DWORD MraSendQueueAdd(HANDLE hSendQueueHandle, DWORD dwCMDNum, DWORD dwFlags, HCONTACT hContact, DWORD dwAckType, LPBYTE lpbData, size_t dwDataSize) { if (!hSendQueueHandle || !dwCMDNum) return ERROR_INVALID_HANDLE; @@ -108,7 +108,7 @@ DWORD MraSendQueueFree(HANDLE hSendQueueHandle, DWORD dwCMDNum) return ERROR_NOT_FOUND; } -DWORD MraSendQueueFind(HANDLE hSendQueueHandle, DWORD dwCMDNum, DWORD *pdwFlags, HANDLE *phContact, DWORD *pdwAckType, LPBYTE *plpbData, size_t *pdwDataSize) +DWORD MraSendQueueFind(HANDLE hSendQueueHandle, DWORD dwCMDNum, DWORD *pdwFlags, HCONTACT *phContact, DWORD *pdwAckType, LPBYTE *plpbData, size_t *pdwDataSize) { if (!hSendQueueHandle) return ERROR_INVALID_HANDLE; @@ -135,7 +135,7 @@ DWORD MraSendQueueFind(HANDLE hSendQueueHandle, DWORD dwCMDNum, DWORD *pdwFlags, return ERROR_NOT_FOUND; } -DWORD MraSendQueueFindOlderThan(HANDLE hSendQueueHandle, DWORD dwTime, DWORD *pdwCMDNum, DWORD *pdwFlags, HANDLE *phContact, DWORD *pdwAckType, LPBYTE *plpbData, size_t *pdwDataSize) +DWORD MraSendQueueFindOlderThan(HANDLE hSendQueueHandle, DWORD dwTime, DWORD *pdwCMDNum, DWORD *pdwFlags, HCONTACT *phContact, DWORD *pdwAckType, LPBYTE *plpbData, size_t *pdwDataSize) { if (!hSendQueueHandle) return ERROR_INVALID_HANDLE; diff --git a/protocols/MRA/src/MraSendQueue.h b/protocols/MRA/src/MraSendQueue.h index 1115c4f815..e75038cfd9 100644 --- a/protocols/MRA/src/MraSendQueue.h +++ b/protocols/MRA/src/MraSendQueue.h @@ -7,10 +7,10 @@ DWORD MraSendQueueInitialize(DWORD dwSendTimeOutInterval, HANDLE *phSendQueueHandle); void MraSendQueueDestroy(HANDLE hSendQueueHandle); -DWORD MraSendQueueAdd(HANDLE hSendQueueHandle, DWORD dwCMDNum, DWORD dwFlags, HANDLE hContact, DWORD dwAckType, LPBYTE lpbData, size_t dwDataSize); +DWORD MraSendQueueAdd(HANDLE hSendQueueHandle, DWORD dwCMDNum, DWORD dwFlags, HCONTACT hContact, DWORD dwAckType, LPBYTE lpbData, size_t dwDataSize); DWORD MraSendQueueFree(HANDLE hSendQueueHandle, DWORD dwCMDNum); -DWORD MraSendQueueFind(HANDLE hSendQueueHandle, DWORD dwCMDNum, DWORD *pdwFlags, HANDLE *phContact, DWORD *pdwAckType, LPBYTE *plpbData, size_t *pdwDataSize); -DWORD MraSendQueueFindOlderThan(HANDLE hSendQueueHandle, DWORD dwTime, DWORD *pdwCMDNum, DWORD *pdwFlags, HANDLE *phContact, DWORD *pdwAckType, LPBYTE *plpbData, size_t *pdwDataSize); +DWORD MraSendQueueFind(HANDLE hSendQueueHandle, DWORD dwCMDNum, DWORD *pdwFlags, HCONTACT *phContact, DWORD *pdwAckType, LPBYTE *plpbData, size_t *pdwDataSize); +DWORD MraSendQueueFindOlderThan(HANDLE hSendQueueHandle, DWORD dwTime, DWORD *pdwCMDNum, DWORD *pdwFlags, HCONTACT *phContact, DWORD *pdwAckType, LPBYTE *plpbData, size_t *pdwDataSize); #endif // !defined(AFX_MRA_SENDQUEUE_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_) diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 2ba7335d8a..5864886814 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -13,7 +13,7 @@ struct SetXStatusData struct SetBlogStatusData { CMraProto *ppro; - HANDLE hContact; + HCONTACT hContact; }; #define RECURSION_DATA_STACK_ITEMS_MIN 128 @@ -157,7 +157,7 @@ CMStringA MraAddrListGetToBuff(MRA_ADDR_LIST *pmalAddrList) return res; } -void CMraProto::MraAddrListStoreToContact(HANDLE hContact, MRA_ADDR_LIST *pmalAddrList) +void CMraProto::MraAddrListStoreToContact(HCONTACT hContact, MRA_ADDR_LIST *pmalAddrList) { if (!hContact || !pmalAddrList) return; @@ -181,7 +181,7 @@ void MraAddrListFree(MRA_ADDR_LIST *pmalAddrList) } } -bool DB_GetStaticStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPSTR lpszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize) +bool DB_GetStaticStringA(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPSTR lpszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize) { bool bRet = false; size_t dwReadedStringLen, dwRetBuffSizeLocal; @@ -209,7 +209,7 @@ bool DB_GetStaticStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueNam } // sizes in wchars -bool DB_GetStaticStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPWSTR lpwszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize) +bool DB_GetStaticStringW(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPWSTR lpwszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize) { bool bRet = false; size_t dwReadedStringLen; @@ -235,7 +235,7 @@ bool DB_GetStaticStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueNam return bRet; } -bool DB_GetStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringA& res) +bool DB_GetStringA(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringA& res) { char *szRes = db_get_sa(hContact, lpszModule, lpszValueName); if (szRes) { @@ -249,7 +249,7 @@ bool DB_GetStringA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMS } -bool DB_GetStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringW& res) +bool DB_GetStringW(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringW& res) { WCHAR *szRes = db_get_wsa(hContact, lpszModule, lpszValueName); if (szRes) { @@ -262,7 +262,7 @@ bool DB_GetStringW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMS return false; } -bool DB_SetStringExA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringA &szValue) +bool DB_SetStringExA(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringA &szValue) { if (szValue.IsEmpty()) { db_unset(hContact, lpszModule, lpszValueName); @@ -272,7 +272,7 @@ bool DB_SetStringExA(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, c return db_set_s(hContact, lpszModule, lpszValueName, szValue) != 0; } -bool DB_SetStringExW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringW &szValue) +bool DB_SetStringExW(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringW &szValue) { if (szValue.IsEmpty()) { db_unset(hContact, lpszModule, lpszValueName); @@ -282,7 +282,7 @@ bool DB_SetStringExW(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, c return db_set_ws(hContact, lpszModule, lpszValueName, szValue) != 0; } -bool DB_GetContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize) +bool DB_GetContactSettingBlob(HCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize) { bool bRet = false; DBVARIANT dbv; @@ -303,7 +303,7 @@ bool DB_GetContactSettingBlob(HANDLE hContact, LPCSTR lpszModule, LPCSTR lpszVal return bRet; } -DWORD CMraProto::MraMoveContactToGroup(HANDLE hContact, DWORD dwGroupID, LPCTSTR ptszName) +DWORD CMraProto::MraMoveContactToGroup(HCONTACT hContact, DWORD dwGroupID, LPCTSTR ptszName) { MraGroupItem *p = NULL; @@ -335,7 +335,7 @@ DWORD CMraProto::MraMoveContactToGroup(HANDLE hContact, DWORD dwGroupID, LPCTSTR return p->m_id; } -DWORD CMraProto::GetContactFlags(HANDLE hContact) +DWORD CMraProto::GetContactFlags(HCONTACT hContact) { DWORD dwRet = 0; @@ -366,7 +366,7 @@ DWORD CMraProto::GetContactFlags(HANDLE hContact) return(dwRet); } -DWORD CMraProto::SetContactFlags(HANDLE hContact, DWORD dwContactFlag) +DWORD CMraProto::SetContactFlags(HCONTACT hContact, DWORD dwContactFlag) { if (!IsContactMra(hContact)) return ERROR_INVALID_HANDLE; @@ -398,7 +398,7 @@ DWORD CMraProto::SetContactFlags(HANDLE hContact, DWORD dwContactFlag) return 0; } -DWORD CMraProto::GetContactBasicInfoW(HANDLE hContact, DWORD *pdwID, DWORD *pdwGroupID, DWORD *pdwContactFlag, DWORD *pdwContactSeverFlags, DWORD *pdwStatus, CMStringA *szEmail, CMStringW *wszNick, CMStringA *szPhones) +DWORD CMraProto::GetContactBasicInfoW(HCONTACT hContact, DWORD *pdwID, DWORD *pdwGroupID, DWORD *pdwContactFlag, DWORD *pdwContactSeverFlags, DWORD *pdwStatus, CMStringA *szEmail, CMStringW *wszNick, CMStringA *szPhones) { if (!IsContactMra(hContact)) return ERROR_INVALID_HANDLE; @@ -434,7 +434,7 @@ DWORD CMraProto::GetContactBasicInfoW(HANDLE hContact, DWORD *pdwID, DWORD *pdwG return 0; } -DWORD CMraProto::SetContactBasicInfoW(HANDLE hContact, DWORD dwSetInfoFlags, DWORD dwFlags, DWORD dwID, DWORD dwGroupID, DWORD dwContactFlag, DWORD dwContactSeverFlags, DWORD dwStatus, const CMStringA *szEmail, const CMStringW *wszNick, const CMStringA *szPhones) +DWORD CMraProto::SetContactBasicInfoW(HCONTACT hContact, DWORD dwSetInfoFlags, DWORD dwFlags, DWORD dwID, DWORD dwGroupID, DWORD dwContactFlag, DWORD dwContactSeverFlags, DWORD dwStatus, const CMStringA *szEmail, const CMStringW *wszNick, const CMStringA *szPhones) { if (!IsContactMra(hContact)) return ERROR_INVALID_HANDLE; @@ -496,12 +496,12 @@ DWORD CMraProto::SetContactBasicInfoW(HANDLE hContact, DWORD dwSetInfoFlags, DWO return 0; } -HANDLE CMraProto::MraHContactFromEmail(const CMStringA& szEmail, BOOL bAddIfNeeded, BOOL bTemporary, BOOL *pbAdded) +HCONTACT CMraProto::MraHContactFromEmail(const CMStringA &szEmail, BOOL bAddIfNeeded, BOOL bTemporary, BOOL *pbAdded) { if (szEmail.IsEmpty()) return NULL; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; bool bFound = false; //check not already on list @@ -541,7 +541,7 @@ HANDLE CMraProto::MraHContactFromEmail(const CMStringA& szEmail, BOOL bAddIfNeed } } else { - hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName); } @@ -563,7 +563,7 @@ HANDLE CMraProto::MraHContactFromEmail(const CMStringA& szEmail, BOOL bAddIfNeed return hContact; } -bool CMraProto::MraUpdateContactInfo(HANDLE hContact) +bool CMraProto::MraUpdateContactInfo(HCONTACT hContact) { if (m_bLoggedIn && hContact) if (IsContactMra(hContact)) { @@ -577,22 +577,22 @@ bool CMraProto::MraUpdateContactInfo(HANDLE hContact) return false; } -DWORD CMraProto::MraContactCapabilitiesGet(HANDLE hContact) +DWORD CMraProto::MraContactCapabilitiesGet(HCONTACT hContact) { return getDword(hContact, DBSETTING_CAPABILITIES, 0); } -void CMraProto::MraContactCapabilitiesSet(HANDLE hContact, DWORD dwFutureFlags) +void CMraProto::MraContactCapabilitiesSet(HCONTACT hContact, DWORD dwFutureFlags) { setDword(hContact, DBSETTING_CAPABILITIES, dwFutureFlags); } -DWORD CMraProto::MraGetContactStatus(HANDLE hContact) +DWORD CMraProto::MraGetContactStatus(HCONTACT hContact) { return getWord(hContact, "Status", ID_STATUS_OFFLINE); } -DWORD CMraProto::MraSetContactStatus(HANDLE hContact, DWORD dwNewStatus) +DWORD CMraProto::MraSetContactStatus(HCONTACT hContact, DWORD dwNewStatus) { DWORD dwOldStatus = MraGetContactStatus(hContact); @@ -641,7 +641,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & if (m_dwEmailMessagesUnread) { CMStringA szEmail; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; TCHAR szMailBoxStatus[MAX_SECONDLINE]; mir_sntprintf(szMailBoxStatus, SIZEOF(szMailBoxStatus), TranslateT("Unread mail is available: %lu/%lu messages"), m_dwEmailMessagesUnread, dwEmailMessagesTotal); @@ -709,13 +709,13 @@ bool IsHTTPSProxyUsed(HANDLE m_hNetlibUser) } // îïðåäåëÿåò ïðèíàäëåæíîñòü êîíòàêòà äàííîé êîïèè ïëàãèíà -bool CMraProto::IsContactMra(HANDLE hContact) +bool CMraProto::IsContactMra(HCONTACT hContact) { return CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName) != 0; } // îïðåäåëÿåòñÿ ÿâëÿåòñÿ ëè êîíòàêò êîíòàêòîì MRA ïðîòîêîëà, íå çàâèñèìî îò òîãî êàêîìó ïëàãèíó îí ïðèíàäëåæèò -bool IsContactMraProto(HANDLE hContact) +bool IsContactMraProto(HCONTACT hContact) { LPSTR lpszProto = GetContactProto(hContact); if (lpszProto) { @@ -751,7 +751,7 @@ bool CMraProto::IsEMailChatAgent(const CMStringA &szEmail) return false; } -bool CMraProto::IsContactChatAgent(HANDLE hContact) +bool CMraProto::IsContactChatAgent(HCONTACT hContact) { if (hContact == NULL) return false; @@ -791,7 +791,7 @@ bool GetEMailFromString(const CMStringA& szBuff, CMStringA& szEmail) return false; } -DWORD GetContactEMailCountParam(HANDLE hContact, BOOL bMRAOnly, LPSTR lpszModule, LPSTR lpszValueName) +DWORD GetContactEMailCountParam(HCONTACT hContact, BOOL bMRAOnly, LPSTR lpszModule, LPSTR lpszValueName) { DWORD dwRet = 0; CMStringA szEmail; @@ -815,7 +815,7 @@ DWORD GetContactEMailCountParam(HANDLE hContact, BOOL bMRAOnly, LPSTR lpszModule return dwRet; } -DWORD CMraProto::GetContactEMailCount(HANDLE hContact, BOOL bMRAOnly) +DWORD CMraProto::GetContactEMailCount(HCONTACT hContact, BOOL bMRAOnly) { LPSTR lpszProto = (hContact) ? GetContactProto(hContact) : m_szModuleName; @@ -828,7 +828,7 @@ DWORD CMraProto::GetContactEMailCount(HANDLE hContact, BOOL bMRAOnly) return dwRet; } -bool GetContactFirstEMailParam(HANDLE hContact, BOOL bMRAOnly, LPSTR lpszModule, LPSTR lpszValueName, CMStringA &res) +bool GetContactFirstEMailParam(HCONTACT hContact, BOOL bMRAOnly, LPSTR lpszModule, LPSTR lpszValueName, CMStringA &res) { CMStringA szEmail; @@ -853,7 +853,7 @@ bool GetContactFirstEMailParam(HANDLE hContact, BOOL bMRAOnly, LPSTR lpszModule, return false; } -bool CMraProto::GetContactFirstEMail(HANDLE hContact, BOOL bMRAOnly, CMStringA &res) +bool CMraProto::GetContactFirstEMail(HCONTACT hContact, BOOL bMRAOnly, CMStringA &res) { LPSTR lpszProto = (hContact) ? GetContactProto(hContact) : m_szModuleName; @@ -891,7 +891,7 @@ static void FakeThread(void* param) mir_free(param); } -DWORD CMraProto::ProtoBroadcastAckAsync(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam) +DWORD CMraProto::ProtoBroadcastAckAsync(HCONTACT hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam) { ACKDATA *ack = (ACKDATA*)::mir_calloc(sizeof(ACKDATA)); ack->cbSize = sizeof(ACKDATA); @@ -905,7 +905,7 @@ DWORD CMraProto::ProtoBroadcastAckAsync(HANDLE hContact, int type, int hResult, return 0; } -CMStringA CMraProto::CreateBlobFromContact(HANDLE hContact, const CMStringW &wszRequestReason) +CMStringA CMraProto::CreateBlobFromContact(HCONTACT hContact, const CMStringW &wszRequestReason) { CMStringA res('\0', 8), tmp; DWORD *p = (DWORD*)res.c_str(); @@ -1206,7 +1206,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w return iRet; } -bool CMraProto::MraSendReplyBlogStatus(HANDLE hContact) +bool CMraProto::MraSendReplyBlogStatus(HCONTACT hContact) { SetBlogStatusData* dat = (SetBlogStatusData*)mir_calloc(sizeof(SetBlogStatusData)); dat->ppro = this; diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index 2e92363a74..ba91e2e660 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -43,7 +43,7 @@ INT_PTR CMraProto::MraWebSearch(WPARAM wParam, LPARAM lParam) INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM wParam, LPARAM lParam) { if (MessageBox(NULL, TranslateT("Are you sure?"), TranslateT(MRA_UPD_ALL_USERS_INFO_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { CMStringA szEmail; if (mraGetStringA(hContact, "e-mail", szEmail)) MraWPRequestByEMail(hContact, ACKTYPE_GETINFO, szEmail); @@ -55,7 +55,7 @@ INT_PTR CMraProto::MraUpdateAllUsersInfo(WPARAM wParam, LPARAM lParam) INT_PTR CMraProto::MraCheckUpdatesUsersAvt(WPARAM wParam, LPARAM lParam) { if (MessageBox(NULL, TranslateT("Are you sure?"), TranslateT(MRA_CHK_USERS_AVATARS_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { CMStringA szEmail; if (mraGetStringA(hContact, "e-mail", szEmail)) if (!IsEMailChatAgent(szEmail)) @@ -68,7 +68,7 @@ INT_PTR CMraProto::MraCheckUpdatesUsersAvt(WPARAM wParam, LPARAM lParam) INT_PTR CMraProto::MraRequestAuthForAll(WPARAM wParam, LPARAM lParam) { if (MessageBox(NULL, TranslateT("Are you sure?"), TranslateT(MRA_REQ_AUTH_FOR_ALL_STR), MB_YESNO | MB_ICONQUESTION) == IDYES) { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DWORD dwContactSeverFlags; if (GetContactBasicInfoW(hContact, NULL, NULL, NULL, &dwContactSeverFlags, NULL, NULL, NULL, NULL) == NO_ERROR) if (dwContactSeverFlags & CONTACT_INTFLAG_NOT_AUTHORIZED && dwContactSeverFlags != -1) @@ -80,7 +80,7 @@ INT_PTR CMraProto::MraRequestAuthForAll(WPARAM wParam, LPARAM lParam) INT_PTR CMraProto::MraRequestAuthorization(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!hContact) return 0; @@ -110,7 +110,7 @@ INT_PTR CMraProto::MraGrantAuthorization(WPARAM wParam, LPARAM lParam) // send without reason, do we need any ? CMStringA szEmail; - if (mraGetStringA((HANDLE)wParam, "e-mail", szEmail)) + if (mraGetStringA((HCONTACT)wParam, "e-mail", szEmail)) MraAuthorize(szEmail); return 0; @@ -121,17 +121,17 @@ INT_PTR CMraProto::MraSendPostcard(WPARAM wParam, LPARAM lParam) if (!m_bLoggedIn) return 0; - DWORD dwContactEMailCount = GetContactEMailCount((HANDLE)wParam, FALSE); + DWORD dwContactEMailCount = GetContactEMailCount((HCONTACT)wParam, FALSE); if (dwContactEMailCount) { if (dwContactEMailCount == 1) { CMStringA szUrl, szEmail; - if (GetContactFirstEMail((HANDLE)wParam, FALSE, szEmail)) { + if (GetContactFirstEMail((HCONTACT)wParam, FALSE, szEmail)) { szEmail.MakeLower(); szUrl.Format("http://cards.mail.ru/event.html?rcptname=%s&rcptemail=%s", GetContactNameA((HANDLE)wParam), szEmail); MraMPopSessionQueueAddUrl(hMPopSessionQueue, szUrl); } } - else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_SEND_POSTCARD); + else MraSelectEMailDlgShow((HCONTACT)wParam, MRA_SELECT_EMAIL_TYPE_SEND_POSTCARD); } return 0; } @@ -141,14 +141,14 @@ INT_PTR CMraProto::MraViewAlbum(WPARAM wParam, LPARAM lParam) if (!m_bLoggedIn) return 0; - DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE); + DWORD dwContactEMailMRCount = GetContactEMailCount((HCONTACT)wParam, TRUE); if (dwContactEMailMRCount) { if (dwContactEMailMRCount == 1) { CMStringA szEmail; - if (GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail)) + if (GetContactFirstEMail((HCONTACT)wParam, TRUE, szEmail)) MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_FOTO_URL, szEmail); } - else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_VIEW_ALBUM); + else MraSelectEMailDlgShow((HCONTACT)wParam, MRA_SELECT_EMAIL_TYPE_VIEW_ALBUM); } return 0; } @@ -158,14 +158,14 @@ INT_PTR CMraProto::MraReadBlog(WPARAM wParam, LPARAM lParam) if (!m_bLoggedIn) return 0; - DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE); + DWORD dwContactEMailMRCount = GetContactEMailCount((HCONTACT)wParam, TRUE); if (dwContactEMailMRCount) if (dwContactEMailMRCount == 1) { CMStringA szEmail; - if (GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail)) + if (GetContactFirstEMail((HCONTACT)wParam, TRUE, szEmail)) MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_BLOGS_URL, szEmail); } - else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_READ_BLOG); + else MraSelectEMailDlgShow((HCONTACT)wParam, MRA_SELECT_EMAIL_TYPE_READ_BLOG); return 0; } @@ -176,9 +176,9 @@ INT_PTR CMraProto::MraReplyBlogStatus(WPARAM wParam, LPARAM lParam) return 0; CMStringW blogStatusMsg; - mraGetStringW((HANDLE)wParam, DBSETTING_BLOGSTATUS, blogStatusMsg); + mraGetStringW((HCONTACT)wParam, DBSETTING_BLOGSTATUS, blogStatusMsg); if (!blogStatusMsg.IsEmpty() || wParam == 0) - MraSendReplyBlogStatus((HANDLE)wParam); + MraSendReplyBlogStatus((HCONTACT)wParam); return 0; } @@ -188,14 +188,14 @@ INT_PTR CMraProto::MraViewVideo(WPARAM wParam, LPARAM lParam) if (!m_bLoggedIn) return 0; - DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE); + DWORD dwContactEMailMRCount = GetContactEMailCount((HCONTACT)wParam, TRUE); if (dwContactEMailMRCount) { if (dwContactEMailMRCount == 1) { CMStringA szEmail; - if (GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail)) + if (GetContactFirstEMail((HCONTACT)wParam, TRUE, szEmail)) MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_VIDEO_URL, szEmail); } - else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_VIEW_VIDEO); + else MraSelectEMailDlgShow((HCONTACT)wParam, MRA_SELECT_EMAIL_TYPE_VIEW_VIDEO); } return 0; } @@ -205,14 +205,14 @@ INT_PTR CMraProto::MraAnswers(WPARAM wParam, LPARAM lParam) if (!m_bLoggedIn) return 0; - DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE); + DWORD dwContactEMailMRCount = GetContactEMailCount((HCONTACT)wParam, TRUE); if (dwContactEMailMRCount) { if (dwContactEMailMRCount == 1) { CMStringA szEmail; - if (GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail)) + if (GetContactFirstEMail((HCONTACT)wParam, TRUE, szEmail)) MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_ANSWERS_URL, szEmail); } - else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_ANSWERS); + else MraSelectEMailDlgShow((HCONTACT)wParam, MRA_SELECT_EMAIL_TYPE_ANSWERS); } return 0; } @@ -222,14 +222,14 @@ INT_PTR CMraProto::MraWorld(WPARAM wParam, LPARAM lParam) if (!m_bLoggedIn) return 0; - DWORD dwContactEMailMRCount = GetContactEMailCount((HANDLE)wParam, TRUE); + DWORD dwContactEMailMRCount = GetContactEMailCount((HCONTACT)wParam, TRUE); if (dwContactEMailMRCount) { if (dwContactEMailMRCount == 1) { CMStringA szEmail; - if (GetContactFirstEMail((HANDLE)wParam, TRUE, szEmail)) + if (GetContactFirstEMail((HCONTACT)wParam, TRUE, szEmail)) MraMPopSessionQueueAddUrlAndEMail(hMPopSessionQueue, MRA_WORLD_URL, szEmail); } - else MraSelectEMailDlgShow((HANDLE)wParam, MRA_SELECT_EMAIL_TYPE_WORLD); + else MraSelectEMailDlgShow((HCONTACT)wParam, MRA_SELECT_EMAIL_TYPE_WORLD); } return 0; } @@ -241,7 +241,7 @@ int CMraProto::MraRebuildContactMenu(WPARAM wParam, LPARAM lParam) BOOL bIsContactMRA, bHasEMail, bHasEMailMR, bChatAgent; DWORD dwContactSeverFlags = 0; CMStringW blogStatusMsgSize; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; // proto own contact bIsContactMRA = IsContactMra(hContact); diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 91f9578d44..73270f7d9e 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -233,7 +233,7 @@ DWORD CMraProto::MraNetworkDispatcher() } { DWORD dwCMDNum, dwFlags, dwAckType; - HANDLE hContact; + HCONTACT hContact; LPBYTE lpbData; size_t dwDataSize; while (!MraSendQueueFindOlderThan(hSendQueueHandle, SEND_QUEUE_TIMEOUT, &dwCMDNum, &dwFlags, &hContact, &dwAckType, &lpbData, &dwDataSize)) { @@ -430,7 +430,7 @@ bool CMraProto::CmdMessageAck(BinBuffer &buf) bool CMraProto::CmdMessageStatus(ULONG seq, BinBuffer &buf) { DWORD dwAckType, dwTemp = buf.getDword(); - HANDLE hContact; + HCONTACT hContact; if (!MraSendQueueFind(hSendQueueHandle, seq, NULL, &hContact, &dwAckType, NULL, NULL)) { switch (dwTemp) { case MESSAGE_DELIVERED:// Message delivered directly to user @@ -554,7 +554,7 @@ bool CMraProto::CmdAuthAck(BinBuffer &buf) buf >> szEmail; BOOL bAdded; - HANDLE hContact = MraHContactFromEmail(szEmail, TRUE, TRUE, &bAdded); + HCONTACT hContact = MraHContactFromEmail(szEmail, TRUE, TRUE, &bAdded); if (bAdded) MraUpdateContactInfo(hContact); @@ -613,7 +613,7 @@ bool CMraProto::CmdFileTransfer(BinBuffer &buf) } BOOL bAdded = FALSE; - HANDLE hContact = MraHContactFromEmail(szEmail, TRUE, TRUE, &bAdded); + HCONTACT hContact = MraHContactFromEmail(szEmail, TRUE, TRUE, &bAdded); if (bAdded) MraUpdateContactInfo(hContact); @@ -667,7 +667,7 @@ bool CMraProto::CmdUserStatus(BinBuffer &buf) buf >> dwStatus >> szSpecStatusUri >> szStatusTitle >> szStatusDesc >> szEmail >> dwFutureFlags >> szUserAgentFormatted; BOOL bAdded; - if (HANDLE hContact = MraHContactFromEmail(szEmail, TRUE, TRUE, &bAdded)) { + if (HCONTACT hContact = MraHContactFromEmail(szEmail, TRUE, TRUE, &bAdded)) { if (bAdded) MraUpdateContactInfo(hContact); @@ -705,7 +705,7 @@ bool CMraProto::CmdUserStatus(BinBuffer &buf) bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) { - DWORD dwAckType; HANDLE hContact; LPBYTE pData; size_t dataLen; + DWORD dwAckType; HCONTACT hContact; LPBYTE pData; size_t dataLen; if (!MraSendQueueFind(hSendQueueHandle, seq, NULL, &hContact, &dwAckType, &pData, &dataLen)) { DWORD dwTemp = buf.getDword(); switch (dwTemp) { @@ -753,7 +753,7 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) bool CMraProto::CmdAnketaInfo(int seq, BinBuffer &buf) { - DWORD dwAckType, dwFlags; HANDLE hContact; LPBYTE pData; size_t dataLen; + DWORD dwAckType, dwFlags; HCONTACT hContact; LPBYTE pData; size_t dataLen; if (MraSendQueueFind(hSendQueueHandle, seq, &dwFlags, &hContact, &dwAckType, &pData, &dataLen)) { MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, TranslateT("MRIM_ANKETA_INFO: not found in queue")); return true; @@ -1002,7 +1002,7 @@ bool CMraProto::CmdAnketaInfo(int seq, BinBuffer &buf) bool CMraProto::CmdGame(BinBuffer &buf) { - HANDLE hContact; + HCONTACT hContact; CMStringA szEmail, szData; DWORD dwGameSessionID, dwGameMsg, dwGameMsgID, dwTemp; buf >> szEmail >> dwGameSessionID >> dwGameMsg >> dwGameMsgID >> dwTemp >> szData; @@ -1241,7 +1241,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) if (dwControlParam > 5)// âñå ïàðàìåòðû ïðàâèëüíî èíèöèàëèçèðîâàííû! if ((dwContactFlag & (CONTACT_FLAG_GROUP | CONTACT_FLAG_REMOVED)) == 0) { BOOL bAdded; - HANDLE hContact = MraHContactFromEmail(szEmail, TRUE, FALSE, &bAdded); + HCONTACT hContact = MraHContactFromEmail(szEmail, TRUE, FALSE, &bAdded); if (hContact) { // already in list, remove the duplicate if (GetContactBasicInfoW(hContact, &dwTemp, NULL, NULL, NULL, NULL, NULL, NULL, NULL) == NO_ERROR && dwTemp != -1) { @@ -1309,7 +1309,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) if (mraGetStringW(NULL, "AuthMessage", wszAuthMessage) == FALSE) // def auth message wszAuthMessage = TranslateT(MRA_DEFAULT_AUTH_MESSAGE); - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (GetContactBasicInfoW(hContact, &dwID, NULL, NULL, NULL, NULL, &szEmail, NULL, NULL) == NO_ERROR) if (dwID == -1) { if (IsEMailChatAgent(szEmail)) {// ÷àò: åù¸ ðàç çàïðîñèì àâòîðèçàöèþ, ïîìåòèì êàê âèäèìûé â ñïèñêå, ïîñòîÿííûé @@ -1338,7 +1338,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) } else { // êîíòàêò ëèñò ïî÷åìóòî íå ïîëó÷èëè // âñåõ â offline è id â íåñòàíäàðò - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { SetContactBasicInfoW(hContact, SCBIFSI_LOCK_CHANGES_EVENTS, (SCBIF_ID | SCBIF_GROUP_ID | SCBIF_SERVER_FLAG | SCBIF_STATUS), -1, -2, 0, 0, ID_STATUS_OFFLINE, 0, 0, 0); // request user info from server @@ -1442,7 +1442,7 @@ bool CMraProto::CmdBlogStatus(BinBuffer &buf) buf >> dwFlags >> szEmail >> dwBlogStatusID >> dwTime >> wszText >> szString; - if (HANDLE hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL)) { + if (HCONTACT hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL)) { if (dwFlags & MRIM_BLOG_STATUS_MUSIC) mraSetStringW(hContact, DBSETTING_BLOGSTATUSMUSIC, wszText); else { @@ -1459,7 +1459,7 @@ bool CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader) WCHAR szBuff[4096] = { 0 }; DWORD dwTemp, dwAckType; size_t dwSize; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; LPBYTE pByte; debugLogA("Received packet %x\n", pmaHeader->msg); @@ -1674,7 +1674,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA & } else { BOOL bAdded; - HANDLE hContact = MraHContactFromEmail(plpsFrom, TRUE, TRUE, &bAdded); + HCONTACT hContact = MraHContactFromEmail(plpsFrom, TRUE, TRUE, &bAdded); if (bAdded) MraUpdateContactInfo(hContact); diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index 50f8923fbd..16efbc3467 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -119,7 +119,7 @@ const LPWSTR lpcszXStatusNameDef[] = ////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void CMraProto::SetExtraIcons(HANDLE hContact) +void CMraProto::SetExtraIcons(HCONTACT hContact) { DWORD dwID, dwGroupID, dwContactSeverFlags; if (GetContactBasicInfoW(hContact, &dwID, &dwGroupID, NULL, &dwContactSeverFlags, NULL, NULL, NULL, NULL)) @@ -168,7 +168,7 @@ INT_PTR CMraProto::MraXStatusMenu(WPARAM wParam, LPARAM lParam, LPARAM param) int CMraProto::MraContactDeleted(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!m_bLoggedIn || !hContact) return 0; @@ -191,7 +191,7 @@ int CMraProto::MraDbSettingChanged(WPARAM wParam, LPARAM lParam) if (!m_bLoggedIn || !lParam) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; @@ -298,7 +298,7 @@ int CMraProto::MraDbSettingChanged(WPARAM wParam, LPARAM lParam) int CMraProto::MraExtraIconsApply(WPARAM wParam, LPARAM lParam) { - SetExtraIcons((HANDLE)wParam); + SetExtraIcons((HCONTACT)wParam); return 0; } @@ -449,7 +449,7 @@ INT_PTR CMraProto::MraSetXStatusEx(WPARAM wParam, LPARAM lParam) INT_PTR CMraProto::MraGetXStatusEx(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; CUSTOM_STATUS *pData = (CUSTOM_STATUS*)lParam; if (pData->cbSize < sizeof(CUSTOM_STATUS)) @@ -552,7 +552,7 @@ INT_PTR CMraProto::MraSendNudge(WPARAM wParam, LPARAM lParam) { if (m_bLoggedIn && wParam) { LPWSTR lpwszAlarmMessage = TranslateW(MRA_ALARM_MESSAGE); - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; CMStringA szEmail; if (mraGetStringA(hContact, "e-mail", szEmail)) @@ -619,7 +619,7 @@ INT_PTR CMraProto::MraGetMyAvatar(WPARAM wParam, LPARAM lParam) int CMraProto::OnGroupChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) { CLISTGROUPCHANGE *cgc = (CLISTGROUPCHANGE*)lParam; if (cgc->pszOldName == NULL) diff --git a/protocols/MSN/src/msn_avatar.cpp b/protocols/MSN/src/msn_avatar.cpp index 45abcf490c..ae8ca277cb 100644 --- a/protocols/MSN/src/msn_avatar.cpp +++ b/protocols/MSN/src/msn_avatar.cpp @@ -34,7 +34,7 @@ void CMsnProto::AvatarQueue_Uninit() ::CloseHandle(hevAvatarQueue); } -void CMsnProto::pushAvatarRequest(HANDLE hContact, LPCSTR pszUrl) +void CMsnProto::pushAvatarRequest(HCONTACT hContact, LPCSTR pszUrl) { ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0); diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 55c9ae5cd3..76688d5235 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -25,13 +25,13 @@ along with this program. If not, see . #include "msn_proto.h" #include -HANDLE CMsnProto::MSN_GetChatInernalHandle(HANDLE hContact) +HCONTACT CMsnProto::MSN_GetChatInernalHandle(HCONTACT hContact) { - HANDLE result = hContact; + HCONTACT result = hContact; if ( isChatRoom(hContact)) { DBVARIANT dbv; if (getString(hContact, "ChatRoomID", &dbv) == 0) { - result = (HANDLE)(-atol(dbv.pszVal)); + result = (HCONTACT)(-atol(dbv.pszVal)); db_free(&dbv); } } @@ -98,7 +98,7 @@ void CMsnProto::MSN_ChatStart(ThreadData* info) for (int j=0; j < info->mJoinedContactsWLID.getCount(); j++) { - HANDLE hContact = MSN_HContactFromEmail(info->mJoinedContactsWLID[j]); + HCONTACT hContact = MSN_HContactFromEmail(info->mJoinedContactsWLID[j]); TCHAR *wlid = mir_a2t(info->mJoinedContactsWLID[j]); gce.ptszNick = GetContactNameT(hContact); @@ -159,7 +159,7 @@ static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto } else { - MsnContact *msc = ppro->Lists_Get(hItem); + MsnContact *msc = ppro->Lists_Get((LPCSTR)hItem); if (msc) str.insertn(msc->email); } } @@ -169,25 +169,25 @@ static void ChatInviteSend(HANDLE hItem, HWND hwndList, STRLIST &str, CMsnProto } -static void ChatValidateContact(HANDLE hItem, HWND hwndList, CMsnProto* ppro) +static void ChatValidateContact(HCONTACT hItem, HWND hwndList, CMsnProto* ppro) { if (!ppro->MSN_IsMyContact(hItem) || ppro->isChatRoom(hItem) || ppro->MSN_IsMeByContact(hItem)) SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0); } -static void ChatPrepare(HANDLE hItem, HWND hwndList, CMsnProto* ppro) +static void ChatPrepare(HCONTACT hItem, HWND hwndList, CMsnProto* ppro) { if (hItem == NULL) - hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); + hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); while (hItem) { - HANDLE hItemN = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); + HCONTACT hItemN = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); - if (IsHContactGroup(hItem)) - { - HANDLE hItemT = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); - if (hItemT) ChatPrepare(hItemT, hwndList, ppro); + if (IsHContactGroup(hItem)) { + HCONTACT hItemT = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + if (hItemT) + ChatPrepare(hItemT, hwndList, ppro); } else if (IsHContactContact(hItem)) ChatValidateContact(hItem, hwndList, ppro); @@ -198,7 +198,7 @@ static void ChatPrepare(HANDLE hItem, HWND hwndList, CMsnProto* ppro) INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - InviteChatParam* param = (InviteChatParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + InviteChatParam *param = (InviteChatParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { @@ -229,7 +229,7 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l { case CLN_NEWCONTACT: if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) - ChatValidateContact(nmc->hItem, nmc->hdr.hwndFrom, param->ppro); + ChatValidateContact((HCONTACT)nmc->hItem, nmc->hdr.hwndFrom, param->ppro); break; case CLN_LISTREBUILT: @@ -361,7 +361,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) case GC_USER_PRIVMESS: { char *email = mir_t2a(gch->ptszUID); - HANDLE hContact = MSN_HContactFromEmail(email); + HCONTACT hContact = MSN_HContactFromEmail(email); CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); mir_free(email); break; @@ -384,7 +384,7 @@ int CMsnProto::MSN_GCEventHook(WPARAM, LPARAM lParam) case GC_USER_NICKLISTMENU: { char *email = mir_t2a(gch->ptszUID); - HANDLE hContact = MSN_HContactFromEmail(email); + HCONTACT hContact = MSN_HContactFromEmail(email); mir_free(email); switch(gch->dwData) diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 9701adc096..9cdce62c55 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -46,7 +46,7 @@ void MSN_ConnectionProc(HANDLE hNewConnection, DWORD /* dwRemoteIP */, void* ext } } -void CMsnProto::sttSetMirVer(HANDLE hContact, DWORD dwValue, bool always) +void CMsnProto::sttSetMirVer(HCONTACT hContact, DWORD dwValue, bool always) { static const char* MirVerStr[] = { @@ -117,8 +117,7 @@ void CMsnProto::sttInviteMessage(ThreadData* info, char* msgBody, char* email, c if (AppGUID != NULL) { if (!strcmp(AppGUID, "{02D3C01F-BF30-4825-A83A-DE7AF41648AA}")) { MSN_ShowPopup(info->getContactHandle(), - TranslateT("Contact tried to open an audio conference (not currently supported)"), - MSN_ALLOW_MSGBOX); + TranslateT("Contact tried to open an audio conference (not currently supported)"), MSN_ALLOW_MSGBOX); return; } } @@ -254,7 +253,7 @@ void CMsnProto::sttInviteMessage(ThreadData* info, char* msgBody, char* email, c void CMsnProto::sttCustomSmiley(const char* msgBody, char* email, char* nick, int iSmileyType) { - HANDLE hContact = MSN_HContactFromEmail(email, nick, true, true); + HCONTACT hContact = MSN_HContactFromEmail(email, nick, true, true); char smileyList[500] = ""; @@ -390,7 +389,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para tFileInfo.readFromBuffer(msgBody); info->firstMsgRecv = true; - HANDLE hContact = MSN_HContactFromEmail(email); + HCONTACT hContact = MSN_HContactFromEmail(email); const char* mirver = tFileInfo["Client-Name"]; if (hContact != NULL && mirver != NULL) { setString(hContact, "MirVer", mirver); @@ -405,7 +404,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para } if (!_strnicmp(tContentType, "text/plain", 10)) { - HANDLE hContact = MSN_HContactFromEmail(email, nick, true, true); + HCONTACT hContact = MSN_HContactFromEmail(email, nick, true, true); const char* p = tHeader["X-MMS-IM-Format"]; bool isRtl = p != NULL && strstr(p, "RL=1") != NULL; @@ -491,7 +490,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para const char* tTypingUser = tHeader["TypingUser"]; if (tTypingUser != NULL && info->mChatID[0] == 0 && _stricmp(email, MyOptions.szEmail)) { - HANDLE hContact = MSN_HContactFromEmail(tTypingUser, tTypingUser); + HCONTACT hContact = MSN_HContactFromEmail(tTypingUser, tTypingUser); CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, 7); } } @@ -501,7 +500,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para if (info->mChatID[0]) { GC_INFO gci = { 0 }; - gci.Flags = HCONTACT; + gci.Flags = GCF_HCONTACT; gci.pszModule = m_szModuleName; gci.pszID = info->mChatID; CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci); @@ -603,7 +602,7 @@ void CMsnProto::sttProcessYFind(char* buf, size_t len) else { if (szNetId != NULL) { int netId = atol(szNetId); - HANDLE hContact = MSN_HContactFromEmail(szEmail, szEmail, true, false); + HCONTACT hContact = MSN_HContactFromEmail(szEmail, szEmail, true, false); if (MSN_AddUser(hContact, szEmail, netId, LIST_FL)) { MSN_AddUser(hContact, szEmail, netId, LIST_PL + LIST_REMOVE); MSN_AddUser(hContact, szEmail, netId, LIST_BL + LIST_REMOVE); @@ -641,7 +640,7 @@ void CMsnProto::sttProcessAdd(char* buf, size_t len) UrlDecode((char*)szNick); if (listId == LIST_FL) { - HANDLE hContact = MSN_HContactFromEmail(szEmail, szNick, true, false); + HCONTACT hContact = MSN_HContactFromEmail(szEmail, szNick, true, false); MSN_SetContactDb(hContact, szEmail); } @@ -707,7 +706,7 @@ void CMsnProto::sttProcessRemove(char* buf, size_t len) void CMsnProto::sttProcessStatusMessage(char* buf, unsigned len, const char* wlid) { - HANDLE hContact = MSN_HContactFromEmail(wlid); + HCONTACT hContact = MSN_HContactFromEmail(wlid); if (hContact == NULL) return; ezxml_t xmli = ezxml_parse_str(buf, len); @@ -1049,12 +1048,12 @@ LBL_InvalidCommand: if (strchr(data.userEmail, ';')) { if (info->mJoinedContactsWLID.getCount() == 1) - p2p_clearThreadSessions(info->mJoinedContactsWLID[0], info->mType); + p2p_clearThreadSessions((HCONTACT)info->mJoinedContactsWLID[0], info->mType); info->contactLeft(data.userEmail); break; } - HANDLE hContact = MSN_HContactFromEmail(data.userEmail); + HCONTACT hContact = MSN_HContactFromEmail(data.userEmail); if (getByte("EnableSessionPopup", 0)) MSN_ShowPopup(hContact, TranslateT("Contact left channel"), 0); @@ -1099,7 +1098,7 @@ LBL_InvalidCommand: MSN_KillChatSession(info->mChatID); // open up srmm dialog when quit while 1 person left - HANDLE hContact = info->getContactHandle(); + HCONTACT hContact = info->getContactHandle(); if (hContact) CallServiceSync(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); } } @@ -1163,7 +1162,7 @@ LBL_InvalidCommand: if (tArgs < 2) goto LBL_InvalidCommand; - HANDLE hContact = MSN_HContactFromEmail(data.userEmail); + HCONTACT hContact = MSN_HContactFromEmail(data.userEmail); if (hContact != NULL) { setWord(hContact, "Status", MSN_GetThreadByContact(data.userEmail) ? ID_STATUS_INVISIBLE : ID_STATUS_OFFLINE); setDword(hContact, "IdleTS", 0); @@ -1204,7 +1203,7 @@ LBL_InvalidCommand: MsnContact *cont = Lists_Get(szEmail); - HANDLE hContact = NULL; + HCONTACT hContact = NULL; if (!cont && !isMe) { hContact = MSN_HContactFromEmail(data.wlid, data.userNick, true, true); cont = Lists_Get(szEmail); @@ -1294,7 +1293,7 @@ remove: if (!strchr(data.userEmail, ';')) { UrlDecode(data.userNick); - HANDLE hContact = MSN_HContactFromEmail(data.userEmail, data.userNick, true, true); + HCONTACT hContact = MSN_HContactFromEmail(data.userEmail, data.userNick, true, true); if (tNumTokens == 5 && strcmp(data.flags, "0:0")) { MsnContact *cont = Lists_Get(data.userEmail); @@ -1386,7 +1385,7 @@ remove: stripBBCode(data.userNick); stripColorCode(data.userNick); - HANDLE hContact = MSN_HContactFromEmail(data.userEmail, data.userNick, true, true); + HCONTACT hContact = MSN_HContactFromEmail(data.userEmail, data.userNick, true, true); if (tNumTokens == 3) { MsnContact *cont = Lists_Get(data.userEmail); if (cont) { diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp index 3412165ef1..1fdef99e6b 100644 --- a/protocols/MSN/src/msn_contact.cpp +++ b/protocols/MSN/src/msn_contact.cpp @@ -23,9 +23,9 @@ along with this program. If not, see . #include "msn_global.h" #include "msn_proto.h" -HANDLE CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick, bool addIfNeeded, bool temporary) +HCONTACT CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick, bool addIfNeeded, bool temporary) { - HANDLE hContact = NULL; + HCONTACT hContact = NULL; char* szEmail; parseWLID(NEWSTR_ALLOCA(wlid), NULL, &szEmail, NULL); @@ -33,9 +33,8 @@ HANDLE CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick, b MsnContact *msc = Lists_Get(szEmail); if (msc && msc->hContact) hContact = msc->hContact; - if (hContact == NULL && addIfNeeded) - { - hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + if (hContact == NULL && addIfNeeded) { + hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName); setString(hContact, "e-mail", szEmail); setStringUtf(hContact, "Nick", msnNick ? msnNick : wlid); @@ -49,7 +48,7 @@ HANDLE CMsnProto::MSN_HContactFromEmail(const char* wlid, const char* msnNick, b } -void CMsnProto::MSN_SetContactDb(HANDLE hContact, const char *szEmail) +void CMsnProto::MSN_SetContactDb(HCONTACT hContact, const char *szEmail) { MsnContact *cont = Lists_Get(szEmail); const int listId = cont->list; @@ -120,7 +119,7 @@ void CMsnProto::AddDelUserContList(const char* email, const int list, const int ///////////////////////////////////////////////////////////////////////////////////////// // MSN_AddUser - adds a e-mail address to one of the MSN server lists -bool CMsnProto::MSN_AddUser(HANDLE hContact, const char* email, int netId, int flags, const char *msg) +bool CMsnProto::MSN_AddUser(HCONTACT hContact, const char* email, int netId, int flags, const char *msg) { bool needRemove = (flags & LIST_REMOVE) != 0; bool leaveHotmail = (flags & LIST_REMOVENH) == LIST_REMOVENH; diff --git a/protocols/MSN/src/msn_global.h b/protocols/MSN/src/msn_global.h index 9c97843e95..fac52f59d7 100644 --- a/protocols/MSN/src/msn_global.h +++ b/protocols/MSN/src/msn_global.h @@ -167,7 +167,7 @@ template void UrlDecode(chartype* str); void __cdecl MSN_ConnectionProc(HANDLE hNewConnection, DWORD dwRemoteIP, void*); char* MSN_GetAvatarHash(char* szContext, char** pszUrl = NULL); -bool MSN_MsgWndExist(HANDLE hContact); +bool MSN_MsgWndExist(HCONTACT hContact); #define MSN_SendNickname(a) MSN_SendNicknameUtf(UTF8(a)) @@ -478,71 +478,71 @@ typedef void (__cdecl CMsnProto::*MsnThreadFunc)(void*); struct ThreadData { - ThreadData(); - ~ThreadData(); - - STRLIST mJoinedContactsWLID; - STRLIST mJoinedIdentContactsWLID; - char* mInitialContactWLID; - - TInfoType mType; // thread type - MsnThreadFunc mFunc; // thread entry point - char mServer[80]; // server name - - HANDLE s; // NetLib connection for the thread - HANDLE mIncomingBoundPort; // Netlib listen for the thread - HANDLE hWaitEvent; - WORD mIncomingPort; - TCHAR mChatID[10]; - bool mIsMainThread; - clock_t mWaitPeriod; - - CMsnProto* proto; - - //----| for gateways |---------------------------------------------------------------- - char mSessionID[50]; // Gateway session ID - char mGatewayIP[80]; // Gateway IP address - int mGatewayTimeout; - bool sessionClosed; - bool termPending; - bool gatewayType; - - //----| for switchboard servers only |------------------------------------------------ - bool firstMsgRecv; - int mCaller; - char mCookie[130]; // for switchboard servers only - LONG mTrid; // current message ID - UINT mTimerId; // typing notifications timer id - - //----| for file transfers only |----------------------------------------------------- - filetransfer* mMsnFtp; // file transfer block - bool mBridgeInit; - - //----| internal data buffer |-------------------------------------------------------- - int mBytesInData; // bytes available in data buffer - char mData[8192]; // data buffer for connection - - //----| methods |--------------------------------------------------------------------- - void applyGatewayData(HANDLE hConn, bool isPoll); - void getGatewayUrl(char* dest, int destlen, bool isPoll); - void processSessionData(const char* xMsgr, const char* xHost); - void startThread(MsnThreadFunc , CMsnProto *prt); - - int send(const char data[], size_t datalen); - int recv(char* data, size_t datalen); - - void resetTimeout(bool term = false); - bool isTimeout(void); - - void sendTerminate(void); - void sendCaps(void); - int sendMessage(int msgType, const char* email, int netId, const char* msg, int parFlags); - int sendRawMessage(int msgType, const char* data, int datLen); - int sendPacket(const char* cmd, const char* fmt, ...); - - int contactJoined(const char* email); - int contactLeft(const char* email); - HANDLE getContactHandle(void); + ThreadData(); + ~ThreadData(); + + STRLIST mJoinedContactsWLID; + STRLIST mJoinedIdentContactsWLID; + char* mInitialContactWLID; + + TInfoType mType; // thread type + MsnThreadFunc mFunc; // thread entry point + char mServer[80]; // server name + + HANDLE s; // NetLib connection for the thread + HANDLE mIncomingBoundPort; // Netlib listen for the thread + HANDLE hWaitEvent; + WORD mIncomingPort; + TCHAR mChatID[10]; + bool mIsMainThread; + clock_t mWaitPeriod; + + CMsnProto* proto; + + //----| for gateways |---------------------------------------------------------------- + char mSessionID[50]; // Gateway session ID + char mGatewayIP[80]; // Gateway IP address + int mGatewayTimeout; + bool sessionClosed; + bool termPending; + bool gatewayType; + + //----| for switchboard servers only |------------------------------------------------ + bool firstMsgRecv; + int mCaller; + char mCookie[130]; // for switchboard servers only + LONG mTrid; // current message ID + UINT mTimerId; // typing notifications timer id + + //----| for file transfers only |----------------------------------------------------- + filetransfer* mMsnFtp; // file transfer block + bool mBridgeInit; + + //----| internal data buffer |-------------------------------------------------------- + int mBytesInData; // bytes available in data buffer + char mData[8192]; // data buffer for connection + + //----| methods |--------------------------------------------------------------------- + void applyGatewayData(HANDLE hConn, bool isPoll); + void getGatewayUrl(char* dest, int destlen, bool isPoll); + void processSessionData(const char* xMsgr, const char* xHost); + void startThread(MsnThreadFunc , CMsnProto *prt); + + int send(const char data[], size_t datalen); + int recv(char* data, size_t datalen); + + void resetTimeout(bool term = false); + bool isTimeout(void); + + void sendTerminate(void); + void sendCaps(void); + int sendMessage(int msgType, const char* email, int netId, const char* msg, int parFlags); + int sendRawMessage(int msgType, const char* data, int datLen); + int sendPacket(const char* cmd, const char* fmt, ...); + + int contactJoined(const char* email); + int contactLeft(const char* email); + HCONTACT getContactHandle(void); }; @@ -569,7 +569,7 @@ struct ThreadData -inline bool IsChatHandle(HANDLE hContact) { return (INT_PTR)hContact < 0; } +inline bool IsChatHandle(HCONTACT hContact) { return (INT_PTR)hContact < 0; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -596,10 +596,10 @@ struct MsgQueueEntry struct AvatarQueueEntry { - HANDLE hContact; - char* pszUrl; + HCONTACT hContact; + char *pszUrl; - __forceinline AvatarQueueEntry(HANDLE _contact, LPCSTR _url) : + __forceinline AvatarQueueEntry(HCONTACT _contact, LPCSTR _url) : hContact(_contact), pszUrl( mir_strdup(_url)) {} @@ -639,7 +639,7 @@ struct MsnContact char *email; char *invite; char *nick; - HANDLE hContact; + HCONTACT hContact; int list; int netId; int p2pMsgId; @@ -863,7 +863,7 @@ struct chunkedmsg struct DeleteParam { CMsnProto *proto; - HANDLE hContact; + HCONTACT hContact; }; INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); @@ -871,10 +871,10 @@ INT_PTR CALLBACK DlgDeleteContactUI(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA struct InviteChatParam { TCHAR* id; - HANDLE hContact; + HCONTACT hContact; CMsnProto* ppro; - InviteChatParam(const TCHAR* id, HANDLE hContact, CMsnProto* ppro) + InviteChatParam(const TCHAR* id, HCONTACT hContact, CMsnProto* ppro) : id(mir_tstrdup(id)), hContact(hContact), ppro(ppro) {} ~InviteChatParam() diff --git a/protocols/MSN/src/msn_links.cpp b/protocols/MSN/src/msn_links.cpp index f6bc3e5f85..e41bf5becb 100644 --- a/protocols/MSN/src/msn_links.cpp +++ b/protocols/MSN/src/msn_links.cpp @@ -27,7 +27,7 @@ along with this program. If not, see . static HANDLE hServiceParseLink; -static HANDLE GetContact(TCHAR *arg, TCHAR **pemail, CMsnProto *proto) +static HCONTACT GetContact(TCHAR *arg, TCHAR **pemail, CMsnProto *proto) { TCHAR* email = NULL; do @@ -51,7 +51,7 @@ static HANDLE GetContact(TCHAR *arg, TCHAR **pemail, CMsnProto *proto) return NULL; } if (pemail) *pemail = email; - HANDLE hContact = proto->MSN_HContactFromEmail(UTF8(email), NULL, true, true); + HCONTACT hContact = proto->MSN_HContactFromEmail(UTF8(email), NULL, true, true); return hContact; } @@ -96,7 +96,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) arg += 4; TCHAR *email; - HANDLE hContact = GetContact(arg, &email, proto); + HCONTACT hContact = GetContact(arg, &email, proto); if (email == NULL) return 1; /* does not yet check if email is current user */ @@ -121,7 +121,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) { arg += 5; - HANDLE hContact = GetContact(arg, NULL, proto); + HCONTACT hContact = GetContact(arg, NULL, proto); if (hContact != NULL) { @@ -133,7 +133,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) { arg += 6; - HANDLE hContact = GetContact(arg, NULL, proto); + HCONTACT hContact = GetContact(arg, NULL, proto); if (hContact != NULL) { @@ -145,7 +145,7 @@ static INT_PTR ServiceParseMsnimLink(WPARAM, LPARAM lParam) { arg += 6; - HANDLE hContact = GetContact(arg, NULL, proto); + HCONTACT hContact = GetContact(arg, NULL, proto); if (hContact != NULL) { diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index 1a5d372fce..bd3ab46208 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -65,7 +65,7 @@ MsnContact* CMsnProto::Lists_Get(const char* email) return p; } -MsnContact* CMsnProto::Lists_Get(HANDLE hContact) +MsnContact* CMsnProto::Lists_Get(HCONTACT hContact) { EnterCriticalSection(&csLists); @@ -188,7 +188,7 @@ unsigned CMsnProto::p2p_getPktNum(const char* wlid) return res; } -int CMsnProto::Lists_Add(int list, int netId, const char* email, HANDLE hContact, const char* nick, const char* invite) +int CMsnProto::Lists_Add(int list, int netId, const char* email, HCONTACT hContact, const char* nick, const char* invite) { EnterCriticalSection(&csLists); @@ -238,9 +238,9 @@ void CMsnProto::Lists_Remove(int list, const char* email) void CMsnProto::Lists_Populate(void) { - HANDLE hContact = db_find_first(m_szModuleName); + HCONTACT hContact = db_find_first(m_szModuleName); while (hContact) { - HANDLE hNext = db_find_next(hContact, m_szModuleName); + HCONTACT hNext = db_find_next(hContact, m_szModuleName); char szEmail[MSN_MAX_EMAIL_LEN] = ""; if (db_get_static(hContact, m_szModuleName, "wlid", szEmail, sizeof(szEmail))) db_get_static(hContact, m_szModuleName, "e-mail", szEmail, sizeof(szEmail)); @@ -439,7 +439,7 @@ static void ResetListOptions(HWND hwndList) SendMessage(hwndList, CLM_SETTEXTCOLOR, i, GetSysColor(COLOR_WINDOWTEXT)); } -static void SetContactIcons(HANDLE hItem, HWND hwndList, CMsnProto* proto) +static void SetContactIcons(HCONTACT hItem, HWND hwndList, CMsnProto* proto) { if (!proto->MSN_IsMyContact(hItem)) { SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0); @@ -460,38 +460,34 @@ static void SetContactIcons(HANDLE hItem, HWND hwndList, CMsnProto* proto) SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(4,(dwMask & LIST_RL)?5:0)); } -static void SetAllContactIcons(HANDLE hItem, HWND hwndList, CMsnProto* proto) +static void SetAllContactIcons(HCONTACT hItem, HWND hwndList, CMsnProto* proto) { if (hItem == NULL) - hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); + hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); while (hItem) { - HANDLE hItemN = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); + HCONTACT hItemN = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); - if (IsHContactGroup(hItem)) - { - HANDLE hItemT = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); - if (hItemT) SetAllContactIcons(hItemT, hwndList, proto); + if (IsHContactGroup(hItem)) { + HCONTACT hItemT = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + if (hItemT) + SetAllContactIcons(hItemT, hwndList, proto); } else if (IsHContactContact(hItem)) - { SetContactIcons(hItem, hwndList, proto); - } hItem = hItemN; } } -static void SaveListItem(HANDLE hContact, const char* szEmail, int list, int iPrevValue, int iNewValue, CMsnProto* proto) +static void SaveListItem(HCONTACT hContact, const char* szEmail, int list, int iPrevValue, int iNewValue, CMsnProto* proto) { if (iPrevValue == iNewValue) return; - if (iNewValue == 0) - { - if (list & LIST_FL) - { + if (iNewValue == 0) { + if (list & LIST_FL) { DeleteParam param = { proto, hContact }; DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_DELETECONTACT), NULL, DlgDeleteContactUI, (LPARAM)¶m); return; @@ -503,29 +499,26 @@ static void SaveListItem(HANDLE hContact, const char* szEmail, int list, int iPr proto->MSN_AddUser(hContact, szEmail, proto->Lists_GetNetId(szEmail), list); } -static void SaveSettings(HANDLE hItem, HWND hwndList, CMsnProto* proto) +static void SaveSettings(HCONTACT hItem, HWND hwndList, CMsnProto* proto) { if (hItem == NULL) - hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); + hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); while (hItem) { - if (IsHContactGroup(hItem)) - { - HANDLE hItemT = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); - if (hItemT) SaveSettings(hItemT, hwndList, proto); + if (IsHContactGroup(hItem)) { + HCONTACT hItemT = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + if (hItemT) + SaveSettings(hItemT, hwndList, proto); } - else - { + else { char szEmail[MSN_MAX_EMAIL_LEN]; - if (IsHContactContact(hItem)) - { - if (db_get_static(hItem, proto->m_szModuleName, "e-mail", szEmail, sizeof(szEmail))) continue; + if (IsHContactContact(hItem)) { + if (db_get_static(hItem, proto->m_szModuleName, "e-mail", szEmail, sizeof(szEmail))) + continue; } - else if (IsHContactInfo(hItem)) - { - + else if (IsHContactInfo(hItem)) { TCHAR buf[MSN_MAX_EMAIL_LEN]; SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf); WideCharToMultiByte(CP_ACP, 0, buf, -1, szEmail, sizeof(szEmail), 0, 0); @@ -543,7 +536,7 @@ static void SaveSettings(HANDLE hItem, HWND hwndList, CMsnProto* proto) if (xorMask && newMask & (LIST_FL | LIST_LL)) { - HANDLE hContact = IsHContactInfo(hItem) ? proto->MSN_HContactFromEmail(szEmail, szEmail, true, false) : hItem; + HCONTACT hContact = IsHContactInfo(hItem) ? proto->MSN_HContactFromEmail(szEmail, szEmail, true, false) : hItem; proto->MSN_SetContactDb(hContact, szEmail); } @@ -557,7 +550,7 @@ static void SaveSettings(HANDLE hItem, HWND hwndList, CMsnProto* proto) } } } - hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); + hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); } } @@ -639,7 +632,7 @@ INT_PTR CALLBACK DlgProcMsnServLists(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { case CLN_NEWCONTACT: if ((nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) - SetContactIcons(nmc->hItem, nmc->hdr.hwndFrom, proto); + SetContactIcons((HCONTACT)nmc->hItem, nmc->hdr.hwndFrom, proto); break; case CLN_LISTREBUILT: diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index 180d3e77a3..d74d62ff33 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -293,7 +293,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) ShowPopup &= mUnreadMessages != 0 || (mUnreadJunkEmails != 0 && !getByte("DisableHotmailJunk", 0)); - HANDLE hContact = MSN_HContactFromEmail(MyOptions.szEmail); + HCONTACT hContact = MSN_HContactFromEmail(MyOptions.szEmail); if (hContact) { CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM) 1); @@ -398,7 +398,7 @@ static void TruncUtf8(char *str, size_t sz) str[cntl] = 0; } -void CMsnProto::displayEmailCount(HANDLE hContact) +void CMsnProto::displayEmailCount(HCONTACT hContact) { if (!emailEnabled || getByte("DisableHotmailCL", 0)) return; diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index 76e2e9f784..e9e6cf3b1a 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -32,9 +32,8 @@ HANDLE hNetMeeting, hBlockCom, hSendHotMail, hInviteChat, hViewProfile; INT_PTR CMsnProto::MsnBlockCommand(WPARAM wParam, LPARAM) { - if (msnLoggedIn) - { - const HANDLE hContact = (HANDLE)wParam; + if (msnLoggedIn) { + HCONTACT hContact = (HCONTACT)wParam; char tEmail[MSN_MAX_EMAIL_LEN]; db_get_static(hContact, m_szModuleName, "e-mail", tEmail, sizeof(tEmail)); @@ -52,7 +51,7 @@ INT_PTR CMsnProto::MsnBlockCommand(WPARAM wParam, LPARAM) INT_PTR CMsnProto::MsnGotoInbox(WPARAM, LPARAM) { - HANDLE hContact = MSN_HContactFromEmail(MyOptions.szEmail); + HCONTACT hContact = MSN_HContactFromEmail(MyOptions.szEmail); if (hContact) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM) 1); MsnInvokeMyURL(true, "http://mail.live.com?rru=inbox"); @@ -61,7 +60,7 @@ INT_PTR CMsnProto::MsnGotoInbox(WPARAM, LPARAM) INT_PTR CMsnProto::MsnSendHotmail(WPARAM wParam, LPARAM) { - const HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; char szEmail[MSN_MAX_EMAIL_LEN]; if (MSN_IsMeByContact(hContact, szEmail)) @@ -86,7 +85,7 @@ INT_PTR CMsnProto::MsnSetupAlerts(WPARAM, LPARAM) INT_PTR CMsnProto::MsnViewProfile(WPARAM wParam, LPARAM) { - const HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; char buf[64], *cid; if (hContact == NULL) @@ -128,7 +127,7 @@ INT_PTR CMsnProto::MsnInviteCommand(WPARAM, LPARAM) int CMsnProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) { - const HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; char szEmail[MSN_MAX_EMAIL_LEN]; if ( !MSN_IsMyContact(hContact)) @@ -158,10 +157,9 @@ int CMsnProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) int CMsnProto::OnContactDoubleClicked(WPARAM wParam, LPARAM) { - const HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; - if (emailEnabled && MSN_IsMeByContact(hContact)) - { + if (emailEnabled && MSN_IsMeByContact(hContact)) { MsnSendHotmail(wParam, 0); return 1; } @@ -175,7 +173,7 @@ INT_PTR CMsnProto::MsnSendNetMeeting(WPARAM wParam, LPARAM) { if (!msnLoggedIn) return 0; - HANDLE hContact = HANDLE(wParam); + HCONTACT hContact = HCONTACT(wParam); char szEmail[MSN_MAX_EMAIL_LEN]; if (MSN_IsMeByContact(hContact, szEmail)) return 0; @@ -361,7 +359,7 @@ void CMsnProto::MSN_EnableMenuItems(bool bEnable) ////////////////////////////////////////////////////////////////////////////////////// -static CMsnProto* GetProtoInstanceByHContact(HANDLE hContact) +static CMsnProto* GetProtoInstanceByHContact(HCONTACT hContact) { char* szProto = GetContactProto(hContact); if (szProto == NULL) @@ -376,31 +374,31 @@ static CMsnProto* GetProtoInstanceByHContact(HANDLE hContact) static INT_PTR MsnMenuBlockCommand(WPARAM wParam, LPARAM lParam) { - CMsnProto* ppro = GetProtoInstanceByHContact((HANDLE)wParam); + CMsnProto* ppro = GetProtoInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->MsnBlockCommand(wParam, lParam) : 0; } static INT_PTR MsnMenuViewProfile(WPARAM wParam, LPARAM lParam) { - CMsnProto* ppro = GetProtoInstanceByHContact((HANDLE)wParam); + CMsnProto* ppro = GetProtoInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->MsnViewProfile(wParam, lParam) : 0; } static INT_PTR MsnMenuSendNetMeeting(WPARAM wParam, LPARAM lParam) { - CMsnProto* ppro = GetProtoInstanceByHContact((HANDLE)wParam); + CMsnProto* ppro = GetProtoInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->MsnSendNetMeeting(wParam, lParam) : 0; } static INT_PTR MsnMenuSendHotmail(WPARAM wParam, LPARAM lParam) { - CMsnProto* ppro = GetProtoInstanceByHContact((HANDLE)wParam); + CMsnProto* ppro = GetProtoInstanceByHContact((HCONTACT)wParam); return (ppro) ? ppro->MsnSendHotmail(wParam, lParam) : 0; } static int MSN_OnPrebuildContactMenu(WPARAM wParam, LPARAM lParam) { - CMsnProto* ppro = GetProtoInstanceByHContact((HANDLE)wParam); + CMsnProto* ppro = GetProtoInstanceByHContact((HCONTACT)wParam); if (ppro) ppro->OnPrebuildContactMenu(wParam, lParam); else { diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index f774da7cde..4e2a8bfb0e 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -88,7 +88,7 @@ void CMsnProto::MSN_AddAuthRequest(const char *email, const char *nick, const ch { //blob is: UIN=0(DWORD), hContact(DWORD), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ) - HANDLE hContact = MSN_HContactFromEmail(email, nick, true, true); + HCONTACT hContact = MSN_HContactFromEmail(email, nick, true, true); int emaillen = (int)strlen(email); @@ -176,7 +176,7 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl) ///////////////////////////////////////////////////////////////////////////////////////// // MSN_GetAvatarFileName - gets a file name for an contact's avatar -void CMsnProto::MSN_GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext) +void CMsnProto::MSN_GetAvatarFileName(HCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext) { size_t tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName); @@ -321,7 +321,7 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen) ///////////////////////////////////////////////////////////////////////////////////////// // MSN_GetCustomSmileyFileName - gets a file name for an contact's custom smiley -void CMsnProto::MSN_GetCustomSmileyFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int type) +void CMsnProto::MSN_GetCustomSmileyFileName(HCONTACT hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int type) { size_t tPathLen; @@ -834,7 +834,7 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara case WM_COMMAND: if (tData != NULL) { if (tData->flags & MSN_HOTMAIL_POPUP) { - HANDLE hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL); + HCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL); if (hContact) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM) 1); if (tData->flags & MSN_ALLOW_ENTER) tData->proto->MsnInvokeMyURL(true, tData->url); @@ -847,7 +847,7 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara case WM_CONTEXTMENU: if (tData != NULL && tData->flags & MSN_HOTMAIL_POPUP) { - HANDLE hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL); + HCONTACT hContact = tData->proto->MSN_HContactFromEmail(tData->proto->MyOptions.szEmail, NULL); if (hContact) CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hContact, (LPARAM) 1); } @@ -946,7 +946,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd); } -void CMsnProto::MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags, const char* url, HANDLE hContact) +void CMsnProto::MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags, const char* url, HCONTACT hContact) { if (Miranda_Terminated()) return; @@ -961,7 +961,7 @@ void CMsnProto::MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags } -void CMsnProto::MSN_ShowPopup(const HANDLE hContact, const TCHAR* msg, int flags) +void CMsnProto::MSN_ShowPopup(const HCONTACT hContact, const TCHAR* msg, int flags) { const TCHAR* nickname = hContact ? GetContactNameT(hContact) : _T("Me"); MSN_ShowPopup(nickname, msg, flags, NULL, hContact); @@ -1194,13 +1194,13 @@ char* TWinErrorCode::getText() return mErrorText; } -bool CMsnProto::MSN_IsMyContact(HANDLE hContact) +bool CMsnProto::MSN_IsMyContact(HCONTACT hContact) { const char* szProto = GetContactProto(hContact); return szProto != NULL && strcmp(m_szModuleName, szProto) == 0; } -bool CMsnProto::MSN_IsMeByContact(HANDLE hContact, char* szEmail) +bool CMsnProto::MSN_IsMeByContact(HCONTACT hContact, char* szEmail) { char tEmail[MSN_MAX_EMAIL_LEN]; char *emailPtr = szEmail ? szEmail : tEmail; @@ -1212,7 +1212,7 @@ bool CMsnProto::MSN_IsMeByContact(HANDLE hContact, char* szEmail) return _stricmp(emailPtr, MyOptions.szEmail) == 0; } -bool MSN_MsgWndExist(HANDLE hContact) +bool MSN_MsgWndExist(HCONTACT hContact) { MessageWindowInputData msgWinInData = { sizeof(MessageWindowInputData), hContact, MSG_WINDOW_UFLAG_MSG_BOTH }; @@ -1222,7 +1222,7 @@ bool MSN_MsgWndExist(HANDLE hContact) bool res = CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgWinInData, (LPARAM)&msgWinData) != 0; res = res || msgWinData.hwndWindow; if (res) { - msgWinInData.hContact = (HANDLE)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); + msgWinInData.hContact = (HCONTACT)CallService(MS_MC_GETMETACONTACT, (WPARAM)hContact, 0); if (msgWinInData.hContact != NULL) { res = CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgWinInData, (LPARAM)&msgWinData) != 0; res |= (msgWinData.hwndWindow == NULL); diff --git a/protocols/MSN/src/msn_msgqueue.cpp b/protocols/MSN/src/msn_msgqueue.cpp index 894e4dee30..0bbd87c01b 100644 --- a/protocols/MSN/src/msn_msgqueue.cpp +++ b/protocols/MSN/src/msn_msgqueue.cpp @@ -156,7 +156,7 @@ void CMsnProto::MsgQueue_Clear(const char* wlid, bool msg) const MsgQueueEntry& E = lsMessageQueue[i]; if (E.msgSize == 0) { - HANDLE hContact = MSN_HContactFromEmail(E.wlid); + HCONTACT hContact = MSN_HContactFromEmail(E.wlid); ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)E.seq, (LPARAM)Translate("Message delivery failed")); } @@ -187,7 +187,7 @@ void CMsnProto::MsgQueue_Clear(const char* wlid, bool msg) if (msgfnd) { LeaveCriticalSection(&csMsgQueue); - HANDLE hContact = MSN_HContactFromEmail(wlid); + HCONTACT hContact = MSN_HContactFromEmail(wlid); ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)seq, (LPARAM)Translate("Message delivery failed")); i = 0; diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 26aa551c2d..b4c00ca167 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -490,7 +490,7 @@ static INT_PTR CALLBACK DlgProcHotmailPopupOpts(HWND hwndDlg, UINT msg, WPARAM w proto->setByte("EnableDeliveryPopup", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFY_FIRSTMSG)); proto->setByte("EnableSessionPopup", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFY_ENDSESSION)); - HANDLE hContact = proto->MSN_HContactFromEmail(proto->MyOptions.szEmail); + HCONTACT hContact = proto->MSN_HContactFromEmail(proto->MyOptions.szEmail); if (hContact) proto->displayEmailCount(hContact); return TRUE; diff --git a/protocols/MSN/src/msn_p2ps.cpp b/protocols/MSN/src/msn_p2ps.cpp index 8c631aca5a..697bb49c0b 100644 --- a/protocols/MSN/src/msn_p2ps.cpp +++ b/protocols/MSN/src/msn_p2ps.cpp @@ -110,7 +110,7 @@ bool CMsnProto::p2p_sessionRegistered(filetransfer* ft) return idx > -1; } -filetransfer* CMsnProto::p2p_getThreadSession(HANDLE hContact, TInfoType mType) +filetransfer* CMsnProto::p2p_getThreadSession(HCONTACT hContact, TInfoType mType) { EnterCriticalSection(&sessionLock); @@ -129,7 +129,7 @@ filetransfer* CMsnProto::p2p_getThreadSession(HANDLE hContact, TInfoType mType) return result; } -void CMsnProto::p2p_clearThreadSessions(HANDLE hContact, TInfoType mType) +void CMsnProto::p2p_clearThreadSessions(HCONTACT hContact, TInfoType mType) { EnterCriticalSection(&sessionLock); @@ -147,7 +147,7 @@ void CMsnProto::p2p_clearThreadSessions(HANDLE hContact, TInfoType mType) LeaveCriticalSection(&sessionLock); } -filetransfer* CMsnProto::p2p_getAvatarSession(HANDLE hContact) +filetransfer* CMsnProto::p2p_getAvatarSession(HCONTACT hContact) { EnterCriticalSection(&sessionLock); @@ -165,7 +165,7 @@ filetransfer* CMsnProto::p2p_getAvatarSession(HANDLE hContact) return result; } -bool CMsnProto::p2p_isAvatarOnly(HANDLE hContact) +bool CMsnProto::p2p_isAvatarOnly(HCONTACT hContact) { EnterCriticalSection(&sessionLock); diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index d6f7fbef5c..950d8575ef 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -80,7 +80,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : LoadOptions(); - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { delSetting(hContact, "Status"); delSetting(hContact, "IdleTS"); delSetting(hContact, "p2pMsgId"); @@ -216,9 +216,9 @@ int CMsnProto::OnPreShutdown(WPARAM, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// // MsnAddToList - adds contact to the server list -HANDLE CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD flags) +HCONTACT CMsnProto::AddToListByEmail(const char *email, const char *nick, DWORD flags) { - HANDLE hContact = MSN_HContactFromEmail(email, nick, true, flags & PALF_TEMPORARY); + HCONTACT hContact = MSN_HContactFromEmail(email, nick, true, flags & PALF_TEMPORARY); if (flags & PALF_TEMPORARY) { @@ -277,7 +277,7 @@ HANDLE __cdecl CMsnProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEv return AddToListByEmail(email, nick, flags); } -int CMsnProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) +int CMsnProto::AuthRecv(HCONTACT hContact, PROTORECVEVENT* pre) { Proto_AuthRecv(m_szModuleName, pre); return 0; @@ -286,7 +286,7 @@ int CMsnProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) //////////////////////////////////////////////////////////////////////////////////////// // PSS_AUTHREQUEST -int __cdecl CMsnProto::AuthRequest(HANDLE hContact, const TCHAR* szMessage) +int __cdecl CMsnProto::AuthRequest(HCONTACT hContact, const TCHAR* szMessage) { if (msnLoggedIn) { @@ -349,7 +349,7 @@ int CMsnProto::Authorize(HANDLE hDbEvent) char* lastName = firstName + strlen(firstName) + 1; char* email = lastName + strlen(lastName) + 1; - HANDLE hContact = MSN_HContactFromEmail(email, nick, true, 0); + HCONTACT hContact = MSN_HContactFromEmail(email, nick, true, 0); int netId = Lists_GetNetId(email); MSN_AddUser(hContact, email, netId, LIST_AL); @@ -398,7 +398,7 @@ int CMsnProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) { if (msc->hContact) CallService(MS_DB_CONTACT_DELETE, (WPARAM)msc->hContact, 0); msc->hContact = NULL; - HANDLE hContact = MSN_HContactFromEmail(email); + HCONTACT hContact = MSN_HContactFromEmail(email); if (hContact) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); } @@ -518,7 +518,7 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg) ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, ft, 0); } -HANDLE __cdecl CMsnProto::FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath) +HANDLE __cdecl CMsnProto::FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath) { filetransfer* ft = (filetransfer*)hTransfer; @@ -546,7 +546,7 @@ HANDLE __cdecl CMsnProto::FileAllow(HANDLE hContact, HANDLE hTransfer, const PRO ///////////////////////////////////////////////////////////////////////////////////////// // MsnFileCancel - cancels the active file transfer -int __cdecl CMsnProto::FileCancel(HANDLE hContact, HANDLE hTransfer) +int __cdecl CMsnProto::FileCancel(HCONTACT hContact, HANDLE hTransfer) { filetransfer* ft = (filetransfer*)hTransfer; @@ -579,7 +579,7 @@ int __cdecl CMsnProto::FileCancel(HANDLE hContact, HANDLE hTransfer) ///////////////////////////////////////////////////////////////////////////////////////// // MsnFileDeny - rejects the file transfer request -int __cdecl CMsnProto::FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* /*szReason*/) +int __cdecl CMsnProto::FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* /*szReason*/) { filetransfer* ft = (filetransfer*)hTransfer; @@ -650,7 +650,7 @@ int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const PROTOCHAR typedef struct AwayMsgInfo_tag { INT_PTR id; - HANDLE hContact; + HCONTACT hContact; } AwayMsgInfo; void __cdecl CMsnProto::MsnGetAwayMsgThread(void* arg) @@ -668,7 +668,7 @@ void __cdecl CMsnProto::MsnGetAwayMsgThread(void* arg) mir_free(inf); } -HANDLE __cdecl CMsnProto::GetAwayMsg(HANDLE hContact) +HANDLE __cdecl CMsnProto::GetAwayMsg(HCONTACT hContact) { AwayMsgInfo* inf = (AwayMsgInfo*)mir_alloc(sizeof(AwayMsgInfo)); inf->hContact = hContact; @@ -681,7 +681,7 @@ HANDLE __cdecl CMsnProto::GetAwayMsg(HANDLE hContact) ///////////////////////////////////////////////////////////////////////////////////////// // MsnGetCaps - obtain the protocol capabilities -DWORD_PTR __cdecl CMsnProto::GetCaps(int type, HANDLE hContact) +DWORD_PTR __cdecl CMsnProto::GetCaps(int type, HCONTACT hContact) { switch(type) { case PFLAGNUM_1: @@ -718,7 +718,7 @@ DWORD_PTR __cdecl CMsnProto::GetCaps(int type, HANDLE hContact) ///////////////////////////////////////////////////////////////////////////////////////// // MsnGetInfo - nothing to do, cause we cannot obtain information from the server -int __cdecl CMsnProto::GetInfo(HANDLE hContact, int infoType) +int __cdecl CMsnProto::GetInfo(HCONTACT hContact, int infoType) { return 1; } @@ -726,7 +726,7 @@ int __cdecl CMsnProto::GetInfo(HANDLE hContact, int infoType) //////////////////////////////////////////////////////////////////////////////////////// // RecvContacts -int __cdecl CMsnProto::RecvContacts(HANDLE hContact, PROTORECVEVENT*) +int __cdecl CMsnProto::RecvContacts(HCONTACT hContact, PROTORECVEVENT*) { return 1; } @@ -735,7 +735,7 @@ int __cdecl CMsnProto::RecvContacts(HANDLE hContact, PROTORECVEVENT*) ///////////////////////////////////////////////////////////////////////////////////////// // MsnRecvFile - creates a database event from the file request been received -int __cdecl CMsnProto::RecvFile(HANDLE hContact, PROTOFILEEVENT* evt) +int __cdecl CMsnProto::RecvFile(HCONTACT hContact, PROTOFILEEVENT* evt) { return Proto_RecvFile(hContact, evt); } @@ -743,7 +743,7 @@ int __cdecl CMsnProto::RecvFile(HANDLE hContact, PROTOFILEEVENT* evt) ///////////////////////////////////////////////////////////////////////////////////////// // MsnRecvMessage - creates a database event from the message been received -int __cdecl CMsnProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) +int __cdecl CMsnProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT* pre) { char tEmail[MSN_MAX_EMAIL_LEN]; db_get_static(hContact, m_szModuleName, "e-mail", tEmail, sizeof(tEmail)); @@ -757,7 +757,7 @@ int __cdecl CMsnProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) //////////////////////////////////////////////////////////////////////////////////////// // RecvUrl -int __cdecl CMsnProto::RecvUrl(HANDLE hContact, PROTORECVEVENT*) +int __cdecl CMsnProto::RecvUrl(HCONTACT hContact, PROTORECVEVENT*) { return 1; } @@ -765,7 +765,7 @@ int __cdecl CMsnProto::RecvUrl(HANDLE hContact, PROTORECVEVENT*) //////////////////////////////////////////////////////////////////////////////////////// // SendContacts -int __cdecl CMsnProto::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList) +int __cdecl CMsnProto::SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) { return 1; } @@ -773,7 +773,7 @@ int __cdecl CMsnProto::SendContacts(HANDLE hContact, int flags, int nContacts, H ///////////////////////////////////////////////////////////////////////////////////////// // MsnSendFile - initiates a file transfer -HANDLE __cdecl CMsnProto::SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) +HANDLE __cdecl CMsnProto::SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) { if (!msnLoggedIn) return 0; @@ -826,14 +826,14 @@ HANDLE __cdecl CMsnProto::SendFile(HANDLE hContact, const PROTOCHAR* szDescripti struct TFakeAckParams { - inline TFakeAckParams(HANDLE p2, long p3, const char* p4, CMsnProto *p5) : + inline TFakeAckParams(HCONTACT p2, long p3, const char* p4, CMsnProto *p5) : hContact(p2), id(p3), msg(p4), proto(p5) {} - HANDLE hContact; + HCONTACT hContact; long id; const char* msg; CMsnProto *proto; @@ -846,12 +846,12 @@ void CMsnProto::MsnFakeAck(void* arg) Sleep(150); tParam->proto->ProtoBroadcastAck(tParam->hContact, ACKTYPE_MESSAGE, tParam->msg ? ACKRESULT_FAILED : ACKRESULT_SUCCESS, - (HANDLE)tParam->id, LPARAM(tParam->msg)); + (HCONTACT)tParam->id, LPARAM(tParam->msg)); delete tParam; } -int __cdecl CMsnProto::SendMsg(HANDLE hContact, int flags, const char* pszSrc) +int __cdecl CMsnProto::SendMsg(HCONTACT hContact, int flags, const char* pszSrc) { const char *errMsg = NULL; @@ -1002,7 +1002,7 @@ int __cdecl CMsnProto::SetAwayMsg(int status, const TCHAR* msg) //////////////////////////////////////////////////////////////////////////////////////// // PSR_AWAYMSG -int __cdecl CMsnProto::RecvAwayMsg(HANDLE hContact, int statusMode, PROTORECVEVENT* evt) +int __cdecl CMsnProto::RecvAwayMsg(HCONTACT hContact, int statusMode, PROTORECVEVENT* evt) { return 1; } @@ -1065,7 +1065,7 @@ int __cdecl CMsnProto::SetStatus(int iNewStatus) ///////////////////////////////////////////////////////////////////////////////////////// // MsnUserIsTyping - notify another contact that we're typing a message -int __cdecl CMsnProto::UserIsTyping(HANDLE hContact, int type) +int __cdecl CMsnProto::UserIsTyping(HCONTACT hContact, int type) { if (!msnLoggedIn) return 0; @@ -1108,7 +1108,7 @@ int __cdecl CMsnProto::UserIsTyping(HANDLE hContact, int type) //////////////////////////////////////////////////////////////////////////////////////// // SendUrl -int __cdecl CMsnProto::SendUrl(HANDLE hContact, int flags, const char* url) +int __cdecl CMsnProto::SendUrl(HCONTACT hContact, int flags, const char* url) { return 1; } @@ -1116,7 +1116,7 @@ int __cdecl CMsnProto::SendUrl(HANDLE hContact, int flags, const char* url) ///////////////////////////////////////////////////////////////////////////////////////// // MsnSetApparentMode - controls contact visibility -int __cdecl CMsnProto::SetApparentMode(HANDLE hContact, int mode) +int __cdecl CMsnProto::SetApparentMode(HCONTACT hContact, int mode) { if (mode && mode != ID_STATUS_OFFLINE) return 1; diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index 8d95a7e76d..1e351b900b 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -37,18 +37,18 @@ struct CMsnProto : public PROTO virtual int __cdecl Authorize(HANDLE hDbEvent); virtual int __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR* szReason); - virtual int __cdecl AuthRecv(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl AuthRequest(HANDLE hContact, const TCHAR* szMessage); + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl AuthRequest(HCONTACT hContact, const TCHAR* szMessage); virtual HANDLE __cdecl ChangeInfo(int iInfoType, void* pInfoData); - virtual HANDLE __cdecl FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath); - virtual int __cdecl FileCancel(HANDLE hContact, HANDLE hTransfer); - virtual int __cdecl FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason); + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath); + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer); + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason); virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** szFilename); - virtual DWORD_PTR __cdecl GetCaps(int type, HANDLE hContact = NULL); - virtual int __cdecl GetInfo(HANDLE hContact, int infoType); + virtual DWORD_PTR __cdecl GetCaps(int type, HCONTACT hContact = NULL); + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType); virtual HANDLE __cdecl SearchBasic(const PROTOCHAR* id); virtual HANDLE __cdecl SearchByEmail(const PROTOCHAR* email); @@ -56,24 +56,24 @@ struct CMsnProto : public PROTO virtual HWND __cdecl SearchAdvanced(HWND owner); virtual HWND __cdecl CreateExtendedSearchUI(HWND owner); - virtual int __cdecl RecvContacts(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl RecvFile(HANDLE hContact, PROTOFILEEVENT*); - virtual int __cdecl RecvMsg(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl RecvUrl(HANDLE hContact, PROTORECVEVENT*); + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvFile(HCONTACT hContact, PROTOFILEEVENT*); + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT*); - virtual int __cdecl SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList); - virtual HANDLE __cdecl SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles); - virtual int __cdecl SendMsg(HANDLE hContact, int flags, const char* msg); - virtual int __cdecl SendUrl(HANDLE hContact, int flags, const char* url); + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList); + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles); + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg); + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url); - virtual int __cdecl SetApparentMode(HANDLE hContact, int mode); + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode); virtual int __cdecl SetStatus(int iNewStatus); - virtual HANDLE __cdecl GetAwayMsg(HANDLE hContact); - virtual int __cdecl RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT* evt); + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact); + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt); virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR* msg); - virtual int __cdecl UserIsTyping(HANDLE hContact, int type); + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type); virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam); @@ -195,7 +195,7 @@ struct CMsnProto : public PROTO bool getMyAvatarFile(char *url, TCHAR *fname); void MSN_GoOffline(void); - void MSN_GetCustomSmileyFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int Type); + void MSN_GetCustomSmileyFileName(HCONTACT hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int Type); const char* MirandaStatusToMSN(int status); WORD MSNStatusToMiranda(const char *status); @@ -218,13 +218,13 @@ struct CMsnProto : public PROTO void sttProcessYFind(char* buf, size_t len); void sttCustomSmiley(const char* msgBody, char* email, char* nick, int iSmileyType); void sttInviteMessage(ThreadData* info, char* msgBody, char* email, char* nick); - void sttSetMirVer(HANDLE hContact, DWORD dwValue, bool always); + void sttSetMirVer(HCONTACT hContact, DWORD dwValue, bool always); void LoadOptions(void); void InitPopups(void); - void MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags, const char* url, HANDLE hContact = NULL); - void MSN_ShowPopup(const HANDLE hContact, const TCHAR* msg, int flags); + void MSN_ShowPopup(const TCHAR* nickname, const TCHAR* msg, int flags, const char* url, HCONTACT hContact = NULL); + void MSN_ShowPopup(const HCONTACT hContact, const TCHAR* msg, int flags); void MSN_ShowError(const char* msgtext, ...); void MSN_SetNicknameUtf(const char* nickname); @@ -337,7 +337,7 @@ struct CMsnProto : public PROTO void p2p_cancelAllSessions(void); void p2p_redirectSessions(const char* wlid); void p2p_startSessions(const char* wlid); - void p2p_clearThreadSessions(HANDLE hContact, TInfoType mType); + void p2p_clearThreadSessions(HCONTACT hContact, TInfoType mType); void p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid); void p2p_inviteDc(filetransfer* ft, const char *wlid); @@ -380,14 +380,14 @@ struct CMsnProto : public PROTO void P2pSessions_Init(void); void P2pSessions_Uninit(void); - filetransfer* p2p_getAvatarSession(HANDLE hContact); - filetransfer* p2p_getThreadSession(HANDLE hContact, TInfoType mType); + filetransfer* p2p_getAvatarSession(HCONTACT hContact); + filetransfer* p2p_getThreadSession(HCONTACT hContact, TInfoType mType); filetransfer* p2p_getSessionByID(unsigned id); filetransfer* p2p_getSessionByUniqueID(unsigned id); filetransfer* p2p_getSessionByCallID(const char* CallID, const char* wlid); bool p2p_sessionRegistered(filetransfer* ft); - bool p2p_isAvatarOnly(HANDLE hContact); + bool p2p_isAvatarOnly(HCONTACT hContact); unsigned p2p_getMsgId(const char* wlid, int inc); unsigned p2p_getPktNum(const char* wlid); @@ -413,7 +413,7 @@ struct CMsnProto : public PROTO void MSN_ChatStart(ThreadData* info); void MSN_KillChatSession(const TCHAR* id); - HANDLE MSN_GetChatInernalHandle(HANDLE hContact); + HCONTACT MSN_GetChatInernalHandle(HCONTACT hContact); int __cdecl MSN_GCEventHook(WPARAM wParam, LPARAM lParam); int __cdecl MSN_GCMenuHook(WPARAM wParam, LPARAM lParam); @@ -421,7 +421,7 @@ struct CMsnProto : public PROTO ///////////////////////////////////////////////////////////////////////////////////////// // MSN contact list - int Lists_Add(int list, int netId, const char* email, HANDLE hContact = NULL, const char* nick = NULL, const char* invite = NULL); + int Lists_Add(int list, int netId, const char* email, HCONTACT hContact = NULL, const char* nick = NULL, const char* invite = NULL); bool Lists_IsInList(int list, const char* email); int Lists_GetMask(const char* email); int Lists_GetNetId(const char* email); @@ -430,7 +430,7 @@ struct CMsnProto : public PROTO void Lists_Wipe(void); MsnContact* Lists_Get(const char* email); - MsnContact* Lists_Get(HANDLE hContact); + MsnContact* Lists_Get(HCONTACT hContact); MsnContact* Lists_GetNext(int& i); MsnPlace* Lists_GetPlace(const char* wlid); @@ -446,30 +446,30 @@ struct CMsnProto : public PROTO void MSN_FindYahooUser(const char* email); bool MSN_RefreshContactList(void); - bool MSN_IsMyContact(HANDLE hContact); - bool MSN_IsMeByContact(HANDLE hContact, char* szEmail = NULL); - bool MSN_AddUser(HANDLE hContact, const char* email, int netId, int flags, const char *msg = NULL); + bool MSN_IsMyContact(HCONTACT hContact); + bool MSN_IsMeByContact(HCONTACT hContact, char* szEmail = NULL); + bool MSN_AddUser(HCONTACT hContact, const char* email, int netId, int flags, const char *msg = NULL); void MSN_AddAuthRequest(const char *email, const char *nick, const char *reason); - void MSN_SetContactDb(HANDLE hContact, const char *szEmail); - HANDLE MSN_HContactFromEmail(const char* msnEmail, const char* msnNick = NULL, bool addIfNeeded = false, bool temporary = false); - HANDLE AddToListByEmail(const char *email, const char *nick, DWORD flags); + void MSN_SetContactDb(HCONTACT hContact, const char *szEmail); + HCONTACT MSN_HContactFromEmail(const char* msnEmail, const char* msnNick = NULL, bool addIfNeeded = false, bool temporary = false); + HCONTACT AddToListByEmail(const char *email, const char *nick, DWORD flags); ///////////////////////////////////////////////////////////////////////////////////////// // MSN server groups - void MSN_AddGroup(const char* pName, const char* pId, bool init); - void MSN_DeleteGroup(const char* pId); - void MSN_FreeGroups(void); - LPCSTR MSN_GetGroupById(const char* pId); - LPCSTR MSN_GetGroupByName(const char* pName); - void MSN_SetGroupName(const char* pId, const char* pName); + void MSN_AddGroup(const char* pName, const char* pId, bool init); + void MSN_DeleteGroup(const char* pId); + void MSN_FreeGroups(void); + LPCSTR MSN_GetGroupById(const char* pId); + LPCSTR MSN_GetGroupByName(const char* pName); + void MSN_SetGroupName(const char* pId, const char* pName); - void MSN_MoveContactToGroup(HANDLE hContact, const char* grpName); - void MSN_RenameServerGroup(LPCSTR szId, const char* newName); - void MSN_DeleteServerGroup(LPCSTR szId); - void MSN_RemoveEmptyGroups(void); - void MSN_SyncContactToServerGroup(HANDLE hContact, const char* szContId, ezxml_t cgrp); - void MSN_UploadServerGroups(char* group); + void MSN_MoveContactToGroup(HCONTACT hContact, const char* grpName); + void MSN_RenameServerGroup(LPCSTR szId, const char* newName); + void MSN_DeleteServerGroup(LPCSTR szId); + void MSN_RemoveEmptyGroups(void); + void MSN_SyncContactToServerGroup(HCONTACT hContact, const char* szContId, ezxml_t cgrp); + void MSN_UploadServerGroups(char* group); ///////////////////////////////////////////////////////////////////////////////////////// // MSN Authentication @@ -485,12 +485,12 @@ struct CMsnProto : public PROTO void AvatarQueue_Init(void); void AvatarQueue_Uninit(void); - void MSN_GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext); + void MSN_GetAvatarFileName(HCONTACT hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext); int MSN_SetMyAvatar(const TCHAR* szFname, void* pData, size_t cbLen); void __cdecl MSN_AvatarsThread(void*); - void pushAvatarRequest(HANDLE hContact, LPCSTR pszUrl); + void pushAvatarRequest(HCONTACT hContact, LPCSTR pszUrl); bool loadHttpAvatar(AvatarQueueEntry *p); ///////////////////////////////////////////////////////////////////////////////////////// @@ -504,7 +504,7 @@ struct CMsnProto : public PROTO void processMailData(char* mailData); void sttNotificationMessage(char* msgBody, bool isInitial); - void displayEmailCount(HANDLE hContact); + void displayEmailCount(HCONTACT hContact); ///////////////////////////////////////////////////////////////////////////////////////// // MSN SOAP Address Book @@ -526,7 +526,7 @@ struct CMsnProto : public PROTO ezxml_t abSoapHdr(const char* service, const char* scenario, ezxml_t& tbdy, char*& httphdr); char* GetABHost(const char* service, bool isSharing); - void SetAbParam(HANDLE hContact, const char *name, const char *par); + void SetAbParam(HCONTACT hContact, const char *name, const char *par); void UpdateABHost(const char* service, const char* url); void UpdateABCacheKey(ezxml_t bdy, bool isSharing); @@ -560,11 +560,11 @@ struct CMsnProto : public PROTO ////////////////////////////////////////////////////////////////////////////////////// - TCHAR* GetContactNameT(HANDLE hContact); + TCHAR* GetContactNameT(HCONTACT hContact); - int getStringUtf(HANDLE hContact, const char* name, DBVARIANT* result); + int getStringUtf(HCONTACT hContact, const char* name, DBVARIANT* result); int getStringUtf(const char* name, DBVARIANT* result); - void setStringUtf(HANDLE hContact, const char* name, const char* value); + void setStringUtf(HCONTACT hContact, const char* name, const char* value); }; extern OBJLIST g_Instances; diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp index 10f22e1df1..5f528760f0 100644 --- a/protocols/MSN/src/msn_soapab.cpp +++ b/protocols/MSN/src/msn_soapab.cpp @@ -609,7 +609,7 @@ bool CMsnProto::MSN_SharingMyProfile(bool allowRecurse) } -void CMsnProto::SetAbParam(HANDLE hContact, const char *name, const char *par) +void CMsnProto::SetAbParam(HCONTACT hContact, const char *name, const char *par) { if (*par) setStringUtf(hContact, name, (char*)par); // else delSetting(hContact, "FirstName"); @@ -814,7 +814,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas // Depricated in WLM 8.1 // const char* szNick = ezxml_txt(ezxml_child(contInf, "displayName")); // if (*szNick == '\0') szNick = szEmail; - HANDLE hContact = MSN_HContactFromEmail(szEmail, szEmail, true, false); + HCONTACT hContact = MSN_HContactFromEmail(szEmail, szEmail, true, false); // setStringUtf(hContact, "Nick", (char*)szNick); if (MyOptions.ManageServer) @@ -1555,7 +1555,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in else { MSN_ABAddRemoveContact(szContId, NETID_MSN, true); - HANDLE hContact = MSN_HContactFromEmail(szEmail, szNick ? szNick : szEmail, true, false); + HCONTACT hContact = MSN_HContactFromEmail(szEmail, szNick ? szNick : szEmail, true, false); setString(hContact, "ID", szContId); } status = 0; @@ -1590,7 +1590,7 @@ unsigned CMsnProto::MSN_ABContactAdd(const char* szEmail, const char* szNick, in } else { - HANDLE hContact = MSN_HContactFromEmail(szEmail, szNick ? szNick : szEmail, true, false); + HCONTACT hContact = MSN_HContactFromEmail(szEmail, szNick ? szNick : szEmail, true, false); setString(hContact, "ID", szContId); } } diff --git a/protocols/MSN/src/msn_srv.cpp b/protocols/MSN/src/msn_srv.cpp index bf86fc1706..472e7fafd8 100644 --- a/protocols/MSN/src/msn_srv.cpp +++ b/protocols/MSN/src/msn_srv.cpp @@ -133,7 +133,7 @@ void CMsnProto::MSN_SetGroupName(const char* pId, const char* pNewName) ///////////////////////////////////////////////////////////////////////////////////////// // MSN_MoveContactToGroup - sends a contact to the specified group -void CMsnProto::MSN_MoveContactToGroup(HANDLE hContact, const char* grpName) +void CMsnProto::MSN_MoveContactToGroup(HCONTACT hContact, const char* grpName) { if (!MyOptions.ManageServer) return; @@ -251,7 +251,7 @@ void CMsnProto::MSN_UploadServerGroups(char* group) // if contact in multiple server groups it get removed from all of them other them it's // in or the last one -void CMsnProto::MSN_SyncContactToServerGroup(HANDLE hContact, const char* szContId, ezxml_t cgrp) +void CMsnProto::MSN_SyncContactToServerGroup(HCONTACT hContact, const char* szContId, ezxml_t cgrp) { if (!MyOptions.ManageServer) return; diff --git a/protocols/MSN/src/msn_std.cpp b/protocols/MSN/src/msn_std.cpp index 3816e2035e..78655c0035 100644 --- a/protocols/MSN/src/msn_std.cpp +++ b/protocols/MSN/src/msn_std.cpp @@ -26,7 +26,7 @@ along with this program. If not, see . ///////////////////////////////////////////////////////////////////////////////////////// // Standard functions -int CMsnProto::getStringUtf(HANDLE hContact, const char* name, DBVARIANT* result) +int CMsnProto::getStringUtf(HCONTACT hContact, const char* name, DBVARIANT* result) { return db_get_utf(hContact, m_szModuleName, name, result); } @@ -34,13 +34,13 @@ int CMsnProto::getStringUtf(const char* name, DBVARIANT* result) { return db_get_utf(NULL, m_szModuleName, name, result); } -void CMsnProto::setStringUtf(HANDLE hContact, const char* name, const char* value) +void CMsnProto::setStringUtf(HCONTACT hContact, const char* name, const char* value) { db_set_utf(hContact, m_szModuleName, name, value); } ///////////////////////////////////////////////////////////////////////////////////////// -TCHAR* CMsnProto::GetContactNameT(HANDLE hContact) +TCHAR* CMsnProto::GetContactNameT(HCONTACT hContact) { if (hContact) return (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), GCDNF_TCHAR); diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index 5ed7d2f7b3..73a74e0670 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -246,7 +246,7 @@ INT_PTR CMsnProto::SendNudge(WPARAM wParam, LPARAM lParam) { if (!msnLoggedIn) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; char tEmail[MSN_MAX_EMAIL_LEN]; if (MSN_IsMeByContact(hContact, tEmail)) return 0; @@ -257,8 +257,7 @@ INT_PTR CMsnProto::SendNudge(WPARAM wParam, LPARAM lParam) int netId = Lists_GetNetId(tEmail); - switch (netId) - { + switch (netId) { case NETID_UNKNOWN: hContact = MSN_GetChatInernalHandle(hContact); @@ -381,7 +380,7 @@ INT_PTR CMsnProto::SetCurrentMedia(WPARAM wParam, LPARAM lParam) int CMsnProto::OnContactDeleted(WPARAM wParam, LPARAM lParam) { - const HANDLE hContact = (HANDLE)wParam; + const HCONTACT hContact = (HCONTACT)wParam; if (!msnLoggedIn) //should never happen for MSN contacts return 0; @@ -425,7 +424,7 @@ int CMsnProto::OnGroupChange(WPARAM wParam,LPARAM lParam) { if (!msnLoggedIn || !MyOptions.ManageServer) return 0; - const HANDLE hContact = (HANDLE)wParam; + const HCONTACT hContact = (HCONTACT)wParam; const CLISTGROUPCHANGE* grpchg = (CLISTGROUPCHANGE*)lParam; if (hContact == NULL) @@ -459,7 +458,7 @@ int CMsnProto::OnGroupChange(WPARAM wParam,LPARAM lParam) int CMsnProto::OnDbSettingChanged(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBCONTACTWRITESETTING* cws = (DBCONTACTWRITESETTING*)lParam; if (!msnLoggedIn) @@ -620,7 +619,7 @@ INT_PTR CMsnProto::GetUnreadEmailCount(WPARAM wParam, LPARAM lParam) INT_PTR CMsnProto::OnLeaveChat(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (isChatRoom(hContact) != 0) { DBVARIANT dbv; if (getTString(hContact, "ChatRoomID", &dbv) == 0) { diff --git a/protocols/MSN/src/msn_switchboard.cpp b/protocols/MSN/src/msn_switchboard.cpp index 95f07482ec..582ea94452 100644 --- a/protocols/MSN/src/msn_switchboard.cpp +++ b/protocols/MSN/src/msn_switchboard.cpp @@ -47,7 +47,7 @@ int ThreadData::contactLeft(const char* email) return mJoinedContactsWLID.getCount(); } -HANDLE ThreadData::getContactHandle(void) +HCONTACT ThreadData::getContactHandle(void) { return mJoinedContactsWLID.getCount() ? proto->MSN_HContactFromEmail(mJoinedContactsWLID[0]) : NULL; } diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index a7f3027cbe..5abc87ed2a 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -552,7 +552,7 @@ ThreadData* CMsnProto::MSN_StartSB(const char* wlid, bool& isOffline) ThreadData* thread = MSN_GetThreadByContact(wlid); if (thread == NULL) { - HANDLE hContact = MSN_HContactFromEmail(wlid); + HCONTACT hContact = MSN_HContactFromEmail(wlid); WORD wStatus = getWord(hContact, "Status", ID_STATUS_OFFLINE); if (wStatus != ID_STATUS_OFFLINE) { @@ -664,7 +664,7 @@ ThreadData::~ThreadData() for (i=0; iMSN_HContactFromEmail(wlid); + HCONTACT hContact = proto->MSN_HContactFromEmail(wlid); int temp_status = proto->getWord(hContact, "Status", ID_STATUS_OFFLINE); if (temp_status == ID_STATUS_INVISIBLE && proto->MSN_GetThreadByContact(wlid) == NULL) proto->setWord(hContact, "Status", ID_STATUS_OFFLINE); diff --git a/protocols/MSN/src/msn_ws.cpp b/protocols/MSN/src/msn_ws.cpp index 1cd3e04c2b..95f0ba5cea 100644 --- a/protocols/MSN/src/msn_ws.cpp +++ b/protocols/MSN/src/msn_ws.cpp @@ -67,7 +67,7 @@ bool ThreadData::isTimeout(void) } else if (mJoinedContactsWLID.getCount() <= 1 || mChatID[0] == 0) { - HANDLE hContact = getContactHandle(); + HCONTACT hContact = getContactHandle(); if (mJoinedContactsWLID.getCount() == 0 || termPending) res = true; @@ -96,7 +96,7 @@ bool ThreadData::isTimeout(void) if (proto->getByte("EnableSessionPopup", 0)) { - HANDLE hContact = NULL; + HCONTACT hContact = NULL; if (mJoinedContactsWLID.getCount()) hContact = proto->MSN_HContactFromEmail(mJoinedContactsWLID[0]); else if (mInitialContactWLID) diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp index 31fb4ae58b..1c14409e74 100644 --- a/protocols/Omegle/src/chat.cpp +++ b/protocols/Omegle/src/chat.cpp @@ -366,7 +366,7 @@ HANDLE OmegleProto::GetChatHandle() /*if (facy.chatHandle_ != NULL) return facy.chatHandle_; - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0) > 0) { ptrA id = db_get_sa(hContact, m_szModuleName, "ChatRoomId"); if (id != NULL && !strcmp(id, m_szModuleName)) @@ -377,7 +377,7 @@ HANDLE OmegleProto::GetChatHandle() return NULL;*/ GC_INFO gci = {0}; - gci.Flags = HCONTACT; + gci.Flags = GCF_HCONTACT; gci.pszModule = m_szModuleName; gci.pszID = m_tszUserName; CallService(MS_GC_GETINFO, 0, (LPARAM)&gci); diff --git a/protocols/Omegle/src/messages.cpp b/protocols/Omegle/src/messages.cpp index 90049ab2cd..e98fa84271 100644 --- a/protocols/Omegle/src/messages.cpp +++ b/protocols/Omegle/src/messages.cpp @@ -79,7 +79,7 @@ void OmegleProto::StopChatWorker(void*p) StopChat(); } -int OmegleProto::SendMsg(HANDLE hContact, int flags, const char *msg) +int OmegleProto::SendMsg(HCONTACT hContact, int flags, const char *msg) { // TODO: msg comes as Unicode (retyped wchar_t*), why should we convert it as ANSI to UTF-8? o_O /* if ( flags & PREF_UNICODE ) diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index 245fa749ea..ef213f5066 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -82,7 +82,7 @@ OmegleProto::~OmegleProto( ) ////////////////////////////////////////////////////////////////////////////// -DWORD_PTR OmegleProto::GetCaps( int type, HANDLE hContact ) +DWORD_PTR OmegleProto::GetCaps( int type, HCONTACT hContact ) { switch(type) { case PFLAGNUM_1: @@ -210,7 +210,7 @@ int OmegleProto::OnPreShutdown(WPARAM wParam,LPARAM lParam) int OmegleProto::OnContactDeleted(WPARAM wparam,LPARAM) { - //HANDLE hContact = (HANDLE)wparam; + //HCONTACT hContact = (HCONTACT)wparam; OnLeaveChat(NULL, NULL); return 0; diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h index dc774a56b3..507faea578 100644 --- a/protocols/Omegle/src/proto.h +++ b/protocols/Omegle/src/proto.h @@ -49,18 +49,18 @@ public: virtual int __cdecl Authorize( HANDLE hDbEvent ); virtual int __cdecl AuthDeny( HANDLE hDbEvent, const PROTOCHAR* szReason ); - virtual int __cdecl AuthRecv( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl AuthRequest( HANDLE hContact, const PROTOCHAR* szMessage ); + virtual int __cdecl AuthRecv( HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl AuthRequest( HCONTACT hContact, const PROTOCHAR* szMessage ); virtual HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData ); - virtual HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath ); - virtual int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer ); - virtual int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason ); + virtual HANDLE __cdecl FileAllow( HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath ); + virtual int __cdecl FileCancel( HCONTACT hContact, HANDLE hTransfer ); + virtual int __cdecl FileDeny( HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason ); virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** szFilename ); - virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL ); - virtual int __cdecl GetInfo( HANDLE hContact, int infoType ); + virtual DWORD_PTR __cdecl GetCaps( int type, HCONTACT hContact = NULL ); + virtual int __cdecl GetInfo( HCONTACT hContact, int infoType ); virtual HANDLE __cdecl SearchBasic( const PROTOCHAR* id ); virtual HANDLE __cdecl SearchByEmail( const PROTOCHAR* email ); @@ -68,24 +68,24 @@ public: virtual HWND __cdecl SearchAdvanced( HWND owner ); virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ); - virtual int __cdecl RecvContacts( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvFile( HANDLE hContact, PROTOFILEEVENT* ); - virtual int __cdecl RecvMsg( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvUrl( HANDLE hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvContacts( HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvFile( HCONTACT hContact, PROTOFILEEVENT* ); + virtual int __cdecl RecvMsg( HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvUrl( HCONTACT hContact, PROTORECVEVENT* ); - virtual int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ); - virtual HANDLE __cdecl SendFile( HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles ); - virtual int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg ); - virtual int __cdecl SendUrl( HANDLE hContact, int flags, const char* url ); + virtual int __cdecl SendContacts( HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList ); + virtual HANDLE __cdecl SendFile( HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles ); + virtual int __cdecl SendMsg( HCONTACT hContact, int flags, const char* msg ); + virtual int __cdecl SendUrl( HCONTACT hContact, int flags, const char* url ); - virtual int __cdecl SetApparentMode( HANDLE hContact, int mode ); + virtual int __cdecl SetApparentMode( HCONTACT hContact, int mode ); virtual int __cdecl SetStatus( int iNewStatus ); - virtual HANDLE __cdecl GetAwayMsg( HANDLE hContact ); - virtual int __cdecl RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVENT* evt ); + virtual HANDLE __cdecl GetAwayMsg( HCONTACT hContact ); + virtual int __cdecl RecvAwayMsg( HCONTACT hContact, int mode, PROTORECVEVENT* evt ); virtual int __cdecl SetAwayMsg( int iStatus, const PROTOCHAR* msg ); - virtual int __cdecl UserIsTyping( HANDLE hContact, int type ); + virtual int __cdecl UserIsTyping( HCONTACT hContact, int type ); virtual int __cdecl OnEvent( PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam ); diff --git a/protocols/Omegle/src/stubs.cpp b/protocols/Omegle/src/stubs.cpp index 1bad2bfca9..817c2c02a9 100644 --- a/protocols/Omegle/src/stubs.cpp +++ b/protocols/Omegle/src/stubs.cpp @@ -42,12 +42,12 @@ int OmegleProto::AuthDeny(HANDLE hDbEvent,const PROTOCHAR *reason) return 1; } -int OmegleProto::AuthRecv(HANDLE hContact,PROTORECVEVENT *) +int OmegleProto::AuthRecv(HCONTACT hContact,PROTORECVEVENT *) { return 1; } -int OmegleProto::AuthRequest(HANDLE hContact,const PROTOCHAR *message) +int OmegleProto::AuthRequest(HCONTACT hContact,const PROTOCHAR *message) { return 1; } @@ -57,17 +57,17 @@ HANDLE OmegleProto::ChangeInfo(int type,void *info_data) return NULL; } -HANDLE OmegleProto::FileAllow(HANDLE hContact,HANDLE hTransfer,const PROTOCHAR *path) +HANDLE OmegleProto::FileAllow(HCONTACT hContact,HANDLE hTransfer,const PROTOCHAR *path) { return NULL; } -int OmegleProto::FileCancel(HANDLE hContact,HANDLE hTransfer) +int OmegleProto::FileCancel(HCONTACT hContact,HANDLE hTransfer) { return 1; } -int OmegleProto::FileDeny(HANDLE hContact,HANDLE hTransfer,const PROTOCHAR *reason) +int OmegleProto::FileDeny(HCONTACT hContact,HANDLE hTransfer,const PROTOCHAR *reason) { return 1; } @@ -77,7 +77,7 @@ int OmegleProto::FileResume(HANDLE hTransfer,int *action,const PROTOCHAR **filen return 1; } -int OmegleProto::GetInfo( HANDLE hContact, int infoType ) +int OmegleProto::GetInfo( HCONTACT hContact, int infoType ) { return 1; } @@ -107,47 +107,47 @@ HWND OmegleProto::CreateExtendedSearchUI(HWND owner) return NULL; } -int OmegleProto::RecvContacts(HANDLE hContact,PROTORECVEVENT *) +int OmegleProto::RecvContacts(HCONTACT hContact,PROTORECVEVENT *) { return 1; } -int OmegleProto::RecvFile(HANDLE hContact,PROTORECVFILET *) +int OmegleProto::RecvFile(HCONTACT hContact,PROTORECVFILET *) { return 1; } -int OmegleProto::RecvUrl(HANDLE hContact,PROTORECVEVENT *) +int OmegleProto::RecvUrl(HCONTACT hContact,PROTORECVEVENT *) { return 1; } -int OmegleProto::SendContacts(HANDLE hContact,int flags,int nContacts,HANDLE *hContactsList) +int OmegleProto::SendContacts(HCONTACT hContact,int flags,int nContacts,HCONTACT *hContactsList) { return 1; } -HANDLE OmegleProto::SendFile(HANDLE hContact,const PROTOCHAR *desc, PROTOCHAR **files) +HANDLE OmegleProto::SendFile(HCONTACT hContact,const PROTOCHAR *desc, PROTOCHAR **files) { return NULL; } -int OmegleProto::SendUrl(HANDLE hContact,int flags,const char *url) +int OmegleProto::SendUrl(HCONTACT hContact,int flags,const char *url) { return 1; } -int OmegleProto::SetApparentMode(HANDLE hContact,int mode) +int OmegleProto::SetApparentMode(HCONTACT hContact,int mode) { return 1; } -int OmegleProto::RecvAwayMsg(HANDLE hContact,int mode,PROTORECVEVENT *evt) +int OmegleProto::RecvAwayMsg(HCONTACT hContact,int mode,PROTORECVEVENT *evt) { return 1; } -int OmegleProto::UserIsTyping(HANDLE hContact, int type) +int OmegleProto::UserIsTyping(HCONTACT hContact, int type) { return 1; } @@ -157,12 +157,12 @@ int OmegleProto::SetAwayMsg(int iStatus, const PROTOCHAR* msg) return 1; } -HANDLE OmegleProto::GetAwayMsg( HANDLE hContact ) +HANDLE OmegleProto::GetAwayMsg( HCONTACT hContact ) { return NULL; } -int OmegleProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) +int OmegleProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT *pre) { return 1; } diff --git a/protocols/Omegle/src/theme.cpp b/protocols/Omegle/src/theme.cpp index 786e2c2340..78e1f9d135 100644 --- a/protocols/Omegle/src/theme.cpp +++ b/protocols/Omegle/src/theme.cpp @@ -47,7 +47,7 @@ HANDLE GetIconHandle(const char* name) } // Helper functions -static OmegleProto * GetInstanceByHContact(HANDLE hContact) +static OmegleProto * GetInstanceByHContact(HCONTACT hContact) { char *proto = GetContactProto(hContact); if (!proto) diff --git a/protocols/Skype/src/skype_avatars.cpp b/protocols/Skype/src/skype_avatars.cpp index a42bd24dc3..0ff7d40b56 100644 --- a/protocols/Skype/src/skype_avatars.cpp +++ b/protocols/Skype/src/skype_avatars.cpp @@ -1,6 +1,6 @@ #include "skype.h" -bool CSkypeProto::IsAvatarChanged(const SEBinary &avatar, HANDLE hContact) +bool CSkypeProto::IsAvatarChanged(const SEBinary &avatar, HCONTACT hContact) { bool result = false; @@ -21,7 +21,7 @@ bool CSkypeProto::IsAvatarChanged(const SEBinary &avatar, HANDLE hContact) return result; } -wchar_t * CSkypeProto::GetContactAvatarFilePath(HANDLE hContact) +wchar_t * CSkypeProto::GetContactAvatarFilePath(HCONTACT hContact) { TCHAR path[MAX_PATH]; ::mir_sntprintf(path, SIZEOF(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), this->m_szModuleName); diff --git a/protocols/Skype/src/skype_blocked.cpp b/protocols/Skype/src/skype_blocked.cpp index ba6b123824..a7c96da731 100644 --- a/protocols/Skype/src/skype_blocked.cpp +++ b/protocols/Skype/src/skype_blocked.cpp @@ -3,7 +3,7 @@ int CSkypeProto::BlockCommand(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact) { SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID))); @@ -143,7 +143,7 @@ LRESULT CALLBACK CSkypeProto::SkypeBlockedOptionsSubProc(HWND hwnd, UINT msg, WP param->contact->GetIdentity(data); ptrW sid(::mir_utf8decodeW(data)); - HANDLE hContact = param->ppro->GetContactBySid(sid); + HCONTACT hContact = param->ppro->GetContactBySid(sid); if (::db_get_b(hContact, param->ppro->m_szModuleName, "IsSkypeOut", 0) > 0) ::db_set_w(hContact, param->ppro->m_szModuleName, "Status", ID_STATUS_ONTHEPHONE); @@ -252,7 +252,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeBlockedOptionsProc(HWND hwndDlg, UINT msg, WP } /// int nItem = 0; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; ::EnterCriticalSection(&ppro->contact_search_lock); @@ -296,7 +296,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeBlockedOptionsProc(HWND hwndDlg, UINT msg, WP { int i = ::SendMessage(::GetDlgItem(hwndDlg, IDC_CONTACTS), CB_GETCURSEL, 0, 0); - HANDLE hContact = (HANDLE)::SendMessage(GetDlgItem(hwndDlg, IDC_CONTACTS), CB_GETITEMDATA, i, 0); + HCONTACT hContact = (HCONTACT)::SendMessage(GetDlgItem(hwndDlg, IDC_CONTACTS), CB_GETITEMDATA, i, 0); if ( !hContact) break; diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp index 01b62ea3ed..cfc6bb4aab 100644 --- a/protocols/Skype/src/skype_chat.cpp +++ b/protocols/Skype/src/skype_chat.cpp @@ -256,16 +256,14 @@ void ChatRoom::Start(const ConversationRef &conversation, bool showWindow) this->conversation->SetChatRoom(this); GC_INFO gci = { 0 }; - gci.Flags = BYID | HCONTACT; + gci.Flags = GCF_BYID | GCF_HCONTACT; gci.pszModule = ppro->m_szModuleName; gci.pszID = this->cid; - if ( !::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) - { + if ( !::CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci)) { this->hContact = gci.hContact; ptrW cid( ::db_get_wsa(gci.hContact, ppro->m_szModuleName, SKYPE_SETTINGS_SID)); - if (cid == NULL) - { + if (cid == NULL) { this->conversation->GetPropIdentity(data); cid = ::mir_utf8decodeW(data); ::db_set_ws(gci.hContact, ppro->m_szModuleName, SKYPE_SETTINGS_SID, cid); @@ -984,7 +982,7 @@ void ChatRoom::OnParticipantChanged(const ParticipantRef &participant, int prop) /// -void CSkypeProto::ChatValidateContact(HANDLE hItem, HWND hwndList, const StringList &contacts) +void CSkypeProto::ChatValidateContact(HCONTACT hItem, HWND hwndList, const StringList &contacts) { if (this->IsProtoContact(hItem) && !this->isChatRoom(hItem)) { @@ -996,19 +994,18 @@ void CSkypeProto::ChatValidateContact(HANDLE hItem, HWND hwndList, const StringL ::SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0); } -void CSkypeProto::ChatPrepare(HANDLE hItem, HWND hwndList, const StringList &contacts) +void CSkypeProto::ChatPrepare(HCONTACT hItem, HWND hwndList, const StringList &contacts) { if (hItem == NULL) - hItem = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); + hItem = (HCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); - while (hItem) - { - HANDLE hItemN = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); + while (hItem) { + HCONTACT hItemN = (HCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); - if (IsHContactGroup(hItem)) - { - HANDLE hItemT = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); - if (hItemT) this->ChatPrepare(hItemT, hwndList, contacts); + if (IsHContactGroup(hItem)) { + HCONTACT hItemT = (HCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + if (hItemT) + this->ChatPrepare(hItemT, hwndList, contacts); } else if (IsHContactContact(hItem)) this->ChatValidateContact(hItem, hwndList, contacts); @@ -1017,39 +1014,33 @@ void CSkypeProto::ChatPrepare(HANDLE hItem, HWND hwndList, const StringList &con } } -void CSkypeProto::GetInvitedContacts(HANDLE hItem, HWND hwndList, StringList &chatTargets) +void CSkypeProto::GetInvitedContacts(HCONTACT hItem, HWND hwndList, StringList &chatTargets) { if (hItem == NULL) - hItem = (HANDLE)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); + hItem = (HCONTACT)::SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); - while (hItem) - { - if (IsHContactGroup(hItem)) - { - HANDLE hItemT = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + while (hItem) { + if (IsHContactGroup(hItem)) { + HCONTACT hItemT = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); if (hItemT) this->GetInvitedContacts(hItemT, hwndList, chatTargets); } - else - { + else { int chk = SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0); - if (chk) - { - if (IsHContactInfo(hItem)) - { + if (chk) { + if (IsHContactInfo(hItem)) { TCHAR buf[128] = _T(""); SendMessage(hwndList, CLM_GETITEMTEXT, (WPARAM)hItem, (LPARAM)buf); - - if (buf[0]) chatTargets.insert(buf); + if (buf[0]) + chatTargets.insert(buf); } - else - { + else { ptrW login( ::db_get_wsa(hItem, this->m_szModuleName, SKYPE_SETTINGS_SID)); chatTargets.insert(login); } } } - hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); + hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); } } @@ -1057,8 +1048,7 @@ INT_PTR CALLBACK CSkypeProto::ChatRoomProc(HWND hwndDlg, UINT msg, WPARAM wParam { ChatRoomParam *param = (ChatRoomParam *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - switch (msg) - { + switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -1076,8 +1066,7 @@ INT_PTR CALLBACK CSkypeProto::ChatRoomProc(HWND hwndDlg, UINT msg, WPARAM wParam } SendDlgItemMessage(hwndDlg, IDC_CHAT_JOINING, BM_SETCHECK, param->enableJoining, 0); - for (int i = 1; i < SIZEOF(ChatRoom::Roles) - 4; i++) - { + for (int i = 1; i < SIZEOF(ChatRoom::Roles) - 4; i++) { int nItem = ::SendMessage(::GetDlgItem(hwndDlg, IDC_CHAT_ROLES), CB_ADDSTRING, 0, (LPARAM)::TranslateW(ChatRoom::Roles[i])); if (i == Participant::WRITER) @@ -1095,13 +1084,11 @@ INT_PTR CALLBACK CSkypeProto::ChatRoomProc(HWND hwndDlg, UINT msg, WPARAM wParam case WM_NOTIFY: { NMCLISTCONTROL *nmc = (NMCLISTCONTROL *)lParam; - if (nmc->hdr.idFrom == IDC_CCLIST) - { - switch (nmc->hdr.code) - { + if (nmc->hdr.idFrom == IDC_CCLIST) { + switch (nmc->hdr.code) { case CLN_NEWCONTACT: if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) - param->ppro->ChatValidateContact(nmc->hItem, nmc->hdr.hwndFrom, param->invitedContacts); + param->ppro->ChatValidateContact((HCONTACT)nmc->hItem, nmc->hdr.hwndFrom, param->invitedContacts); break; case CLN_LISTREBUILT: @@ -1205,19 +1192,17 @@ INT_PTR CSkypeProto::CreateChatRoomCommand(WPARAM, LPARAM) return 0; } -void CSkypeProto::ChatRoomInvite(HANDLE hContact) +void CSkypeProto::ChatRoomInvite(HCONTACT hContact) { ptrT chat_id(::db_get_tsa(hContact, this->m_szModuleName, "ChatRoomID")); GC_INFO gci = { 0 }; - gci.Flags = BYID | USERS | DATA; + gci.Flags = GCF_BYID | GCF_USERS | GCF_DATA; gci.pszModule = this->m_szModuleName; gci.pszID = chat_id; - if ( !::CallService(MS_GC_GETINFO, 0, (LPARAM)&gci)) - { + if ( !::CallService(MS_GC_GETINFO, 0, (LPARAM)&gci)) { ChatRoom *room = (ChatRoom *)gci.dwItemData; - if (room != NULL && gci.pszUsers != NULL) - { + if (room != NULL && gci.pszUsers != NULL) { StringList invitedContacts(_A2T(gci.pszUsers)); ChatRoomParam *param = new ChatRoomParam(NULL, invitedContacts, this); @@ -1232,7 +1217,7 @@ void CSkypeProto::ChatRoomInvite(HANDLE hContact) void CSkypeProto::CloseAllChatSessions() { GC_INFO gci = {0}; - gci.Flags = BYINDEX | ID | DATA; + gci.Flags = GCF_BYINDEX | GCF_ID | GCF_DATA; gci.pszModule = this->m_szModuleName; int count = ::CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)this->m_szModuleName); @@ -1252,7 +1237,7 @@ void CSkypeProto::CloseAllChatSessions() ChatRoom *CSkypeProto::FindChatRoom(const wchar_t *cid) { GC_INFO gci = { 0 }; - gci.Flags = BYID | DATA; + gci.Flags = GCF_BYID | GCF_DATA; gci.pszModule = this->m_szModuleName; gci.pszID = (wchar_t*)cid; @@ -1364,7 +1349,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) case CHAT_LIST_MENU::ICM_CONF_INVITE: { GC_INFO gci = { 0 }; - gci.Flags = BYID | USERS; + gci.Flags = GCF_BYID | GCF_USERS; gci.pszModule = this->m_szModuleName; gci.pszID = gch->pDest->ptszID; if ( !::CallService(MS_GC_GETINFO, 0, (LPARAM)&gci) && gci.pszUsers != NULL) @@ -1399,7 +1384,7 @@ int __cdecl CSkypeProto::OnGCEventHook(WPARAM, LPARAM lParam) case CHAT_LIST_MENU::ICM_COPY_SID: { - HANDLE hContact = this->GetContactBySid(gch->ptszUID); + HCONTACT hContact = this->GetContactBySid(gch->ptszUID); if (!hContact) { ptrW sid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)); @@ -1471,7 +1456,7 @@ int __cdecl CSkypeProto::OnGCMenuHook(WPARAM, LPARAM lParam) if (member->GetRank() > Participant::SPECTATOR) DisableChatMenuItem(ICM_ROLE); - HANDLE hContact = this->GetContactBySid(gcmi->pszUID); + HCONTACT hContact = this->GetContactBySid(gcmi->pszUID); if (hContact == NULL) DisableChatMenuItem(ICM_DETAILS); else if(this->getByte(hContact, "Auth", 0) == 0) @@ -1504,7 +1489,7 @@ void CSkypeProto::UpdateChatUserStatus(const ContactRef &contact) ptrW sid(::mir_utf8decodeW(identity)); GC_INFO gci = { 0 }; - gci.Flags = BYINDEX | DATA; + gci.Flags = GCF_BYINDEX | GCF_DATA; gci.pszModule = this->m_szModuleName; int count = ::CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)this->m_szModuleName); @@ -1533,7 +1518,7 @@ void CSkypeProto::UpdateChatUserNick(const ContactRef &contact) ptrW nick(::mir_utf8decodeW(((CContact::Ref)contact)->GetNick())); GC_INFO gci = { 0 }; - gci.Flags = BYINDEX | DATA; + gci.Flags = GCF_BYINDEX | GCF_DATA; gci.pszModule = this->m_szModuleName; int count = ::CallServiceSync(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)this->m_szModuleName); @@ -1554,7 +1539,7 @@ void CSkypeProto::UpdateChatUserNick(const ContactRef &contact) INT_PTR __cdecl CSkypeProto::OnJoinChat(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact) { ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID")); @@ -1582,9 +1567,8 @@ INT_PTR __cdecl CSkypeProto::OnJoinChat(WPARAM wParam, LPARAM) INT_PTR __cdecl CSkypeProto::OnLeaveChat(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; - if (hContact) - { + HCONTACT hContact = (HCONTACT)wParam; + if (hContact) { ptrW cid(::db_get_wsa(hContact, this->m_szModuleName, "ChatRoomID")); ChatRoom *room = this->FindChatRoom(cid); diff --git a/protocols/Skype/src/skype_chat.h b/protocols/Skype/src/skype_chat.h index 3235622348..eb5e7d432e 100644 --- a/protocols/Skype/src/skype_chat.h +++ b/protocols/Skype/src/skype_chat.h @@ -129,7 +129,7 @@ private: CConversation::Ref conversation; - HANDLE hContact; + HCONTACT hContact; OBJLIST members; diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 33042e728d..325d70f508 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -1,6 +1,6 @@ #include "skype.h" -void CSkypeProto::UpdateContactAuthState(HANDLE hContact, const ContactRef &contact) +void CSkypeProto::UpdateContactAuthState(HCONTACT hContact, const ContactRef &contact) { uint newTS = 0; contact->GetPropAuthreqTimestamp(newTS); @@ -23,7 +23,7 @@ void CSkypeProto::UpdateContactAuthState(HANDLE hContact, const ContactRef &cont } } -void CSkypeProto::UpdateContactStatus(HANDLE hContact, const ContactRef &contact) +void CSkypeProto::UpdateContactStatus(HCONTACT hContact, const ContactRef &contact) { Contact::AVAILABILITY availability; contact->GetPropAvailability(availability); @@ -40,7 +40,7 @@ void CSkypeProto::UpdateContactStatus(HANDLE hContact, const ContactRef &contact } } -void CSkypeProto::UpdateContactClient(HANDLE hContact, const ContactRef &contact) +void CSkypeProto::UpdateContactClient(HCONTACT hContact, const ContactRef &contact) { bool isMobile = false; contact->HasCapability(Contact::CAPABILITY_MOBILE_DEVICE, isMobile/*, true*/); @@ -48,7 +48,7 @@ void CSkypeProto::UpdateContactClient(HANDLE hContact, const ContactRef &contact this->setTString(hContact, "MirVer", isMobile ? L"SkypeMobile" : L"Skype"); } -void CSkypeProto::UpdateContactOnlineSinceTime(HANDLE hContact, const ContactRef &contact) +void CSkypeProto::UpdateContactOnlineSinceTime(HCONTACT hContact, const ContactRef &contact) { uint newTS = 0; contact->GetPropLastonlineTimestamp(newTS); @@ -57,7 +57,7 @@ void CSkypeProto::UpdateContactOnlineSinceTime(HANDLE hContact, const ContactRef this->setDword(hContact, "OnlineSinceTS", newTS); } -void CSkypeProto::UpdateContactLastEventDate(HANDLE hContact, const ContactRef &contact) +void CSkypeProto::UpdateContactLastEventDate(HCONTACT hContact, const ContactRef &contact) { uint newTS = 0; contact->GetPropLastusedTimestamp(newTS); @@ -71,7 +71,7 @@ void CSkypeProto::OnContactChanged(const ContactRef &contact, int prop) SEString data; contact->GetPropSkypename(data); wchar_t *sid = ::mir_utf8decodeW(data); - HANDLE hContact = this->GetContactBySid(sid); + HCONTACT hContact = this->GetContactBySid(sid); ::mir_free(sid); SEObject *contactObj = contact.fetch(); @@ -148,14 +148,14 @@ void CSkypeProto::OnContactListChanged(const ContactRef &contact) } } -bool CSkypeProto::IsProtoContact(HANDLE hContact) +bool CSkypeProto::IsProtoContact(HCONTACT hContact) { return ::lstrcmpiA(::GetContactProto(hContact), this->m_szModuleName) == 0; } -HANDLE CSkypeProto::GetContactBySid(const wchar_t *sid) +HCONTACT CSkypeProto::GetContactBySid(const wchar_t *sid) { - HANDLE hContact = NULL; + HCONTACT hContact = NULL; ::EnterCriticalSection(&this->contact_search_lock); @@ -171,7 +171,7 @@ HANDLE CSkypeProto::GetContactBySid(const wchar_t *sid) return hContact; } -HANDLE CSkypeProto::GetContactFromAuthEvent(HANDLE hEvent) +HCONTACT CSkypeProto::GetContactFromAuthEvent(HANDLE hEvent) { // db_event_getContact DWORD body[3]; @@ -180,34 +180,33 @@ HANDLE CSkypeProto::GetContactFromAuthEvent(HANDLE hEvent) dbei.pBlob = (PBYTE)&body; if (::db_event_get(hEvent, &dbei)) - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; if (dbei.eventType != EVENTTYPE_AUTHREQUEST) - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; if (strcmp(dbei.szModule, this->m_szModuleName) != 0) - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; return ::DbGetAuthEventContact(&dbei); } -HANDLE CSkypeProto::AddContact(CContact::Ref contact, bool isTemporary) +HCONTACT CSkypeProto::AddContact(CContact::Ref contact, bool isTemporary) { ptrW sid(::mir_utf8decodeW(contact->GetSid())); CContact::AVAILABILITY availability; contact->GetPropAvailability(availability); - HANDLE hContact = this->GetContactBySid(sid); + HCONTACT hContact = this->GetContactBySid(sid); if ( !hContact) { - hContact = (HANDLE)::CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT)::CallService(MS_DB_CONTACT_ADD, 0, 0); ::CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)this->m_szModuleName); ptrW nick(::mir_utf8decodeW(contact->GetNick())); - switch(availability) - { + switch(availability) { case CContact::SKYPEOUT: this->setByte(hContact, "IsSkypeOut", 1); break; @@ -256,7 +255,7 @@ void __cdecl CSkypeProto::LoadContactList(void* data) { CContact::Ref contact = this->contactList[i]; - HANDLE hContact = this->AddContact(contact); + HCONTACT hContact = this->AddContact(contact); if ( !isFirstLoad) { @@ -294,7 +293,7 @@ void __cdecl CSkypeProto::LoadAuthWaitList(void*) } } -bool CSkypeProto::IsContactOnline(HANDLE hContact) +bool CSkypeProto::IsContactOnline(HCONTACT hContact) { return this->getWord(hContact, SKYPE_SETTINGS_STATUS, ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE; } @@ -303,7 +302,7 @@ void CSkypeProto::SetAllContactStatus(int status) { ::EnterCriticalSection(&this->contact_search_lock); - for (HANDLE hContact = ::db_find_first(this->m_szModuleName); hContact; hContact = ::db_find_next(hContact, this->m_szModuleName)) + for (HCONTACT hContact = ::db_find_first(this->m_szModuleName); hContact; hContact = ::db_find_next(hContact, this->m_szModuleName)) { if (this->getByte(hContact, "IsSkypeOut", 0) != 0) continue; @@ -356,7 +355,7 @@ void __cdecl CSkypeProto::SearchBySidAsync(void* arg) { mir_ptr sid((wchar_t*)arg); - HANDLE hContact = this->GetContactBySid(sid); + HCONTACT hContact = this->GetContactBySid(sid); if (hContact) { this->ShowNotification(TranslateT("Contact already in your contact list"), 0, hContact); @@ -463,7 +462,7 @@ void CSkypeProto::OnContactsReceived(const ConversationRef &conversation, const CContact::Ref author; this->GetContact(data, author); - HANDLE hContact = this->AddContact(author); + HCONTACT hContact = this->AddContact(author); SEBinary guid; message->GetPropGuid(guid); @@ -519,7 +518,7 @@ void CSkypeProto::OnContactsSent(const ConversationRef &conversation, const Mess CContact::Ref receiver; this->GetContact(data, receiver); - HANDLE hContact = this->AddContact(receiver); + HCONTACT hContact = this->AddContact(receiver); this->SendBroadcast( hContact, ACKTYPE_CONTACTS, diff --git a/protocols/Skype/src/skype_database.cpp b/protocols/Skype/src/skype_database.cpp index ddc780098e..2390897d10 100644 --- a/protocols/Skype/src/skype_database.cpp +++ b/protocols/Skype/src/skype_database.cpp @@ -1,6 +1,6 @@ #include "skype.h" -bool CSkypeProto::IsMessageInDB(HANDLE hContact, DWORD timestamp, SEBinary &guid, int flag) +bool CSkypeProto::IsMessageInDB(HCONTACT hContact, DWORD timestamp, SEBinary &guid, int flag) { for (HANDLE hDbEvent = ::db_event_last(hContact); hDbEvent; hDbEvent = ::db_event_prev(hDbEvent)) { @@ -25,7 +25,7 @@ bool CSkypeProto::IsMessageInDB(HANDLE hContact, DWORD timestamp, SEBinary &guid return false; } -HANDLE CSkypeProto::AddDBEvent(HANDLE hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob) +HANDLE CSkypeProto::AddDBEvent(HCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.szModule = this->m_szModuleName; @@ -52,7 +52,7 @@ void CSkypeProto::RaiseAuthRequestEvent(DWORD timestamp, CContact::Ref contact) char *firstName = ::mir_strdup(data); char *lastName = ::mir_strdup(last); - HANDLE hContact = this->AddContact(contact); + HCONTACT hContact = this->AddContact(contact); /*blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), firstName(ASCIIZ), lastName(ASCIIZ), sid(ASCIIZ), reason(ASCIIZ)*/ DWORD cbBlob = (DWORD) @@ -84,7 +84,7 @@ void CSkypeProto::RaiseAuthRequestEvent(DWORD timestamp, CContact::Ref contact) this->AddDBEvent(hContact, EVENTTYPE_AUTHREQUEST, time(NULL), DBEF_UTF, cbBlob, pBlob); } -void CSkypeProto::RaiseMessageSentEvent(HANDLE hContact, DWORD timestamp, SEBinary &guid, const char *message, bool isUnread) +void CSkypeProto::RaiseMessageSentEvent(HCONTACT hContact, DWORD timestamp, SEBinary &guid, const char *message, bool isUnread) { if (this->IsMessageInDB(hContact, timestamp, guid, DBEF_SENT)) return; diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index 9eeb4bd25c..b0dd1f5802 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -403,7 +403,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam break; char *szProto; - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; if (hContact == NULL) szProto = ppro->m_szModuleName; @@ -780,7 +780,7 @@ INT_PTR CALLBACK CSkypeProto::HomeSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wP } } - tmi.prepareList((HANDLE)lParam, ::GetDlgItem(hwndDlg, IDC_TIMEZONE), TZF_PLF_CB); + tmi.prepareList((HCONTACT)lParam, ::GetDlgItem(hwndDlg, IDC_TIMEZONE), TZF_PLF_CB); HANDLE hTimeZone = tmi.createByContact ? tmi.createByContact(NULL, 0) : 0; LPCTSTR TzDescr = tmi.getTzDescription(tmi.getTzName(hTimeZone)); ::SetDlgItemText(hwndDlg, IDC_TIMEZONE, TzDescr); diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index e86de2e396..7e399ba829 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -65,7 +65,7 @@ int CSkypeProto::OnPreShutdown(WPARAM, LPARAM) int CSkypeProto::OnContactDeleted(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact) { if (this->isChatRoom(hContact)) @@ -128,7 +128,7 @@ int __cdecl CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM lParam) int __cdecl CSkypeProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) { - if ((!this->IsProtoContact((HANDLE)lParam)) && lParam) + if ((!this->IsProtoContact((HCONTACT)lParam)) && lParam) return 0; OPTIONSDIALOGPAGE odp = { sizeof(odp) }; @@ -138,7 +138,7 @@ int __cdecl CSkypeProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) odp.position = -1900000000; odp.ptszTitle = this->m_tszUserName; - HANDLE hContact = (HANDLE)lParam; + HCONTACT hContact = (HCONTACT)lParam; if (hContact) { char *szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if (szProto != NULL && !strcmp(szProto, m_szModuleName)) { @@ -192,7 +192,7 @@ int __cdecl CSkypeProto::OnSrmmWindowOpen(WPARAM, LPARAM lParam) int __cdecl CSkypeProto::OnTabSRMMButtonPressed(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; CustomButtonClickData *cbcd = (CustomButtonClickData *)lParam; switch (cbcd->dwButtonId) diff --git a/protocols/Skype/src/skype_instances.cpp b/protocols/Skype/src/skype_instances.cpp index 37a465481d..264f6e14c2 100644 --- a/protocols/Skype/src/skype_instances.cpp +++ b/protocols/Skype/src/skype_instances.cpp @@ -73,7 +73,7 @@ void CSkypeProto::UninitInstances() instanceList.destroy(); } -CSkypeProto* CSkypeProto::GetContactInstance(HANDLE hContact) +CSkypeProto* CSkypeProto::GetContactInstance(HCONTACT hContact) { char *proto = (char *)::CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp index f8083bb3e7..52849b5efd 100644 --- a/protocols/Skype/src/skype_menus.cpp +++ b/protocols/Skype/src/skype_menus.cpp @@ -13,7 +13,7 @@ INT_PTR CSkypeProto::MenuChooseService(WPARAM wParam, LPARAM lParam) int CSkypeProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if ( !hContact) return 0; @@ -66,19 +66,19 @@ int CSkypeProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) template INT_PTR GlobalService(WPARAM wParam, LPARAM lParam) { - CSkypeProto *ppro = CSkypeProto::GetContactInstance((HANDLE)wParam); + CSkypeProto *ppro = CSkypeProto::GetContactInstance((HCONTACT)wParam); return ppro ? (ppro->*Service)(wParam, lParam) : 0; } int CSkypeProto::RequestAuth(WPARAM wParam, LPARAM lParam) { - return this->AuthRequest((HANDLE)wParam, LPGENT("Hi! I\'d like to add you to my contact list")); + return this->AuthRequest((HCONTACT)wParam, LPGENT("Hi! I\'d like to add you to my contact list")); } int CSkypeProto::GrantAuth(WPARAM wParam, LPARAM lParam) { CContact::Ref contact; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID))); if (this->GetContact(sid, contact)) { @@ -95,7 +95,7 @@ int CSkypeProto::GrantAuth(WPARAM wParam, LPARAM lParam) int CSkypeProto::RevokeAuth(WPARAM wParam, LPARAM lParam) { CContact::Ref contact; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; SEString sid(_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID))); if (this->GetContact(sid, contact)) { @@ -112,7 +112,7 @@ int CSkypeProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) for (int i = 0; i < SIZEOF(CSkypeProto::contactMenuItems); i++) ::Menu_ShowItem(CSkypeProto::contactMenuItems[i], false); - CSkypeProto* ppro = CSkypeProto::GetContactInstance((HANDLE)wParam); + CSkypeProto* ppro = CSkypeProto::GetContactInstance((HCONTACT)wParam); return (ppro) ? ppro->OnPrebuildContactMenu(wParam, lParam) : 0; } diff --git a/protocols/Skype/src/skype_messages.cpp b/protocols/Skype/src/skype_messages.cpp index d0e4ea81da..f82b89cb9e 100644 --- a/protocols/Skype/src/skype_messages.cpp +++ b/protocols/Skype/src/skype_messages.cpp @@ -53,7 +53,7 @@ void CSkypeProto::OnMessageReceived(const ConversationRef &conversation, const M message->GetPropAuthor(data); this->GetContact(data, author); - HANDLE hContact = this->AddContact(author, true); + HCONTACT hContact = this->AddContact(author, true); this->UserIsTyping(hContact, PROTOTYPE_SELFTYPING_OFF); SEBinary guid; @@ -103,7 +103,7 @@ void CSkypeProto::OnMessageSent(const ConversationRef &conversation, const Messa ptrW sid(::mir_utf8decodeW(data)); - HANDLE hContact = this->GetContactBySid(sid); + HCONTACT hContact = this->GetContactBySid(sid); this->SendBroadcast( hContact, ACKTYPE_MESSAGE, @@ -157,7 +157,7 @@ void CSkypeProto::OnMessageEvent(const ConversationRef &conversation, const Mess CContact::Ref author; this->GetContact(identity, author); - HANDLE hContact = this->AddContact(author); + HCONTACT hContact = this->AddContact(author); char *message = ::mir_utf8encode(::Translate("Incoming call started")); @@ -191,7 +191,7 @@ void CSkypeProto::OnMessageEvent(const ConversationRef &conversation, const Mess CContact::Ref author; this->GetContact(identity, author); - HANDLE hContact = this->AddContact(author); + HCONTACT hContact = this->AddContact(author); char *message = ::mir_utf8encode(::Translate("Incoming call finished")); @@ -222,7 +222,7 @@ void CSkypeProto::SyncMessageHystory(const ConversationRef &conversation, const } } -void CSkypeProto::SyncHistoryCommand(HANDLE hContact, time_t timestamp) +void CSkypeProto::SyncHistoryCommand(HCONTACT hContact, time_t timestamp) { if (hContact) { @@ -250,7 +250,7 @@ int CSkypeProto::SyncLastDayHistoryCommand(WPARAM wParam, LPARAM lParam) { time_t timestamp = time(NULL); timestamp -= 60*60*24; - this->SyncHistoryCommand((HANDLE)wParam, timestamp); + this->SyncHistoryCommand((HCONTACT)wParam, timestamp); return 0; } @@ -258,7 +258,7 @@ int CSkypeProto::SyncLastWeekHistoryCommand(WPARAM wParam, LPARAM lParam) { time_t timestamp = time(NULL); timestamp -= 60*60*24*7; - this->SyncHistoryCommand((HANDLE)wParam, timestamp); + this->SyncHistoryCommand((HCONTACT)wParam, timestamp); return 0; } @@ -266,7 +266,7 @@ int CSkypeProto::SyncLastMonthHistoryCommand(WPARAM wParam, LPARAM lParam) { time_t timestamp = time(NULL); timestamp -= 60*60*24*30; - this->SyncHistoryCommand((HANDLE)wParam, timestamp); + this->SyncHistoryCommand((HCONTACT)wParam, timestamp); return 0; } @@ -274,7 +274,7 @@ int CSkypeProto::SyncLast3MonthHistoryCommand(WPARAM wParam, LPARAM lParam) { time_t timestamp = time(NULL); timestamp -= 60*60*24*90; - this->SyncHistoryCommand((HANDLE)wParam, timestamp); + this->SyncHistoryCommand((HCONTACT)wParam, timestamp); return 0; } @@ -282,13 +282,13 @@ int CSkypeProto::SyncLastYearHistoryCommand(WPARAM wParam, LPARAM lParam) { time_t timestamp = time(NULL); timestamp -= 60*60*24*365; - this->SyncHistoryCommand((HANDLE)wParam, timestamp); + this->SyncHistoryCommand((HCONTACT)wParam, timestamp); return 0; } int CSkypeProto::SyncAllTimeHistoryCommand(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact) { ptrW sid( ::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)); @@ -312,4 +312,4 @@ int CSkypeProto::SyncAllTimeHistoryCommand(WPARAM wParam, LPARAM lParam) } } return 0; -} \ No newline at end of file +} diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp index bd59491c34..6c8cb4e96d 100644 --- a/protocols/Skype/src/skype_profile.cpp +++ b/protocols/Skype/src/skype_profile.cpp @@ -1,7 +1,7 @@ #include "skype.h" #include -void CSkypeProto::UpdateProfileAvatar(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileAvatar(SEObject *obj, HCONTACT hContact) { uint newTS = obj->GetUintProp(/* *::P_AVATAR_TIMESTAMP */ 182); //if (!newTS) return; //uncomment when skypekit will be work correctly @@ -50,7 +50,7 @@ void CSkypeProto::UpdateProfileAvatar(SEObject *obj, HANDLE hContact) } } -void CSkypeProto::UpdateProfileAboutText(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileAboutText(SEObject *obj, HCONTACT hContact) { ptrW aboutText(::mir_utf8decodeW(obj->GetStrProp(/* *::P_ABOUT */ 18))); if ( !::wcslen(aboutText)) @@ -59,7 +59,7 @@ void CSkypeProto::UpdateProfileAboutText(SEObject *obj, HANDLE hContact) this->setTString(hContact, "About", aboutText); } -void CSkypeProto::UpdateProfileBirthday(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileBirthday(SEObject *obj, HCONTACT hContact) { uint data = obj->GetUintProp(/* *::P_BIRTHDAY */ 7); if (data > 0) @@ -96,7 +96,7 @@ void CSkypeProto::UpdateProfileBirthday(SEObject *obj, HANDLE hContact) } } -void CSkypeProto::UpdateProfileCity(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileCity(SEObject *obj, HCONTACT hContact) { ptrW city(::mir_utf8decodeW(obj->GetStrProp(/* *::P_CITY */ 12))); if ( !::wcslen(city)) @@ -105,7 +105,7 @@ void CSkypeProto::UpdateProfileCity(SEObject *obj, HANDLE hContact) this->setTString(hContact, "City", city); } -void CSkypeProto::UpdateProfileCountry(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileCountry(SEObject *obj, HCONTACT hContact) { char *country; ptrA isocode(::mir_strdup(obj->GetStrProp(/* *::P_COUNTRY */ 10))); @@ -118,7 +118,7 @@ void CSkypeProto::UpdateProfileCountry(SEObject *obj, HANDLE hContact) } } -void CSkypeProto::UpdateProfileEmails(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileEmails(SEObject *obj, HCONTACT hContact) { ptrW emails(::mir_utf8decodeW(obj->GetStrProp(/* *::P_EMAILS */ 16))); if (::wcscmp(emails, L"") == 0) @@ -141,7 +141,7 @@ void CSkypeProto::UpdateProfileEmails(SEObject *obj, HANDLE hContact) } } -void CSkypeProto::UpdateProfileFullName(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileFullName(SEObject *obj, HCONTACT hContact) { ptrW fullname(::mir_utf8decodeW(obj->GetStrProp(/* *::P_FULLNAME */ 5))); if ( !::wcslen(fullname)) @@ -159,7 +159,7 @@ void CSkypeProto::UpdateProfileFullName(SEObject *obj, HANDLE hContact) } } -void CSkypeProto::UpdateProfileGender(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileGender(SEObject *obj, HCONTACT hContact) { uint data = obj->GetUintProp(/* *::P_GENDER */ 8); if (data) @@ -168,7 +168,7 @@ void CSkypeProto::UpdateProfileGender(SEObject *obj, HANDLE hContact) this->delSetting(hContact, "Gender"); } -void CSkypeProto::UpdateProfileHomepage(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileHomepage(SEObject *obj, HCONTACT hContact) { ptrW homepage(::mir_utf8decodeW(obj->GetStrProp(/* *::P_HOMEPAGE */ 17))); if (::wcscmp(homepage, L"") == 0) @@ -177,7 +177,7 @@ void CSkypeProto::UpdateProfileHomepage(SEObject *obj, HANDLE hContact) this->setTString(hContact, "Homepage", homepage); } -void CSkypeProto::UpdateProfileLanguages(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileLanguages(SEObject *obj, HCONTACT hContact) { ptrW isocodes(::mir_utf8decodeW(obj->GetStrProp(/* *::P_LANGUAGES */ 9))); @@ -199,7 +199,7 @@ void CSkypeProto::UpdateProfileLanguages(SEObject *obj, HANDLE hContact) } } -void CSkypeProto::UpdateProfileMobilePhone(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileMobilePhone(SEObject *obj, HCONTACT hContact) { ptrW phone(::mir_utf8decodeW(obj->GetStrProp(/* *::P_PHONE_MOBILE */ 15))); if ( !::wcslen(phone)) @@ -208,7 +208,7 @@ void CSkypeProto::UpdateProfileMobilePhone(SEObject *obj, HANDLE hContact) this->setTString(hContact, "Cellular", phone); } -void CSkypeProto::UpdateProfileNick(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileNick(SEObject *obj, HCONTACT hContact) { ptrW nick; if (hContact) @@ -225,7 +225,7 @@ void CSkypeProto::UpdateProfileNick(SEObject *obj, HANDLE hContact) this->setTString(hContact, "Nick", nick); } -void CSkypeProto::UpdateProfilePhone(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfilePhone(SEObject *obj, HCONTACT hContact) { ptrW phone(::mir_utf8decodeW(obj->GetStrProp(/* *::P_PHONE_MOBILE */ 13))); if ( !::wcslen(phone)) @@ -234,7 +234,7 @@ void CSkypeProto::UpdateProfilePhone(SEObject *obj, HANDLE hContact) this->setTString(hContact, "Phone", phone); } -void CSkypeProto::UpdateProfileOfficePhone(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileOfficePhone(SEObject *obj, HCONTACT hContact) { ptrW phone(::mir_utf8decodeW(obj->GetStrProp(/* *::P_PHONE_OFFICE */ 14))); if ( !::wcslen(phone)) @@ -243,7 +243,7 @@ void CSkypeProto::UpdateProfileOfficePhone(SEObject *obj, HANDLE hContact) this->setTString(hContact, "CompanyPhone", phone); } -void CSkypeProto::UpdateProfileState(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileState(SEObject *obj, HCONTACT hContact) { ptrW state(::mir_utf8decodeW(obj->GetStrProp(/* *::P_PROVINCE */ 11))); if ( !::wcslen(state)) @@ -252,7 +252,7 @@ void CSkypeProto::UpdateProfileState(SEObject *obj, HANDLE hContact) this->setTString(hContact, "State", state); } -void CSkypeProto::UpdateProfileStatusMessage(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileStatusMessage(SEObject *obj, HCONTACT hContact) { ptrW statusMessage(::mir_utf8decodeW(obj->GetStrProp(/* *::P_MOOD_TEXT */ 26))); if ( !::wcslen(statusMessage)) @@ -261,7 +261,7 @@ void CSkypeProto::UpdateProfileStatusMessage(SEObject *obj, HANDLE hContact) this->setTString(hContact, "XStatusMsg", statusMessage); } -void CSkypeProto::UpdateProfileTimezone(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfileTimezone(SEObject *obj, HCONTACT hContact) { LONG data = obj->GetUintProp(/* *::P_TIMEZONE */ 27); if (data > 0) @@ -286,7 +286,7 @@ void CSkypeProto::UpdateProfileTimezone(SEObject *obj, HANDLE hContact) else this->delSetting(hContact, "Timezone"); } -void CSkypeProto::UpdateProfile(SEObject *obj, HANDLE hContact) +void CSkypeProto::UpdateProfile(SEObject *obj, HCONTACT hContact) { this->debugLogW(L"Updating profile for %p", hContact); this->UpdateProfileAvatar(obj, hContact); diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index 8c9308d78c..27aed96317 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -79,7 +79,7 @@ int __cdecl CSkypeProto::Authorize(HANDLE hDbEvent) { if (this->IsOnline() && hDbEvent) { - HANDLE hContact = this->GetContactFromAuthEvent(hDbEvent); + HCONTACT hContact = this->GetContactFromAuthEvent(hDbEvent); if (hContact == INVALID_HANDLE_VALUE) return 1; @@ -93,7 +93,7 @@ int __cdecl CSkypeProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) { if (this->IsOnline()) { - HANDLE hContact = this->GetContactFromAuthEvent(hDbEvent); + HCONTACT hContact = this->GetContactFromAuthEvent(hDbEvent); if (hContact == INVALID_HANDLE_VALUE) return 1; @@ -103,7 +103,7 @@ int __cdecl CSkypeProto::AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) return 1; } -int __cdecl CSkypeProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) +int __cdecl CSkypeProto::AuthRecv(HCONTACT hContact, PROTORECVEVENT* pre) { DWORD flags = 0; @@ -124,7 +124,7 @@ int __cdecl CSkypeProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) return 0; } -int __cdecl CSkypeProto::AuthRequest(HANDLE hContact, const TCHAR* szMessage) +int __cdecl CSkypeProto::AuthRequest(HCONTACT hContact, const TCHAR* szMessage) { if (this->IsOnline() && hContact) { @@ -144,7 +144,7 @@ int __cdecl CSkypeProto::AuthRequest(HANDLE hContact, const TCHAR* szMessage) HANDLE __cdecl CSkypeProto::ChangeInfo( int iInfoType, void* pInfoData ) { return 0; } -HANDLE __cdecl CSkypeProto::FileAllow( HANDLE hContact, HANDLE hTransfer, const TCHAR* szPath ) +HANDLE __cdecl CSkypeProto::FileAllow(HCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath ) { uint oid = (uint)hTransfer; @@ -193,7 +193,7 @@ HANDLE __cdecl CSkypeProto::FileAllow( HANDLE hContact, HANDLE hTransfer, const return hTransfer; } -int __cdecl CSkypeProto::FileCancel( HANDLE hContact, HANDLE hTransfer ) +int __cdecl CSkypeProto::FileCancel(HCONTACT hContact, HANDLE hTransfer ) { uint oid = (uint)hTransfer; @@ -217,7 +217,7 @@ int __cdecl CSkypeProto::FileCancel( HANDLE hContact, HANDLE hTransfer ) return 1; } -int __cdecl CSkypeProto::FileDeny( HANDLE hContact, HANDLE hTransfer, const TCHAR* szReason ) +int __cdecl CSkypeProto::FileDeny(HCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason ) { uint oid = (uint)hTransfer; @@ -292,7 +292,7 @@ int __cdecl CSkypeProto::FileResume( HANDLE hTransfer, int* action, const TCH return 0; } -DWORD_PTR __cdecl CSkypeProto:: GetCaps(int type, HANDLE hContact) +DWORD_PTR __cdecl CSkypeProto:: GetCaps(int type, HCONTACT hContact) { switch(type) { @@ -318,7 +318,7 @@ DWORD_PTR __cdecl CSkypeProto:: GetCaps(int type, HANDLE hContact) } } -int __cdecl CSkypeProto::GetInfo( HANDLE hContact, int infoType ) { return 0; } +int __cdecl CSkypeProto::GetInfo(HCONTACT hContact, int infoType ) { return 0; } HANDLE __cdecl CSkypeProto::SearchBasic(const TCHAR* id) { @@ -358,7 +358,7 @@ HWND __cdecl CSkypeProto::SearchAdvanced( HWND owner ) { return 0; } HWND __cdecl CSkypeProto::CreateExtendedSearchUI( HWND owner ){ return 0; } -int __cdecl CSkypeProto::RecvContacts( HANDLE hContact, PROTORECVEVENT* pre) +int __cdecl CSkypeProto::RecvContacts(HCONTACT hContact, PROTORECVEVENT* pre) { this->debugLogW(L"Incoming contacts"); ::db_unset(hContact, "CList", "Hidden"); @@ -372,14 +372,14 @@ int __cdecl CSkypeProto::RecvContacts( HANDLE hContact, PROTORECVEVENT* pre) (PBYTE)pre->szMessage); } -int __cdecl CSkypeProto::RecvFile( HANDLE hContact, PROTORECVFILET* pre) +int __cdecl CSkypeProto::RecvFile(HCONTACT hContact, PROTORECVFILET* pre) { this->debugLogW(L"Incoming file transfer"); ::db_unset(hContact, "CList", "Hidden"); return ::Proto_RecvFile(hContact, pre); } -int __cdecl CSkypeProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) +int __cdecl CSkypeProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT* pre) { this->debugLogW(L"Incoming message"); ::db_unset(hContact, "CList", "Hidden"); @@ -401,9 +401,9 @@ int __cdecl CSkypeProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) (PBYTE)message); } -int __cdecl CSkypeProto::RecvUrl(HANDLE hContact, PROTORECVEVENT *) { return 0; } +int __cdecl CSkypeProto::RecvUrl(HCONTACT hContact, PROTORECVEVENT *) { return 0; } -int __cdecl CSkypeProto::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE *hContactsList) +int __cdecl CSkypeProto::SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) { if (this->IsOnline() && hContact && hContactsList) { @@ -454,7 +454,7 @@ int __cdecl CSkypeProto::SendContacts(HANDLE hContact, int flags, int nContacts, return 0; } -HANDLE __cdecl CSkypeProto::SendFile(HANDLE hContact, const TCHAR *szDescription, TCHAR **ppszFiles) +HANDLE __cdecl CSkypeProto::SendFile(HCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles) { if (this->IsOnline() && hContact && ppszFiles) { @@ -525,7 +525,7 @@ HANDLE __cdecl CSkypeProto::SendFile(HANDLE hContact, const TCHAR *szDescription return 0; } -int __cdecl CSkypeProto::SendMsg(HANDLE hContact, int flags, const char *msg) +int __cdecl CSkypeProto::SendMsg(HCONTACT hContact, int flags, const char *msg) { this->debugLogW(L"Outcoming message"); SEStringList targets; @@ -546,9 +546,9 @@ int __cdecl CSkypeProto::SendMsg(HANDLE hContact, int flags, const char *msg) return 0; } -int __cdecl CSkypeProto::SendUrl(HANDLE hContact, int flags, const char *url) { return 0; } +int __cdecl CSkypeProto::SendUrl(HCONTACT hContact, int flags, const char *url) { return 0; } -int __cdecl CSkypeProto::SetApparentMode(HANDLE hContact, int mode) { return 0; } +int __cdecl CSkypeProto::SetApparentMode(HCONTACT hContact, int mode) { return 0; } int CSkypeProto::SetStatus(int new_status) { @@ -613,11 +613,11 @@ int CSkypeProto::SetStatus(int new_status) return 0; } -HANDLE __cdecl CSkypeProto::GetAwayMsg(HANDLE hContact) { return 0; } -int __cdecl CSkypeProto::RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT *evt) { return 0; } +HANDLE __cdecl CSkypeProto::GetAwayMsg(HCONTACT hContact) { return 0; } +int __cdecl CSkypeProto::RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT *evt) { return 0; } int __cdecl CSkypeProto::SetAwayMsg(int m_iStatus, const TCHAR *msg) { return 0; } -int __cdecl CSkypeProto::UserIsTyping(HANDLE hContact, int type) +int __cdecl CSkypeProto::UserIsTyping(HCONTACT hContact, int type) { if (hContact && this->IsOnline() && this->m_iStatus != ID_STATUS_INVISIBLE) { diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 8534c395e1..761607c9c4 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -26,12 +26,12 @@ struct ContactParam struct BlockParam { - HANDLE hContact; + HCONTACT hContact; CSkypeProto *ppro; bool remove; bool abuse; - BlockParam(HANDLE hContact, CSkypeProto *ppro) : ppro(ppro) + BlockParam(HCONTACT hContact, CSkypeProto *ppro) : ppro(ppro) { this->hContact = hContact; } @@ -184,18 +184,18 @@ public: virtual int __cdecl Authorize( HANDLE hDbEvent ); virtual int __cdecl AuthDeny( HANDLE hDbEvent, const TCHAR* szReason ); - virtual int __cdecl AuthRecv( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl AuthRequest( HANDLE hContact, const TCHAR* szMessage ); + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl AuthRequest(HCONTACT hContact, const TCHAR* szMessage ); virtual HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData ); - virtual HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const TCHAR* szPath ); - virtual int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer ); - virtual int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const TCHAR* szReason ); + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath ); + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer ); + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason ); virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const TCHAR** szFilename ); - virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL ); - virtual int __cdecl GetInfo( HANDLE hContact, int infoType ); + virtual DWORD_PTR __cdecl GetCaps( int type, HCONTACT hContact = NULL ); + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType ); virtual HANDLE __cdecl SearchBasic( const TCHAR* id ); virtual HANDLE __cdecl SearchByEmail( const TCHAR* email ); @@ -203,24 +203,24 @@ public: virtual HWND __cdecl SearchAdvanced( HWND owner ); virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ); - virtual int __cdecl RecvContacts( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvFile( HANDLE hContact, PROTORECVFILET* ); - virtual int __cdecl RecvMsg( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvUrl( HANDLE hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvFile(HCONTACT hContact, PROTORECVFILET* ); + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT* ); - virtual int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ); - virtual HANDLE __cdecl SendFile( HANDLE hContact, const TCHAR* szDescription, TCHAR** ppszFiles ); - virtual int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg ); - virtual int __cdecl SendUrl( HANDLE hContact, int flags, const char* url ); + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList); + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles ); + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg ); + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url ); - virtual int __cdecl SetApparentMode( HANDLE hContact, int mode ); + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode ); virtual int __cdecl SetStatus( int iNewStatus ); - virtual HANDLE __cdecl GetAwayMsg( HANDLE hContact ); - virtual int __cdecl RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVENT* evt ); + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact ); + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt ); virtual int __cdecl SetAwayMsg( int m_iStatus, const TCHAR* msg ); - virtual int __cdecl UserIsTyping( HANDLE hContact, int type ); + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type ); virtual int __cdecl OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam ); @@ -228,7 +228,7 @@ public: static CSkypeProto* InitSkypeProto(const char* protoName, const wchar_t* userName); static int UninitSkypeProto(CSkypeProto* ppro); - static CSkypeProto* GetContactInstance(HANDLE hContact); + static CSkypeProto* GetContactInstance(HCONTACT hContact); static void UninitInstances(); // icons @@ -321,9 +321,9 @@ protected: INT_PTR __cdecl SetMyNickName(WPARAM, LPARAM); // avatars - bool IsAvatarChanged(const SEBinary &avatar, HANDLE hContact = NULL); + bool IsAvatarChanged(const SEBinary &avatar, HCONTACT hContact = NULL); - wchar_t* GetContactAvatarFilePath(HANDLE hContact); + wchar_t* GetContactAvatarFilePath(HCONTACT hContact); INT_PTR __cdecl GetAvatarInfo(WPARAM, LPARAM); INT_PTR __cdecl GetAvatarCaps(WPARAM, LPARAM); @@ -338,7 +338,7 @@ protected: void OnMessageReceived(const ConversationRef &conversation, const MessageRef &message); void SyncMessageHystory(const ConversationRef &conversation, const time_t timestamp); - void SyncHistoryCommand(HANDLE hContact, time_t timestamp); + void SyncHistoryCommand(HCONTACT hContact, time_t timestamp); int __cdecl SyncLastDayHistoryCommand(WPARAM wParam, LPARAM lParam); int __cdecl SyncLastWeekHistoryCommand(WPARAM wParam, LPARAM lParam); int __cdecl SyncLastMonthHistoryCommand(WPARAM wParam, LPARAM lParam); @@ -366,14 +366,14 @@ protected: void UpdateChatUserStatus(const ContactRef &contact); void UpdateChatUserNick(const ContactRef &contact); - void ChatValidateContact(HANDLE hItem, HWND hwndList, const StringList &contacts); - void ChatPrepare(HANDLE hItem, HWND hwndList, const StringList &contacts); + void ChatValidateContact(HCONTACT hItem, HWND hwndList, const StringList &contacts); + void ChatPrepare(HCONTACT hItem, HWND hwndList, const StringList &contacts); - void GetInvitedContacts(HANDLE hItem, HWND hwndList, StringList &invitedContacts); + void GetInvitedContacts(HCONTACT hItem, HWND hwndList, StringList &invitedContacts); void ChatRoomParseUriComands(const wchar_t *commands); - void ChatRoomInvite(HANDLE hContact); + void ChatRoomInvite(HCONTACT hContact); void CloseAllChatSessions(); @@ -391,11 +391,11 @@ protected: OBJLIST chatRooms; // contacts - void UpdateContactAuthState(HANDLE hContact, const ContactRef &contact); - void UpdateContactStatus(HANDLE hContact, const ContactRef &contact); - void UpdateContactClient(HANDLE hContact, const ContactRef &contact); - void UpdateContactOnlineSinceTime(HANDLE hContact, const ContactRef &contact); - void UpdateContactLastEventDate(HANDLE hContact, const ContactRef &contact); + void UpdateContactAuthState(HCONTACT hContact, const ContactRef &contact); + void UpdateContactStatus(HCONTACT hContact, const ContactRef &contact); + void UpdateContactClient(HCONTACT hContact, const ContactRef &contact); + void UpdateContactOnlineSinceTime(HCONTACT hContact, const ContactRef &contact); + void UpdateContactLastEventDate(HCONTACT hContact, const ContactRef &contact); void OnSearchCompleted(HANDLE hSearch); void OnContactFinded(CContact::Ref contact, HANDLE hSearch); @@ -403,12 +403,12 @@ protected: void OnContactChanged(const ContactRef &contact, int prop); void OnContactListChanged(const ContactRef &contact); - bool IsProtoContact(HANDLE hContact); - HANDLE GetContactBySid(const wchar_t* sid); - HANDLE GetContactFromAuthEvent(HANDLE hEvent); - HANDLE AddContact(CContact::Ref contact, bool isTemporary = false); + bool IsProtoContact(HCONTACT hContact); + HCONTACT GetContactBySid(const wchar_t* sid); + HCONTACT GetContactFromAuthEvent(HANDLE hEvent); + HCONTACT AddContact(CContact::Ref contact, bool isTemporary = false); - bool IsContactOnline(HANDLE hContact); + bool IsContactOnline(HCONTACT hContact); void SetAllContactStatus(int status); void __cdecl LoadContactList(void*); @@ -420,25 +420,25 @@ protected: void __cdecl SearchByEmailAsync(void*); // profile - void UpdateProfileAvatar(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileAboutText(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileBirthday(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileCity(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileCountry(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileEmails(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileFullName(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileGender(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileHomepage(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileLanguages(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileMobilePhone(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileNick(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfilePhone(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileOfficePhone(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileState(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileStatusMessage(SEObject *obj, HANDLE hContact = NULL); - void UpdateProfileTimezone(SEObject *obj, HANDLE hContact = NULL); - - void UpdateProfile(SEObject *obj, HANDLE hContact = NULL); + void UpdateProfileAvatar(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileAboutText(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileBirthday(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileCity(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileCountry(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileEmails(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileFullName(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileGender(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileHomepage(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileLanguages(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileMobilePhone(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileNick(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfilePhone(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileOfficePhone(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileState(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileStatusMessage(SEObject *obj, HCONTACT hContact = NULL); + void UpdateProfileTimezone(SEObject *obj, HCONTACT hContact = NULL); + + void UpdateProfile(SEObject *obj, HCONTACT hContact = NULL); void __cdecl LoadOwnInfo(void*); @@ -456,8 +456,8 @@ protected: static bool FileExists(wchar_t *path); - static void ShowNotification(const wchar_t *message, int flags = 0, HANDLE hContact = NULL); - static void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags = 0, HANDLE hContact = NULL); + static void ShowNotification(const wchar_t *message, int flags = 0, HCONTACT hContact = NULL); + static void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags = 0, HCONTACT hContact = NULL); static void CopyToClipboard(const wchar_t *text); @@ -472,7 +472,7 @@ protected: // int SendBroadcast(int type, int result, HANDLE hProcess, LPARAM lParam); - int SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam); + int SendBroadcast(HCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam); HANDLE CreateEvent(const char* szService); @@ -514,11 +514,11 @@ protected: static LRESULT CALLBACK SkypeBlockedOptionsSubProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); // database - bool IsMessageInDB(HANDLE hContact, DWORD timestamp, SEBinary &guid, int flag = 0); + bool IsMessageInDB(HCONTACT hContact, DWORD timestamp, SEBinary &guid, int flag = 0); - HANDLE AddDBEvent(HANDLE hContact, WORD type, DWORD time, DWORD flags = 0, DWORD cbBlob = 0, PBYTE pBlob = 0); + HANDLE AddDBEvent(HCONTACT hContact, WORD type, DWORD time, DWORD flags = 0, DWORD cbBlob = 0, PBYTE pBlob = 0); void RaiseMessageSentEvent( - HANDLE hContact, + HCONTACT hContact, DWORD timestamp, SEBinary &guid, const char *message, diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp index 27be882ada..e95287b65b 100644 --- a/protocols/Skype/src/skype_utils.cpp +++ b/protocols/Skype/src/skype_utils.cpp @@ -243,7 +243,7 @@ void CSkypeProto::InitLanguages() // --- -int CSkypeProto::SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam) +int CSkypeProto::SendBroadcast(HCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam) { return ::ProtoBroadcastAck(this->m_szModuleName, hContact, type, result, hProcess, lParam); } @@ -285,7 +285,7 @@ int CSkypeProto::SkypeToMirandaLoginError(CAccount::LOGOUTREASON logoutReason) return loginError; } -void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, HANDLE hContact) +void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, HCONTACT hContact) { if (::Miranda_Terminated()) return; @@ -305,7 +305,7 @@ void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *messag ::MessageBoxW(NULL, message, caption, MB_OK | flags); } -void CSkypeProto::ShowNotification(const wchar_t *message, int flags, HANDLE hContact) +void CSkypeProto::ShowNotification(const wchar_t *message, int flags, HCONTACT hContact) { CSkypeProto::ShowNotification(::TranslateT(MODULE), message, flags, hContact); } diff --git a/protocols/SkypeClassic/src/contacts.cpp b/protocols/SkypeClassic/src/contacts.cpp index ead7b9ffc8..127f962792 100644 --- a/protocols/SkypeClassic/src/contacts.cpp +++ b/protocols/SkypeClassic/src/contacts.cpp @@ -151,7 +151,7 @@ CLISTMENUITEM ChatInitItem(void) { return mi; } -HANDLE add_contextmenu(HANDLE hContact) { +HANDLE add_contextmenu(HCONTACT hContact) { CLISTMENUITEM mi; UNREFERENCED_PARAMETER(hContact); @@ -225,8 +225,8 @@ int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { if (!strcmp(szProto, SKYPE_PROTONAME)) { if (!HasVoiceService()) { - if (!db_get((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv)) { - if (db_get_b((HANDLE)wParam, SKYPE_PROTONAME, "OnHold", 0)) + if (!db_get((HCONTACT)wParam, SKYPE_PROTONAME, "CallId", &dbv)) { + if (db_get_b((HCONTACT)wParam, SKYPE_PROTONAME, "OnHold", 0)) mi=ResumeCallItem(); else mi=HoldCallItem(); mi.flags=CMIM_ALL; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuHoldCallItem,(LPARAM)&mi); @@ -237,7 +237,7 @@ int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { db_free(&dbv); } else { callAvailable = TRUE; hangupAvailable = FALSE; } - if (db_get_b((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoom", 0)!=0) { + if (db_get_b((HCONTACT)wParam, SKYPE_PROTONAME, "ChatRoom", 0)!=0) { callAvailable = FALSE; hangupAvailable = FALSE; } @@ -259,7 +259,7 @@ int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { // File sending and groupchat-creation works starting with protocol version 5 if (protocol>=5) { mi=FileTransferItem(); - if (db_get_b((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoom", 0)==0) + if (db_get_b((HCONTACT)wParam, SKYPE_PROTONAME, "ChatRoom", 0)==0) mi.flags ^= CMIF_HIDDEN; mi.flags |= CMIM_FLAGS; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuFileTransferItem,(LPARAM)&mi); @@ -268,19 +268,19 @@ int __cdecl PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { if (protocol>=5 || bIsImoproxy) { mi=ChatInitItem(); if (db_get_b(NULL, SKYPE_PROTONAME, "UseGroupchat", 0) && - db_get_b((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoom", 0)==0) + db_get_b((HCONTACT)wParam, SKYPE_PROTONAME, "ChatRoom", 0)==0) mi.flags ^= CMIF_HIDDEN; mi.flags |= CMIM_FLAGS; CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)(HANDLE)hMenuChatInitItem,(LPARAM)&mi); } } else if (bSkypeOut) { - if (!db_get((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv)) { + if (!db_get((HCONTACT)wParam, SKYPE_PROTONAME, "CallId", &dbv)) { mi=SkypeOutHupItem(); db_free(&dbv); } else { mi=SkypeOutCallItem(); - if(!db_get((HANDLE)wParam,"UserInfo","MyPhone0",&dbv)) { + if(!db_get((HCONTACT)wParam,"UserInfo","MyPhone0",&dbv)) { db_free(&dbv); mi.flags=0; } @@ -306,16 +306,15 @@ int ClistDblClick(WPARAM wParam, LPARAM lParam) { } */ -HANDLE find_contact(char *name) { - char *szProto; +HCONTACT find_contact(char *name) +{ int tCompareResult; - HANDLE hContact; DBVARIANT dbv; // already on list? - for (hContact=(HANDLE)db_find_first();hContact != NULL;hContact=db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact != NULL; hContact=db_find_next(hContact)) { - szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 ); + char *szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 ); if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) && db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==0) { if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue; @@ -327,16 +326,16 @@ HANDLE find_contact(char *name) { } return NULL; } -HANDLE find_contactT(TCHAR *name) { - char *szProto; + +HCONTACT find_contactT(TCHAR *name) +{ int tCompareResult; - HANDLE hContact; DBVARIANT dbv; // already on list? - for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) + for (HCONTACT hContact=db_find_first(); hContact != NULL; hContact=db_find_next(hContact)) { - szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 ); + char *szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 ); if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME) && db_get_b(hContact, SKYPE_PROTONAME, "ChatRoom", 0)==0) { if (db_get_ts(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) continue; @@ -350,8 +349,9 @@ HANDLE find_contactT(TCHAR *name) { } -HANDLE add_contact(char *name, DWORD flags) { - HANDLE hContact; +HCONTACT add_contact(char *name, DWORD flags) +{ + HCONTACT hContact; // already on list? if (hContact=find_contact(name)) { @@ -365,7 +365,7 @@ HANDLE add_contact(char *name, DWORD flags) { // no, so add LOG(("add_contact: Adding %s", name)); - hContact=(HANDLE)CallServiceSync(MS_DB_CONTACT_ADD, 0, 0); + hContact=(HCONTACT)CallServiceSync(MS_DB_CONTACT_ADD, 0, 0); if (hContact) { if (CallServiceSync(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact,(LPARAM)SKYPE_PROTONAME)!=0) { LOG(("add_contact: Ouch! MS_PROTO_ADDTOCONTACT failed for some reason")); @@ -387,7 +387,7 @@ HANDLE add_contact(char *name, DWORD flags) { } void logoff_contacts(BOOL bCleanup) { - HANDLE hContact; + HCONTACT hContact; char *szProto; DBVARIANT dbv={0}; diff --git a/protocols/SkypeClassic/src/contacts.h b/protocols/SkypeClassic/src/contacts.h index 35a400c3e9..1cc71571a5 100644 --- a/protocols/SkypeClassic/src/contacts.h +++ b/protocols/SkypeClassic/src/contacts.h @@ -1,11 +1,14 @@ // Prototypes -HANDLE add_contextmenu(HANDLE hContact); -HANDLE find_contact(char *name); -HANDLE find_contactT(TCHAR *name); -HANDLE add_contact(char *name, DWORD flags); +HANDLE add_contextmenu(HCONTACT hContact); HANDLE add_mainmenu(void); + +HCONTACT find_contact(char *name); +HCONTACT find_contactT(TCHAR *name); +HCONTACT add_contact(char *name, DWORD flags); + CLISTMENUITEM HupItem(void); CLISTMENUITEM CallItem(void); + void logoff_contacts(BOOL bCleanup); int PrebuildContactMenu(WPARAM, LPARAM); //int ClistDblClick(WPARAM, LPARAM); \ No newline at end of file diff --git a/protocols/SkypeClassic/src/gchat.cpp b/protocols/SkypeClassic/src/gchat.cpp index 0a1ea0441b..dd38a9d990 100644 --- a/protocols/SkypeClassic/src/gchat.cpp +++ b/protocols/SkypeClassic/src/gchat.cpp @@ -112,7 +112,7 @@ gchat_contact *GetChatContact(gchat_contacts *gc, const TCHAR *who) { static int AddChatContact(gchat_contacts *gc, char *who, TCHAR *pszRole) { int i = -2; - HANDLE hContact; + HCONTACT hContact; CONTACTINFO ci = {0}; TCHAR *twho; @@ -165,10 +165,10 @@ void RemChatContact(gchat_contacts *gc, const TCHAR *who) { } } -HANDLE find_chat(LPCTSTR chatname) { +HCONTACT find_chat(LPCTSTR chatname) { char *szProto; int tCompareResult; - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) { @@ -187,10 +187,10 @@ HANDLE find_chat(LPCTSTR chatname) { } #ifdef _UNICODE -HANDLE find_chatA(char *chatname) { +HCONTACT find_chatA(char *chatname) { char *szProto; int tCompareResult; - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) { @@ -479,7 +479,7 @@ void KillChatSession(GCDEST *gcd) void InviteUser(const TCHAR *szChatId) { HMENU tMenu = CreatePopupMenu(); - HANDLE hContact = db_find_first(), hInvitedUser; + HCONTACT hContact = db_find_first(), hInvitedUser; DBVARIANT dbv; HWND tWindow; POINT pt; @@ -516,7 +516,7 @@ void InviteUser(const TCHAR *szChatId) tWindow = CreateWindow(_T("EDIT"),_T(""),0,1,1,1,1,NULL,NULL,hInst,NULL); GetCursorPos (&pt); - hInvitedUser = (HANDLE)TrackPopupMenu(tMenu, TPM_NONOTIFY | TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, tWindow, NULL); + hInvitedUser = (HCONTACT)TrackPopupMenu(tMenu, TPM_NONOTIFY | TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, tWindow, NULL); DestroyMenu(tMenu); DestroyWindow(tWindow); @@ -527,7 +527,7 @@ void InviteUser(const TCHAR *szChatId) } -static void KickUser (HANDLE hContact, GCHOOK *gch) +static void KickUser (HCONTACT hContact, GCHOOK *gch) { char *ptr; @@ -566,7 +566,7 @@ static void KickUser (HANDLE hContact, GCHOOK *gch) void SetChatTopic(const TCHAR *szChatId, TCHAR *szTopic, BOOL bSet) { - HANDLE hContact = find_chat (szChatId); + HCONTACT hContact = find_chat (szChatId); char *szUTFTopic; GCDEST gcd = { SKYPE_PROTONAME, szChatId, GC_EVENT_TOPIC }; @@ -608,7 +608,7 @@ int GCEventHook(WPARAM wParam,LPARAM lParam) { switch (gch->pDest->iType) { case GC_SESSION_TERMINATE: { - HANDLE hContact; + HCONTACT hContact; if (gc->mJoinedCount == 1) { // switch back to normal session @@ -691,7 +691,7 @@ int GCEventHook(WPARAM wParam,LPARAM lParam) { InviteUser(gch->pDest->ptszID); break; case GC_USER_PRIVMESS: { - HANDLE hContact = find_contactT(gch->ptszUID); + HCONTACT hContact = find_contactT(gch->ptszUID); if (hContact) CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0); break; @@ -714,7 +714,7 @@ int GCEventHook(WPARAM wParam,LPARAM lParam) { } break; case GC_USER_NICKLISTMENU: { - HANDLE hContact = find_contactT(gch->ptszUID); + HCONTACT hContact = find_contactT(gch->ptszUID); switch(gch->dwData) { case 10:CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); break; @@ -821,7 +821,7 @@ int __cdecl GCMenuHook(WPARAM wParam,LPARAM lParam) { INT_PTR GCOnLeaveChat(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBVARIANT dbv; UNREFERENCED_PARAMETER(lParam); @@ -837,7 +837,7 @@ INT_PTR GCOnLeaveChat(WPARAM wParam,LPARAM lParam) INT_PTR GCOnJoinChat(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBVARIANT dbv; UNREFERENCED_PARAMETER(lParam); diff --git a/protocols/SkypeClassic/src/gchat.h b/protocols/SkypeClassic/src/gchat.h index 1b3cfcbe73..13ef26afe6 100644 --- a/protocols/SkypeClassic/src/gchat.h +++ b/protocols/SkypeClassic/src/gchat.h @@ -12,7 +12,7 @@ #define MAX_BUF 256 // Buffer for topic-string typedef struct { - HANDLE hContact; + HCONTACT hContact; TCHAR who[33]; TCHAR szRole[12]; } gchat_contact; @@ -26,9 +26,9 @@ typedef struct { int ChatInit(WPARAM, LPARAM); int __cdecl ChatStart(char *szChatId, BOOL bJustCreate); gchat_contacts *GetChat(LPCTSTR szChatId); -HANDLE find_chat(LPCTSTR chatname); +HCONTACT find_chat(LPCTSTR chatname); #ifdef _UNICODE -HANDLE find_chatA(char *chatname); +HCONTACT find_chatA(char *chatname); #else #define find_chatA find_chat #endif diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 20a75aaea5..49e0c528b7 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -123,7 +123,7 @@ typedef struct { } fetchmsg_arg; typedef struct { - HANDLE hContact; + HCONTACT hContact; char szId[16]; } msgsendwt_arg; @@ -266,7 +266,7 @@ int HookContactAdded(WPARAM wParam, LPARAM lParam) { szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 ); if (szProto!=NULL && !strcmp(szProto, SKYPE_PROTONAME)) - add_contextmenu((HANDLE)wParam); + add_contextmenu((HCONTACT)wParam); return 0; } @@ -280,7 +280,7 @@ int HookContactDeleted(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; int retval; - if (db_get_s((HANDLE)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return 1; + if (db_get_s((HCONTACT)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return 1; retval=SkypeSend("SET USER %s BUDDYSTATUS 1", dbv.pszVal); db_free(&dbv); if (retval) return 1; @@ -288,7 +288,8 @@ int HookContactDeleted(WPARAM wParam, LPARAM lParam) { return 0; } -void GetInfoThread(HANDLE hContact) { +void GetInfoThread(void *hContact) +{ DBVARIANT dbv; int i; char *ptr; @@ -301,10 +302,9 @@ void GetInfoThread(HANDLE hContact) { char *pszProps[] = { "BIRTHDAY", "COUNTRY", "SEX", "MOOD_TEXT", "TIMEZONE", "IS_VIDEO_CAPABLE"}; - LOG (("GetInfoThread started.")); EnterCriticalSection (&QueryThreadMutex); - if (db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) + if (db_get_s((HCONTACT)hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) { LOG (("GetInfoThread terminated, cannot find Skype Name for contact %08X.", hContact)); LeaveCriticalSection (&QueryThreadMutex); @@ -320,7 +320,7 @@ void GetInfoThread(HANDLE hContact) { if (ptr=SkypeGet ("USER", dbv.pszVal, "FULLNAME")) { if (*ptr && !bSetNick && db_get_b(NULL, SKYPE_PROTONAME, "ShowFullname", 1)) { // No Displayname and FULLNAME requested - db_set_utf(hContact, SKYPE_PROTONAME, "Nick", ptr); + db_set_utf((HCONTACT)hContact, SKYPE_PROTONAME, "Nick", ptr); bSetNick = TRUE; } free (ptr); @@ -328,7 +328,7 @@ void GetInfoThread(HANDLE hContact) { if (!bSetNick) { // Still no nick set, so use SKYPE Nickname - db_set_s(hContact, SKYPE_PROTONAME, "Nick", dbv.pszVal); + db_set_s((HCONTACT)hContact, SKYPE_PROTONAME, "Nick", dbv.pszVal); } @@ -345,7 +345,7 @@ void GetInfoThread(HANDLE hContact) { ACKDATA ack = {0}; ack.cbSize = sizeof( ACKDATA ); ack.szModule = SKYPE_PROTONAME; - ack.hContact = hContact; + ack.hContact = (HCONTACT)hContact; ack.type = ACKTYPE_AVATAR; ack.result = ACKRESULT_STATUS; @@ -359,13 +359,14 @@ void GetInfoThread(HANDLE hContact) { if (ptr=SkypeGet ("USER", dbv.pszVal, m_settings[i].SkypeSetting)) free (ptr); } - ProtoBroadcastAck(SKYPE_PROTONAME, hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0); + ProtoBroadcastAck(SKYPE_PROTONAME, (HCONTACT)hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0); LeaveCriticalSection(&QueryThreadMutex); db_free(&dbv); LOG (("GetInfoThread terminated gracefully.")); } -time_t SkypeTime(time_t *timer) { +time_t SkypeTime(time_t *timer) +{ struct _timeb tb; EnterCriticalSection (&TimeMutex); @@ -448,11 +449,11 @@ INT_PTR ImportHistory(WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); - if (db_get_b((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoom", 0)) { - if (db_get_s((HANDLE)wParam, SKYPE_PROTONAME, "ChatRoomID", &dbv)) return 0; + if (db_get_b((HCONTACT)wParam, SKYPE_PROTONAME, "ChatRoom", 0)) { + if (db_get_s((HCONTACT)wParam, SKYPE_PROTONAME, "ChatRoomID", &dbv)) return 0; SkypeSend ("GET CHAT %s CHATMESSAGES", dbv.pszVal); } else { - if (db_get_s((HANDLE)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return 0; + if (db_get_s((HCONTACT)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return 0; SkypeSend("SEARCH %sS %s", cmdMessage, dbv.pszVal); } db_free(&dbv); @@ -500,7 +501,7 @@ void __cdecl SearchUsersWaitingMyAuthorization(void *dummy) { while (token) { CCSDATA ccs={0}; PROTORECVEVENT pre={0}; - HANDLE hContact; + HCONTACT hContact; char *firstname=NULL, *lastname=NULL, *pCurBlob; LOG(("Awaiting auth: %s", token)); @@ -512,7 +513,7 @@ void __cdecl SearchUsersWaitingMyAuthorization(void *dummy) { pre.timestamp=(DWORD)SkypeTime(NULL); /* blob is: */ - //DWORD protocolSpecific HANDLE hContact + //DWORD protocolSpecific HCONTACT hContact //ASCIIZ nick, firstName, lastName, e-mail, requestReason if (firstname=SkypeGet("USER", token, "FULLNAME")) if (lastname=strchr(firstname, ' ')) { @@ -869,9 +870,10 @@ void FetchMessageThread(fetchmsg_arg *pargs) { char *ptr, *msgptr, szPartnerHandle[32], szBuf[128]; int direction=0, msglen = 0; DWORD timestamp = 0, lwr=0; - CCSDATA ccs={0}; - PROTORECVEVENT pre={0}; - HANDLE hContact = NULL, hDbEvent, hChat = NULL; + CCSDATA ccs={0}; + PROTORECVEVENT pre={0}; + HCONTACT hContact = NULL, hChat = NULL; + HANDLE hDbEvent; DBEVENTINFO dbei={0}; DBVARIANT dbv={0}; fetchmsg_arg args; @@ -1033,7 +1035,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { free_nonutf_tchar_string((void*)gcd.ptszID); if (!args.bDontMarkSeen) { - MsgList_Add (pre.lParam, INVALID_HANDLE_VALUE); + MsgList_Add(pre.lParam, INVALID_HANDLE_VALUE); SkypeSend("SET %s %s SEEN", cmdMessage, args.msgnum); } __leave; @@ -1271,7 +1273,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { // Check if the timestamp is valid dbei.cbSize=sizeof(dbei); dbei.cbBlob=0; - if (hDbEvent=db_event_first(hContact)) { + if (hDbEvent = db_event_first(hContact)) { db_event_get(hDbEvent,&dbei); lwr=dbei.timestamp; } @@ -1306,7 +1308,7 @@ void FetchMessageThread(fetchmsg_arg *pargs) { if (db_get_b(hContact, "MetaContacts", "IsSubcontact", 0)) { DWORD dwMetaLink = db_get_dw(hContact, "MetaContacts", "MetaLink", MAXDWORD); - HANDLE hMetaContact; + HCONTACT hMetaContact; if (dwMetaLink != MAXDWORD && (hMetaContact = GetMetaHandle(dwMetaLink))) { @@ -1361,8 +1363,8 @@ void FetchMessageThreadSync(fetchmsg_arg *pargs) { /* if (pargs->bIsRead && pMsgEvent->hEvent != INVALID_HANDLE_VALUE) { - HANDLE hContact; - if ((int)(hContact = (HANDLE)CallService (MS_DB_EVENT_GETCONTACT, (WPARAM)pMsgEntry->hEvent, 0)) != -1) + HCONTACT hContact; + if ((int)(hContact = (HCONTACT)CallService (MS_DB_EVENT_GETCONTACT, (WPARAM)pMsgEntry->hEvent, 0)) != -1) CallService (MS_DB_EVENT_MARKREAD, (WPARAM)hContact, (LPARAM)hDBEvent); } */ @@ -1416,9 +1418,10 @@ char *GetCallerHandle(char *szSkypeMsg) { } -HANDLE GetCallerContact(char *szSkypeMsg) { +HCONTACT GetCallerContact(char *szSkypeMsg) +{ char *szHandle; - HANDLE hContact=NULL; + HCONTACT hContact=NULL; if (!(szHandle=GetCallerHandle(szSkypeMsg))) return NULL; if (!(hContact=find_contact(szHandle))) { @@ -1438,17 +1441,15 @@ HANDLE GetCallerContact(char *szSkypeMsg) { return hContact; } -HANDLE GetMetaHandle(DWORD dwId) { - HANDLE hContact; - char *szProto; - - for (hContact=db_find_first();hContact != NULL;hContact=db_find_next(hContact)) { - szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 ); +HCONTACT GetMetaHandle(DWORD dwId) +{ + for (HCONTACT hContact=db_find_first(); hContact != NULL; hContact=db_find_next(hContact)) { + char *szProto = (char*)CallService( MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0 ); if (szProto!=NULL && !strcmp(szProto, "MetaContacts") && db_get_dw(hContact, "MetaContacts", "MetaID", MAXDWORD)==dwId) - return hContact; - } - return 0; + return hContact; + } + return 0; } LRESULT CALLBACK InCallPopUpProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) @@ -1476,7 +1477,7 @@ LRESULT CALLBACK InCallPopUpProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) } void RingThread(char *szSkypeMsg) { - HANDLE hContact; + HCONTACT hContact; DBEVENTINFO dbei={0}; DBVARIANT dbv; char *ptr = NULL; @@ -1604,7 +1605,8 @@ l_exitRT: } void EndCallThread(char *szSkypeMsg) { - HANDLE hContact=NULL, hDbEvent; + HCONTACT hContact=NULL; + HANDLE hDbEvent; DBEVENTINFO dbei={0}; DBVARIANT dbv; int tCompareResult; @@ -1640,7 +1642,7 @@ void EndCallThread(char *szSkypeMsg) { if (!HasVoiceService()) { dbei.cbSize=sizeof(dbei); - hDbEvent=db_event_firstUnread(hContact); + hDbEvent = db_event_firstUnread(hContact); while(hDbEvent) { dbei.cbBlob=0; db_event_get(hDbEvent, &dbei); @@ -1666,7 +1668,7 @@ void EndCallThread(char *szSkypeMsg) { } void HoldCallThread(char *szSkypeMsg) { - HANDLE hContact; + HCONTACT hContact; LOG(("HoldCallThread started")); if (!szSkypeMsg) { @@ -1682,7 +1684,7 @@ void HoldCallThread(char *szSkypeMsg) { } void ResumeCallThread(char *szSkypeMsg) { - HANDLE hContact; + HCONTACT hContact; LOG(("ResumeCallThread started")); if (!szSkypeMsg) { @@ -1740,7 +1742,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) static char *onlinestatus=NULL; static BOOL RestoreUserStatus=FALSE; int sstat, oldstatus, flag; - HANDLE hContact; + HCONTACT hContact; fetchmsg_arg *args; static int iReentranceCnt = 0; @@ -2088,7 +2090,7 @@ LONG APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) } else if (strncmp(ptr, " FRIENDLYNAME ", 14) == 0) { // Chat session name - HANDLE hContact; + HCONTACT hContact; *ptr=0; if (hContact = find_chatA(szSkypeMsg+5)) @@ -2356,7 +2358,7 @@ INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam) return iRet; } -int __stdcall SendBroadcast( HANDLE 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 ); @@ -2369,14 +2371,14 @@ int __stdcall SendBroadcast( HANDLE hContact, int type, int result, HANDLE hProc return CallService( MS_PROTO_BROADCASTACK, 0, ( LPARAM )&ack ); } -static void __cdecl SkypeGetAwayMessageThread( HANDLE hContact ) +static void __cdecl SkypeGetAwayMessageThread(void *hContact) { DBVARIANT dbv; - if ( !db_get_ts( hContact, "CList", "StatusMsg", &dbv )) { - SendBroadcast( hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, ( HANDLE )1, ( LPARAM )dbv.ptszVal ); + if (!db_get_ts((HCONTACT)hContact, "CList", "StatusMsg", &dbv )) { + SendBroadcast((HCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, ( HANDLE )1, ( LPARAM )dbv.ptszVal ); db_free( &dbv ); } - else SendBroadcast( hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, ( HANDLE )1, ( LPARAM )0 ); + else SendBroadcast((HCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, ( HANDLE )1, ( LPARAM )0 ); } INT_PTR SkypeGetAwayMessage(WPARAM wParam,LPARAM lParam) @@ -2385,7 +2387,7 @@ INT_PTR SkypeGetAwayMessage(WPARAM wParam,LPARAM lParam) UNREFERENCED_PARAMETER(wParam); - pthread_create( SkypeGetAwayMessageThread, ccs->hContact ); + pthread_create(SkypeGetAwayMessageThread, ccs->hContact); return 1; } @@ -2447,7 +2449,8 @@ static int _GetFileSize(char* filename) */ void RetrieveUserAvatar(void *param) { - HANDLE hContact = (HANDLE) param, file; + HCONTACT hContact = (HCONTACT) param; + HANDLE file; PROTO_AVATAR_INFORMATION AI={0}; ACKDATA ack = {0}; DBVARIANT dbv; @@ -2774,7 +2777,7 @@ INT_PTR SkypeRecvMessage(WPARAM wParam, LPARAM lParam) INT_PTR SkypeUserIsTyping(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv={0}; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (protocol<5 && !bIsImoproxy) return 0; if (db_get_s(hContact, SKYPE_PROTONAME, "Typing_Stream", &dbv)) { @@ -2890,7 +2893,7 @@ INT_PTR SkypeAddToListByEvent(WPARAM wParam, LPARAM lParam) { if (pBlob=__skypeauth(wParam)) { - HANDLE hContact=add_contact(pBlob+sizeof(DWORD)+sizeof(HANDLE), LOWORD(wParam)); + HCONTACT hContact=add_contact(pBlob+sizeof(DWORD)+sizeof(HANDLE), LOWORD(wParam)); free(pBlob); if (hContact) return (int)hContact; } @@ -2911,7 +2914,7 @@ INT_PTR SkypeRegisterProxy(WPARAM wParam, LPARAM lParam) { void CleanupNicknames(char *dummy) { - HANDLE hContact; + HCONTACT hContact; char *szProto; DBVARIANT dbv, dbv2; @@ -3011,7 +3014,7 @@ int EnumOldPluginName(const char *szSetting,LPARAM lParam) // 0 --> No int AnySkypeusers(void) { - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; int tCompareResult; @@ -3036,7 +3039,7 @@ int AnySkypeusers(void) DBCONTACTENUMSETTINGS cns; DBCONTACTWRITESETTING cws; DBVARIANT dbv; - HANDLE hContact=NULL; + HCONTACT hContact=NULL; struct PLUGINDI pdi; LOG(("Updating old database settings if there are any...")); diff --git a/protocols/SkypeClassic/src/skype.h b/protocols/SkypeClassic/src/skype.h index 3c7fd2b927..83021b91c6 100644 --- a/protocols/SkypeClassic/src/skype.h +++ b/protocols/SkypeClassic/src/skype.h @@ -140,7 +140,7 @@ int ShowMessageA(int iconID, char *lpzText, int mustShow); #define ShowMessageA ShowMessage #endif void EndCallThread(char *); -void GetInfoThread(HANDLE); +void GetInfoThread(void *); int OnDetailsInit( WPARAM, LPARAM ); INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam); INT_PTR SkypeGetAvatarCaps(WPARAM wParam,LPARAM lParam); @@ -172,7 +172,7 @@ int __stdcall EnterBitmapFileName( char* szDest ); void CleanupNicknames(char *dummy); int InitVSApi(); int FreeVSApi(); -HANDLE GetMetaHandle(DWORD dwId); +HCONTACT GetMetaHandle(DWORD dwId); void LaunchSkypeAndSetStatusThread(void *newStatus); // Structs diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp index c7d8ab8010..84e886b61a 100644 --- a/protocols/SkypeClassic/src/skypeapi.cpp +++ b/protocols/SkypeClassic/src/skypeapi.cpp @@ -413,7 +413,7 @@ char *SkypeRcv(char *what, DWORD maxwait) return SkypeRcvTime(what, 0, maxwait); } -char *SkypeRcvMsg(char *what, time_t st, HANDLE hContact, DWORD maxwait) +char *SkypeRcvMsg(char *what, time_t st, HCONTACT hContact, DWORD maxwait) { char *msg, msgid[32]={0}, *pMsg, *pCurMsg; struct MsgQueue *ptr; @@ -612,10 +612,10 @@ INT_PTR SkypeCall(WPARAM wParam, LPARAM lParam) { char *msg=0; int res; - if (!db_get_s((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv)) { + if (!db_get_s((HCONTACT)wParam, SKYPE_PROTONAME, "CallId", &dbv)) { res = -1; // no direct return, because dbv needs to be freed } else { - if (db_get_s((HANDLE)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1; + if (db_get_s((HCONTACT)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1; msg=(char *)malloc(strlen(dbv.pszVal)+6); strcpy(msg, "CALL "); strcat(msg, dbv.pszVal); @@ -644,13 +644,13 @@ INT_PTR SkypeCallHangup(WPARAM wParam, LPARAM lParam) char *msg=0; int res = -1; - if (!db_get_s((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv)) { + if (!db_get_s((HCONTACT)wParam, SKYPE_PROTONAME, "CallId", &dbv)) { msg=(char *)malloc(strlen(dbv.pszVal)+21); sprintf(msg, "SET %s STATUS FINISHED", dbv.pszVal); //sprintf(msg, "ALTER CALL %s HANGUP", dbv.pszVal); res=SkypeSend(msg); #if _DEBUG - db_unset((HANDLE)wParam, SKYPE_PROTONAME, "CallId"); + db_unset((HCONTACT)wParam, SKYPE_PROTONAME, "CallId"); #endif //} else { // if (db_get((HANDLE)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1; @@ -686,14 +686,14 @@ static void FixNumber(char *p) { * Purpose: Dialog procedure for the Dial-Dialog */ static INT_PTR CALLBACK DialDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static HANDLE hContact; + static HCONTACT hContact; static unsigned int entries=0; BOOL TempAdded=FALSE; char number[64], *msg, *ptr=NULL; switch (uMsg){ case WM_INITDIALOG: - hContact=(HANDLE)lParam; + hContact=(HCONTACT)lParam; Utils_RestoreWindowPosition(hwndDlg, NULL, SKYPE_PROTONAME, "DIALdlg"); TranslateDialogDefault(hwndDlg); @@ -810,10 +810,10 @@ static INT_PTR CALLBACK CallstatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, switch (uMsg){ case WM_INITDIALOG: { - HANDLE hContact; + HCONTACT hContact; char *szProto; - if (!db_get_s((HANDLE)lParam, SKYPE_PROTONAME, "CallId", &dbv)) { + 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)) { @@ -928,7 +928,7 @@ INT_PTR SkypeOutCall(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; int res = -1; - if (wParam && !db_get_s((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv)) { + if (wParam && !db_get_s((HCONTACT)wParam, SKYPE_PROTONAME, "CallId", &dbv)) { res=SkypeSend("SET %s STATUS FINISHED", dbv.pszVal); pthread_create(( pThreadFunc )SkypeOutCallErrorCheck, _strdup(dbv.pszVal)); db_free(&dbv); @@ -948,10 +948,10 @@ INT_PTR SkypeHoldCall(WPARAM wParam, LPARAM lParam) { int retval; LOG(("SkypeHoldCall started")); - if (!wParam || db_get_s((HANDLE)wParam, SKYPE_PROTONAME, "CallId", &dbv)) + if (!wParam || db_get_s((HCONTACT)wParam, SKYPE_PROTONAME, "CallId", &dbv)) return -1; retval = SkypeSend ("SET %s STATUS %s", dbv.pszVal, - db_get_b((HANDLE)wParam, SKYPE_PROTONAME, "OnHold", 0)?"INPROGRESS":"ONHOLD"); + db_get_b((HCONTACT)wParam, SKYPE_PROTONAME, "OnHold", 0)?"INPROGRESS":"ONHOLD"); db_free(&dbv); return retval; } @@ -1146,7 +1146,7 @@ INT_PTR SkypeSendFile(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; int retval; - if (!wParam || db_get_s((HANDLE)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) + if (!wParam || db_get_s((HCONTACT)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1; retval=SkypeSend("OPEN FILETRANSFER %s", dbv.pszVal); db_free(&dbv); @@ -1163,7 +1163,7 @@ INT_PTR SkypeSendFile(WPARAM wParam, LPARAM lParam) { */ INT_PTR SkypeChatCreate(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; - HANDLE hContact=(HANDLE)wParam; + HCONTACT hContact=(HCONTACT)wParam; char *ptr, *ptr2; if (!hContact || db_get_s(hContact, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) diff --git a/protocols/SkypeClassic/src/skypeapi.h b/protocols/SkypeClassic/src/skypeapi.h index fa4f5139a1..0d3f661dcb 100644 --- a/protocols/SkypeClassic/src/skypeapi.h +++ b/protocols/SkypeClassic/src/skypeapi.h @@ -28,7 +28,7 @@ char *SkypeMsgGet(void); int SkypeSend(char*, ...); char *SkypeRcv(char *what, DWORD maxwait); char *SkypeRcvTime(char *what, time_t st, DWORD maxwait); -char *SkypeRcvMsg(char *what, time_t st, HANDLE hContact, DWORD maxwait); +char *SkypeRcvMsg(char *what, time_t st, HCONTACT hContact, DWORD maxwait); INT_PTR SkypeCall(WPARAM wParam, LPARAM lParam); INT_PTR SkypeCallHangup(WPARAM wParam, LPARAM lParam); INT_PTR SkypeOutCall(WPARAM wParam, LPARAM lParam); diff --git a/protocols/SkypeClassic/src/skypeopt.cpp b/protocols/SkypeClassic/src/skypeopt.cpp index 75b90967f2..8b90c78780 100644 --- a/protocols/SkypeClassic/src/skypeopt.cpp +++ b/protocols/SkypeClassic/src/skypeopt.cpp @@ -159,7 +159,7 @@ INT_PTR CALLBACK OptPopupDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar { case IDC_PREVIEW: { - HANDLE hContact; + HCONTACT hContact; TCHAR * lpzContactName; hContact = db_find_first(); @@ -750,7 +750,7 @@ INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L int OnDetailsInit( WPARAM wParam, LPARAM lParam ) { OPTIONSDIALOGPAGE odp = {0}; - HANDLE hContact = ( HANDLE )lParam; + HCONTACT hContact = (HCONTACT)lParam; odp.cbSize = sizeof(odp); odp.hIcon = NULL; diff --git a/protocols/SkypeClassic/src/voiceservice.cpp b/protocols/SkypeClassic/src/voiceservice.cpp index 2a22bbe86c..11b1f1becd 100644 --- a/protocols/SkypeClassic/src/voiceservice.cpp +++ b/protocols/SkypeClassic/src/voiceservice.cpp @@ -20,7 +20,7 @@ BOOL HasVoiceService() return has_voice_service; } -void NofifyVoiceService(HANDLE hContact, char *callId, int state) +void NofifyVoiceService(HCONTACT hContact, char *callId, int state) { VOICE_CALL vc = {0}; vc.cbSize = sizeof(vc); @@ -42,7 +42,7 @@ static INT_PTR VoiceGetInfo(WPARAM wParam, LPARAM lParam) static HANDLE FindContactByCallId(char *callId) { - HANDLE hContact; + HCONTACT hContact; int iCmpRes; for (hContact = db_find_first(); hContact != NULL; @@ -73,7 +73,7 @@ static INT_PTR VoiceCall(WPARAM wParam, LPARAM lParam) if (!wParam) return -1; - if (db_get_s((HANDLE)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) + if (db_get_s((HCONTACT)wParam, SKYPE_PROTONAME, SKYPE_NAME, &dbv)) return -1; SkypeSend("CALL %s", dbv.pszVal); diff --git a/protocols/SkypeClassic/src/voiceservice.h b/protocols/SkypeClassic/src/voiceservice.h index 0ffbd6d9ca..fce03545d2 100644 --- a/protocols/SkypeClassic/src/voiceservice.h +++ b/protocols/SkypeClassic/src/voiceservice.h @@ -10,7 +10,7 @@ BOOL HasVoiceService(); void VoiceServiceInit(); void VoiceServiceExit(); void VoiceServiceModulesLoaded(); -void NofifyVoiceService(HANDLE hContact, char *callId, int state) ; +void NofifyVoiceService(HCONTACT hContact, char *callId, int state) ; diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index 0bf2926e3e..377d52f43c 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -114,7 +114,7 @@ static void TlenRegisterIcons() int TlenProtocol::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact != NULL && isOnline) { DBVARIANT dbv; if (!db_get(hContact, m_szModuleName, "jid", &dbv)) { @@ -140,7 +140,7 @@ int TlenProtocol::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) INT_PTR TlenProtocol::ContactMenuHandleRequestAuth(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact != NULL && isOnline) { DBVARIANT dbv; if (!db_get(hContact, m_szModuleName, "jid", &dbv)) { @@ -153,7 +153,7 @@ INT_PTR TlenProtocol::ContactMenuHandleRequestAuth(WPARAM wParam, LPARAM lParam) INT_PTR TlenProtocol::ContactMenuHandleGrantAuth(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact != NULL && isOnline) { DBVARIANT dbv; if (!db_get(hContact, m_szModuleName, "jid", &dbv)) { @@ -166,7 +166,7 @@ INT_PTR TlenProtocol::ContactMenuHandleGrantAuth(WPARAM wParam, LPARAM lParam) INT_PTR TlenProtocol::ContactMenuHandleSendPicture(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact != NULL && isOnline) SendPicture(this, hContact); @@ -241,7 +241,7 @@ int TlenProtocol::OnModulesLoaded(WPARAM wParam, LPARAM lParam) char str[128]; /* Set all contacts to offline */ - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) if (db_get_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) db_set_w(hContact, m_szModuleName, "Status", ID_STATUS_OFFLINE); diff --git a/protocols/Tlen/src/tlen.h b/protocols/Tlen/src/tlen.h index 9748f47742..e9ad52b64a 100644 --- a/protocols/Tlen/src/tlen.h +++ b/protocols/Tlen/src/tlen.h @@ -223,18 +223,18 @@ struct TlenProtocol : public PROTO virtual int __cdecl Authorize(HANDLE hDbEvent); virtual int __cdecl AuthDeny(HANDLE hDbEvent, const PROTOCHAR* szReason); - virtual int __cdecl AuthRecv(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl AuthRequest(HANDLE hContact, const PROTOCHAR* szMessage); + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl AuthRequest(HCONTACT hContact, const PROTOCHAR* szMessage); virtual HANDLE __cdecl ChangeInfo(int iInfoType, void* pInfoData); - virtual HANDLE __cdecl FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath); - virtual int __cdecl FileCancel(HANDLE hContact, HANDLE hTransfer); - virtual int __cdecl FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason); + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath); + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer); + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason); virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** szFilename); - virtual DWORD_PTR __cdecl GetCaps(int type, HANDLE hContact = NULL); - virtual int __cdecl GetInfo(HANDLE hContact, int infoType); + virtual DWORD_PTR __cdecl GetCaps(int type, HCONTACT hContact = NULL); + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType); virtual HANDLE __cdecl SearchBasic(const PROTOCHAR* id); virtual HANDLE __cdecl SearchByEmail(const PROTOCHAR* email); @@ -242,24 +242,24 @@ struct TlenProtocol : public PROTO virtual HWND __cdecl SearchAdvanced(HWND owner); virtual HWND __cdecl CreateExtendedSearchUI(HWND owner); - virtual int __cdecl RecvContacts(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl RecvFile(HANDLE hContact, PROTOFILEEVENT*); - virtual int __cdecl RecvMsg(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl RecvUrl(HANDLE hContact, PROTORECVEVENT*); + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvFile(HCONTACT hContact, PROTOFILEEVENT*); + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT*); - virtual int __cdecl SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList); - virtual HANDLE __cdecl SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles); - virtual int __cdecl SendMsg(HANDLE hContact, int flags, const char* msg); - virtual int __cdecl SendUrl(HANDLE hContact, int flags, const char* url); + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList); + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles); + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg); + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url); - virtual int __cdecl SetApparentMode(HANDLE hContact, int mode); + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode); virtual int __cdecl SetStatus(int iNewStatus); - virtual HANDLE __cdecl GetAwayMsg(HANDLE hContact); - virtual int __cdecl RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT* evt); + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact); + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt); virtual int __cdecl SetAwayMsg(int iStatus, const PROTOCHAR* msg); - virtual int __cdecl UserIsTyping(HANDLE hContact, int type); + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type); virtual int __cdecl OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam); @@ -381,7 +381,7 @@ typedef struct ThreadDataStruct{ typedef enum { FT_CONNECTING, FT_INITIALIZING, FT_RECEIVING, FT_DONE, FT_ERROR, FT_DENIED, FT_SWITCH } TLEN_FILE_STATE; typedef enum { FT_RECV, FT_SEND} TLEN_FILE_MODE; typedef struct TLEN_FILE_TRANSFER_STRUCT{ - HANDLE hContact; + HCONTACT hContact; HANDLE s; NETLIBNEWCONNECTIONPROC_V2 pfnNewConnectionV2; TLEN_FILE_STATE state; @@ -466,8 +466,8 @@ void TlenSerialInit(TlenProtocol *proto); void TlenSerialUninit(TlenProtocol *proto); unsigned int TlenSerialNext(TlenProtocol *proto); int TlenSend(TlenProtocol *proto, const char *fmt, ...); -HANDLE TlenHContactFromJID(TlenProtocol *proto, const char *jid); -char *TlenJIDFromHContact(TlenProtocol *proto, HANDLE hContact); +HCONTACT TlenHContactFromJID(TlenProtocol *proto, const char *jid); +char *TlenJIDFromHContact(TlenProtocol *proto, HCONTACT hContact); char *TlenLoginFromJID(const char *jid); char *TlenResourceFromJID(const char *jid); char *TlenNickFromJID(const char *jid); @@ -481,7 +481,7 @@ void TlenUrlDecode(char *str); char *TlenUrlEncode(const char *str); char *TlenTextEncode(const char *str); char *TlenTextDecode(const char *str); -void TlenLogMessage(TlenProtocol *proto, HANDLE hContact, DWORD flags, const char *message); +void TlenLogMessage(TlenProtocol *proto, HCONTACT hContact, DWORD flags, const char *message); BOOL IsAuthorized(TlenProtocol *proto, const char *jid); //char *TlenGetVersionText(); time_t TlenIsoToUnixTime(char *stamp); @@ -490,9 +490,9 @@ void TlenSendPresence(TlenProtocol *proto,int status); void TlenStringAppend(char **str, int *sizeAlloced, const char *fmt, ...); //char *TlenGetClientJID(char *jid); // tlen_misc.cpp -void TlenDBAddEvent(TlenProtocol *proto, HANDLE hContact, int eventType, DWORD flags, PBYTE pBlob, DWORD cbBlob); +void TlenDBAddEvent(TlenProtocol *proto, HCONTACT hContact, int eventType, DWORD flags, PBYTE pBlob, DWORD cbBlob); void TlenDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick); -HANDLE TlenDBCreateContact(TlenProtocol *proto, char *jid, char *nick, BOOL temporary); +HCONTACT TlenDBCreateContact(TlenProtocol *proto, char *jid, char *nick, BOOL temporary); // tlen_svc.cpp int TlenRunSearch(TlenProtocol *proto); // tlen_opt.cpp diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index aea83f9804..f413b277ec 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -64,7 +64,7 @@ void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, TCHAR* pts mir_sntprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S_avatar%s"), proto->m_szModuleName, tszFileType); } -static void RemoveAvatar(TlenProtocol *proto, HANDLE hContact) { +static void RemoveAvatar(TlenProtocol *proto, HCONTACT hContact) { TCHAR tFileName[ MAX_PATH ]; if (hContact == NULL) { proto->threadData->avatarHash[0] = '\0'; @@ -77,7 +77,7 @@ static void RemoveAvatar(TlenProtocol *proto, HANDLE hContact) { ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0); } -static void SetAvatar(TlenProtocol *proto, HANDLE hContact, TLEN_LIST_ITEM *item, char *data, int len, DWORD format) { +static void SetAvatar(TlenProtocol *proto, HCONTACT hContact, TLEN_LIST_ITEM *item, char *data, int len, DWORD format) { TCHAR filename[MAX_PATH]; char md5[33]; mir_md5_state_t ctx; @@ -123,7 +123,7 @@ int TlenProcessAvatarNode(TlenProtocol *proto, XmlNode *avatarNode, TLEN_LIST_IT XmlNode *aNode; char *oldHash = NULL; char *md5 = NULL, *type = NULL; - HANDLE hContact; + HCONTACT hContact; hContact = NULL; if (item != NULL) { if ((hContact=TlenHContactFromJID(proto, item->jid)) == NULL) return 0; @@ -165,7 +165,7 @@ int TlenProcessAvatarNode(TlenProtocol *proto, XmlNode *avatarNode, TLEN_LIST_IT } void TlenProcessPresenceAvatar(TlenProtocol *proto, XmlNode *node, TLEN_LIST_ITEM *item) { - HANDLE hContact; + HCONTACT hContact; if ((hContact=TlenHContactFromJID(proto, item->jid)) == NULL) return; TlenProcessAvatarNode(proto, TlenXmlGetChild(node, "avatar"), item); } @@ -225,7 +225,7 @@ static int getAvatarMutex = 0; typedef struct { TlenProtocol *proto; - HANDLE hContact; + HCONTACT hContact; } TLENGETAVATARTHREADDATA; static void TlenGetAvatarThread(void *ptr) { @@ -234,7 +234,7 @@ static void TlenGetAvatarThread(void *ptr) { NETLIBHTTPREQUEST req; NETLIBHTTPREQUEST *resp; TLENGETAVATARTHREADDATA *data = (TLENGETAVATARTHREADDATA *)ptr; - HANDLE hContact = data->hContact; + HCONTACT hContact = data->hContact; char *request; char *login = NULL; if (hContact != NULL) { @@ -301,7 +301,7 @@ static void TlenGetAvatarThread(void *ptr) { mir_free(data); } -void TlenGetAvatar(TlenProtocol *proto, HANDLE hContact) { +void TlenGetAvatar(TlenProtocol *proto, HCONTACT hContact) { if (hContact == NULL) { if (getAvatarMutex != 0) { return; diff --git a/protocols/Tlen/src/tlen_avatar.h b/protocols/Tlen/src/tlen_avatar.h index 1db81cd3a7..c0bbfaa086 100644 --- a/protocols/Tlen/src/tlen_avatar.h +++ b/protocols/Tlen/src/tlen_avatar.h @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void TlenProcessPresenceAvatar(TlenProtocol *proto, XmlNode *node, TLEN_LIST_ITEM *item); int TlenProcessAvatarNode(TlenProtocol *proto, XmlNode *avatarNode, TLEN_LIST_ITEM *item); void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, TCHAR* psztDest, int cbLen); -void TlenGetAvatar(TlenProtocol *proto, HANDLE hContact); +void TlenGetAvatar(TlenProtocol *proto, HCONTACT hContact); void TlenUploadAvatar(TlenProtocol *proto, unsigned char *data, int dataLen, int access); void TlenRemoveAvatar(TlenProtocol *proto); diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp index c74cfdde1a..74181bd9c3 100644 --- a/protocols/Tlen/src/tlen_iqid.cpp +++ b/protocols/Tlen/src/tlen_iqid.cpp @@ -65,7 +65,7 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) { DBVARIANT dbv; XmlNode *itemNode, *groupNode; TLEN_LIST_ITEM *item; - HANDLE hContact; + HCONTACT hContact; char *jid, *name, *nick; int i; char *str; @@ -76,7 +76,7 @@ void TlenResultSetRoster(TlenProtocol *proto, XmlNode *queryNode) { if ((jid=TlenXmlGetAttrValue(itemNode, "jid")) != NULL) { str = TlenXmlGetAttrValue(itemNode, "subscription"); if (!strcmp(str, "remove")) { - if ((hContact=TlenHContactFromJID(proto, jid)) != NULL) { + if ((hContact = TlenHContactFromJID(proto, jid)) != NULL) { if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) db_set_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE); } @@ -165,7 +165,7 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) nick = TlenLocalNickFromJID(jid); if (nick != NULL) { - HANDLE hContact; + HCONTACT hContact; item = TlenListAdd(proto, LIST_ROSTER, jid); if (item->nick) mir_free(item->nick); item->nick = nick; @@ -206,8 +206,8 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) // Delete orphaned contacts (if roster sync is enabled) if (db_get_b(NULL, proto->m_szModuleName, "RosterSync", FALSE) == TRUE) { - for (HANDLE hContact = db_find_first(proto->m_szModuleName); hContact; ) { - HANDLE hNext = hContact = db_find_next(hContact, proto->m_szModuleName); + for (HCONTACT hContact = db_find_first(proto->m_szModuleName); hContact; ) { + HCONTACT hNext = hContact = db_find_next(hContact, proto->m_szModuleName); ptrA jid( db_get_sa(hContact, proto->m_szModuleName, "jid")); if (jid != NULL) { if (!TlenListExist(proto, LIST_ROSTER, jid)) { @@ -241,7 +241,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) XmlNode *queryNode, *itemNode, *n; char *type, *jid; char text[128]; - HANDLE hContact; + HCONTACT hContact; char *nText; // TlenLog(" iqIdGetVcard (tlen)"); @@ -561,7 +561,7 @@ void TlenIqResultVersion(TlenProtocol *proto, XmlNode *iqNode) if (( from=TlenXmlGetAttrValue( iqNode, "from" )) != NULL ) { TLEN_LIST_ITEM *item; if (( item=TlenListGetItemPtr( proto, LIST_ROSTER, from )) != NULL) { - HANDLE hContact; + HCONTACT hContact; XmlNode *n; if ( item->software ) mir_free( item->software ); if ( item->version ) mir_free( item->version ); @@ -598,7 +598,7 @@ void TlenIqResultInfo(TlenProtocol *proto, XmlNode *iqNode) if (( from=TlenXmlGetAttrValue( queryNode, "from" )) != NULL ) { TLEN_LIST_ITEM *item; if (( item=TlenListGetItemPtr( proto, LIST_ROSTER, from )) != NULL) { - HANDLE hContact; + HCONTACT hContact; XmlNode *version = TlenXmlGetChild(queryNode, "version"); item->protocolVersion = TlenTextDecode(version->text); if (( hContact=TlenHContactFromJID(proto, item->jid )) != NULL ) { diff --git a/protocols/Tlen/src/tlen_misc.cpp b/protocols/Tlen/src/tlen_misc.cpp index ad62fbf4c3..670d014fc6 100644 --- a/protocols/Tlen/src/tlen_misc.cpp +++ b/protocols/Tlen/src/tlen_misc.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "tlen.h" #include "tlen_list.h" -void TlenDBAddEvent(TlenProtocol *proto, HANDLE hContact, int eventType, DWORD flags, PBYTE pBlob, DWORD cbBlob) +void TlenDBAddEvent(TlenProtocol *proto, HCONTACT hContact, int eventType, DWORD flags, PBYTE pBlob, DWORD cbBlob) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.szModule = proto->m_szModuleName; @@ -42,10 +42,10 @@ void TlenDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick) PBYTE pCurBlob; PBYTE pBlob; DWORD cbBlob; - HANDLE hContact; + HCONTACT hContact; if ((hContact=TlenHContactFromJID(proto, jid)) == NULL) { - hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->m_szModuleName); // strip resource if present s = TlenLoginFromJID(jid); @@ -72,7 +72,7 @@ void TlenDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick) TlenDBAddEvent(proto, NULL, EVENTTYPE_AUTHREQUEST, 0, pBlob, cbBlob); } -char *TlenJIDFromHContact(TlenProtocol *proto, HANDLE hContact) +char *TlenJIDFromHContact(TlenProtocol *proto, HCONTACT hContact) { char *p = NULL; DBVARIANT dbv; @@ -83,14 +83,14 @@ char *TlenJIDFromHContact(TlenProtocol *proto, HANDLE hContact) return p; } -HANDLE TlenHContactFromJID(TlenProtocol *proto, const char *jid) +HCONTACT TlenHContactFromJID(TlenProtocol *proto, const char *jid) { DBVARIANT dbv; char *p; if (jid == NULL) return NULL; - for (HANDLE hContact = db_find_first(proto->m_szModuleName); hContact; hContact = db_find_next(hContact, proto->m_szModuleName)) { + for (HCONTACT hContact = db_find_first(proto->m_szModuleName); hContact; hContact = db_find_next(hContact, proto->m_szModuleName)) { if ( db_get_s(hContact, proto->m_szModuleName, "jid", &dbv)) continue; @@ -106,14 +106,14 @@ HANDLE TlenHContactFromJID(TlenProtocol *proto, const char *jid) return NULL; } -HANDLE TlenDBCreateContact(TlenProtocol *proto, char *jid, char *nick, BOOL temporary) +HCONTACT TlenDBCreateContact(TlenProtocol *proto, char *jid, char *nick, BOOL temporary) { - HANDLE hContact; + HCONTACT hContact; if (jid == NULL || jid[0] == '\0') return NULL; if ((hContact=TlenHContactFromJID(proto, jid)) == NULL) { - hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->m_szModuleName); db_set_s(hContact, proto->m_szModuleName, "jid", jid); if (nick != NULL && nick[0] != '\0') diff --git a/protocols/Tlen/src/tlen_muc.cpp b/protocols/Tlen/src/tlen_muc.cpp index 843d4f4c98..05d609947c 100644 --- a/protocols/Tlen/src/tlen_muc.cpp +++ b/protocols/Tlen/src/tlen_muc.cpp @@ -69,7 +69,7 @@ static int stringToHex(const char *str) static char *getDisplayName(TlenProtocol *proto, const char *id) { char jid[256]; - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) { mir_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal); @@ -101,7 +101,7 @@ BOOL TlenMUCInit(TlenProtocol *proto) int TlenProtocol::MUCHandleEvent(WPARAM wParam, LPARAM lParam) { - HANDLE hContact; + HCONTACT hContact; int id; MUCCEVENT *mucce=(MUCCEVENT *) lParam; if (!strcmp(mucce->pszModule, m_szModuleName)) { @@ -954,7 +954,7 @@ static void __cdecl TlenMUCCSendQueryResultThread(void *ptr) queryResult.iItemsNum = 0; - for (HANDLE hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) { + for (HCONTACT hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) { if ( db_get_b(hContact, szProto, "bChat", FALSE)) continue; @@ -970,7 +970,7 @@ static void __cdecl TlenMUCCSendQueryResultThread(void *ptr) memset(queryResult.pItems, 0, sizeof(MUCCQUERYITEM) * queryResult.iItemsNum); queryResult.iItemsNum = 0; - for (HANDLE hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) { + for (HCONTACT hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) { if ( db_get_b(hContact, szProto, "bChat", FALSE)) continue; @@ -1025,13 +1025,13 @@ INT_PTR TlenProtocol::MUCMenuHandleChats(WPARAM wParam, LPARAM lParam) INT_PTR TlenProtocol::MUCContactMenuHandleMUC(WPARAM wParam, LPARAM lParam) { - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; TLEN_LIST_ITEM *item; if (!isOnline) return 1; - if ((hContact=(HANDLE) wParam) != NULL && isOnline) { + if ((hContact=(HCONTACT)wParam) != NULL && isOnline) { if (!db_get(hContact, m_szModuleName, "jid", &dbv)) { char serialId[32]; mir_snprintf(serialId, SIZEOF(serialId), TLEN_IQID"%d", TlenSerialNext(this)); diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index 3f0156f3f8..7f3f769ef2 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -254,7 +254,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) { mir_free(fromRaw); } -BOOL SendPicture(TlenProtocol *proto, HANDLE hContact) { +BOOL SendPicture(TlenProtocol *proto, HCONTACT hContact) { DBVARIANT dbv; if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) { char *jid = dbv.pszVal; diff --git a/protocols/Tlen/src/tlen_picture.h b/protocols/Tlen/src/tlen_picture.h index 178134007d..a15922a5a4 100644 --- a/protocols/Tlen/src/tlen_picture.h +++ b/protocols/Tlen/src/tlen_picture.h @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "tlen.h" void TlenProcessPic(XmlNode *node, TlenProtocol *proto); -BOOL SendPicture(TlenProtocol *, HANDLE hContact); +BOOL SendPicture(TlenProtocol *, HCONTACT hContact); #endif /* _TLEN_PICTURE_H */ diff --git a/protocols/Tlen/src/tlen_presence.cpp b/protocols/Tlen/src/tlen_presence.cpp index 617ec7e2ca..d37c9bcdc6 100644 --- a/protocols/Tlen/src/tlen_presence.cpp +++ b/protocols/Tlen/src/tlen_presence.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) { - HANDLE hContact; + HCONTACT hContact; XmlNode *showNode, *statusNode; TLEN_LIST_ITEM *item; char *from, *type, *nick, *show; @@ -178,7 +178,7 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) void setOwnStatusOnCList(TlenProtocol *proto, int status, char *statusMsg) { ptrA ownJid(db_get_sa(NULL, proto->m_szModuleName, "jid")); - HANDLE hContact = TlenHContactFromJID(proto, ownJid); + HCONTACT hContact = TlenHContactFromJID(proto, ownJid); if(hContact){ if (db_get_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) != status) db_set_w(hContact, proto->m_szModuleName, "Status", (WORD)status); diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 52ab263c8c..3eff4c7b86 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "tlen_avatar.h" #include "tlen_file.h" -DWORD_PTR TlenProtocol::GetCaps(int type, HANDLE hContact) +DWORD_PTR TlenProtocol::GetCaps(int type, HCONTACT hContact) { if (type == PFLAGNUM_1) return PF1_IM|PF1_AUTHREQ|PF1_SERVERCLIST|PF1_MODEMSG|PF1_BASICSEARCH|PF1_SEARCHBYEMAIL|PF1_EXTSEARCH|PF1_EXTSEARCHUI|PF1_SEARCHBYNAME|PF1_FILE;//|PF1_VISLIST|PF1_INVISLIST; @@ -175,15 +175,15 @@ HWND TlenProtocol::SearchAdvanced(HWND owner) } -static HANDLE AddToListByJID(TlenProtocol *proto, const char *newJid, DWORD flags) +static HCONTACT AddToListByJID(TlenProtocol *proto, const char *newJid, DWORD flags) { - HANDLE hContact; + HCONTACT hContact; char *jid, *nick; if ((hContact=TlenHContactFromJID(proto, newJid)) == NULL) { // not already there: add jid = mir_strdup(newJid); _strlwr(jid); - hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) proto->m_szModuleName); db_set_s(hContact, proto->m_szModuleName, "jid", jid); if ((nick=TlenNickFromJID(newJid)) == NULL) @@ -216,7 +216,7 @@ static HANDLE AddToListByJID(TlenProtocol *proto, const char *newJid, DWORD flag HANDLE TlenProtocol::AddToList(int flags, PROTOSEARCHRESULT *psr) { - HANDLE hContact; + HCONTACT hContact; TLEN_SEARCH_RESULT *jsr = (TLEN_SEARCH_RESULT*)psr; if (jsr->hdr.cbSize != sizeof(TLEN_SEARCH_RESULT)) return (int) NULL; @@ -257,7 +257,7 @@ HANDLE TlenProtocol::AddToListByEvent( int flags, int iContact, HANDLE hDbEvent char *lastName = firstName + strlen(firstName) + 1; char *jid = lastName + strlen(lastName) + 1; - HANDLE hContact = (HANDLE) AddToListByJID(this, jid, flags); + HCONTACT hContact = (HCONTACT) AddToListByJID(this, jid, flags); mir_free(dbei.pBlob); return hContact; } @@ -294,7 +294,7 @@ int TlenProtocol::Authorize(HANDLE hDbEvent) // Automatically add this user to my roster if option is enabled if (db_get_b(NULL, m_szModuleName, "AutoAdd", TRUE) == TRUE) { - HANDLE hContact; + HCONTACT hContact; TLEN_LIST_ITEM *item; if ((item=TlenListGetItemPtr(this, LIST_ROSTER, jid)) == NULL || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) { @@ -473,7 +473,7 @@ int TlenProtocol::SetAwayMsg(int iStatus, const PROTOCHAR* msg) return 0; } -int TlenProtocol::GetInfo(HANDLE hContact, int infoType) +int TlenProtocol::GetInfo(HCONTACT hContact, int infoType) { DBVARIANT dbv; int iqId; @@ -500,7 +500,7 @@ int TlenProtocol::GetInfo(HANDLE hContact, int infoType) return 0; } -int TlenProtocol::SetApparentMode(HANDLE hContact, int mode) +int TlenProtocol::SetApparentMode(HCONTACT hContact, int mode) { DBVARIANT dbv; int oldMode; @@ -539,12 +539,12 @@ int TlenProtocol::SetApparentMode(HANDLE hContact, int mode) struct SENDACKTHREADDATA { - __inline SENDACKTHREADDATA(TlenProtocol *_ppro, HANDLE _hContact, int _msgid=0) : + __inline SENDACKTHREADDATA(TlenProtocol *_ppro, HCONTACT _hContact, int _msgid=0) : proto(_ppro), hContact(_hContact), msgid(_msgid) {} TlenProtocol *proto; - HANDLE hContact; + HCONTACT hContact; int msgid; }; @@ -599,7 +599,7 @@ static void __cdecl TlenGetAwayMsgThread(void *ptr) INT_PTR TlenProtocol::SendAlert(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = ( HANDLE )wParam; + HCONTACT hContact = (HCONTACT)wParam; DBVARIANT dbv; if (isOnline && !db_get(hContact, m_szModuleName, "jid", &dbv)) { TlenSend(this, "", dbv.pszVal); @@ -609,7 +609,7 @@ INT_PTR TlenProtocol::SendAlert(WPARAM wParam, LPARAM lParam) return 0; } -int TlenProtocol::SendMsg(HANDLE hContact, int flags, const char* msgRAW) +int TlenProtocol::SendMsg(HCONTACT hContact, int flags, const char* msgRAW) { DBVARIANT dbv; char *msgEnc; @@ -717,19 +717,19 @@ INT_PTR TlenProtocol::GetAvatarInfo(WPARAM wParam, LPARAM lParam) return GAIR_NOAVATAR; } -HANDLE TlenProtocol::GetAwayMsg(HANDLE hContact) +HANDLE TlenProtocol::GetAwayMsg(HCONTACT hContact) { SENDACKTHREADDATA *tdata = new SENDACKTHREADDATA(this, hContact, 0); forkthread((void (__cdecl *)(void*))TlenGetAwayMsgThread, 0, (void*)tdata); return (HANDLE)1; } -int TlenProtocol::RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT* evt) +int TlenProtocol::RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt) { return 0; } -HANDLE TlenProtocol::FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath) +HANDLE TlenProtocol::FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath) { TLEN_FILE_TRANSFER *ft; TLEN_LIST_ITEM *item; @@ -752,7 +752,7 @@ HANDLE TlenProtocol::FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHA return (HANDLE)hTransfer; } -int TlenProtocol::FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason) +int TlenProtocol::FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason) { TLEN_FILE_TRANSFER *ft; char *nick; @@ -775,7 +775,7 @@ int TlenProtocol::FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** sz return 0; } -int TlenProtocol::FileCancel(HANDLE hContact, HANDLE hTransfer) +int TlenProtocol::FileCancel(HCONTACT hContact, HANDLE hTransfer) { TLEN_FILE_TRANSFER *ft = (TLEN_FILE_TRANSFER *) hTransfer; debugLogA("Invoking FileCancel()"); @@ -794,7 +794,7 @@ int TlenProtocol::FileCancel(HANDLE hContact, HANDLE hTransfer) return 0; } -HANDLE TlenProtocol::SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) +HANDLE TlenProtocol::SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) { TLEN_FILE_TRANSFER *ft; int i, j; @@ -862,25 +862,25 @@ HANDLE TlenProtocol::SendFile(HANDLE hContact, const PROTOCHAR* szDescription, P return (HANDLE) ft; } -int TlenProtocol::SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList){ +int TlenProtocol::SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList){ return 0; } -int TlenProtocol::SendUrl(HANDLE hContact, int flags, const char* urlt){ +int TlenProtocol::SendUrl(HCONTACT hContact, int flags, const char* urlt){ return 0; } -int TlenProtocol::RecvMsg(HANDLE hContact, PROTORECVEVENT* evt) +int TlenProtocol::RecvMsg(HCONTACT hContact, PROTORECVEVENT* evt) { return Proto_RecvMessage(hContact, evt); } -int TlenProtocol::RecvFile(HANDLE hContact, PROTOFILEEVENT* evt) +int TlenProtocol::RecvFile(HCONTACT hContact, PROTOFILEEVENT* evt) { return Proto_RecvFile(hContact, evt); } -int TlenProtocol::RecvUrl(HANDLE hContact, PROTORECVEVENT*) +int TlenProtocol::RecvUrl(HCONTACT hContact, PROTORECVEVENT*) { return 0; } @@ -904,12 +904,12 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam) if (!isConnected) return 0; if (!strcmp(cws->szModule, "CList")) { - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; TLEN_LIST_ITEM *item; char *szProto, *nick, *jid, *group; - hContact = (HANDLE) wParam; + hContact = (HCONTACT) wParam; szProto = GetContactProto(hContact); if (szProto == NULL || strcmp(szProto, m_szModuleName)) return 0; // A contact's group is changed @@ -956,7 +956,7 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam) else if (!strcmp(cws->szSetting, "MyHandle")) { char *newNick; -// hContact = (HANDLE) wParam; +// hContact = (HCONTACT) wParam; // szProto = GetContactProto(hContact); // if (szProto == NULL || strcmp(szProto, proto->m_szModuleName)) return 0; @@ -1035,12 +1035,12 @@ int TlenProtocol::TlenContactDeleted(WPARAM wParam, LPARAM lParam) if (!isOnline) // should never happen return 0; - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto == NULL || strcmp(szProto, m_szModuleName)) return 0; DBVARIANT dbv; - if (!db_get((HANDLE) wParam, m_szModuleName, "jid", &dbv)) { + if (!db_get((HCONTACT)wParam, m_szModuleName, "jid", &dbv)) { char *jid, *p, *q; jid = dbv.pszVal; @@ -1058,7 +1058,7 @@ int TlenProtocol::TlenContactDeleted(WPARAM wParam, LPARAM lParam) return 0; } -int TlenProtocol::UserIsTyping(HANDLE hContact, int type) +int TlenProtocol::UserIsTyping(HCONTACT hContact, int type) { DBVARIANT dbv; TLEN_LIST_ITEM *item; @@ -1200,13 +1200,13 @@ int TlenProtocol::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lPara } // PSS_ADDED -int TlenProtocol::AuthRecv(HANDLE hContact, PROTORECVEVENT* evt) +int TlenProtocol::AuthRecv(HCONTACT hContact, PROTORECVEVENT* evt) { return 1; } // PSS_AUTHREQUEST -int TlenProtocol::AuthRequest(HANDLE hContact, const PROTOCHAR* szMessage) +int TlenProtocol::AuthRequest(HCONTACT hContact, const PROTOCHAR* szMessage) { return 1; } @@ -1217,7 +1217,7 @@ HANDLE TlenProtocol::ChangeInfo(int iInfoType, void* pInfoData) } -int TlenProtocol::RecvContacts(HANDLE hContact, PROTORECVEVENT* evt) +int TlenProtocol::RecvContacts(HCONTACT hContact, PROTORECVEVENT* evt) { return 1; } diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index 00ec568e86..40ae861fcf 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -352,7 +352,7 @@ void __cdecl TlenServerThread(ThreadData *info) ProtoBroadcastAck(szProto, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, info->proto->m_iStatus); // Set all contacts to offline - for (HANDLE hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) + for (HCONTACT hContact = db_find_first(szProto); hContact; hContact = db_find_next(hContact, szProto)) if (db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); @@ -595,7 +595,7 @@ static void TlenProcessAvatar(XmlNode* node, ThreadData *info) static void TlenProcessMessage(XmlNode *node, ThreadData *info) { - HANDLE hContact; + HCONTACT hContact; XmlNode *bodyNode, *subjectNode, *xNode, *n; char *from, *type, *nick, *p, *localMessage, *idStr; DWORD msgTime; @@ -728,7 +728,7 @@ static void TlenProcessMessage(XmlNode *node, ThreadData *info) static void TlenProcessIq(XmlNode *node, ThreadData *info) { - HANDLE hContact; + HCONTACT hContact; XmlNode *queryNode = NULL; char *type, *jid, *nick; char *xmlns = NULL; @@ -960,7 +960,7 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) */ static void TlenProcessW(XmlNode *node, ThreadData *info) { - HANDLE hContact; + HCONTACT hContact; char *f, *e, *s, *body; char *str, *localMessage; int strSize; @@ -1007,7 +1007,7 @@ static void TlenProcessW(XmlNode *node, ThreadData *info) */ static void TlenProcessM(XmlNode *node, ThreadData *info) { - HANDLE hContact; + HCONTACT hContact; char *f;//, *from;//username char *tp;//typing start/stop char *p, *n, *r, *s, *str, *localMessage; diff --git a/protocols/Tlen/src/tlen_userinfo.cpp b/protocols/Tlen/src/tlen_userinfo.cpp index 825bbfe3c4..22ed3651e7 100644 --- a/protocols/Tlen/src/tlen_userinfo.cpp +++ b/protocols/Tlen/src/tlen_userinfo.cpp @@ -132,7 +132,7 @@ int TlenProtocol::UserInfoInit(WPARAM wParam, LPARAM lParam) if (!CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)m_szModuleName)) return 0; - HANDLE hContact = (HANDLE) lParam; + HCONTACT hContact = (HCONTACT) lParam; char *szProto = GetContactProto(hContact); if ((szProto != NULL && !strcmp(szProto, m_szModuleName)) || !lParam) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; @@ -155,7 +155,7 @@ int TlenProtocol::UserInfoInit(WPARAM wParam, LPARAM lParam) typedef struct { TlenProtocol *proto; - HANDLE hContact; + HCONTACT hContact; }TLENUSERINFODLGDATA; @@ -166,7 +166,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara case WM_INITDIALOG: data = (TLENUSERINFODLGDATA*)mir_alloc(sizeof(TLENUSERINFODLGDATA)); - data->hContact = (HANDLE) lParam; + data->hContact = (HCONTACT) lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)data); // lParam is hContact TranslateDialogDefault(hwndDlg); @@ -286,7 +286,7 @@ static INT_PTR CALLBACK TlenUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara switch (((LPNMHDR)lParam)->code) { case PSN_INFOCHANGED: { - HANDLE hContact = (HANDLE) ((LPPSHNOTIFY) lParam)->lParam; + HCONTACT hContact = (HCONTACT) ((LPPSHNOTIFY) lParam)->lParam; SendMessage(hwndDlg, WM_TLEN_REFRESH, 0, (LPARAM) hContact); } break; diff --git a/protocols/Tlen/src/tlen_util.cpp b/protocols/Tlen/src/tlen_util.cpp index 5ac920336e..8f8837454b 100644 --- a/protocols/Tlen/src/tlen_util.cpp +++ b/protocols/Tlen/src/tlen_util.cpp @@ -440,7 +440,7 @@ BOOL IsAuthorized(TlenProtocol *proto, const char *jid) } -void TlenLogMessage(TlenProtocol *proto, HANDLE hContact, DWORD flags, const char *message) +void TlenLogMessage(TlenProtocol *proto, HCONTACT hContact, DWORD flags, const char *message) { int size = (int)strlen(message) + 2; char *localMessage = (char *)mir_alloc(size); diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index 9739aa53a7..57cab89d2a 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -693,14 +693,14 @@ int TlenVoiceCancelAll(TlenProtocol *proto) INT_PTR TlenProtocol::VoiceContactMenuHandleVoice(WPARAM wParam, LPARAM lParam) { - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; TLEN_LIST_ITEM *item; TLEN_FILE_TRANSFER *ft; if (!isOnline) return 1; - if ((hContact=(HANDLE) wParam) != NULL) { + if ((hContact=(HCONTACT)wParam) != NULL) { if (!db_get(hContact, m_szModuleName, "jid", &dbv)) { char serialId[32]; mir_snprintf(serialId, SIZEOF(serialId), "%d", TlenSerialNext(this)); @@ -942,7 +942,7 @@ int TlenVoiceStart(TLEN_FILE_TRANSFER *ft, int mode) static char *getDisplayName(TlenProtocol *proto, const char *id) { char jid[256]; - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) { mir_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal); diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 6867783ea0..df581c8586 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -39,7 +39,7 @@ void TwitterProto::UpdateChat(const twitter_user &update) gce.time = static_cast(update.status.time); DBVARIANT nick; - HANDLE hContact = UsernameToHContact(update.username.c_str()); + HCONTACT hContact = UsernameToHContact(update.username.c_str()); if(hContact && !db_get_s(hContact,"CList","MyHandle",&nick)) { gce.ptszNick = mir_a2t(nick.pszVal); @@ -163,7 +163,7 @@ void TwitterProto::SetChatStatus(int status) if(status == ID_STATUS_ONLINE) { // Add all friends to contact list - for(HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for(HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if( isChatRoom(hContact)) continue; diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 938f9350ff..bb332624e4 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -25,7 +25,7 @@ void CALLBACK TwitterProto::APC_callback(ULONG_PTR p) } template -inline static T db_pod_get(HANDLE hContact,const char *module,const char *setting,T errorValue) +inline static T db_pod_get(HCONTACT hContact,const char *module,const char *setting,T errorValue) { DBVARIANT dbv; if(db_get(hContact, module, setting, &dbv)) @@ -41,7 +41,7 @@ inline static T db_pod_get(HANDLE hContact,const char *module,const char *settin } template -inline static INT_PTR db_pod_set(HANDLE hContact,const char *module,const char *setting,T val) +inline static INT_PTR db_pod_set(HCONTACT hContact,const char *module,const char *setting,T val) { return db_set_blob(hContact, module, setting, &val, sizeof(T)); } @@ -401,8 +401,8 @@ void TwitterProto::MessageLoop(void*) struct update_avatar { - update_avatar(HANDLE hContact,const std::string &url) : hContact(hContact),url(url) {} - HANDLE hContact; + update_avatar(HCONTACT hContact,const std::string &url) : hContact(hContact),url(url) {} + HCONTACT hContact; std::string url; }; @@ -454,7 +454,7 @@ void TwitterProto::UpdateAvatarWorker(void *p) debugLogA( _T("***** Done avatar: %s"),data->url.c_str()); } -void TwitterProto::UpdateAvatar(HANDLE hContact,const std::string &url,bool force) +void TwitterProto::UpdateAvatar(HCONTACT hContact,const std::string &url,bool force) { DBVARIANT dbv = {0}; @@ -493,7 +493,7 @@ void TwitterProto::UpdateFriends() if(i->username == twit_.get_username()) continue; - HANDLE hContact = AddToClientList(i->username.c_str(),i->status.text.c_str()); + HCONTACT hContact = AddToClientList(i->username.c_str(),i->status.text.c_str()); UpdateAvatar(hContact,i->profile_image_url); } disconnectionCount = 0; @@ -516,7 +516,7 @@ void TwitterProto::UpdateFriends() } -void TwitterProto::ShowContactPopup(HANDLE hContact,const std::string &text) +void TwitterProto::ShowContactPopup(HCONTACT hContact,const std::string &text) { if(!ServiceExists(MS_POPUP_ADDPOPUPT) || db_get_b(0,m_szModuleName,TWITTER_KEY_POPUP_SHOW,0) == 0) { @@ -565,7 +565,7 @@ void TwitterProto::UpdateStatuses(bool pre_read, bool popups, bool tweetToMsg) if(i->username == twit_.get_username()) continue; - HANDLE hContact = AddToClientList(i->username.c_str(),""); + HCONTACT hContact = AddToClientList(i->username.c_str(),""); UpdateAvatar(hContact,i->profile_image_url); // as UpdateFriends() doesn't work at the moment, i'm going to update the avatars here // i think we maybe should just do that DBEF_READ line instead of stopping ALL this code. have to test. @@ -620,7 +620,7 @@ void TwitterProto::UpdateMessages(bool pre_read) for(twitter::status_list::reverse_iterator i=messages.rbegin(); i!=messages.rend(); ++i) { - HANDLE hContact = AddToClientList(i->username.c_str(),""); + HCONTACT hContact = AddToClientList(i->username.c_str(),""); PROTORECVEVENT recv = { 0 }; recv.flags = PREF_UTF; diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index f9772bf7b6..9a37a50284 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -32,7 +32,7 @@ void TwitterProto::AddToListWorker(void *p) twitter_user user = twit_.add_friend(name); s.Unlock(); - HANDLE hContact = UsernameToHContact(name); + HCONTACT hContact = UsernameToHContact(name); UpdateAvatar(hContact,user.profile_image_url); } catch(const std::exception &e) @@ -60,7 +60,7 @@ void TwitterProto::UpdateInfoWorker(void *hContact) std::string username; DBVARIANT dbv; - if(!db_get_s(hContact,m_szModuleName,TWITTER_KEY_UN,&dbv)) + if (!db_get_s((HCONTACT)hContact, m_szModuleName, TWITTER_KEY_UN, &dbv)) { username = dbv.pszVal; db_free(&dbv); @@ -73,11 +73,11 @@ void TwitterProto::UpdateInfoWorker(void *hContact) twit_.get_info(username,&user); } - UpdateAvatar(hContact,user.profile_image_url,true); - ProtoBroadcastAck(hContact,ACKTYPE_GETINFO,ACKRESULT_SUCCESS,0,0); + UpdateAvatar((HCONTACT)hContact, user.profile_image_url, true); + ProtoBroadcastAck((HCONTACT)hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, 0, 0); } -int TwitterProto::GetInfo(HANDLE hContact,int info_type) +int TwitterProto::GetInfo(HCONTACT hContact,int info_type) { if(m_iStatus != ID_STATUS_ONLINE) return 1; @@ -170,14 +170,14 @@ void TwitterProto::GetAwayMsgWorker(void *hContact) return; DBVARIANT dbv; - if( !db_get_ts(hContact,"CList","StatusMsg",&dbv)) { - ProtoBroadcastAck(hContact,ACKTYPE_AWAYMSG,ACKRESULT_SUCCESS, (HANDLE)1,(LPARAM)dbv.ptszVal); + if (!db_get_ts((HCONTACT)hContact, "CList", "StatusMsg", &dbv)) { + ProtoBroadcastAck((HCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal); db_free(&dbv); } - else ProtoBroadcastAck(hContact,ACKTYPE_AWAYMSG,ACKRESULT_FAILED, (HANDLE)1,0); + else ProtoBroadcastAck((HCONTACT)hContact, ACKTYPE_AWAYMSG, ACKRESULT_FAILED, (HANDLE)1, 0); } -HANDLE TwitterProto::GetAwayMsg(HANDLE hContact) +HANDLE TwitterProto::GetAwayMsg(HCONTACT hContact) { ForkThread(&TwitterProto::GetAwayMsgWorker, hContact); return (HANDLE)1; @@ -188,7 +188,7 @@ int TwitterProto::OnContactDeleted(WPARAM wParam,LPARAM lParam) if(m_iStatus != ID_STATUS_ONLINE) return 0; - const HANDLE hContact = reinterpret_cast(wParam); + const HCONTACT hContact = reinterpret_cast(wParam); if(!IsMyContact(hContact)) return 0; @@ -208,7 +208,7 @@ int TwitterProto::OnContactDeleted(WPARAM wParam,LPARAM lParam) // ************************* -bool TwitterProto::IsMyContact(HANDLE hContact,bool include_chat) +bool TwitterProto::IsMyContact(HCONTACT hContact,bool include_chat) { char *proto = GetContactProto(hContact); if(proto && strcmp(m_szModuleName,proto) == 0) { @@ -219,9 +219,9 @@ bool TwitterProto::IsMyContact(HANDLE hContact,bool include_chat) else return false; } -HANDLE TwitterProto::UsernameToHContact(const char *name) +HCONTACT TwitterProto::UsernameToHContact(const char *name) { - for(HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) + for(HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if( db_get_b(hContact, m_szModuleName, "ChatRoom", 0)) continue; @@ -242,10 +242,10 @@ HANDLE TwitterProto::UsernameToHContact(const char *name) return 0; } -HANDLE TwitterProto::AddToClientList(const char *name,const char *status) +HCONTACT TwitterProto::AddToClientList(const char *name, const char *status) { // First, check if this contact exists - HANDLE hContact = UsernameToHContact(name); + HCONTACT hContact = UsernameToHContact(name); if(hContact) return hContact; @@ -253,7 +253,7 @@ HANDLE TwitterProto::AddToClientList(const char *name,const char *status) AddChatContact(name); // If not, make a new contact! - hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if(hContact) { if(CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)m_szModuleName) == 0) @@ -282,7 +282,7 @@ HANDLE TwitterProto::AddToClientList(const char *name,const char *status) void TwitterProto::SetAllContactStatuses(int status) { - for(HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) + for(HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) if( !db_get_b(hContact, m_szModuleName, "ChatRoom", 0)) db_set_w(hContact,m_szModuleName,"Status",status); diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index d034fe6772..33b7a019ea 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -88,7 +88,7 @@ TwitterProto::~TwitterProto() // ************************* -DWORD_PTR TwitterProto::GetCaps(int type,HANDLE) +DWORD_PTR TwitterProto::GetCaps(int type, HCONTACT) { switch(type) { @@ -113,7 +113,7 @@ DWORD_PTR TwitterProto::GetCaps(int type,HANDLE) // ************************* -int TwitterProto::RecvMsg(HANDLE hContact,PROTORECVEVENT *pre) +int TwitterProto::RecvMsg(HCONTACT hContact,PROTORECVEVENT *pre) { Proto_RecvMessage(hContact, pre); return 0; @@ -123,11 +123,11 @@ int TwitterProto::RecvMsg(HANDLE hContact,PROTORECVEVENT *pre) struct send_direct { - __inline send_direct(HANDLE _hContact, const std::string &_msg, int _msgid) : + __inline send_direct(HCONTACT _hContact, const std::string &_msg, int _msgid) : hContact(_hContact), msg(_msg), msgid(_msgid) {} - HANDLE hContact; + HCONTACT hContact; std::string msg; int msgid; }; @@ -151,7 +151,7 @@ void TwitterProto::SendSuccess(void *p) delete data; } -int TwitterProto::SendMsg(HANDLE hContact,int flags,const char *msg) +int TwitterProto::SendMsg(HCONTACT hContact,int flags,const char *msg) { if(m_iStatus != ID_STATUS_ONLINE) return 0; @@ -246,7 +246,7 @@ INT_PTR TwitterProto::GetStatus(WPARAM,LPARAM) INT_PTR TwitterProto::ReplyToTweet(WPARAM wParam,LPARAM) { // TODO: support replying to tweets instead of just users - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(wParam); HWND hDlg = CreateDialogParam(g_hInstance,MAKEINTRESOURCE(IDD_TWEET),0,tweet_proc,reinterpret_cast(this)); @@ -264,7 +264,7 @@ INT_PTR TwitterProto::ReplyToTweet(WPARAM wParam,LPARAM) INT_PTR TwitterProto::VisitHomepage(WPARAM wParam,LPARAM) { - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(wParam); DBVARIANT dbv; // TODO: remove this @@ -398,7 +398,7 @@ int TwitterProto::OnPreShutdown(WPARAM,LPARAM) int TwitterProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM) { - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(wParam); if(IsMyContact(hContact)) ShowContactMenus(true); @@ -495,8 +495,8 @@ void TwitterProto::UpdateSettings() if(in_chat_) OnLeaveChat(0,0); - for(HANDLE hContact = db_find_first(m_szModuleName); hContact; ) { - HANDLE hNext = db_find_next(hContact, m_szModuleName); + for(HCONTACT hContact = db_find_first(m_szModuleName); hContact; ) { + HCONTACT hNext = db_find_next(hContact, m_szModuleName); if(isChatRoom(hContact)) CallService(MS_DB_CONTACT_DELETE,reinterpret_cast(hContact),0); hContact = hNext; diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index ff10081aed..16739bbfc9 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -41,18 +41,18 @@ public: virtual int __cdecl Authorize(HANDLE); virtual int __cdecl AuthDeny(HANDLE,const TCHAR *); - virtual int __cdecl AuthRecv(HANDLE,PROTORECVEVENT *); - virtual int __cdecl AuthRequest(HANDLE,const TCHAR *); + virtual int __cdecl AuthRecv(HCONTACT, PROTORECVEVENT *); + virtual int __cdecl AuthRequest(HCONTACT, const TCHAR *); virtual HANDLE __cdecl ChangeInfo(int,void *); - virtual HANDLE __cdecl FileAllow(HANDLE,HANDLE,const TCHAR *); - virtual int __cdecl FileCancel(HANDLE,HANDLE); - virtual int __cdecl FileDeny(HANDLE,HANDLE,const TCHAR *); - virtual int __cdecl FileResume(HANDLE,int *,const TCHAR **); + virtual HANDLE __cdecl FileAllow(HCONTACT, HANDLE, const TCHAR *); + virtual int __cdecl FileCancel(HCONTACT, HANDLE); + virtual int __cdecl FileDeny(HCONTACT, HANDLE, const TCHAR *); + virtual int __cdecl FileResume(HANDLE, int *, const TCHAR **); - virtual DWORD_PTR __cdecl GetCaps(int,HANDLE = 0); - virtual int __cdecl GetInfo(HANDLE,int); + virtual DWORD_PTR __cdecl GetCaps(int, HCONTACT = 0); + virtual int __cdecl GetInfo(HCONTACT, int); virtual HANDLE __cdecl SearchBasic(const TCHAR *); virtual HANDLE __cdecl SearchByEmail(const TCHAR *); @@ -60,24 +60,24 @@ public: virtual HWND __cdecl SearchAdvanced(HWND); virtual HWND __cdecl CreateExtendedSearchUI(HWND); - virtual int __cdecl RecvContacts(HANDLE,PROTORECVEVENT *); - virtual int __cdecl RecvFile(HANDLE,PROTORECVFILET *); - virtual int __cdecl RecvMsg(HANDLE,PROTORECVEVENT *); - virtual int __cdecl RecvUrl(HANDLE,PROTORECVEVENT *); + virtual int __cdecl RecvContacts(HCONTACT, PROTORECVEVENT *); + virtual int __cdecl RecvFile(HCONTACT, PROTORECVFILET *); + virtual int __cdecl RecvMsg(HCONTACT, PROTORECVEVENT *); + virtual int __cdecl RecvUrl(HCONTACT, PROTORECVEVENT *); - virtual int __cdecl SendContacts(HANDLE,int,int,HANDLE *); - virtual HANDLE __cdecl SendFile(HANDLE,const TCHAR *,TCHAR **); - virtual int __cdecl SendMsg(HANDLE,int,const char *); - virtual int __cdecl SendUrl(HANDLE,int,const char *); + virtual int __cdecl SendContacts(HCONTACT, int, int, HCONTACT*); + virtual HANDLE __cdecl SendFile(HCONTACT, const TCHAR *, TCHAR **); + virtual int __cdecl SendMsg(HCONTACT, int, const char *); + virtual int __cdecl SendUrl(HCONTACT, int, const char *); - virtual int __cdecl SetApparentMode(HANDLE,int); + virtual int __cdecl SetApparentMode(HCONTACT, int); virtual int __cdecl SetStatus(int); - virtual HANDLE __cdecl GetAwayMsg(HANDLE); - virtual int __cdecl RecvAwayMsg(HANDLE,int,PROTORECVEVENT *); + virtual HANDLE __cdecl GetAwayMsg(HCONTACT); + virtual int __cdecl RecvAwayMsg(HCONTACT, int, PROTORECVEVENT *); virtual int __cdecl SetAwayMsg(int,const TCHAR *); - virtual int __cdecl UserIsTyping(HANDLE,int); + virtual int __cdecl UserIsTyping(HCONTACT, int); virtual int __cdecl OnEvent(PROTOEVENTTYPE,WPARAM,LPARAM); @@ -123,16 +123,16 @@ private: void UpdateStatuses(bool pre_read,bool popups, bool tweetToMsg); void UpdateMessages(bool pre_read); void UpdateFriends(); - void UpdateAvatar(HANDLE,const std::string &,bool force=false); + void UpdateAvatar(HCONTACT, const std::string &, bool force = false); int ShowPinDialog(); void ShowPopup(const wchar_t *, int Error = 0); void ShowPopup(const char *, int Error = 0); - void ShowContactPopup(HANDLE,const std::string &); + void ShowContactPopup(HCONTACT, const std::string &); - bool IsMyContact(HANDLE,bool include_chat = false); - HANDLE UsernameToHContact(const char *); - HANDLE AddToClientList(const char *,const char *); + bool IsMyContact(HCONTACT, bool include_chat = false); + HCONTACT UsernameToHContact(const char *); + HCONTACT AddToClientList(const char *, const char *); void SetAllContactStatuses(int); void debugLogA(TCHAR *fmt,...); diff --git a/protocols/Twitter/src/stubs.cpp b/protocols/Twitter/src/stubs.cpp index da781eda1a..c62ae86147 100644 --- a/protocols/Twitter/src/stubs.cpp +++ b/protocols/Twitter/src/stubs.cpp @@ -32,12 +32,12 @@ int TwitterProto::AuthDeny(HANDLE hDbEvent,const TCHAR *reason) return 1; } -int TwitterProto::AuthRecv(HANDLE hContact,PROTORECVEVENT *) +int TwitterProto::AuthRecv(HCONTACT hContact,PROTORECVEVENT *) { return 1; } -int TwitterProto::AuthRequest(HANDLE hContact,const TCHAR *message) +int TwitterProto::AuthRequest(HCONTACT hContact,const TCHAR *message) { return 1; } @@ -48,17 +48,17 @@ HANDLE TwitterProto::ChangeInfo(int type,void *info_data) return NULL; } -HANDLE TwitterProto::FileAllow(HANDLE hContact,HANDLE hTransfer,const TCHAR *path) +HANDLE TwitterProto::FileAllow(HCONTACT hContact,HANDLE hTransfer,const TCHAR *path) { return NULL; } -int TwitterProto::FileCancel(HANDLE hContact,HANDLE hTransfer) +int TwitterProto::FileCancel(HCONTACT hContact,HANDLE hTransfer) { return 1; } -int TwitterProto::FileDeny(HANDLE hContact,HANDLE hTransfer,const TCHAR *reason) +int TwitterProto::FileDeny(HCONTACT hContact,HANDLE hTransfer,const TCHAR *reason) { return 1; } @@ -83,42 +83,42 @@ HWND TwitterProto::CreateExtendedSearchUI(HWND owner) return NULL; } -int TwitterProto::RecvContacts(HANDLE hContact,PROTORECVEVENT *) +int TwitterProto::RecvContacts(HCONTACT hContact,PROTORECVEVENT *) { return 1; } -int TwitterProto::RecvFile(HANDLE hContact,PROTORECVFILET *) +int TwitterProto::RecvFile(HCONTACT hContact,PROTORECVFILET *) { return 1; } -int TwitterProto::RecvUrl(HANDLE hContact,PROTORECVEVENT *) +int TwitterProto::RecvUrl(HCONTACT hContact,PROTORECVEVENT *) { return 1; } -int TwitterProto::SendContacts(HANDLE hContact,int flags,int nContacts,HANDLE *hContactsList) +int TwitterProto::SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) { return 1; } -HANDLE TwitterProto::SendFile(HANDLE hContact,const TCHAR *desc, TCHAR **files) +HANDLE TwitterProto::SendFile(HCONTACT hContact,const TCHAR *desc, TCHAR **files) { return NULL; } -int TwitterProto::SendUrl(HANDLE hContact,int flags,const char *url) +int TwitterProto::SendUrl(HCONTACT hContact,int flags,const char *url) { return 1; } -int TwitterProto::SetApparentMode(HANDLE hContact,int mode) +int TwitterProto::SetApparentMode(HCONTACT hContact,int mode) { return 1; } -int TwitterProto::RecvAwayMsg(HANDLE hContact,int mode,PROTORECVEVENT *evt) +int TwitterProto::RecvAwayMsg(HCONTACT hContact,int mode,PROTORECVEVENT *evt) { return 1; } @@ -128,7 +128,7 @@ int TwitterProto::SetAwayMsg(int status,const TCHAR *msg) return 1; } -int TwitterProto::UserIsTyping(HANDLE hContact,int type) +int TwitterProto::UserIsTyping(HCONTACT hContact,int type) { return 1; } \ No newline at end of file diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp index 196905b5aa..9d8de71c0e 100644 --- a/protocols/Twitter/src/theme.cpp +++ b/protocols/Twitter/src/theme.cpp @@ -52,7 +52,7 @@ static HGENMENU g_hMenuItems[2]; static HANDLE g_hMenuEvts[3]; // Helper functions -static TwitterProto * GetInstanceByHContact(HANDLE hContact) +static TwitterProto * GetInstanceByHContact(HCONTACT hContact) { char *proto = GetContactProto(hContact); if(!proto) @@ -68,7 +68,7 @@ static TwitterProto * GetInstanceByHContact(HANDLE hContact) template INT_PTR GlobalService(WPARAM wParam,LPARAM lParam) { - TwitterProto *proto = GetInstanceByHContact(reinterpret_cast(wParam)); + TwitterProto *proto = GetInstanceByHContact(reinterpret_cast(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(reinterpret_cast(wParam)); return proto ? proto->OnPrebuildContactMenu(wParam,lParam) : 0; } diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index 97441b186f..91c5f96ec5 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -385,7 +385,7 @@ namespace popup_options POPUPDATAT popup = {}; // Pick a random contact - HANDLE hContact = 0; + HCONTACT hContact = 0; int n_contacts = (int)CallService(MS_DB_CONTACT_GETCOUNT,0,0); if(n_contacts != 0) diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index a0d8a7abc8..b36ea81976 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -25,7 +25,7 @@ TCHAR* CVkProto::GetUserStoredPassword() void CVkProto::SetAllContactStatuses(int iStatus) { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { if (isChatRoom(hContact)) SetChatStatus(hContact, iStatus); else if (getWord(hContact, "Status", 0) != iStatus) @@ -33,9 +33,9 @@ void CVkProto::SetAllContactStatuses(int iStatus) } } -HANDLE CVkProto::FindUser(LONG dwUserid, bool bCreate) +HCONTACT CVkProto::FindUser(LONG dwUserid, bool bCreate) { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { LONG dbUserid = getDword(hContact, "ID", -1); if (dbUserid == -1) continue; @@ -47,7 +47,7 @@ HANDLE CVkProto::FindUser(LONG dwUserid, bool bCreate) if (!bCreate) return NULL; - HANDLE hNewContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + HCONTACT hNewContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hNewContact, (LPARAM)m_szModuleName); setDword(hNewContact, "ID", dwUserid); db_set_ts(hNewContact, "CList", "Group", m_defaultGroup); diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index 3784b08b8c..15c56ba41a 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -23,18 +23,18 @@ void CVkProto::OnReceiveAvatar(NETLIBHTTPREQUEST *reply, AsyncHttpRequest* pReq) return; PROTO_AVATAR_INFORMATIONT AI = { sizeof(AI) }; - GetAvatarFileName(pReq->pUserInfo, AI.filename, SIZEOF(AI.filename)); + GetAvatarFileName((HCONTACT)pReq->pUserInfo, AI.filename, SIZEOF(AI.filename)); AI.format = ProtoGetBufferFormat(reply->pData); FILE *out = _tfopen(AI.filename, _T("wb")); if (out == NULL) { - ProtoBroadcastAck(pReq->pUserInfo, ACKTYPE_AVATAR, ACKRESULT_FAILED, &AI, 0); + ProtoBroadcastAck((HCONTACT)pReq->pUserInfo, ACKTYPE_AVATAR, ACKRESULT_FAILED, &AI, 0); return; } fwrite(reply->pData, 1, reply->dataLength, out); fclose(out); - ProtoBroadcastAck(pReq->pUserInfo, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &AI, 0); + ProtoBroadcastAck((HCONTACT)pReq->pUserInfo, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &AI, 0); } INT_PTR CVkProto::SvcGetAvatarCaps(WPARAM wParam, LPARAM lParam) @@ -93,7 +93,7 @@ INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM wParam, LPARAM lParam) return GAIR_NOAVATAR; } -void CVkProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen) +void CVkProto::GetAvatarFileName(HCONTACT hContact, TCHAR* pszDest, size_t cbLen) { int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName); @@ -115,7 +115,7 @@ void CVkProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen) mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%d%s"), id, szFileType); } -void CVkProto::SetAvatarUrl(HANDLE hContact, LPCTSTR ptszUrl) +void CVkProto::SetAvatarUrl(HCONTACT hContact, LPCTSTR ptszUrl) { ptrT oldUrl( getTStringA(hContact, "AvatarUrl")); if (!lstrcmp(ptszUrl, oldUrl)) diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 686c3f667c..31b583c62c 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -55,7 +55,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, JSONNODE *pDlg) GC_INFO gci = { 0 }; gci.pszModule = m_szModuleName; gci.pszID = sid; - gci.Flags = BYID | HCONTACT; + gci.Flags = GCF_BYID | GCF_HCONTACT; CallServiceSync(MS_GC_GETINFO, 0, (LPARAM)&gci); c->m_hContact = gci.hContact; @@ -287,7 +287,7 @@ CVkChatUser* CVkChatInfo::GetUserById(LPCTSTR ptszId) ///////////////////////////////////////////////////////////////////////////////////////// -void CVkProto::SetChatStatus(HANDLE hContact, int iStatus) +void CVkProto::SetChatStatus(HCONTACT hContact, int iStatus) { ptrT tszChatID(getTStringA(hContact, "ChatRoomID")); if (tszChatID == NULL) @@ -372,7 +372,7 @@ static INT_PTR CALLBACK InviteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA { CVkProto *ppro = (CVkProto*)lParam; HWND hwndCombo = GetDlgItem(hwndDlg, IDC_CONTACT); - for (HANDLE hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) { + for (HCONTACT hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) { TCHAR *ptszNick = pcli->pfnGetContactDisplayName(hContact, 0); int idx = SendMessage(hwndCombo, CB_ADDSTRING, 0, LPARAM(ptszNick)); SendMessage(hwndCombo, CB_SETITEMDATA, idx, (LPARAM)hContact); @@ -413,7 +413,7 @@ LPTSTR CVkProto::ChangeChatTopic(CVkChatInfo *cc) void CVkProto::LogMenuHook(CVkChatInfo *cc, GCHOOK *gch) { - HANDLE hContact; + HCONTACT hContact; switch (gch->dwData) { case IDM_TOPIC: @@ -425,7 +425,7 @@ void CVkProto::LogMenuHook(CVkChatInfo *cc, GCHOOK *gch) break; case IDM_INVITE: - hContact = (HANDLE)DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_INVITE), NULL, InviteDlgProc, (LPARAM)this); + hContact = (HCONTACT)DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_INVITE), NULL, InviteDlgProc, (LPARAM)this); if (hContact != NULL) { int uid = getDword(hContact, "ID", -1); if (uid != -1) @@ -474,7 +474,7 @@ void CVkProto::NickMenuHook(CVkChatInfo *cc, GCHOOK *gch) switch (gch->dwData) { case IDM_INFO: - if (HANDLE hContact = FindUser(cu->m_uid)) + if (HCONTACT hContact = FindUser(cu->m_uid)) CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); break; @@ -527,7 +527,7 @@ int CVkProto::OnGcMenuHook(WPARAM, LPARAM lParam) static void FilterContacts(HWND hwndDlg, CVkProto *ppro) { HWND hwndClist = GetDlgItem(hwndDlg, IDC_CLIST); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *proto = GetContactProto(hContact); if (lstrcmpA(proto, ppro->m_szModuleName) || ppro->isChatRoom(hContact)) if (HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_FINDCONTACT, (WPARAM)hContact, 0)) @@ -585,7 +585,7 @@ static INT_PTR CALLBACK GcCreateDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDOK: HWND hwndClist = GetDlgItem(hwndDlg, IDC_CLIST); CMStringA uids; - for (HANDLE hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) { + for (HCONTACT hContact = db_find_first(ppro->m_szModuleName); hContact; hContact = db_find_next(hContact, ppro->m_szModuleName)) { if (ppro->isChatRoom(hContact)) continue; diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 8c1baa072c..2a0bfb0a90 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -103,7 +103,7 @@ int CVkProto::OnPreShutdown(WPARAM wParam, LPARAM lParam) ////////////////////////////////////////////////////////////////////////////// -DWORD_PTR CVkProto::GetCaps(int type, HANDLE hContact) +DWORD_PTR CVkProto::GetCaps(int type, HCONTACT hContact) { switch(type) { case PFLAGNUM_1: @@ -135,7 +135,7 @@ DWORD_PTR CVkProto::GetCaps(int type, HANDLE hContact) ////////////////////////////////////////////////////////////////////////////// -int CVkProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) +int CVkProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT *pre) { Proto_RecvMessage(hContact, pre); return 0; @@ -145,11 +145,11 @@ int CVkProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) struct TFakeAckParams { - __inline TFakeAckParams(HANDLE _hContact, int _msgid) : + __inline TFakeAckParams(HCONTACT _hContact, int _msgid) : hContact(_hContact), msgid(_msgid) {} - HANDLE hContact; + HCONTACT hContact; int msgid; }; @@ -161,7 +161,7 @@ void CVkProto::SendMsgAck(void *param) delete ack; } -int CVkProto::SendMsg(HANDLE hContact, int flags, const char *msg) +int CVkProto::SendMsg(HCONTACT hContact, int flags, const char *msg) { LONG userID = getDword(hContact, "ID", -1); if (userID == -1) @@ -202,7 +202,7 @@ void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) } if (m_bServerDelivery) - ProtoBroadcastAck(pReq->pData, ACKTYPE_MESSAGE, iResult, pReq->pUserInfo, 0); + ProtoBroadcastAck((HCONTACT)pReq->pData, ACKTYPE_MESSAGE, iResult, pReq->pUserInfo, 0); pReq->pData = NULL; } @@ -278,7 +278,7 @@ HANDLE CVkProto::AddToList(int flags, PROTOSEARCHRESULT* psr) return NULL; } -int CVkProto::AuthRequest(HANDLE hContact,const PROTOCHAR *message) +int CVkProto::AuthRequest(HCONTACT hContact,const PROTOCHAR *message) { return 0; } @@ -295,7 +295,7 @@ int CVkProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason) return 1; } -int CVkProto::UserIsTyping(HANDLE hContact, int type) +int CVkProto::UserIsTyping(HCONTACT hContact, int type) { return 0; } @@ -305,7 +305,7 @@ HANDLE CVkProto::AddToListByEvent(int flags,int iContact,HANDLE hDbEvent) return NULL; } -int CVkProto::AuthRecv(HANDLE hContact,PROTORECVEVENT *) +int CVkProto::AuthRecv(HCONTACT hContact,PROTORECVEVENT *) { return 1; } @@ -316,17 +316,17 @@ HANDLE CVkProto::ChangeInfo(int type,void *info_data) return NULL; } -HANDLE CVkProto::FileAllow(HANDLE hContact,HANDLE hTransfer,const PROTOCHAR *path) +HANDLE CVkProto::FileAllow(HCONTACT hContact,HANDLE hTransfer,const PROTOCHAR *path) { return NULL; } -int CVkProto::FileCancel(HANDLE hContact,HANDLE hTransfer) +int CVkProto::FileCancel(HCONTACT hContact,HANDLE hTransfer) { return 1; } -int CVkProto::FileDeny(HANDLE hContact,HANDLE hTransfer,const PROTOCHAR *reason) +int CVkProto::FileDeny(HCONTACT hContact,HANDLE hTransfer,const PROTOCHAR *reason) { return 1; } @@ -336,7 +336,7 @@ int CVkProto::FileResume(HANDLE hTransfer,int *action,const PROTOCHAR **filename return 1; } -int CVkProto::GetInfo(HANDLE hContact, int infoType) +int CVkProto::GetInfo(HCONTACT hContact, int infoType) { // TODO: Most probably some ProtoAck should be here instead return 1; @@ -352,47 +352,47 @@ HWND CVkProto::CreateExtendedSearchUI(HWND owner) return NULL; } -int CVkProto::RecvContacts(HANDLE hContact,PROTORECVEVENT *) +int CVkProto::RecvContacts(HCONTACT hContact,PROTORECVEVENT *) { return 1; } -int CVkProto::RecvFile(HANDLE hContact,PROTORECVFILET *) +int CVkProto::RecvFile(HCONTACT hContact,PROTORECVFILET *) { return 1; } -int CVkProto::RecvUrl(HANDLE hContact,PROTORECVEVENT *) +int CVkProto::RecvUrl(HCONTACT hContact,PROTORECVEVENT *) { return 1; } -int CVkProto::SendContacts(HANDLE hContact,int flags,int nContacts,HANDLE *hContactsList) +int CVkProto::SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) { return 1; } -HANDLE CVkProto::SendFile(HANDLE hContact,const PROTOCHAR *desc, PROTOCHAR **files) +HANDLE CVkProto::SendFile(HCONTACT hContact,const PROTOCHAR *desc, PROTOCHAR **files) { return NULL; } -int CVkProto::SendUrl(HANDLE hContact,int flags,const char *url) +int CVkProto::SendUrl(HCONTACT hContact,int flags,const char *url) { return 1; } -int CVkProto::SetApparentMode(HANDLE hContact,int mode) +int CVkProto::SetApparentMode(HCONTACT hContact,int mode) { return 1; } -int CVkProto::RecvAwayMsg(HANDLE hContact,int mode,PROTORECVEVENT *evt) +int CVkProto::RecvAwayMsg(HCONTACT hContact,int mode,PROTORECVEVENT *evt) { return 1; } -HANDLE CVkProto::GetAwayMsg(HANDLE hContact) +HANDLE CVkProto::GetAwayMsg(HCONTACT hContact) { return 0; // Status messages are disabled } diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index b4906e97d5..7d247b2776 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -100,7 +100,7 @@ struct CVkChatInfo : public MZeroedObject int m_chatid, m_admin_id; bool m_bHistoryRead; ptrT m_tszTopic, m_tszId; - HANDLE m_hContact; + HCONTACT m_hContact; OBJLIST m_users; OBJLIST m_msgs; @@ -121,18 +121,18 @@ struct CVkProto : public PROTO virtual int __cdecl Authorize(HANDLE hDbEvent); virtual int __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR *szReason); - virtual int __cdecl AuthRecv(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl AuthRequest(HANDLE hContact, const TCHAR *szMessage); + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl AuthRequest(HCONTACT hContact, const TCHAR *szMessage); virtual HANDLE __cdecl ChangeInfo(int iInfoType, void* pInfoData); - virtual HANDLE __cdecl FileAllow(HANDLE hContact, HANDLE hTransfer, const TCHAR *szPath); - virtual int __cdecl FileCancel(HANDLE hContact, HANDLE hTransfer); - virtual int __cdecl FileDeny(HANDLE hContact, HANDLE hTransfer, const TCHAR *szReason); + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const TCHAR *szPath); + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer); + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const TCHAR *szReason); virtual int __cdecl FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename); - virtual DWORD_PTR __cdecl GetCaps(int type, HANDLE hContact = NULL); - virtual int __cdecl GetInfo(HANDLE hContact, int infoType); + virtual DWORD_PTR __cdecl GetCaps(int type, HCONTACT hContact = NULL); + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType); virtual HANDLE __cdecl SearchBasic(const TCHAR *id); virtual HANDLE __cdecl SearchByEmail(const TCHAR *email); @@ -140,24 +140,24 @@ struct CVkProto : public PROTO virtual HWND __cdecl SearchAdvanced(HWND owner); virtual HWND __cdecl CreateExtendedSearchUI(HWND owner); - virtual int __cdecl RecvContacts(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl RecvFile(HANDLE hContact, PROTORECVFILET*); - virtual int __cdecl RecvMsg(HANDLE hContact, PROTORECVEVENT*); - virtual int __cdecl RecvUrl(HANDLE hContact, PROTORECVEVENT*); + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvFile(HCONTACT hContact, PROTORECVFILET*); + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT*); - virtual int __cdecl SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList); - virtual HANDLE __cdecl SendFile(HANDLE hContact, const TCHAR *szDescription, TCHAR** ppszFiles); - virtual int __cdecl SendMsg(HANDLE hContact, int flags, const char* msg); - virtual int __cdecl SendUrl(HANDLE hContact, int flags, const char* url); + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList); + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const TCHAR *szDescription, TCHAR **ppszFiles); + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg); + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url); - virtual int __cdecl SetApparentMode(HANDLE hContact, int mode); + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode); virtual int __cdecl SetStatus(int iNewStatus); - virtual HANDLE __cdecl GetAwayMsg(HANDLE hContact); - virtual int __cdecl RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT* evt); + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact); + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt); virtual int __cdecl SetAwayMsg(int m_iStatus, const TCHAR *msg); - virtual int __cdecl UserIsTyping(HANDLE hContact, int type); + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type); virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam); @@ -259,10 +259,10 @@ private: void OnLoggedOut(); void ShutdownSession(); - void SetAvatarUrl(HANDLE hContact, LPCTSTR ptszUrl); - void GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen); + void SetAvatarUrl(HCONTACT hContact, LPCTSTR ptszUrl); + void GetAvatarFileName(HCONTACT hContact, TCHAR* pszDest, size_t cbLen); - HANDLE FindUser(LONG userid, bool bCreate = false); + HCONTACT FindUser(LONG userid, bool bCreate = false); void SetAllContactStatuses(int status); @@ -297,7 +297,7 @@ private: void LogMenuHook(CVkChatInfo*, GCHOOK*); void NickMenuHook(CVkChatInfo*, GCHOOK*); LPTSTR ChangeChatTopic(CVkChatInfo*); - void SetChatStatus(HANDLE hContact, int iStatus); + void SetChatStatus(HCONTACT hContact, int iStatus); CVkChatInfo* GetChatById(LPCTSTR ptszId); INT_PTR __cdecl SvcCreateChat(WPARAM, LPARAM); diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index d51b0e96e5..cac5aee537 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -249,7 +249,7 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (userid == 0) return; - HANDLE hContact; + HCONTACT hContact; if (userid == m_myUserId) hContact = NULL; else if ((hContact = FindUser(userid, false)) == NULL) @@ -311,7 +311,7 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq bool bCleanContacts = getByte("AutoClean", 0) != 0; LIST arContacts(10, PtrKeySortT); if (bCleanContacts) - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) if (!isChatRoom(hContact)) arContacts.insert(hContact); @@ -321,7 +321,7 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq continue; CMString tszNick; - HANDLE hContact = FindUser(_ttoi(szValue), true); + HCONTACT hContact = FindUser(_ttoi(szValue), true); arContacts.remove(hContact); szValue = json_as_string(json_get(pInfo, "first_name")); if (szValue) { @@ -468,7 +468,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe if (pAttachments != NULL) ptszBody = mir_tstrdup(CMString(ptszBody) + GetAttachmentDescr(pAttachments)); - HANDLE hContact = FindUser(uid, true); + HCONTACT hContact = FindUser(uid, true); PROTORECVEVENT recv = { 0 }; recv.flags = PREF_TCHAR; @@ -523,7 +523,7 @@ void CVkProto::PollUpdates(JSONNODE *pUpdates) CMStringA mids; int msgid, uid, flags; - HANDLE hContact; + HCONTACT hContact; JSONNODE *pChild; for (int i = 0; (pChild = json_at(pUpdates, i)) != NULL; i++) { diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index 63551a953f..81fd154153 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -35,7 +35,7 @@ int WhatsAppProto::OnChatOutgoing(WPARAM wParam, LPARAM lParam) mir_free(id); if (isOnline()) { - HANDLE hContact = this->ContactIDToHContact(chat_id); + HCONTACT hContact = this->ContactIDToHContact(chat_id); if (hContact) { debugLogA("**Chat - Outgoing message: %s", text); diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index ead537fc1d..fb3a7bea5f 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -1,6 +1,6 @@ #include "common.h" -bool WhatsAppProto::IsMyContact(HANDLE hContact, bool include_chat) +bool WhatsAppProto::IsMyContact(HCONTACT hContact, bool include_chat) { const char *proto = GetContactProto(hContact); if( proto && strcmp(m_szModuleName,proto) == 0 ) @@ -14,10 +14,10 @@ bool WhatsAppProto::IsMyContact(HANDLE hContact, bool include_chat) return false; } -HANDLE WhatsAppProto::AddToContactList(const std::string& jid, BYTE type, bool dont_check, const char *new_name, +HCONTACT WhatsAppProto::AddToContactList(const std::string& jid, BYTE type, bool dont_check, const char *new_name, bool isChatRoom, bool isHidden) { - HANDLE hContact; + HCONTACT hContact; if (!dont_check) { // First, check if this contact exists @@ -55,7 +55,7 @@ HANDLE WhatsAppProto::AddToContactList(const std::string& jid, BYTE type, bool d } // If not, make a new contact! - hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); if (hContact) { if (CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName) == 0) @@ -111,33 +111,28 @@ HANDLE WhatsAppProto::AddToContactList(const std::string& jid, BYTE type, bool d else CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); } - return INVALID_HANDLE_VALUE; + return (HCONTACT)INVALID_HANDLE_VALUE; } -HANDLE WhatsAppProto::ContactIDToHContact(const std::string& phoneNumber) +HCONTACT WhatsAppProto::ContactIDToHContact(const std::string& phoneNumber) { // Cache - std::map::iterator it = this->hContactByJid.find(phoneNumber); + std::map::iterator it = this->hContactByJid.find(phoneNumber); if (it != this->hContactByJid.end()) return it->second; const char* idForContact = "ID"; const char* idForChat = "ChatRoomID"; - for(HANDLE hContact = db_find_first(); - hContact; - hContact = db_find_next(hContact)) - { - if(!IsMyContact(hContact, true)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + if (!IsMyContact(hContact, true)) continue; const char* id = isChatRoom(hContact) ? idForChat : idForContact; DBVARIANT dbv; - if( !getString(hContact, id, &dbv)) - { - if( strcmp(phoneNumber.c_str(),dbv.pszVal) == 0 ) - { + if (!getString(hContact, id, &dbv)) { + if (strcmp(phoneNumber.c_str(), dbv.pszVal) == 0) { db_free(&dbv); this->hContactByJid[phoneNumber] = hContact; return hContact; @@ -152,13 +147,10 @@ HANDLE WhatsAppProto::ContactIDToHContact(const std::string& phoneNumber) void WhatsAppProto::SetAllContactStatuses(int status, bool reset_client) { - for (HANDLE hContact = db_find_first(); - hContact; - hContact = db_find_next(hContact)) - { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (!IsMyContact(hContact)) continue; - + if (reset_client) { DBVARIANT dbv; if (!getTString(hContact, "MirVer", &dbv)) { @@ -170,7 +162,7 @@ void WhatsAppProto::SetAllContactStatuses(int status, bool reset_client) db_set_ws(hContact, "CList", "StatusMsg", _T("")); } - if (getWord(hContact, "Status",ID_STATUS_OFFLINE) != status) + if (getWord(hContact, "Status", ID_STATUS_OFFLINE) != status) setWord(hContact, "Status", status); } } @@ -179,7 +171,7 @@ void WhatsAppProto::ProcessBuddyList(void*) { std::vector jids; DBVARIANT dbv; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (!IsMyContact(hContact)) continue; @@ -227,7 +219,7 @@ void WhatsAppProto::SearchAckThread(void *targ) void WhatsAppProto::onAvailable(const std::string& paramString, bool paramBoolean) { - HANDLE hContact = this->AddToContactList(paramString, 0, false); + HCONTACT hContact = this->AddToContactList(paramString, 0, false); if (hContact != NULL) { if (paramBoolean) @@ -254,7 +246,7 @@ void WhatsAppProto::onAvailable(const std::string& paramString, bool paramBoolea void WhatsAppProto::onLastSeen(const std::string& paramString1, int paramInt, std::string* paramString2) { /* - HANDLE hContact = this->ContactIDToHContact(paramString1); + HCONTACT hContact = this->ContactIDToHContact(paramString1); if (hContact == NULL) { // This contact was searched @@ -270,13 +262,13 @@ void WhatsAppProto::onLastSeen(const std::string& paramString1, int paramInt, st // #TODO } */ - HANDLE hContact = this->AddToContactList(paramString1, 0, false); + HCONTACT hContact = this->AddToContactList(paramString1, 0, false); setDword(hContact, WHATSAPP_KEY_LAST_SEEN, paramInt); this->UpdateStatusMsg(hContact); } -void WhatsAppProto::UpdateStatusMsg(HANDLE hContact) +void WhatsAppProto::UpdateStatusMsg(HCONTACT hContact) { std::wstringstream ss; @@ -312,7 +304,7 @@ void WhatsAppProto::onPictureChanged(const std::string& from, const std::string& void WhatsAppProto::onSendGetPicture(const std::string& jid, const std::vector& data, const std::string& oldId, const std::string& newId) { - HANDLE hContact = this->ContactIDToHContact(jid); + HCONTACT hContact = this->ContactIDToHContact(jid); if (hContact) { debugLogA("Updating avatar for jid %s", jid.c_str()); @@ -350,7 +342,7 @@ void WhatsAppProto::onSendGetPictureIds(std::map* ids) { for (std::map::iterator it = ids->begin(); it != ids->end(); ++it) { - HANDLE hContact = this->AddToContactList(it->first); + HCONTACT hContact = this->AddToContactList(it->first); if (hContact != NULL) { DBVARIANT dbv; @@ -373,14 +365,14 @@ void WhatsAppProto::onSendGetPictureIds(std::map* ids) } } -string WhatsAppProto::GetContactDisplayName(HANDLE hContact) +string WhatsAppProto::GetContactDisplayName(HCONTACT hContact) { return string((CHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0)); } string WhatsAppProto::GetContactDisplayName(const string& jid) { - HANDLE hContact = this->ContactIDToHContact(jid); + HCONTACT hContact = this->ContactIDToHContact(jid); return hContact ? this->GetContactDisplayName(hContact) : (string("+")+ Utilities::removeWaDomainFromJid(jid)); } @@ -397,7 +389,7 @@ void WhatsAppProto::SendGetGroupInfoWorker(void* data) void WhatsAppProto::onGroupInfo(const std::string& gjid, const std::string& ownerJid, const std::string& subject, const std::string& createrJid, int paramInt1, int paramInt2) { debugLogA("'%s', '%s', '%s', '%s'", gjid.c_str(), ownerJid.c_str(), subject.c_str(), createrJid.c_str()); - HANDLE hContact = ContactIDToHContact(gjid); + HCONTACT hContact = ContactIDToHContact(gjid); if (!hContact) { debugLogA("Group info requested for non existing contact '%s'", gjid.c_str()); @@ -417,13 +409,13 @@ void WhatsAppProto::onGroupInfoFromList(const std::string& paramString1, const s void WhatsAppProto::onGroupNewSubject(const std::string& from, const std::string& author, const std::string& newSubject, int paramInt) { debugLogA("'%s', '%s', '%s'", from.c_str(), author.c_str(), newSubject.c_str()); - HANDLE hContact = this->AddToContactList(from, 0, false, newSubject.c_str(), true); + HCONTACT hContact = this->AddToContactList(from, 0, false, newSubject.c_str(), true); } void WhatsAppProto::onGroupAddUser(const std::string& paramString1, const std::string& paramString2) { debugLogA("%s - user: %s", paramString1.c_str(), paramString2.c_str()); - HANDLE hContact = this->AddToContactList(paramString1); + HCONTACT hContact = this->AddToContactList(paramString1); std::string groupName(this->GetContactDisplayName(hContact)); if (paramString2.compare(this->jid) == 0) @@ -446,7 +438,7 @@ void WhatsAppProto::onGroupAddUser(const std::string& paramString1, const std::s void WhatsAppProto::onGroupRemoveUser(const std::string& paramString1, const std::string& paramString2) { debugLogA("%s - user: %s", paramString1.c_str(), paramString2.c_str()); - HANDLE hContact = this->ContactIDToHContact(paramString1); + HCONTACT hContact = this->ContactIDToHContact(paramString1); if (!hContact) return; @@ -473,7 +465,7 @@ void WhatsAppProto::onLeaveGroup(const std::string& paramString) { // Won't be called for unknown reasons! debugLogA("%s", this->GetContactDisplayName(paramString).c_str()); - HANDLE hContact = this->ContactIDToHContact(paramString); + HCONTACT hContact = this->ContactIDToHContact(paramString); if (hContact) setByte(hContact, "IsGroupMember", 0); } @@ -482,8 +474,7 @@ void WhatsAppProto::onGetParticipants(const std::string& gjid, const std::vector { debugLogA("%s", this->GetContactDisplayName(gjid).c_str()); - HANDLE hUserContact; - HANDLE hContact = this->ContactIDToHContact(gjid); + HCONTACT hUserContact, hContact = this->ContactIDToHContact(gjid); if (!hContact) return; @@ -534,8 +525,8 @@ void WhatsAppProto::onGetParticipants(const std::string& gjid, const std::vector // Menu handler INT_PTR __cdecl WhatsAppProto::OnAddContactToGroup(WPARAM wParam, LPARAM, LPARAM lParam) { - string a = GetContactDisplayName((HANDLE) wParam); - string b = GetContactDisplayName((HANDLE) lParam); + string a = GetContactDisplayName((HCONTACT)wParam); + string b = GetContactDisplayName((HCONTACT)lParam); debugLogA("Request add user %s to group %s", a.c_str(), b.c_str()); if (!this->isOnline()) @@ -543,14 +534,14 @@ INT_PTR __cdecl WhatsAppProto::OnAddContactToGroup(WPARAM wParam, LPARAM, LPARAM DBVARIANT dbv; - if (getString((HANDLE)wParam, "ID", &dbv)) + if (getString((HCONTACT)wParam, "ID", &dbv)) return NULL; std::vector participants; participants.push_back(string(dbv.pszVal)); db_free(&dbv); - if (getString((HANDLE)lParam, "ID", &dbv)) + if (getString((HCONTACT)lParam, "ID", &dbv)) return NULL; this->connection->sendAddParticipants(string(dbv.pszVal), participants); @@ -562,8 +553,8 @@ INT_PTR __cdecl WhatsAppProto::OnAddContactToGroup(WPARAM wParam, LPARAM, LPARAM // Menu handler INT_PTR __cdecl WhatsAppProto::OnRemoveContactFromGroup(WPARAM wParam, LPARAM, LPARAM lParam) { - string a = GetContactDisplayName((HANDLE) wParam); - string b = GetContactDisplayName((HANDLE) lParam); + string a = GetContactDisplayName((HCONTACT)wParam); + string b = GetContactDisplayName((HCONTACT)lParam); debugLogA("Request remove user %s from group %s", a.c_str(), b.c_str()); if (!this->isOnline()) @@ -571,14 +562,14 @@ INT_PTR __cdecl WhatsAppProto::OnRemoveContactFromGroup(WPARAM wParam, LPARAM, L DBVARIANT dbv; - if (getString((HANDLE)lParam, "ID", &dbv)) + if (getString((HCONTACT)lParam, "ID", &dbv)) return NULL; std::vector participants; participants.push_back(string(dbv.pszVal)); db_free(&dbv); - if (getString((HANDLE)wParam, "ID", &dbv)) + if (getString((HCONTACT)wParam, "ID", &dbv)) return NULL; this->connection->sendRemoveParticipants(string(dbv.pszVal), participants); @@ -601,7 +592,7 @@ void WhatsAppProto::onParticipatingGroups(const std::vector& paramVector void WhatsAppProto::HandleReceiveGroups(const std::vector& groups, bool isOwned) { - HANDLE hContact; + HCONTACT hContact; map isMember; // at the moment, only members of owning groups are stored // This could take long time if there are many new groups which aren't @@ -641,7 +632,7 @@ void WhatsAppProto::onGroupCreated(const std::string& paramString1, const std::s // Must be received after onOwningGroups() :/ debugLogA("%s / %s", paramString1.c_str(), paramString2.c_str()); string jid = paramString2 +string("@")+ paramString1; - HANDLE hContact = this->AddToContactList(jid, 0, false, NULL, true); + HCONTACT hContact = this->AddToContactList(jid, 0, false, NULL, true); setByte(hContact, "SimpleChatRoom", 2); } @@ -668,7 +659,7 @@ void __cdecl WhatsAppProto::SendSetGroupNameWorker(void* data) string groupName(ibr->value); mir_free(ibr->value); DBVARIANT dbv; - if (!getString(*((HANDLE*) ibr->userData), WHATSAPP_KEY_ID, &dbv) && this->isOnline()) + if (!getString(*((HCONTACT*)ibr->userData), WHATSAPP_KEY_ID, &dbv) && this->isOnline()) { this->connection->sendSetNewSubject(dbv.pszVal, groupName); db_free(&dbv); @@ -691,7 +682,7 @@ void __cdecl WhatsAppProto::SendCreateGroupWorker(void* data) INT_PTR __cdecl WhatsAppProto::OnChangeGroupSubject(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(wParam); input_box* ib = new input_box; if (getTString(hContact, WHATSAPP_KEY_PUSH_NAME, &dbv)) @@ -719,7 +710,7 @@ INT_PTR __cdecl WhatsAppProto::OnChangeGroupSubject(WPARAM wParam, LPARAM lParam INT_PTR __cdecl WhatsAppProto::OnLeaveGroup(WPARAM wParam, LPARAM) { DBVARIANT dbv; - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(wParam); if (this->isOnline() && !getString(hContact, WHATSAPP_KEY_ID, &dbv)) { setByte(hContact, "IsGroupMember", 0); diff --git a/protocols/WhatsApp/src/entities.h b/protocols/WhatsApp/src/entities.h index d48fbfb573..a2543cf20d 100644 --- a/protocols/WhatsApp/src/entities.h +++ b/protocols/WhatsApp/src/entities.h @@ -3,18 +3,18 @@ struct send_direct { - send_direct(HANDLE hContact,const std::string &msg, HANDLE msgid, bool isChat = false) + send_direct(HCONTACT hContact,const std::string &msg, HANDLE msgid, bool isChat = false) : hContact(hContact), msg(msg), msgid(msgid) {} - HANDLE hContact; + HCONTACT hContact; std::string msg; HANDLE msgid; }; struct send_typing { - send_typing(HANDLE hContact,const int status) : hContact(hContact), status(status) {} - HANDLE hContact; + send_typing(HCONTACT hContact,const int status) : hContact(hContact), status(status) {} + HCONTACT hContact; int status; }; diff --git a/protocols/WhatsApp/src/messages.cpp b/protocols/WhatsApp/src/messages.cpp index 00ddab1e12..c5c911ade8 100644 --- a/protocols/WhatsApp/src/messages.cpp +++ b/protocols/WhatsApp/src/messages.cpp @@ -1,6 +1,6 @@ #include "common.h" -int WhatsAppProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) +int WhatsAppProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT *pre) { CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF); @@ -28,7 +28,7 @@ void WhatsAppProto::onMessageForMe(FMessage* paramFMessage, bool paramBoolean) msg->insert(0, std::string("[").append(paramFMessage->notifyname).append("]: ")); } - HANDLE hContact = this->AddToContactList(paramFMessage->key->remote_jid, 0, false, + HCONTACT hContact = this->AddToContactList(paramFMessage->key->remote_jid, 0, false, isChatRoom ? NULL : paramFMessage->notifyname.c_str(), isChatRoom); PROTORECVEVENT recv = {0}; @@ -40,7 +40,7 @@ void WhatsAppProto::onMessageForMe(FMessage* paramFMessage, bool paramBoolean) this->connection->sendMessageReceived(paramFMessage); } -int WhatsAppProto::SendMsg(HANDLE hContact, int flags, const char *msg) +int WhatsAppProto::SendMsg(HCONTACT hContact, int flags, const char *msg) { debugLogA(""); int msgId = ++(this->msgId); @@ -120,7 +120,7 @@ void WhatsAppProto::RecvMsgWorker(void *p) void WhatsAppProto::onIsTyping(const std::string& paramString, bool paramBoolean) { - HANDLE hContact = this->AddToContactList(paramString, 0, false); + HCONTACT hContact = this->AddToContactList(paramString, 0, false); if (hContact != NULL) { CallService(MS_PROTO_CONTACTISTYPING, (WPARAM) hContact, (LPARAM) @@ -129,7 +129,7 @@ void WhatsAppProto::onIsTyping(const std::string& paramString, bool paramBoolean } -int WhatsAppProto::UserIsTyping(HANDLE hContact,int type) +int WhatsAppProto::UserIsTyping(HCONTACT hContact,int type) { if (hContact && isOnline()) ForkThread(&WhatsAppProto::SendTypingWorker, new send_typing(hContact, type)); @@ -165,7 +165,7 @@ void WhatsAppProto::onMessageStatusUpdate(FMessage* fmsg) { debugLogA(""); - HANDLE hContact = this->ContactIDToHContact(fmsg->key->remote_jid); + HCONTACT hContact = this->ContactIDToHContact(fmsg->key->remote_jid); if (hContact == 0) return; diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index 6b61cca21c..c7239ee4e2 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -61,7 +61,7 @@ int WhatsAppProto::OnModulesLoaded(WPARAM wParam, LPARAM lParam) return 0; } -DWORD_PTR WhatsAppProto::GetCaps( int type, HANDLE hContact ) +DWORD_PTR WhatsAppProto::GetCaps( int type, HCONTACT hContact ) { switch(type) { @@ -139,7 +139,7 @@ HANDLE WhatsAppProto::AddToList( int flags, PROTOSEARCHRESULT* psr ) return NULL; } -int WhatsAppProto::AuthRequest(HANDLE hContact,const PROTOCHAR *message) +int WhatsAppProto::AuthRequest(HCONTACT hContact,const PROTOCHAR *message) { return this->RequestFriendship((WPARAM)hContact, NULL); } @@ -314,7 +314,7 @@ int WhatsAppProto::RequestFriendship(WPARAM wParam, LPARAM lParam) if (wParam == NULL || isOffline()) return 0; - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(wParam); DBVARIANT dbv; if ( !getString(hContact, WHATSAPP_KEY_ID, &dbv)) @@ -363,7 +363,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa return DefWindowProc(hwnd, message, wParam, lParam); }; -void WhatsAppProto::NotifyEvent(const string& title, const string& info, HANDLE contact, DWORD flags, TCHAR* url) +void WhatsAppProto::NotifyEvent(const string& title, const string& info, HCONTACT contact, DWORD flags, TCHAR* url) { TCHAR* rawTitle = mir_a2t_cp(title.c_str(), CP_UTF8); TCHAR* rawInfo = mir_a2t_cp(info.c_str(), CP_UTF8); @@ -372,7 +372,7 @@ void WhatsAppProto::NotifyEvent(const string& title, const string& info, HANDLE mir_free(rawInfo); } -void WhatsAppProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD flags, TCHAR* szUrl) +void WhatsAppProto::NotifyEvent(TCHAR* title, TCHAR* info, HCONTACT contact, DWORD flags, TCHAR* szUrl) { int ret; int timeout; COLORREF colorBack = 0; COLORREF colorText = 0; diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index d8bdab70a6..80e954d71a 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -37,18 +37,18 @@ public: virtual int __cdecl Authorize( HANDLE hDbEvent ); virtual int __cdecl AuthDeny( HANDLE hDbEvent, const PROTOCHAR* szReason ) { return 1; } - virtual int __cdecl AuthRecv( HANDLE hContact, PROTORECVEVENT* ) { return 1; } - virtual int __cdecl AuthRequest( HANDLE hContact, const PROTOCHAR* szMessage ); + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT* ) { return 1; } + virtual int __cdecl AuthRequest(HCONTACT hContact, const PROTOCHAR* szMessage ); virtual HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData ) { return NULL; } - virtual HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath ) { return NULL; } - virtual int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer ) { return 1; } - virtual int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason ) { return 1; } + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath ) { return NULL; } + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer ) { return 1; } + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason ) { return 1; } virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** szFilename ) { return 1; } - virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL ); - virtual int __cdecl GetInfo( HANDLE hContact, int infoType ) { return 1; } + virtual DWORD_PTR __cdecl GetCaps( int type, HCONTACT hContact = NULL ); + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType ) { return 1; } virtual HANDLE __cdecl SearchBasic( const PROTOCHAR* id ); virtual HANDLE __cdecl SearchByEmail( const PROTOCHAR* email ) { return NULL; } @@ -56,25 +56,25 @@ public: virtual HWND __cdecl SearchAdvanced( HWND owner ) { return NULL; } virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ) { return NULL; } - virtual int __cdecl RecvContacts( HANDLE hContact, PROTORECVEVENT* ) { return 1; } - virtual int __cdecl RecvFile( HANDLE hContact, PROTOFILEEVENT* ) { return 1; } - virtual int __cdecl RecvMsg( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvUrl( HANDLE hContact, PROTORECVEVENT* ) { return 1; } + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT* ) { return 1; } + virtual int __cdecl RecvFile(HCONTACT hContact, PROTOFILEEVENT* ) { return 1; } + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT* ) { return 1; } - virtual int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ) { return 1; } - virtual HANDLE __cdecl SendFile( HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles ) { return NULL; } - virtual int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg ); - virtual int __cdecl SendUrl( HANDLE hContact, int flags, const char* url ) { return 1; } + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) { return 1; } + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles ) { return NULL; } + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg ); + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url ) { return 1; } - virtual int __cdecl SetApparentMode( HANDLE hContact, int mode ) { return 1; } + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode ) { return 1; } virtual int __cdecl SetStatus( int iNewStatus ); - virtual HANDLE __cdecl GetAwayMsg( HANDLE hContact ) { return NULL; } - virtual int __cdecl RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVENT* evt ) { return 1; } - virtual int __cdecl SendAwayMsg( HANDLE hContact, HANDLE hProcess, const char* msg ) { return 1; } + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact ) { return NULL; } + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT* evt ) { return 1; } + virtual int __cdecl SendAwayMsg(HCONTACT hContact, HANDLE hProcess, const char* msg ) { return 1; } virtual int __cdecl SetAwayMsg( int iStatus, const PROTOCHAR* msg ) { return 1; } - virtual int __cdecl UserIsTyping( HANDLE hContact, int type ); + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type ); virtual int __cdecl OnEvent( PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam ) { return 1; } @@ -120,18 +120,18 @@ public: void __cdecl SendCreateGroupWorker(void*); // Contacts handling - HANDLE AddToContactList(const std::string& jid, BYTE type = 0, bool dont_check = false, + HCONTACT AddToContactList(const std::string& jid, BYTE type = 0, bool dont_check = false, const char *new_name = NULL, bool isChatRoom = false, bool isHidden = false); - bool IsMyContact(HANDLE, bool include_chat = false); - HANDLE ContactIDToHContact(const std::string&); + bool IsMyContact(HCONTACT hContact, bool include_chat = false); + HCONTACT ContactIDToHContact(const std::string&); void SetAllContactStatuses(int status, bool reset_client = false); - void UpdateStatusMsg(HANDLE hContact); - string GetContactDisplayName(HANDLE hContact); + void UpdateStatusMsg(HCONTACT hContact); + string GetContactDisplayName(HCONTACT hContact); string GetContactDisplayName(const string& jid); void InitContactMenus(); void HandleReceiveGroups(const std::vector& groups, bool isOwned); - bool IsGroupChat(HANDLE hC, bool checkIsAdmin = false) + bool IsGroupChat(HCONTACT hC, bool checkIsAdmin = false) { return getByte(hC, "SimpleChatRoom", 0) > (checkIsAdmin ? 1 : 0); } @@ -165,9 +165,8 @@ public: string phoneNumber; string jid; string nick; - std::map hContactByJid; - //std::map> membersByGroupContact; - map> isMemberByGroupContact; + std::map hContactByJid; + map> isMemberByGroupContact; // WhatsApp Events virtual void onMessageForMe(FMessage* paramFMessage, bool paramBoolean); @@ -206,8 +205,8 @@ public: virtual void onLeaveGroup(const std::string& paramString); // Information providing - void NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD flags, TCHAR* url=NULL); - void NotifyEvent(const string& title, const string& info, HANDLE contact, DWORD flags, TCHAR* url=NULL); + void NotifyEvent(TCHAR* title, TCHAR* info, HCONTACT contact, DWORD flags, TCHAR* url = NULL); + void NotifyEvent(const string& title, const string& info, HCONTACT contact, DWORD flags, TCHAR* url = NULL); }; diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp index e5285ddf0a..3e64694ade 100644 --- a/protocols/WhatsApp/src/theme.cpp +++ b/protocols/WhatsApp/src/theme.cpp @@ -40,7 +40,7 @@ char *GetIconDescription(const char* name) HGENMENU g_hContactMenuItems[CMITEMS_COUNT]; // Helper functions -static WhatsAppProto* GetInstanceByHContact(HANDLE hContact) +static WhatsAppProto* GetInstanceByHContact(HCONTACT hContact) { char *proto = GetContactProto(hContact); if( !proto ) @@ -56,14 +56,14 @@ static WhatsAppProto* GetInstanceByHContact(HANDLE hContact) template INT_PTR GlobalService(WPARAM wParam,LPARAM lParam) { - WhatsAppProto *proto = GetInstanceByHContact(reinterpret_cast(wParam)); + WhatsAppProto *proto = GetInstanceByHContact(reinterpret_cast(wParam)); return proto ? (proto->*Fcn)(wParam,lParam) : 0; } template INT_PTR GlobalServiceParam(WPARAM wParam,LPARAM lParam, LPARAM lParam2) { - WhatsAppProto *proto = GetInstanceByHContact(reinterpret_cast(wParam)); + WhatsAppProto *proto = GetInstanceByHContact(reinterpret_cast(wParam)); return proto ? (proto->*Fcn)(wParam,lParam,lParam2) : 0; } @@ -72,7 +72,7 @@ static int PrebuildContactMenu(WPARAM wParam,LPARAM lParam) for (size_t i=0; i(wParam)); + WhatsAppProto *proto = GetInstanceByHContact(reinterpret_cast(wParam)); return proto ? proto->OnPrebuildContactMenu(wParam,lParam) : 0; } @@ -104,7 +104,7 @@ void WhatsAppProto::InitContactMenus() int WhatsAppProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam) { - HANDLE hContact = reinterpret_cast(wParam); + HCONTACT hContact = reinterpret_cast(wParam); if (hContact) debugLogA(this->GetContactDisplayName(hContact).c_str()); else @@ -144,10 +144,10 @@ int WhatsAppProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam) svcName += "/AddContactToGroup_"; DBVARIANT dbv; - for (map>::iterator it = this->isMemberByGroupContact.begin(); + for (map>::iterator it = this->isMemberByGroupContact.begin(); it != this->isMemberByGroupContact.end(); ++it) { - map::iterator memberIt = it->second.find(hContact); + map::iterator memberIt = it->second.find(hContact); // Only, if current contact is not already member of this group if ((memberIt == it->second.end() || memberIt->second == false) && !getString(it->first, "ID", &dbv)) { @@ -184,7 +184,7 @@ int WhatsAppProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam) bool bShow = false; if (isOnline() && getByte(hContact, "IsGroupMember", 0) == 1) { - map>::iterator groupsIt = this->isMemberByGroupContact.find(hContact); + map>::iterator groupsIt = this->isMemberByGroupContact.find(hContact); if (groupsIt == this->isMemberByGroupContact.end()) { debugLogA("Group exists only on contact list"); @@ -199,7 +199,7 @@ int WhatsAppProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam) svcName += "/RemoveContactFromGroup_"; DBVARIANT dbv; - for (map::iterator it = groupsIt->second.begin(); it != groupsIt->second.end(); ++it) + for (map::iterator it = groupsIt->second.begin(); it != groupsIt->second.end(); ++it) { if (!getString(it->first, "ID", &dbv)) { diff --git a/protocols/Xfire/src/baseProtocol.h b/protocols/Xfire/src/baseProtocol.h index 7946c2adcb..64abc5720c 100644 --- a/protocols/Xfire/src/baseProtocol.h +++ b/protocols/Xfire/src/baseProtocol.h @@ -29,59 +29,14 @@ //===================================================== // Includes (yea why not include lots of stuff :D ) //===================================================== -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include -#include -#include -#include -#include - -//Miranda SDK headers -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "services.h" - -/*#pragma comment(lib, "atl.lib") -#include -#define _ATL_DLL_IMPL -#include */ +#pragma once #ifndef _BASEPROTO_H #define _BASEPROTO_H +#include "services.h" + //======================================================= // Definitions //======================================================= @@ -103,7 +58,7 @@ INT_PTR GetStatus(WPARAM wParam,LPARAM lParam); INT_PTR TMLoadIcon(WPARAM wParam,LPARAM lParam); INT_PTR SetNickName(WPARAM newnick, LPARAM lparam); -BOOL IsXFireContact(HANDLE h); +BOOL IsXFireContact(HCONTACT h); int displayPopup(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType,HICON hhicon=NULL); BOOL CreateToolTip(int toolID, HWND hDlg, CHAR* pText); void EnableDlgItem(HWND hwndDlg, UINT control, int state); @@ -200,7 +155,7 @@ struct XFire_FoundGame struct XFire_SetAvatar { - HANDLE hContact; + HCONTACT hContact; char* username; }; diff --git a/protocols/Xfire/src/buddylist.cpp b/protocols/Xfire/src/buddylist.cpp index 4c596001a0..a7f2ba8042 100644 --- a/protocols/Xfire/src/buddylist.cpp +++ b/protocols/Xfire/src/buddylist.cpp @@ -36,7 +36,7 @@ //buddylist verarbeitung von der main in buddylist verschoben, um doppelte schleifenverarbeitung zuunterbinden #include "baseProtocol.h" -extern HANDLE handlingBuddys(xfirelib::BuddyListEntry *entry, int clan=0,char* group=NULL,BOOL dontscan=FALSE); +extern HCONTACT handlingBuddys(xfirelib::BuddyListEntry *entry, int clan=0,char* group=NULL,BOOL dontscan=FALSE); extern void setBuddyStatusMsg(xfirelib::BuddyListEntry *entry); namespace xfirelib { diff --git a/protocols/Xfire/src/buddylist.h b/protocols/Xfire/src/buddylist.h index 7ab1e26878..ee6f2a22b4 100644 --- a/protocols/Xfire/src/buddylist.h +++ b/protocols/Xfire/src/buddylist.h @@ -37,60 +37,60 @@ namespace xfirelib { - using namespace std; + using namespace std; - struct Client; - struct BuddyListEntry; + struct Client; + struct BuddyListEntry; - class BuddyList : public PacketListener { - public: - BuddyList(Client *client); - ~BuddyList(); - - vector * getEntries() { return entries; } - vector * getEntriesClan() { return entriesClan; } - - void receivedPacket(XFirePacket *packet); - BuddyListEntry *getBuddyById(long userid); - BuddyListEntry *getBuddyBySid(const char *sid); - BuddyListEntry *getBuddyByName(string username); - private: - void initEntries(BuddyListNamesPacket* buddynames); - void initEntriesClan(ClanBuddyListNamesPacket* buddynames); - void updateOnlineBuddies(BuddyListOnlinePacket* buddiesOnline); - void updateBuddiesGame(BuddyListGamesPacket* buddiesGames); - void updateFriendsofFriend(FriendsBuddyListNamesPacket* friends); - - Client *client; - vector * entries; - vector * entriesClan; - }; + class BuddyList : public PacketListener { + public: + BuddyList(Client *client); + ~BuddyList(); + + vector * getEntries() { return entries; } + vector * getEntriesClan() { return entriesClan; } + + void receivedPacket(XFirePacket *packet); + BuddyListEntry *getBuddyById(long userid); + BuddyListEntry *getBuddyBySid(const char *sid); + BuddyListEntry *getBuddyByName(string username); + private: + void initEntries(BuddyListNamesPacket* buddynames); + void initEntriesClan(ClanBuddyListNamesPacket* buddynames); + void updateOnlineBuddies(BuddyListOnlinePacket* buddiesOnline); + void updateBuddiesGame(BuddyListGamesPacket* buddiesGames); + void updateFriendsofFriend(FriendsBuddyListNamesPacket* friends); + + Client *client; + vector * entries; + vector * entriesClan; + }; class BuddyListEntry { public: - BuddyListEntry(); - ~BuddyListEntry(); - bool isOnline(); - - void setSid(const char *sid); - - long userid; - char sid[16]; - string nick; - string username; - string statusmsg; - string gameinfo; - long game; - long game2; - HANDLE hcontact; - int clanid; - - //lastpopup - char* lastpopup; - - XFireGame *gameObj; - XFireGame *game2Obj; + BuddyListEntry(); + ~BuddyListEntry(); + bool isOnline(); + + void setSid(const char *sid); + + long userid; + char sid[16]; + string nick; + string username; + string statusmsg; + string gameinfo; + long game; + long game2; + HCONTACT hcontact; + int clanid; + + //lastpopup + char* lastpopup; + + XFireGame *gameObj; + XFireGame *game2Obj; }; typedef BuddyListEntry *PBuddyListEntry; diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index b663fd50b5..bc9e744231 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -148,13 +148,13 @@ INT_PTR RecvMessage(WPARAM wParam, LPARAM lParam); INT_PTR SendMessage(WPARAM wParam, LPARAM lParam); int FillList(WPARAM wParam, LPARAM lParam); -HANDLE CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan); -HANDLE CList_FindContact (int uid); +HCONTACT CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan); +HCONTACT CList_FindContact (int uid); void CList_MakeAllOffline(); static INT_PTR UserIsTyping(WPARAM wParam, LPARAM lParam); HANDLE LoadGameIcon(char* g, int id, HICON* ico,BOOL onyico=FALSE,char * gamename=NULL,int*uu=NULL); BOOL GetAvatar(char* username,XFireAvatar* av); -//void SetAvatar(HANDLE hContact, char* username); +//void SetAvatar(HCONTACT hContact, char* username); static void SetAvatar(LPVOID lparam); static INT_PTR GetIPPort(WPARAM /*wParam*/,LPARAM lParam); static INT_PTR GetVIPPort(WPARAM /*wParam*/,LPARAM lParam); @@ -187,7 +187,7 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam); INT_PTR GetXStatusIcon(WPARAM wParam, LPARAM lParam); static INT_PTR GotoProfile2(WPARAM wParam,LPARAM lParam); -HANDLE handlingBuddys(BuddyListEntry *entry, int clan=0,char* group=NULL,BOOL dontscan=FALSE); +HCONTACT handlingBuddys(BuddyListEntry *entry, int clan=0,char* group=NULL,BOOL dontscan=FALSE); int StatusIcon(WPARAM wParam,LPARAM lParam); void CreateGroup(char*grpn,char*field); //void CreateGroup(char*grp); @@ -514,7 +514,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { db_free(&dbv); } CreateGroup(Translate(fofname),"fofgroup"); - HANDLE hc=handlingBuddys(entry,-1,Translate(fofname)); + HCONTACT hc=handlingBuddys(entry,-1,Translate(fofname)); if (hc) { CheckAvatar(entry); @@ -608,8 +608,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { xfire_newc.nick=(char*)invite->nick.c_str(); xfire_newc.id=0; - HANDLE handle=CList_AddContact(xfire_newc,TRUE,TRUE,0); - + HCONTACT handle = CList_AddContact(xfire_newc,TRUE,TRUE,0); if (handle) { // invite nachricht mitsenden string str = (char*)invite->msg.c_str(); @@ -999,7 +998,7 @@ int ExtraListRebuild(WPARAM wparam, LPARAM lparam) int ExtraImageApply1(WPARAM wparam, LPARAM lparam) { - HANDLE hContact = (HANDLE)wparam; + HCONTACT hContact = (HCONTACT)wparam; char *szProto = GetContactProto(hContact); if (szProto != NULL && !lstrcmpiA(szProto, protocolname) && db_get_w(hContact, protocolname, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) { int gameid = db_get_w(hContact, protocolname, "GameId", 0); @@ -1011,7 +1010,7 @@ int ExtraImageApply1(WPARAM wparam, LPARAM lparam) int ExtraImageApply2(WPARAM wparam, LPARAM lparam) { - HANDLE hContact=(HANDLE)wparam; + HCONTACT hContact=(HCONTACT)wparam; // TODO: maybe need to fix extra icons char *szProto = GetContactProto(hContact); if ( szProto != NULL && !lstrcmpiA( szProto, protocolname ) && db_get_w(hContact, protocolname, "Status", ID_STATUS_OFFLINE)!=ID_STATUS_OFFLINE) { @@ -1327,18 +1326,18 @@ static void SetStatusLate( LPVOID param ) static void SendAck( LPVOID param ) { - ProtoBroadcastAck(protocolname, param, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) 1, 0); + ProtoBroadcastAck(protocolname, (HCONTACT)param, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) 1, 0); } static void SendBadAck( LPVOID param ) { - ProtoBroadcastAck(protocolname, param, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 0, LPARAM(Translate("XFire does not support offline messaging!"))); + ProtoBroadcastAck(protocolname, (HCONTACT)param, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 0, LPARAM(Translate("XFire does not support offline messaging!"))); } static INT_PTR UserIsTyping(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = ( HANDLE )wParam; - DBVARIANT dbv; + HCONTACT hContact = (HCONTACT)wParam; + DBVARIANT dbv; if (lParam==PROTOTYPE_SELFTYPING_ON) { @@ -1364,9 +1363,9 @@ static INT_PTR UserIsTyping(WPARAM wParam, LPARAM lParam) INT_PTR SendMessage(WPARAM wParam, LPARAM lParam) { - CCSDATA *ccs = (CCSDATA *) lParam; + CCSDATA *ccs = (CCSDATA *) lParam; PROTORECVEVENT* pre = (PROTORECVEVENT*)ccs->lParam; - DBVARIANT dbv; + DBVARIANT dbv; int sended=0; db_get_s(ccs->hContact, protocolname, "Username",&dbv); @@ -1377,13 +1376,10 @@ INT_PTR SendMessage(WPARAM wParam, LPARAM lParam) mir_forkthread(SendAck,ccs->hContact); sended=1; } - else - { - mir_forkthread(SendBadAck,ccs->hContact); - } - db_free(&dbv); + else mir_forkthread(SendBadAck,ccs->hContact); - return sended; + db_free(&dbv); + return sended; } //======================================================= @@ -1598,15 +1594,15 @@ INT_PTR GetStatus(WPARAM wParam,LPARAM lParam) return ID_STATUS_OFFLINE; } -HANDLE CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan) +HCONTACT CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan) { - HANDLE hContact; + HCONTACT hContact; if (xfc.username == NULL) return 0; // here we create a new one since no one is to be found - hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0); if ( hContact ) { CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM)protocolname ); @@ -1668,7 +1664,7 @@ HANDLE CList_AddContact(XFireContact xfc, bool InList, bool SetOnline,int clan) return false; } -BOOL IsXFireContact(HANDLE hContact) +BOOL IsXFireContact(HCONTACT hContact) { char *szProto = GetContactProto(hContact); if (szProto != NULL && !lstrcmpiA(szProto, protocolname)) @@ -1677,9 +1673,9 @@ BOOL IsXFireContact(HANDLE hContact) return FALSE; } -HANDLE CList_FindContact (int uid) +HCONTACT CList_FindContact (int uid) { - for (HANDLE hContact = db_find_first(protocolname); hContact; hContact = db_find_next(hContact, protocolname)) + for (HCONTACT hContact = db_find_first(protocolname); hContact; hContact = db_find_next(hContact, protocolname)) if ( db_get_dw(hContact, protocolname, "UserId", -1) == uid) return hContact; @@ -1689,7 +1685,7 @@ HANDLE CList_FindContact (int uid) void CList_MakeAllOffline() { vector fhandles; - for (HANDLE hContact = db_find_first(protocolname); hContact; hContact = db_find_next(hContact, protocolname)) { + 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 if (db_get_b(hContact,protocolname,"friendoffriend",0)==1 && db_get_b(NULL,protocolname,"fofdbremove",0)==1) @@ -1770,7 +1766,7 @@ void SetAvatar2(LPVOID lparam) { } void SetAvatar(LPVOID lparam) -//void SetAvatar(HANDLE hContact, char* username) +//void SetAvatar(HCONTACT hContact, char* username) { //EnterCriticalSection(&avatarMutex); //WaitForSingleObject(hMutex, INFINITE); @@ -1932,14 +1928,14 @@ static INT_PTR GetIPPort(WPARAM wParam,LPARAM lParam) HGLOBAL clipbuffer; char* buffer; - if (db_get_w((HANDLE)wParam, protocolname, "Port", -1)==0) + if (db_get_w((HCONTACT)wParam, protocolname, "Port", -1)==0) return 0; DBVARIANT dbv; - if (db_get_s((HANDLE)wParam, protocolname, "ServerIP",&dbv)) + if (db_get_s((HCONTACT)wParam, protocolname, "ServerIP",&dbv)) return 0; - mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w((HANDLE)wParam, protocolname, "Port", -1)); + mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w((HCONTACT)wParam, protocolname, "Port", -1)); db_free(&dbv); @@ -1965,14 +1961,14 @@ static INT_PTR GetVIPPort(WPARAM wParam,LPARAM lParam) HGLOBAL clipbuffer; char* buffer; - if (db_get_w((HANDLE)wParam, protocolname, "VPort", -1)==0) + if (db_get_w((HCONTACT)wParam, protocolname, "VPort", -1)==0) return 0; DBVARIANT dbv; - if (db_get_s((HANDLE)wParam, protocolname, "VServerIP",&dbv)) + if (db_get_s((HCONTACT)wParam, protocolname, "VServerIP",&dbv)) return 0; - mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w((HANDLE)wParam, protocolname, "VPort", -1)); + mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w((HCONTACT)wParam, protocolname, "VPort", -1)); db_free(&dbv); @@ -1997,7 +1993,7 @@ static INT_PTR GotoProfile(WPARAM wParam,LPARAM lParam) DBVARIANT dbv; char temp[64]=""; - if (db_get_s((HANDLE)wParam, protocolname, "Username",&dbv)) + if (db_get_s((HCONTACT)wParam, protocolname, "Username",&dbv)) return 0; strcpy(temp,"http://xfire.com/profile/"); @@ -2013,7 +2009,7 @@ static INT_PTR GotoXFireClanSite(WPARAM wParam,LPARAM lParam) { DBVARIANT dbv; char temp[64]=""; - int clanid=db_get_dw((HANDLE)wParam, protocolname, "Clan",-1); + int clanid=db_get_dw((HCONTACT)wParam, protocolname, "Clan",-1); mir_snprintf(temp, SIZEOF(temp), "ClanUrl_%d", clanid); if (db_get_s(NULL, protocolname, temp,&dbv)) @@ -2074,7 +2070,7 @@ static INT_PTR GotoProfileAct(WPARAM wParam,LPARAM lParam) int RebuildContactMenu( WPARAM wParam, LPARAM lParam ) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; bool bEnabled = true, bEnabled2 = true; DBVARIANT dbv; @@ -2688,9 +2684,9 @@ void setBuddyStatusMsg(BuddyListEntry *entry) } }*/ -HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) +HCONTACT handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) { - HANDLE hContact; + HCONTACT hContact; string game; if (entry==NULL) @@ -3257,14 +3253,14 @@ INT_PTR SendPrefs(WPARAM wparam, LPARAM lparam) int ContactDeleted(WPARAM wParam,LPARAM lParam) { - if (!db_get_b((HANDLE)wParam, protocolname, "DontSendDenyPacket", 0)) - if (db_get_b((HANDLE)wParam,"CList","NotOnList",0)) + if (!db_get_b((HCONTACT)wParam, protocolname, "DontSendDenyPacket", 0)) + if (db_get_b((HCONTACT)wParam,"CList","NotOnList",0)) { if (myClient!=NULL) if (myClient->client->connected) { DBVARIANT dbv2; - if (!db_get((HANDLE)wParam,protocolname,"Username",&dbv2)) { + if (!db_get((HCONTACT)wParam,protocolname,"Username",&dbv2)) { SendDenyInvitationPacket deny; deny.name = dbv2.pszVal; myClient->client->send( &deny ); @@ -3297,7 +3293,7 @@ INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam) char temp[256]; DBVARIANT dbv; - if (!db_get_s((HANDLE)wParam, protocolname, "Username",&dbv)) + if (!db_get_s((HCONTACT)wParam, protocolname, "Username",&dbv)) { mir_snprintf(temp, SIZEOF(temp), Translate("Do you really want to delete your friend %s?"), dbv.pszVal); if (MessageBoxA(NULL,temp,Translate("Confirm Delete"),MB_YESNO|MB_ICONQUESTION)==IDYES) @@ -3308,7 +3304,7 @@ INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam) { SendRemoveBuddyPacket removeBuddy; - removeBuddy.userid=db_get_dw((HANDLE)wParam,protocolname,"UserId",0); + removeBuddy.userid=db_get_dw((HCONTACT)wParam,protocolname,"UserId",0); if (removeBuddy.userid!=0) { @@ -3326,7 +3322,7 @@ INT_PTR BlockFriend(WPARAM wParam,LPARAM lParam) { DBVARIANT dbv; - if (!db_get_s((HANDLE)wParam, protocolname, "Username",&dbv)) + if (!db_get_s((HCONTACT)wParam, protocolname, "Username",&dbv)) { if (MessageBox(NULL,TranslateT("Block this user from ever contacting you again?"),TranslateT("Block Confirmation"),MB_YESNO|MB_ICONQUESTION)==IDYES) { @@ -3353,7 +3349,7 @@ INT_PTR StartThisGame(WPARAM wParam,LPARAM lParam) { xgamelist.Block(TRUE); //hole die gameid des spiels - int id=db_get_w((HANDLE)wParam, protocolname, "GameId",0); + int id=db_get_w((HCONTACT)wParam, protocolname, "GameId",0); //hole passendes spielobjekt Xfire_game*game=xgamelist.getGamebyGameid(id); @@ -3373,7 +3369,7 @@ INT_PTR JoinGame(WPARAM wParam,LPARAM lParam) { xgamelist.Block(TRUE); //hole die gameid des spiels - int id=db_get_w((HANDLE)wParam, protocolname, "GameId",0); + int id=db_get_w((HCONTACT)wParam, protocolname, "GameId",0); //hole passendes spielobjekt Xfire_game*game=xgamelist.getGamebyGameid(id); @@ -3382,8 +3378,8 @@ INT_PTR JoinGame(WPARAM wParam,LPARAM lParam) { if (game) { DBVARIANT dbv; //dbv.pszVal - int port=db_get_w((HANDLE)wParam, protocolname, "Port",0); - if (!db_get_s((HANDLE)wParam, protocolname, "ServerIP",&dbv)) + int port=db_get_w((HCONTACT)wParam, protocolname, "Port",0); + if (!db_get_s((HCONTACT)wParam, protocolname, "ServerIP",&dbv)) { //starte spiel mit netzwerk parametern game->start_game(dbv.pszVal,port); diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp index 687b27284f..28eb283f66 100644 --- a/protocols/Xfire/src/processbuddyinfo.cpp +++ b/protocols/Xfire/src/processbuddyinfo.cpp @@ -27,7 +27,7 @@ extern HANDLE XFireAvatarFolder; return h; }*/ -void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char* username) { +void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HCONTACT hcontact,char* username) { char temp[255] = ""; char filename[1024] = ""; BOOL dl=FALSE; diff --git a/protocols/Xfire/src/processbuddyinfo.h b/protocols/Xfire/src/processbuddyinfo.h index 0964ef983b..e4fad3b387 100644 --- a/protocols/Xfire/src/processbuddyinfo.h +++ b/protocols/Xfire/src/processbuddyinfo.h @@ -4,4 +4,4 @@ #include "getbuddyinfo.h" #include "buddyinfo.h" -void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo,HANDLE hcontact,char* username); \ No newline at end of file +void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo, HCONTACT hcontact,char* username); \ No newline at end of file diff --git a/protocols/Xfire/src/socket.h b/protocols/Xfire/src/socket.h index 370aeb74f7..17fdd46bc6 100644 --- a/protocols/Xfire/src/socket.h +++ b/protocols/Xfire/src/socket.h @@ -10,14 +10,6 @@ #include "stdafx.h" -#include -//#include -//#include -//#include -#include -//#include -#include - #include "socketexception.h" diff --git a/protocols/Xfire/src/stdafx.h b/protocols/Xfire/src/stdafx.h index 3b6a0d7bd2..c6055649f3 100644 --- a/protocols/Xfire/src/stdafx.h +++ b/protocols/Xfire/src/stdafx.h @@ -9,10 +9,12 @@ #define _WIN32_WINNT 0x0501 // Ändern Sie dies in den geeigneten Wert für andere Versionen von Windows. #endif +#include #include #include #include #include +#include #define uint unsigned int #define socklen_t int @@ -33,4 +35,44 @@ #pragma comment(lib,"user32.lib") #pragma comment(lib,"gdi32.lib") -// TODO: Hier auf zusätzliche Header, die das Programm erfordert, verweisen. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "resource.h" + +//Miranda SDK headers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp index 0ae7e662f6..bb30eccb98 100644 --- a/protocols/Xfire/src/userdetails.cpp +++ b/protocols/Xfire/src/userdetails.cpp @@ -61,7 +61,7 @@ void LoadProfilStatus(LPVOID lparam) { delete[] lparam; } -void SetItemTxt(HWND hwndDlg,int feldid,char*feld,HANDLE hcontact,int type) +void SetItemTxt(HWND hwndDlg,int feldid,char*feld,HCONTACT hcontact,int type) { DBVARIANT dbv; if (!db_get(hcontact,protocolname,feld,&dbv)) { @@ -91,14 +91,14 @@ static int GetIPPortUDetails(HANDLE wParam,char* feld1,char* feld2) HGLOBAL clipbuffer; char* buffer; - if (db_get_w((HANDLE)wParam, protocolname, feld2, -1)==0) + if (db_get_w((HCONTACT)wParam, protocolname, feld2, -1)==0) return 0; DBVARIANT dbv; - if (db_get_s((HANDLE)wParam, protocolname, feld1,&dbv)) + if (db_get_s((HCONTACT)wParam, protocolname, feld1,&dbv)) return 0; - mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w((HANDLE)wParam, protocolname, feld2, -1)); + mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w((HCONTACT)wParam, protocolname, feld2, -1)); db_free(&dbv); @@ -118,7 +118,7 @@ static int GetIPPortUDetails(HANDLE wParam,char* feld1,char* feld2) return 0; } -void addToList(HWND listbox,HANDLE hContact,char*key,char*val) +void addToList(HWND listbox,HCONTACT hContact,char*key,char*val) { DBVARIANT dbv; if (!db_get(hContact,protocolname,val,&dbv)) @@ -245,7 +245,7 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam case PSN_INFOCHANGED: { char* szProto; - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; uhandle=hContact; //handle sichern if (hContact == NULL) @@ -370,7 +370,7 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam case PSN_INFOCHANGED: { char* szProto; - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; if (hContact == NULL) szProto = protocolname; @@ -429,7 +429,7 @@ static INT_PTR CALLBACK DlgProcUserDetails(HWND hwndDlg, UINT msg, WPARAM wParam int OnDetailsInit(WPARAM wParam,LPARAM lParam) { - if (!IsXFireContact((HANDLE)lParam)) + if (!IsXFireContact((HCONTACT)lParam)) return 0; OPTIONSDIALOGPAGE odp = { sizeof(odp) }; diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index 47318c1b3e..4eb38181ac 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -155,7 +155,6 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) PROTO_AVATAR_INFORMATIONT AI; struct avatar_info *avt = ( avatar_info* )pavt; int error = 0; - HANDLE hContact = 0; TCHAR buf[4096]; if (avt == NULL) { @@ -172,7 +171,7 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) LOG(("yahoo_recv_avatarthread who:%s url:%s checksum: %d", avt->who, avt->pic_url, avt->cksum)); - hContact = getbuddyH(avt->who); + HCONTACT hContact = getbuddyH(avt->who); if (!hContact) { LOG(("ERROR: Can't find buddy: %s", avt->who)); @@ -259,7 +258,7 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) void CYahooProto::ext_got_picture(const char *me, const char *who, const char *pic_url, int cksum, int type) { - HANDLE hContact = 0; + HCONTACT hContact = 0; LOG(("[ext_yahoo_got_picture] for %s with url %s (checksum: %d) type: %d", who, pic_url, cksum, type)); @@ -451,7 +450,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p void CYahooProto::ext_got_picture_checksum(const char *me, const char *who, int cksum) { - HANDLE hContact = 0; + HCONTACT hContact = 0; LOG(("ext_yahoo_got_picture_checksum for %s checksum: %d", who, cksum)); @@ -489,7 +488,7 @@ void CYahooProto::ext_got_picture_checksum(const char *me, const char *who, int void CYahooProto::ext_got_picture_update(const char *me, const char *who, int buddy_icon) { - HANDLE hContact = 0; + HCONTACT hContact = 0; LOG(("ext_got_picture_update for %s buddy_icon: %d", who, buddy_icon)); @@ -507,7 +506,7 @@ void CYahooProto::ext_got_picture_update(const char *me, const char *who, int bu void CYahooProto::ext_got_picture_status(const char *me, const char *who, int buddy_icon) { - HANDLE hContact = 0; + HCONTACT hContact = 0; LOG(("ext_yahoo_got_picture_status for %s buddy_icon: %d", who, buddy_icon)); @@ -573,7 +572,7 @@ void CYahooProto::ext_got_avatar_share(int buddy_icon) setByte("ShareAvatar", buddy_icon ); } -void CYahooProto::reset_avatar(HANDLE hContact) +void CYahooProto::reset_avatar(HCONTACT hContact) { LOG(("[YAHOO_RESET_AVATAR]")); @@ -587,7 +586,7 @@ void CYahooProto::request_avatar(const char* who) return; } - HANDLE hContact = getbuddyH(who); + HCONTACT hContact = getbuddyH(who); if (!hContact) return; @@ -607,7 +606,7 @@ void CYahooProto::request_avatar(const char* who) else LOG(("Avatar Not Available for: %s Last Check: %ld Current: %ld (Flood Check in Effect)", who, last_chk, cur_time)); } -void CYahooProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, int cbLen, int type) +void CYahooProto::GetAvatarFileName(HCONTACT hContact, TCHAR* pszDest, int cbLen, int type) { int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST( _T("%miranda_avatarcache%")), m_szModuleName); diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index 0b22d5e23f..75dbf851ea 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -244,7 +244,7 @@ void CYahooProto::ChatEvent(const char* room, const char* who, int evt, const TC TCHAR* idt = mir_a2t(room); TCHAR* snt = mir_a2t(who); - HANDLE hContact = getbuddyH(who); + HCONTACT hContact = getbuddyH(who); TCHAR* nick = hContact ? (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, WPARAM(hContact), GCDNF_TCHAR) : snt; GCDEST gcd = { m_szModuleName, idt, evt }; @@ -395,18 +395,19 @@ int __cdecl CYahooProto::OnGCMenuHook(WPARAM, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // Invite to chat dialog -static void clist_chat_invite_send(HANDLE hItem, HWND hwndList, YList* &who, char* room, CYahooProto* ppro, TCHAR *msg) +static void clist_chat_invite_send(HCONTACT hItem, HWND hwndList, YList* &who, char* room, CYahooProto* ppro, TCHAR *msg) { bool root = !hItem; if (root) - hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); + hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); while (hItem) { if (IsHContactGroup(hItem)) { - HANDLE hItemT = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); - if (hItemT) clist_chat_invite_send(hItemT, hwndList, who, room, ppro, msg); + HCONTACT hItemT = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + if (hItemT) + clist_chat_invite_send(hItemT, hwndList, who, room, ppro, msg); } else { @@ -428,7 +429,7 @@ static void clist_chat_invite_send(HANDLE hItem, HWND hwndList, YList* &who, cha } } } - hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); + hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); } if (root && who) @@ -450,26 +451,25 @@ static void clist_chat_invite_send(HANDLE hItem, HWND hwndList, YList* &who, cha } } -static void ClistValidateContact(HANDLE hItem, HWND hwndList, CYahooProto* ppro) +static void ClistValidateContact(HCONTACT hItem, HWND hwndList, CYahooProto* ppro) { if (!ppro->IsMyContact(hItem) || ppro->isChatRoom(hItem) || ppro->getWord(hItem, "Status", ID_STATUS_OFFLINE) == ID_STATUS_ONTHEPHONE) SendMessage(hwndList, CLM_DELETEITEM, (WPARAM)hItem, 0); } -static void ClistChatPrepare(HANDLE hItem, HWND hwndList, CYahooProto* ppro) +static void ClistChatPrepare(HCONTACT hItem, HWND hwndList, CYahooProto* ppro) { if (hItem == NULL) - hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); + hItem = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_ROOT, 0); - while (hItem) - { - HANDLE hItemN = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); + while (hItem) { + HCONTACT hItemN = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXT, (LPARAM)hItem); - if (IsHContactGroup(hItem)) - { - HANDLE hItemT = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); - if (hItemT) ClistChatPrepare(hItemT, hwndList, ppro); + if (IsHContactGroup(hItem)) { + HCONTACT hItemT = (HCONTACT)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem); + if (hItemT) + ClistChatPrepare(hItemT, hwndList, ppro); } else if (IsHContactContact(hItem)) ClistValidateContact(hItem, hwndList, ppro); @@ -516,7 +516,7 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA { case CLN_NEWCONTACT: if (param && (nmc->flags & (CLNF_ISGROUP | CLNF_ISINFO)) == 0) - ClistValidateContact(nmc->hItem, nmc->hdr.hwndFrom, param->ppro); + ClistValidateContact((HCONTACT)nmc->hItem, nmc->hdr.hwndFrom, param->ppro); break; case CLN_LISTREBUILT: diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index a3ac8bc57b..e83f9d3836 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -19,7 +19,7 @@ YList *file_transfers=NULL; -static y_filetransfer* new_ft(CYahooProto* ppro, int id, HANDLE hContact, const char *who, const char *msg, +static y_filetransfer* new_ft(CYahooProto* ppro, int id, HCONTACT hContact, const char *who, const char *msg, const char *url, const char *ft_token, int y7, YList *fs, int sending) { yahoo_file_info * fi; @@ -478,7 +478,7 @@ void CYahooProto::ext_got_file(const char *me, const char *who, const char *url, { LOG(("[ext_yahoo_got_file] ident:%s, who: %s, url: %s, expires: %lu, msg: %s, fname: %s, fsize: %lu ftoken: %s y7: %d", me, who, url, expires, msg, fname, fesize, ft_token == NULL ? "NULL" : ft_token, y7)); - HANDLE hContact = getbuddyH(who); + HCONTACT hContact = getbuddyH(who); if (hContact == NULL) hContact = add_buddy(who, who, 0 /* NO FT for other IMs */, PALF_TEMPORARY); @@ -533,7 +533,7 @@ void CYahooProto::ext_got_file(const char *me, const char *who, const char *url, void CYahooProto::ext_got_files(const char *me, const char *who, const char *ft_token, int y7, YList* files) { - HANDLE hContact; + HCONTACT hContact; y_filetransfer *ft; YList *f; char fn[4096]; @@ -699,7 +699,7 @@ void __cdecl CYahooProto::send_filethread(void *psf) //////////////////////////////////////////////////////////////////////////////////////// // SendFile - sends a file -HANDLE __cdecl CYahooProto::SendFile( HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles ) +HANDLE __cdecl CYahooProto::SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles ) { DBVARIANT dbv; y_filetransfer *sf; @@ -763,7 +763,7 @@ HANDLE __cdecl CYahooProto::SendFile( HANDLE hContact, const PROTOCHAR* szDescri //////////////////////////////////////////////////////////////////////////////////////// // FileAllow - starts a file transfer -HANDLE __cdecl CYahooProto::FileAllow( HANDLE /*hContact*/, HANDLE hTransfer, const PROTOCHAR* szPath ) +HANDLE __cdecl CYahooProto::FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath) { y_filetransfer *ft = (y_filetransfer *)hTransfer; size_t len; @@ -792,7 +792,7 @@ HANDLE __cdecl CYahooProto::FileAllow( HANDLE /*hContact*/, HANDLE hTransfer, co //////////////////////////////////////////////////////////////////////////////////////// // FileCancel - cancels a file transfer -int __cdecl CYahooProto::FileCancel( HANDLE /*hContact*/, HANDLE hTransfer ) +int __cdecl CYahooProto::FileCancel(HCONTACT hContact, HANDLE hTransfer) { debugLogA("[YahooFileCancel]"); @@ -815,14 +815,14 @@ int __cdecl CYahooProto::FileCancel( HANDLE /*hContact*/, HANDLE hTransfer ) //////////////////////////////////////////////////////////////////////////////////////// // FileDeny - denies a file transfer -int __cdecl CYahooProto::FileDeny( HANDLE /*hContact*/, HANDLE hTransfer, const PROTOCHAR* ) +int __cdecl CYahooProto::FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR*) { /* deny file receive request.. just ignore it! */ y_filetransfer *ft = (y_filetransfer *)hTransfer; debugLogA("[YahooFileDeny]"); - if ( !m_bLoggedIn || ft == NULL) { + if (!m_bLoggedIn || ft == NULL) { debugLogA("[YahooFileDeny] Not logged-in or some other error!"); return 1; } @@ -838,7 +838,7 @@ int __cdecl CYahooProto::FileDeny( HANDLE /*hContact*/, HANDLE hTransfer, const struct yahoo_file_info *fi = (struct yahoo_file_info *)ft->files->data; debugLogA("[YahooFileDeny] DC Detected: Denying File Transfer!"); - yahoo_ftdc_deny(m_id, ft->who, fi->filename, ft->ftoken, 2); + yahoo_ftdc_deny(m_id, ft->who, fi->filename, ft->ftoken, 2); } return 0; } @@ -846,13 +846,13 @@ int __cdecl CYahooProto::FileDeny( HANDLE /*hContact*/, HANDLE hTransfer, const //////////////////////////////////////////////////////////////////////////////////////// // FileResume - processes file renaming etc -int __cdecl CYahooProto::FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** szFilename ) +int __cdecl CYahooProto::FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** szFilename) { y_filetransfer *ft = (y_filetransfer *)hTransfer; debugLogA("[YahooFileResume] Action: %d", *action); - if ( !m_bLoggedIn || ft == NULL) { + if (!m_bLoggedIn || ft == NULL) { debugLogA("[YahooFileResume] Not loggedin or some other error!"); return 1; } @@ -861,14 +861,13 @@ int __cdecl CYahooProto::FileResume( HANDLE hTransfer, int* action, const PROTOC debugLogA("[YahooFileResume] Action: %d", *action); - if ( *action == FILERESUME_RENAME ) { + if (*action == FILERESUME_RENAME) { debugLogA("[YahooFileResume] Renamed file!"); - + FREE(ft->pfts.tszCurrentFile); - ft->pfts.tszCurrentFile = _tcsdup( *szFilename ); - } + ft->pfts.tszCurrentFile = _tcsdup(*szFilename); + } - SetEvent( ft->hWaitEvent ); + SetEvent(ft->hWaitEvent); return 0; } - diff --git a/protocols/Yahoo/src/file_transfer.h b/protocols/Yahoo/src/file_transfer.h index f33d7cd046..cdbacd9c32 100644 --- a/protocols/Yahoo/src/file_transfer.h +++ b/protocols/Yahoo/src/file_transfer.h @@ -22,7 +22,7 @@ typedef struct { char *msg; char *ftoken; char *relay; - HANDLE hContact; + HCONTACT hContact; int cancel; char *url; HANDLE hWaitEvent; diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index 63ef43875b..224c65677b 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -100,7 +100,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons /* Need to strip off formatting stuff first. Then do all decoding/converting */ LOG(("%s: %s", who, umsg)); - HANDLE hContact = add_buddy(who, who, protocol, PALF_TEMPORARY); + HCONTACT hContact = add_buddy(who, who, protocol, PALF_TEMPORARY); //setWord(hContact, "yprotoid", protocol); Set_Protocol(hContact, protocol); @@ -152,50 +152,50 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons //////////////////////////////////////////////////////////////////////////////////////// // SendMessage - sends a message -void __cdecl CYahooProto::im_sendacksuccess(HANDLE hContact) +void __cdecl CYahooProto::im_sendacksuccess(void *hContact) { - ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) 1, 0); + ProtoBroadcastAck((HCONTACT)hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)1, 0); } -void __cdecl CYahooProto::im_sendackfail(HANDLE hContact) +void __cdecl CYahooProto::im_sendackfail(void *hContact) { SleepEx(1000, TRUE); - ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 1, - (LPARAM) Translate("The message send timed out.")); + ProtoBroadcastAck((HCONTACT)hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)1, + (LPARAM)Translate("The message send timed out.")); } -void __cdecl CYahooProto::im_sendackfail_longmsg(HANDLE hContact) +void __cdecl CYahooProto::im_sendackfail_longmsg(void *hContact) { SleepEx(1000, TRUE); - ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) 1, - (LPARAM)Translate("Message is too long: Yahoo messages are limited by 800 UTF8 chars")); + ProtoBroadcastAck((HCONTACT)hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)1, + (LPARAM)Translate("Message is too long: Yahoo messages are limited by 800 UTF8 chars")); } -int __cdecl CYahooProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc ) +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, hContact); return 1; } ptrA msg; if (flags & PREF_UNICODE) /* convert to utf8 */ - msg = mir_utf8encodeW(( wchar_t* )&pszSrc[ strlen(pszSrc)+1 ] ); - else if ( flags & PREF_UTF ) + msg = mir_utf8encodeW((wchar_t*)&pszSrc[strlen(pszSrc) + 1]); + else if (flags & PREF_UTF) msg = mir_strdup(pszSrc); else msg = mir_utf8encode(pszSrc); if (lstrlenA(msg) > 800) { - ForkThread( &CYahooProto::im_sendackfail_longmsg, hContact ); + ForkThread(&CYahooProto::im_sendackfail_longmsg, hContact); return 1; } DBVARIANT dbv; - if (!getString( hContact, YAHOO_LOGINID, &dbv)) { - send_msg(dbv.pszVal, getWord( hContact, "yprotoid", 0), msg, 1); + 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, hContact); db_free(&dbv); return 1; @@ -207,32 +207,32 @@ int __cdecl CYahooProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc //////////////////////////////////////////////////////////////////////////////////////// // RecvMsg -int __cdecl CYahooProto::RecvMsg( HANDLE hContact, PROTORECVEVENT* pre ) +int __cdecl CYahooProto::RecvMsg(HCONTACT hContact, PROTORECVEVENT* pre) { db_unset(hContact, "CList", "Hidden"); // NUDGES - if ( !lstrcmpA(pre->szMessage, "") && ServiceExists("NUDGE/Send")) { + if (!lstrcmpA(pre->szMessage, "") && ServiceExists("NUDGE/Send")) { debugLogA("[YahooRecvMessage] Doing Nudge Service!"); NotifyEventHooks(hYahooNudge, (WPARAM)hContact, pre->timestamp); return 0; - } + } return Proto_RecvMessage(hContact, pre); } //======================================================= -//Send a nudge +// Send a nudge //======================================================= INT_PTR __cdecl CYahooProto::SendNudge(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT)wParam; debugLogA("[YAHOO_SENDNUDGE]"); if (!m_bLoggedIn) {/* don't send nudge if we not connected! */ - ForkThread( &CYahooProto::im_sendackfail, hContact ); + ForkThread(&CYahooProto::im_sendackfail, hContact); return 1; } @@ -241,12 +241,9 @@ 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, hContact); return 1; } return 0; } - - - diff --git a/protocols/Yahoo/src/links.cpp b/protocols/Yahoo/src/links.cpp index 8af33e94b3..d1136a507a 100644 --- a/protocols/Yahoo/src/links.cpp +++ b/protocols/Yahoo/src/links.cpp @@ -148,7 +148,7 @@ static INT_PTR ServiceParseYmsgrLink(WPARAM wParam, LPARAM lParam) if (arg) *arg = 0; } - HANDLE hContact = proto->add_buddy(id, id, 0, PALF_TEMPORARY); /* ensure contact is on list */ + HCONTACT hContact = proto->add_buddy(id, id, 0, PALF_TEMPORARY); /* ensure contact is on list */ if (hContact) CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, (LPARAM)msg); diff --git a/protocols/Yahoo/src/main.cpp b/protocols/Yahoo/src/main.cpp index 68e9a1167a..8078e72d67 100644 --- a/protocols/Yahoo/src/main.cpp +++ b/protocols/Yahoo/src/main.cpp @@ -79,7 +79,7 @@ LIST g_instances( 1, CompareProtos ); static CYahooProto* yahooProtoInit( const char* pszProtoName, const TCHAR* tszUserName ) { - CYahooProto* ppro = new CYahooProto( pszProtoName, tszUserName ); + CYahooProto* ppro = new CYahooProto(pszProtoName, tszUserName); g_instances.insert( ppro ); diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 183176cb8a..afd2138d9c 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -61,7 +61,7 @@ CYahooProto::~CYahooProto() //////////////////////////////////////////////////////////////////////////////////////// // OnModulesLoadedEx - performs hook registration -int CYahooProto::OnModulesLoadedEx( WPARAM, LPARAM ) +int CYahooProto::OnModulesLoadedEx(WPARAM, LPARAM) { HookProtoEvent( ME_USERINFO_INITIALISE, &CYahooProto::OnUserInfoInit ); HookProtoEvent( ME_IDLE_CHANGED, &CYahooProto::OnIdleEvent); @@ -114,7 +114,7 @@ HANDLE CYahooProto::AddToList( int flags, PROTOSEARCHRESULT* psr ) } char *id = psr->flags & PSR_UNICODE ? mir_utf8encodeW((wchar_t*)psr->id) : mir_utf8encode((char*)psr->id); - HANDLE hContact = getbuddyH(id); + HCONTACT hContact = getbuddyH(id); if (hContact != NULL) { if (db_get_b(hContact, "CList", "NotOnList", 0)) { debugLogA("[YahooAddToList] Temporary Buddy:%s already on our buddy list", id); @@ -164,7 +164,7 @@ HANDLE __cdecl CYahooProto::AddToListByEvent( int flags, int /*iContact*/, HANDL return 0; } - HANDLE hContact = DbGetAuthEventContact(&dbei); + HCONTACT hContact = DbGetAuthEventContact(&dbei); if (hContact != NULL) debugLogA("Temp Buddy found at: %p ", hContact); else @@ -199,7 +199,7 @@ int CYahooProto::Authorize( HANDLE hdbe ) return 1; /* Need to remove the buddy from our Miranda Lists */ - HANDLE hContact = DbGetAuthEventContact(&dbei); + HCONTACT hContact = DbGetAuthEventContact(&dbei); if (hContact != NULL) { ptrA who( getStringA(hContact, YAHOO_LOGINID)); if (who) { @@ -244,7 +244,7 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) } /* Need to remove the buddy from our Miranda Lists */ - HANDLE hContact = DbGetAuthEventContact(&dbei); + HCONTACT hContact = DbGetAuthEventContact(&dbei); if (hContact != NULL) { ptrA who( getStringA(hContact, YAHOO_LOGINID)); if (who) { @@ -262,7 +262,7 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) //////////////////////////////////////////////////////////////////////////////////////// // PSR_AUTH -int __cdecl CYahooProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) +int __cdecl CYahooProto::AuthRecv(HCONTACT hContact, PROTORECVEVENT* pre) { debugLogA("[YahooRecvAuth] "); db_unset(hContact,"CList","Hidden"); @@ -274,7 +274,7 @@ int __cdecl CYahooProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) //////////////////////////////////////////////////////////////////////////////////////// // PSS_AUTHREQUEST -int __cdecl CYahooProto::AuthRequest( HANDLE hContact, const TCHAR* msg ) +int __cdecl CYahooProto::AuthRequest(HCONTACT hContact, const TCHAR* msg ) { debugLogA("[YahooSendAuthRequest]"); @@ -297,7 +297,7 @@ HANDLE __cdecl CYahooProto::ChangeInfo( int /*iInfoType*/, void* ) //////////////////////////////////////////////////////////////////////////////////////// // GetCaps - return protocol capabilities bits -DWORD_PTR __cdecl CYahooProto::GetCaps( int type, HANDLE /*hContact*/ ) +DWORD_PTR __cdecl CYahooProto::GetCaps(int type, HCONTACT hContact) { switch ( type ) { case PFLAGNUM_1: @@ -329,13 +329,13 @@ DWORD_PTR __cdecl CYahooProto::GetCaps( int type, HANDLE /*hContact*/ ) //////////////////////////////////////////////////////////////////////////////////////// // GetInfo - retrieves a contact info -void __cdecl CYahooProto::get_info_thread(HANDLE hContact) +void __cdecl CYahooProto::get_info_thread(void *hContact) { SleepEx(500, TRUE); - ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0); + ProtoBroadcastAck((HCONTACT)hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE)1, 0); } -int __cdecl CYahooProto::GetInfo( HANDLE hContact, int /*infoType*/ ) +int __cdecl CYahooProto::GetInfo(HCONTACT hContact, int /*infoType*/ ) { ForkThread(&CYahooProto::get_info_thread, hContact); return 0; @@ -360,7 +360,7 @@ HANDLE __cdecl CYahooProto::SearchByName( const PROTOCHAR* nick, const PROTOCHAR //////////////////////////////////////////////////////////////////////////////////////// // RecvContacts -int __cdecl CYahooProto::RecvContacts( HANDLE /*hContact*/, PROTORECVEVENT* ) +int __cdecl CYahooProto::RecvContacts(HCONTACT/*hContact*/, PROTORECVEVENT*) { return 1; } @@ -368,7 +368,7 @@ int __cdecl CYahooProto::RecvContacts( HANDLE /*hContact*/, PROTORECVEVENT* ) //////////////////////////////////////////////////////////////////////////////////////// // RecvFile -int __cdecl CYahooProto::RecvFile( HANDLE hContact, PROTORECVFILET* evt ) +int __cdecl CYahooProto::RecvFile(HCONTACT hContact, PROTORECVFILET* evt) { db_unset(hContact, "CList", "Hidden"); @@ -378,7 +378,7 @@ int __cdecl CYahooProto::RecvFile( HANDLE hContact, PROTORECVFILET* evt ) //////////////////////////////////////////////////////////////////////////////////////// // RecvUrl -int __cdecl CYahooProto::RecvUrl( HANDLE /*hContact*/, PROTORECVEVENT* ) +int __cdecl CYahooProto::RecvUrl(HCONTACT/*hContact*/, PROTORECVEVENT*) { return 1; } @@ -386,7 +386,7 @@ int __cdecl CYahooProto::RecvUrl( HANDLE /*hContact*/, PROTORECVEVENT* ) //////////////////////////////////////////////////////////////////////////////////////// // SendContacts -int __cdecl CYahooProto::SendContacts( HANDLE /*hContact*/, int /*flags*/, int /*nContacts*/, HANDLE* /*hContactsList*/ ) +int __cdecl CYahooProto::SendContacts(HCONTACT/*hContact*/, int /*flags*/, int /*nContacts*/, HCONTACT* /*hContactsList*/) { return 1; } @@ -394,7 +394,7 @@ int __cdecl CYahooProto::SendContacts( HANDLE /*hContact*/, int /*flags*/, int / //////////////////////////////////////////////////////////////////////////////////////// // SendUrl -int __cdecl CYahooProto::SendUrl( HANDLE /*hContact*/, int /*flags*/, const char* /*url*/ ) +int __cdecl CYahooProto::SendUrl(HCONTACT/*hContact*/, int /*flags*/, const char* /*url*/) { return 1; } @@ -402,7 +402,7 @@ int __cdecl CYahooProto::SendUrl( HANDLE /*hContact*/, int /*flags*/, const char //////////////////////////////////////////////////////////////////////////////////////// // SetApparentMode - sets the visibility status -int __cdecl CYahooProto::SetApparentMode( HANDLE hContact, int mode ) +int __cdecl CYahooProto::SetApparentMode(HCONTACT hContact, int mode) { if (mode && mode != ID_STATUS_OFFLINE) return 1; @@ -416,7 +416,7 @@ int __cdecl CYahooProto::SetApparentMode( HANDLE hContact, int mode ) //////////////////////////////////////////////////////////////////////////////////////// // SetStatus - sets the protocol status -int __cdecl CYahooProto::SetStatus( int iNewStatus ) +int __cdecl CYahooProto::SetStatus(int iNewStatus) { LOG(("[SetStatus] New status %S", pcli->pfnGetStatusModeDescription(iNewStatus, 0))); @@ -424,7 +424,8 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) logout(); - } else if (!m_bLoggedIn) { + } + else if (!m_bLoggedIn) { DBVARIANT dbv; int err = 0; char errmsg[80]; @@ -472,7 +473,7 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) if (err != 0) { BroadcastStatus(ID_STATUS_OFFLINE); - ShowError( TranslateT("Yahoo Login Error"), _A2T(errmsg)); + ShowError(TranslateT("Yahoo Login Error"), _A2T(errmsg)); return 0; } @@ -495,12 +496,12 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) BroadcastStatus(ID_STATUS_CONNECTING); - iNewStatus = (iNewStatus == ID_STATUS_INVISIBLE) ? YAHOO_STATUS_INVISIBLE: YAHOO_STATUS_AVAILABLE; + iNewStatus = (iNewStatus == ID_STATUS_INVISIBLE) ? YAHOO_STATUS_INVISIBLE : YAHOO_STATUS_AVAILABLE; ForkThread(&CYahooProto::server_main, (void *)iNewStatus); } else if (iNewStatus == ID_STATUS_INVISIBLE) { /* other normal away statuses are set via setaway */ BroadcastStatus(iNewStatus); - set_status(m_iStatus,NULL,(m_iStatus != ID_STATUS_ONLINE) ? 1 : 0); + set_status(m_iStatus, NULL, (m_iStatus != ID_STATUS_ONLINE) ? 1 : 0); } else { /* clear out our message just in case, STUPID AA! */ @@ -516,13 +517,14 @@ int __cdecl CYahooProto::SetStatus( int iNewStatus ) //////////////////////////////////////////////////////////////////////////////////////// // GetAwayMsg - returns a contact's away message -void __cdecl CYahooProto::get_status_thread(HANDLE hContact) +void __cdecl CYahooProto::get_status_thread(void *param) { int l; DBVARIANT dbv; char *gm = NULL, *sm = NULL, *fm; + HCONTACT hContact = (HCONTACT)param; - Sleep( 150 ); + Sleep(150); /* Check Yahoo Games Message */ if (!getString(hContact, "YGMsg", &dbv)) { @@ -530,7 +532,7 @@ void __cdecl CYahooProto::get_status_thread(HANDLE hContact) db_free(&dbv); } - if (! db_get_s(hContact, "CList", "StatusMsg", &dbv)) { + if (!db_get_s(hContact, "CList", "StatusMsg", &dbv)) { if (lstrlenA(dbv.pszVal) >= 1) sm = strdup(dbv.pszVal); @@ -538,7 +540,7 @@ void __cdecl CYahooProto::get_status_thread(HANDLE hContact) } else { int status = getWord(hContact, "YStatus", (WORD)YAHOO_STATUS_OFFLINE); - sm = yahoo_status_code( yahoo_status(status)); + sm = yahoo_status_code(yahoo_status(status)); if (sm) sm = strdup(sm); /* we need this to go global FREE later */ } @@ -547,18 +549,19 @@ void __cdecl CYahooProto::get_status_thread(HANDLE hContact) l += lstrlenA(gm) + 3; l += lstrlenA(sm) + 1; - fm = (char *) malloc(l); + fm = (char *)malloc(l); - fm[0] ='\0'; + fm[0] = '\0'; if (gm && lstrlenA(gm) > 0) { /* BAH YAHOO SUCKS! WHAT A PAIN! find first carriage return add status message then add the rest */ char *c = strchr(gm, '\r'); if (c != NULL) { - lstrcpynA(fm,gm, c - gm + 1); + lstrcpynA(fm, gm, c - gm + 1); fm[c - gm + 1] = '\0'; - } else + } + else lstrcpyA(fm, gm); if (sm) { @@ -568,16 +571,17 @@ void __cdecl CYahooProto::get_status_thread(HANDLE hContact) if (c != NULL) lstrcatA(fm, c); - } else if (sm) { + } + else if (sm) { lstrcatA(fm, sm); } FREE(sm); - ProtoBroadcastAck( hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, ( HANDLE )1, (LPARAM)( TCHAR* )_A2T(fm)); + ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)(TCHAR*)_A2T(fm)); } -HANDLE __cdecl CYahooProto::GetAwayMsg( HANDLE hContact ) +HANDLE __cdecl CYahooProto::GetAwayMsg(HCONTACT hContact) { debugLogA("[YahooGetAwayMessage] "); @@ -595,7 +599,7 @@ HANDLE __cdecl CYahooProto::GetAwayMsg( HANDLE hContact ) //////////////////////////////////////////////////////////////////////////////////////// // PSR_AWAYMSG -int __cdecl CYahooProto::RecvAwayMsg( HANDLE /*hContact*/, int /*statusMode*/, PROTORECVEVENT* ) +int __cdecl CYahooProto::RecvAwayMsg(HCONTACT/*hContact*/, int /*statusMode*/, PROTORECVEVENT*) { return 1; } @@ -603,18 +607,19 @@ int __cdecl CYahooProto::RecvAwayMsg( HANDLE /*hContact*/, int /*statusMode*/, P //////////////////////////////////////////////////////////////////////////////////////// // SetAwayMsg - sets the away status message -int __cdecl CYahooProto::SetAwayMsg( int status, const PROTOCHAR* msg ) +int __cdecl CYahooProto::SetAwayMsg(int status, const PROTOCHAR* msg) { char *c = msg && msg[0] ? mir_utf8encodeT(msg) : NULL; debugLogA("[YahooSetAwayMessage] Status: %S, Msg: %s", pcli->pfnGetStatusModeDescription(status, 0), (char*)c); - if (!m_bLoggedIn) { + if (!m_bLoggedIn) { if (m_iStatus == ID_STATUS_OFFLINE) { debugLogA("[YahooSetAwayMessage] WARNING: WE ARE OFFLINE!"); mir_free(c); return 1; - } else { + } + else { if (m_startMsg) free(m_startMsg); m_startMsg = c ? strdup(c) : NULL; @@ -634,10 +639,12 @@ int __cdecl CYahooProto::SetAwayMsg( int status, const PROTOCHAR* msg ) m_startMsg = strdup(c); if (status == ID_STATUS_ONLINE) { set_status(YAHOO_CUSTOM_STATUS, c, 0); - } else if (status != ID_STATUS_INVISIBLE) { + } + else if (status != ID_STATUS_INVISIBLE) { set_status(YAHOO_CUSTOM_STATUS, c, 1); } - } else { + } + else { set_status(status, NULL, 0); m_startMsg = NULL; } @@ -651,32 +658,33 @@ int __cdecl CYahooProto::SetAwayMsg( int status, const PROTOCHAR* msg ) INT_PTR __cdecl CYahooProto::GetMyAwayMsg(WPARAM wParam, LPARAM lParam) { - if (!m_bLoggedIn || ! m_startMsg) + if (!m_bLoggedIn || !m_startMsg) return 0; if (lParam & SGMA_UNICODE) { - return (INT_PTR) mir_utf8decodeW(m_startMsg); - } else { - return (INT_PTR) mir_utf8decodeA(m_startMsg); + return (INT_PTR)mir_utf8decodeW(m_startMsg); + } + else { + return (INT_PTR)mir_utf8decodeA(m_startMsg); } } ///////////////////////////////////////////////////////////////////////////////////////// // UserIsTyping - sends a UTN notification -int __cdecl CYahooProto::UserIsTyping( HANDLE hContact, int type ) +int __cdecl CYahooProto::UserIsTyping(HCONTACT hContact, int type) { if (!m_bLoggedIn) return 0; char *szProto = GetContactProto(hContact); - if (szProto==NULL || strcmp(szProto, m_szModuleName)) + if (szProto == NULL || strcmp(szProto, m_szModuleName)) return 0; DBVARIANT dbv; if (!getString(hContact, YAHOO_LOGINID, &dbv)) { if (type == PROTOTYPE_SELFTYPING_OFF || type == PROTOTYPE_SELFTYPING_ON) { - sendtyping(dbv.pszVal, getWord(hContact, "yprotoid", 0), type == PROTOTYPE_SELFTYPING_ON?1:0); + sendtyping(dbv.pszVal, getWord(hContact, "yprotoid", 0), type == PROTOTYPE_SELFTYPING_ON ? 1 : 0); } db_free(&dbv); } @@ -686,31 +694,31 @@ int __cdecl CYahooProto::UserIsTyping( HANDLE hContact, int type ) ///////////////////////////////////////////////////////////////////////////////////////// // OnEvent - maintain protocol events -int __cdecl CYahooProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam ) +int __cdecl CYahooProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) { - switch( eventType ) { - case EV_PROTO_ONLOAD: return OnModulesLoadedEx( 0, 0); + switch (eventType) { + case EV_PROTO_ONLOAD: return OnModulesLoadedEx(0, 0); //case EV_PROTO_ONEXIT: return OnPreShutdown( 0, 0); - case EV_PROTO_ONOPTIONS: return OnOptionsInit( wParam, lParam ); - - case EV_PROTO_ONMENU: - MenuMainInit(); - break; - - case EV_PROTO_ONRENAME: - if ( mainMenuRoot ) { - CLISTMENUITEM mi = { sizeof(mi) }; - mi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; - mi.ptszName = m_tszUserName; - Menu_ModifyItem(mainMenuRoot, &mi); - } - break; + case EV_PROTO_ONOPTIONS: return OnOptionsInit(wParam, lParam); + + case EV_PROTO_ONMENU: + MenuMainInit(); + break; - case EV_PROTO_ONCONTACTDELETED: - return OnContactDeleted(wParam, lParam); + case EV_PROTO_ONRENAME: + if (mainMenuRoot) { + CLISTMENUITEM mi = { sizeof(mi) }; + mi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; + mi.ptszName = m_tszUserName; + Menu_ModifyItem(mainMenuRoot, &mi); + } + break; + + case EV_PROTO_ONCONTACTDELETED: + return OnContactDeleted(wParam, lParam); - case EV_PROTO_DBSETTINGSCHANGED: - return OnSettingChanged(wParam, lParam); + case EV_PROTO_DBSETTINGSCHANGED: + return OnSettingChanged(wParam, lParam); } return 1; } @@ -727,12 +735,12 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ppro = (CYahooProto*)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); - if ( !ppro->getString(YAHOO_LOGINID, &dbv)) { + if (!ppro->getString(YAHOO_LOGINID, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_HANDLE, dbv.pszVal); db_free(&dbv); } - if ( !ppro->getString(YAHOO_PASSWORD, &dbv)) { + if (!ppro->getString(YAHOO_PASSWORD, &dbv)) { SetDlgItemTextA(hwndDlg, IDC_PASSWORD, dbv.pszVal); db_free(&dbv); } @@ -741,19 +749,19 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return TRUE; case WM_COMMAND: - if ( LOWORD( wParam ) == IDC_NEWYAHOOACCOUNTLINK ) { + if (LOWORD(wParam) == IDC_NEWYAHOOACCOUNTLINK) { CallService(MS_UTILS_OPENURL, - 1, - ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_YAHOO_JAPAN ) == 1) ? - (LPARAM) "http://edit.yahoo.co.jp/config/eval_register" : - (LPARAM) "http://edit.yahoo.com/config/eval_register" - ); + 1, + ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_YAHOO_JAPAN) == 1) ? + (LPARAM) "http://edit.yahoo.co.jp/config/eval_register" : + (LPARAM) "http://edit.yahoo.com/config/eval_register" + ); return TRUE; } - if ( HIWORD( wParam ) == EN_CHANGE && ( HWND )lParam == GetFocus()) + if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) { - switch( LOWORD( wParam )) { + switch (LOWORD(wParam)) { case IDC_HANDLE: case IDC_PASSWORD: case IDC_YAHOO_JAPAN: @@ -763,7 +771,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break; case WM_NOTIFY: - if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY ) { + if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { char str[128]; BOOL reconnectRequired = FALSE; @@ -771,17 +779,17 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM dbv.pszVal = NULL; - if (ppro->getString( YAHOO_LOGINID, &dbv) || lstrcmpA(str, dbv.pszVal)) + if (ppro->getString(YAHOO_LOGINID, &dbv) || lstrcmpA(str, dbv.pszVal)) reconnectRequired = TRUE; - if ( dbv.pszVal != NULL) + if (dbv.pszVal != NULL) db_free(&dbv); ppro->setString(YAHOO_LOGINID, str); GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str)); dbv.pszVal = NULL; - if (ppro->getString( YAHOO_PASSWORD, &dbv) || lstrcmpA(str, dbv.pszVal)) + if (ppro->getString(YAHOO_PASSWORD, &dbv) || lstrcmpA(str, dbv.pszVal)) reconnectRequired = TRUE; if (dbv.pszVal != NULL) db_free(&dbv); @@ -790,10 +798,10 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ppro->delSetting(YAHOO_PWTOKEN); ppro->setString(YAHOO_PASSWORD, str); - ppro->setByte("YahooJapan", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_YAHOO_JAPAN )); + ppro->setByte("YahooJapan", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_YAHOO_JAPAN)); - if ( reconnectRequired && ppro->m_bLoggedIn ) - MessageBoxA(hwndDlg, Translate("The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK ); + if (reconnectRequired && ppro->m_bLoggedIn) + MessageBoxA(hwndDlg, Translate("The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK); return TRUE; } @@ -803,9 +811,8 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return FALSE; } - INT_PTR CYahooProto::SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam) { - return (INT_PTR)CreateDialogParam (hInstance, MAKEINTRESOURCE( IDD_YAHOOACCOUNT ), - (HWND)lParam, first_run_dialog, (LPARAM)this ); + return (INT_PTR)CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_YAHOOACCOUNT), + (HWND)lParam, first_run_dialog, (LPARAM)this); } diff --git a/protocols/Yahoo/src/proto.h b/protocols/Yahoo/src/proto.h index 7bff1a73dd..c548585dab 100644 --- a/protocols/Yahoo/src/proto.h +++ b/protocols/Yahoo/src/proto.h @@ -30,18 +30,18 @@ struct CYahooProto : public PROTO virtual int __cdecl Authorize( HANDLE hDbEvent ); virtual int __cdecl AuthDeny( HANDLE hDbEvent, const TCHAR* szReason ); - virtual int __cdecl AuthRecv( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl AuthRequest( HANDLE hContact, const TCHAR* szMessage ); + virtual int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT* ); + virtual int __cdecl AuthRequest(HCONTACT hContact, const TCHAR* szMessage ); virtual HANDLE __cdecl ChangeInfo( int iInfoType, void* pInfoData ); - virtual HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath ); - virtual int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer ); - virtual int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason ); + virtual HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath ); + virtual int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer ); + virtual int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason ); virtual int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** szFilename ); - virtual DWORD_PTR __cdecl GetCaps( int type, HANDLE hContact = NULL); - virtual int __cdecl GetInfo( HANDLE hContact, int infoType ); + virtual DWORD_PTR __cdecl GetCaps( int type, HCONTACT hContact = NULL); + virtual int __cdecl GetInfo(HCONTACT hContact, int infoType ); virtual HANDLE __cdecl SearchBasic( const PROTOCHAR* id ); virtual HANDLE __cdecl SearchByEmail( const PROTOCHAR* email ); @@ -49,49 +49,49 @@ struct CYahooProto : public PROTO virtual HWND __cdecl SearchAdvanced( HWND owner ); virtual HWND __cdecl CreateExtendedSearchUI( HWND owner ); - virtual int __cdecl RecvContacts( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvFile( HANDLE hContact, PROTORECVFILET* ); - virtual int __cdecl RecvMsg( HANDLE hContact, PROTORECVEVENT* ); - virtual int __cdecl RecvUrl( HANDLE hContact, PROTORECVEVENT* ); + virtual int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvFile(HCONTACT hContact, PROTORECVFILET*); + virtual int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT*); + virtual int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT*); - virtual int __cdecl SendContacts( HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList ); - virtual HANDLE __cdecl SendFile( HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles ); - virtual int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg ); - virtual int __cdecl SendUrl( HANDLE hContact, int flags, const char* url ); + virtual int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList); + virtual HANDLE __cdecl SendFile(HCONTACT hContact, const PROTOCHAR *szDescription, PROTOCHAR **ppszFiles); + virtual int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg ); + virtual int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url ); - virtual int __cdecl SetApparentMode( HANDLE hContact, int mode ); - virtual int __cdecl SetStatus( int iNewStatus ); + virtual int __cdecl SetApparentMode(HCONTACT hContact, int mode); + virtual int __cdecl SetStatus(int iNewStatus); - virtual HANDLE __cdecl GetAwayMsg( HANDLE hContact ); - virtual int __cdecl RecvAwayMsg( HANDLE hContact, int mode, PROTORECVEVENT* evt ); - virtual int __cdecl SetAwayMsg( int m_iStatus, const PROTOCHAR* msg ); + virtual HANDLE __cdecl GetAwayMsg(HCONTACT hContact); + virtual int __cdecl RecvAwayMsg(HCONTACT hContact, int mode, PROTORECVEVENT *evt); + virtual int __cdecl SetAwayMsg( int m_iStatus, const PROTOCHAR *msg); virtual INT_PTR __cdecl GetMyAwayMsg(WPARAM wParam, LPARAM lParam); - virtual int __cdecl UserIsTyping( HANDLE hContact, int type ); + virtual int __cdecl UserIsTyping(HCONTACT hContact, int type); - virtual int __cdecl OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam ); + virtual int __cdecl OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam); //====| Events |====================================================================== - int __cdecl OnContactDeleted( WPARAM, LPARAM ); - int __cdecl OnIdleEvent( WPARAM, LPARAM ); - int __cdecl OnModulesLoadedEx( WPARAM, LPARAM ); - int __cdecl OnOptionsInit( WPARAM, LPARAM ); - int __cdecl OnSettingChanged( WPARAM, LPARAM ); + int __cdecl OnContactDeleted(WPARAM, LPARAM); + int __cdecl OnIdleEvent(WPARAM, LPARAM); + int __cdecl OnModulesLoadedEx(WPARAM, LPARAM); + int __cdecl OnOptionsInit(WPARAM, LPARAM); + int __cdecl OnSettingChanged(WPARAM, LPARAM); int __cdecl OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam); //====| Services |==================================================================== - INT_PTR __cdecl OnABCommand( WPARAM, LPARAM ); - INT_PTR __cdecl OnCalendarCommand( WPARAM, LPARAM ); - INT_PTR __cdecl OnEditMyProfile( WPARAM, LPARAM ); - INT_PTR __cdecl OnGotoMailboxCommand( WPARAM, LPARAM ); - INT_PTR __cdecl OnRefreshCommand( WPARAM, LPARAM ); - INT_PTR __cdecl OnShowMyProfileCommand( WPARAM, LPARAM ); - INT_PTR __cdecl OnShowProfileCommand( WPARAM, LPARAM ); + INT_PTR __cdecl OnABCommand(WPARAM, LPARAM); + INT_PTR __cdecl OnCalendarCommand(WPARAM, LPARAM); + INT_PTR __cdecl OnEditMyProfile(WPARAM, LPARAM); + INT_PTR __cdecl OnGotoMailboxCommand(WPARAM, LPARAM); + INT_PTR __cdecl OnRefreshCommand(WPARAM, LPARAM); + INT_PTR __cdecl OnShowMyProfileCommand(WPARAM, LPARAM); + INT_PTR __cdecl OnShowProfileCommand(WPARAM, LPARAM); INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam); - INT_PTR __cdecl GetUnreadEmailCount( WPARAM, LPARAM ); - INT_PTR __cdecl SendNudge( WPARAM, LPARAM ); - INT_PTR __cdecl SetMyAvatar( WPARAM, LPARAM ); + INT_PTR __cdecl GetUnreadEmailCount(WPARAM, LPARAM); + INT_PTR __cdecl SendNudge(WPARAM, LPARAM); + INT_PTR __cdecl SetMyAvatar(WPARAM, LPARAM); INT_PTR __cdecl CreateConference(WPARAM /*wParam*/, LPARAM /*lParam*/); @@ -141,9 +141,9 @@ struct CYahooProto : public PROTO void __cdecl send_avt_thread(void *psf); void __cdecl recv_avatarthread(void *pavt); - INT_PTR __cdecl GetAvatarInfo( WPARAM, LPARAM ); - INT_PTR __cdecl GetAvatarCaps( WPARAM, LPARAM ); - INT_PTR __cdecl GetMyAvatar( WPARAM, LPARAM ); + INT_PTR __cdecl GetAvatarInfo(WPARAM, LPARAM); + INT_PTR __cdecl GetAvatarCaps(WPARAM, LPARAM); + INT_PTR __cdecl GetMyAvatar(WPARAM, LPARAM); void ext_got_picture(const char *me, const char *who, const char *pic_url, int cksum, int type); void ext_got_picture_checksum(const char *me, const char *who, int cksum); @@ -152,11 +152,11 @@ struct CYahooProto : public PROTO void ext_got_picture_upload(const char *me, const char *url, unsigned int ts); void ext_got_avatar_share(int buddy_icon); - void reset_avatar(HANDLE hContact); + void reset_avatar(HCONTACT hContact); void request_avatar(const char* who); void SendAvatar(const TCHAR *szFile); - void GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, int cbLen, int type); + void GetAvatarFileName(HCONTACT hContact, TCHAR* pszDest, int cbLen, int type); //====| chat.cpp |==================================================================== void ChatRegister(void); @@ -195,13 +195,13 @@ struct CYahooProto : public PROTO void send_msg(const char *id, int protocol, const char *msg, int utf8); - void __cdecl im_sendacksuccess(HANDLE hContact); - void __cdecl im_sendackfail(HANDLE hContact); - void __cdecl im_sendackfail_longmsg(HANDLE hContact); + void __cdecl im_sendacksuccess(void *hContact); + void __cdecl im_sendackfail(void *hContact); + void __cdecl im_sendackfail_longmsg(void *hContact); //====| proto.cpp |=================================================================== - void __cdecl get_status_thread(HANDLE hContact); - void __cdecl get_info_thread(HANDLE hContact); + void __cdecl get_status_thread(void *hContact); + void __cdecl get_info_thread(void *hContact); //====| search.cpp |================================================================== void __cdecl search_simplethread(void *snsearch); @@ -217,26 +217,26 @@ struct CYahooProto : public PROTO void OpenURL(const char *url, int autoLogin); - INT_PTR __cdecl SetCustomStatCommand( WPARAM, LPARAM ); + INT_PTR __cdecl SetCustomStatCommand(WPARAM, LPARAM); //====| user_info.cpp |=============================================================== int __cdecl OnUserInfoInit( WPARAM wParam, LPARAM lParam ); //====| util.cpp |==================================================================== - int GetStringUtf( HANDLE hContact, const char* name, DBVARIANT* ); - DWORD SetStringUtf( HANDLE hContact, const char* valueName, const char* parValue ); + int GetStringUtf(HCONTACT hContact, const char* name, DBVARIANT* ); + DWORD SetStringUtf(HCONTACT hContact, const char* valueName, const char* parValue ); - DWORD Set_Protocol( HANDLE hContact, int protocol ); + DWORD Set_Protocol(HCONTACT hContact, int protocol ); int ShowNotification(const TCHAR *title, const TCHAR *info, DWORD flags); void ShowError(const TCHAR *title, const TCHAR *buff); int ShowPopup( const TCHAR* nickname, const TCHAR* msg, const char *szURL ); - bool IsMyContact(HANDLE hContact); + bool IsMyContact(HCONTACT hContact); //====| yahoo.cpp |=================================================================== - HANDLE add_buddy( const char *yahoo_id, const char *yahoo_name, int protocol, DWORD flags ); + HCONTACT add_buddy(const char *yahoo_id, const char *yahoo_name, int protocol, DWORD flags); const char *find_buddy( const char *yahoo_id); - HANDLE getbuddyH(const char *yahoo_id); + HCONTACT getbuddyH(const char *yahoo_id); void remove_buddy(const char *who, int protocol); void logout(); @@ -272,7 +272,7 @@ struct CYahooProto : public PROTO void ext_login_response(int succ, const char *url); void ext_login(enum yahoo_status login_mode); - void AddBuddy(HANDLE hContact, const char *group, const TCHAR *msg); + void AddBuddy(HCONTACT hContact, const char *group, const TCHAR *msg); void YAHOO_utils_logversion(); diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 4730a59211..ebf142a7ab 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -31,7 +31,7 @@ void CYahooProto::logoff_buddies() { //set all contacts to 'offline' - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { setWord( hContact, "Status", ID_STATUS_OFFLINE ); setDword(hContact, "IdleTS", 0); setDword(hContact, "PictLastCheck", 0); @@ -80,14 +80,14 @@ void CYahooProto::BroadcastStatus(int s) //======================================================= //Contact deletion event //======================================================= -int __cdecl CYahooProto::OnContactDeleted( WPARAM wParam, LPARAM lParam ) +int __cdecl CYahooProto::OnContactDeleted(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT)wParam; debugLogA("[YahooContactDeleted]"); - if ( !m_bLoggedIn ) {//should never happen for Yahoo contacts + if (!m_bLoggedIn) {//should never happen for Yahoo contacts debugLogA("[YahooContactDeleted] We are not Logged On!!!"); return 0; } @@ -103,9 +103,9 @@ int __cdecl CYahooProto::OnContactDeleted( WPARAM wParam, LPARAM lParam ) remove_buddy(dbv.pszVal, getWord(hContact, "yprotoid", 0)); db_free(&dbv); - } else { - debugLogA("[YahooContactDeleted] Can't retrieve contact Yahoo ID"); } + else debugLogA("[YahooContactDeleted] Can't retrieve contact Yahoo ID"); + return 0; } @@ -244,21 +244,21 @@ void CYahooProto::OpenURL(const char *url, int autoLogin) } //======================================================= -//Show buddy profile +// Show buddy profile //======================================================= -INT_PTR __cdecl CYahooProto::OnShowProfileCommand( WPARAM wParam, LPARAM lParam ) +INT_PTR __cdecl CYahooProto::OnShowProfileCommand(WPARAM wParam, LPARAM lParam) { - char tUrl[ 4096 ]; + char tUrl[4096]; DBVARIANT dbv; /** * We don't show profile for users using other IM clients through the IM server bridge */ - if (getWord(( HANDLE )wParam, "yprotoid", 0) != 0) { + if (getWord((HCONTACT)wParam, "yprotoid", 0) != 0) { return 0; } - if (getString((HANDLE)wParam, YAHOO_LOGINID, &dbv)) + if (getString((HCONTACT)wParam, YAHOO_LOGINID, &dbv)) return 0; mir_snprintf(tUrl, sizeof(tUrl), "http://profiles.yahoo.com/%s", dbv.pszVal); @@ -497,7 +497,7 @@ void CYahooProto::MenuUninit( void ) int __cdecl CYahooProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) { - const HANDLE hContact = (HANDLE)wParam; + const HCONTACT hContact = (HCONTACT)wParam; if (!IsMyContact(hContact)) { debugLogA("[OnPrebuildContactMenu] Not a Yahoo Contact!!!"); return 0; diff --git a/protocols/Yahoo/src/user_info.cpp b/protocols/Yahoo/src/user_info.cpp index 39d5ed9027..79a2c77c64 100644 --- a/protocols/Yahoo/src/user_info.cpp +++ b/protocols/Yahoo/src/user_info.cpp @@ -47,7 +47,7 @@ static INT_PTR CALLBACK YahooUserInfoDlgProc( HWND hwndDlg, UINT msg, WPARAM wPa break; char* szProto; - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; if (hContact == NULL) { szProto = ppro->m_szModuleName; @@ -118,7 +118,7 @@ int __cdecl CYahooProto::OnUserInfoInit( WPARAM wParam, LPARAM lParam ) odp.dwInitParam = (LPARAM)this; odp.flags = ODPF_TCHAR | ODPF_DONTTRANSLATE; - HANDLE hContact = ( HANDLE )lParam; + HCONTACT hContact = (HCONTACT)lParam; if ( IsMyContact(hContact)) { odp.pfnDlgProc = YahooUserInfoDlgProc; odp.position = -1900000000; diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index 044c31ba84..2cad148fb1 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -39,7 +39,7 @@ int debugLogA( const char *fmt, ... ) return CallService(MS_NETLIB_LOG, (WPARAM)g_hNetlibUser, (LPARAM)str); } -DWORD CYahooProto::Set_Protocol( HANDLE hContact, int protocol ) +DWORD CYahooProto::Set_Protocol(HCONTACT hContact, int protocol ) { char *s=NULL; @@ -59,11 +59,11 @@ DWORD CYahooProto::Set_Protocol( HANDLE hContact, int protocol ) return 0; } -int CYahooProto::GetStringUtf(HANDLE hContact, const char* name, DBVARIANT* result) +int CYahooProto::GetStringUtf(HCONTACT hContact, const char* name, DBVARIANT* result) { return db_get_utf(hContact, m_szModuleName, name, result); } -DWORD CYahooProto::SetStringUtf(HANDLE hContact, const char* valueName, const char* parValue) +DWORD CYahooProto::SetStringUtf(HCONTACT hContact, const char* valueName, const char* parValue) { return db_set_utf(hContact, m_szModuleName, valueName, parValue); } @@ -162,8 +162,8 @@ int __cdecl CYahooProto::OnSettingChanged(WPARAM wParam, LPARAM lParam) debugLogA("DB Setting changed. YAHOO user's visible setting changed."); DBVARIANT dbv; - if (!getString((HANDLE)wParam, YAHOO_LOGINID, &dbv)) { - int iAdd = (ID_STATUS_OFFLINE == getWord((HANDLE) wParam, "ApparentMode", 0)); + if (!getString((HCONTACT)wParam, YAHOO_LOGINID, &dbv)) { + int iAdd = (ID_STATUS_OFFLINE == getWord((HCONTACT)wParam, "ApparentMode", 0)); stealth(dbv.pszVal, iAdd); db_free(&dbv); } @@ -171,7 +171,7 @@ int __cdecl CYahooProto::OnSettingChanged(WPARAM wParam, LPARAM lParam) return 0; } -bool CYahooProto::IsMyContact(HANDLE hContact) +bool CYahooProto::IsMyContact(HCONTACT hContact) { if (!hContact) return false; diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 980fb3461e..9c5edf2f63 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -228,7 +228,7 @@ void CYahooProto::logout() poll_loop = 0; } -void CYahooProto::AddBuddy(HANDLE hContact, const char *group, const TCHAR *msg) +void CYahooProto::AddBuddy(HCONTACT hContact, const char *group, const TCHAR *msg) { DBVARIANT dbv; char *fname=NULL, *lname=NULL, *ident=NULL, *who, *u_msg; @@ -282,9 +282,9 @@ void CYahooProto::AddBuddy(HANDLE hContact, const char *group, const TCHAR *msg) mir_free(u_msg); } -HANDLE CYahooProto::getbuddyH(const char *yahoo_id) +HCONTACT CYahooProto::getbuddyH(const char *yahoo_id) { - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; if (getString(hContact, YAHOO_LOGINID, &dbv)) continue; @@ -300,12 +300,12 @@ HANDLE CYahooProto::getbuddyH(const char *yahoo_id) return NULL; } -HANDLE CYahooProto::add_buddy( const char *yahoo_id, const char *yahoo_name, int protocol, DWORD flags ) +HCONTACT CYahooProto::add_buddy(const char *yahoo_id, const char *yahoo_name, int protocol, DWORD flags) { char *yid = NEWSTR_ALLOCA(yahoo_id); strlwr(yid); - HANDLE hContact = getbuddyH(yid); + HCONTACT hContact = getbuddyH(yid); if (hContact != NULL) { LOG(("[add_buddy] Found buddy id: %s, handle: %p", yid, hContact)); if ( !(flags & PALF_TEMPORARY) && db_get_b(hContact, "CList", "NotOnList", 1)) { @@ -319,7 +319,7 @@ HANDLE CYahooProto::add_buddy( const char *yahoo_id, const char *yahoo_name, int //not already there: add LOG(("[add_buddy] Adding buddy id: %s (Nick: %s), flags: %lu", yid, yahoo_name, flags)); - hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact,(LPARAM)m_szModuleName); setString( hContact, YAHOO_LOGINID, yid ); Set_Protocol( hContact, protocol ); @@ -340,7 +340,7 @@ HANDLE CYahooProto::add_buddy( const char *yahoo_id, const char *yahoo_name, int const char* CYahooProto::find_buddy( const char *yahoo_id) { static char nick[128]; - HANDLE hContact; + HCONTACT hContact; DBVARIANT dbv; hContact = getbuddyH(yahoo_id); @@ -371,7 +371,7 @@ void CYahooProto::ext_status_changed(const char *who, int protocol, int stat, co away, idle); - HANDLE hContact = getbuddyH(who); + HCONTACT hContact = getbuddyH(who); if (hContact == NULL) { debugLogA("Buddy Not Found. Adding..."); hContact = add_buddy(who, who, protocol, 0); @@ -426,7 +426,7 @@ void CYahooProto::ext_status_logon(const char *who, int protocol, int stat, cons ext_status_changed(who, protocol, stat, msg, away, idle, mobile, utf8); - HANDLE hContact = getbuddyH(who); + HCONTACT hContact = getbuddyH(who); if (hContact == NULL) { debugLogA("[ext_status_logon] Can't find handle for %s??? PANIC!!!", who); return; @@ -569,7 +569,7 @@ void CYahooProto::ext_got_audible(const char *me, const char *who, const char *a LOG(("ext_got_audible for %s aud: %s msg:'%s' hash: %s", who, aud, msg, aud_hash)); - HANDLE hContact = getbuddyH(who); + HCONTACT hContact = getbuddyH(who); if (hContact == NULL) { LOG(("Buddy Not Found. Skipping avatar update")); return; @@ -600,7 +600,7 @@ void CYahooProto::ext_got_stealth(char *stealthlist) if (stealthlist) stealth = y_strsplit(stealthlist, ",", -1); - for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + for (HCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DBVARIANT dbv; if (getString( hContact, YAHOO_LOGINID, &dbv)) continue; @@ -645,7 +645,7 @@ void CYahooProto::ext_got_buddies(YList * buds) debugLogA(("[ext_got_buddies] Walking buddy list...")); for (; buds; buds = buds->next) { - HANDLE hContact; + HCONTACT hContact; yahoo_buddy *bud = ( yahoo_buddy* )buds->data; if (bud == NULL) { @@ -719,7 +719,7 @@ void CYahooProto::ext_rejected(const char *who, const char *msg) { LOG(("[ext_rejected] who: %s msg: %s", who, msg)); - HANDLE hContact = getbuddyH(who); + HCONTACT hContact = getbuddyH(who); if (hContact != NULL) { /* * Make sure the contact is temporary so we could delete it w/o extra traffic @@ -739,7 +739,7 @@ void CYahooProto::ext_rejected(const char *who, const char *msg) void CYahooProto::ext_buddy_added(char *myid, char *who, char *group, int status, int auth) { - HANDLE hContact=getbuddyH(who); + HCONTACT hContact=getbuddyH(who); LOG(("[ext_buddy_added] %s authorized you as %s group: %s status: %d auth: %d", who, myid, group, status, auth)); @@ -778,7 +778,7 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha { char nick[128]; BYTE *pCurBlob; - HANDLE hContact = NULL; + HCONTACT hContact = NULL; PROTORECVEVENT pre = { 0 }; /* NOTE: Msg is actually in UTF8 unless stated otherwise!! */ @@ -869,7 +869,7 @@ void CYahooProto::ext_typing_notify(const char *me, const char *who, int protoco { LOG(("[ext_typing_notify] me: '%s' who: '%s' protocol: %d stat: %d ", me, who, protocol, stat)); - HANDLE hContact = getbuddyH(who); + HCONTACT hContact = getbuddyH(who); if (hContact) CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)stat?10:0); @@ -904,7 +904,7 @@ void CYahooProto::ext_game_notify(const char *me, const char *who, int stat, con LOG(("[ext_game_notify] me: %s, who: %s, stat: %d, msg: %s", me, who, stat, msg)); /* FIXME - Not Implemented - this informs you someone else is playing on Yahoo! Games */ /* Also Stubbed in Sample Client */ - HANDLE hContact = getbuddyH(who); + HCONTACT hContact = getbuddyH(who); if (!hContact) return; diff --git a/src/core/miranda.h b/src/core/miranda.h index af34963011..4af88c8984 100644 --- a/src/core/miranda.h +++ b/src/core/miranda.h @@ -130,7 +130,7 @@ extern const int statusModeList[ MAX_STATUS_COUNT ]; extern const int skinIconStatusList[ MAX_STATUS_COUNT ]; extern const int skinIconStatusFlags[ MAX_STATUS_COUNT ]; -int TryProcessDoubleClick(HANDLE hContact); +int TryProcessDoubleClick(HCONTACT hContact); void KillModuleMenus(int hLangpack); @@ -144,7 +144,7 @@ void KillModuleMenus(int hLangpack); extern LIST accounts; PROTOACCOUNT* __fastcall Proto_GetAccount(const char* accName); -PROTOACCOUNT* __fastcall Proto_GetAccount(HANDLE hContact); +PROTOACCOUNT* __fastcall Proto_GetAccount(HCONTACT hContact); PROTOCOLDESCRIPTOR* __fastcall Proto_IsProtocolLoaded(const char* szProtoName); bool __fastcall Proto_IsAccountEnabled(PROTOACCOUNT* pa); @@ -162,7 +162,7 @@ void OpenAccountOptions(PROTOACCOUNT* pa); void LoadDbAccounts(void); void WriteDbAccounts(void); -INT_PTR CallProtoServiceInt(HANDLE hContact, const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam); +INT_PTR CallProtoServiceInt(HCONTACT hContact, const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam); /**** utils.cpp ************************************************************************/ diff --git a/src/core/stdauth/auth.cpp b/src/core/stdauth/auth.cpp index f02278e81b..14f5723124 100644 --- a/src/core/stdauth/auth.cpp +++ b/src/core/stdauth/auth.cpp @@ -57,7 +57,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) dbei.pBlob = (PBYTE)alloca(dbei.cbBlob); db_event_get(hDbEvent, &dbei); - HANDLE hContact = DbGetAuthEventContact(&dbei); + HCONTACT hContact = DbGetAuthEventContact(&dbei); CLISTEVENT cli = {0}; cli.cbSize = sizeof(cli); diff --git a/src/core/stdauth/authdialogs.cpp b/src/core/stdauth/authdialogs.cpp index 900de05b61..7c367b78d1 100644 --- a/src/core/stdauth/authdialogs.cpp +++ b/src/core/stdauth/authdialogs.cpp @@ -45,7 +45,7 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar db_event_get(hDbEvent, &dbei); DWORD uin = *(PDWORD)dbei.pBlob; - HANDLE hContact = DbGetAuthEventContact(&dbei); + HCONTACT hContact = DbGetAuthEventContact(&dbei); char* nick = (char*)dbei.pBlob + sizeof(DWORD)*2; char* first = nick + strlen(nick) + 1; char* last = first + strlen(first) + 1; @@ -111,14 +111,14 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar acs.szProto = ""; CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); - HANDLE hContact = (HANDLE)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA); + 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); break; } case IDC_DETAILS: { - HANDLE hContact = (HANDLE)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA); CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); break; } @@ -168,7 +168,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP db_event_get(hDbEvent, &dbei); DWORD uin = *(PDWORD)dbei.pBlob; - HANDLE hContact = DbGetAuthEventContact(&dbei); + HCONTACT hContact = DbGetAuthEventContact(&dbei); char *nick = (char*)dbei.pBlob + sizeof(DWORD)*2; char *first = nick + strlen(nick) + 1; char *last = first + strlen(first) + 1; diff --git a/src/core/stdaway/awaymsg.cpp b/src/core/stdaway/awaymsg.cpp index 119fe411b4..cc8427ec72 100644 --- a/src/core/stdaway/awaymsg.cpp +++ b/src/core/stdaway/awaymsg.cpp @@ -30,7 +30,7 @@ static HGENMENU hAwayMsgMenuItem; static HANDLE hWindowList; struct AwayMsgDlgData { - HANDLE hContact; + HCONTACT hContact; HANDLE hSeq; HANDLE hAwayMsgEvent; }; @@ -46,7 +46,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP dat = (AwayMsgDlgData*)mir_alloc(sizeof(AwayMsgDlgData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); - dat->hContact = (HANDLE)lParam; + dat->hContact = (HCONTACT)lParam; dat->hAwayMsgEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_AWAYMSG); dat->hSeq = (HANDLE)CallContactService(dat->hContact, PSS_GETAWAYMSG, 0, 0); WindowList_Add(hWindowList, hwndDlg, dat->hContact); @@ -77,7 +77,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP ack.result = ACKRESULT_SUCCESS; SendMessage(hwndDlg, HM_AWAYMSG, 0, (LPARAM)&ack); } - Utils_RestoreWindowPosition(hwndDlg, (HANDLE)lParam, "SRAway", "AwayMsgDlg"); + Utils_RestoreWindowPosition(hwndDlg, (HCONTACT)lParam, "SRAway", "AwayMsgDlg"); return TRUE; case HM_AWAYMSG: @@ -123,7 +123,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM) { HWND hwnd; - if (hwnd = WindowList_Find(hWindowList, (HANDLE)wParam)) { + if (hwnd = WindowList_Find(hWindowList, (HCONTACT)wParam)) { SetForegroundWindow(hwnd); SetFocus(hwnd); } @@ -134,15 +134,15 @@ static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM) static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM) { TCHAR str[128]; - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); CLISTMENUITEM mi = { sizeof(mi) }; mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN | CMIF_TCHAR; if (szProto != NULL) { - int chatRoom = szProto ? db_get_b((HANDLE)wParam, szProto, "ChatRoom", 0) : 0; + int chatRoom = szProto ? db_get_b((HCONTACT)wParam, szProto, "ChatRoom", 0) : 0; if ( !chatRoom) { - int status = db_get_w((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE); + int status = db_get_w((HCONTACT)wParam, szProto, "Status", ID_STATUS_OFFLINE); mir_sntprintf(str, SIZEOF(str), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0)); mi.ptszName = str; if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) { diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index 7522e78831..05145007f2 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -1074,7 +1074,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return mir_callNextSubclass(hwnd, NicklistSubclassProc, msg, wParam, lParam); } -static int RestoreWindowPosition(HWND hwnd, HANDLE hContact, char * szModule, char * szNamePrefix, UINT showCmd) +static int RestoreWindowPosition(HWND hwnd, HCONTACT hContact, char * szModule, char * szNamePrefix, UINT showCmd) { WINDOWPLACEMENT wp; wp.length = sizeof(wp); diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp index e214645b18..6dc2d88deb 100644 --- a/src/core/stdclist/src/clistopts.cpp +++ b/src/core/stdclist/src/clistopts.cpp @@ -28,19 +28,20 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) { case WM_USER + 1: { - HANDLE hContact = (HANDLE) wParam; + HCONTACT hContact = (HCONTACT)wParam; DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *) lParam; - if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL - && lstrcmpiA(ws->szModule, "CList") == 0 && lstrcmpiA(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) { - CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0); - } - break; + if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && + lstrcmpiA(ws->szModule, "CList") == 0 && lstrcmpiA(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) + { + CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0); + } } + break; + case WM_DESTROY: - { - UnhookEvent((HANDLE) GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); - break; - } + UnhookEvent((HANDLE) GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); + break; + case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) HookEventMessage(ME_DB_CONTACT_SETTINGCHANGED, hwndDlg, WM_USER + 1)); @@ -221,7 +222,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP pcli->pfnTrayIconIconsChanged(); pcli->pfnLoadContactTree(); /* this won't do job properly since it only really works when changes happen */ - pcli->pfnInvalidateDisplayNameCacheEntry( INVALID_HANDLE_VALUE ); /* force reshuffle */ + pcli->pfnInvalidateDisplayNameCacheEntry((HCONTACT)INVALID_HANDLE_VALUE); /* force reshuffle */ return TRUE; } break; diff --git a/src/core/stdemail/email.cpp b/src/core/stdemail/email.cpp index 12296eeda3..537f40e7df 100644 --- a/src/core/stdemail/email.cpp +++ b/src/core/stdemail/email.cpp @@ -35,9 +35,9 @@ void SendEmailThread(void *szUrl) static INT_PTR SendEMailCommand(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; - char *szProto = GetContactProto((HANDLE)wParam); - if (szProto == NULL || db_get_s((HANDLE)wParam, szProto, "e-mail", &dbv)) { - if (db_get_s((HANDLE)wParam, "UserInfo", "Mye-mail0", &dbv)) { + char *szProto = GetContactProto((HCONTACT)wParam); + if (szProto == NULL || db_get_s((HCONTACT)wParam, szProto, "e-mail", &dbv)) { + if (db_get_s((HCONTACT)wParam, "UserInfo", "Mye-mail0", &dbv)) { MessageBox((HWND)lParam, TranslateT("User has not registered an e-mail address"), TranslateT("Send e-mail"), MB_OK); return 1; } @@ -54,9 +54,9 @@ static int EMailPreBuildMenu(WPARAM wParam, LPARAM) { bool bEnabled = true; DBVARIANT dbv = { 0 }; - char *szProto = GetContactProto((HANDLE)wParam); - if (szProto == NULL || db_get_s((HANDLE)wParam, szProto, "e-mail", & dbv)) - if (db_get_s((HANDLE)wParam, "UserInfo", "Mye-mail0", &dbv)) + char *szProto = GetContactProto((HCONTACT)wParam); + if (szProto == NULL || db_get_s((HCONTACT)wParam, szProto, "e-mail", &dbv)) + if (db_get_s((HCONTACT)wParam, "UserInfo", "Mye-mail0", &dbv)) bEnabled = false; Menu_ShowItem(hEMailMenuItem, bEnabled); diff --git a/src/core/stdfile/file.cpp b/src/core/stdfile/file.cpp index 217605b18f..7cf600a641 100644 --- a/src/core/stdfile/file.cpp +++ b/src/core/stdfile/file.cpp @@ -30,7 +30,7 @@ int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHAR static HGENMENU hSRFileMenuItem; -TCHAR *GetContactID(HANDLE hContact) +TCHAR *GetContactID(HCONTACT hContact) { TCHAR *theValue = {0}; char *szProto = GetContactProto(hContact); @@ -62,7 +62,7 @@ TCHAR *GetContactID(HANDLE hContact) static INT_PTR SendFileCommand(WPARAM wParam, LPARAM) { struct FileSendData fsd; - fsd.hContact = (HANDLE)wParam; + fsd.hContact = (HCONTACT)wParam; fsd.ppFiles = NULL; CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); return 0; @@ -71,7 +71,7 @@ static INT_PTR SendFileCommand(WPARAM wParam, LPARAM) static INT_PTR SendSpecificFiles(WPARAM wParam, LPARAM lParam) { FileSendData fsd; - fsd.hContact = (HANDLE)wParam; + fsd.hContact = (HCONTACT)wParam; char** ppFiles = (char**)lParam; int count = 0; @@ -92,7 +92,7 @@ static INT_PTR SendSpecificFiles(WPARAM wParam, LPARAM lParam) static INT_PTR SendSpecificFilesT(WPARAM wParam, LPARAM lParam) { FileSendData fsd; - fsd.hContact = (HANDLE)wParam; + fsd.hContact = (HCONTACT)wParam; fsd.ppFiles = (const TCHAR**)lParam; CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd); return 0; @@ -101,7 +101,7 @@ static INT_PTR SendSpecificFilesT(WPARAM wParam, LPARAM lParam) static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam) { TCHAR buf[MAX_PATH]; - GetContactReceivedFilesDir((HANDLE)wParam, buf, MAX_PATH, TRUE); + GetContactReceivedFilesDir((HCONTACT)wParam, buf, MAX_PATH, TRUE); char* dir = mir_t2a(buf); lstrcpynA((char*)lParam, dir, MAX_PATH); mir_free(dir); @@ -114,7 +114,7 @@ static INT_PTR RecvFileCommand(WPARAM, LPARAM lParam) return 0; } -void PushFileEvent(HANDLE hContact, HANDLE hdbe, LPARAM lParam) +void PushFileEvent(HCONTACT hContact, HANDLE hdbe, LPARAM lParam) { CLISTEVENT cle = {0}; cle.cbSize = sizeof(cle); @@ -148,7 +148,7 @@ static int FileEventAdded(WPARAM wParam, LPARAM lParam) if (dbei.flags & (DBEF_SENT|DBEF_READ) || dbei.eventType != EVENTTYPE_FILE || dwSignature == 0) return 0; - PushFileEvent((HANDLE)wParam, (HANDLE)lParam, 0); + PushFileEvent((HCONTACT)wParam, (HANDLE)lParam, 0); return 0; } @@ -288,7 +288,7 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS static void RemoveUnreadFileEvents(void) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hDbEvent = db_event_firstUnread(hContact); while (hDbEvent) { DBEVENTINFO dbei = { sizeof(dbei) }; @@ -303,12 +303,12 @@ static void RemoveUnreadFileEvents(void) static int SRFilePreBuildMenu(WPARAM wParam, LPARAM) { bool bEnabled = false; - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto != NULL) { if ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_FILESEND) { if ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_OFFLINEFILES) bEnabled = true; - else if (db_get_w((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) + else if (db_get_w((HCONTACT)wParam, szProto, "Status", ID_STATUS_OFFLINE) != ID_STATUS_OFFLINE) bEnabled = true; } } @@ -339,7 +339,7 @@ INT_PTR FtMgrShowCommand(WPARAM, LPARAM) INT_PTR openContRecDir(WPARAM wparam, LPARAM) { TCHAR szContRecDir[MAX_PATH]; - HANDLE hContact = (HANDLE)wparam; + HCONTACT hContact = (HCONTACT)wparam; GetContactReceivedFilesDir(hContact, szContRecDir, SIZEOF(szContRecDir), TRUE); ShellExecute(0, _T("open"), szContRecDir, 0, 0, SW_SHOW); return 0; diff --git a/src/core/stdfile/file.h b/src/core/stdfile/file.h index 80f8b26d2b..aa390a774a 100644 --- a/src/core/stdfile/file.h +++ b/src/core/stdfile/file.h @@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define M_PRESHUTDOWN (WM_USER+201) struct FileSendData { - HANDLE hContact; + HCONTACT hContact; const TCHAR **ppFiles; }; @@ -46,7 +46,7 @@ struct FileSendData { struct FileDlgData { HWND hwndTransfer; HANDLE fs; - HANDLE hContact; + HCONTACT hContact; HANDLE hDbEvent; HANDLE hNotifyEvent; TCHAR **files; @@ -85,7 +85,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); void RemoveInvalidFilenameChars(TCHAR *tszString); void RemoveInvalidPathChars(TCHAR *tszString); -void GetContactReceivedFilesDir(HANDLE hContact, TCHAR *szDir, int cchDir, BOOL substVars); +void GetContactReceivedFilesDir(HCONTACT hContact, TCHAR *szDir, int cchDir, BOOL substVars); void GetReceivedFilesDir(TCHAR *szDir, int cchDir); int BrowseForFolder(HWND hwnd, TCHAR *szPath); //fileexistsdlg.c @@ -113,4 +113,4 @@ HWND FtMgr_AddTransfer(struct FileDlgData *dat); void FreeFileDlgData(FileDlgData* dat); -TCHAR *GetContactID(HANDLE hContact); +TCHAR *GetContactID(HCONTACT hContact); diff --git a/src/core/stdfile/filerecvdlg.cpp b/src/core/stdfile/filerecvdlg.cpp index a5c230cbb2..ca00c0f642 100644 --- a/src/core/stdfile/filerecvdlg.cpp +++ b/src/core/stdfile/filerecvdlg.cpp @@ -131,7 +131,7 @@ static void patchDir(TCHAR *str, size_t strSize) lstrcpy(str+len, _T("\\")); } -void GetContactReceivedFilesDir(HANDLE hContact, TCHAR *szDir, int cchDir, BOOL patchVars) +void GetContactReceivedFilesDir(HCONTACT hContact, TCHAR *szDir, int cchDir, BOOL patchVars) { DBVARIANT dbv; TCHAR szTemp[MAX_PATH]; diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp index ebeb98519f..90be69418b 100644 --- a/src/core/stdmsg/src/cmdlist.cpp +++ b/src/core/stdmsg/src/cmdlist.cpp @@ -89,7 +89,7 @@ static VOID CALLBACK MsgTimer(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTi MessageFailureProcess(tmlst[i], LPGEN("The message send timed out.")); } -void msgQueue_add(HANDLE hContact, int id, const TCHAR* szMsg, HANDLE hDbEvent) +void msgQueue_add(HCONTACT hContact, int id, const TCHAR* szMsg, HANDLE hDbEvent) { TMsgQueue *item = (TMsgQueue*)mir_alloc(sizeof(TMsgQueue)); item->hContact = hContact; @@ -106,7 +106,7 @@ void msgQueue_add(HANDLE hContact, int id, const TCHAR* szMsg, HANDLE hDbEvent) } -void msgQueue_processack(HANDLE hContact, int id, BOOL success, const char* szErr) +void msgQueue_processack(HCONTACT hContact, int id, BOOL success, const char* szErr) { int i; TMsgQueue* item = NULL; diff --git a/src/core/stdmsg/src/cmdlist.h b/src/core/stdmsg/src/cmdlist.h index 5f9db21b50..c82cf41666 100644 --- a/src/core/stdmsg/src/cmdlist.h +++ b/src/core/stdmsg/src/cmdlist.h @@ -38,15 +38,15 @@ __inline TCHAR* tcmdlist_getitem(SortedList *list, int ind) typedef struct _TMsgQueue { int id; - HANDLE hContact; + HCONTACT hContact; TCHAR* szMsg; HANDLE hDbEvent; unsigned ts; } TMsgQueue; -void msgQueue_add(HANDLE hContact, int id, const TCHAR* szMsg, HANDLE hDbEvent); -void msgQueue_processack(HANDLE hContact, int id, BOOL success, const char* szErr); +void msgQueue_add(HCONTACT hContact, int id, const TCHAR* szMsg, HANDLE hDbEvent); +void msgQueue_processack(HCONTACT hContact, int id, BOOL success, const char* szErr); void msgQueue_init(void); void msgQueue_destroy(void); diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 466001fb5d..15d5bc126a 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -121,7 +121,7 @@ void ReloadGlobals() static int dbaddedevent(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact) { HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact); if (h) @@ -144,7 +144,7 @@ static int ackevent(WPARAM wParam, LPARAM lParam) int AvatarChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; HWND h = WindowList_Find(g_dat.hMessageWindowList, hContact); if (h) SendMessage(h, HM_AVATARACK, wParam, lParam); return 0; diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 0e8563f8f2..47b867c439 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -41,7 +41,7 @@ static const UINT infoLineControls[] = { IDC_PROTOCOL, IDC_NAME }; static const UINT buttonLineControls[] = { IDC_ADD, IDC_USERMENU, IDC_DETAILS, IDC_HISTORY }; static const UINT sendControls[] = { IDC_MESSAGE }; -static void NotifyLocalWinEvent(HANDLE hContact, HWND hwnd, unsigned int type) +static void NotifyLocalWinEvent(HCONTACT hContact, HWND hwnd, unsigned int type) { if (hContact == NULL || hwnd == NULL) return; @@ -58,7 +58,7 @@ static void NotifyLocalWinEvent(HANDLE hContact, HWND hwnd, unsigned int type) NotifyEventHooks(hHookWinEvt, 0, (LPARAM)&mwe); } -static BOOL IsUtfSendAvailable(HANDLE hContact) +static BOOL IsUtfSendAvailable(HCONTACT hContact) { char* szProto = GetContactProto(hContact); if ( szProto == NULL ) @@ -80,7 +80,7 @@ static int RTL_Detect(const TCHAR *ptszText) return 0; } -HANDLE SendMessageDirect(const TCHAR *szMsg, HANDLE hContact, char *szProto) +HANDLE SendMessageDirect(const TCHAR *szMsg, HCONTACT hContact, char *szProto) { if (hContact == NULL) return NULL; @@ -1751,7 +1751,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (hFont != NULL && hFont != (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0)) DeleteObject(hFont); - HANDLE hContact; + HCONTACT hContact; if (db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT)) hContact = dat->hContact; else diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 78229431f3..4775242489 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -37,7 +37,7 @@ static int logIconBmpSize[ SIZEOF(pLogIconBmpBits) ]; struct LogStreamData { int stage; - HANDLE hContact; + HCONTACT hContact; HANDLE hDbEvent, hDbEventLast; char *buffer; int bufferOffset, bufferLen; @@ -263,7 +263,7 @@ int DbEventIsShown(DBEVENTINFO * dbei, SrmmWindowData *dat) } //mir_free() the return value -static char *CreateRTFFromDbEvent(SrmmWindowData *dat, HANDLE hContact, HANDLE hDbEvent, struct LogStreamData *streamData) +static char *CreateRTFFromDbEvent(SrmmWindowData *dat, HCONTACT hContact, HANDLE hDbEvent, struct LogStreamData *streamData) { char *buffer; int bufferAlloced, bufferEnd; diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 7e6aee4da6..511de0a1f1 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -449,7 +449,7 @@ static void RebuildList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) if (hItemUnknown && db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItemUnknown, 1); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0); if (hItem && db_get_b(hContact, SRMMMOD, SRMSGSET_TYPING, defType)) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItem, 1); @@ -464,7 +464,7 @@ static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) if (hItemUnknown) db_set_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItemUnknown, 0) ? 1 : 0)); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) db_set_b(hContact, SRMMMOD, SRMSGSET_TYPING, (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0) ? 1 : 0)); diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 53a2314fa8..256790d429 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -59,7 +59,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, (LPARAM) 1); /* does a window for the contact exist? */ - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HCONTACT)wParam); if (hwnd) { if (!db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS)) { ShowWindow(hwnd, SW_RESTORE); @@ -78,10 +78,10 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) /* new message */ SkinPlaySound("AlertMsg"); - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto && (g_dat.openFlags & SRMMStatusToPf2(CallProtoService(szProto, PS_GETSTATUS, 0, 0)))) { NewMessageWindowLParam newData = { 0 }; - newData.hContact = (HANDLE)wParam; + newData.hContact = (HCONTACT)wParam; newData.noActivate = db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS); CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), NULL, DlgProcMessage, (LPARAM)&newData); return 0; @@ -89,19 +89,19 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) TCHAR toolTip[256], *contactName; CLISTEVENT cle = { sizeof(cle) }; - cle.hContact = (HANDLE)wParam; + cle.hContact = (HCONTACT)wParam; cle.hDbEvent = (HANDLE)lParam; cle.flags = CLEF_TCHAR; cle.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); cle.pszService = "SRMsg/ReadMessage"; - contactName = pcli->pfnGetContactDisplayName((HANDLE)wParam, 0); + contactName = pcli->pfnGetContactDisplayName((HCONTACT)wParam, 0); mir_sntprintf(toolTip, SIZEOF(toolTip), TranslateT("Message from %s"), contactName); cle.ptszTooltip = toolTip; CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); return 0; } -INT_PTR SendMessageCmd(HANDLE hContact, char* msg, int isWchar) +INT_PTR SendMessageCmd(HCONTACT hContact, char* msg, int isWchar) { /* does the HCONTACT's protocol support IM messages? */ char *szProto = GetContactProto(hContact); @@ -135,12 +135,12 @@ INT_PTR SendMessageCmd(HANDLE hContact, char* msg, int isWchar) static INT_PTR SendMessageCommand_W(WPARAM wParam, LPARAM lParam) { - return SendMessageCmd((HANDLE)wParam, (char*)lParam, TRUE); + return SendMessageCmd((HCONTACT)wParam, (char*)lParam, TRUE); } static INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam) { - return SendMessageCmd((HANDLE)wParam, (char*)lParam, FALSE); + return SendMessageCmd((HCONTACT)wParam, (char*)lParam, FALSE); } static INT_PTR ReadMessageCommand(WPARAM wParam, LPARAM lParam) @@ -159,12 +159,12 @@ static int TypingMessage(WPARAM wParam, LPARAM lParam) SkinPlaySound((lParam) ? "TNStart" : "TNStop"); - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HCONTACT)wParam); if (hwnd) SendMessage(hwnd, DM_TYPING, 0, lParam); else if (lParam && (g_dat.flags & SMF_SHOWTYPINGTRAY)) { TCHAR szTip[256]; - mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName((HANDLE)wParam, 0)); + mir_sntprintf(szTip, SIZEOF(szTip), TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName((HCONTACT)wParam, 0)); if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags&SMF_SHOWTYPINGCLIST)) { MIRANDASYSTRAYNOTIFY tn = { sizeof(tn) }; @@ -177,7 +177,7 @@ static int TypingMessage(WPARAM wParam, LPARAM lParam) } else { CLISTEVENT cle = { sizeof(cle) }; - cle.hContact = (HANDLE)wParam; + cle.hContact = (HCONTACT)wParam; cle.hDbEvent = (HANDLE)1; cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR; cle.hIcon = LoadSkinnedIcon( SKINICON_OTHER_TYPING ); @@ -194,7 +194,7 @@ static int TypingMessage(WPARAM wParam, LPARAM lParam) static int MessageSettingChanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (cws->szModule == NULL) return 0; @@ -204,7 +204,7 @@ static int MessageSettingChanged(WPARAM wParam, LPARAM lParam) if (cws->szSetting && !strcmp(cws->szSetting, "Timezone")) WindowList_Broadcast(g_dat.hMessageWindowList, DM_NEWTIMEZONE, (WPARAM) cws, 0); else { - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto && !strcmp(cws->szModule, szProto)) WindowList_Broadcast(g_dat.hMessageWindowList, DM_UPDATETITLE, (WPARAM) cws, 0); } @@ -215,7 +215,7 @@ static int MessageSettingChanged(WPARAM wParam, LPARAM lParam) static int ContactDeleted(WPARAM wParam, LPARAM lParam) { HWND hwnd; - if (hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam)) + if (hwnd = WindowList_Find(g_dat.hMessageWindowList, (HCONTACT)wParam)) SendMessage(hwnd, WM_CLOSE, 0, 0); return 0; @@ -235,7 +235,7 @@ static void RestoreUnreadMessageAlerts(void) DBEVENTINFO dbei = { sizeof(dbei) }; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hDbEvent = db_event_firstUnread(hContact); while (hDbEvent) { autoPopup = 0; @@ -315,7 +315,7 @@ static int IconsChanged(WPARAM, LPARAM) static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact) { bool bEnabled = false; char *szProto = GetContactProto(hContact); @@ -346,7 +346,7 @@ static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam) static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) { - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)wParam); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HCONTACT)wParam); if (hwnd == NULL) return 1; diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 1a75b19b1b..29cbf7520e 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct NewMessageWindowLParam { - HANDLE hContact; + HCONTACT hContact; const char *szInitialText; int isWchar; int noActivate; @@ -35,7 +35,7 @@ struct NewMessageWindowLParam struct SrmmWindowData { - HANDLE hContact; + HCONTACT hContact; HANDLE hDbEventFirst, hDbEventLast; HBRUSH hBkgBrush; int splitterPos, originalSplitterPos; @@ -117,7 +117,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar int DbEventIsForMsgWindow(DBEVENTINFO *dbei); int DbEventIsShown(DBEVENTINFO * dbei, SrmmWindowData *dat); void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend); -HANDLE SendMessageDirect(const TCHAR *szMsg, HANDLE hContact, char *szProto); +HANDLE SendMessageDirect(const TCHAR *szMsg, HCONTACT hContact, char *szProto); void LoadMsgLogIcons(void); void FreeMsgLogIcons(void); diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp index 5ecaf6861f..f8c8b82f49 100644 --- a/src/core/stdmsg/src/msgtimedout.cpp +++ b/src/core/stdmsg/src/msgtimedout.cpp @@ -28,7 +28,7 @@ typedef struct TMsgQueue *item; } ErrorDlgParam; -INT_PTR SendMessageCmd(HANDLE hContact, char* msg, int isWchar); +INT_PTR SendMessageCmd(HCONTACT hContact, char* msg, int isWchar); INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -90,10 +90,10 @@ void MessageFailureProcess(TMsgQueue *item, const char* err) { db_event_delete(item->hContact, item->hDbEvent); - HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)item->hContact); + HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, item->hContact); if (hwnd == NULL) { SendMessageCmd(item->hContact, NULL, 0); - hwnd = WindowList_Find(g_dat.hMessageWindowList, (HANDLE)item->hContact); + hwnd = WindowList_Find(g_dat.hMessageWindowList, item->hContact); } else SendMessage(hwnd, DM_REMAKELOG, 0, 0); diff --git a/src/core/stdmsg/src/statusicon.cpp b/src/core/stdmsg/src/statusicon.cpp index 1ad1395032..060f950aa0 100644 --- a/src/core/stdmsg/src/statusicon.cpp +++ b/src/core/stdmsg/src/statusicon.cpp @@ -26,7 +26,7 @@ HANDLE hHookIconPressedEvt; static int OnSrmmIconChanged(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) WindowList_Broadcast(g_dat.hMessageWindowList, DM_STATUSICONCHANGE, 0, 0); else { @@ -37,7 +37,7 @@ static int OnSrmmIconChanged(WPARAM wParam, LPARAM) return 0; } -void DrawStatusIcons(HANDLE hContact, HDC hDC, RECT r, int gap) +void DrawStatusIcons(HCONTACT hContact, HDC hDC, RECT r, int gap) { HICON hIcon; int x = r.left; @@ -55,7 +55,7 @@ void DrawStatusIcons(HANDLE hContact, HDC hDC, RECT r, int gap) } } -void CheckIconClick(HANDLE hContact, HWND hwndFrom, POINT pt, RECT r, int gap, int click_flags) +void CheckIconClick(HCONTACT hContact, HWND hwndFrom, POINT pt, RECT r, int gap, int click_flags) { int iconNum = (pt.x - r.left) / (GetSystemMetrics(SM_CXSMICON) + gap); StatusIconData *sid = Srmm_GetNthIcon(hContact, iconNum); @@ -88,7 +88,7 @@ int DeinitStatusIcons() return 0; } -int GetStatusIconsCount(HANDLE hContact) +int GetStatusIconsCount(HCONTACT hContact) { int nIcon = 0; while ( Srmm_GetNthIcon(hContact, nIcon) != NULL) diff --git a/src/core/stdmsg/src/statusicon.h b/src/core/stdmsg/src/statusicon.h index 314ac9ec1e..2da94eab1a 100644 --- a/src/core/stdmsg/src/statusicon.h +++ b/src/core/stdmsg/src/statusicon.h @@ -7,8 +7,8 @@ extern int status_icon_list_size; int InitStatusIcons(); int DeinitStatusIcons(); -int GetStatusIconsCount(HANDLE hContact); -void DrawStatusIcons(HANDLE hContact, HDC hdc, RECT r, int gap); -void CheckIconClick(HANDLE hContact, HWND hwndFrom, POINT pt, RECT r, int gap, int flags); +int GetStatusIconsCount(HCONTACT hContact); +void DrawStatusIcons(HCONTACT hContact, HDC hdc, RECT r, int gap); +void CheckIconClick(HCONTACT hContact, HWND hwndFrom, POINT pt, RECT r, int gap, int flags); #endif diff --git a/src/core/stduihist/history.cpp b/src/core/stduihist/history.cpp index 55795e62bc..0978f94731 100644 --- a/src/core/stduihist/history.cpp +++ b/src/core/stduihist/history.cpp @@ -135,7 +135,7 @@ static void GetObjectSummary(DBEVENTINFO *dbei, TCHAR* str, int cbStr) } typedef struct { - HANDLE hContact; + HCONTACT hContact; HWND hwnd; } THistoryThread; @@ -201,14 +201,12 @@ static int HistoryDlgResizer(HWND, LPARAM, UTILRESIZECONTROL *urc) static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - HANDLE hContact; - - hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam); - hContact = (HANDLE)lParam; + hContact = (HCONTACT)lParam; WindowList_Add(hWindowList, hwndDlg, hContact); Utils_RestoreWindowPosition(hwndDlg, hContact, "History", ""); { @@ -378,7 +376,7 @@ static INT_PTR CALLBACK DlgProcHistoryFind(HWND hwndDlg, UINT msg, WPARAM wParam static INT_PTR UserHistoryCommand(WPARAM wParam, LPARAM) { - HWND hwnd = WindowList_Find(hWindowList, (HANDLE)wParam); + HWND hwnd = WindowList_Find(hWindowList, (HCONTACT)wParam); if (hwnd) { SetForegroundWindow(hwnd); SetFocus(hwnd); @@ -390,7 +388,7 @@ static INT_PTR UserHistoryCommand(WPARAM wParam, LPARAM) static int HistoryContactDelete(WPARAM wParam, LPARAM) { - HWND hwnd = WindowList_Find(hWindowList, (HANDLE)wParam); + HWND hwnd = WindowList_Find(hWindowList, (HCONTACT)wParam); if (hwnd != NULL) DestroyWindow(hwnd); return 0; diff --git a/src/core/stdurl/url.cpp b/src/core/stdurl/url.cpp index ee096ac8df..12e7137c67 100644 --- a/src/core/stdurl/url.cpp +++ b/src/core/stdurl/url.cpp @@ -49,11 +49,11 @@ static int UrlEventAdded(WPARAM wParam, LPARAM lParam) SkinPlaySound("RecvUrl"); TCHAR szTooltip[256]; - mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("URL from %s"), pcli->pfnGetContactDisplayName((HANDLE)wParam, 0)); + mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("URL from %s"), pcli->pfnGetContactDisplayName((HCONTACT)wParam, 0)); CLISTEVENT cle = { sizeof(cle) }; cle.flags = CLEF_TCHAR; - cle.hContact = (HANDLE)wParam; + cle.hContact = (HCONTACT)wParam; cle.hDbEvent = (HANDLE)lParam; cle.hIcon = LoadSkinIcon(SKINICON_EVENT_URL); cle.pszService = "SRUrl/ReadUrl"; @@ -75,7 +75,7 @@ static void RestoreUnreadUrlAlerts(void) cle.pszService = "SRUrl/ReadUrl"; cle.flags = CLEF_TCHAR; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hDbEvent = db_event_firstUnread(hContact); while (hDbEvent) { DBEVENTINFO dbei = { sizeof(dbei) }; @@ -97,7 +97,7 @@ static void RestoreUnreadUrlAlerts(void) static int ContactSettingChanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (lstrcmpA(cws->szModule, "CList") && (szProto == NULL || lstrcmpA(cws->szModule, szProto))) return 0; @@ -108,7 +108,7 @@ static int ContactSettingChanged(WPARAM wParam, LPARAM lParam) static int SRUrlPreBuildMenu(WPARAM wParam, LPARAM) { bool bEnabled = false; - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto != NULL) if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_URLSEND) bEnabled = true; @@ -147,7 +147,7 @@ static int SRUrlShutdown(WPARAM, LPARAM) int UrlContactDeleted(WPARAM wParam, LPARAM) { - HWND h = WindowList_Find(hUrlWindowList, (HANDLE)wParam); + HWND h = WindowList_Find(hUrlWindowList, (HCONTACT)wParam); if (h) SendMessage(h, WM_CLOSE, 0, 0); diff --git a/src/core/stdurl/url.h b/src/core/stdurl/url.h index 482ddf4a01..075f14ecbb 100644 --- a/src/core/stdurl/url.h +++ b/src/core/stdurl/url.h @@ -29,12 +29,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DDEMESSAGETIMEOUT 1000 struct UrlRcvData { - HANDLE hContact; + HCONTACT hContact; HANDLE hDbEvent; }; struct UrlSendData { - HANDLE hContact; + HCONTACT hContact; HANDLE hSendId; HANDLE hAckEvent; char *sendBuffer; diff --git a/src/core/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp index 907720845c..a82ef7510c 100644 --- a/src/core/stdurl/urldialogs.cpp +++ b/src/core/stdurl/urldialogs.cpp @@ -28,7 +28,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP extern HANDLE hUrlWindowList; -static void sttUpdateTitle(HWND hwndDlg, HANDLE hContact) +static void sttUpdateTitle(HWND hwndDlg, HCONTACT hContact) { TCHAR newtitle[256], oldtitle[256]; TCHAR *szStatus, *contactName, *pszNewTitleStart = TranslateT("Send URL to"); @@ -469,7 +469,7 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_LIMITTEXT, 450, 0); dat = (struct UrlSendData*)mir_alloc(sizeof(struct UrlSendData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); - dat->hContact = (HANDLE)lParam; + dat->hContact = (HCONTACT)lParam; dat->hAckEvent = NULL; dat->hSendId = NULL; dat->sendBuffer = NULL; diff --git a/src/core/stduserinfo/contactinfo.cpp b/src/core/stduserinfo/contactinfo.cpp index f674685200..fd38ad1758 100644 --- a/src/core/stduserinfo/contactinfo.cpp +++ b/src/core/stduserinfo/contactinfo.cpp @@ -252,7 +252,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case M_REMAKELISTS: { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (hContact != NULL) { char *szProto = GetContactProto(hContact); if (szProto == NULL) @@ -436,7 +436,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP NMLISTVIEW *nm = (NMLISTVIEW*)lParam; LVITEM lvi; TCHAR szEmail[256]; - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); char *szIdTemplate = (nm->hdr.idFrom == IDC_PHONES) ? "MyPhone%d" : "Mye-mail%d"; LVHITTESTINFO hti; diff --git a/src/core/stduserinfo/stdinfo.cpp b/src/core/stduserinfo/stdinfo.cpp index b807e8f37e..ac02608694 100644 --- a/src/core/stduserinfo/stdinfo.cpp +++ b/src/core/stduserinfo/stdinfo.cpp @@ -35,7 +35,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP #define SVS_SIGNED 6 #define SVS_TIMEZONE 7 -static int Proto_GetContactInfoSetting(HANDLE hContact, const char *szProto, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType) +static int Proto_GetContactInfoSetting(HCONTACT hContact, const char *szProto, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType) { DBCONTACTGETSETTING cgs = {szModule, szSetting, dbv}; dbv->type = (BYTE)nType; @@ -64,7 +64,7 @@ static void Proto_FreeInfoVariant(DBVARIANT *dbv) dbv->type = 0; } -static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule, char *szSetting, int special) +static void SetValue(HWND hwndDlg, int idCtrl, HCONTACT hContact, char *szModule, char *szSetting, int special) { char str[80], *pstr = NULL; TCHAR* ptstr = NULL; @@ -194,7 +194,7 @@ static INT_PTR CALLBACK SummaryDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (((LPNMHDR)lParam)->idFrom) { case 0: if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED) { - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; if (hContact != NULL) { char *szProto = GetContactProto(hContact); if (szProto == NULL) @@ -244,13 +244,13 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L TranslateDialogDefault(hwndDlg); SetTimer(hwndDlg, 1, 1000, NULL); - tmi.prepareList((HANDLE)lParam, GetDlgItem(hwndDlg, IDC_TIMEZONESELECT), TZF_PLF_CB); + tmi.prepareList((HCONTACT)lParam, GetDlgItem(hwndDlg, IDC_TIMEZONESELECT), TZF_PLF_CB); SendMessage(hwndDlg, WM_TIMER, 0, 0); break; case WM_TIMER: { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (hContact != NULL) { TCHAR szTime[80]; if (tmi.printDateTimeByContact(hContact, _T("s"), szTime, SIZEOF(szTime), TZF_KNOWNONLY)) { @@ -269,7 +269,7 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L switch (((LPNMHDR)lParam)->idFrom) { case 0: if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED) { - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; if (hContact != NULL) { char *szProto = GetContactProto(hContact); if (szProto == NULL) @@ -297,7 +297,7 @@ static INT_PTR CALLBACK LocationDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_TIMEZONESELECT: if (HIWORD(wParam) == CBN_SELCHANGE) { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); tmi.storeListResults(hContact, GetDlgItem(hwndDlg, IDC_TIMEZONESELECT), TZF_PLF_CB); @@ -319,7 +319,7 @@ static INT_PTR CALLBACK WorkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA switch (((LPNMHDR)lParam)->idFrom) { case 0: if (((LPNMHDR)lParam)->code == PSN_INFOCHANGED) { - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; if (hContact != NULL) { char *szProto = GetContactProto(hContact); if (szProto == NULL) break; @@ -395,7 +395,7 @@ static INT_PTR CALLBACK BackgroundDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, int i; char idstr[33]; DBVARIANT dbv, dbvText; - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; if (hContact != NULL) { char *szProto = GetContactProto(hContact); @@ -522,7 +522,7 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR hFont = CreateFontIndirect(&lf); SendDlgItemMessage(hwndDlg, IDC_ABOUT, WM_SETFONT, (WPARAM) hFont, MAKELPARAM(TRUE, 0)); - if ( !db_get_s((HANDLE)lParam, "UserInfo", "MyNotes", &dbv)) { + if (!db_get_s((HCONTACT)lParam, "UserInfo", "MyNotes", &dbv)) { SetDlgItemTextA(hwndDlg, IDC_MYNOTES, dbv.pszVal); db_free(&dbv); } @@ -531,30 +531,31 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { - case 0: - switch (((LPNMHDR)lParam)->code) { - case PSN_INFOCHANGED: - { char *szProto; - HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; - if (hContact != NULL) { - szProto = GetContactProto(hContact); - if (szProto == NULL) break; + case 0: + switch (((LPNMHDR)lParam)->code) { + case PSN_INFOCHANGED: + { + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; + if (hContact != NULL) { + char *szProto = GetContactProto(hContact); + if (szProto != NULL) SetValue(hwndDlg, IDC_ABOUT, hContact, szProto, "About", 0); - } - break; } - case PSN_APPLY: - { HANDLE hContact = (HANDLE)((LPPSHNOTIFY)lParam)->lParam; - if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MYNOTES))) { - char text[2048]; - GetDlgItemTextA(hwndDlg, IDC_MYNOTES, text, SIZEOF(text)); - db_set_s(hContact, "UserInfo", "MyNotes", text); - } - else db_unset(hContact, "UserInfo", "MyNotes"); - break; + } + break; + case PSN_APPLY: + { + HCONTACT hContact = (HCONTACT)((LPPSHNOTIFY)lParam)->lParam; + if (GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MYNOTES))) { + char text[2048]; + GetDlgItemTextA(hwndDlg, IDC_MYNOTES, text, SIZEOF(text)); + db_set_s(hContact, "UserInfo", "MyNotes", text); } + else db_unset(hContact, "UserInfo", "MyNotes"); } break; + } + break; } break; case WM_COMMAND: @@ -578,7 +579,7 @@ int DetailsInit(WPARAM wParam, LPARAM lParam) if (lParam == NULL) return 0; - if (GetContactProto((HANDLE)lParam) == 0) + if (GetContactProto((HCONTACT)lParam) == 0) return 0; OPTIONSDIALOGPAGE odp = { sizeof(odp) }; diff --git a/src/core/stduserinfo/userinfo.cpp b/src/core/stduserinfo/userinfo.cpp index adb844c56e..d7312c0134 100644 --- a/src/core/stduserinfo/userinfo.cpp +++ b/src/core/stduserinfo/userinfo.cpp @@ -51,7 +51,7 @@ struct DetailsPageData struct DetailsData { - HANDLE hContact; + HCONTACT hContact; HANDLE hProtoAckEvent; HINSTANCE hInstIcmp; HFONT hBoldFont; @@ -95,7 +95,7 @@ static int PageSortProc(OPTIONSDIALOGPAGE *item1, OPTIONSDIALOGPAGE *item2) static INT_PTR ShowDetailsDialogCommand(WPARAM wParam, LPARAM) { HWND hwnd; - if (hwnd = WindowList_Find(hWindowList, (HANDLE)wParam)) { + if (hwnd = WindowList_Find(hWindowList, (HCONTACT)wParam)) { SetForegroundWindow(hwnd); SetFocus(hwnd); return 0; @@ -222,7 +222,7 @@ static void CreateDetailsPageWindow(HWND hwndDlg, DetailsData *dat, DetailsPageD static int UserInfoContactDelete(WPARAM wParam, LPARAM) { - HWND hwnd = WindowList_Find(hWindowList, (HANDLE)wParam); + HWND hwnd = WindowList_Find(hWindowList, (HCONTACT)wParam); if (hwnd != NULL) DestroyWindow(hwnd); return 0; @@ -245,7 +245,7 @@ static INT_PTR CALLBACK DlgProcDetails(HWND hwndDlg, UINT msg, WPARAM wParam, LP PROPSHEETHEADER *psh = (PROPSHEETHEADER*)lParam; dat = (DetailsData*)mir_calloc(sizeof(DetailsData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); - dat->hContact = (HANDLE)psh->pszCaption; + dat->hContact = (HCONTACT)psh->pszCaption; dat->hProtoAckEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_PROTOACK); WindowList_Add(hWindowList, hwndDlg, dat->hContact); diff --git a/src/core/stduseronline/useronline.cpp b/src/core/stduseronline/useronline.cpp index 12fcb3c6ed..90881b1e4b 100644 --- a/src/core/stduseronline/useronline.cpp +++ b/src/core/stduseronline/useronline.cpp @@ -38,17 +38,17 @@ static int UserOnlineSettingChanged(WPARAM wParam, LPARAM lParam) return 0; int newStatus = cws->value.wVal; - int oldStatus = db_get_w((HANDLE)wParam, "UserOnline", "OldStatus", ID_STATUS_OFFLINE); - db_set_w((HANDLE)wParam, "UserOnline", "OldStatus", (WORD)newStatus); + int oldStatus = db_get_w((HCONTACT)wParam, "UserOnline", "OldStatus", ID_STATUS_OFFLINE); + db_set_w((HCONTACT)wParam, "UserOnline", "OldStatus", (WORD)newStatus); if (CallService(MS_IGNORE_ISIGNORED, wParam, IGNOREEVENT_USERONLINE)) return 0; - if (db_get_b((HANDLE)wParam, "CList", "Hidden", 0)) return 0; + if (db_get_b((HCONTACT)wParam, "CList", "Hidden", 0)) return 0; if (newStatus == ID_STATUS_OFFLINE && oldStatus != ID_STATUS_OFFLINE) { // Remove the event from the queue if it exists since they are now offline - int lastEvent = (int)db_get_dw((HANDLE)wParam, "UserOnline", "LastEvent", 0); + int lastEvent = (int)db_get_dw((HCONTACT)wParam, "UserOnline", "LastEvent", 0); if (lastEvent) { CallService(MS_CLIST_REMOVEEVENT, wParam, (LPARAM)lastEvent); - db_set_dw((HANDLE)wParam, "UserOnline", "LastEvent", 0); + db_set_dw((HCONTACT)wParam, "UserOnline", "LastEvent", 0); } } if ((newStatus == ID_STATUS_ONLINE || newStatus == ID_STATUS_FREECHAT) && @@ -63,11 +63,11 @@ static int UserOnlineSettingChanged(WPARAM wParam, LPARAM lParam) ZeroMemory(&cle, sizeof(cle)); cle.cbSize = sizeof(cle); cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR; - cle.hContact = (HANDLE)wParam; + cle.hContact = (HCONTACT)wParam; cle.hDbEvent = (HANDLE)(uniqueEventId++); cle.hIcon = LoadSkinIcon(SKINICON_OTHER_USERONLINE, false); cle.pszService = "UserOnline/Description"; - mir_sntprintf(tooltip, SIZEOF(tooltip), TranslateT("%s is online"), pcli->pfnGetContactDisplayName((HANDLE)wParam, 0)); + mir_sntprintf(tooltip, SIZEOF(tooltip), TranslateT("%s is online"), pcli->pfnGetContactDisplayName((HCONTACT)wParam, 0)); cle.ptszTooltip = tooltip; CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); IcoLib_ReleaseIcon(cle.hIcon, 0); diff --git a/src/mir_core/db.cpp b/src/mir_core/db.cpp index 5912b5125a..962daff91e 100644 --- a/src/mir_core/db.cpp +++ b/src/mir_core/db.cpp @@ -29,7 +29,7 @@ static MIDatabase* currDb = NULL; ///////////////////////////////////////////////////////////////////////////////////////// // getting data -MIR_CORE_DLL(int) db_get_b(HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) +MIR_CORE_DLL(int) db_get_b(HCONTACT hContact, const char *szModule, const char *szSetting, int errorValue) { if (currDb != NULL) { DBVARIANT dbv; @@ -46,7 +46,7 @@ MIR_CORE_DLL(int) db_get_b(HANDLE hContact, const char *szModule, const char *sz return errorValue; } -MIR_CORE_DLL(int) db_get_w(HANDLE hContact, const char *szModule, const char *szSetting, int errorValue) +MIR_CORE_DLL(int) db_get_w(HCONTACT hContact, const char *szModule, const char *szSetting, int errorValue) { if (currDb != NULL) { DBVARIANT dbv; @@ -62,7 +62,7 @@ MIR_CORE_DLL(int) db_get_w(HANDLE hContact, const char *szModule, const char *sz return errorValue; } -MIR_CORE_DLL(DWORD) db_get_dw(HANDLE hContact, const char *szModule, const char *szSetting, DWORD errorValue) +MIR_CORE_DLL(DWORD) db_get_dw(HCONTACT hContact, const char *szModule, const char *szSetting, DWORD errorValue) { if (currDb != NULL) { DBVARIANT dbv; @@ -80,7 +80,7 @@ MIR_CORE_DLL(DWORD) db_get_dw(HANDLE hContact, const char *szModule, const char return errorValue; } -MIR_CORE_DLL(INT_PTR) db_get(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) +MIR_CORE_DLL(INT_PTR) db_get(HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { if (currDb == NULL) return 1; @@ -88,7 +88,7 @@ MIR_CORE_DLL(INT_PTR) db_get(HANDLE hContact, const char *szModule, const char * return currDb->GetContactSetting((MCONTACT)hContact, szModule, szSetting, dbv); } -MIR_CORE_DLL(INT_PTR) db_get_s(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType) +MIR_CORE_DLL(INT_PTR) db_get_s(HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const int nType) { if (currDb == NULL) return 1; @@ -97,7 +97,7 @@ MIR_CORE_DLL(INT_PTR) db_get_s(HANDLE hContact, const char *szModule, const char return currDb->GetContactSettingStr((MCONTACT)hContact, szModule, szSetting, dbv); } -MIR_CORE_DLL(char*) db_get_sa(HANDLE hContact, const char *szModule, const char *szSetting) +MIR_CORE_DLL(char*) db_get_sa(HCONTACT hContact, const char *szModule, const char *szSetting) { char *str = NULL; DBVARIANT dbv = {0}; @@ -108,7 +108,7 @@ MIR_CORE_DLL(char*) db_get_sa(HANDLE hContact, const char *szModule, const char return str; } -MIR_CORE_DLL(wchar_t*) db_get_wsa(HANDLE hContact, const char *szModule, const char *szSetting) +MIR_CORE_DLL(wchar_t*) db_get_wsa(HCONTACT hContact, const char *szModule, const char *szSetting) { wchar_t *str = NULL; DBVARIANT dbv={0}; @@ -122,7 +122,7 @@ MIR_CORE_DLL(wchar_t*) db_get_wsa(HANDLE hContact, const char *szModule, const c ///////////////////////////////////////////////////////////////////////////////////////// // getting static data -MIR_CORE_DLL(int) db_get_static(HANDLE hContact, const char *szModule, const char *szSetting, char *pDest, int cbDest) +MIR_CORE_DLL(int) db_get_static(HCONTACT hContact, const char *szModule, const char *szSetting, char *pDest, int cbDest) { if (currDb == NULL) return 1; @@ -134,7 +134,7 @@ MIR_CORE_DLL(int) db_get_static(HANDLE hContact, const char *szModule, const cha return currDb->GetContactSettingStatic((MCONTACT)hContact, szModule, szSetting, &dbv); } -MIR_CORE_DLL(int) db_get_static_utf(HANDLE hContact, const char *szModule, const char *szSetting, char *pDest, int cbDest) +MIR_CORE_DLL(int) db_get_static_utf(HCONTACT hContact, const char *szModule, const char *szSetting, char *pDest, int cbDest) { if (currDb == NULL) return 1; @@ -146,7 +146,7 @@ MIR_CORE_DLL(int) db_get_static_utf(HANDLE hContact, const char *szModule, const return currDb->GetContactSettingStatic((MCONTACT)hContact, szModule, szSetting, &dbv); } -MIR_CORE_DLL(int) db_get_wstatic(HANDLE hContact, const char *szModule, const char *szSetting, WCHAR *pDest, int cbDest) +MIR_CORE_DLL(int) db_get_wstatic(HCONTACT hContact, const char *szModule, const char *szSetting, WCHAR *pDest, int cbDest) { if (currDb == NULL) return 1; @@ -161,7 +161,7 @@ MIR_CORE_DLL(int) db_get_wstatic(HANDLE hContact, const char *szModule, const ch ///////////////////////////////////////////////////////////////////////////////////////// // setting data -MIR_CORE_DLL(INT_PTR) db_set(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) +MIR_CORE_DLL(INT_PTR) db_set(HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { if (currDb == NULL) return 1; @@ -172,7 +172,7 @@ MIR_CORE_DLL(INT_PTR) db_set(HANDLE hContact, const char *szModule, const char * return currDb->WriteContactSetting((MCONTACT)hContact, &cws); } -MIR_CORE_DLL(INT_PTR) db_set_b(HANDLE hContact, const char *szModule, const char *szSetting, BYTE val) +MIR_CORE_DLL(INT_PTR) db_set_b(HCONTACT hContact, const char *szModule, const char *szSetting, BYTE val) { if (currDb == NULL) return 1; @@ -184,7 +184,7 @@ MIR_CORE_DLL(INT_PTR) db_set_b(HANDLE hContact, const char *szModule, const char return currDb->WriteContactSetting((MCONTACT)hContact, &cws); } -MIR_CORE_DLL(INT_PTR) db_set_w(HANDLE hContact, const char *szModule, const char *szSetting, WORD val) +MIR_CORE_DLL(INT_PTR) db_set_w(HCONTACT hContact, const char *szModule, const char *szSetting, WORD val) { if (currDb == NULL) return 1; @@ -196,7 +196,7 @@ MIR_CORE_DLL(INT_PTR) db_set_w(HANDLE hContact, const char *szModule, const char return currDb->WriteContactSetting((MCONTACT)hContact, &cws); } -MIR_CORE_DLL(INT_PTR) db_set_dw(HANDLE hContact, const char *szModule, const char *szSetting, DWORD val) +MIR_CORE_DLL(INT_PTR) db_set_dw(HCONTACT hContact, const char *szModule, const char *szSetting, DWORD val) { if (currDb == NULL) return 1; @@ -208,7 +208,7 @@ MIR_CORE_DLL(INT_PTR) db_set_dw(HANDLE hContact, const char *szModule, const cha return currDb->WriteContactSetting((MCONTACT)hContact, &cws); } -MIR_CORE_DLL(INT_PTR) db_set_s(HANDLE hContact, const char *szModule, const char *szSetting, const char *val) +MIR_CORE_DLL(INT_PTR) db_set_s(HCONTACT hContact, const char *szModule, const char *szSetting, const char *val) { if (currDb == NULL) return 1; @@ -220,7 +220,7 @@ MIR_CORE_DLL(INT_PTR) db_set_s(HANDLE hContact, const char *szModule, const char return currDb->WriteContactSetting((MCONTACT)hContact, &cws); } -MIR_CORE_DLL(INT_PTR) db_set_ws(HANDLE hContact, const char *szModule, const char *szSetting, const WCHAR *val) +MIR_CORE_DLL(INT_PTR) db_set_ws(HCONTACT hContact, const char *szModule, const char *szSetting, const WCHAR *val) { if (currDb == NULL) return 1; @@ -232,7 +232,7 @@ MIR_CORE_DLL(INT_PTR) db_set_ws(HANDLE hContact, const char *szModule, const cha return currDb->WriteContactSetting((MCONTACT)hContact, &cws); } -MIR_CORE_DLL(INT_PTR) db_set_utf(HANDLE hContact, const char *szModule, const char *szSetting, const char *val) +MIR_CORE_DLL(INT_PTR) db_set_utf(HCONTACT hContact, const char *szModule, const char *szSetting, const char *val) { if (currDb == NULL) return 1; @@ -244,7 +244,7 @@ MIR_CORE_DLL(INT_PTR) db_set_utf(HANDLE hContact, const char *szModule, const ch return currDb->WriteContactSetting((MCONTACT)hContact, &cws); } -MIR_CORE_DLL(INT_PTR) db_set_blob(HANDLE hContact, const char *szModule, const char *szSetting, void *val, unsigned len) +MIR_CORE_DLL(INT_PTR) db_set_blob(HCONTACT hContact, const char *szModule, const char *szSetting, void *val, unsigned len) { if (currDb == NULL) return 1; @@ -260,27 +260,27 @@ MIR_CORE_DLL(INT_PTR) db_set_blob(HANDLE hContact, const char *szModule, const c ///////////////////////////////////////////////////////////////////////////////////////// // events -MIR_CORE_DLL(HANDLE) db_event_add(HANDLE hContact, DBEVENTINFO *dbei) +MIR_CORE_DLL(HANDLE) db_event_add(HCONTACT hContact, DBEVENTINFO *dbei) { return (currDb == NULL) ? 0 : currDb->AddEvent((MCONTACT)hContact, dbei); } -MIR_CORE_DLL(int) db_event_count(HANDLE hContact) +MIR_CORE_DLL(int) db_event_count(HCONTACT hContact) { return (currDb == NULL) ? 0 : currDb->GetEventCount((MCONTACT)hContact); } -MIR_CORE_DLL(int) db_event_delete(HANDLE hContact, HANDLE hDbEvent) +MIR_CORE_DLL(int) db_event_delete(HCONTACT hContact, HANDLE hDbEvent) { return (currDb == NULL) ? 0 : currDb->DeleteEvent((MCONTACT)hContact, hDbEvent); } -MIR_CORE_DLL(HANDLE) db_event_first(HANDLE hContact) +MIR_CORE_DLL(HANDLE) db_event_first(HCONTACT hContact) { return (currDb == NULL) ? 0 : currDb->FindFirstEvent((MCONTACT)hContact); } -MIR_CORE_DLL(HANDLE) db_event_firstUnread(HANDLE hContact) +MIR_CORE_DLL(HANDLE) db_event_firstUnread(HCONTACT hContact) { return (currDb == NULL) ? 0 : currDb->FindFirstUnreadEvent((MCONTACT)hContact); } @@ -295,17 +295,17 @@ MIR_CORE_DLL(int) db_event_getBlobSize(HANDLE hDbEvent) return (currDb == NULL) ? 0 : currDb->GetBlobSize(hDbEvent); } -MIR_CORE_DLL(HANDLE) db_event_getContact(HANDLE hDbEvent) +MIR_CORE_DLL(HCONTACT) db_event_getContact(HANDLE hDbEvent) { - return (currDb == NULL) ? 0 : currDb->GetEventContact(hDbEvent); + return (currDb == NULL) ? 0 : (HCONTACT)currDb->GetEventContact(hDbEvent); } -MIR_CORE_DLL(HANDLE) db_event_last(HANDLE hContact) +MIR_CORE_DLL(HANDLE) db_event_last(HCONTACT hContact) { return (currDb == NULL) ? 0 : currDb->FindLastEvent((MCONTACT)hContact); } -MIR_CORE_DLL(int) db_event_markRead(HANDLE hContact, HANDLE hDbEvent) +MIR_CORE_DLL(int) db_event_markRead(HCONTACT hContact, HANDLE hDbEvent) { return (currDb == NULL) ? 0 : currDb->MarkEventRead((MCONTACT)hContact, hDbEvent); } @@ -328,7 +328,7 @@ MIR_CORE_DLL(INT_PTR) db_free(DBVARIANT *dbv) return (currDb == NULL) ? 1 : currDb->FreeVariant(dbv); } -MIR_CORE_DLL(INT_PTR) db_unset(HANDLE hContact, const char *szModule, const char *szSetting) +MIR_CORE_DLL(INT_PTR) db_unset(HCONTACT hContact, const char *szModule, const char *szSetting) { if (currDb == NULL) return 1; @@ -336,14 +336,14 @@ MIR_CORE_DLL(INT_PTR) db_unset(HANDLE hContact, const char *szModule, const char return currDb->DeleteContactSetting((MCONTACT)hContact, szModule, szSetting); } -MIR_CORE_DLL(HANDLE) db_find_first(const char *szProto) +MIR_CORE_DLL(HCONTACT) db_find_first(const char *szProto) { - return (currDb == NULL) ? NULL : (HANDLE)currDb->FindFirstContact(szProto); + return (currDb == NULL) ? NULL : (HCONTACT)currDb->FindFirstContact(szProto); } -MIR_CORE_DLL(HANDLE) db_find_next(HANDLE hContact, const char *szProto) +MIR_CORE_DLL(HCONTACT) db_find_next(HCONTACT hContact, const char *szProto) { - return (currDb == NULL) ? NULL : (HANDLE)currDb->FindNextContact((MCONTACT)hContact, szProto); + return (currDb == NULL) ? NULL : (HCONTACT)currDb->FindNextContact((MCONTACT)hContact, szProto); } extern "C" MIR_CORE_DLL(void) db_setCurrent(MIDatabase* _db) diff --git a/src/mir_core/protos.cpp b/src/mir_core/protos.cpp index eeda5305e6..99db602565 100644 --- a/src/mir_core/protos.cpp +++ b/src/mir_core/protos.cpp @@ -61,7 +61,7 @@ MIR_CORE_DLL(void) ProtoLogW(struct PROTO_INTERFACE *pThis, LPCWSTR wszFormat, v ///////////////////////////////////////////////////////////////////////////////////////// -MIR_CORE_DLL(INT_PTR) ProtoBroadcastAck(const char *szModule, HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam) +MIR_CORE_DLL(INT_PTR) ProtoBroadcastAck(const char *szModule, HCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam) { if (type == ACKTYPE_AVATAR && hProcess) { PROTO_AVATAR_INFORMATION* ai = (PROTO_AVATAR_INFORMATION*)hProcess; diff --git a/src/modules/addcontact/addcontact.cpp b/src/modules/addcontact/addcontact.cpp index 513cd00c83..c44183faba 100644 --- a/src/modules/addcontact/addcontact.cpp +++ b/src/modules/addcontact/addcontact.cpp @@ -49,7 +49,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp { TCHAR *szName = NULL, *tmpStr = NULL; if (acs->handleType == HANDLE_CONTACT) - szName = cli.pfnGetContactDisplayName(acs->handle, GCDNF_TCHAR); + szName = cli.pfnGetContactDisplayName((HCONTACT)acs->handle, GCDNF_TCHAR); else { int isSet = 0; @@ -58,7 +58,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp dbei.cbBlob = db_event_getBlobSize(acs->handle); dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob); db_event_get(acs->handle, &dbei); - HANDLE hcontact = *((PHANDLE)(dbei.pBlob+sizeof(DWORD))); + HCONTACT hcontact = *(HCONTACT*)(dbei.pBlob + sizeof(DWORD)); mir_free(dbei.pBlob); if (hcontact != INVALID_HANDLE_VALUE) { szName = cli.pfnGetContactDisplayName(hcontact, 0); @@ -83,7 +83,7 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp if (acs->handleType == HANDLE_CONTACT && acs->handle) if (acs->szProto == NULL || (acs->szProto != NULL && *acs->szProto == 0)) - acs->szProto = GetContactProto(acs->handle); + acs->szProto = GetContactProto((HCONTACT)acs->handle); { TCHAR *grpName; @@ -147,22 +147,22 @@ INT_PTR CALLBACK AddContactDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp break; case IDOK: { - HANDLE hContact = INVALID_HANDLE_VALUE; + HCONTACT hContact = (HCONTACT)INVALID_HANDLE_VALUE; switch (acs->handleType) { case HANDLE_EVENT: { DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get(acs->handle, &dbei); - hContact = (HANDLE)CallProtoServiceInt(NULL,dbei.szModule, PS_ADDTOLISTBYEVENT, 0, (LPARAM)acs->handle); + hContact = (HCONTACT)CallProtoServiceInt(NULL, dbei.szModule, PS_ADDTOLISTBYEVENT, 0, (LPARAM)acs->handle); } break; case HANDLE_SEARCHRESULT: - hContact = (HANDLE)CallProtoServiceInt(NULL,acs->szProto, PS_ADDTOLIST, 0, (LPARAM)acs->psr); + hContact = (HCONTACT)CallProtoServiceInt(NULL, acs->szProto, PS_ADDTOLIST, 0, (LPARAM)acs->psr); break; case HANDLE_CONTACT: - hContact = acs->handle; + hContact = (HCONTACT)acs->handle; break; } diff --git a/src/modules/chat/chat.h b/src/modules/chat/chat.h index de8dac8906..d79accdc35 100644 --- a/src/modules/chat/chat.h +++ b/src/modules/chat/chat.h @@ -55,18 +55,18 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData); char* Log_SetStyle(int style); // clist.c -BOOL AddEvent(HANDLE hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR* fmt, ...); -HANDLE AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisplayName, int iType); -HANDLE FindRoom(const char *pszModule, const TCHAR *pszRoom); -BOOL SetAllOffline(BOOL bHide, const char *pszModule); -BOOL SetOffline(HANDLE hContact, BOOL bHide); - -int RoomDoubleclicked(WPARAM wParam,LPARAM lParam); -INT_PTR EventDoubleclicked(WPARAM wParam,LPARAM lParam); -INT_PTR JoinChat(WPARAM wParam, LPARAM lParam); -INT_PTR LeaveChat(WPARAM wParam, LPARAM lParam); -int PrebuildContactMenu(WPARAM wParam, LPARAM lParam); -INT_PTR PrebuildContactMenuSvc(WPARAM wParam, LPARAM lParam); +BOOL AddEvent(HCONTACT hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR* fmt, ...); +HCONTACT AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisplayName, int iType); +HCONTACT FindRoom(const char *pszModule, const TCHAR *pszRoom); +BOOL SetAllOffline(BOOL bHide, const char *pszModule); +BOOL SetOffline(HCONTACT hContact, BOOL bHide); + +int RoomDoubleclicked(WPARAM wParam,LPARAM lParam); +INT_PTR EventDoubleclicked(WPARAM wParam,LPARAM lParam); +INT_PTR JoinChat(WPARAM wParam, LPARAM lParam); +INT_PTR LeaveChat(WPARAM wParam, LPARAM lParam); +int PrebuildContactMenu(WPARAM wParam, LPARAM lParam); +INT_PTR PrebuildContactMenuSvc(WPARAM wParam, LPARAM lParam); // options.c int OptionsInit(void); @@ -99,7 +99,7 @@ BOOL IsEventSupported(int eventType); BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce); BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce); BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce); -int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...); +int ShowPopup(HCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...); const TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2); diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index b999172b4d..f69a06b75c 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -133,20 +133,20 @@ static INT_PTR Service_GetInfo(WPARAM wParam, LPARAM lParam) mir_cslock lck(cs); SESSION_INFO *si; - if (gci->Flags & BYINDEX) + if (gci->Flags & GCF_BYINDEX) si = ci.SM_FindSessionByIndex(gci->pszModule, gci->iItem); else si = ci.SM_FindSession(gci->pszID, gci->pszModule); if (si == NULL) return 1; - if (gci->Flags & DATA) gci->dwItemData = si->dwItemData; - if (gci->Flags & HCONTACT) gci->hContact = si->hContact; - if (gci->Flags & TYPE) gci->iType = si->iType; - if (gci->Flags & COUNT) gci->iCount = si->nUsersInNicklist; - if (gci->Flags & USERS) gci->pszUsers = ci.SM_GetUsers(si); - if (gci->Flags & ID) gci->pszID = si->ptszID; - if (gci->Flags & NAME) gci->pszName = si->ptszName; + if (gci->Flags & GCF_DATA) gci->dwItemData = si->dwItemData; + if (gci->Flags & GCF_HCONTACT) gci->hContact = si->hContact; + if (gci->Flags & GCF_TYPE) gci->iType = si->iType; + if (gci->Flags & GCF_COUNT) gci->iCount = si->nUsersInNicklist; + if (gci->Flags & GCF_USERS) gci->pszUsers = ci.SM_GetUsers(si); + if (gci->Flags & GCF_ID) gci->pszID = si->ptszID; + if (gci->Flags & GCF_NAME) gci->pszName = si->ptszName; return 0; } diff --git a/src/modules/chat/clist.cpp b/src/modules/chat/clist.cpp index 90d507a39f..cbd9fbd262 100644 --- a/src/modules/chat/clist.cpp +++ b/src/modules/chat/clist.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "chat.h" -HANDLE AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisplayName, int iType) +HCONTACT AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisplayName, int iType) { TCHAR pszGroup[50]; *pszGroup = '\0'; ptrT groupName(db_get_tsa(NULL, CHAT_MODULE, "AddToGroup")); @@ -42,7 +42,7 @@ HANDLE AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisp } } - HANDLE hContact = ci.FindRoom(pszModule, pszRoom); + HCONTACT hContact = ci.FindRoom(pszModule, pszRoom); if (hContact) { //contact exist, make sure it is in the right group if (pszGroup[0]) { ptrT grpName(db_get_tsa(hContact, "CList", "Group")); @@ -56,7 +56,7 @@ HANDLE AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisp } // here we create a new one since no one is to be found - if ((hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0)) == NULL) + if ((hContact = (HCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0)) == NULL) return NULL; CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)pszModule); @@ -71,7 +71,7 @@ HANDLE AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisp return hContact; } -BOOL SetOffline(HANDLE hContact, BOOL bHide) +BOOL SetOffline(HCONTACT hContact, BOOL bHide) { if (hContact) { char *szProto = GetContactProto(hContact); @@ -85,7 +85,7 @@ BOOL SetOffline(HANDLE hContact, BOOL bHide) BOOL SetAllOffline(BOOL bHide, const char *pszModule) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *szProto = GetContactProto(hContact); if (!ci.MM_FindModule(szProto)) continue; @@ -103,7 +103,7 @@ BOOL SetAllOffline(BOOL bHide, const char *pszModule) int RoomDoubleclicked(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (!hContact) return 0; @@ -141,7 +141,7 @@ INT_PTR EventDoubleclicked(WPARAM wParam,LPARAM lParam) INT_PTR JoinChat(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact) { char *szProto = GetContactProto(hContact); if (szProto) { @@ -157,7 +157,7 @@ INT_PTR JoinChat(WPARAM wParam, LPARAM lParam) INT_PTR LeaveChat(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact) { char *szProto = GetContactProto(hContact); if (szProto) @@ -168,7 +168,7 @@ INT_PTR LeaveChat(WPARAM wParam, LPARAM lParam) int PrebuildContactMenu(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; @@ -201,7 +201,7 @@ INT_PTR PrebuildContactMenuSvc(WPARAM wParam, LPARAM lParam) return PrebuildContactMenu(wParam, lParam); } -BOOL AddEvent(HANDLE hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR* fmt, ... ) +BOOL AddEvent(HCONTACT hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR* fmt, ... ) { TCHAR szBuf[4096]; @@ -233,9 +233,9 @@ BOOL AddEvent(HANDLE hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR* fmt, return TRUE; } -HANDLE FindRoom(const char *pszModule, const TCHAR *pszRoom) +HCONTACT FindRoom(const char *pszModule, const TCHAR *pszRoom) { - for (HANDLE hContact = db_find_first(pszModule); hContact; hContact = db_find_next(hContact, pszModule)) { + for (HCONTACT hContact = db_find_first(pszModule); hContact; hContact = db_find_next(hContact, pszModule)) { if (!db_get_b(hContact, pszModule, "ChatRoom", 0)) continue; diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp index 23980a5e91..9001e5678b 100644 --- a/src/modules/chat/tools.cpp +++ b/src/modules/chat/tools.cpp @@ -166,7 +166,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA return DefWindowProc(hWnd, message, wParam, lParam); } -int ShowPopup(HANDLE hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...) +int ShowPopup(HCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...) { static TCHAR szBuf[4 * 1024]; diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index d223f59307..c07c11441c 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -78,7 +78,7 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) if (!strcmp(cws->szModule, "CList")) { if (!strcmp(cws->szSetting, "MyHandle")) { - cli.pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam); + cli.pfnInvalidateDisplayNameCacheEntry((HCONTACT)wParam); cli.pfnClcBroadcast(INTM_NAMECHANGED, wParam, lParam); } else if (!strcmp(cws->szSetting, "Group")) @@ -93,7 +93,7 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) cli.pfnClcBroadcast(INTM_NAMEORDERCHANGED, 0, 0); } else { - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto != NULL) { if (!strcmp(cws->szModule, "Protocol") && !strcmp(cws->szSetting, "p")) cli.pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam); @@ -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, (HANDLE) (groupId | HCONTACT_ISGROUP), &contact, &group, NULL)) { + if (cli.pfnFindItem(hwnd, dat, (HCONTACT)(groupId | HCONTACT_ISGROUP), &contact, &group, NULL)) { lstrcpy(szFullName, contact->szText); while (group->parent) { for (i=0; i < group->parent->cl.count; i++) @@ -443,13 +443,13 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; case INTM_CONTACTADDED: - cli.pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 1, 1); - cli.pfnNotifyNewContact(hwnd, (HANDLE)wParam); + cli.pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, 1, 1); + cli.pfnNotifyNewContact(hwnd, (HCONTACT)wParam); SortClcByTimer(hwnd); break; case INTM_CONTACTDELETED: - cli.pfnDeleteItemFromTree(hwnd, (HANDLE)wParam); + cli.pfnDeleteItemFromTree(hwnd, (HCONTACT)wParam); SortClcByTimer(hwnd); break; @@ -459,12 +459,12 @@ 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, (HANDLE)wParam, NULL, NULL, NULL)) + if (cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, NULL, NULL, NULL)) break; - cli.pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 1, 1); - cli.pfnNotifyNewContact(hwnd, (HANDLE)wParam); + cli.pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, 1, 1); + cli.pfnNotifyNewContact(hwnd, (HCONTACT)wParam); } - else cli.pfnDeleteItemFromTree(hwnd, (HANDLE)wParam); + else cli.pfnDeleteItemFromTree(hwnd, (HCONTACT)wParam); dat->needsResort = 1; SortClcByTimer(hwnd); @@ -475,17 +475,17 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, { WORD iExtraImage[EXTRA_ICON_COUNT]; BYTE flags = 0; - if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) memset(iExtraImage, 0xFF, sizeof(iExtraImage)); else { memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); flags = contact->flags; } - cli.pfnDeleteItemFromTree(hwnd, (HANDLE)wParam); - if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b((HANDLE)wParam, "CList", "Hidden", 0)) { + cli.pfnDeleteItemFromTree(hwnd, (HCONTACT)wParam); + if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b((HCONTACT)wParam, "CList", "Hidden", 0)) { NMCLISTCONTROL nm; - cli.pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 1, 1); - if (cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { + cli.pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, 1, 1); + if (cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); if (flags & CONTACTF_CHECKED) contact->flags |= CONTACTF_CHECKED; @@ -506,32 +506,32 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, { int recalcScrollBar = 0, shouldShow; WORD status; - HANDLE hSelItem = NULL; + HCONTACT hSelItem = NULL; ClcContact *selcontact = NULL; - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto == NULL) status = ID_STATUS_OFFLINE; else - status = db_get_w((HANDLE)wParam, szProto, "Status", ID_STATUS_OFFLINE); + status = db_get_w((HCONTACT)wParam, szProto, "Status", ID_STATUS_OFFLINE); // this means an offline msg is flashing, so the contact should be shown DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); - shouldShow = (style & CLS_SHOWHIDDEN || !db_get_b((HANDLE)wParam, "CList", "Hidden", 0)) + shouldShow = (style & CLS_SHOWHIDDEN || !db_get_b((HCONTACT)wParam, "CList", "Hidden", 0)) && (!cli.pfnIsHiddenMode(dat, status) || CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != lParam); contact = NULL; group = NULL; - if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) { + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)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 = cli.pfnContactToHItem(selcontact); - cli.pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, (style & CLS_CONTACTLIST) == 0, 0); + hSelItem = (HCONTACT)cli.pfnContactToHItem(selcontact); + cli.pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, (style & CLS_CONTACTLIST) == 0, 0); recalcScrollBar = 1; - cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL); + cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL); if (contact) { contact->iImage = (WORD) lParam; - cli.pfnNotifyNewContact(hwnd, (HANDLE)wParam); + cli.pfnNotifyNewContact(hwnd, (HCONTACT)wParam); dat->needsResort = 1; } } @@ -541,7 +541,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) { if (dat->selection >= 0 && cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) - hSelItem = cli.pfnContactToHItem(selcontact); + hSelItem = (HCONTACT)cli.pfnContactToHItem(selcontact); cli.pfnRemoveItemFromGroup(hwnd, group, contact, (style & CLS_CONTACTLIST) == 0); recalcScrollBar = 1; } @@ -566,26 +566,26 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; case INTM_NAMECHANGED: - if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; - lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText)); + lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HCONTACT)wParam, 0), SIZEOF(contact->szText)); dat->needsResort = 1; SortClcByTimer(hwnd); break; case INTM_PROTOCHANGED: - if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; - contact->proto = GetContactProto((HANDLE)wParam); - cli.pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam); - lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText)); + contact->proto = GetContactProto((HCONTACT)wParam); + cli.pfnInvalidateDisplayNameCacheEntry((HCONTACT)wParam); + lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HCONTACT)wParam, 0), SIZEOF(contact->szText)); SortClcByTimer(hwnd); break; case INTM_NOTONLISTCHANGED: - if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; if (contact->type == CLCIT_CONTACT) { @@ -603,12 +603,12 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; case INTM_APPARENTMODECHANGED: - if ( cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { - char *szProto = GetContactProto((HANDLE)wParam); + if (cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto == NULL) break; - WORD apparentMode = db_get_w((HANDLE)wParam, szProto, "ApparentMode", 0); + WORD apparentMode = db_get_w((HCONTACT)wParam, szProto, "ApparentMode", 0); contact->flags &= ~(CONTACTF_INVISTO | CONTACTF_VISTO); if (apparentMode == ID_STATUS_OFFLINE) contact->flags |= CONTACTF_INVISTO; @@ -625,12 +625,12 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; case INTM_IDLECHANGED: - if ( cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { - char *szProto = GetContactProto((HANDLE)wParam); + if (cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto == NULL) break; contact->flags &= ~CONTACTF_IDLE; - if (db_get_dw((HANDLE)wParam, szProto, "IdleTS", 0)) + if (db_get_dw((HCONTACT)wParam, szProto, "IdleTS", 0)) contact->flags |= CONTACTF_IDLE; cli.pfnInvalidateRect(hwnd, NULL, FALSE); diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index 4732800a42..b95e072656 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -44,11 +44,11 @@ HMENU fnBuildGroupPopupMenu(ClcGroup* group); LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); /* clcidents.c */ -int fnGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex); -int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible); -int fnGetRowByIndex(struct ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup); -HANDLE fnContactToHItem(ClcContact* contact); -HANDLE fnContactToItemHandle(ClcContact * contact, DWORD * nmFlags); +int fnGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex); +int fnFindItem(HWND hwnd, struct ClcData *dat, HANDLE hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible); +int fnGetRowByIndex(struct ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup); +HANDLE fnContactToHItem(ClcContact *contact); +HANDLE fnContactToItemHandle(ClcContact *contact, DWORD *nmFlags); /* clcitems.c */ ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers); @@ -58,9 +58,9 @@ void fnFreeContact(ClcContact *p); void fnFreeGroup(ClcGroup *group); int fnAddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText); int fnAddItemToGroup(ClcGroup *group, int iAboveItem); -void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline); -int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact); -void fnDeleteItemFromTree(HWND hwnd, HANDLE hItem); +void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HCONTACT hContact, int updateTotalCount, int checkHideOffline); +int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, HCONTACT hContact); +void fnDeleteItemFromTree(HWND hwnd, HCONTACT hItem); void fnRebuildEntireList(HWND hwnd, struct ClcData *dat); int fnGetGroupContentsCount(ClcGroup *group, int visibleOnly); void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort); @@ -86,7 +86,7 @@ int fnGetDropTargetInformation(HWND hwnd, struct ClcData *dat, POINT pt); int fnClcStatusToPf2(int status); int fnIsHiddenMode(struct ClcData *dat, int status); void fnHideInfoTip(HWND hwnd, struct ClcData *dat); -void fnNotifyNewContact(HWND hwnd, HANDLE hContact); +void fnNotifyNewContact(HWND hwnd, HCONTACT hContact); DWORD fnGetDefaultExStyle(void); void fnGetSetting(int i, LOGFONT* lf, COLORREF* colour); void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF* colour); @@ -120,12 +120,12 @@ void RebuildMenuOrder(void); INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam); /* clistsettings.c */ -TCHAR* fnGetContactDisplayName(HANDLE hContact, int mode); +TCHAR* fnGetContactDisplayName(HCONTACT hContact, int mode); void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF * colour); -void fnInvalidateDisplayNameCacheEntry(HANDLE hContact); +void fnInvalidateDisplayNameCacheEntry(HCONTACT hContact); -ClcCacheEntry* fnGetCacheEntry(HANDLE hContact); -ClcCacheEntry* fnCreateCacheItem (HANDLE hContact); +ClcCacheEntry* fnGetCacheEntry(HCONTACT hContact); +ClcCacheEntry* fnCreateCacheItem (HCONTACT hContact); void fnCheckCacheItem(ClcCacheEntry *p); void fnFreeCacheItem(ClcCacheEntry *p); @@ -137,21 +137,21 @@ void fnUnregisterFileDropping (HWND hwnd); /* clistevents.c */ struct CListEvent* fnAddEvent(CLISTEVENT *cle); -CLISTEVENT* fnGetEvent(HANDLE hContact, int idx); +CLISTEVENT* fnGetEvent(HCONTACT hContact, int idx); struct CListEvent* fnCreateEvent(void); void fnFreeEvent(struct CListEvent* p); -int fnEventsProcessContactDoubleClick(HANDLE hContact); +int fnEventsProcessContactDoubleClick(HCONTACT hContact); int fnEventsProcessTrayDoubleClick(int); int fnGetImlIconIndex(HICON hIcon); -int fnRemoveEvent(HANDLE hContact, HANDLE dbEvent); +int fnRemoveEvent(HCONTACT hContact, HANDLE dbEvent); /* clistmod.c */ -int fnGetContactIcon(HANDLE hContact); -int fnIconFromStatusMode(const char *szProto, int status, HANDLE hContact); +int fnGetContactIcon(HCONTACT hContact); +int fnIconFromStatusMode(const char *szProto, int status, HCONTACT hContact); int fnShowHide(WPARAM wParam, LPARAM lParam); -HICON fnGetIconFromStatusMode(HANDLE hContact, const char *szProto, int status); +HICON fnGetIconFromStatusMode(HCONTACT hContact, const char *szProto, int status); TCHAR* fnGetStatusModeDescription(int wParam, int lParam); int fnGetWindowVisibleState(HWND hWnd, int iStepX, int iStepY); @@ -186,7 +186,7 @@ void fnCluiProtocolStatusChanged(int, const char*); void fnDrawMenuItem(DRAWITEMSTRUCT *dis, HICON hIcon, HICON eventIcon); /* contact.c */ -void fnChangeContactIcon (HANDLE hContact, int iIcon, int add); +void fnChangeContactIcon (HCONTACT hContact, int iIcon, int add); void fnLoadContactTree (void); int fnCompareContacts (const ClcContact *contact1, const ClcContact *contact2); void fnSortContacts (void); diff --git a/src/modules/clist/clcfiledrop.cpp b/src/modules/clist/clcfiledrop.cpp index 7f610710fd..2c79cafb7e 100644 --- a/src/modules/clist/clcfiledrop.cpp +++ b/src/modules/clist/clcfiledrop.cpp @@ -70,7 +70,7 @@ ULONG CDropTarget::Release(void) return InterlockedDecrement(&refCount); } -static HANDLE HContactFromPoint(HWND hwnd, struct ClcData *dat, int x, int y, int *hitLine) +static HCONTACT HContactFromPoint(HWND hwnd, struct ClcData *dat, int x, int y, int *hitLine) { DWORD hitFlags; ClcContact *contact; @@ -98,7 +98,7 @@ HRESULT CDropTarget::DragOver(DWORD /*grfKeyState*/, POINTL pt, DWORD * pdwEffec struct ClcData *dat; RECT clRect; int hit; - HANDLE hContact; + HCONTACT hContact; if (pDropTargetHelper && hwndCurrentDrag) pDropTargetHelper->DragOver((POINT*)&pt, *pdwEffect); @@ -207,7 +207,6 @@ HRESULT CDropTarget::Drop(IDataObject * pDataObj, DWORD /*fKeyState*/, POINTL pt HDROP hDrop; POINT shortPt; struct ClcData *dat; - HANDLE hContact; if (pDropTargetHelper && hwndCurrentDrag) pDropTargetHelper->Drop(pDataObj, (POINT*)&pt, *pdwEffect); @@ -221,7 +220,7 @@ HRESULT CDropTarget::Drop(IDataObject * pDataObj, DWORD /*fKeyState*/, POINTL pt shortPt.x = pt.x; shortPt.y = pt.y; ScreenToClient(hwndCurrentDrag, &shortPt); - hContact = HContactFromPoint(hwndCurrentDrag, dat, shortPt.x, shortPt.y, NULL); + HCONTACT hContact = HContactFromPoint(hwndCurrentDrag, dat, shortPt.x, shortPt.y, NULL); if (hContact != NULL) { TCHAR **ppFiles = NULL; TCHAR szFilename[MAX_PATH]; diff --git a/src/modules/clist/clcidents.cpp b/src/modules/clist/clcidents.cpp index 72279117ab..5ec0b48600 100644 --- a/src/modules/clist/clcidents.cpp +++ b/src/modules/clist/clcidents.cpp @@ -176,20 +176,20 @@ int fnGetRowByIndex(struct ClcData *dat, int testindex, ClcContact **contact, Cl return -1; } -HANDLE fnContactToHItem(ClcContact * contact) +HANDLE fnContactToHItem(ClcContact *contact) { switch (contact->type) { case CLCIT_CONTACT: return contact->hContact; case CLCIT_GROUP: - return (HANDLE) (contact->groupId | HCONTACT_ISGROUP); + return (HCONTACT)(contact->groupId | HCONTACT_ISGROUP); case CLCIT_INFO: - return (HANDLE) ((UINT_PTR) contact->hContact | HCONTACT_ISINFO); + return (HCONTACT)((UINT_PTR)contact->hContact | HCONTACT_ISINFO); } return NULL; } -HANDLE fnContactToItemHandle(ClcContact * contact, DWORD * nmFlags) +HANDLE fnContactToItemHandle(ClcContact *contact, DWORD *nmFlags) { switch (contact->type) { case CLCIT_CONTACT: @@ -197,11 +197,11 @@ HANDLE fnContactToItemHandle(ClcContact * contact, DWORD * nmFlags) case CLCIT_GROUP: if (nmFlags) *nmFlags |= CLNF_ISGROUP; - return (HANDLE) contact->groupId; + return (HCONTACT)contact->groupId; case CLCIT_INFO: if (nmFlags) *nmFlags |= CLNF_ISINFO; - return (HANDLE) ((UINT_PTR) contact->hContact | HCONTACT_ISINFO); + return (HCONTACT)((UINT_PTR)contact->hContact | HCONTACT_ISINFO); } return NULL; } diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index 8e4eb13939..0a66b5933e 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -108,7 +108,7 @@ ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD group->totalMembers = 0; if (flags != (DWORD) - 1 && pNextField == NULL && calcTotalMembers) { DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ClcCacheEntry *cache = cli.pfnGetCacheEntry(hContact); if (!lstrcmp(cache->tszGroup, szName) && (style & CLS_SHOWHIDDEN || !cache->bIsHidden)) group->totalMembers++; @@ -164,12 +164,12 @@ int fnAddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText) ++iInfoItemUniqueHandle; group->cl.items[i]->type = CLCIT_INFO; group->cl.items[i]->flags = (BYTE) flags; - group->cl.items[i]->hContact = (HANDLE)++ iInfoItemUniqueHandle; + group->cl.items[i]->hContact = (HCONTACT)++iInfoItemUniqueHandle; lstrcpyn(group->cl.items[i]->szText, pszText, SIZEOF(group->cl.items[i]->szText)); return i; } -int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact) +int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, HCONTACT hContact) { int i, index = -1; @@ -212,7 +212,7 @@ int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact) return i; } -void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int updateTotalCount, int checkHideOffline) +void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HCONTACT hContact, int updateTotalCount, int checkHideOffline) { ClcGroup *group; DBVARIANT dbv; @@ -309,7 +309,7 @@ ClcGroup* fnRemoveItemFromGroup(HWND hwnd, ClcGroup *group, ClcContact *contact, return group; } -void fnDeleteItemFromTree(HWND hwnd, HANDLE hItem) +void fnDeleteItemFromTree(HWND hwnd, HCONTACT hItem) { ClcContact *contact; ClcGroup *group; @@ -363,7 +363,7 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat) cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 0); } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (style & CLS_SHOWHIDDEN || !db_get_b(hContact, "CList", "Hidden", 0)) { DBVARIANT dbv; if (db_get_ts(hContact, "CList", "Group", &dbv)) @@ -545,13 +545,13 @@ void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort) { ClcContact *selcontact; ClcGroup *group = &dat->list, *selgroup; - HANDLE hSelItem; + HCONTACT hSelItem; if (dat->needsResort) { if (cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) == -1) hSelItem = NULL; else - hSelItem = cli.pfnContactToHItem(selcontact); + hSelItem = (HCONTACT)cli.pfnContactToHItem(selcontact); group->scanIndex = 0; SortGroup(dat, group, useInsertionSort); for (;;) { @@ -580,7 +580,7 @@ void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort) struct SavedContactState_t { - HANDLE hContact; + HCONTACT hContact; WORD iExtraImage[EXTRA_ICON_COUNT]; int checked; }; @@ -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, (HANDLE) (saveInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)(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 6845cd02e1..f1cc63ed18 100644 --- a/src/modules/clist/clcmsgs.cpp +++ b/src/modules/clist/clcmsgs.cpp @@ -31,7 +31,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR { switch (msg) { case CLM_ADDCONTACT: - cli.pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 1, 0); + cli.pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, 1, 0); cli.pfnRecalcScrollBar(hwnd, dat); cli.pfnSortCLC(hwnd, dat, 1); break; @@ -55,12 +55,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcGroup *group; CLCINFOITEM *cii = (CLCINFOITEM *) lParam; if (cii == NULL || cii->cbSize != sizeof(CLCINFOITEM)) - return (LRESULT)(HANDLE) NULL; + return NULL; if (cii->hParentGroup == NULL) group = &dat->list; else { - if (!cli.pfnFindItem(hwnd, dat, (HANDLE) ((UINT_PTR) cii->hParentGroup | HCONTACT_ISGROUP), &groupContact, NULL, NULL)) - return (LRESULT)(HANDLE) NULL; + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)((UINT_PTR)cii->hParentGroup | HCONTACT_ISGROUP), &groupContact, NULL, NULL)) + return NULL; group = groupContact->group; } if (msg == CLM_ADDINFOITEMA) @@ -79,7 +79,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR break; case CLM_DELETEITEM: - cli.pfnDeleteItemFromTree(hwnd, (HANDLE)wParam); + cli.pfnDeleteItemFromTree(hwnd, (HCONTACT)wParam); cli.pfnSortCLC(hwnd, dat, 1); cli.pfnRecalcScrollBar(hwnd, dat); break; @@ -97,7 +97,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR { ClcContact *contact; ClcGroup *group, *tgroup; - if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)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, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; if (contact->type != CLCIT_GROUP) break; @@ -117,13 +117,13 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR } case CLM_FINDCONTACT: - if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, NULL, NULL, NULL)) - return (LRESULT)(HANDLE) NULL; + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, NULL, NULL, NULL)) + return NULL; return wParam; case CLM_FINDGROUP: - if (!cli.pfnFindItem(hwnd, dat, (HANDLE) (wParam | HCONTACT_ISGROUP), NULL, NULL, NULL)) - return (LRESULT)(HANDLE) NULL; + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)(wParam | HCONTACT_ISGROUP), NULL, NULL, NULL)) + return NULL; return wParam | HCONTACT_ISGROUP; case CLM_GETBKCOLOR: @@ -132,7 +132,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR case CLM_GETCHECKMARK: { ClcContact *contact; - if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)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, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)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, (HANDLE)wParam, &contact, NULL, NULL)) + if (cli.pfnFindItem(hwnd, dat, (HCONTACT)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, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)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, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) return CLCIT_INVALID; return contact->type; } @@ -217,14 +217,14 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcContact *contact; ClcGroup *group; - if (!cli.pfnFindItem(hwnd, dat, (HANDLE) lParam, &contact, &group, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)lParam, &contact, &group, NULL)) return NULL; int i = List_IndexOf((SortedList*)&group->cl, contact); switch (wParam) { case CLGN_CHILD: if (contact->type != CLCIT_GROUP) - return (LRESULT)(HANDLE) NULL; + return NULL; group = contact->group; if (group->cl.count == 0) return NULL; @@ -320,7 +320,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR { ClcContact *contact; ClcGroup *group, *tgroup; - if (!cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)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, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)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, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)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, (HANDLE)wParam, &contact, NULL, NULL)) + if (!cli.pfnFindItem(hwnd, dat, (HCONTACT)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 b87fc9cfa5..49946868c7 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -633,7 +633,7 @@ void fnHideInfoTip(HWND, struct ClcData *dat) NotifyEventHooks(hHideInfoTipEvent, 0, (LPARAM) & it); } -void fnNotifyNewContact(HWND hwnd, HANDLE hContact) +void fnNotifyNewContact(HWND hwnd, HCONTACT hContact) { NMCLISTCONTROL nm; nm.hdr.code = CLN_NEWCONTACT; diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp index 3407be16df..2347021133 100644 --- a/src/modules/clist/clistevents.cpp +++ b/src/modules/clist/clistevents.cpp @@ -200,7 +200,7 @@ struct CListEvent* fnAddEvent(CLISTEVENT *cle) // Removes an event from the contact list's queue // Returns 0 if the event was successfully removed, or nonzero if the event was not found -int fnRemoveEvent(HANDLE hContact, HANDLE dbEvent) +int fnRemoveEvent(HCONTACT hContact, HANDLE dbEvent) { int i; char *szProto; @@ -257,7 +257,7 @@ int fnRemoveEvent(HANDLE hContact, HANDLE dbEvent) return 0; } -CLISTEVENT* fnGetEvent(HANDLE hContact, int idx) +CLISTEVENT* fnGetEvent(HCONTACT hContact, int idx) { if (hContact == INVALID_HANDLE_VALUE) { if (idx >= cli.events.count) @@ -272,7 +272,7 @@ CLISTEVENT* fnGetEvent(HANDLE hContact, int idx) return NULL; } -int fnEventsProcessContactDoubleClick(HANDLE hContact) +int fnEventsProcessContactDoubleClick(HCONTACT hContact) { for (int i=0; i < cli.events.count; i++) { if (cli.events.items[i]->cle.hContact == hContact) { @@ -290,7 +290,8 @@ int fnEventsProcessTrayDoubleClick(int index) { BOOL click_in_first_icon = FALSE; if (cli.events.count) { - HANDLE hContact, hDbEvent; + HCONTACT hContact; + HANDLE hDbEvent; int eventIndex = 0; cli.pfnLockTray(); if (cli.trayIconCount>1 && index>0) { @@ -369,8 +370,8 @@ static int RemoveEventsForContact(WPARAM wParam, LPARAM) for (; cli.events.count > 0;) { for (hit = 0, j = 0; j < cli.events.count; j++) { - if (cli.events.items[j]->cle.hContact == (HANDLE)wParam) { - cli.pfnRemoveEvent((HANDLE)wParam, cli.events.items[j]->cle.hDbEvent); + if (cli.events.items[j]->cle.hContact == (HCONTACT)wParam) { + cli.pfnRemoveEvent((HCONTACT)wParam, cli.events.items[j]->cle.hDbEvent); hit = 1; } } @@ -383,8 +384,8 @@ static int RemoveEventsForContact(WPARAM wParam, LPARAM) static int CListEventSettingsChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; - DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; + HCONTACT hContact = (HCONTACT)wParam; + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; if (hContact == NULL && cws && cws->szModule && cws->szSetting && strcmp(cws->szModule, "CList") == 0) { if (strcmp(cws->szSetting, "DisableTrayFlash") == 0) disableTrayFlash = (int)cws->value.bVal; @@ -398,8 +399,8 @@ static int CListEventSettingsChanged(WPARAM wParam, LPARAM lParam) INT_PTR AddEventSyncStub(WPARAM wParam, LPARAM lParam) { return CallServiceSync(MS_CLIST_ADDEVENT"_SYNC", wParam, lParam); } INT_PTR AddEventStub(WPARAM, LPARAM lParam) { return cli.pfnAddEvent((CLISTEVENT*)lParam) == NULL; } -INT_PTR RemoveEventStub(WPARAM wParam, LPARAM lParam) { return cli.pfnRemoveEvent((HANDLE)wParam, (HANDLE)lParam); } -INT_PTR GetEventStub(WPARAM wParam, LPARAM lParam) { return (INT_PTR)cli.pfnGetEvent((HANDLE)wParam, (int)lParam); } +INT_PTR RemoveEventStub(WPARAM wParam, LPARAM lParam) { return cli.pfnRemoveEvent((HCONTACT)wParam, (HANDLE)lParam); } +INT_PTR GetEventStub(WPARAM wParam, LPARAM lParam) { return (INT_PTR)cli.pfnGetEvent((HCONTACT)wParam, (int)lParam); } int InitCListEvents(void) { diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index 387d3b565c..08c81d6a3d 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -320,7 +320,7 @@ static INT_PTR AddContactMenuItem(WPARAM, LPARAM lParam) static INT_PTR BuildContactMenu(WPARAM wParam, LPARAM) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; NotifyEventHooks(hPreBuildContactMenuEvent, (WPARAM)hContact, 0); char *szProto = GetContactProto(hContact); diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index 3cd0e45693..5f2ae798be 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -139,8 +139,8 @@ static int ProtocolAck(WPARAM, LPARAM lParam) if ((int)ack->hProcess < ID_STATUS_ONLINE && ack->lParam >= ID_STATUS_ONLINE) { DWORD caps = (DWORD)CallProtoServiceInt(NULL,ack->szModule, PS_GETCAPS, PFLAGNUM_1, 0); if (caps & PF1_SERVERCLIST) { - for (HANDLE hContact = db_find_first(ack->szModule); hContact; ) { - HANDLE hNext = db_find_next(hContact, ack->szModule); + for (HCONTACT hContact = db_find_first(ack->szModule); hContact; ) { + HCONTACT hNext = db_find_next(hContact, ack->szModule); if (db_get_b(hContact, "CList", "Delete", 0)) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); hContact = hNext; @@ -152,12 +152,12 @@ static int ProtocolAck(WPARAM, LPARAM lParam) return 0; } -HICON fnGetIconFromStatusMode(HANDLE hContact, const char *szProto, int status) +HICON fnGetIconFromStatusMode(HCONTACT hContact, const char *szProto, int status) { return ImageList_GetIcon(hCListImages, cli.pfnIconFromStatusMode(szProto, status, hContact), ILD_NORMAL); } -int fnIconFromStatusMode(const char *szProto, int status, HANDLE) +int fnIconFromStatusMode(const char *szProto, int status, HCONTACT) { int index, i; @@ -176,7 +176,7 @@ int fnIconFromStatusMode(const char *szProto, int status, HANDLE) return 1; } -int fnGetContactIcon(HANDLE hContact) +int fnGetContactIcon(HCONTACT hContact) { char *szProto = GetContactProto(hContact); return cli.pfnIconFromStatusMode(szProto, @@ -185,7 +185,7 @@ int fnGetContactIcon(HANDLE hContact) static INT_PTR GetContactIcon(WPARAM wParam, LPARAM) { - return cli.pfnGetContactIcon((HANDLE)wParam); + return cli.pfnGetContactIcon((HCONTACT)wParam); } static void AddProtoIconIndex(PROTOACCOUNT* pa) @@ -245,7 +245,7 @@ static int ContactListAccountsChanged(WPARAM eventCode, LPARAM lParam) static INT_PTR ContactDoubleClicked(WPARAM wParam, LPARAM) { // Try to process event myself - if (cli.pfnEventsProcessContactDoubleClick((HANDLE)wParam) == 0) + if (cli.pfnEventsProcessContactDoubleClick((HCONTACT)wParam) == 0) return 0; // Allow third-party plugins to process a dblclick @@ -253,7 +253,7 @@ static INT_PTR ContactDoubleClicked(WPARAM wParam, LPARAM) return 0; // Otherwise try to execute the default action - TryProcessDoubleClick((HANDLE)wParam); + TryProcessDoubleClick((HCONTACT)wParam); return 0; } @@ -425,7 +425,7 @@ extern int sortByStatus, sortByProto; static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam) { - HANDLE a = (HANDLE)wParam, b = (HANDLE) lParam; + HCONTACT a = (HCONTACT)wParam, b = (HCONTACT)lParam; TCHAR namea[128], *nameb; int statusa, statusb; char *szProto1, *szProto2; @@ -433,8 +433,8 @@ static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam) szProto1 = GetContactProto(a); szProto2 = GetContactProto(b); - statusa = db_get_w((HANDLE) a, SAFESTRING(szProto1), "Status", ID_STATUS_OFFLINE); - statusb = db_get_w((HANDLE) b, SAFESTRING(szProto2), "Status", ID_STATUS_OFFLINE); + statusa = db_get_w(a, SAFESTRING(szProto1), "Status", ID_STATUS_OFFLINE); + statusb = db_get_w(b, SAFESTRING(szProto2), "Status", ID_STATUS_OFFLINE); if (sortByProto) { /* deal with statuses, online contacts have to go above offline */ @@ -533,8 +533,8 @@ void UnloadContactListModule() return; //remove transitory contacts - for (HANDLE hContact = db_find_first(); hContact != NULL; ) { - HANDLE hNext = db_find_next(hContact); + for (HCONTACT hContact = db_find_first(); hContact != NULL; ) { + HCONTACT hNext = db_find_next(hContact); if (db_get_b(hContact, "CList", "NotOnList", 0)) CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0); hContact = hNext; diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp index 89ee1d5f75..bf11aa6e95 100644 --- a/src/modules/clist/clistsettings.cpp +++ b/src/modules/clist/clistsettings.cpp @@ -54,7 +54,7 @@ void FreeDisplayNameCache(void) // default handlers for the cache item creation and destruction -ClcCacheEntry* fnCreateCacheItem(HANDLE hContact) +ClcCacheEntry* fnCreateCacheItem(HCONTACT hContact) { ClcCacheEntry* p = (ClcCacheEntry*)mir_calloc(sizeof(ClcCacheEntry)); if (p == NULL) @@ -86,14 +86,14 @@ void fnFreeCacheItem(ClcCacheEntry *p) p->bIsHidden = -1; } -ClcCacheEntry* fnGetCacheEntry(HANDLE hContact) +ClcCacheEntry* fnGetCacheEntry(HCONTACT hContact) { ClcCacheEntry *p; int idx; if (!List_GetIndex(clistCache, &hContact, &idx)) { if ((p = cli.pfnCreateCacheItem(hContact)) != NULL) { List_Insert(clistCache, p, idx); - cli.pfnInvalidateDisplayNameCacheEntry(p); + cli.pfnInvalidateDisplayNameCacheEntry((HCONTACT)p); } } else p = (ClcCacheEntry*)clistCache->items[idx]; @@ -102,7 +102,7 @@ ClcCacheEntry* fnGetCacheEntry(HANDLE hContact) return p; } -void fnInvalidateDisplayNameCacheEntry(HANDLE hContact) +void fnInvalidateDisplayNameCacheEntry(HCONTACT hContact) { if (hContact == INVALID_HANDLE_VALUE) { FreeDisplayNameCache(); @@ -116,7 +116,7 @@ void fnInvalidateDisplayNameCacheEntry(HANDLE hContact) } } -TCHAR* fnGetContactDisplayName(HANDLE hContact, int mode) +TCHAR* fnGetContactDisplayName(HCONTACT hContact, int mode) { ClcCacheEntry *cacheEntry = NULL; @@ -160,7 +160,7 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam) { static char retVal[200]; ClcCacheEntry *cacheEntry = NULL; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (lParam & GCDNF_UNICODE) return (INT_PTR)cli.pfnGetContactDisplayName(hContact, lParam & ~GCDNF_UNICODE); @@ -209,13 +209,13 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam) INT_PTR InvalidateDisplayName(WPARAM wParam, LPARAM) { - cli.pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam); + cli.pfnInvalidateDisplayNameCacheEntry((HCONTACT)wParam); return 0; } int ContactAdded(WPARAM wParam, LPARAM) { - cli.pfnChangeContactIcon((HANDLE)wParam, cli.pfnIconFromStatusMode(GetContactProto((HANDLE)wParam), ID_STATUS_OFFLINE, NULL), 1); + cli.pfnChangeContactIcon((HCONTACT)wParam, cli.pfnIconFromStatusMode(GetContactProto((HCONTACT)wParam), ID_STATUS_OFFLINE, NULL), 1); cli.pfnSortContacts(); return 0; } @@ -230,7 +230,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; DBVARIANT dbv; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; // Early exit if (hContact == NULL) @@ -270,7 +270,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam) if (!strcmp(cws->szModule, "CList")) { if (!strcmp(cws->szSetting, "Hidden")) { if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) { - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact), 1); } else diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index 559e9b2b13..ce1996d89e 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -134,7 +134,7 @@ static INT_PTR CALLBACK AskForConfirmationDlgProc(HWND hWnd, UINT msg, WPARAM wP TCHAR szFinal[256]; GetDlgItemText(hWnd, IDC_TOPLINE, szFormat, SIZEOF(szFormat)); - mir_sntprintf(szFinal, SIZEOF(szFinal), szFormat, cli.pfnGetContactDisplayName((HANDLE)lParam, 0)); + mir_sntprintf(szFinal, SIZEOF(szFinal), szFormat, cli.pfnGetContactDisplayName((HCONTACT)lParam, 0)); SetDlgItemText(hWnd, IDC_TOPLINE, szFinal); } SetFocus( GetDlgItem(hWnd, IDNO)); @@ -185,7 +185,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) // Delete contact case IDYES: { - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (szProto != NULL) { // Check if protocol uses server side lists DWORD caps; @@ -197,7 +197,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) status = CallProtoServiceInt(NULL,szProto, PS_GETSTATUS, 0, 0); if (status == ID_STATUS_OFFLINE || (status >= ID_STATUS_CONNECTING && status < ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES)) { // Set a flag so we remember to delete the contact when the protocol goes online the next time - db_set_b((HANDLE)wParam, "CList", "Delete", 1); + db_set_b((HCONTACT)wParam, "CList", "Delete", 1); MessageBox(NULL, TranslateT("This contact is on an instant messaging system which stores its contact list on a central server. The contact will be removed from the server and from your contact list when you next connect to that network."), TranslateT("Delete contact"), MB_ICONINFORMATION | MB_OK); @@ -212,7 +212,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam) // Archive contact case IDC_HIDE: - db_set_b((HANDLE)wParam, "CList", "Hidden", 1); + db_set_b((HCONTACT)wParam, "CList", "Hidden", 1); break; } @@ -815,7 +815,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case CLN_NEWCONTACT: if (nmc != NULL) - cli.pfnSetAllExtraIcons(nmc->hItem); + cli.pfnSetAllExtraIcons((HCONTACT)nmc->hItem); return TRUE; case CLN_LISTREBUILT: @@ -869,7 +869,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (hItem) { if (hitFlags & CLCHT_ONITEMEXTRA) { if (!IsHContactGroup(hItem) && !IsHContactInfo(hItem)) - if ( cli.pfnGetCacheEntry(nmc->hItem)) + if (cli.pfnGetCacheEntry((HCONTACT)nmc->hItem)) NotifyEventHooks(hEventExtraClick, (WPARAM)nmc->hItem, nmc->iColumn+1); } break; diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp index 4a7be77ba1..92f7f5deda 100644 --- a/src/modules/clist/contact.cpp +++ b/src/modules/clist/contact.cpp @@ -45,7 +45,7 @@ static const struct { {ID_STATUS_ONTHEPHONE, 150}, {ID_STATUS_OUTTOLUNCH, 425}}; -static int GetContactStatus(HANDLE hContact) +static int GetContactStatus(HCONTACT hContact) { char *szProto = GetContactProto(hContact); if (szProto == NULL) @@ -53,7 +53,7 @@ static int GetContactStatus(HANDLE hContact) return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); } -void fnChangeContactIcon(HANDLE hContact, int iIcon, int add) +void fnChangeContactIcon(HCONTACT hContact, int iIcon, int add) { CallService(add ? MS_CLUI_CONTACTADDED : MS_CLUI_CONTACTSETICON, (WPARAM) hContact, iIcon); NotifyEventHooks(hContactIconChangedEvent, (WPARAM) hContact, iIcon); @@ -78,7 +78,7 @@ void fnLoadContactTree(void) } int hideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { int status = GetContactStatus(hContact); if ((!hideOffline || status != ID_STATUS_OFFLINE) && !db_get_b(hContact, "CList", "Hidden", 0)) cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(GetContactProto(hContact), status, hContact), 1); @@ -90,13 +90,13 @@ void fnLoadContactTree(void) int fnCompareContacts(const ClcContact* c1, const ClcContact* c2) { - HANDLE a = c1->hContact, b = c2->hContact; + HCONTACT a = c1->hContact, b = c2->hContact; TCHAR namea[128], *nameb; int statusa, statusb; int rc; - statusa = db_get_w((HANDLE) a, c1->proto, "Status", ID_STATUS_OFFLINE); - statusb = db_get_w((HANDLE) b, c2->proto, "Status", ID_STATUS_OFFLINE); + statusa = db_get_w(a, c1->proto, "Status", ID_STATUS_OFFLINE); + statusb = db_get_w(b, c2->proto, "Status", ID_STATUS_OFFLINE); if (sortByProto) { /* deal with statuses, online contacts have to go above offline */ @@ -111,17 +111,15 @@ int fnCompareContacts(const ClcContact* c1, const ClcContact* c2) } if (sortByStatus) { - int ordera, orderb; - ordera = GetStatusModeOrdering(statusa); - orderb = GetStatusModeOrdering(statusb); + int ordera = GetStatusModeOrdering(statusa); + int orderb = GetStatusModeOrdering(statusb); if (ordera != orderb) return ordera - orderb; } else { //one is offline: offline goes below online - if ((statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE)) { + if ((statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE)) return 2 * (statusa == ID_STATUS_OFFLINE) - 1; - } } nameb = cli.pfnGetContactDisplayName(a, 0); @@ -146,13 +144,13 @@ INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam) CallService(MS_CLUI_CONTACTDELETED, wParam, 0); if ((HANDLE) lParam == NULL) - db_unset((HANDLE)wParam, "CList", "Group"); + db_unset((HCONTACT)wParam, "CList", "Group"); else { grpChg.pszNewName = cli.pfnGetGroupName(lParam, NULL); - db_set_ts((HANDLE)wParam, "CList", "Group", grpChg.pszNewName); + db_set_ts((HCONTACT)wParam, "CList", "Group", grpChg.pszNewName); } CallService(MS_CLUI_CONTACTADDED, wParam, - cli.pfnIconFromStatusMode(GetContactProto((HANDLE)wParam), GetContactStatus((HANDLE)wParam), (HANDLE)wParam)); + cli.pfnIconFromStatusMode(GetContactProto((HCONTACT)wParam), GetContactStatus((HCONTACT)wParam), (HCONTACT)wParam)); NotifyEventHooks(hGroupChangeEvent, wParam, (LPARAM)&grpChg); return 0; diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index be411350a5..c453635fce 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -1096,7 +1096,7 @@ int RegisterAllIconsInIconLib() return 0; } -int TryProcessDoubleClick(HANDLE hContact) +int TryProcessDoubleClick(HCONTACT hContact) { int iMenuID = GetMenuObjbyId((int)hContactMenuObject); if (iMenuID != -1) { diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp index b6162fc17e..123ee33692 100644 --- a/src/modules/clist/groups.cpp +++ b/src/modules/clist/groups.cpp @@ -178,7 +178,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) int i; char str[33]; DBVARIANT dbv; - HANDLE hContact; + HCONTACT hContact; TCHAR name[256], szNewParent[256], *pszLastBackslash; //get the name @@ -292,7 +292,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) db_set_ts(NULL, "CListGroups", idstr, str); //must rename setting in all child contacts too - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ClcCacheEntry *cache = cli.pfnGetCacheEntry(hContact); if (!lstrcmp(cache->tszGroup, oldName)) { db_set_ts(hContact, "CList", "Group", szName); diff --git a/src/modules/clist/movetogroup.cpp b/src/modules/clist/movetogroup.cpp index 00d6817fb8..3c3dc12ef2 100644 --- a/src/modules/clist/movetogroup.cpp +++ b/src/modules/clist/movetogroup.cpp @@ -101,7 +101,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) CallService(MS_CLIST_REMOVECONTACTMENUITEM, (WPARAM)lphGroupsItems[i], 0); lphGroupsItems.destroy(); - ptrT szContactGroup( db_get_tsa((HANDLE)wParam, "CList", "Group")); + ptrT szContactGroup(db_get_tsa((HCONTACT)wParam, "CList", "Group")); int pos = 1000; diff --git a/src/modules/database/dbintf.cpp b/src/modules/database/dbintf.cpp index a4a4e7a1a7..c07ab7502f 100644 --- a/src/modules/database/dbintf.cpp +++ b/src/modules/database/dbintf.cpp @@ -48,7 +48,7 @@ static INT_PTR srvGetContactCount(WPARAM, LPARAM) static INT_PTR srvDeleteContact(WPARAM wParam, LPARAM) { DBVARIANT dbv = {0}; - if (!db_get_ts((HANDLE)wParam, "ContactPhoto", "File", &dbv)) { + if (!db_get_ts((HCONTACT)wParam, "ContactPhoto", "File", &dbv)) { DeleteFile(dbv.ptszVal); db_free(&dbv); } diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index 977248f906..045967ed1d 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -112,7 +112,7 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) // EVENTTYPE_AUTHREQUEST: uin(DWORD), hContact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ) // EVENTTYPE_ADDED: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ) DWORD uin = *(DWORD*)dbei->pBlob; - HANDLE hContact = (HANDLE)*(DWORD*)(dbei->pBlob + sizeof(DWORD)); + HCONTACT hContact = (HCONTACT)*(DWORD*)(dbei->pBlob + sizeof(DWORD)); char *buf = LPSTR(dbei->pBlob) + sizeof(DWORD)*2; ptrT tszNick(getEventString(dbei, buf)); ptrT tszFirst(getEventString(dbei, buf)); diff --git a/src/modules/extraicons/BaseExtraIcon.cpp b/src/modules/extraicons/BaseExtraIcon.cpp index 0baffeba67..e60276bad4 100644 --- a/src/modules/extraicons/BaseExtraIcon.cpp +++ b/src/modules/extraicons/BaseExtraIcon.cpp @@ -65,13 +65,13 @@ void BaseExtraIcon::setDescIcon(const char *icon) szDescIcon = mir_strdup(icon); } -void BaseExtraIcon::onClick(HANDLE hContact) +void BaseExtraIcon::onClick(HCONTACT hContact) { if (OnClick != NULL) OnClick((WPARAM)hContact, (LPARAM)ConvertToClistSlot(slot), onClickParam); } -int BaseExtraIcon::ClistSetExtraIcon(HANDLE hContact, HANDLE hImage) +int BaseExtraIcon::ClistSetExtraIcon(HCONTACT hContact, HANDLE hImage) { ExtraIcon *tmp = extraIconsByHandle[id - 1]; if (tmp != this) diff --git a/src/modules/extraicons/CallbackExtraIcon.cpp b/src/modules/extraicons/CallbackExtraIcon.cpp index b271aef8bb..6c83193971 100644 --- a/src/modules/extraicons/CallbackExtraIcon.cpp +++ b/src/modules/extraicons/CallbackExtraIcon.cpp @@ -50,7 +50,7 @@ void CallbackExtraIcon::rebuildIcons() RebuildIcons(0, 0); } -void CallbackExtraIcon::applyIcon(HANDLE hContact) +void CallbackExtraIcon::applyIcon(HCONTACT hContact) { if (!isEnabled() || hContact == NULL) return; @@ -61,7 +61,7 @@ void CallbackExtraIcon::applyIcon(HANDLE hContact) ApplyIcon((WPARAM)hContact, 0); } -int CallbackExtraIcon::setIcon(int id, HANDLE hContact, HANDLE icon) +int CallbackExtraIcon::setIcon(int id, HCONTACT hContact, HANDLE icon) { if (!isEnabled() || hContact == NULL || id != this->id) return -1; @@ -69,7 +69,7 @@ int CallbackExtraIcon::setIcon(int id, HANDLE hContact, HANDLE icon) return ClistSetExtraIcon(hContact, icon); } -int CallbackExtraIcon::setIconByName(int id, HANDLE hContact, const char *icon) +int CallbackExtraIcon::setIconByName(int id, HCONTACT hContact, const char *icon) { return -1; } diff --git a/src/modules/extraicons/DefaultExtraIcons.cpp b/src/modules/extraicons/DefaultExtraIcons.cpp index 9b968d81f1..fe75c5b1a8 100644 --- a/src/modules/extraicons/DefaultExtraIcons.cpp +++ b/src/modules/extraicons/DefaultExtraIcons.cpp @@ -33,7 +33,7 @@ ExtraIcon* GetExtraIcon(HANDLE id); HANDLE hExtraVisibility, hExtraChat, hExtraGender, hExtraProto; -static void SetVisibility(HANDLE hContact, int apparentMode, bool clear) +static void SetVisibility(HCONTACT hContact, int apparentMode, bool clear) { if (hContact == NULL) return; @@ -69,7 +69,7 @@ static void SetVisibility(HANDLE hContact, int apparentMode, bool clear) } } -static void SetGender(HANDLE hContact, int gender, bool clear) +static void SetGender(HCONTACT hContact, int gender, bool clear) { if (hContact == NULL) return; @@ -134,7 +134,7 @@ static Info infos[] = &EmailOnClick }, }; -static void SetExtraIcons(HANDLE hContact) +static void SetExtraIcons(HCONTACT hContact) { if (hContact == NULL) return; @@ -161,7 +161,7 @@ static void SetExtraIcons(HANDLE hContact) static int SettingChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; @@ -209,7 +209,7 @@ static int DefaultOnClick(WPARAM wParam, LPARAM lParam, LPARAM param) if (p == NULL) return 0; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; @@ -279,7 +279,7 @@ static ProtoInfo* FindProto(const char *proto) static int ProtocolApplyIcon(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; char *proto = GetContactProto(hContact); if (IsEmpty(proto)) return 0; @@ -319,7 +319,7 @@ void DefaultExtraIcons_Load() p.hExtraIcon = ExtraIcon_Register(p.name, p.desc, LoadSkinnedIconName(p.iSkinIcon)); } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { SetExtraIcons(hContact); SetVisibility(hContact, -1, false); SetGender(hContact, -1, false); diff --git a/src/modules/extraicons/ExtraIcon.cpp b/src/modules/extraicons/ExtraIcon.cpp index 197da8976f..0da9413ef8 100644 --- a/src/modules/extraicons/ExtraIcon.cpp +++ b/src/modules/extraicons/ExtraIcon.cpp @@ -67,7 +67,7 @@ void ExtraIcon::applyIcons() if (!isEnabled()) return; - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { // Clear to assert that it will be cleared Clist_SetExtraIcon(hContact, slot, INVALID_HANDLE_VALUE); applyIcon(hContact); diff --git a/src/modules/extraicons/ExtraIcon.h b/src/modules/extraicons/ExtraIcon.h index 31ec96a490..de259cbd9c 100644 --- a/src/modules/extraicons/ExtraIcon.h +++ b/src/modules/extraicons/ExtraIcon.h @@ -35,12 +35,12 @@ public: virtual void rebuildIcons() = 0; virtual void applyIcons(); - virtual void applyIcon(HANDLE hContact) =0 ; - virtual void onClick(HANDLE hContact) = 0; + virtual void applyIcon(HCONTACT hContact) =0 ; + virtual void onClick(HCONTACT hContact) = 0; - virtual int setIcon(int id, HANDLE hContact, HANDLE icon) = 0; - virtual int setIconByName(int id, HANDLE hContact, const char* icon) = 0; - virtual void storeIcon(HANDLE hContact, void *icon) {}; + virtual int setIcon(int id, HCONTACT hContact, HANDLE icon) = 0; + virtual int setIconByName(int id, HCONTACT hContact, const char* icon) = 0; + virtual void storeIcon(HCONTACT hContact, void *icon) {}; virtual const char *getName() const; virtual const TCHAR *getDescription() const = 0; @@ -55,7 +55,7 @@ public: virtual bool isEnabled() const; - virtual int ClistSetExtraIcon(HANDLE hContact, HANDLE hImage) = 0; + virtual int ClistSetExtraIcon(HCONTACT hContact, HANDLE hImage) = 0; int hLangpack; @@ -82,10 +82,10 @@ public: virtual void setDescIcon(const char *icon); virtual int getType() const =0; - virtual void onClick(HANDLE hContact); + virtual void onClick(HCONTACT hContact); virtual void setOnClick(MIRANDAHOOKPARAM OnClick, LPARAM param); - virtual int ClistSetExtraIcon(HANDLE hContact, HANDLE hImage); + virtual int ClistSetExtraIcon(HCONTACT hContact, HANDLE hImage); protected: int id; @@ -108,10 +108,10 @@ public: virtual int getType() const; virtual void rebuildIcons(); - virtual void applyIcon(HANDLE hContact); + virtual void applyIcon(HCONTACT hContact); - virtual int setIcon(int id, HANDLE hContact, HANDLE icon); - virtual int setIconByName(int id, HANDLE hContact, const char* icon); + virtual int setIcon(int id, HCONTACT hContact, HANDLE icon); + virtual int setIconByName(int id, HCONTACT hContact, const char* icon); private: int(*RebuildIcons)(WPARAM wParam, LPARAM lParam); @@ -132,11 +132,11 @@ public: virtual int getType() const; virtual void rebuildIcons(); - virtual void applyIcon(HANDLE hContact); + virtual void applyIcon(HCONTACT hContact); - virtual int setIcon(int id, HANDLE hContact, HANDLE icon); - virtual int setIconByName(int id, HANDLE hContact, const char* icon); - virtual void storeIcon(HANDLE hContact, void *icon); + virtual int setIcon(int id, HCONTACT hContact, HANDLE icon); + virtual int setIconByName(int id, HCONTACT hContact, const char* icon); + virtual void storeIcon(HCONTACT hContact, void *icon); }; ///////////////////////////////////////////////////////////////////////////////////////// @@ -144,7 +144,7 @@ public: class ExtraIconGroup : public ExtraIcon { - int internalSetIcon(int id, HANDLE hContact, HANDLE icon, bool bByName); + int internalSetIcon(int id, HCONTACT hContact, HANDLE icon, bool bByName); public: ExtraIconGroup(const char *name); virtual ~ExtraIconGroup(); @@ -152,11 +152,11 @@ public: virtual void addExtraIcon(BaseExtraIcon *extra); virtual void rebuildIcons(); - virtual void applyIcon(HANDLE hContact); - virtual void onClick(HANDLE hContact); + virtual void applyIcon(HCONTACT hContact); + virtual void onClick(HCONTACT hContact); - virtual int setIcon(int id, HANDLE hContact, HANDLE icon); - virtual int setIconByName(int id, HANDLE hContact, const char *icon); + virtual int setIcon(int id, HCONTACT hContact, HANDLE icon); + virtual int setIconByName(int id, HCONTACT hContact, const char *icon); virtual const TCHAR* getDescription() const; virtual const char* getDescIcon() const; @@ -167,14 +167,14 @@ public: LIST items; - virtual int ClistSetExtraIcon(HANDLE hContact, HANDLE hImage); + virtual int ClistSetExtraIcon(HCONTACT hContact, HANDLE hImage); protected: ptrT tszDescription; bool setValidExtraIcon; bool insideApply; - virtual ExtraIcon *getCurrentItem(HANDLE hContact) const; + virtual ExtraIcon *getCurrentItem(HCONTACT hContact) const; }; #endif // __EXTRAICON_H__ diff --git a/src/modules/extraicons/ExtraIconGroup.cpp b/src/modules/extraicons/ExtraIconGroup.cpp index 5ec33e2b2c..9df088c1c8 100644 --- a/src/modules/extraicons/ExtraIconGroup.cpp +++ b/src/modules/extraicons/ExtraIconGroup.cpp @@ -54,7 +54,7 @@ void ExtraIconGroup::rebuildIcons() items[i]->rebuildIcons(); } -void ExtraIconGroup::applyIcon(HANDLE hContact) +void ExtraIconGroup::applyIcon(HCONTACT hContact) { if (!isEnabled() || hContact == NULL) return; @@ -91,7 +91,7 @@ void ExtraIconGroup::setSlot(int slot) items[i]->setSlot(slot); } -ExtraIcon * ExtraIconGroup::getCurrentItem(HANDLE hContact) const +ExtraIcon * ExtraIconGroup::getCurrentItem(HCONTACT hContact) const { int id = (int)db_get_dw(hContact, MODULE_NAME, szName, 0); if (id < 1) @@ -104,24 +104,24 @@ ExtraIcon * ExtraIconGroup::getCurrentItem(HANDLE hContact) const return NULL; } -void ExtraIconGroup::onClick(HANDLE hContact) +void ExtraIconGroup::onClick(HCONTACT hContact) { ExtraIcon *extra = getCurrentItem(hContact); if (extra != NULL) extra->onClick(hContact); } -int ExtraIconGroup::setIcon(int id, HANDLE hContact, HANDLE value) +int ExtraIconGroup::setIcon(int id, HCONTACT hContact, HANDLE value) { return internalSetIcon(id, hContact, (void*)value, false); } -int ExtraIconGroup::setIconByName(int id, HANDLE hContact, const char *value) +int ExtraIconGroup::setIconByName(int id, HCONTACT hContact, const char *value) { return internalSetIcon(id, hContact, (void*)value, true); } -int ExtraIconGroup::internalSetIcon(int id, HANDLE hContact, void *value, bool bByName) +int ExtraIconGroup::internalSetIcon(int id, HCONTACT hContact, void *value, bool bByName) { if (insideApply) { for (int i=0; i < items.getCount(); i++) @@ -208,7 +208,7 @@ int ExtraIconGroup::getType() const return EXTRAICON_TYPE_GROUP; } -int ExtraIconGroup::ClistSetExtraIcon(HANDLE hContact, HANDLE hImage) +int ExtraIconGroup::ClistSetExtraIcon(HCONTACT hContact, HANDLE hImage) { if (hImage != INVALID_HANDLE_VALUE) setValidExtraIcon = true; diff --git a/src/modules/extraicons/IcolibExtraIcon.cpp b/src/modules/extraicons/IcolibExtraIcon.cpp index 78c020ce3a..acf38d3ead 100644 --- a/src/modules/extraicons/IcolibExtraIcon.cpp +++ b/src/modules/extraicons/IcolibExtraIcon.cpp @@ -46,7 +46,7 @@ void IcolibExtraIcon::rebuildIcons() { } -void IcolibExtraIcon::applyIcon(HANDLE hContact) +void IcolibExtraIcon::applyIcon(HCONTACT hContact) { if (!isEnabled() || hContact == NULL) return; @@ -60,7 +60,7 @@ void IcolibExtraIcon::applyIcon(HANDLE hContact) ClistSetExtraIcon(hContact, hImage); } -int IcolibExtraIcon::setIcon(int id, HANDLE hContact, HANDLE hIcoLib) +int IcolibExtraIcon::setIcon(int id, HCONTACT hContact, HANDLE hIcoLib) { if (hContact == NULL || id != this->id) return -1; @@ -84,7 +84,7 @@ int IcolibExtraIcon::setIcon(int id, HANDLE hContact, HANDLE hIcoLib) return 0; } -int IcolibExtraIcon::setIconByName(int id, HANDLE hContact, const char *icon) +int IcolibExtraIcon::setIconByName(int id, HCONTACT hContact, const char *icon) { if (hContact == NULL || id != this->id) return -1; @@ -106,7 +106,7 @@ int IcolibExtraIcon::setIconByName(int id, HANDLE hContact, const char *icon) return 0; } -void IcolibExtraIcon::storeIcon(HANDLE hContact, void *icon) +void IcolibExtraIcon::storeIcon(HCONTACT hContact, void *icon) { if (hContact == NULL) return; diff --git a/src/modules/extraicons/extraicons.cpp b/src/modules/extraicons/extraicons.cpp index 99abd93ed0..a85fb18a28 100644 --- a/src/modules/extraicons/extraicons.cpp +++ b/src/modules/extraicons/extraicons.cpp @@ -82,7 +82,7 @@ int ExtraImage_ExtraIDToColumnNum(int extra) return (extra < 1 || extra > EXTRA_ICON_COUNT) ? -1 : extra-1; } -int Clist_SetExtraIcon(HANDLE hContact, int slot, HANDLE hImage) +int Clist_SetExtraIcon(HCONTACT hContact, int slot, HANDLE hImage) { if (cli.hwndContactTree == 0) return -1; @@ -248,7 +248,7 @@ int ClistExtraListRebuild(WPARAM wParam, LPARAM lParam) int ClistExtraImageApply(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; @@ -262,7 +262,7 @@ int ClistExtraImageApply(WPARAM wParam, LPARAM lParam) int ClistExtraClick(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) return 0; @@ -313,7 +313,7 @@ void fnReloadExtraIcons() bImageCreated = true; } -void fnSetAllExtraIcons(HANDLE hContact) +void fnSetAllExtraIcons(HCONTACT hContact) { if (cli.hwndContactTree == 0) return; diff --git a/src/modules/extraicons/extraicons.h b/src/modules/extraicons/extraicons.h index 3926cdc963..cedddefb0c 100644 --- a/src/modules/extraicons/extraicons.h +++ b/src/modules/extraicons/extraicons.h @@ -41,14 +41,14 @@ ExtraIcon * GetExtraIconBySlot(int slot); int GetNumberOfSlots(); int ConvertToClistSlot(int slot); -int Clist_SetExtraIcon(HANDLE hContact, int slot, HANDLE hImage); +int Clist_SetExtraIcon(HCONTACT hContact, int slot, HANDLE hImage); void DefaultExtraIcons_Load(); HANDLE ExtraIcon_Add(HICON hIcon); void fnReloadExtraIcons(); -void fnSetAllExtraIcons(HANDLE hContact); +void fnSetAllExtraIcons(HCONTACT hContact); static inline BOOL IsEmpty(const char *str) { diff --git a/src/modules/extraicons/options_ei.cpp b/src/modules/extraicons/options_ei.cpp index 8432b945a9..19117a0de8 100644 --- a/src/modules/extraicons/options_ei.cpp +++ b/src/modules/extraicons/options_ei.cpp @@ -70,7 +70,7 @@ BOOL ScreenToClient(HWND hWnd, LPRECT lpRect) static void RemoveExtraIcons(int slot) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) Clist_SetExtraIcon(hContact, slot, INVALID_HANDLE_VALUE); } diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index 57dcb2bc4f..d3f32ea6d5 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -379,15 +379,13 @@ void ShowMoreOptionsMenu(HWND hwndDlg, int x, int y) } case IDC_DETAILS: { - HANDLE hContact; - hContact = (HANDLE)CallProtoServiceInt(NULL,lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr); + HCONTACT hContact = (HCONTACT)CallProtoServiceInt(NULL, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr); CallService(MS_USERINFO_SHOWDIALOG, (WPARAM)hContact, 0); break; } case IDC_SENDMESSAGE: { - HANDLE hContact; - hContact = (HANDLE)CallProtoServiceInt(NULL,lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr); + HCONTACT hContact = (HCONTACT)CallProtoServiceInt(NULL, lsr->szProto, PS_ADDTOLIST, PALF_TEMPORARY, (LPARAM)&lsr->psr); CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)(const char*)NULL); break; } diff --git a/src/modules/ignore/ignore.cpp b/src/modules/ignore/ignore.cpp index 3b63ba8b8c..74683b5c18 100644 --- a/src/modules/ignore/ignore.cpp +++ b/src/modules/ignore/ignore.cpp @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static const DWORD ignoreIdToPf1[IGNOREEVENT_MAX] = {PF1_IMRECV, PF1_URLRECV, PF1_FILERECV, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; static const DWORD ignoreIdToPf4[IGNOREEVENT_MAX] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, PF4_SUPPORTTYPING}; -static DWORD GetMask(HANDLE hContact) +static DWORD GetMask(HCONTACT hContact) { DWORD mask = db_get_dw(hContact, "Ignore", "Mask1", (DWORD)(-1)); if (mask == (DWORD)(-1)) { @@ -145,7 +145,7 @@ static void SetIconsForColumn(HWND hwndList, HANDLE hItem, HANDLE hItemAll, int } } -static void InitialiseItem(HWND hwndList, HANDLE hContact, HANDLE hItem, DWORD proto1Caps, DWORD proto4Caps) +static void InitialiseItem(HWND hwndList, HCONTACT hContact, HANDLE hItem, DWORD proto1Caps, DWORD proto4Caps) { DWORD mask = GetMask(hContact); for (int i=0; i < IGNOREEVENT_MAX; i++) @@ -156,7 +156,7 @@ static void InitialiseItem(HWND hwndList, HANDLE hContact, HANDLE hItem, DWORD p SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(IGNOREEVENT_MAX+1, 2)); } -static void SaveItemMask(HWND hwndList, HANDLE hContact, HANDLE hItem, const char *pszSetting) +static void SaveItemMask(HWND hwndList, HCONTACT hContact, HANDLE hItem, const char *pszSetting) { DWORD mask = 0; for (int i=0; i < IGNOREEVENT_MAX; i++) { @@ -169,7 +169,7 @@ static void SaveItemMask(HWND hwndList, HANDLE hContact, HANDLE hItem, const cha static void SetAllContactIcons(HWND hwndList) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(IGNOREEVENT_MAX, 0)) == EMPTY_EXTRA_ICON) { DWORD proto1Caps, proto4Caps; @@ -296,7 +296,7 @@ static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) SaveItemMask( GetDlgItem(hwndDlg, IDC_LIST), hContact, hItem, "Mask1"); if (SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) @@ -338,7 +338,7 @@ static int IgnoreOptInitialise(WPARAM wParam, LPARAM) static INT_PTR IsIgnored(WPARAM wParam, LPARAM lParam) { - DWORD mask = GetMask((HANDLE)wParam); + DWORD mask = GetMask((HCONTACT)wParam); if (lParam < 1 || lParam > IGNOREEVENT_MAX) return 1; return (mask >> (lParam-1))&1; @@ -346,20 +346,20 @@ static INT_PTR IsIgnored(WPARAM wParam, LPARAM lParam) static INT_PTR Ignore(WPARAM wParam, LPARAM lParam) { - DWORD mask = GetMask((HANDLE)wParam); + DWORD mask = GetMask((HCONTACT)wParam); if ((lParam < 1 || lParam > IGNOREEVENT_MAX) && lParam != IGNOREEVENT_ALL) return 1; if (lParam == IGNOREEVENT_ALL) mask = (1 << IGNOREEVENT_MAX)-1; else mask |= 1 << (lParam-1); - db_set_dw((HANDLE)wParam, "Ignore", "Mask1", mask); + db_set_dw((HCONTACT)wParam, "Ignore", "Mask1", mask); return 0; } static INT_PTR Unignore(WPARAM wParam, LPARAM lParam) { - DWORD mask = GetMask((HANDLE)wParam); + DWORD mask = GetMask((HCONTACT)wParam); if ((lParam < 1 || lParam > IGNOREEVENT_MAX) && lParam != IGNOREEVENT_ALL) return 1; @@ -367,7 +367,7 @@ static INT_PTR Unignore(WPARAM wParam, LPARAM lParam) mask = 0; else mask &= ~(1 << (lParam-1)); - db_set_dw((HANDLE)wParam, "Ignore", "Mask1", mask); + db_set_dw((HCONTACT)wParam, "Ignore", "Mask1", mask); return 0; } @@ -403,7 +403,7 @@ static int IgnoreAddedNotify(WPARAM, LPARAM lParam) { DBEVENTINFO *dbei = (DBEVENTINFO*)lParam; if (dbei && dbei->eventType == EVENTTYPE_ADDED && dbei->pBlob != NULL) { - HANDLE hContact = DbGetAuthEventContact(dbei); + HCONTACT hContact = DbGetAuthEventContact(dbei); if (CallService(MS_DB_CONTACT_IS, (WPARAM)hContact, 0) && IsIgnored((WPARAM)hContact, IGNOREEVENT_YOUWEREADDED)) return 1; } diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index ea474771a7..e3ef2977c5 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -199,7 +199,7 @@ void WriteDbAccounts() ///////////////////////////////////////////////////////////////////////////////////////// static int OnContactDeleted(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact) { PROTOACCOUNT* pa = Proto_GetAccount(hContact); if (Proto_IsAccountEnabled(pa) && pa->ppro) @@ -210,7 +210,7 @@ static int OnContactDeleted(WPARAM wParam, LPARAM lParam) static int OnDbSettingsChanged(WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact) { PROTOACCOUNT* pa = Proto_GetAccount(hContact); if (Proto_IsAccountEnabled(pa) && pa->ppro) @@ -317,7 +317,7 @@ static INT_PTR stub11(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam) static INT_PTR stub12(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam) { - return (INT_PTR)ppi->GetCaps(wParam, (HANDLE)lParam); + return (INT_PTR)ppi->GetCaps(wParam, (HCONTACT)lParam); } static INT_PTR stub13(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM) @@ -550,9 +550,9 @@ void DeactivateAccount(PROTOACCOUNT* pa, bool bIsDynamic, bool bErase) void EraseAccount(const char* pszModuleName) { // remove protocol contacts first - HANDLE hContact = db_find_first(); + HCONTACT hContact = db_find_first(); while (hContact != NULL) { - HANDLE h1 = hContact; + HCONTACT h1 = hContact; hContact = db_find_next(h1); char *szProto = GetContactProto(hContact); diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp index e14837c18f..cc55405227 100644 --- a/src/modules/protocols/protochains.cpp +++ b/src/modules/protocols/protochains.cpp @@ -56,7 +56,7 @@ static int GetProtocolP(MCONTACT hContact, char *szBuf, int cbLen) ///////////////////////////////////////////////////////////////////////////////////////// -INT_PTR CallContactService(HANDLE hContact, const char *szProtoService, WPARAM wParam, LPARAM lParam) +INT_PTR CallContactService(HCONTACT hContact, const char *szProtoService, WPARAM wParam, LPARAM lParam) { INT_PTR ret; CCSDATA ccs = { hContact, szProtoService, wParam, lParam }; @@ -161,7 +161,7 @@ static INT_PTR Proto_RecvChain(WPARAM wParam, LPARAM lParam) return ret; } -PROTOACCOUNT* __fastcall Proto_GetAccount(HANDLE hContact) +PROTOACCOUNT* __fastcall Proto_GetAccount(HCONTACT hContact) { if (hContact == NULL) return NULL; @@ -175,13 +175,13 @@ PROTOACCOUNT* __fastcall Proto_GetAccount(HANDLE hContact) static INT_PTR Proto_GetContactBaseProto(WPARAM wParam, LPARAM) { - PROTOACCOUNT *pa = Proto_GetAccount((HANDLE)wParam); + PROTOACCOUNT *pa = Proto_GetAccount((HCONTACT)wParam); return (INT_PTR)(Proto_IsAccountEnabled(pa) ? pa->szModuleName : NULL); } static INT_PTR Proto_GetContactBaseAccount(WPARAM wParam, LPARAM) { - PROTOACCOUNT *pa = Proto_GetAccount((HANDLE)wParam); + PROTOACCOUNT *pa = Proto_GetAccount((HCONTACT)wParam); return (INT_PTR)(pa ? pa->szModuleName : NULL); } @@ -210,14 +210,14 @@ static INT_PTR Proto_AddToContact(WPARAM wParam, LPARAM lParam) if (pd == NULL) { PROTOACCOUNT *pa = Proto_GetAccount(szProto); if (pa) { - db_set_s((HANDLE)wParam, "Protocol", "p", szProto); + db_set_s((HCONTACT)wParam, "Protocol", "p", szProto); return 0; } return 1; } if (pd->type == PROTOTYPE_PROTOCOL || pd->type == PROTOTYPE_VIRTUAL) - db_set_s((HANDLE)wParam, "Protocol", "p", szProto); + db_set_s((HCONTACT)wParam, "Protocol", "p", szProto); return 0; } @@ -228,7 +228,7 @@ static INT_PTR Proto_RemoveFromContact(WPARAM wParam, LPARAM lParam) case 0: return 1; case -1: - db_unset((HANDLE)wParam, "Protocol", "p"); + db_unset((HCONTACT)wParam, "Protocol", "p"); } return 0; diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 8ef8aadb2d..f2a30976e7 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -203,7 +203,7 @@ static INT_PTR Proto_AuthRecv(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // User Typing Notification services -static int Proto_ValidTypingContact(HANDLE hContact, char *szProto) +static int Proto_ValidTypingContact(HCONTACT hContact, char *szProto) { if (!hContact || !szProto) return 0; @@ -214,11 +214,11 @@ static int Proto_ValidTypingContact(HANDLE hContact, char *szProto) static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam) { if (lParam == PROTOTYPE_SELFTYPING_OFF || lParam == PROTOTYPE_SELFTYPING_ON) { - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (!szProto) return 0; - if (Proto_ValidTypingContact((HANDLE)wParam, szProto)) + if (Proto_ValidTypingContact((HCONTACT)wParam, szProto)) CallProtoServiceInt(NULL,szProto, PSS_USERISTYPING, wParam, lParam); } @@ -228,7 +228,7 @@ static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam) static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam) { int type = (int)lParam; - char *szProto = GetContactProto((HANDLE)wParam); + char *szProto = GetContactProto((HCONTACT)wParam); if (!szProto) return 0; @@ -238,7 +238,7 @@ static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam) if (type < PROTOTYPE_CONTACTTYPING_OFF) return 0; - if (Proto_ValidTypingContact((HANDLE)wParam, szProto)) + if (Proto_ValidTypingContact((HCONTACT)wParam, szProto)) NotifyEventHooks(hTypeEvent, wParam, lParam); return 0; @@ -246,25 +246,21 @@ static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam) void Proto_SetStatus(const char *szProto, unsigned status) { - if (CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) - { - TCHAR* awayMsg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGW, (WPARAM) status, (LPARAM) szProto); - if ((INT_PTR)awayMsg == CALLSERVICE_NOTFOUND) - { - char* awayMsgA = (char*)CallService(MS_AWAYMSG_GETSTATUSMSG, (WPARAM) status, (LPARAM) szProto); - if ((INT_PTR)awayMsgA != CALLSERVICE_NOTFOUND) - { + if (CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) { + TCHAR* awayMsg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGW, (WPARAM)status, (LPARAM)szProto); + if ((INT_PTR)awayMsg == CALLSERVICE_NOTFOUND) { + char* awayMsgA = (char*)CallService(MS_AWAYMSG_GETSTATUSMSG, (WPARAM)status, (LPARAM)szProto); + if ((INT_PTR)awayMsgA != CALLSERVICE_NOTFOUND) { awayMsg = mir_a2t(awayMsgA); mir_free(awayMsgA); } } - if ((INT_PTR)awayMsg != CALLSERVICE_NOTFOUND) - { - CallProtoServiceInt(NULL,szProto, PS_SETAWAYMSGT, status, (LPARAM) awayMsg); + if ((INT_PTR)awayMsg != CALLSERVICE_NOTFOUND) { + CallProtoServiceInt(NULL, szProto, PS_SETAWAYMSGT, status, (LPARAM)awayMsg); mir_free(awayMsg); } } - CallProtoServiceInt(NULL,szProto, PS_SETSTATUS, status, 0); + CallProtoServiceInt(NULL, szProto, PS_SETSTATUS, status, 0); } char** __fastcall Proto_FilesMatrixA(wchar_t **files) @@ -376,7 +372,7 @@ INT_PTR CallProtoService(const char* szModule, const char* szService, WPARAM wPa return CallProtoServiceInt(NULL, szModule, szService, wParam, lParam); } -INT_PTR CallProtoServiceInt(HANDLE hContact, const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam) +INT_PTR CallProtoServiceInt(HCONTACT hContact, const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam) { PROTOACCOUNT* pa = Proto_GetAccount(szModule); if (pa && !pa->bOldProto) { @@ -446,7 +442,7 @@ INT_PTR CallProtoServiceInt(HANDLE hContact, const char *szModule, const char *s else return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&pfr->szFilename); } - case 12: return (INT_PTR)ppi->GetCaps(wParam, (HANDLE)lParam); + case 12: return (INT_PTR)ppi->GetCaps(wParam, (HCONTACT)lParam); case 13: return (INT_PTR)Proto_GetIcon(ppi, wParam); case 14: return (INT_PTR)ppi->GetInfo(hContact, wParam); case 15: @@ -473,7 +469,7 @@ INT_PTR CallProtoServiceInt(HANDLE hContact, const char *szModule, const char *s case 21: return (INT_PTR)ppi->RecvFile(hContact, (PROTOFILEEVENT*)lParam); case 22: return (INT_PTR)ppi->RecvMsg(hContact, (PROTORECVEVENT*)lParam); case 23: return (INT_PTR)ppi->RecvUrl(hContact, (PROTORECVEVENT*)lParam); - case 24: return (INT_PTR)ppi->SendContacts(hContact, LOWORD(wParam), HIWORD(wParam), (HANDLE*)lParam); + case 24: return (INT_PTR)ppi->SendContacts(hContact, LOWORD(wParam), HIWORD(wParam), (HCONTACT*)lParam); case 25: if (ppi->m_iVersion > 1) { TCHAR** files = Proto_FilesMatrixU((char**)lParam); @@ -494,7 +490,7 @@ INT_PTR CallProtoServiceInt(HANDLE hContact, const char *szModule, const char *s return (INT_PTR)ppi->SetAwayMsg(wParam, StrConvT((char*)lParam)); else return (INT_PTR)ppi->SetAwayMsg(wParam, (TCHAR*)lParam); - case 34: return (INT_PTR)ppi->UserIsTyping((HANDLE)wParam, lParam); + case 34: return (INT_PTR)ppi->UserIsTyping((HCONTACT)wParam, lParam); case 35: lstrcpynA((char*)lParam, ppi->m_szModuleName, wParam); return 0; case 36: return ppi->m_iStatus; diff --git a/src/modules/protocols/protoint.cpp b/src/modules/protocols/protoint.cpp index ba6e40f01e..41b4a7991a 100644 --- a/src/modules/protocols/protoint.cpp +++ b/src/modules/protocols/protoint.cpp @@ -57,23 +57,23 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return (HANDLE)ProtoCallService(m_szModuleName, PS_ADDTOLISTBYEVENT, MAKELONG(flags, iContact), (LPARAM)hDbEvent); } - int __cdecl Authorize(HANDLE hContact) + int __cdecl Authorize(HANDLE hDbEvent) { - return (int)ProtoCallService(m_szModuleName, PS_AUTHALLOW, (WPARAM)hContact, 0); + return (int)ProtoCallService(m_szModuleName, PS_AUTHALLOW, (WPARAM)hDbEvent, 0); } - int __cdecl AuthDeny(HANDLE hContact, const TCHAR* szReason) + int __cdecl AuthDeny(HANDLE hDbEvent, const TCHAR* szReason) { - return (int)ProtoCallService(m_szModuleName, PS_AUTHDENY, (WPARAM)hContact, (LPARAM)StrConvA(szReason)); + return (int)ProtoCallService(m_szModuleName, PS_AUTHDENY, (WPARAM)hDbEvent, (LPARAM)StrConvA(szReason)); } - int __cdecl AuthRecv(HANDLE hContact, PROTORECVEVENT* evt) + int __cdecl AuthRecv(HCONTACT hContact, PROTORECVEVENT* evt) { CCSDATA ccs = { hContact, PSR_AUTH, 0, (LPARAM)evt }; return (int)ProtoCallService(m_szModuleName, PSR_AUTH, 0, (LPARAM)&ccs); } - int __cdecl AuthRequest(HANDLE hContact, const TCHAR* szMessage) + int __cdecl AuthRequest(HCONTACT hContact, const TCHAR* szMessage) { CCSDATA ccs = { hContact, PSS_AUTHREQUEST, 0, (LPARAM)szMessage }; ccs.lParam = (LPARAM)mir_t2a(szMessage); @@ -87,7 +87,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return (HANDLE)ProtoCallService(m_szModuleName, PS_CHANGEINFO, iInfoType, (LPARAM)pInfoData); } - HANDLE __cdecl FileAllow(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath) + HANDLE __cdecl FileAllow(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath) { CCSDATA ccs = { hContact, PSS_FILEALLOW, (WPARAM)hTransfer, (LPARAM)szPath }; @@ -97,13 +97,13 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return res; } - int __cdecl FileCancel(HANDLE hContact, HANDLE hTransfer) + int __cdecl FileCancel(HCONTACT hContact, HANDLE hTransfer) { CCSDATA ccs = { hContact, PSS_FILECANCEL, (WPARAM)hTransfer, 0 }; return (int)ProtoCallService(m_szModuleName, PSS_FILECANCEL, 0, (LPARAM)&ccs); } - int __cdecl FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason) + int __cdecl FileDeny(HCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason) { CCSDATA ccs = { hContact, PSS_FILEDENY, (WPARAM)hTransfer, (LPARAM)szReason }; @@ -125,7 +125,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return res; } - DWORD_PTR __cdecl GetCaps(int type, HANDLE hContact) + DWORD_PTR __cdecl GetCaps(int type, HCONTACT hContact) { return (DWORD_PTR)ProtoCallService(m_szModuleName, PS_GETCAPS, type, (LPARAM)hContact); } @@ -135,7 +135,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return (HICON)ProtoCallService(m_szModuleName, PS_LOADICON, iconIndex, 0); } - int __cdecl GetInfo(HANDLE hContact, int flags) + int __cdecl GetInfo(HCONTACT hContact, int flags) { CCSDATA ccs = { hContact, PSS_GETINFO, flags, 0 }; return ProtoCallService(m_szModuleName, PSS_GETINFO, 0, (LPARAM)&ccs); @@ -176,37 +176,37 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return (HWND)ProtoCallService(m_szModuleName, PS_CREATEADVSEARCHUI, 0, (LPARAM)owner); } - int __cdecl RecvContacts(HANDLE hContact, PROTORECVEVENT* evt) + int __cdecl RecvContacts(HCONTACT hContact, PROTORECVEVENT* evt) { CCSDATA ccs = { hContact, PSR_CONTACTS, 0, (LPARAM)evt }; return (int)ProtoCallService(m_szModuleName, PSR_CONTACTS, 0, (LPARAM)&ccs); } - int __cdecl RecvFile(HANDLE hContact, PROTOFILEEVENT* evt) + int __cdecl RecvFile(HCONTACT hContact, PROTOFILEEVENT* evt) { CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)evt }; return ProtoCallService(m_szModuleName, PSR_FILE, 0, (LPARAM)&ccs); } - int __cdecl RecvMsg(HANDLE hContact, PROTORECVEVENT* evt) + int __cdecl RecvMsg(HCONTACT hContact, PROTORECVEVENT* evt) { CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)evt }; return (int)ProtoCallService(m_szModuleName, PSR_MESSAGE, 0, (LPARAM)&ccs); } - int __cdecl RecvUrl(HANDLE hContact, PROTORECVEVENT* evt) + int __cdecl RecvUrl(HCONTACT hContact, PROTORECVEVENT* evt) { CCSDATA ccs = { hContact, PSR_URL, 0, (LPARAM)evt }; return (int)ProtoCallService(m_szModuleName, PSR_URL, 0, (LPARAM)&ccs); } - int __cdecl SendContacts(HANDLE hContact, int flags, int nContacts, HANDLE* hContactsList) + int __cdecl SendContacts(HCONTACT hContact, int flags, int nContacts, HCONTACT *hContactsList) { CCSDATA ccs = { hContact, PSS_CONTACTS, MAKEWPARAM(flags, nContacts), (LPARAM)hContactsList }; return (int)ProtoCallService(m_szModuleName, PSS_CONTACTS, 0, (LPARAM)&ccs); } - HANDLE __cdecl SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) + HANDLE __cdecl SendFile(HCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles) { CCSDATA ccs = { hContact, PSS_FILE, (WPARAM)szDescription, (LPARAM)ppszFiles }; @@ -218,19 +218,19 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return res; } - int __cdecl SendMsg(HANDLE hContact, int flags, const char* msg) + int __cdecl SendMsg(HCONTACT hContact, int flags, const char* msg) { CCSDATA ccs = { hContact, PSS_MESSAGE, flags, (LPARAM)msg }; return (int)ProtoCallService(m_szModuleName, PSS_MESSAGE, 0, (LPARAM)&ccs); } - int __cdecl SendUrl(HANDLE hContact, int flags, const char* url) + int __cdecl SendUrl(HCONTACT hContact, int flags, const char* url) { CCSDATA ccs = { hContact, PSS_URL, flags, (LPARAM)url }; return (int)ProtoCallService(m_szModuleName, PSS_URL, 0, (LPARAM)&ccs); } - int __cdecl SetApparentMode(HANDLE hContact, int mode) + int __cdecl SetApparentMode(HCONTACT hContact, int mode) { CCSDATA ccs = { hContact, PSS_SETAPPARENTMODE, mode, 0 }; return (int)ProtoCallService(m_szModuleName, PSS_SETAPPARENTMODE, 0, (LPARAM)&ccs); @@ -241,13 +241,13 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return (int)ProtoCallService(m_szModuleName, PS_SETSTATUS, iNewStatus, 0); } - HANDLE __cdecl GetAwayMsg(HANDLE hContact) + HANDLE __cdecl GetAwayMsg(HCONTACT hContact) { CCSDATA ccs = { hContact, PSS_GETAWAYMSG, 0, 0 }; return (HANDLE)ProtoCallService(m_szModuleName, PSS_GETAWAYMSG, 0, (LPARAM)&ccs); } - int __cdecl RecvAwayMsg(HANDLE hContact, int statusMode, PROTORECVEVENT* evt) + int __cdecl RecvAwayMsg(HCONTACT hContact, int statusMode, PROTORECVEVENT* evt) { CCSDATA ccs = { hContact, PSR_AWAYMSG, statusMode, (LPARAM)evt }; return (int)ProtoCallService(m_szModuleName, PSR_AWAYMSG, 0, (LPARAM)&ccs); @@ -258,7 +258,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE return (int)ProtoCallService(m_szModuleName, PS_SETAWAYMSG, iStatus, (LPARAM)StrConvA(msg)); } - int __cdecl UserIsTyping(HANDLE hContact, int type) + int __cdecl UserIsTyping(HCONTACT hContact, int type) { CCSDATA ccs = { hContact, PSS_USERISTYPING, (WPARAM)hContact, type }; return ProtoCallService(m_szModuleName, PSS_USERISTYPING, 0, (LPARAM)&ccs); diff --git a/src/modules/srmm/statusicon.cpp b/src/modules/srmm/statusicon.cpp index 2b88911990..d74d5eac0b 100644 --- a/src/modules/srmm/statusicon.cpp +++ b/src/modules/srmm/statusicon.cpp @@ -32,7 +32,7 @@ struct StatusIconChild : public MZeroedObject mir_free(tszTooltip); } - HANDLE hContact; + HCONTACT hContact; HICON hIcon, hIconDisabled; int flags; TCHAR *tszTooltip; @@ -88,7 +88,7 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) if (p == NULL) return 1; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; if (hContact == NULL) { mir_free(p->sid.szModule); mir_free(p->sid.szTooltip); diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index b60d5c68ac..0f47fdb23a 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -68,7 +68,7 @@ static INT_PTR createDirTreeW(WPARAM, LPARAM lParam) return CreateDirectoryTreeW((WCHAR*)lParam); } -TCHAR *GetContactID(HANDLE hContact) +TCHAR *GetContactID(HCONTACT hContact) { TCHAR *theValue = {0}; char *szProto = GetContactProto(hContact); @@ -114,12 +114,12 @@ static __forceinline char *_xstrselect(char *, char *s1, TCHAR *s2) { return s1; static __forceinline char *_itox(char *, int a) { return itoa(a, (char *)mir_alloc(sizeof(char)*20), 10); } static __forceinline char *mir_a2x(char *, char *s) { return mir_strdup(s); } -static __forceinline char *GetContactNickX(char *, HANDLE hContact) +static __forceinline char *GetContactNickX(char *, HCONTACT hContact) { return mir_strdup((char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0)); } -static __forceinline char *GetContactIDX(char *, HANDLE hContact) +static __forceinline char *GetContactIDX(char *, HCONTACT hContact) { TCHAR *id = GetContactID(hContact); char* res = mir_t2a(id); @@ -201,12 +201,12 @@ static __forceinline TCHAR *_xstrselect(TCHAR *, char *s1, TCHAR *s2) { return s static __forceinline TCHAR *_itox(TCHAR *, int a) { return _itot(a, (TCHAR *)mir_alloc(sizeof(TCHAR)*20), 10); } static __forceinline TCHAR *mir_a2x(TCHAR *, char *s) { return mir_a2t(s); } -static __forceinline TCHAR *GetContactNickX(TCHAR *, HANDLE hContact) +static __forceinline TCHAR *GetContactNickX(TCHAR *, HCONTACT hContact) { return mir_tstrdup((TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)); } -static __forceinline TCHAR *GetContactIDX(TCHAR *, HANDLE hContact) +static __forceinline TCHAR *GetContactIDX(TCHAR *, HCONTACT hContact) { return GetContactID(hContact); } @@ -277,7 +277,7 @@ static __forceinline TCHAR *GetPathVarX(TCHAR *, int code) } template -XCHAR *GetInternalVariable(XCHAR *key, size_t keyLength, HANDLE hContact) +XCHAR *GetInternalVariable(XCHAR *key, size_t keyLength, HCONTACT hContact) { XCHAR *theValue = NULL; XCHAR *theKey = (XCHAR *)_alloca(sizeof(XCHAR) * (keyLength + 1)); @@ -323,7 +323,7 @@ XCHAR *GetInternalVariable(XCHAR *key, size_t keyLength, HANDLE hContact) } template -XCHAR *GetVariableFromArray(REPLACEVARSARRAY *vars, XCHAR *key, size_t keyLength, HANDLE hContact, bool *bFree) +XCHAR *GetVariableFromArray(REPLACEVARSARRAY *vars, XCHAR *key, size_t keyLength, HCONTACT hContact, bool *bFree) { *bFree = false; for (REPLACEVARSARRAY *var = vars; var && var->lptzKey; ++var) diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp index 174d9ea1fc..ec3442c471 100644 --- a/src/modules/utils/timezones.cpp +++ b/src/modules/utils/timezones.cpp @@ -168,7 +168,7 @@ static HANDLE timeapiGetInfoByName(LPCTSTR tszName, DWORD dwFlags) return tz; } -static HANDLE timeapiGetInfoByContact(HANDLE hContact, DWORD dwFlags) +static HANDLE timeapiGetInfoByContact(HCONTACT hContact, DWORD dwFlags) { if (hContact == NULL) return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? NULL : &myInfo.myTZ; @@ -227,7 +227,7 @@ static HANDLE timeapiGetInfoByContact(HANDLE hContact, DWORD dwFlags) return (dwFlags & (TZF_DIFONLY | TZF_KNOWNONLY)) ? NULL : &myInfo.myTZ; } -static void timeapiSetInfoByContact(HANDLE hContact, HANDLE hTZ) +static void timeapiSetInfoByContact(HCONTACT hContact, HANDLE hTZ) { MIM_TIMEZONE *tz = (MIM_TIMEZONE*)hTZ; @@ -354,7 +354,7 @@ static const ListMessages *GetListMessages(HWND hWnd, DWORD dwFlags) } -static int timeapiSelectListItem(HANDLE hContact, HWND hWnd, DWORD dwFlags) +static int timeapiSelectListItem(HCONTACT hContact, HWND hWnd, DWORD dwFlags) { if (hWnd == NULL) // nothing to do return -1; @@ -386,7 +386,7 @@ static int timeapiSelectListItem(HANDLE hContact, HWND hWnd, DWORD dwFlags) } -static int timeapiPrepareList(HANDLE hContact, HWND hWnd, DWORD dwFlags) +static int timeapiPrepareList(HCONTACT hContact, HWND hWnd, DWORD dwFlags) { if (hWnd == NULL) // nothing to do return 0; @@ -408,7 +408,7 @@ static int timeapiPrepareList(HANDLE hContact, HWND hWnd, DWORD dwFlags) } -static void timeapiStoreListResult(HANDLE hContact, HWND hWnd, DWORD dwFlags) +static void timeapiStoreListResult(HCONTACT hContact, HWND hWnd, DWORD dwFlags) { const ListMessages *lstMsg = GetListMessages(hWnd, dwFlags); if (lstMsg == NULL) return; diff --git a/src/modules/utils/windowlist.cpp b/src/modules/utils/windowlist.cpp index 29569ff93e..1337795f2d 100644 --- a/src/modules/utils/windowlist.cpp +++ b/src/modules/utils/windowlist.cpp @@ -26,12 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct TWindowListItem { - TWindowListItem(HANDLE _contact, HWND _wnd) : + TWindowListItem(HCONTACT _contact, HWND _wnd) : hContact(_contact), hWnd(_wnd) {} - HANDLE hContact; + HCONTACT hContact; HWND hWnd; }; diff --git a/src/modules/visibility/visibility.cpp b/src/modules/visibility/visibility.cpp index cdc7647534..449467c3e9 100644 --- a/src/modules/visibility/visibility.cpp +++ b/src/modules/visibility/visibility.cpp @@ -107,7 +107,7 @@ static void ResetListOptions(HWND hwndList) static void SetAllContactIcons(HWND hwndList) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem == NULL) continue; @@ -244,7 +244,7 @@ static INT_PTR CALLBACK DlgProcVisibilityOpts(HWND hwndDlg, UINT msg, WPARAM, LP case 0: if (((LPNMHDR)lParam)->code == PSN_APPLY) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem == NULL) continue; -- cgit v1.2.3