summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/TooltipNotify/src/DbHelpers.cpp16
-rw-r--r--plugins/TooltipNotify/src/TooltipNotify.cpp109
-rw-r--r--plugins/TooltipNotify/src/TooltipNotify.h4
3 files changed, 50 insertions, 79 deletions
diff --git a/plugins/TooltipNotify/src/DbHelpers.cpp b/plugins/TooltipNotify/src/DbHelpers.cpp
index 4a4fad9c1f..017e01451c 100644
--- a/plugins/TooltipNotify/src/DbHelpers.cpp
+++ b/plugins/TooltipNotify/src/DbHelpers.cpp
@@ -41,7 +41,7 @@ void DeleteModuleSettings(HANDLE hContact, const char* pszModuleName)
{
for(unsigned i=0; i<settingsList.size(); i++)
{
- DBDeleteContactSetting(hContact, pszModuleName, settingsList[i]);
+ db_unset(hContact, pszModuleName, settingsList[i]);
free((char*)settingsList[i]);
}
}
@@ -87,31 +87,31 @@ void RenameModule(HANDLE hContact, const char* pszOldName, const char* pszNewNam
switch (dbv.type)
{
case DBVT_BYTE:
- DBWriteContactSettingByte(hContact, pszNewName, pszSetting, dbv.bVal);
+ db_set_b(hContact, pszNewName, pszSetting, dbv.bVal);
break;
case DBVT_WORD:
- DBWriteContactSettingWord(hContact, pszNewName, pszSetting, dbv.wVal);
+ db_set_w(hContact, pszNewName, pszSetting, dbv.wVal);
break;
case DBVT_DWORD:
- DBWriteContactSettingDword(hContact, pszNewName, pszSetting, dbv.dVal);
+ db_set_dw(hContact, pszNewName, pszSetting, dbv.dVal);
break;
case DBVT_ASCIIZ:
- DBWriteContactSettingString(hContact, pszNewName, pszSetting, dbv.pszVal);
+ db_set_s(hContact, pszNewName, pszSetting, dbv.pszVal);
break;
case DBVT_UTF8:
- DBWriteContactSettingStringUtf(hContact, pszNewName, pszSetting, dbv.pszVal);
+ db_set_utf(hContact, pszNewName, pszSetting, dbv.pszVal);
break;
default:
assert(0);
break;
}
- DBDeleteContactSetting(hContact, pszOldName, pszSetting);
- DBFreeVariant(&dbv);
+ db_unset(hContact, pszOldName, pszSetting);
+ db_free(&dbv);
}
free((char*)settingsList[i]);
}
diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp
index 705ad870d1..abcbe146d5 100644
--- a/plugins/TooltipNotify/src/TooltipNotify.cpp
+++ b/plugins/TooltipNotify/src/TooltipNotify.cpp
@@ -4,15 +4,15 @@
#include "stdafx.h"
-#define ReadSettingByte(c, d) DBGetContactSettingByte(NULL, s_szModuleName, c, d)
-#define ReadSettingWord(c, d) DBGetContactSettingWord(NULL, s_szModuleName, c, d)
-#define ReadSettingDword(c, d) DBGetContactSettingDword(NULL, s_szModuleName, c, d)
-#define ReadSettingString(c, d) DBGetContactSettingTString(NULL, s_szModuleName, c, d)
+#define ReadSettingByte(c, d) db_get_b(NULL, s_szModuleName, c, d)
+#define ReadSettingWord(c, d) db_get_w(NULL, s_szModuleName, c, d)
+#define ReadSettingDword(c, d) db_get_dw(NULL, s_szModuleName, c, d)
+#define ReadSettingString(c, d) db_get_ts(NULL, s_szModuleName, c, d)
-#define WriteSettingByte(c, d) DBWriteContactSettingByte(NULL, s_szModuleName, c, d)
-#define WriteSettingWord(c, d) DBWriteContactSettingWord(NULL, s_szModuleName, c, d)
-#define WriteSettingDword(c, d) DBWriteContactSettingDword(NULL, s_szModuleName, c, d)
-#define WriteSettingString(c, d) DBWriteContactSettingTString(NULL, s_szModuleName, c, d)
+#define WriteSettingByte(c, d) db_set_b(NULL, s_szModuleName, c, d)
+#define WriteSettingWord(c, d) db_set_w(NULL, s_szModuleName, c, d)
+#define WriteSettingDword(c, d) db_set_dw(NULL, s_szModuleName, c, d)
+#define WriteSettingString(c, d) db_set_ts(NULL, s_szModuleName, c, d)
enum
{
@@ -150,10 +150,10 @@ int CTooltipNotify::ModulesLoaded(WPARAM wParam, LPARAM lParam)
if (m_sOptions.bFirstRun)
{
- DBWriteContactSettingByte(NULL, "SkinSoundsOff", SND_ONLINE, 1);
- DBWriteContactSettingByte(NULL, "SkinSoundsOff", SND_OFFLINE, 1);
- DBWriteContactSettingByte(NULL, "SkinSoundsOff", SND_OTHER, 1);
- DBWriteContactSettingByte(NULL, "SkinSoundsOff", SND_TYPING, 1);
+ db_set_b(NULL, "SkinSoundsOff", SND_ONLINE, 1);
+ db_set_b(NULL, "SkinSoundsOff", SND_OFFLINE, 1);
+ db_set_b(NULL, "SkinSoundsOff", SND_OTHER, 1);
+ db_set_b(NULL, "SkinSoundsOff", SND_TYPING, 1);
WriteSettingByte("firstrun", 0);
}
@@ -236,7 +236,7 @@ int CTooltipNotify::ContactSettingChanged(WPARAM wParam, LPARAM lParam)
idle = true;
else return 0;
- if(DBGetContactSettingByte(hContact, "CList", "Hidden", 0)) return 0;
+ if(db_get_b(hContact, "CList", "Hidden", 0)) return 0;
const char *pszProto = cws->szModule;
if (ReadSettingByte(pszProto, ProtoUserBit|ProtoIntBit) != (ProtoUserBit|ProtoIntBit))
@@ -244,12 +244,12 @@ int CTooltipNotify::ContactSettingChanged(WPARAM wParam, LPARAM lParam)
return 0;
}
- if (DBGetContactSettingByte(hContact, "CList", "NotOnList", 0) && m_sOptions.bIgnoreUnknown)
+ if (db_get_b(hContact, "CList", "NotOnList", 0) && m_sOptions.bIgnoreUnknown)
{
return 0;
}
- if (DBGetContactSettingByte(hContact, s_szModuleName, CONTACT_IGNORE_TTNOTIFY, m_sOptions.bIgnoreNew))
+ if (db_get_b(hContact, s_szModuleName, CONTACT_IGNORE_TTNOTIFY, m_sOptions.bIgnoreNew))
{
return 0;
}
@@ -642,11 +642,11 @@ BOOL CTooltipNotify::OptionsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
}
case IDC_SEL_PROTO:
- DialogBox(m_hDllInstance, MAKEINTRESOURCE(IDD_PROTOS), hDlg, (DLGPROC)CTooltipNotify::ProtosDlgProcWrapper);
+ DialogBox(m_hDllInstance, MAKEINTRESOURCE(IDD_PROTOS), hDlg, CTooltipNotify::ProtosDlgProcWrapper);
break;
case IDC_IGNORE:
- DialogBox(m_hDllInstance, MAKEINTRESOURCE(IDD_CONTACTS), hDlg, (DLGPROC)CTooltipNotify::ContactsDlgProcWrapper);
+ DialogBox(m_hDllInstance, MAKEINTRESOURCE(IDD_CONTACTS), hDlg, CTooltipNotify::ContactsDlgProcWrapper);
break;
default:
@@ -790,7 +790,7 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
void CTooltipNotify::ResetCList(HWND hwndDlg)
{
BOOL b = (CallService(MS_CLUI_GETCAPS, 0, 0) & CLUIF_DISABLEGROUPS &&
- DBGetContactSettingByte(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
+ db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT));
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, (WPARAM) b, 0);
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0);
@@ -819,7 +819,7 @@ void CTooltipNotify::LoadList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown
do
{
HANDLE hItem = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM) hContact, 0);
- if (hItem && !DBGetContactSettingByte(hContact, s_szModuleName, CONTACT_IGNORE_TTNOTIFY, m_sOptions.bIgnoreNew))
+ if (hItem && !db_get_b(hContact, s_szModuleName, CONTACT_IGNORE_TTNOTIFY, m_sOptions.bIgnoreNew))
{
SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM) hItem, 1);
}
@@ -845,7 +845,7 @@ void CTooltipNotify::SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown
if (hItem)
{
BYTE bChecked = (BYTE) (SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM) hItem, 0));
- DBWriteContactSettingByte(hContact, s_szModuleName, CONTACT_IGNORE_TTNOTIFY, bChecked ? 0 : 1);
+ db_set_b(hContact, s_szModuleName, CONTACT_IGNORE_TTNOTIFY, bChecked ? 0 : 1);
}
}
while (hContact = db_find_next(hContact));
@@ -912,60 +912,31 @@ BOOL CTooltipNotify::ContactsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
TCHAR *CTooltipNotify::StatusToString(int iStatus, TCHAR *szStatus, int iBufSize)
{
-
- //iBufSize--;
-
- switch(iStatus)
+ if((iStatus>=ID_STATUS_OFFLINE) && (iStatus<=ID_STATUS_OUTTOLUNCH))
{
- case ID_STATUS_OFFLINE:
- lstrcpyn(szStatus, TranslateT("Offline"), iBufSize);
- break;
-
- case ID_STATUS_ONLINE:
- lstrcpyn(szStatus, TranslateT("Online"), iBufSize);
- break;
-
- case ID_STATUS_AWAY:
- lstrcpyn(szStatus, TranslateT("Away"), iBufSize);
- break;
-
- case ID_STATUS_NA :
- lstrcpyn(szStatus, TranslateT("N/A"), iBufSize);
- break;
-
- case ID_STATUS_OCCUPIED:
- lstrcpyn(szStatus, TranslateT("Occupied"), iBufSize);
- break;
-
- case ID_STATUS_DND:
- lstrcpyn(szStatus, TranslateT("DND"), iBufSize);
- break;
-
- case ID_STATUS_FREECHAT:
- lstrcpyn(szStatus, TranslateT("Free for chat"), iBufSize);
- break;
-
- case ID_STATUS_INVISIBLE:
- lstrcpyn(szStatus, TranslateT("Invisible"), iBufSize);
- break;
-
- case ID_TTNTF_STATUS_TYPING:
- lstrcpyn(szStatus, TranslateT("Typing"), iBufSize);
- break;
+ lstrcpyn(szStatus, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,iStatus,GSMDF_TCHAR), iBufSize);
+ }
+ else
+ {
+ switch(iStatus)
+ {
+ case ID_TTNTF_STATUS_TYPING:
+ lstrcpyn(szStatus, TranslateT("Typing"), iBufSize);
+ break;
- case ID_TTNTF_STATUS_IDLE:
- lstrcpyn(szStatus, TranslateT("Idle"), iBufSize);
- break;
+ case ID_TTNTF_STATUS_IDLE:
+ lstrcpyn(szStatus, TranslateT("Idle"), iBufSize);
+ break;
- case ID_TTNTF_STATUS_NOT_IDLE:
- lstrcpyn(szStatus, TranslateT("Not Idle"), iBufSize);
- break;
+ case ID_TTNTF_STATUS_NOT_IDLE:
+ lstrcpyn(szStatus, TranslateT("Not Idle"), iBufSize);
+ break;
- default:
- lstrcpyn(szStatus, TranslateT("Unknown"), iBufSize);
- break;
+ default:
+ lstrcpyn(szStatus, TranslateT("Unknown"), iBufSize);
+ break;
+ }
}
-
return szStatus;
}
diff --git a/plugins/TooltipNotify/src/TooltipNotify.h b/plugins/TooltipNotify/src/TooltipNotify.h
index 9e31c5e383..8cdb306203 100644
--- a/plugins/TooltipNotify/src/TooltipNotify.h
+++ b/plugins/TooltipNotify/src/TooltipNotify.h
@@ -128,12 +128,12 @@ private:
{
return CTooltipNotify::GetObjInstance()->OptionsDlgProc(hDlg, msg, wParam, lParam);
}
- static BOOL CALLBACK ProtosDlgProcWrapper(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+ static INT_PTR CALLBACK ProtosDlgProcWrapper(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
return CTooltipNotify::GetObjInstance()->ProtosDlgProc(hDlg, msg, wParam, lParam);
}
- static BOOL CALLBACK ContactsDlgProcWrapper(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+ static INT_PTR CALLBACK ContactsDlgProcWrapper(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
return CTooltipNotify::GetObjInstance()->ContactsDlgProc(hDlg, msg, wParam, lParam);
}