diff options
Diffstat (limited to 'plugins/TabSRMM')
26 files changed, 181 insertions, 215 deletions
diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp index 73611ef337..f633aa7205 100644 --- a/plugins/TabSRMM/src/chat_main.cpp +++ b/plugins/TabSRMM/src/chat_main.cpp @@ -81,11 +81,11 @@ static void OnCreateModule(MODULEINFO *mi) static void OnLoadSettings()
{
- g_Settings.dwIconFlags = M.GetDword(CHAT_MODULE, "IconFlags", 0x0000);
+ g_Settings.dwIconFlags = db_get_dw(0, CHAT_MODULE, "IconFlags", 0x0000);
g_Settings.bOpenInDefault = M.GetBool(CHAT_MODULE, "DefaultContainer", true);
- g_Settings.UserListColors[CHAT_STATUS_NORMAL] = M.GetDword(CHATFONT_MODULE, "Font18Col", RGB(0, 0, 0));
- g_Settings.UserListColors[CHAT_STATUS_AWAY] = M.GetDword(CHATFONT_MODULE, "Font19Col", RGB(170, 170, 170));
- g_Settings.UserListColors[CHAT_STATUS_OFFLINE] = M.GetDword(CHATFONT_MODULE, "Font5Col", RGB(160, 90, 90));
+ g_Settings.UserListColors[CHAT_STATUS_NORMAL] = db_get_dw(0, CHATFONT_MODULE, "Font18Col", RGB(0, 0, 0));
+ g_Settings.UserListColors[CHAT_STATUS_AWAY] = db_get_dw(0, CHATFONT_MODULE, "Font19Col", RGB(170, 170, 170));
+ g_Settings.UserListColors[CHAT_STATUS_OFFLINE] = db_get_dw(0, CHATFONT_MODULE, "Font5Col", RGB(160, 90, 90));
g_Settings.bBBCodeInPopups = M.GetBool(CHAT_MODULE, "BBCodeInPopups", false);
g_Settings.bClassicIndicators = M.GetBool(CHAT_MODULE, "ClassicIndicators", false);
g_Settings.bLogClassicIndicators = M.GetBool(CHAT_MODULE, "LogClassicIndicators", false);
@@ -129,15 +129,15 @@ static void OnLoadSettings() int ih = Chat_GetTextPixelSize(L"AQGglo", g_Settings.UserListFonts[CHAT_STATUS_NORMAL], false);
int ih2 = Chat_GetTextPixelSize(L"AQGglo", g_Settings.UserListFonts[CHAT_STATUS_AWAY], false);
- g_Settings.iNickListFontHeight = max(M.GetByte(CHAT_MODULE, "NicklistRowDist", 12), (ih > ih2 ? ih : ih2));
+ g_Settings.iNickListFontHeight = max(db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12), (ih > ih2 ? ih : ih2));
for (int i = 0; i < 5; i++) {
char szBuf[40];
mir_snprintf(szBuf, "NickColor%d", i);
- g_Settings.nickColors[i] = M.GetDword(CHAT_MODULE, szBuf, g_Settings.UserListColors[0]);
+ g_Settings.nickColors[i] = db_get_dw(0, CHAT_MODULE, szBuf, g_Settings.UserListColors[0]);
}
- g_Settings.nickColors[5] = M.GetDword(CHAT_MODULE, "NickColor5", GetSysColor(COLOR_HIGHLIGHT));
- g_Settings.nickColors[6] = M.GetDword(CHAT_MODULE, "NickColor6", GetSysColor(COLOR_HIGHLIGHTTEXT));
+ g_Settings.nickColors[5] = db_get_dw(0, CHAT_MODULE, "NickColor5", GetSysColor(COLOR_HIGHLIGHT));
+ g_Settings.nickColors[6] = db_get_dw(0, CHAT_MODULE, "NickColor6", GetSysColor(COLOR_HIGHLIGHTTEXT));
if (g_Settings.SelectionBGBrush)
DeleteObject(g_Settings.SelectionBGBrush);
@@ -192,8 +192,8 @@ static void CheckUpdate() }
if (compat == 2) {
- COLORREF color0 = M.GetDword(CHAT_MODULE, "NickColor2", 0);
- COLORREF color2 = M.GetDword(CHAT_MODULE, "NickColor0", 0);
+ COLORREF color0 = db_get_dw(0, CHAT_MODULE, "NickColor2", 0);
+ COLORREF color2 = db_get_dw(0, CHAT_MODULE, "NickColor0", 0);
db_set_dw(0, CHAT_MODULE, "NickColor0", color0);
db_set_dw(0, CHAT_MODULE, "NickColor2", color2);
compat++;
diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index dabe09fc1a..e6329e9ce7 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -184,17 +184,17 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM if (colour) {
mir_snprintf(str, "Font%dCol", db_idx);
- *colour = M.GetDword(szMod, str, fol[i].defColour);
+ *colour = db_get_dw(0, szMod, str, fol[i].defColour);
}
if (lf) {
mir_snprintf(str, "Font%dSize", db_idx);
- lf->lfHeight = (char)M.GetByte(szMod, str, fol[i].defSize);
+ lf->lfHeight = (char)db_get_b(0, szMod, str, fol[i].defSize);
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
mir_snprintf(str, "Font%dSty", db_idx);
- int style = M.GetByte(szMod, str, fol[i].defStyle);
+ int style = db_get_b(0, szMod, str, fol[i].defStyle);
if (i == MSGFONTID_MESSAGEAREA && section == FONTSECTION_IM && M.GetByte("inputFontFix", 1) == 1) {
lf->lfWeight = FW_NORMAL;
lf->lfItalic = 0;
@@ -208,7 +208,7 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM lf->lfStrikeOut = style & FONTF_STRIKEOUT ? 1 : 0;
}
mir_snprintf(str, "Font%dSet", db_idx);
- lf->lfCharSet = M.GetByte(szMod, str, fol[i].defCharset);
+ lf->lfCharSet = db_get_b(0, szMod, str, fol[i].defCharset);
lf->lfOutPrecision = OUT_DEFAULT_PRECIS;
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf->lfQuality = DEFAULT_QUALITY;
@@ -562,9 +562,9 @@ class CChatSettingsDlg : public CChatBaseOptionDlg tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvis.item.pszText = TranslateW(branch[i].szDescr);
if (branch[i].iMode)
- tvis.item.iImage = tvis.item.iSelectedImage = ((((M.GetDword(CHAT_MODULE, branch[i].szDBName, defaultval) & branch[i].iMode) & branch[i].iMode) != 0) ? IMG_CHECK : IMG_NOCHECK);
+ tvis.item.iImage = tvis.item.iSelectedImage = ((((db_get_dw(0, CHAT_MODULE, branch[i].szDBName, defaultval) & branch[i].iMode) & branch[i].iMode) != 0) ? IMG_CHECK : IMG_NOCHECK);
else
- tvis.item.iImage = tvis.item.iSelectedImage = ((M.GetByte(CHAT_MODULE, branch[i].szDBName, branch[i].bDefault) != 0) ? IMG_CHECK : IMG_NOCHECK);
+ tvis.item.iImage = tvis.item.iSelectedImage = ((db_get_dw(0, CHAT_MODULE, branch[i].szDBName, branch[i].bDefault) != 0) ? IMG_CHECK : IMG_NOCHECK);
branch[i].hItem = treeCheck.InsertItem(&tvis);
}
}
@@ -682,7 +682,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0));
SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(0, CHAT_MODULE, "LogLimit", 100), 0));
SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN3, UDM_SETRANGE, 0, MAKELONG(255, 10));
- SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN3, UDM_SETPOS, 0, MAKELONG(M.GetByte(CHAT_MODULE, "NicklistRowDist", 12), 0));
+ SendDlgItemMessage(m_hwnd, IDC_CHAT_SPIN3, UDM_SETPOS, 0, MAKELONG(db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12), 0));
SetDlgItemText(m_hwnd, IDC_LOGTIMESTAMP, g_Settings.pszTimeStampLog);
SetDlgItemText(m_hwnd, IDC_TIMESTAMP, g_Settings.pszTimeStamp);
SetDlgItemText(m_hwnd, IDC_OUTSTAMP, g_Settings.pszOutgoingNick);
@@ -799,7 +799,7 @@ public: if (g_chatApi.hListBkgBrush)
DeleteObject(g_chatApi.hListBkgBrush);
- g_chatApi.hListBkgBrush = CreateSolidBrush(M.GetDword(CHAT_MODULE, "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR));
+ g_chatApi.hListBkgBrush = CreateSolidBrush(db_get_dw(0, CHAT_MODULE, "ColorNicklistBG", SRMSGDEFSET_BKGCOLOUR));
return true;
}
@@ -925,10 +925,10 @@ public: bool OnInitDialog() override
{
- DWORD dwFilterFlags = M.GetDword(CHAT_MODULE, "FilterFlags", GC_EVENT_ALL);
- DWORD dwTrayFlags = M.GetDword(CHAT_MODULE, "TrayIconFlags", GC_EVENT_HIGHLIGHT);
- DWORD dwPopupFlags = M.GetDword(CHAT_MODULE, "PopupFlags", GC_EVENT_HIGHLIGHT);
- DWORD dwLogFlags = M.GetDword(CHAT_MODULE, "DiskLogFlags", GC_EVENT_ALL);
+ DWORD dwFilterFlags = db_get_dw(0, CHAT_MODULE, "FilterFlags", GC_EVENT_ALL);
+ DWORD dwTrayFlags = db_get_dw(0, CHAT_MODULE, "TrayIconFlags", GC_EVENT_HIGHLIGHT);
+ DWORD dwPopupFlags = db_get_dw(0, CHAT_MODULE, "PopupFlags", GC_EVENT_HIGHLIGHT);
+ DWORD dwLogFlags = db_get_dw(0, CHAT_MODULE, "DiskLogFlags", GC_EVENT_ALL);
for (int i = 0; i < _countof(_eventorder); i++) {
if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
@@ -945,7 +945,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_LOGICONTYPE, CB_SETCURSEL, (g_Settings.bLogSymbols ? 2 : (g_Settings.dwIconFlags ? 1 : 0)), 0);
- CheckDlgButton(m_hwnd, IDC_TRAYONLYFORINACTIVE, M.GetByte(CHAT_MODULE, "TrayIconInactiveOnly", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_TRAYONLYFORINACTIVE, db_get_b(0, CHAT_MODULE, "TrayIconInactiveOnly", 0) ? BST_CHECKED : BST_UNCHECKED);
return true;
}
@@ -1007,13 +1007,13 @@ public: if (wszText)
edtNick.SetText(wszText);
- DWORD dwFlags = M.GetByte(CHAT_MODULE, "HighlightEnabled", CMUCHighlight::MATCH_TEXT);
+ DWORD dwFlags = db_get_b(0, CHAT_MODULE, "HighlightEnabled", CMUCHighlight::MATCH_TEXT);
chkNick.SetState(dwFlags & CMUCHighlight::MATCH_NICKNAME); onChange_Nick(0);
chkText.SetState(dwFlags & CMUCHighlight::MATCH_TEXT); onChange_Text(0);
::CheckDlgButton(m_hwnd, IDC_HIGHLIGHTNICKUID, dwFlags & CMUCHighlight::MATCH_UIN ? BST_CHECKED : BST_UNCHECKED);
- ::CheckDlgButton(m_hwnd, IDC_HIGHLIGHTME, M.GetByte(CHAT_MODULE, "HighlightMe", 1) ? BST_CHECKED : BST_UNCHECKED);
+ ::CheckDlgButton(m_hwnd, IDC_HIGHLIGHTME, db_get_b(0, CHAT_MODULE, "HighlightMe", 1) ? BST_CHECKED : BST_UNCHECKED);
return true;
}
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 0fd56c7b0d..1ecf6702c9 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -487,7 +487,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) */
void Chat_SetFilters(SESSION_INFO *si)
{
- DWORD dwFlags_default = M.GetDword(CHAT_MODULE, "FilterFlags", GC_EVENT_ALL);
+ DWORD dwFlags_default = db_get_dw(0, CHAT_MODULE, "FilterFlags", GC_EVENT_ALL);
DWORD dwFlags_local = db_get_dw(si->hContact, CHAT_MODULE, "FilterFlags", GC_EVENT_ALL);
DWORD dwMask = db_get_dw(si->hContact, CHAT_MODULE, "FilterMask", 0);
@@ -501,7 +501,7 @@ void Chat_SetFilters(SESSION_INFO *si) }
}
- dwFlags_default = M.GetDword(CHAT_MODULE, "PopupFlags", GC_EVENT_HIGHLIGHT);
+ dwFlags_default = db_get_dw(0, CHAT_MODULE, "PopupFlags", GC_EVENT_HIGHLIGHT);
dwFlags_local = db_get_dw(si->hContact, CHAT_MODULE, "PopupFlags", GC_EVENT_HIGHLIGHT);
dwMask = db_get_dw(si->hContact, CHAT_MODULE, "PopupMask", 0);
@@ -512,11 +512,11 @@ void Chat_SetFilters(SESSION_INFO *si) si->iLogPopupFlags = (dwFlags_local & dwBit) ? si->iLogPopupFlags | dwBit : si->iLogPopupFlags & ~dwBit;
}
- dwFlags_default = M.GetDword(CHAT_MODULE, "TrayIconFlags", GC_EVENT_HIGHLIGHT);
+ dwFlags_default = db_get_dw(0, CHAT_MODULE, "TrayIconFlags", GC_EVENT_HIGHLIGHT);
dwFlags_local = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconFlags", GC_EVENT_HIGHLIGHT);
dwMask = db_get_dw(si->hContact, CHAT_MODULE, "TrayIconMask", 0);
- si->iDiskLogFlags = M.GetDword(CHAT_MODULE, "DiskLogFlags", GC_EVENT_ALL);
+ si->iDiskLogFlags = db_get_dw(0, CHAT_MODULE, "DiskLogFlags", GC_EVENT_ALL);
si->iLogTrayFlags = dwFlags_default;
for (int i = 0; i < 32; i++) {
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index e554a73c3b..2b28791964 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -669,7 +669,7 @@ void CChatRoomDlg::onClick_Filter(CCtrlButton *pButton) m_btnFilter.SendMsg(BUTTONSETOVERLAYICON, (LPARAM)(m_bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); - if (m_bFilterEnabled && M.GetByte(CHAT_MODULE, "RightClickFilter", 0) == 0) { + if (m_bFilterEnabled && db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0) { ShowFilterMenu(); return; } @@ -842,7 +842,7 @@ void CChatRoomDlg::UpdateOptions() if (m_si->iType == GCW_CHATROOM) m_btnChannelMgr.Enable(pInfo->bChanMgr); } - m_log.SendMsg(EM_SETBKGNDCOLOR, 0, M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); + m_log.SendMsg(EM_SETBKGNDCOLOR, 0, db_get_dw(0, FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); DM_InitRichEdit(); m_btnOk.SendMsg(BUTTONSETASNORMAL, TRUE, 0); @@ -2157,7 +2157,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) // Typing support for GCW_PRIVMESS sessions if (m_si->iType == GCW_PRIVMESS) { if (m_hContact) { - int iCurrentTypingMode = db_get_b(m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)); + int iCurrentTypingMode = db_get_b(m_hContact, SRMSGMOD, SRMSGSET_TYPING, db_get_b(0, SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)); if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON && iCurrentTypingMode) { DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 3f79b65190..195943ef1d 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -71,7 +71,6 @@ void CContactCache::initPhaseTwo() if (m_isMeta) updateMeta(); updateNick(); - updateFavorite(); } else { m_szAccount = C_INVALID_ACCOUNT; @@ -167,7 +166,7 @@ bool CContactCache::updateUIN() void CContactCache::updateStats(int iType, size_t value) { if (m_stats == nullptr) - allocStats(); + m_stats = new TSessionStats(); switch (iType) { case TSessionStats::UPDATE_WITH_LAST_RCV: @@ -192,14 +191,6 @@ void CContactCache::updateStats(int iType, size_t value) } } -void CContactCache::allocStats() -{ - if (m_stats == nullptr) { - m_stats = new TSessionStats; - memset(m_stats, 0, sizeof(TSessionStats)); - } -} - ///////////////////////////////////////////////////////////////////////////////////////// //set the window data for this contact.The window procedure of the message // dialog will use this in WM_INITDIALOG and WM_DESTROY to tell the cache @@ -390,17 +381,6 @@ void CContactCache::deletedHandler() } ///////////////////////////////////////////////////////////////////////////////////////// -// udpate favorite or recent state.runs when user manually adds -// or removes a user from that list or when database setting is -// changed from elsewhere - -void CContactCache::updateFavorite() -{ - m_isFavorite = M.GetBool(m_hContact, "isFavorite", false); - m_isRecent = M.GetDword(m_hContact, "isRecent", 0) ? true : false; -} - -///////////////////////////////////////////////////////////////////////////////////////// // update all or only the given status message information from the database // // @param szKey: char* database key name or 0 to reload all messages diff --git a/plugins/TabSRMM/src/contactcache.h b/plugins/TabSRMM/src/contactcache.h index cfd4ed4a9e..7f68be3e62 100644 --- a/plugins/TabSRMM/src/contactcache.h +++ b/plugins/TabSRMM/src/contactcache.h @@ -32,12 +32,14 @@ #define C_INVALID_ACCOUNT L"<account error>"
#define HISTORY_INITIAL_ALLOCSIZE 300
-struct TInputHistory {
+struct TInputHistory
+{
wchar_t* szText;
size_t lLen;
};
-struct TSessionStats {
+struct TSessionStats : public MZeroedObject
+{
enum {
BYTES_RECEIVED = 1,
BYTES_SENT = 2,
@@ -75,8 +77,6 @@ struct CContactCache : public MZeroedObject __forceinline bool isMeta() const { return m_isMeta; }
__forceinline bool isSubContact() const { return cc->IsSub(); }
- __forceinline bool isFavorite() const { return m_isFavorite; }
- __forceinline bool isRecent() const { return m_isRecent; }
__forceinline LPCWSTR getRealAccount() const { return m_szAccount ? m_szAccount : C_INVALID_ACCOUNT; }
__forceinline LPCWSTR getUIN() const { return m_szUIN; }
@@ -109,7 +109,7 @@ struct CContactCache : public MZeroedObject void resetMeta();
void closeWindow();
void deletedHandler();
- void updateFavorite();
+
wchar_t* getNormalizedStatusMsg(const wchar_t *src, bool fStripAll = false);
HICON getIcon(int& iSize) const;
@@ -121,7 +121,6 @@ struct CContactCache : public MZeroedObject static int cacheUpdateMetaChanged(WPARAM wParam, LPARAM lParam);
private:
- void allocStats();
void initPhaseTwo();
void allocHistory();
void releaseAlloced();
@@ -136,8 +135,6 @@ private: DWORD m_idleTS;
bool m_isMeta;
bool m_isValid;
- bool m_isFavorite;
- bool m_isRecent;
int m_nMax;
int m_iHistoryCurrent, m_iHistoryTop, m_iHistorySize;
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index 5dae4b1224..d1f3c1b187 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -963,7 +963,7 @@ LONG_PTR CALLBACK CTabBaseDlg::StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM pContainer->dwFlags & CNT_NOSOUND ? TranslateT("disabled") : TranslateT("enabled"));
else if (sid->dwId == MSG_ICON_UTN && (!dat->isChat() || dat->m_si->iType == GCW_PRIVMESS)) {
- int mtnStatus = db_get_b(dat->m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
+ int mtnStatus = db_get_b(dat->m_hContact, SRMSGMOD, SRMSGSET_TYPING, db_get_b(0, SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW));
mir_snwprintf(wBuf, TranslateT("Sending typing notifications is %s."),
mtnStatus ? TranslateT("enabled") : TranslateT("disabled"));
}
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 0e85f99703..3bad09357d 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -65,7 +65,7 @@ static void PU_CleanUp() static void CheckForRemoveMask()
{
- if (!M.GetByte(MODULE, "firsttime", 0) && (nen_options.maskActL & MASK_REMOVE || nen_options.maskActR & MASK_REMOVE || nen_options.maskActTE & MASK_REMOVE)) {
+ if (!db_get_b(0, MODULE, "firsttime", 0) && (nen_options.maskActL & MASK_REMOVE || nen_options.maskActR & MASK_REMOVE || nen_options.maskActTE & MASK_REMOVE)) {
MessageBox(nullptr, TranslateT("One of your popup actions is set to DISMISS EVENT.\nNote that this options may have unwanted side effects as it REMOVES the event from the unread queue.\nThis may lead to events not showing up as \"new\". If you don't want this behavior, please review the 'Event notifications' settings page."), TranslateT("TabSRMM warning message"), MB_OK | MB_ICONSTOP);
db_set_b(0, MODULE, "firsttime", 1);
}
@@ -74,37 +74,37 @@ static void CheckForRemoveMask() int TSAPI NEN_ReadOptions(NEN_OPTIONS *options)
{
- options->bPreview = (BOOL)M.GetByte(MODULE, OPT_PREVIEW, TRUE);
- options->bDefaultColorMsg = (BOOL)M.GetByte(MODULE, OPT_COLDEFAULT_MESSAGE, TRUE);
- options->bDefaultColorOthers = (BOOL)M.GetByte(MODULE, OPT_COLDEFAULT_OTHERS, TRUE);
- options->bDefaultColorErr = (BOOL)M.GetByte(MODULE, OPT_COLDEFAULT_ERR, TRUE);
- options->colBackMsg = (COLORREF)M.GetDword(MODULE, OPT_COLBACK_MESSAGE, DEFAULT_COLBACK);
- options->colTextMsg = (COLORREF)M.GetDword(MODULE, OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT);
- options->colBackOthers = (COLORREF)M.GetDword(MODULE, OPT_COLBACK_OTHERS, DEFAULT_COLBACK);
- options->colTextOthers = (COLORREF)M.GetDword(MODULE, OPT_COLTEXT_OTHERS, DEFAULT_COLTEXT);
- options->colBackErr = (COLORREF)M.GetDword(MODULE, OPT_COLBACK_ERR, DEFAULT_COLBACK);
- options->colTextErr = (COLORREF)M.GetDword(MODULE, OPT_COLTEXT_ERR, DEFAULT_COLTEXT);
- options->maskActL = (UINT)M.GetByte(MODULE, OPT_MASKACTL, DEFAULT_MASKACTL);
- options->maskActR = (UINT)M.GetByte(MODULE, OPT_MASKACTR, DEFAULT_MASKACTR);
- options->maskActTE = (UINT)M.GetByte(MODULE, OPT_MASKACTTE, DEFAULT_MASKACTR) & (MASK_OPEN | MASK_DISMISS);
- options->bMergePopup = (BOOL)M.GetByte(MODULE, OPT_MERGEPOPUP, 0);
- options->iDelayMsg = (int)M.GetDword(MODULE, OPT_DELAY_MESSAGE, DEFAULT_DELAY);
- options->iDelayOthers = (int)M.GetDword(MODULE, OPT_DELAY_OTHERS, DEFAULT_DELAY);
- options->iDelayErr = (int)M.GetDword(MODULE, OPT_DELAY_ERR, DEFAULT_DELAY);
+ options->bPreview = (BOOL)db_get_b(0, MODULE, OPT_PREVIEW, TRUE);
+ options->bDefaultColorMsg = (BOOL)db_get_b(0, MODULE, OPT_COLDEFAULT_MESSAGE, TRUE);
+ options->bDefaultColorOthers = (BOOL)db_get_b(0, MODULE, OPT_COLDEFAULT_OTHERS, TRUE);
+ options->bDefaultColorErr = (BOOL)db_get_b(0, MODULE, OPT_COLDEFAULT_ERR, TRUE);
+ options->colBackMsg = db_get_dw(0, MODULE, OPT_COLBACK_MESSAGE, DEFAULT_COLBACK);
+ options->colTextMsg = db_get_dw(0, MODULE, OPT_COLTEXT_MESSAGE, DEFAULT_COLTEXT);
+ options->colBackOthers = db_get_dw(0, MODULE, OPT_COLBACK_OTHERS, DEFAULT_COLBACK);
+ options->colTextOthers = db_get_dw(0, MODULE, OPT_COLTEXT_OTHERS, DEFAULT_COLTEXT);
+ options->colBackErr = db_get_dw(0, MODULE, OPT_COLBACK_ERR, DEFAULT_COLBACK);
+ options->colTextErr = db_get_dw(0, MODULE, OPT_COLTEXT_ERR, DEFAULT_COLTEXT);
+ options->maskActL = (UINT)db_get_b(0, MODULE, OPT_MASKACTL, DEFAULT_MASKACTL);
+ options->maskActR = (UINT)db_get_b(0, MODULE, OPT_MASKACTR, DEFAULT_MASKACTR);
+ options->maskActTE = (UINT)db_get_b(0, MODULE, OPT_MASKACTTE, DEFAULT_MASKACTR) & (MASK_OPEN | MASK_DISMISS);
+ options->bMergePopup = (BOOL)db_get_b(0, MODULE, OPT_MERGEPOPUP, 0);
+ options->iDelayMsg = db_get_dw(0, MODULE, OPT_DELAY_MESSAGE, DEFAULT_DELAY);
+ options->iDelayOthers = db_get_dw(0, MODULE, OPT_DELAY_OTHERS, DEFAULT_DELAY);
+ options->iDelayErr = db_get_dw(0, MODULE, OPT_DELAY_ERR, DEFAULT_DELAY);
options->iDelayDefault = (int)DBGetContactSettingRangedWord(0, "Popup", "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX);
- options->bShowHeaders = (BYTE)M.GetByte(MODULE, OPT_SHOW_HEADERS, FALSE);
- options->bNoRSS = (BOOL)M.GetByte(MODULE, OPT_NORSS, FALSE);
- options->iDisable = (BYTE)M.GetByte(MODULE, OPT_DISABLE, 0);
- options->iMUCDisable = (BYTE)M.GetByte(MODULE, OPT_MUCDISABLE, 0);
- options->dwStatusMask = (DWORD)M.GetDword(MODULE, "statusmask", (DWORD)-1);
- options->bTraySupport = (BOOL)M.GetByte(MODULE, "traysupport", 0);
- options->bWindowCheck = (BOOL)M.GetByte(MODULE, OPT_WINDOWCHECK, 0);
- options->bNoRSS = (BOOL)M.GetByte(MODULE, OPT_NORSS, 0);
- options->iLimitPreview = (int)M.GetDword(MODULE, OPT_LIMITPREVIEW, 0);
+ options->bShowHeaders = (BYTE)db_get_b(0, MODULE, OPT_SHOW_HEADERS, FALSE);
+ options->bNoRSS = (BOOL)db_get_b(0, MODULE, OPT_NORSS, FALSE);
+ options->iDisable = (BYTE)db_get_b(0, MODULE, OPT_DISABLE, 0);
+ options->iMUCDisable = (BYTE)db_get_b(0, MODULE, OPT_MUCDISABLE, 0);
+ options->dwStatusMask = db_get_dw(0, MODULE, "statusmask", (DWORD)-1);
+ options->bTraySupport = (BOOL)db_get_b(0, MODULE, "traysupport", 0);
+ options->bWindowCheck = (BOOL)db_get_b(0, MODULE, OPT_WINDOWCHECK, 0);
+ options->bNoRSS = (BOOL)db_get_b(0, MODULE, OPT_NORSS, 0);
+ options->iLimitPreview = db_get_dw(0, MODULE, OPT_LIMITPREVIEW, 0);
options->wMaxFavorites = 15;
options->wMaxRecent = 15;
- options->dwRemoveMask = M.GetDword(MODULE, OPT_REMOVEMASK, 0);
- options->bDisableNonMessage = M.GetByte(MODULE, "disablenonmessage", 0);
+ options->dwRemoveMask = db_get_dw(0, MODULE, OPT_REMOVEMASK, 0);
+ options->bDisableNonMessage = db_get_b(0, MODULE, "disablenonmessage", 0);
CheckForRemoveMask();
return 0;
}
@@ -548,7 +548,7 @@ static INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPA break;
case IDC_POPUPSTATUSMODES:
- CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), hWnd, DlgProcSetupStatusModes, M.GetDword(MODULE, "statusmask", (DWORD)-1));
+ CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHOOSESTATUSMODES), hWnd, DlgProcSetupStatusModes, db_get_dw(0, MODULE, "statusmask", (DWORD)-1));
break;
default:
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 6ce5bbe22f..ab55da5749 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -337,24 +337,24 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar case IDC_INFOPANELMENU: submenu = GetSubMenu(PluginConfig.g_hMenuContext, 7); GetWindowRect(GetDlgItem(m_hwnd, IDC_NAME), &rc); - - EnableMenuItem(submenu, ID_FAVORITES_ADDCONTACTTOFAVORITES, !m_cache->isFavorite() ? MF_ENABLED : MF_GRAYED); - EnableMenuItem(submenu, ID_FAVORITES_REMOVECONTACTFROMFAVORITES, !m_cache->isFavorite() ? MF_GRAYED : MF_ENABLED); - + { + bool bIsFavorite = M.IsFavorite(m_hContact); + EnableMenuItem(submenu, ID_FAVORITES_ADDCONTACTTOFAVORITES, !bIsFavorite ? MF_ENABLED : MF_GRAYED); + EnableMenuItem(submenu, ID_FAVORITES_REMOVECONTACTFROMFAVORITES, bIsFavorite ? MF_ENABLED : MF_GRAYED); + } iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, nullptr); switch (iSelection) { case ID_FAVORITES_ADDCONTACTTOFAVORITES: - db_set_b(m_hContact, SRMSGMOD_T, "isFavorite", 1); + M.SetFavorite(m_hContact, 1); AddContactToFavorites(m_hContact, m_cache->getNick(), m_cache->getProto(), m_wszStatus, m_wStatus, Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()), 1, PluginConfig.g_hMenuFavorites); break; case ID_FAVORITES_REMOVECONTACTFROMFAVORITES: - db_set_b(m_hContact, SRMSGMOD_T, "isFavorite", 0); + M.SetFavorite(m_hContact, 0); DeleteMenu(PluginConfig.g_hMenuFavorites, m_hContact, MF_BYCOMMAND); break; } - m_cache->updateFavorite(); break; case IDC_SENDMENU: @@ -500,7 +500,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar case IDC_SELFTYPING: if (m_hContact) { - int iCurrentTypingMode = db_get_b(m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)); + int iCurrentTypingMode = db_get_b(m_hContact, SRMSGMOD, SRMSGSET_TYPING, db_get_b(0, SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)); if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON && iCurrentTypingMode) { DM_NotifyTyping(PROTOTYPE_SELFTYPING_OFF); @@ -780,8 +780,8 @@ HWND CTabBaseDlg::DM_CreateClist() if (hItem) SendMessage(hwndClist, CLM_SETCHECKMARK, (WPARAM)hItem, 1); - SendMessage(hwndClist, CLM_SETHIDEEMPTYGROUPS, M.GetByte("CList", "HideEmptyGroups", SETTING_USEGROUPS_DEFAULT), 0); - SendMessage(hwndClist, CLM_SETUSEGROUPS, M.GetByte("CList", "UseGroups", SETTING_USEGROUPS_DEFAULT), 0); + SendMessage(hwndClist, CLM_SETHIDEEMPTYGROUPS, db_get_b(0, "CList", "HideEmptyGroups", SETTING_USEGROUPS_DEFAULT), 0); + SendMessage(hwndClist, CLM_SETUSEGROUPS, db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT), 0); SendMessage(hwndClist, CLM_FIRST + 106, 0, 1); SendMessage(hwndClist, CLM_AUTOREBUILD, 0, 0); if (hwndClist) @@ -903,7 +903,7 @@ void CTabBaseDlg::DM_NotifyTyping(int mode) return; // allow supression of sending out TN for the contact (NOTE: for metacontacts, do NOT use the subcontact handle) - if (!db_get_b(hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW))) + if (!db_get_b(hContact, SRMSGMOD, SRMSGSET_TYPING, db_get_b(0, SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW))) return; if (szProto == nullptr) // should not, but who knows... @@ -929,7 +929,7 @@ void CTabBaseDlg::DM_NotifyTyping(int mode) // don't send to contacts which are not permanently added to the contact list, // unless the option to ignore added status is set. - if (db_get_b(m_hContact, "CList", "NotOnList", 0) && !M.GetByte(SRMSGMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) + if (db_get_b(m_hContact, "CList", "NotOnList", 0) && !db_get_b(0, SRMSGMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) return; // End user check @@ -1329,7 +1329,7 @@ void CTabBaseDlg::DrawStatusIcons(HDC hDC, const RECT &rc, int gap) if (!isChat() || m_si->iType == GCW_PRIVMESS) { DrawIconEx(hDC, x, y, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING], PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); - DrawIconEx(hDC, x, y, db_get_b(m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)) ? + DrawIconEx(hDC, x, y, db_get_b(m_hContact, SRMSGMOD, SRMSGSET_TYPING, db_get_b(0, SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)) ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); } else CSkin::DrawDimmedIcon(hDC, x, y, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING], 50); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index c3a315e2ce..fea9413e26 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -146,7 +146,7 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_bLogStatusChanges = M.GetBool("logstatuschanges", false);
m_bUseDividers = M.GetBool("usedividers", false);
m_bDividersUsePopupConfig = M.GetBool("div_popupconfig", false);
- m_MsgTimeout = M.GetDword(SRMSGMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
+ m_MsgTimeout = db_get_dw(0, SRMSGMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
if (m_MsgTimeout < SRMSGSET_MSGTIMEOUT_MIN)
m_MsgTimeout = SRMSGSET_MSGTIMEOUT_MIN;
@@ -162,36 +162,36 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_SendFormat = M.GetByte("sendformat", 0);
m_TabAppearance = M.GetDword("tabconfig", TCF_FLASHICON | TCF_SINGLEROWTABCONTROL);
m_panelHeight = (DWORD)M.GetDword("panelheight", CInfoPanel::DEGRADE_THRESHOLD);
- m_MUCpanelHeight = M.GetDword(CHAT_MODULE, "panelheight", CInfoPanel::DEGRADE_THRESHOLD);
+ m_MUCpanelHeight = db_get_dw(0, CHAT_MODULE, "panelheight", CInfoPanel::DEGRADE_THRESHOLD);
m_bIdleDetect = M.GetBool("dimIconsForIdleContacts", true);
m_smcxicon = m_smcyicon = 16;
m_PasteAndSend = M.GetByte("pasteandsend", 1);
m_LangPackCP = Langpack_GetDefaultCodePage();
m_visualMessageSizeIndicator = M.GetByte("msgsizebar", 0);
m_autoSplit = M.GetByte("autosplit", 0);
- m_FlashOnMTN = M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINFLASH, SRMSGDEFSET_SHOWTYPINGWINFLASH);
+ m_FlashOnMTN = db_get_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGWINFLASH, SRMSGDEFSET_SHOWTYPINGWINFLASH);
if (m_MenuBar == nullptr) {
m_MenuBar = ::LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_MENUBAR));
TranslateMenu(m_MenuBar);
}
- m_ipBackgroundGradient = M.GetDword(FONTMODULE, "ipfieldsbg", 0x62caff);
+ m_ipBackgroundGradient = db_get_dw(0, FONTMODULE, "ipfieldsbg", 0x62caff);
if (0 == m_ipBackgroundGradient)
m_ipBackgroundGradient = 0x62caff;
- m_ipBackgroundGradientHigh = M.GetDword(FONTMODULE, "ipfieldsbgHigh", 0xf0f0f0);
+ m_ipBackgroundGradientHigh = db_get_dw(0, FONTMODULE, "ipfieldsbgHigh", 0xf0f0f0);
if (0 == m_ipBackgroundGradientHigh)
m_ipBackgroundGradientHigh = 0xf0f0f0;
- m_tbBackgroundHigh = M.GetDword(FONTMODULE, "tbBgHigh", 0);
- m_tbBackgroundLow = M.GetDword(FONTMODULE, "tbBgLow", 0);
- m_fillColor = M.GetDword(FONTMODULE, "fillColor", 0);
+ m_tbBackgroundHigh = db_get_dw(0, FONTMODULE, "tbBgHigh", 0);
+ m_tbBackgroundLow = db_get_dw(0, FONTMODULE, "tbBgLow", 0);
+ m_fillColor = db_get_dw(0, FONTMODULE, "fillColor", 0);
if (CSkin::m_BrushFill) {
::DeleteObject(CSkin::m_BrushFill);
CSkin::m_BrushFill = nullptr;
}
- m_genericTxtColor = M.GetDword(FONTMODULE, "genericTxtClr", GetSysColor(COLOR_BTNTEXT));
- m_cRichBorders = M.GetDword(FONTMODULE, "cRichBorders", 0);
+ m_genericTxtColor = db_get_dw(0, FONTMODULE, "genericTxtClr", GetSysColor(COLOR_BTNTEXT));
+ m_cRichBorders = db_get_dw(0, FONTMODULE, "cRichBorders", 0);
::memcpy(&globalContainerSettings, &_cnt_default, sizeof(TContainerSettings));
Utils::ReadContainerSettingsFromDB(0, &globalContainerSettings);
@@ -357,11 +357,6 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) if (!c->isValid())
c->resetMeta(); // restart constructor
- // catch own relevant settings
- if (!strcmp(cws->szModule, SRMSGMOD_T))
- if (!strcmp(setting, "isFavorite") || !strcmp(setting, "isRecent"))
- c->updateFavorite();
-
// neither clist nor contact's settings -> skip
if (strcmp(cws->szModule, "CList") && strcmp(cws->szModule, szProto))
return 0;
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index e388ce109c..69246d827e 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -214,7 +214,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode) hContact = hMeta; } - if (hwnd && M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING)) + if (hwnd && db_get_b(0, SRMSGMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING)) preTyping = SendMessage(hwnd, DM_TYPING, 0, mode); if (hwnd && IsWindowVisible(hwnd)) @@ -229,10 +229,10 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode) return 0; } - if (M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST)) { - if (!hwnd && !M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGNOWINOPEN, 1)) + if (db_get_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST)) { + if (!hwnd && !db_get_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGNOWINOPEN, 1)) fShowOnClist = false; - if (hwnd && !M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINOPEN, 1)) + if (hwnd && !db_get_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGWINOPEN, 1)) fShowOnClist = false; } else fShowOnClist = false; @@ -240,7 +240,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode) if ((!foundWin || !(pContainer->dwFlags & CNT_NOSOUND)) && preTyping != (mode != 0)) Skin_PlaySound(mode ? "TNStart" : "TNStop"); - if (M.GetByte(SRMSGMOD, "ShowTypingPopup", 0)) { + if (db_get_b(0, SRMSGMOD, "ShowTypingPopup", 0)) { BOOL fShow = false; int iMode = M.GetByte("MTN_PopupMode", 0); @@ -272,7 +272,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode) if (mode) { wchar_t szTip[256]; mir_snwprintf(szTip, TranslateT("%s is typing a message"), Clist_GetContactDisplayName(hContact)); - if (fShowOnClist && M.GetByte(SRMSGMOD, "ShowTypingBalloon", 0)) + if (fShowOnClist && db_get_b(0, SRMSGMOD, "ShowTypingBalloon", 0)) Clist_TrayNotifyW(nullptr, TranslateT("Typing notification"), szTip, NIIF_INFO, 1000 * 4); if (fShowOnClist) { diff --git a/plugins/TabSRMM/src/mim.h b/plugins/TabSRMM/src/mim.h index 0aea60b9e5..ca8f45abb8 100644 --- a/plugins/TabSRMM/src/mim.h +++ b/plugins/TabSRMM/src/mim.h @@ -97,43 +97,42 @@ public: * database functions
*/
- static DWORD __forceinline GetDword(const char *szModule, const char *szSetting, DWORD uDefault)
- {
- 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);
+ { return db_get_dw(0, SRMSGMOD_T, szSetting, uDefault);
}
static DWORD __forceinline GetDword(const MCONTACT hContact, const char *szSetting, DWORD uDefault)
- {
- return db_get_dw(hContact, SRMSGMOD_T, szSetting, 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);
+ { return db_get_b(0, SRMSGMOD_T, szSetting, uDefault);
}
static int __forceinline GetByte(const MCONTACT hContact, const char *szSetting, int uDefault)
- {
- return db_get_b(hContact, SRMSGMOD_T, szSetting, uDefault);
+ { return db_get_b(hContact, SRMSGMOD_T, szSetting, uDefault);
}
static bool __forceinline GetBool(const char *szSetting, bool bDefault)
- {
- return db_get_b(0, SRMSGMOD_T, szSetting, bDefault) != 0;
+ { return db_get_b(0, SRMSGMOD_T, szSetting, bDefault) != 0;
}
static bool __forceinline GetBool(const char *szModule, const char *szSetting, bool bDefault)
- {
- return db_get_b(0, szModule, szSetting, bDefault) != 0;
+ { return db_get_b(0, szModule, szSetting, bDefault) != 0;
}
static bool __forceinline GetBool(const MCONTACT hContact, const char *szSetting, bool bDefault)
- {
- return db_get_b(hContact, SRMSGMOD_T, szSetting, bDefault) != 0;
+ { return db_get_b(hContact, SRMSGMOD_T, szSetting, bDefault) != 0;
+ }
+
+ static bool __forceinline IsFavorite(const MCONTACT hContact)
+ { return db_get_b(hContact, SRMSGMOD_T, "isFavorite", false);
+ }
+ static void __forceinline SetFavorite(const MCONTACT hContact, bool bValue)
+ { db_set_b(hContact, SRMSGMOD_T, "isFavorite", bValue);
+ }
+
+ static DWORD __forceinline IsRecent(const MCONTACT hContact)
+ { return db_get_dw(hContact, SRMSGMOD_T, "isRecent", 0);
+ }
+ static void __forceinline SetRecent(const MCONTACT hContact, DWORD dwValue)
+ { db_set_dw(hContact, SRMSGMOD_T, "isRecent", dwValue);
}
/*
@@ -149,9 +148,6 @@ public: void configureCustomFolders();
INT_PTR foldersPathChanged();
- void startTimer();
- void stopTimer(const char *szMsg = nullptr);
-
__forceinline __int64 getTimerStart() const { return m_tStart; }
__forceinline __int64 getTimerStop() const { return m_tStop; }
__forceinline __int64 getTicks() const { return m_tStop - m_tStart; }
diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp index 6052e090d6..aee87efd84 100644 --- a/plugins/TabSRMM/src/modplus.cpp +++ b/plugins/TabSRMM/src/modplus.cpp @@ -86,7 +86,7 @@ static int CustomButtonPressed(WPARAM wParam, LPARAM lParam) CMStringW pwszFormatedText;
if (cbcd->flags & BBCF_RIGHTBUTTON) {
- int menulimit = M.GetByte("tabmodplus", "MenuCount", 0);
+ int menulimit = db_get_b(0, "tabmodplus", "MenuCount", 0);
if (menulimit != 0) {
HMENU hMenu = CreatePopupMenu();
LIST<wchar_t> arMenuLines(1);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index f64daf18c7..823515e596 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -662,7 +662,7 @@ bool CSrmmWindow::OnInitDialog() GetMyNick();
- m_iMultiSplit = (int)M.GetDword(SRMSGMOD, "multisplit", 150);
+ m_iMultiSplit = db_get_dw(0, SRMSGMOD, "multisplit", 150);
m_nTypeMode = PROTOTYPE_SELFTYPING_OFF;
SetTimer(m_hwnd, TIMERID_TYPE, 1000, nullptr);
m_iLastEventType = 0xffffffff;
@@ -1044,13 +1044,11 @@ void CSrmmWindow::UpdateTitle() m_pContainer->UpdateTitle(m_hContact);
UpdateTrayMenuState(this, TRUE);
- if (m_cache->isFavorite())
- AddContactToFavorites(m_hContact, m_cache->getNick(), szActProto, m_wszStatus, m_wStatus,
- Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()), 0, PluginConfig.g_hMenuFavorites);
+ if (M.IsFavorite(m_hContact))
+ AddContactToFavorites(m_hContact, m_cache->getNick(), szActProto, m_wszStatus, m_wStatus, Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()), 0, PluginConfig.g_hMenuFavorites);
- if (m_cache->isRecent())
- AddContactToFavorites(m_hContact, m_cache->getNick(), szActProto, m_wszStatus, m_wStatus,
- Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()), 0, PluginConfig.g_hMenuRecent);
+ if (M.IsRecent(m_hContact))
+ AddContactToFavorites(m_hContact, m_cache->getNick(), szActProto, m_wszStatus, m_wStatus, Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()), 0, PluginConfig.g_hMenuRecent);
m_pPanel.Invalidate();
if (m_pWnd)
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index b870db669d..b30e050518 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -1116,7 +1116,7 @@ void CTabBaseDlg::FindFirstEvent() {
int historyMode = db_get_b(m_hContact, SRMSGMOD, SRMSGSET_LOADHISTORY, -1);
if (historyMode == -1)
- historyMode = (int)M.GetByte(SRMSGMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY);
+ historyMode = (int)db_get_b(0, SRMSGMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY);
m_hDbEventFirst = db_event_firstUnread(m_hContact);
@@ -1453,16 +1453,16 @@ int CTabBaseDlg::MsgWindowDrawHandler(DRAWITEMSTRUCT *dis) void TSAPI LoadThemeDefaults(TContainerData *pContainer)
{
memset(&pContainer->theme, 0, sizeof(TLogTheme));
- pContainer->theme.bg = M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, GetSysColor(COLOR_WINDOW));
+ pContainer->theme.bg = db_get_dw(0, FONTMODULE, SRMSGSET_BKGCOLOUR, GetSysColor(COLOR_WINDOW));
pContainer->theme.statbg = PluginConfig.crStatus;
pContainer->theme.oldinbg = PluginConfig.crOldIncoming;
pContainer->theme.oldoutbg = PluginConfig.crOldOutgoing;
pContainer->theme.inbg = PluginConfig.crIncoming;
pContainer->theme.outbg = PluginConfig.crOutgoing;
- pContainer->theme.hgrid = M.GetDword(FONTMODULE, "hgrid", RGB(224, 224, 224));
+ pContainer->theme.hgrid = db_get_dw(0, FONTMODULE, "hgrid", RGB(224, 224, 224));
pContainer->theme.left_indent = M.GetDword("IndentAmount", 20) * 15;
pContainer->theme.right_indent = M.GetDword("RightIndent", 20) * 15;
- pContainer->theme.inputbg = M.GetDword(FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR);
+ pContainer->theme.inputbg = db_get_dw(0, FONTMODULE, "inputbg", SRMSGDEFSET_BKGCOLOUR);
for (int i = 1; i <= 5; i++) {
char szTemp[40];
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index f927814879..7ad9f53771 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -147,11 +147,11 @@ void TSAPI CacheLogFonts() ReleaseDC(PluginConfig.g_hwndHotkeyHandler, hdc);
PluginConfig.hFontCaption = CInfoPanel::m_ipConfig.hFonts[IPFONTCOUNT - 1];
- PluginConfig.crIncoming = M.GetDword(FONTMODULE, "inbg", SRMSGDEFSET_BKGINCOLOUR);
- PluginConfig.crOutgoing = M.GetDword(FONTMODULE, "outbg", SRMSGDEFSET_BKGOUTCOLOUR);
- PluginConfig.crStatus = M.GetDword(FONTMODULE, "statbg", SRMSGDEFSET_BKGCOLOUR);
- PluginConfig.crOldIncoming = M.GetDword(FONTMODULE, "oldinbg", SRMSGDEFSET_BKGINCOLOUR);
- PluginConfig.crOldOutgoing = M.GetDword(FONTMODULE, "oldoutbg", SRMSGDEFSET_BKGOUTCOLOUR);
+ PluginConfig.crIncoming = db_get_dw(0, FONTMODULE, "inbg", SRMSGDEFSET_BKGINCOLOUR);
+ PluginConfig.crOutgoing = db_get_dw(0, FONTMODULE, "outbg", SRMSGDEFSET_BKGOUTCOLOUR);
+ PluginConfig.crStatus = db_get_dw(0, FONTMODULE, "statbg", SRMSGDEFSET_BKGCOLOUR);
+ PluginConfig.crOldIncoming = db_get_dw(0, FONTMODULE, "oldinbg", SRMSGDEFSET_BKGINCOLOUR);
+ PluginConfig.crOldOutgoing = db_get_dw(0, FONTMODULE, "oldoutbg", SRMSGDEFSET_BKGOUTCOLOUR);
}
void FreeLogFonts()
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 7c73a4bac9..8730257d47 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -688,7 +688,7 @@ public: {
DWORD dwFlags = M.GetDword("mwflags", MWF_LOG_DEFAULT);
- switch (M.GetByte(SRMSGMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) {
+ switch (db_get_b(0, SRMSGMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) {
case LOADHISTORY_UNREAD:
chkLoadUnread.SetState(true);
break;
@@ -859,7 +859,7 @@ class COptTypingDlg : public CDlgBase void ResetCList()
{
- if (!M.GetByte("CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
+ if (!db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT))
SendDlgItemMessage(m_hwnd, IDC_CLIST, CLM_SETUSEGROUPS, FALSE, 0);
else
SendDlgItemMessage(m_hwnd, IDC_CLIST, CLM_SETUSEGROUPS, TRUE, 0);
@@ -868,11 +868,11 @@ class COptTypingDlg : public CDlgBase void RebuildList()
{
- BYTE defType = M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW);
+ BYTE defType = db_get_b(0, SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW);
if (hItemNew && defType)
SendDlgItemMessage(m_hwnd, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItemNew, 1);
- if (hItemUnknown && M.GetByte(SRMSGMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN))
+ if (hItemUnknown && db_get_b(0, SRMSGMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN))
SendDlgItemMessage(m_hwnd, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItemUnknown, 1);
for (auto &hContact : Contacts()) {
@@ -926,15 +926,15 @@ public: SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_CLIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(m_hwnd, IDC_CLIST), GWL_STYLE) | (CLS_SHOWHIDDEN));
ResetCList();
- CheckDlgButton(m_hwnd, IDC_SHOWNOTIFY, M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_TYPEFLASHWIN, M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINFLASH, SRMSGDEFSET_SHOWTYPINGWINFLASH) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SHOWNOTIFY, db_get_b(0, SRMSGMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_TYPEFLASHWIN, db_get_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGWINFLASH, SRMSGDEFSET_SHOWTYPINGWINFLASH) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_TYPENOWIN, M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGNOWINOPEN, 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_TYPEWIN, M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGWINOPEN, 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_NOTIFYTRAY, M.GetByte(SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_NOTIFYBALLOON, M.GetByte(SRMSGMOD, "ShowTypingBalloon", 0));
+ CheckDlgButton(m_hwnd, IDC_TYPENOWIN, db_get_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGNOWINOPEN, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_TYPEWIN, db_get_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGWINOPEN, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_NOTIFYTRAY, db_get_b(0, SRMSGMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_NOTIFYBALLOON, db_get_b(0, SRMSGMOD, "ShowTypingBalloon", 0));
- CheckDlgButton(m_hwnd, IDC_NOTIFYPOPUP, M.GetByte(SRMSGMOD, "ShowTypingPopup", 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_NOTIFYPOPUP, db_get_b(0, SRMSGMOD, "ShowTypingPopup", 0) ? BST_CHECKED : BST_UNCHECKED);
Utils::enableDlgControl(m_hwnd, IDC_TYPEWIN, IsDlgButtonChecked(m_hwnd, IDC_NOTIFYTRAY) != 0);
Utils::enableDlgControl(m_hwnd, IDC_TYPENOWIN, IsDlgButtonChecked(m_hwnd, IDC_NOTIFYTRAY) != 0);
@@ -1393,11 +1393,11 @@ DWORD OptCheckBox_LoadValue(struct OptCheckBox *cb) case CBVT_NONE:
switch (cb->dbType) {
case DBVT_BYTE:
- return M.GetByte(cb->dbModule, cb->dbSetting, cb->defValue);
+ return db_get_b(0, cb->dbModule, cb->dbSetting, cb->defValue);
case DBVT_WORD:
return db_get_w(0, cb->dbModule, cb->dbSetting, cb->defValue);
case DBVT_DWORD:
- return M.GetDword(cb->dbModule, cb->dbSetting, cb->defValue);
+ return db_get_dw(0, cb->dbModule, cb->dbSetting, cb->defValue);
}
break;
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 5161067678..2c2374ab9c 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -255,16 +255,16 @@ void CTabBaseDlg::NotifyDeliveryFailure() const wcsncpy_s(ppd.lptzContactName, m_cache->getNick(), _TRUNCATE);
wcsncpy_s(ppd.lptzText, TranslateT("A message delivery has failed.\nClick to open the message window."), _TRUNCATE);
- if (!(BOOL)M.GetByte(MODULE, OPT_COLDEFAULT_ERR, TRUE)) {
- ppd.colorText = (COLORREF)M.GetDword(MODULE, OPT_COLTEXT_ERR, DEFAULT_COLTEXT);
- ppd.colorBack = (COLORREF)M.GetDword(MODULE, OPT_COLBACK_ERR, DEFAULT_COLBACK);
+ if (!(BOOL)db_get_b(0, MODULE, OPT_COLDEFAULT_ERR, TRUE)) {
+ ppd.colorText = (COLORREF)db_get_dw(0, MODULE, OPT_COLTEXT_ERR, DEFAULT_COLTEXT);
+ ppd.colorBack = (COLORREF)db_get_dw(0, MODULE, OPT_COLBACK_ERR, DEFAULT_COLBACK);
}
else ppd.colorText = ppd.colorBack = 0;
ppd.PluginWindowProc = Utils::PopupDlgProcError;
ppd.lchIcon = PluginConfig.g_iconErr;
ppd.PluginData = nullptr;
- ppd.iSeconds = (int)M.GetDword(MODULE, OPT_DELAY_ERR, (DWORD)DEFAULT_DELAY);
+ ppd.iSeconds = (int)db_get_dw(0, MODULE, OPT_DELAY_ERR, (DWORD)DEFAULT_DELAY);
PUAddPopupT(&ppd);
}
diff --git a/plugins/TabSRMM/src/muchighlight.cpp b/plugins/TabSRMM/src/muchighlight.cpp index afbbcb907f..839e313922 100644 --- a/plugins/TabSRMM/src/muchighlight.cpp +++ b/plugins/TabSRMM/src/muchighlight.cpp @@ -58,8 +58,8 @@ void CMUCHighlight::init() if (0 == db_get_ws(0, CHAT_MODULE, "HighlightNames", &dbv))
m_NickPatternString = dbv.pwszVal;
- m_dwFlags = M.GetByte(CHAT_MODULE, "HighlightEnabled", MATCH_TEXT);
- m_fHighlightMe = (M.GetByte(CHAT_MODULE, "HighlightMe", 1) ? true : false);
+ m_dwFlags = db_get_b(0, CHAT_MODULE, "HighlightEnabled", MATCH_TEXT);
+ m_fHighlightMe = (db_get_b(0, CHAT_MODULE, "HighlightMe", 1) ? true : false);
tokenize(m_TextPatternString, m_TextPatterns, m_iTextPatterns);
tokenize(m_NickPatternString, m_NickPatterns, m_iNickPatterns);
diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 88c7c38328..d257ccb812 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -372,7 +372,7 @@ void CProxyWindow::sendPreview() HBITMAP hbmRich = CSkin::CreateAeroCompatibleBitmap(rcRich, hdcRich);
HBITMAP hbmRichOld = reinterpret_cast<HBITMAP>(::SelectObject(hdcRich, hbmRich));
- COLORREF clr = fIsChat ? M.GetDword(FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR) : m_dat->m_pContainer->theme.inbg;
+ COLORREF clr = fIsChat ? db_get_dw(0, FONTMODULE, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR) : m_dat->m_pContainer->theme.inbg;
HBRUSH br = ::CreateSolidBrush(clr);
::FillRect(hdcRich, &rcRich, br);
::DeleteObject(br);
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index b82440d908..d28ee841a1 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -99,12 +99,12 @@ void LoadDefaultTemplates() LTR_Active = LTR_Default; RTL_Active = RTL_Default; - if (M.GetByte(RTLTEMPLATES_MODULE, "setup", 0) < 2) { + if (db_get_b(0, RTLTEMPLATES_MODULE, "setup", 0) < 2) { for (int i = 0; i <= TMPL_ERRMSG; i++) db_set_ws(0, RTLTEMPLATES_MODULE, TemplateNames[i], RTL_Default.szTemplates[i]); db_set_b(0, RTLTEMPLATES_MODULE, "setup", 2); } - if (M.GetByte(TEMPLATES_MODULE, "setup", 0) < 2) { + if (db_get_b(0, TEMPLATES_MODULE, "setup", 0) < 2) { for (int i = 0; i <= TMPL_ERRMSG; i++) db_set_ws(0, TEMPLATES_MODULE, TemplateNames[i], LTR_Default.szTemplates[i]); db_set_b(0, TEMPLATES_MODULE, "setup", 2); diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp index 5916d9f7cb..d98ec5e22b 100644 --- a/plugins/TabSRMM/src/themeio.cpp +++ b/plugins/TabSRMM/src/themeio.cpp @@ -199,23 +199,23 @@ void TSAPI WriteThemeToINI(const wchar_t *szIniFilenameT, CSrmmWindow *dat) db_free(&dbv);
}
mir_snprintf(szTemp, "Font%dCol", firstIndex + i);
- WritePrivateProfileStringA(szAppname, "Color", _itoa(M.GetDword(szModule, szTemp, 0), szBuf, 10), szIniFilename);
+ WritePrivateProfileStringA(szAppname, "Color", _itoa(db_get_dw(0, szModule, szTemp, 0), szBuf, 10), szIniFilename);
mir_snprintf(szTemp, "Font%dSty", firstIndex + i);
- WritePrivateProfileStringA(szAppname, "Style", _itoa(M.GetByte(szModule, szTemp, 0), szBuf, 10), szIniFilename);
+ WritePrivateProfileStringA(szAppname, "Style", _itoa(db_get_b(0, szModule, szTemp, 0), szBuf, 10), szIniFilename);
mir_snprintf(szTemp, "Font%dSize", firstIndex + i);
- WritePrivateProfileStringA(szAppname, "Size", _itoa(M.GetByte(szModule, szTemp, 0), szBuf, 10), szIniFilename);
+ WritePrivateProfileStringA(szAppname, "Size", _itoa(db_get_b(0, szModule, szTemp, 0), szBuf, 10), szIniFilename);
mir_snprintf(szTemp, "Font%dSet", firstIndex + i);
- WritePrivateProfileStringA(szAppname, "Set", _itoa(M.GetByte(szModule, szTemp, 0), szBuf, 10), szIniFilename);
+ WritePrivateProfileStringA(szAppname, "Set", _itoa(db_get_b(0, szModule, szTemp, 0), szBuf, 10), szIniFilename);
}
n++;
}
def = SRMSGDEFSET_BKGCOLOUR;
for (auto &it : _extSettings)
- WritePrivateProfileStringA(it.szIniSection, it.szIniName, _itoa(M.GetDword(it.szDbModule, it.szDbSetting, it.dwDef), szBuf, 10), szIniFilename);
+ WritePrivateProfileStringA(it.szIniSection, it.szIniName, _itoa(db_get_dw(0, it.szDbModule, it.szDbSetting, it.dwDef), szBuf, 10), szIniFilename);
for (auto &it : _extSettings_v5)
- WritePrivateProfileStringA(it.szIniSection, it.szIniName, _itoa(M.GetDword(it.szDbModule, it.szDbSetting, it.dwDef), szBuf, 10), szIniFilename);
+ WritePrivateProfileStringA(it.szIniSection, it.szIniName, _itoa(db_get_dw(0, it.szDbModule, it.szDbSetting, it.dwDef), szBuf, 10), szIniFilename);
WritePrivateProfileStringA("Message Log", "VGrid", _itoa(M.GetByte("wantvgrid", 0), szBuf, 10), szIniFilename);
WritePrivateProfileStringA("Message Log", "ExtraMicroLF", _itoa(M.GetByte("extramicrolf", 0), szBuf, 10), szIniFilename);
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index cb9db3de87..2c6e8ec08b 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -1768,7 +1768,7 @@ void CSkin::setupAeroSkins() fib = (FIBITMAP *)Image_Load(tszFilename, IMGL_RETURNDIB);
- COLORREF glowColor = M.GetDword(FONTMODULE, "aeroGlow", RGB(40, 40, 255));
+ COLORREF glowColor = db_get_dw(0, FONTMODULE, "aeroGlow", RGB(40, 40, 255));
hbm = FreeImage_CreateHBITMAPFromDIB(fib);
CImageItem::Colorize(hbm, GetRValue(glowColor), GetGValue(glowColor), GetBValue(glowColor));
CImageItem::PreMultiply(hbm, 1);
@@ -2150,7 +2150,7 @@ void CTabBaseDlg::RenderToolbarBG(HDC hdc, const RECT &rcWindow) const bool bAero = M.isAero();
bool fTbColorsValid = PluginConfig.m_tbBackgroundHigh && PluginConfig.m_tbBackgroundLow;
BYTE bAlphaOffset = 0;
- BOOL fMustDrawNonThemed = ((bAero || fTbColorsValid) && !M.GetByte(SRMSGMOD_T, "forceThemedToolbar", 0));
+ BOOL fMustDrawNonThemed = ((bAero || fTbColorsValid) && !db_get_b(0, SRMSGMOD_T, "forceThemedToolbar", 0));
RECT rc, rcToolbar;
POINT pt;
@@ -2366,7 +2366,7 @@ void CSkin::initAeroEffect() void CSkin::setAeroEffect(LRESULT effect)
{
if (effect == -1)
- effect = static_cast<LRESULT>(M.GetDword(SRMSGMOD_T, "aerostyle", AERO_EFFECT_NONE));
+ effect = static_cast<LRESULT>(db_get_dw(0, SRMSGMOD_T, "aerostyle", AERO_EFFECT_NONE));
if (effect >= 0 && effect < AERO_EFFECT_LAST)
m_aeroEffect = (UINT)effect;
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp index 8cd57b7863..49a814f22a 100644 --- a/plugins/TabSRMM/src/trayicon.cpp +++ b/plugins/TabSRMM/src/trayicon.cpp @@ -224,11 +224,11 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, c UINT uid = GetMenuItemID(hMenu, 0);
if (uid) {
DeleteMenu(hMenu, (UINT_PTR)0, MF_BYPOSITION);
- db_set_dw((MCONTACT)uid, SRMSGMOD_T, "isRecent", 0);
+ M.SetRecent((MCONTACT)uid, 0);
}
}
addnew:
- db_set_dw(hContact, SRMSGMOD_T, "isRecent", time(0));
+ M.SetRecent(hContact, time(0));
AppendMenu(hMenu, MF_BYCOMMAND, (UINT_PTR)hContact, szMenuEntry);
}
else if (hMenu == PluginConfig.g_hMenuFavorites) { // insert the item sorted...
@@ -288,9 +288,9 @@ void TSAPI LoadFavoritesAndRecent() return;
for (auto &hContact : Contacts()) {
- if (M.GetByte(hContact, "isFavorite", 0))
+ if (M.IsFavorite(hContact))
AddContactToFavorites(hContact, nullptr, nullptr, nullptr, 0, nullptr, 1, PluginConfig.g_hMenuFavorites);
- if ((dwRecent = M.GetDword(hContact, "isRecent", 0)) != 0 && iIndex < nen_options.wMaxRecent) {
+ if ((dwRecent = M.IsRecent(hContact)) != 0 && iIndex < nen_options.wMaxRecent) {
recentEntries[iIndex].dwTimestamp = dwRecent;
recentEntries[iIndex++].hContact = hContact;
}
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 6d4cb8bc9f..335e9e8816 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -506,23 +506,23 @@ int TN_ModuleInit() {
hPopupsList = WindowList_Create();
- OnePopup = M.GetByte(TypigModule, SET_ONEPOPUP, DEF_ONEPOPUP);
- ShowMenu = M.GetByte(TypigModule, SET_SHOWDISABLEMENU, DEF_SHOWDISABLEMENU);
+ OnePopup = db_get_b(0, TypigModule, SET_ONEPOPUP, DEF_ONEPOPUP);
+ ShowMenu = db_get_b(0, TypigModule, SET_SHOWDISABLEMENU, DEF_SHOWDISABLEMENU);
- int i = M.GetByte(TypigModule, SET_DISABLED, DEF_DISABLED);
+ int i = db_get_b(0, TypigModule, SET_DISABLED, DEF_DISABLED);
Disabled = i & 1;
StartDisabled = i & 2;
StopDisabled = i & 4;
- ColorMode = M.GetByte(TypigModule, SET_COLOR_MODE, DEF_COLOR_MODE);
- TimeoutMode = M.GetByte(TypigModule, SET_TIMEOUT_MODE, DEF_TIMEOUT_MODE);
- Timeout = M.GetByte(TypigModule, SET_TIMEOUT, DEF_TIMEOUT);
- TimeoutMode2 = M.GetByte(TypigModule, SET_TIMEOUT_MODE2, DEF_TIMEOUT_MODE2);
- Timeout2 = M.GetByte(TypigModule, SET_TIMEOUT2, DEF_TIMEOUT2);
+ ColorMode = db_get_b(0, TypigModule, SET_COLOR_MODE, DEF_COLOR_MODE);
+ TimeoutMode = db_get_b(0, TypigModule, SET_TIMEOUT_MODE, DEF_TIMEOUT_MODE);
+ Timeout = db_get_b(0, TypigModule, SET_TIMEOUT, DEF_TIMEOUT);
+ TimeoutMode2 = db_get_b(0, TypigModule, SET_TIMEOUT_MODE2, DEF_TIMEOUT_MODE2);
+ Timeout2 = db_get_b(0, TypigModule, SET_TIMEOUT2, DEF_TIMEOUT2);
- if (!(M.GetDword(TypigModule, colorPicker[0].desc, 1) && !M.GetDword(TypigModule, colorPicker[0].desc, 0)))
+ if (!(db_get_dw(0, TypigModule, colorPicker[0].desc, 1) && !db_get_dw(0, TypigModule, colorPicker[0].desc, 0)))
for (auto &it : colorPicker)
- it.color = M.GetDword(TypigModule, it.desc, 0);
+ it.color = db_get_dw(0, TypigModule, it.desc, 0);
mir_snwprintf(szStart, TranslateT("...is typing a message."));
mir_snwprintf(szStop, TranslateT("...has stopped typing."));
diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index 7b6e0c214c..3701cb7e85 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -181,12 +181,12 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, }
if (IsDlgButtonChecked(hwndDlg, IDC_ISFAVORITE)) {
- if (!M.GetByte(hContact, "isFavorite", 0))
+ if (!M.IsFavorite(hContact))
AddContactToFavorites(hContact, nullptr, nullptr, nullptr, 0, nullptr, 1, PluginConfig.g_hMenuFavorites);
}
else DeleteMenu(PluginConfig.g_hMenuFavorites, hContact, MF_BYCOMMAND);
- db_set_b(hContact, SRMSGMOD_T, "isFavorite", (WORD)(IsDlgButtonChecked(hwndDlg, IDC_ISFAVORITE) ? 1 : 0));
+ M.SetFavorite(hContact, IsDlgButtonChecked(hwndDlg, IDC_ISFAVORITE) != 0);
db_set_b(hContact, SRMSGMOD_T, "splitoverride", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PRIVATESPLITTER) ? 1 : 0));
db_set_b(hContact, TEMPLATES_MODULE, "enabled", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_TEMPLOVERRIDE)));
|