From 68d6271552d4b9bdb27efda50c457f0d56b23457 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 14 Nov 2018 18:24:56 +0300 Subject: other minor code cleaning considering g_plugin --- plugins/AuthState/src/main.cpp | 46 +-- plugins/Clist_modern/src/modern_defsettings.h | 374 +++++++++++----------- plugins/ConnectionNotify/src/ConnectionNotify.cpp | 69 ++-- plugins/ConnectionNotify/src/stdafx.h | 7 +- plugins/CyrTranslit/src/MirandaContact.cpp | 6 +- plugins/CyrTranslit/src/MirandaContact.h | 1 - plugins/GmailNotifier/src/notify.cpp | 8 +- plugins/GmailNotifier/src/options.cpp | 8 +- plugins/MirFox/src/MirfoxData.cpp | 6 +- plugins/Toaster/src/options.cpp | 2 +- plugins/WebView/src/webview_services.cpp | 2 +- plugins/XSoundNotify/src/options.cpp | 4 +- protocols/ICQCorp/src/options.cpp | 14 +- protocols/ICQCorp/src/protocol.cpp | 28 +- protocols/ICQCorp/src/user.cpp | 26 +- 15 files changed, 300 insertions(+), 301 deletions(-) diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index 29d8456739..ffc7e229f5 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -1,21 +1,21 @@ /* - Authorization State plugin for Miranda NG (www.miranda-ng.org) - (c) 2006-2010 by Thief + Authorization State plugin for Miranda NG (www.miranda-ng.org) + (c) 2006-2010 by Thief - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include "stdafx.h" @@ -57,7 +57,8 @@ PLUGININFOEX pluginInfoEx = { CMPlugin::CMPlugin() : PLUGIN(MODULENAME, pluginInfoEx) -{} +{ +} ///////////////////////////////////////////////////////////////////////////////////////// @@ -65,7 +66,8 @@ INT_PTR getIconToUse(MCONTACT hContact, LPARAM) { const char *proto = GetContactProto(hContact); // if (lParam == 1) return icon_none; - if (!db_get_b(hContact, "AuthState", "ShowIcons", !Options.bIconsForRecentContacts)) return ICON_NONE; + if (!g_plugin.getByte(hContact, "ShowIcons", !Options.bIconsForRecentContacts)) + return ICON_NONE; if (db_get_b(0, "ICQ", "UseServerCList", 0)) if (db_get_dw(hContact, proto, "ServerId", 1) == 0) @@ -102,7 +104,8 @@ int onContactSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; const char *proto = GetContactProto((MCONTACT)hContact); - if (!proto) return 0; + if (!proto) + return 0; if (!strcmp(cws->szModule, proto)) if (!strcmp(cws->szSetting, "Auth") || !strcmp(cws->szSetting, "Grant") || !strcmp(cws->szSetting, "ServerId") || !strcmp(cws->szSetting, "ContactType")) @@ -113,22 +116,21 @@ int onContactSettingChanged(WPARAM hContact, LPARAM lParam) int onDBContactAdded(WPARAM hContact, LPARAM) { - db_set_b((MCONTACT)hContact, MODULENAME, "ShowIcons", 1); + g_plugin.setByte(hContact, "ShowIcons", 1); onExtraImageApplying(hContact, 0); return 0; } INT_PTR onAuthMenuSelected(WPARAM hContact, LPARAM) { - db_set_b((MCONTACT)hContact, MODULENAME, "ShowIcons", 1 - db_get_b((MCONTACT)hContact, "AuthState", "ShowIcons", 1)); + g_plugin.setByte(hContact, "ShowIcons", 1 - g_plugin.getByte(hContact, "ShowIcons", 1)); onExtraImageApplying(hContact, 0); return 0; } int onPrebuildContactMenu(WPARAM hContact, LPARAM) { - if (!Options.bContactMenuItem) - { + if (!Options.bContactMenuItem) { Menu_ShowItem(hUserMenu, false); return 0; } @@ -137,7 +139,7 @@ int onPrebuildContactMenu(WPARAM hContact, LPARAM) if (!proto) return 0; - if (db_get_b((MCONTACT)hContact, "AuthState", "ShowIcons", 1)) + if (g_plugin.getByte(hContact, "ShowIcons", 1)) Menu_ModifyItem(hUserMenu, LPGENW("Disable AuthState icons")); else Menu_ModifyItem(hUserMenu, LPGENW("Enable AuthState icons")); diff --git a/plugins/Clist_modern/src/modern_defsettings.h b/plugins/Clist_modern/src/modern_defsettings.h index 381486b1b6..d22c3fa6d8 100644 --- a/plugins/Clist_modern/src/modern_defsettings.h +++ b/plugins/Clist_modern/src/modern_defsettings.h @@ -30,200 +30,200 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma once -#define SETTING_TOOLWINDOW_DEFAULT 1 // "CList","ToolWindow" -#define SETTING_ONTOP_DEFAULT 1 // "CList","OnTop" -#define SETTING_MIN2TRAY_DEFAULT 1 // "CList","Min2Tray" -#define SETTING_HIDEOFFLINE_DEFAULT 0 // "CList", "HideOffline" -#define SETTING_HIDEEMPTYGROUPS_DEFAULT 0 // "CList","HideEmptyGroups" -#define SETTING_USEGROUPS_DEFAULT 1 // "CList","UseGroups" -#define SETTING_PLACEOFFLINETOROOT_DEFAULT 0 // "CList","PlaceOfflineToRoot" -#define SETTING_DISABLETRAYFLASH_DEFAULT 0 // "CList","DisableTrayFlash" -#define SETTING_ICONFLASHTIME_DEFAULT 550 // "CList","IconFlashTime" -#define SETTING_THINBORDER_DEFAULT 0 // "CList","ThinBorder" -#define SETTING_NOBORDER_DEFAULT 0 // "CList","NoBorder" -#define SETTING_WINDOWSHADOW_DEFAULT 0 // "CList","WindowShadow" -#define SETTING_ONDESKTOP_DEFAULT 0 // "CList","OnDesktop" -#define SETTING_DISABLEWORKINGSET_DEFAULT 1 // "CList","DisableWorkingSet" -#define SETTING_NOICONBLINF_DEFAULT 0 // "CList","NoIconBlink" -#define SETTING_ALWAYSVISICON_DEFAULT 0 // "CList","AlwaysShowAlwaysVisIcon" - -#define SETTING_SHOWMAINMENU_DEFAULT 1 // "CLUI","ShowMainMenu" -#define SETTING_SHOWCAPTION_DEFAULT 1 // "CLUI","ShowCaption" -#define SETTING_CLIENTDRAG_DEFAULT 1 // "CLUI","ClientAreaDrag" -#define SETTING_SHOWSBAR_DEFAULT 1 // "CLUI","ShowSBar" -#define SETTING_SBARPERPROTO_DEFAULT 0 // "CLUI","SBarPerProto" -#define SETTING_USECONNECTINGICON_DEFAULT 1 // "CLUI","UseConnectingIcon" -#define SETTING_SHOWXSTATUS_DEFAULT 6 // "CLUI","ShowXStatus" -#define SETTING_SHOWUNREADEMAILS_DEFAULT 1 // "CLUI","ShowUnreadEmails" -#define SETTING_SBARSHOW_DEFAULT 3 // "CLUI","SBarShow" -#define SETTING_SBARACCOUNTISCUSTOM_DEFAULT 0 // "CLUI","AccountIsCustom" -#define SETTING_SBARHIDEACCOUNT_DEFAULT 0 // "CLUI","HideAccount" -#define SETTING_SBARRIGHTCLK_DEFAULT 0 // "CLUI","SBarRightClk" -#define SETTING_EQUALSECTIONS_DEFAULT 0 // "CLUI","EqualSections" -#define SETTING_LEFTOFFSET_DEFAULT 0 // "CLUI","LeftOffset" -#define SETTING_RIGHTOFFSET_DEFAULT 0 // "CLUI","RightOffset -#define SETTING_TOPOFFSET_DEFAULT 0 // "CLUI","TopOffset" -#define SETTING_BOTTOMOFFSET_DEFAULT 0 // "CLUI","BottomOffset -#define SETTING_SPACEBETWEEN_DEFAULT 0 // "CLUI","SpaceBetween" -#define SETTING_ALIGN_DEFAULT 0 // "CLUI","Align" -#define SETTING_VALIGN_DEFAULT 1 // "CLUI","VAlign" -#define SETTING_PADDINGLEFT_DEFAULT 0 // "CLUI","PaddingLeft_*" -#define SETTING_PADDINGRIGHT_DEFAULT 0 // "CLUI","PaddingRight_*" -#define SETTING_DRAGTOSCROLL_DEFAULT 0 // "CLUI","DragToScroll" -#define SETTING_AUTOSIZE_DEFAULT 0 // "CLUI","AutoSize" -#define SETTING_LOCKSIZE_DEFAULT 0 // "CLUI","LockSize" -#define SETTING_MINHEIGTH_DEFAULT 0 // "CLUI","MinHeight" -#define SETTING_MINWIDTH_DEFAULT 18 // "CLUI","MinWidth" -#define SETTING_MAXSIZEHEIGHT_DEFAULT 75 // "CLUI","MaxSizeHeight" -#define SETTING_MINSIZEHEIGHT_DEFAULT 10 // "CLUI","MinSizeHeight" -#define SETTING_AUTOSIZEUPWARD_DEFAULT 0 // "CLUI","AutoSizeUpward" -#define SETTING_SNAPTOEDGES_DEFAULT 1 // "CLUI","SnapToEdges" -#define SETTING_DOCKTOSIDES_DEFAULT 1 // "CLUI","DockToSides", - -#define SETTING_PROTOSPERLINE_DEFAULT 0 // "CLUI","StatusBarProtosPerLine" -#define SETTING_TEXTEFFECTID_DEFAULT 0xFF // "StatusBar","TextEffectID" -#define SETTING_TEXTEFFECTCOLOR1_DEFAULT 0 // "StatusBar","TextEffectColor1" -#define SETTING_TEXTEFFECTCOLOR2_DEFAULT 0 // "StatusBar","TextEffectColor2" -#define SETTING_SBHILIGHTMODE_DEFAULT 0 // "StatusBar","HiLightMode" -#define SETTING_HIDETOOLTIPTIME_DEFAULT 5000 // "CLUIFrames","HideToolTipTime" - -#define SETTING_EXTRACOLUMNSPACE_DEFAULT 18 // "CLUI","ExtraColumnSpace" - -#define SETTING_HIDEBEHIND_DEFAULT 0 // "ModernData","HideBehind" //(0-none, 1-leftedge, 2-rightedge) -#define SETTING_BEHINDEDGE_DEFAULT 0 // "ModernData", "BehindEdge" -#define SETTING_SHOWDELAY_DEFAULT 3 // "ModernData","ShowDelay" -#define SETTING_HIDEDELAY_DEFAULT 3 // "ModernData","HideDelay" -#define SETTING_HIDEBEHINDBORDERSIZE_DEFAULT 0 // "ModernData","HideBehindBorderSize" -#define SETTING_AEROGLASS_DEFAULT 0 // "ModernData","AeroGlass" - -#define SETTING_ROUNDCORNERS_DEFAULT 0 // "CLC","RoundCorners" -#define SETTING_GAPFRAMES_DEFAULT 1 // "CLUIFrames","GapBetweenFrames" -#define SETTING_GAPTITLEBAR_DEFAULT 1 // "CLUIFrames","GapBetweenTitleBar" -#define SETTING_LEFTCLIENTMARIGN_DEFAULT 0 // "CLUI","LeftClientMargin" -#define SETTING_RIGHTCLIENTMARIGN_DEFAULT 0 // "CLUI","RightClientMargin" -#define SETTING_TOPCLIENTMARIGN_DEFAULT 0 // "CLUI","TopClientMargin" -#define SETTING_BOTTOMCLIENTMARIGN_DEFAULT 0 // "CLUI","BottomClientMargin" -#define SETTING_KEYCOLOR_DEFAULT RGB(255,0,255) // "ModernSettings","KeyColor" -#define SETTING_LINEUNDERMENU_DEFAULT 0 // "CLUI","LineUnderMenu" -#define SETTING_SHOWONSTART_DEFAULT 0 // "CList","ShowOnStart" - -#define SETTING_INTERNALAWAYMSGREQUEST_DEFAULT 1 // "ModernData","InternalAwayMsgDiscovery" -#define SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT 1 // "ModernData","RemoveAwayMessageForOffline" -#define SETTING_FILTERSEARCH_DEFAULT 0 // "ModernData","FilterSearch" -#define SETTING_METAAVOIDDBLCLICK_DEFAULT 1 // "CLC","MetaDoubleClick" -#define SETTING_METAIGNOREEMPTYEXTRA_DEFAULT 1 // "CLC","MetaIgnoreEmptyExtra" -#define SETTING_METAHIDEEXTRA_DEFAULT 0 // "CLC","MetaHideExtra" -#define SETTING_METAEXPANDING_DEFAULT 1 // "CLC","MetaExpanding" -#define SETTING_USEMETAICON_DEFAULT 1 // "CLC","Meta" -#define SETTING_DRAWOVERLAYEDSTATUS_DEFAULT 3 // todo replace by contstants - - -#define SETTING_SORTBY1_DEFAULT SORTBY_RATE // "CList","SortBy1" -#define SETTING_SORTBY2_DEFAULT SORTBY_NAME_LOCALE // "CList","SortBy2" -#define SETTING_SORTBY3_DEFAULT SORTBY_PROTO // "CList","SortBy3" - -#define SETTING_NOOFFLINEBOTTOM_DEFAULT 0 // "CList","NoOfflineBottom" -#define SETTING_HIDEOFFLINEATROOT_DEFAULT 0 // "CLC","HideOfflineRoot" -#define SETTING_HILIGHTMODE_DEFAULT 1 // todo replace by constant //"CLC","HiLightMode" - -#define SETTING_DISABLESKIN_DEFAULT 0 // "ModernData","DisableEngine" -#define SETTING_ENABLELAYERING_DEFAULT 1 // "ModernData","EnableLayering" -#define SETTING_COMPACTMODE_DEFAULT 0 // "CLC","CompactMode" - -#define SETTING_EVENTAREAMODE_DEFAULT 1 // autohide todo replace by const //"CLUI","EventArea" -#define SETTING_SHOWEVENTAREAFRAME_DEFAULT 1 // "CLUI","ShowEventArea" - -#define SETTING_TRAYOPTION_DEFAULT 15 // show combined icon -#define SETTING_FADEIN_DEFAULT 0 // "CLUI","FadeInOut" +#define SETTING_TOOLWINDOW_DEFAULT 1 +#define SETTING_ONTOP_DEFAULT 1 +#define SETTING_MIN2TRAY_DEFAULT 1 +#define SETTING_HIDEOFFLINE_DEFAULT 0 +#define SETTING_HIDEEMPTYGROUPS_DEFAULT 0 +#define SETTING_USEGROUPS_DEFAULT 1 +#define SETTING_PLACEOFFLINETOROOT_DEFAULT 0 +#define SETTING_DISABLETRAYFLASH_DEFAULT 0 +#define SETTING_ICONFLASHTIME_DEFAULT 550 +#define SETTING_THINBORDER_DEFAULT 0 +#define SETTING_NOBORDER_DEFAULT 0 +#define SETTING_WINDOWSHADOW_DEFAULT 0 +#define SETTING_ONDESKTOP_DEFAULT 0 +#define SETTING_DISABLEWORKINGSET_DEFAULT 1 +#define SETTING_NOICONBLINF_DEFAULT 0 +#define SETTING_ALWAYSVISICON_DEFAULT 0 + +#define SETTING_SHOWMAINMENU_DEFAULT 1 +#define SETTING_SHOWCAPTION_DEFAULT 1 +#define SETTING_CLIENTDRAG_DEFAULT 1 +#define SETTING_SHOWSBAR_DEFAULT 1 +#define SETTING_SBARPERPROTO_DEFAULT 0 +#define SETTING_USECONNECTINGICON_DEFAULT 1 +#define SETTING_SHOWXSTATUS_DEFAULT 6 +#define SETTING_SHOWUNREADEMAILS_DEFAULT 1 +#define SETTING_SBARSHOW_DEFAULT 3 +#define SETTING_SBARACCOUNTISCUSTOM_DEFAULT 0 +#define SETTING_SBARHIDEACCOUNT_DEFAULT 0 +#define SETTING_SBARRIGHTCLK_DEFAULT 0 +#define SETTING_EQUALSECTIONS_DEFAULT 0 +#define SETTING_LEFTOFFSET_DEFAULT 0 +#define SETTING_RIGHTOFFSET_DEFAULT 0 +#define SETTING_TOPOFFSET_DEFAULT 0 +#define SETTING_BOTTOMOFFSET_DEFAULT 0 +#define SETTING_SPACEBETWEEN_DEFAULT 0 +#define SETTING_ALIGN_DEFAULT 0 +#define SETTING_VALIGN_DEFAULT 1 +#define SETTING_PADDINGLEFT_DEFAULT 0 +#define SETTING_PADDINGRIGHT_DEFAULT 0 +#define SETTING_DRAGTOSCROLL_DEFAULT 0 +#define SETTING_AUTOSIZE_DEFAULT 0 +#define SETTING_LOCKSIZE_DEFAULT 0 +#define SETTING_MINHEIGTH_DEFAULT 0 +#define SETTING_MINWIDTH_DEFAULT 18 +#define SETTING_MAXSIZEHEIGHT_DEFAULT 75 +#define SETTING_MINSIZEHEIGHT_DEFAULT 10 +#define SETTING_AUTOSIZEUPWARD_DEFAULT 0 +#define SETTING_SNAPTOEDGES_DEFAULT 1 +#define SETTING_DOCKTOSIDES_DEFAULT 1 + +#define SETTING_PROTOSPERLINE_DEFAULT 0 +#define SETTING_TEXTEFFECTID_DEFAULT 0xFF +#define SETTING_TEXTEFFECTCOLOR1_DEFAULT 0 +#define SETTING_TEXTEFFECTCOLOR2_DEFAULT 0 +#define SETTING_SBHILIGHTMODE_DEFAULT 0 +#define SETTING_HIDETOOLTIPTIME_DEFAULT 5000 + +#define SETTING_EXTRACOLUMNSPACE_DEFAULT 18 + +#define SETTING_HIDEBEHIND_DEFAULT 0 +#define SETTING_BEHINDEDGE_DEFAULT 0 +#define SETTING_SHOWDELAY_DEFAULT 3 +#define SETTING_HIDEDELAY_DEFAULT 3 +#define SETTING_HIDEBEHINDBORDERSIZE_DEFAULT 0 +#define SETTING_AEROGLASS_DEFAULT 0 + +#define SETTING_ROUNDCORNERS_DEFAULT 0 +#define SETTING_GAPFRAMES_DEFAULT 1 +#define SETTING_GAPTITLEBAR_DEFAULT 1 +#define SETTING_LEFTCLIENTMARIGN_DEFAULT 0 +#define SETTING_RIGHTCLIENTMARIGN_DEFAULT 0 +#define SETTING_TOPCLIENTMARIGN_DEFAULT 0 +#define SETTING_BOTTOMCLIENTMARIGN_DEFAULT 0 +#define SETTING_KEYCOLOR_DEFAULT RGB(255,0,255) +#define SETTING_LINEUNDERMENU_DEFAULT 0 +#define SETTING_SHOWONSTART_DEFAULT 0 + +#define SETTING_INTERNALAWAYMSGREQUEST_DEFAULT 1 +#define SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT 1 +#define SETTING_FILTERSEARCH_DEFAULT 0 +#define SETTING_METAAVOIDDBLCLICK_DEFAULT 1 +#define SETTING_METAIGNOREEMPTYEXTRA_DEFAULT 1 +#define SETTING_METAHIDEEXTRA_DEFAULT 0 +#define SETTING_METAEXPANDING_DEFAULT 1 +#define SETTING_USEMETAICON_DEFAULT 1 +#define SETTING_DRAWOVERLAYEDSTATUS_DEFAULT 3 + + +#define SETTING_SORTBY1_DEFAULT SORTBY_RATE +#define SETTING_SORTBY2_DEFAULT SORTBY_NAME_LOCALE +#define SETTING_SORTBY3_DEFAULT SORTBY_PROTO + +#define SETTING_NOOFFLINEBOTTOM_DEFAULT 0 +#define SETTING_HIDEOFFLINEATROOT_DEFAULT 0 +#define SETTING_HILIGHTMODE_DEFAULT 1 + +#define SETTING_DISABLESKIN_DEFAULT 0 +#define SETTING_ENABLELAYERING_DEFAULT 1 +#define SETTING_COMPACTMODE_DEFAULT 0 + +#define SETTING_EVENTAREAMODE_DEFAULT 1 +#define SETTING_SHOWEVENTAREAFRAME_DEFAULT 1 + +#define SETTING_TRAYOPTION_DEFAULT 15 +#define SETTING_FADEIN_DEFAULT 0 ////////////////////////////////////////////////////////////////////////// // ROW SETTINGS -#define SETTING_ROWBORDER_DEFAULT 1 // "CList","RowBorder" -#define SETTING_ROW_ADVANCEDLAYOUT_DEFAULT 0 // "ModernData","UseAdvancedRowLayout" -#define SETTING_ROW_ROWBORDER_DEFAULT 1 // "CList","RowBorder" -#define SETTING_VARIABLEROWHEIGHT_DEFAULT 1 // "CList","VariableRowHeight" -#define SETTING_ALIGNLEFTTOLEFT_DEFAULT 1 // "CList","AlignLeftItemsToLeft" -#define SETTING_ALIGNRIGHTORIGHT_DEFAULT 1 // "CList","AlignRightItemsToRight" -#define SETTING_HIDEGROUPSICON_DEFAULT 0 // "CList","HideGroupsIcon" -#define SETTING_ALIGNGROPCAPTION_DEFAULT 0 // left todo replace by const //"CList","AlignGroupCaptions" +#define SETTING_ROWBORDER_DEFAULT 1 +#define SETTING_ROW_ADVANCEDLAYOUT_DEFAULT 0 +#define SETTING_ROW_ROWBORDER_DEFAULT 1 +#define SETTING_VARIABLEROWHEIGHT_DEFAULT 1 +#define SETTING_ALIGNLEFTTOLEFT_DEFAULT 1 +#define SETTING_ALIGNRIGHTORIGHT_DEFAULT 1 +#define SETTING_HIDEGROUPSICON_DEFAULT 0 +#define SETTING_ALIGNGROPCAPTION_DEFAULT 0 #define SETTINS_ROWITEMORDER_DEFAULT {ITEM_AVATAR, ITEM_ICON, ITEM_TEXT, ITEM_CONTACT_TIME, ITEM_EXTRA_ICONS} -#define SETTINGS_SHOWAVATARS_DEFAULT 0 // "CList","AvatarsShow" -#define SETTINGS_AVATARDRAWBORDER_DEFAULT 0 // "CList","AvatarsDrawBorders" -#define SETTINGS_AVATARBORDERCOLOR_DEFAULT RGB(0,0,0) // "CList","AvatarsBorderColor" -#define SETTINGS_AVATARROUNDCORNERS_DEFAULT 0 // "CList","AvatarsRoundCorners" -#define SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT 0 // "CList","AvatarsUseCustomCornerSize" -#define SETTINGS_AVATARCORNERSIZE_DEFAULT 4 // "CList","AvatarsCustomCornerSize" -#define SETTINGS_AVATARIGNORESIZEFORROW_DEFAULT 0 // "CList","AvatarsIgnoreSizeForRow" -#define SETTINGS_AVATARDRAWOVERLAY_DEFAULT 0 // "CList","AvatarsDrawOverlay" +#define SETTINGS_SHOWAVATARS_DEFAULT 0 +#define SETTINGS_AVATARDRAWBORDER_DEFAULT 0 +#define SETTINGS_AVATARBORDERCOLOR_DEFAULT RGB(0,0,0) +#define SETTINGS_AVATARROUNDCORNERS_DEFAULT 0 +#define SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT 0 +#define SETTINGS_AVATARCORNERSIZE_DEFAULT 4 +#define SETTINGS_AVATARIGNORESIZEFORROW_DEFAULT 0 +#define SETTINGS_AVATARDRAWOVERLAY_DEFAULT 0 #define SETTINGS_AVATAROVERLAYTYPE_DEFAULT SETTING_AVATAR_OVERLAY_TYPE_NORMAL -#define SETTING_AVATARHEIGHT_DEFAULT 24 // "CList","AvatarsSize" -#define SETTING_AVATARWIDTH_DEFAULT 24 // "CList","AvatarsWidth" -#define SETTINGS_AVATARINSEPARATE_DEFAULT 0 // "CList","AvatarsInSeparateWnd", - -#define SETTING_HIDEICONONAVATAR_DEFAULT 0 // "CList","IconHideOnAvatar" -#define SETTING_ICONONAVATARPLACE_DEFAULT 0 // "CList","IconDrawOnAvatarSpace" -#define SETTING_ICONIGNORESIZE_DEFAULT 0 // "CList","IconIgnoreSizeForRownHeight" -#define SETTING_SHOWTIME_DEFAULT 0 // "CList","ContactTimeShow" -#define SETTING_SHOWTIMEIFDIFF_DEFAULT 1 // "CList","ContactTimeShowOnlyIfDifferent" - -#define SETTING_TEXT_RTL_DEFAULT 0 // "CList","TextRTL" -#define SETTING_TEXT_RIGHTALIGN_DEFAULT 0 // "CList","TextAlignToRight" -#define SETTING_TEXT_SMILEY_DEFAULT 1 // "CList","TextReplaceSmileys" -#define SETTING_TEXT_RESIZESMILEY_DEFAULT 1 // "CList","TextResizeSmileys" -#define SETTING_TEXT_PROTOSMILEY_DEFAULT 1 // "CList","TextUseProtocolSmileys" -#define SETTING_TEXT_IGNORESIZE_DEFAULT 0 // "CList","TextIgnoreSizeForRownHeight" - -#define SETTING_FIRSTLINE_SMILEYS_DEFAULT 0 // "CList","FirstLineDrawSmileys" -#define SETTING_FIRSTLINE_APPENDNICK_DEFAULT 0 // "CList","FirstLineAppendNick" -#define SETTING_FIRSTLINE_TRIMTEXT_DEFAULT 1 // "CList","TrimText" - -#define SETTING_SECONDLINE_SHOW_DEFAULT 0 // "CList","SecondLineShow" -#define SETTING_SECONDLINE_TOPSPACE_DEFAULT 2 // "CList","SecondLineTopSpace" -#define SETTING_SECONDLINE_SMILEYS_DEFAULT 1 // "CList","SecondLineDrawSmileys" -#define SETTING_SECONDLINE_TYPE_DEFAULT TEXT_STATUS_MESSAGE // "CList","SecondLineType" -#define SETTING_SECONDLINE_XSTATUS_DEFAULT 1 // "CList","SecondLineXStatusHasPriority" -#define SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT 0 // "CList","SecondLineUseNameAndMessageForXStatus" -#define SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT 1 // "CList","SecondLineShowStatusIfNoAway" -#define SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT 1 // "CList","SecondLineShowListeningIfNoAway" - -#define SETTING_THIRDLINE_SHOW_DEFAULT 0 // "CList","ThirdLineShow" -#define SETTING_THIRDLINE_TOPSPACE_DEFAULT 2 // "CList","ThirdLineTopSpace" -#define SETTING_THIRDLINE_SMILEYS_DEFAULT 0 // "CList","ThirdLineDrawSmileys" -#define SETTING_THIRDLINE_TYPE_DEFAULT TEXT_STATUS_MESSAGE // "CList","ThirdLineType" -#define SETTING_THIRDLINE_XSTATUS_DEFAULT 1 // "ThirdLineXStatusHasPriority" -#define SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT 0 // "ThirdLineUseNameAndMessageForXStatus" -#define SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT 0 // "CList","ThirdLineShowStatusIfNoAway" -#define SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT 0 // "ThirdLineShowListeningIfNoAway" - -#define SETTING_TRANSPARENT_DEFAULT 0 // "CList","Transparent" -#define SETTING_AUTOALPHA_DEFAULT 150 // "CList","AutoAlpha" -#define SETTING_CONFIRMDELETE_DEFAULT 1 // "CList","ConfirmDelete" -#define SETTING_AUTOHIDE_DEFAULT 0 // "CList","AutoHide" -#define SETTING_HIDETIME_DEFAULT 30 // "CList","HideTime" -#define SETTING_CYCLETIME_DEFAULT 4 // "CList","CycleTime" -#define SETTING_TRAYICON_DEFAULT SETTING_TRAYICON_SINGLE // "CList","TrayIcon" -#define SETTING_ALWAYSSTATUS_DEFAULT 0 // "CList","AlwaysStatus" - -#define SETTING_BLENDINACTIVESTATE_DEFAULT 0 //"CLC","BlendInActiveState" +#define SETTING_AVATARHEIGHT_DEFAULT 24 +#define SETTING_AVATARWIDTH_DEFAULT 24 +#define SETTINGS_AVATARINSEPARATE_DEFAULT 0 + +#define SETTING_HIDEICONONAVATAR_DEFAULT 0 +#define SETTING_ICONONAVATARPLACE_DEFAULT 0 +#define SETTING_ICONIGNORESIZE_DEFAULT 0 +#define SETTING_SHOWTIME_DEFAULT 0 +#define SETTING_SHOWTIMEIFDIFF_DEFAULT 1 + +#define SETTING_TEXT_RTL_DEFAULT 0 +#define SETTING_TEXT_RIGHTALIGN_DEFAULT 0 +#define SETTING_TEXT_SMILEY_DEFAULT 1 +#define SETTING_TEXT_RESIZESMILEY_DEFAULT 1 +#define SETTING_TEXT_PROTOSMILEY_DEFAULT 1 +#define SETTING_TEXT_IGNORESIZE_DEFAULT 0 + +#define SETTING_FIRSTLINE_SMILEYS_DEFAULT 0 +#define SETTING_FIRSTLINE_APPENDNICK_DEFAULT 0 +#define SETTING_FIRSTLINE_TRIMTEXT_DEFAULT 1 + +#define SETTING_SECONDLINE_SHOW_DEFAULT 0 +#define SETTING_SECONDLINE_TOPSPACE_DEFAULT 2 +#define SETTING_SECONDLINE_SMILEYS_DEFAULT 1 +#define SETTING_SECONDLINE_TYPE_DEFAULT TEXT_STATUS_MESSAGE +#define SETTING_SECONDLINE_XSTATUS_DEFAULT 1 +#define SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT 0 +#define SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT 1 +#define SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT 1 + +#define SETTING_THIRDLINE_SHOW_DEFAULT 0 +#define SETTING_THIRDLINE_TOPSPACE_DEFAULT 2 +#define SETTING_THIRDLINE_SMILEYS_DEFAULT 0 +#define SETTING_THIRDLINE_TYPE_DEFAULT TEXT_STATUS_MESSAGE +#define SETTING_THIRDLINE_XSTATUS_DEFAULT 1 +#define SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT 0 +#define SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT 0 +#define SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT 0 + +#define SETTING_TRANSPARENT_DEFAULT 0 +#define SETTING_AUTOALPHA_DEFAULT 150 +#define SETTING_CONFIRMDELETE_DEFAULT 1 +#define SETTING_AUTOHIDE_DEFAULT 0 +#define SETTING_HIDETIME_DEFAULT 30 +#define SETTING_CYCLETIME_DEFAULT 4 +#define SETTING_TRAYICON_DEFAULT SETTING_TRAYICON_SINGLE +#define SETTING_ALWAYSSTATUS_DEFAULT 0 + +#define SETTING_BLENDINACTIVESTATE_DEFAULT 0 #define CLCDEFAULT_MODERN_SELTEXTCOLOUR (g_CluiData.fDisableSkinEngine?GetSysColor(COLOR_HIGHLIGHTTEXT):RGB(0,0,128)) #define CLCDEFAULT_MODERN_HOTTEXTCOLOUR (g_CluiData.fDisableSkinEngine ? CLCDEFAULT_MODERN_SELTEXTCOLOUR : RGB(0,0,255)) #define CLCDEFAULT_MODERN_QUICKSEARCHCOLOUR RGB(255,255,0) -#define CLCDEFAULT_NOVSCROLL 0 // "CLC","NoVScrollBar" -#define CLCDEFAULT_INFOTIPTIME 750 // "CLC","InfoTipHoverTime" -#define CLCDEFAULT_COLLICONTOLEFT 0 // "FrameTitleBar","AlignCOLLIconToLeft" - -#define SKIN_OFFSET_TOP_DEFAULT 0 // "ModernSkin","SizeMarginOffset_Top" -#define SKIN_OFFSET_BOTTOM_DEFAULT 0 // "ModernSkin","SizeMarginOffset_Bottom" -#define SKIN_OFFSET_LEFT_DEFAULT 0 // "ModernSkin","SizeMarginOffset_Left" -#define SKIN_OFFSET_RIGHT_DEFAULT 0 // "ModernSkin","SizeMarginOffset_Right" -#define SKIN_SPACEBEFOREGROUP_DEFAULT 0 // "ModernSkin","SpaceBeforeGroup" - -#define SETTINGS_BARBTNWIDTH_DEFAULT 22 // "ModernToolBar", "option_Bar0_BtnWidth" -#define SETTINGS_BARBTNHEIGHT_DEFAULT 22 // "ModernToolBar", "option_Bar0_BtnHeight" -#define SETTINGS_BARBTNSPACE_DEFAULT 0 // "ModernToolBar", "option_Bar0_BtnSpace" -#define SETTINGS_BARAUTOSIZE_DEFAULT 1 // "ModernToolBar", "option_Bar0_Autosize" -#define SETTINGS_BARMULTILINE_DEFAULT 1 // "ModernToolBar", "option_Bar0_Multiline" - -#define SETTING_ENABLESOUNDS_DEFAULT 1 // "Skin", "UseSound", +#define CLCDEFAULT_NOVSCROLL 0 +#define CLCDEFAULT_INFOTIPTIME 750 +#define CLCDEFAULT_COLLICONTOLEFT 0 + +#define SKIN_OFFSET_TOP_DEFAULT 0 +#define SKIN_OFFSET_BOTTOM_DEFAULT 0 +#define SKIN_OFFSET_LEFT_DEFAULT 0 +#define SKIN_OFFSET_RIGHT_DEFAULT 0 +#define SKIN_SPACEBEFOREGROUP_DEFAULT 0 + +#define SETTINGS_BARBTNWIDTH_DEFAULT 22 +#define SETTINGS_BARBTNHEIGHT_DEFAULT 22 +#define SETTINGS_BARBTNSPACE_DEFAULT 0 +#define SETTINGS_BARAUTOSIZE_DEFAULT 1 +#define SETTINGS_BARMULTILINE_DEFAULT 1 + +#define SETTING_ENABLESOUNDS_DEFAULT 1 diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index 156115a229..13151f8b40 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -91,22 +91,22 @@ void saveSettingsConnections(struct CONNECTION *connHead) while (tmp != nullptr) { mir_snprintf(buff, "%dFilterIntIp", i); - db_set_ws(0, PLUGINNAME, buff, tmp->strIntIp); + g_plugin.setWString(buff, tmp->strIntIp); mir_snprintf(buff, "%dFilterExtIp", i); - db_set_ws(0, PLUGINNAME, buff, tmp->strExtIp); + g_plugin.setWString(buff, tmp->strExtIp); mir_snprintf(buff, "%dFilterPName", i); - db_set_ws(0, PLUGINNAME, buff, tmp->PName); + g_plugin.setWString(buff, tmp->PName); mir_snprintf(buff, "%dFilterIntPort", i); - db_set_dw(0, PLUGINNAME, buff, tmp->intIntPort); + g_plugin.setDword(buff, tmp->intIntPort); mir_snprintf(buff, "%dFilterExtPort", i); - db_set_dw(0, PLUGINNAME, buff, tmp->intExtPort); + g_plugin.setDword(buff, tmp->intExtPort); mir_snprintf(buff, "%dFilterAction", i); - db_set_dw(0, PLUGINNAME, buff, tmp->Pid); + g_plugin.setDword(buff, tmp->Pid); i++; tmp = tmp->next; } settingFiltersCount = i; - db_set_dw(0, PLUGINNAME, "FiltersCount", settingFiltersCount); + g_plugin.setDword("FiltersCount", settingFiltersCount); } @@ -120,26 +120,26 @@ struct CONNECTION* LoadSettingsConnections() for (i = settingFiltersCount - 1; i >= 0; i--) { struct CONNECTION *conn = (struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION)); mir_snprintf(buff, "%dFilterIntIp", i); - if (!db_get_ws(0, PLUGINNAME, buff, &dbv)) + if (!g_plugin.getWString(buff, &dbv)) wcsncpy(conn->strIntIp, dbv.pwszVal, _countof(conn->strIntIp)); db_free(&dbv); mir_snprintf(buff, "%dFilterExtIp", i); - if (!db_get_ws(0, PLUGINNAME, buff, &dbv)) + if (!g_plugin.getWString(buff, &dbv)) wcsncpy(conn->strExtIp, dbv.pwszVal, _countof(conn->strExtIp)); db_free(&dbv); mir_snprintf(buff, "%dFilterPName", i); - if (!db_get_ws(0, PLUGINNAME, buff, &dbv)) + if (!g_plugin.getWString(buff, &dbv)) wcsncpy(conn->PName, dbv.pwszVal, _countof(conn->PName)); db_free(&dbv); mir_snprintf(buff, "%dFilterIntPort", i); - conn->intIntPort = db_get_dw(0, PLUGINNAME, buff, -1); + conn->intIntPort = g_plugin.getDword(buff, -1); mir_snprintf(buff, "%dFilterExtPort", i); - conn->intExtPort = db_get_dw(0, PLUGINNAME, buff, -1); + conn->intExtPort = g_plugin.getDword(buff, -1); mir_snprintf(buff, "%dFilterAction", i); - conn->Pid = db_get_dw(0, PLUGINNAME, buff, 0); + conn->Pid = g_plugin.getDword(buff, 0); conn->next = connHead; connHead = conn; @@ -149,22 +149,21 @@ struct CONNECTION* LoadSettingsConnections() //called to load settings from database void LoadSettings() { - settingInterval = (INT)db_get_dw(0, PLUGINNAME, "Interval", 500); - settingInterval1 = (INT)db_get_dw(0, PLUGINNAME, "PopupInterval", 0); - settingResolveIp = db_get_b(0, PLUGINNAME, "ResolveIp", TRUE); - settingDefaultAction = db_get_b(0, PLUGINNAME, "FilterDefaultAction", TRUE); - - settingSetColours = db_get_b(0, PLUGINNAME, "PopupSetColours", 0); - settingBgColor = (COLORREF)db_get_dw(0, PLUGINNAME, "PopupBgColor", (DWORD)0xFFFFFF); - settingFgColor = (COLORREF)db_get_dw(0, PLUGINNAME, "PopupFgColor", (DWORD)0x000000); - settingFiltersCount = (INT)db_get_dw(0, PLUGINNAME, "FiltersCount", 0); - settingStatusMask = (WORD)db_get_w(0, PLUGINNAME, "StatusMask", 16); + settingInterval = g_plugin.getDword("Interval", 500); + settingInterval1 = g_plugin.getDword("PopupInterval", 0); + settingResolveIp = g_plugin.getByte("ResolveIp", TRUE); + settingDefaultAction = g_plugin.getByte("FilterDefaultAction", TRUE); + + settingSetColours = g_plugin.getByte("PopupSetColours", 0); + settingBgColor = g_plugin.getDword("PopupBgColor", (DWORD)0xFFFFFF); + settingFgColor = g_plugin.getDword("PopupFgColor", (DWORD)0x000000); + settingFiltersCount = g_plugin.getDword("FiltersCount", 0); + settingStatusMask = g_plugin.getWord("StatusMask", 16); for (int i = 0; i < STATUS_COUNT; i++) { char buff[128]; mir_snprintf(buff, "Status%d", i); - settingStatus[i] = (db_get_b(0, PLUGINNAME, buff, 0) == 1); + settingStatus[i] = (g_plugin.getByte(buff, 0) == 1); } - //lookupLotusDefaultSettings(); } void fillExceptionsListView(HWND hwndDlg) @@ -506,19 +505,19 @@ INT_PTR CALLBACK DlgProcConnectionNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wPar return TRUE; case PSN_APPLY: - db_set_dw(0, PLUGINNAME, "Interval", settingInterval); - db_set_dw(0, PLUGINNAME, "PopupInterval", settingInterval1); - db_set_b(0, PLUGINNAME, "PopupSetColours", settingSetColours); - db_set_dw(0, PLUGINNAME, "PopupBgColor", (DWORD)settingBgColor); - db_set_dw(0, PLUGINNAME, "PopupFgColor", (DWORD)settingFgColor); - db_set_b(0, PLUGINNAME, "ResolveIp", settingResolveIp); - db_set_b(0, PLUGINNAME, "FilterDefaultAction", settingDefaultAction); + g_plugin.setDword("Interval", settingInterval); + g_plugin.setDword("PopupInterval", settingInterval1); + g_plugin.setByte("PopupSetColours", settingSetColours); + g_plugin.setDword("PopupBgColor", settingBgColor); + g_plugin.setDword("PopupFgColor", settingFgColor); + g_plugin.setByte("ResolveIp", settingResolveIp); + g_plugin.setByte("FilterDefaultAction", settingDefaultAction); for (int i = 0; i < STATUS_COUNT; i++) { char buff[128]; mir_snprintf(buff, "Status%d", i); settingStatus[i] = (ListView_GetCheckState(GetDlgItem(hwndDlg, IDC_STATUS), i) ? TRUE : FALSE); - db_set_b(0, PLUGINNAME, buff, settingStatus[i] ? 1 : 0); + g_plugin.setByte(buff, settingStatus[i] ? 1 : 0); } if (WAIT_OBJECT_0 == WaitForSingleObject(hExceptionsMutex, 100)) { deleteConnectionsTable(connExceptions); @@ -846,7 +845,7 @@ int CMPlugin::Load() // set all contacts to offline for (auto &hContact : Contacts(PLUGINNAME)) - db_set_w(hContact, PLUGINNAME, "status", ID_STATUS_OFFLINE); + g_plugin.setWord(hContact, "status", ID_STATUS_OFFLINE); CreateProtoServiceFunction(PLUGINNAME, PS_GETCAPS, GetCaps); CreateProtoServiceFunction(PLUGINNAME, PS_GETNAME, GetName); @@ -854,7 +853,7 @@ int CMPlugin::Load() CreateProtoServiceFunction(PLUGINNAME, PS_SETSTATUS, SetStatus); CreateProtoServiceFunction(PLUGINNAME, PS_GETSTATUS, GetStatus); - g_plugin.addSound(PLUGINNAME_NEWSOUND, PLUGINNAMEW, LPGENW("New Connection Notification")); + g_plugin.addSound(PLUGINNAME_NEWSOUND, _A2W(PLUGINNAME), LPGENW("New Connection Notification")); HookEvent(ME_OPT_INITIALISE, ConnectionNotifyOptInit); // register service to hook option call HookEvent(ME_SYSTEM_MODULESLOADED, modulesloaded); // hook event that all plugins are loaded diff --git a/plugins/ConnectionNotify/src/stdafx.h b/plugins/ConnectionNotify/src/stdafx.h index dbadd2d5c9..94d8174f1f 100644 --- a/plugins/ConnectionNotify/src/stdafx.h +++ b/plugins/ConnectionNotify/src/stdafx.h @@ -27,17 +27,16 @@ #include "pid2name.h" #define MAX_SETTING_STR 512 -#define PLUGINNAME "ConnectionNotify" -#define PLUGINNAMEW L"ConnectionNotify" #define MAX_LENGTH 512 #define STATUS_COUNT 9 -#define PLUGINNAME_NEWSOUND PLUGINNAME "_new_sound" - // Note: could also use malloc() and free() #define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x)) #define FREE(x) HeapFree(GetProcessHeap(), 0, (x)) +#define PLUGINNAME "ConnectionNotify" +#define PLUGINNAME_NEWSOUND PLUGINNAME "_new_sound" + struct CMPlugin : public PLUGIN { CMPlugin(); diff --git a/plugins/CyrTranslit/src/MirandaContact.cpp b/plugins/CyrTranslit/src/MirandaContact.cpp index 4d981e3b60..444c2bae39 100644 --- a/plugins/CyrTranslit/src/MirandaContact.cpp +++ b/plugins/CyrTranslit/src/MirandaContact.cpp @@ -22,8 +22,6 @@ namespace CyrTranslit { -const char* MirandaContact::SETTINGS_MODULE = "CyrTranslit"; - const char* MirandaContact::SETTING_SHOULD_TRANSLITERATE = "translit"; char *MirandaContact::MENU_ITEM_TEXT = LPGEN("&Transliterate"); @@ -49,14 +47,14 @@ void MirandaContact::initialize() bool MirandaContact::bIsActive(MCONTACT hContact) { - return db_get_b(hContact, SETTINGS_MODULE, SETTING_SHOULD_TRANSLITERATE, 0) != 0; + return g_plugin.getBool(hContact, SETTING_SHOULD_TRANSLITERATE, 0); } //------------------------------------------------------------------------------ void MirandaContact::save(MCONTACT hContact, bool bValue) { - db_set_b(hContact, SETTINGS_MODULE, SETTING_SHOULD_TRANSLITERATE, bValue); + g_plugin.setByte(hContact, SETTING_SHOULD_TRANSLITERATE, bValue); } //------------------------------------------------------------------------------ diff --git a/plugins/CyrTranslit/src/MirandaContact.h b/plugins/CyrTranslit/src/MirandaContact.h index 4760d8f836..ee7309fd7d 100644 --- a/plugins/CyrTranslit/src/MirandaContact.h +++ b/plugins/CyrTranslit/src/MirandaContact.h @@ -52,7 +52,6 @@ public: static void save(MCONTACT hContact, bool bValue); private: - static const char* SETTINGS_MODULE; static const char* SETTING_SHOULD_TRANSLITERATE; static char *MENU_ITEM_TEXT; diff --git a/plugins/GmailNotifier/src/notify.cpp b/plugins/GmailNotifier/src/notify.cpp index f47c0792cd..42804b3322 100644 --- a/plugins/GmailNotifier/src/notify.cpp +++ b/plugins/GmailNotifier/src/notify.cpp @@ -82,7 +82,7 @@ int OpenBrowser(WPARAM hContact, LPARAM) return FALSE; if (curAcc->oldResults_num != 0) { - db_set_w(curAcc->hContact, MODULENAME, "Status", ID_STATUS_NONEW); + g_plugin.setWord(curAcc->hContact, "Status", ID_STATUS_NONEW); curAcc->oldResults_num = 0; DeleteResults(curAcc->results.next); curAcc->results.next = nullptr; @@ -134,15 +134,15 @@ void NotifyUser(Account *curAcc) PUDeletePopup(curAcc->popUpHwnd); g_clistApi.pfnRemoveEvent(curAcc->hContact, 1); if (curAcc->oldResults_num != 0) - db_set_w(curAcc->hContact, MODULENAME, "Status", ID_STATUS_NONEW); + g_plugin.setWord(curAcc->hContact, "Status", ID_STATUS_NONEW); break; case -1: - db_set_w(curAcc->hContact, MODULENAME, "Status", ID_STATUS_AWAY); + g_plugin.setWord(curAcc->hContact, "Status", ID_STATUS_AWAY); break; default: - db_set_w(curAcc->hContact, MODULENAME, "Status", ID_STATUS_OCCUPIED); + g_plugin.setWord(curAcc->hContact, "Status", ID_STATUS_OCCUPIED); int newMails = (curAcc->oldResults_num == -1) ? (curAcc->results_num) : (curAcc->results_num - curAcc->oldResults_num); if (opt.LogThreads&&newMails > 0) { DBEVENTINFO dbei = {}; diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp index e9bc4bab5c..3a520b6cd2 100644 --- a/plugins/GmailNotifier/src/options.cpp +++ b/plugins/GmailNotifier/src/options.cpp @@ -13,11 +13,11 @@ static void SaveButton(HWND hwndDlg, HWND hwndCombo, int curIndex) SendMessageA(hwndCombo, CB_DELETESTRING, curIndex, 0); SendMessageA(hwndCombo, CB_INSERTSTRING, curIndex, (LPARAM)acc.name); SendMessageA(hwndCombo, CB_SETCURSEL, curIndex, 0); - db_set_s(acc.hContact, MODULENAME, "name", acc.name); - db_set_s(acc.hContact, MODULENAME, "Nick", acc.name); + g_plugin.setString(acc.hContact, "name", acc.name); + g_plugin.setString(acc.hContact, "Nick", acc.name); GetDlgItemTextA(hwndDlg, IDC_PASS, acc.pass, _countof(acc.pass)); - db_set_s(acc.hContact, MODULENAME, "Password", acc.pass); + g_plugin.setString(acc.hContact, "Password", acc.pass); } } @@ -259,7 +259,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ID_STATUS_NONEW = opt.UseOnline ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE; for (auto &it : g_accs) - db_set_w(it->hContact, MODULENAME, "Status", ID_STATUS_NONEW); + g_plugin.setWord(it->hContact, "Status", ID_STATUS_NONEW); } return TRUE; diff --git a/plugins/MirFox/src/MirfoxData.cpp b/plugins/MirFox/src/MirfoxData.cpp index 4f9611435d..5aa4034d45 100644 --- a/plugins/MirFox/src/MirfoxData.cpp +++ b/plugins/MirFox/src/MirfoxData.cpp @@ -548,7 +548,7 @@ MirfoxData::createOrGetAccountStateFromDB(MirandaAccount* mirandaAccount){ MFENUM_MIRANDACONTACT_STATE MirfoxData::createOrGetContactStateFromDB(MirandaContact* mirandaContact){ - int keyValue = db_get_b(mirandaContact->contactHandle, MODULENAME, "state", 0); + int keyValue = g_plugin.getByte(mirandaContact->contactHandle, "state"); if (keyValue == 1 || keyValue == 2){ //setting exist if (keyValue == 1){ @@ -559,10 +559,10 @@ MirfoxData::createOrGetContactStateFromDB(MirandaContact* mirandaContact){ } else { //setting does not exist, or is invalid -> save default setting (1 - ON) if (MirfoxData::getContactDefaultState(mirandaContact->getObjectPtr()) == 1){ //on = 1 - db_set_b(mirandaContact->contactHandle, MODULENAME, "state", 1); + g_plugin.setByte(mirandaContact->contactHandle, "state", 1); return MFENUM_MIRANDACONTACT_STATE_ON; //1 } else { //off = 2 - db_set_b(mirandaContact->contactHandle, MODULENAME, "state", 2); + g_plugin.setByte(mirandaContact->contactHandle, "state", 2); return MFENUM_MIRANDACONTACT_STATE_OFF; //2 } } diff --git a/plugins/Toaster/src/options.cpp b/plugins/Toaster/src/options.cpp index e5e497fc03..a235263cff 100644 --- a/plugins/Toaster/src/options.cpp +++ b/plugins/Toaster/src/options.cpp @@ -47,7 +47,7 @@ void COptions::Enabled_OnChange(CCtrlCheck* chk) int OnOptionsInitialized(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = {}; - odp.szTitle.w = L"Popups"; //_T(MODULENAME); + odp.szTitle.w = L"Popups"; odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; odp.position = -790000000; odp.szTab.w = _T(MODULENAME); diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 1a43c19f6f..4957120181 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -166,7 +166,7 @@ INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM) return 0; } - ptrW url(g_plugin.getWStringA((wParam, "URL")); + ptrW url(g_plugin.getWStringA(wParam, "URL")); if (url == NULL) return 0; diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp index 957816a898..420599f6ef 100644 --- a/plugins/XSoundNotify/src/options.cpp +++ b/plugins/XSoundNotify/src/options.cpp @@ -320,12 +320,12 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l wchar_t shortpath[MAX_PATH]; PathToRelativeW(it->path, shortpath); if (it->iscontact) - db_set_ws(it->hContact, MODULENAME, SETTINGSKEY, shortpath); + g_plugin.setWString(it->hContact, SETTINGSKEY, shortpath); else g_plugin.setWString((LPCSTR)it->hContact, shortpath); } if (it->iscontact) - db_set_b(it->hContact, MODULENAME, SETTINGSIGNOREKEY, it->ignore); + g_plugin.setByte(it->hContact, SETTINGSIGNOREKEY, it->ignore); else { size_t value_max_len = mir_strlen((const char*)it->hContact) + 8; char *value = (char *)mir_alloc(sizeof(char) * value_max_len); diff --git a/protocols/ICQCorp/src/options.cpp b/protocols/ICQCorp/src/options.cpp index fb0fd8af76..79c9fda410 100644 --- a/protocols/ICQCorp/src/options.cpp +++ b/protocols/ICQCorp/src/options.cpp @@ -29,12 +29,12 @@ static INT_PTR CALLBACK icqOptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hWnd); - SetDlgItemInt(hWnd, IDC_OPT_UIN, db_get_dw(0, protoName, "UIN", 0), FALSE); - if (!db_get_s(0, protoName, "Password", &dbv)) { + SetDlgItemInt(hWnd, IDC_OPT_UIN, g_plugin.getDword("UIN"), FALSE); + if (!g_plugin.getString("Password", &dbv)) { SetDlgItemTextA(hWnd, IDC_OPT_PASSWORD, dbv.pszVal); db_free(&dbv); } - if (!db_get_s(0, protoName, "Server", &dbv)) { + if (!g_plugin.getString("Server", &dbv)) { SetDlgItemTextA(hWnd, IDC_OPT_SERVER, dbv.pszVal); db_free(&dbv); } @@ -45,12 +45,12 @@ static INT_PTR CALLBACK icqOptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_dw(0, protoName, "UIN", (DWORD)GetDlgItemInt(hWnd, IDC_OPT_UIN, nullptr, FALSE)); + g_plugin.setDword("UIN", (DWORD)GetDlgItemInt(hWnd, IDC_OPT_UIN, nullptr, FALSE)); GetDlgItemTextA(hWnd, IDC_OPT_PASSWORD, str, sizeof(str)); - db_set_s(0, protoName, "Password", str); + g_plugin.setString("Password", str); GetDlgItemTextA(hWnd, IDC_OPT_SERVER, str, sizeof(str)); - db_set_s(0, protoName, "Server", str); - db_set_w(0, protoName, "Port", (WORD)GetDlgItemInt(hWnd, IDC_OPT_PORT, nullptr, FALSE)); + g_plugin.setString("Server", str); + g_plugin.setWord("Port", (WORD)GetDlgItemInt(hWnd, IDC_OPT_PORT, nullptr, FALSE)); return TRUE; } break; diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp index b1e1f02d20..cfc2675148 100644 --- a/protocols/ICQCorp/src/protocol.cpp +++ b/protocols/ICQCorp/src/protocol.cpp @@ -195,7 +195,7 @@ bool ICQ::logon(unsigned short logonStatus) DBVARIANT dbv; char str[128]; - if (!db_get_s(0, protoName, "Server", &dbv)) { + if (!g_plugin.getString("Server", &dbv)) { lstrcpyA(str, dbv.pszVal); db_free(&dbv); } @@ -218,8 +218,8 @@ bool ICQ::logon(unsigned short logonStatus) updateContactList(); - dwUIN = db_get_dw(0, protoName, "UIN", 0); - if (!db_get_s(0, protoName, "Password", &dbv)) { + dwUIN = g_plugin.getDword("UIN", 0); + if (!g_plugin.getString("Password", &dbv)) { lstrcpyA(str, dbv.pszVal); db_free(&dbv); } @@ -602,7 +602,8 @@ unsigned short ICQ::processUdpPacket(Packet &packet) break; } - if (e->reply == 0) ProtoBroadcastAck(protoName, u->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, nullptr, 0); + if (e->reply == 0) + ProtoBroadcastAck(protoName, u->hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, nullptr, 0); doneEvent(true, udpSocket.handleVal, theSequence1); delete[] buffer; break; @@ -763,7 +764,7 @@ unsigned short ICQ::processUdpPacket(Packet &packet) >> timedataStamp >> newCommand; - db_set_dw(0, protoName, "LastBroadcastTime", timedataStamp); + g_plugin.setDword("LastBroadcastTime", timedataStamp); timedataStamp = TimeZone_ToLocal(timedataStamp); processSystemMessage(packet, checkUin, newCommand, timedataStamp); @@ -1061,7 +1062,7 @@ void ICQ::requestSystemMsg() void ICQ::requestBroadcastMsg() { - unsigned int timeStamp = db_get_dw(0, protoName, "LastBroadcastTime", 0); + unsigned int timeStamp = g_plugin.getDword("LastBroadcastTime", 0); Packet packet; packet << ICQ_VERSION @@ -1116,13 +1117,13 @@ void ICQ::updateContactList() if ((u = getUserByContact(hContact)) == nullptr) { u = new ICQUser(); u->hContact = hContact; - u->dwUIN = db_get_dw(hContact, protoName, "UIN", 0); + u->dwUIN = g_plugin.getDword(hContact, "UIN", 0); icqUsers.push_back(u); } if (statusVal <= ID_STATUS_OFFLINE) u->setStatus(ID_STATUS_OFFLINE); else - u->statusVal = db_get_w(hContact, protoName, "Status", ID_STATUS_OFFLINE); + u->statusVal = g_plugin.getWord(hContact, "Status", ID_STATUS_OFFLINE); } } @@ -1133,7 +1134,8 @@ void ICQ::updateContactList() Packet userPacket; for (i = 0; i < icqUsers.size();) { userCount = (unsigned int)icqUsers.size() - i; - if (userCount > 100) userCount = 100; + if (userCount > 100) + userCount = 100; userPacket.clearPacket(); userPacket << ICQ_VERSION @@ -1173,7 +1175,7 @@ void ICQ::sendVisibleList() for (i=0; istatusVal != ID_STATUS_OFFLINE && db_get_w(u->hContact, protoName, "ApparentMode", 0) == ID_STATUS_ONLINE) + if (u->statusVal != ID_STATUS_OFFLINE && g_plugin.getWord(u->hContact, "ApparentMode") == ID_STATUS_ONLINE) numUsers++; } @@ -1183,7 +1185,7 @@ void ICQ::sendVisibleList() for (i=0; istatusVal != ID_STATUS_OFFLINE && db_get_w(u->hContact, protoName, "ApparentMode", 0) == ID_STATUS_ONLINE) + if (u->statusVal != ID_STATUS_OFFLINE && g_plugin.getWord(u->hContact, "ApparentMode") == ID_STATUS_ONLINE) userPacket << icqUsers[i]->uin; } @@ -1209,7 +1211,7 @@ void ICQ::sendInvisibleList() for (i=0; ihContact, protoName, "ApparentMode", 0) == ID_STATUS_OFFLINE) + if (g_plugin.getWord(icqUsers[i]->hContact, "ApparentMode") == ID_STATUS_OFFLINE) numUsers++; } @@ -1218,7 +1220,7 @@ void ICQ::sendInvisibleList() for (i=0; ihContact, protoName, "ApparentMode", 0) == ID_STATUS_OFFLINE) + if (g_plugin.getWord(icqUsers[i]->hContact, "ApparentMode") == ID_STATUS_OFFLINE) userPacket << icqUsers[i]->uin; } diff --git a/protocols/ICQCorp/src/user.cpp b/protocols/ICQCorp/src/user.cpp index 1b83e518cf..382b5c5303 100644 --- a/protocols/ICQCorp/src/user.cpp +++ b/protocols/ICQCorp/src/user.cpp @@ -36,7 +36,7 @@ void ICQUser::setStatus(unsigned short newStatus) return; statusVal = newStatus; - db_set_w(hContact, protoName, "Status", newStatus); + g_plugin.setWord(hContact, "Status", newStatus); } /////////////////////////////////////////////////////////////////////////////// @@ -44,9 +44,9 @@ void ICQUser::setStatus(unsigned short newStatus) void ICQUser::setInfo(char *name, unsigned int data) { if (data && data != 0xFFFFFFFF) - db_set_dw(hContact, protoName, name, data); + g_plugin.setDword(hContact, name, data); else - db_unset(hContact, protoName, name); + g_plugin.delSetting(hContact, name); } /////////////////////////////////////////////////////////////////////////////// @@ -54,9 +54,9 @@ void ICQUser::setInfo(char *name, unsigned int data) void ICQUser::setInfo(char *name, unsigned short data) { if (data && data != 0xFFFF) - db_set_w(hContact, protoName, name, data); + g_plugin.setWord(hContact, name, data); else - db_unset(hContact, protoName, name); + g_plugin.delSetting(hContact, name); } /////////////////////////////////////////////////////////////////////////////// @@ -64,9 +64,9 @@ void ICQUser::setInfo(char *name, unsigned short data) void ICQUser::setInfo(char *name, unsigned char data) { if (data && data != 0xFF) - db_set_b(hContact, protoName, name, data); + g_plugin.setByte(hContact, name, data); else - db_unset(hContact, protoName, name); + g_plugin.delSetting(hContact, name); } /////////////////////////////////////////////////////////////////////////////// @@ -74,9 +74,9 @@ void ICQUser::setInfo(char *name, unsigned char data) void ICQUser::setInfo(char *name, char *data) { if (data[0]) - db_set_s(hContact, protoName, name, data); + g_plugin.setString(hContact, name, data); else - db_unset(hContact, protoName, name); + g_plugin.delSetting(hContact, name); } /////////////////////////////////////////////////////////////////////////////// @@ -116,16 +116,16 @@ static INT_PTR CALLBACK icqUserInfoDlgProc(HWND hWnd, UINT msg, WPARAM wParam, L unsigned long ip, port; MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam; - _itow(db_get_dw(hContact, protoName, "UIN", 0), buffer, 10); + _itow(g_plugin.getDword(hContact, "UIN", 0), buffer, 10); setTextValue(hWnd, IDC_INFO_UIN, buffer); - ip = db_get_dw(hContact, protoName, "IP", 0); + ip = g_plugin.getDword(hContact, "IP", 0); setTextValue(hWnd, IDC_INFO_IP, ip ? _A2T(iptoa(ip)) : nullptr); - ip = db_get_dw(hContact, protoName, "RealIP", 0); + ip = g_plugin.getDword(hContact, "RealIP", 0); setTextValue(hWnd, IDC_INFO_REALIP, ip ? _A2T(iptoa(ip)) : nullptr); - port = db_get_w(hContact, protoName, "Port", 0); + port = g_plugin.getWord(hContact, "Port", 0); _itow(port, buffer, 10); setTextValue(hWnd, IDC_INFO_PORT, port ? buffer : nullptr); -- cgit v1.2.3