From c30391220326446fcdf5ff90a445401947b101a4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 16 Apr 2013 20:30:13 +0000 Subject: SkypeStatusChange plugin added git-svn-id: http://svn.miranda-ng.org/main/trunk@4459 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SkypeStatusChange/src/stdafx.h | 171 +++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 plugins/SkypeStatusChange/src/stdafx.h (limited to 'plugins/SkypeStatusChange/src/stdafx.h') diff --git a/plugins/SkypeStatusChange/src/stdafx.h b/plugins/SkypeStatusChange/src/stdafx.h new file mode 100644 index 0000000000..f6c0589707 --- /dev/null +++ b/plugins/SkypeStatusChange/src/stdafx.h @@ -0,0 +1,171 @@ +#define _CRT_SECURE_NO_WARNINGS + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MODULENAME "Change Skype Status" + +class COptions +{ + enum + { + cssOnline = 0x00000001, + cssOffline = 0x00000002, + cssInvisible = 0x00000004, + cssShortAway = 0x00000008, + cssLongAway = 0x00000010, + cssLightDND = 0x00000020, + cssHeavyDND = 0x00000040, + cssFreeChart = 0x00000080, + cssOutToLunch = 0x00000100, + cssOnThePhone = 0x00000200, + cssIdle = 0x00000400, + cssAll = 0x80000000 + }; + + static unsigned long Status2Flag(int status) + { + switch(status) + { + case ID_STATUS_ONLINE: return cssOnline; + case ID_STATUS_OFFLINE: return cssOffline; + case ID_STATUS_INVISIBLE: return cssInvisible; + case ID_STATUS_OUTTOLUNCH: return cssOutToLunch; + case ID_STATUS_ONTHEPHONE: return cssOnThePhone; + case ID_STATUS_AWAY: return cssShortAway; + case ID_STATUS_NA: return cssLongAway; + case ID_STATUS_OCCUPIED: return cssLightDND; + case ID_STATUS_DND: return cssHeavyDND; + case ID_STATUS_FREECHAT: return cssFreeChart; + case ID_STATUS_IDLE: return cssIdle; + } + return 0; + } + + struct PrevStatus + { + PrevStatus(const char *_proto, int _status) : + szProto(mir_strdup(_proto)), + iStatus(_status) + {} + + mir_ptr szProto; + int iStatus; + }; + + OBJLIST m_aProtocol2Status; + static int CompareStatuses(const PrevStatus *p1, const PrevStatus *p2) + { return strcmp(p1->szProto, p2->szProto); + } + +public: + COptions() : + m_aProtocol2Status(3, CompareStatuses) + {} + + bool IsProtocolExcluded(const char* pszProtocol)const + { + DWORD dwSettings = db_get_dw(NULL,pszProtocol,"ChangeSkypeStatus_Exclusions",0); + return ((dwSettings&cssAll) ? true : false); + } + + bool IsProtocolStatusExcluded(const char* pszProtocol,int nStatus)const + { + DWORD dwSettings = db_get_dw(NULL,pszProtocol,"ChangeSkypeStatus_Exclusions",0); + return ((dwSettings&Status2Flag(nStatus)) ? true : false); + } + + void ExcludeProtocol(const char* pszProtocol,bool bExclude) + { + DWORD dwSettings = db_get_dw(NULL,pszProtocol,"ChangeSkypeStatus_Exclusions",0); + if (bExclude) + dwSettings |=cssAll; + else + dwSettings &= ~cssAll; + + db_set_dw(NULL,pszProtocol,"ChangeSkypeStatus_Exclusions",dwSettings); + } + + void ExcludeProtocolStatus(const char* pszProtocol,int nStatus,bool bExclude) + { + DWORD dwSettings = db_get_dw(NULL,pszProtocol,"ChangeSkypeStatus_Exclusions",0); + if (bExclude) + dwSettings |=Status2Flag(nStatus); + else + dwSettings &= ~Status2Flag(nStatus); + + db_set_dw(NULL,pszProtocol,"ChangeSkypeStatus_Exclusions",dwSettings); + } + + bool GetSyncStatusMsgFlag()const + { + return db_get_b(NULL,MODULENAME,"SyncStatusMsg",false) > 0; + } + + bool GetSyncStatusStateFlag()const + { + return db_get_b(NULL,MODULENAME,"SyncStatusState",false) > 0; + } + + void SetSyncStatusMsgFlag(bool b) + { + db_set_b(NULL,MODULENAME,"SyncStatusMsg",b); + } + + void SetSyncStatusStateFlag(bool b) + { + db_set_b(NULL,MODULENAME,"SyncStatusState",b); + } + + bool GetPreviousStatus(const char* pszProtocol,int& nStatus)const + { + int i = m_aProtocol2Status.getIndex((PrevStatus*)&pszProtocol); + if (i != -1) { + nStatus = m_aProtocol2Status[i].iStatus; + return true; + } + + return false; + } + + void SetPreviousStatus(const char* pszProtocol,int nStatus) + { + int i = m_aProtocol2Status.getIndex((PrevStatus*)&pszProtocol); + if (i != -1) + m_aProtocol2Status[i].iStatus = nStatus; + else + m_aProtocol2Status.insert( new PrevStatus(pszProtocol, nStatus)); + } +}; + +extern COptions g_Options; + +///////////////////////////////////////////////////////////////////////////////////////// + +struct CMirandaStatus2SkypeStatus +{ + int m_nMirandaStatus; + LPCSTR m_pszSkypeStatus; + LPCTSTR m_ptszStatusName; +}; + +extern const CMirandaStatus2SkypeStatus g_aStatusCode[10]; + +///////////////////////////////////////////////////////////////////////////////////////// + +extern HINSTANCE g_hModule; \ No newline at end of file -- cgit v1.2.3