From 3fed56c332215dd3a753d2fc0b31616c1b270a51 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sun, 24 Mar 2013 19:30:28 +0000 Subject: TooltipNotify now uses status description from the core git-svn-id: http://svn.miranda-ng.org/main/trunk@4176 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TooltipNotify/src/DbHelpers.cpp | 16 ++-- plugins/TooltipNotify/src/TooltipNotify.cpp | 109 ++++++++++------------------ plugins/TooltipNotify/src/TooltipNotify.h | 4 +- 3 files changed, 50 insertions(+), 79 deletions(-) (limited to 'plugins/TooltipNotify') 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; iszModule; 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); } -- cgit v1.2.3