summaryrefslogtreecommitdiff
path: root/plugins/SkypeStatusChange/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SkypeStatusChange/src')
-rw-r--r--plugins/SkypeStatusChange/src/main.cpp311
-rw-r--r--plugins/SkypeStatusChange/src/options.cpp161
-rw-r--r--plugins/SkypeStatusChange/src/resource.h21
-rw-r--r--plugins/SkypeStatusChange/src/stdafx.cxx18
-rw-r--r--plugins/SkypeStatusChange/src/stdafx.h132
-rw-r--r--plugins/SkypeStatusChange/src/version.h13
6 files changed, 0 insertions, 656 deletions
diff --git a/plugins/SkypeStatusChange/src/main.cpp b/plugins/SkypeStatusChange/src/main.cpp
deleted file mode 100644
index 3be15c1351..0000000000
--- a/plugins/SkypeStatusChange/src/main.cpp
+++ /dev/null
@@ -1,311 +0,0 @@
-#include "stdafx.h"
-#include "resource.h"
-#include "Version.h"
-
-#pragma comment(lib, "Comctl32.lib")
-
-CMPlugin g_plugin;
-
-int SSC_OptInitialise(WPARAM wp, LPARAM lp);
-
-UINT g_MsgIDSkypeControlAPIAttach = 0;
-UINT g_MsgIDSkypeControlAPIDiscover = 0;
-HWND g_wndMainWindow = nullptr;
-
-bool g_bMirandaIsShutdown = false;
-
-HANDLE g_hThread = nullptr;
-HANDLE g_hEventShutdown = nullptr;
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static PLUGININFOEX pluginInfoEx =
-{
- sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- { 0x2925520b, 0x6677, 0x4658, { 0x8b, 0xad, 0x56, 0x61, 0xd1, 0x3e, 0x46, 0x92 }}
-};
-
-static int CompareStatuses(const PrevStatus *p1, const PrevStatus *p2)
-{
- return mir_strcmp(p1->szProto, p2->szProto);
-}
-
-CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>("Change Skype Status", pluginInfoEx),
- m_aProtocol2Status(3, CompareStatuses),
- bSyncStatusMsg(getModule(), "SyncStatusMsg", false),
- bSyncStatusState(getModule(), "SyncStatusState", false)
-{}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-enum
-{
- // Client is successfully attached and API window handle can be found in wParam parameter
- SKYPECONTROLAPI_ATTACH_SUCCESS = 0,
-
- // Skype has acknowledged connection request and is waiting for confirmation from the user.
- SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION = 1,
-
- // The client is not yet attached and should wait for SKYPECONTROLAPI_ATTACH_SUCCESS message
- // User has explicitly denied access to client
- SKYPECONTROLAPI_ATTACH_REFUSED = 2,
-
- // API is not available at the moment. For example, this happens when no user is currently logged in.
- SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE = 3,
-
- // Client should wait for SKYPECONTROLAPI_ATTACH_API_AVAILABLE broadcast before making any further
- // connection attempts.
- SKYPECONTROLAPI_ATTACH_API_AVAILABLE = 0x8001
-};
-
-LPCTSTR g_pszSkypeWndClassName = L"SkypeHelperWindow{155198f0-8749-47b7-ac53-58f2ac70844c}";
-
-const CMirandaStatus2SkypeStatus g_aStatusCode[MAX_STATUS_COUNT] =
-{
- {ID_STATUS_AWAY, "AWAY",L"Away"},
- {ID_STATUS_NA, "AWAY",L"Not available"}, // removed in Skype 5
- {ID_STATUS_DND, "DND",L"Do not disturb"},
- {ID_STATUS_ONLINE, "ONLINE",L"Online"},
- {ID_STATUS_FREECHAT, "ONLINE",L"Free for chat"}, // SKYPEME status doesn't work in Skype 4!
- {ID_STATUS_OFFLINE, "OFFLINE",L"Offline"},
- {ID_STATUS_INVISIBLE, "INVISIBLE",L"Invisible"},
- {ID_STATUS_OCCUPIED,"DND",L"Occupied"}
-};
-
-enum { INVALID_INDEX = 0xFFFFFFFF };
-
-class CStatusInfo
-{
-public:
- CStatusInfo() : m_nStatusIndex(INVALID_INDEX) { m_szModule[0] = '\0'; }
-
- size_t StatusIndex()const { return m_nStatusIndex; }
- void StatusIndex(size_t val) { m_nStatusIndex = val; }
-
- const char* Module()const { return m_szModule; }
- void Module(const char* val)
- {
- if (val)
- strncpy_s(m_szModule, val, mir_strlen(val));
- else
- m_szModule[0] = '\0';
- }
-
-private:
- char m_szModule[MAXMODULELABELLENGTH];
- size_t m_nStatusIndex;
-};
-
-CStatusInfo g_CurrStatusInfo;
-mir_cs g_csStatusInfo;
-
-int SSC_OnProtocolAck(WPARAM, LPARAM lParam)
-{
- if (g_bMirandaIsShutdown)
- return 0;
-
- ACKDATA* pAckData = reinterpret_cast<ACKDATA*>(lParam);
- if (pAckData->type != ACKTYPE_STATUS || pAckData->result != ACKRESULT_SUCCESS || !pAckData->szModule)
- return 0;
-
- if (!g_plugin.IsProtocolExcluded(pAckData->szModule)) {
- int nStatus = Proto_GetStatus(pAckData->szModule);
- for (size_t i = 0; i < _countof(g_aStatusCode); ++i) {
- const CMirandaStatus2SkypeStatus& ms = g_aStatusCode[i];
- if (ms.m_nMirandaStatus == nStatus) {
- int nPrevStatus;
- if ((false == g_plugin.IsProtocolStatusExcluded(pAckData->szModule, nStatus))
- && ((!g_plugin.bSyncStatusState)
- || (false == g_plugin.GetPreviousStatus(pAckData->szModule, nPrevStatus))
- || (nPrevStatus != nStatus))) {
- {
- mir_cslock guard(g_csStatusInfo);
- g_CurrStatusInfo.StatusIndex(i);
- g_CurrStatusInfo.Module(pAckData->szModule);
- }
- if (0 == ::PostMessage(HWND_BROADCAST, g_MsgIDSkypeControlAPIDiscover, (WPARAM)g_wndMainWindow, 0)) {
- mir_cslock guard(g_csStatusInfo);
- g_CurrStatusInfo.StatusIndex(INVALID_INDEX);
- g_CurrStatusInfo.Module(nullptr);
- }
- else g_plugin.SetPreviousStatus(pAckData->szModule, nStatus);
- }
- break;
- }
- }
- }
-
- return 0;
-}
-
-static void ThreadFunc(void*)
-{
- while (true) {
- MSG msg;
- if (TRUE == ::PeekMessage(&msg, g_wndMainWindow, 0, 0, PM_NOREMOVE)) {
- while (::GetMessage(&msg, g_wndMainWindow, 0, 0)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
- else {
- uint32_t dwResult = ::MsgWaitForMultipleObjects(1, &g_hEventShutdown, FALSE, INFINITE, QS_ALLEVENTS);
- assert(WAIT_FAILED != dwResult);
- if (WAIT_OBJECT_0 == dwResult)
- break;
- }
- }
-}
-
-LRESULT APIENTRY SkypeAPI_WindowProc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
-{
- LRESULT lReturnCode = 0;
- bool bIssueDefProc = false;
-
- switch (msg) {
- case WM_DESTROY:
- g_wndMainWindow = nullptr;
- break;
-
- case WM_COPYDATA:
- break;
-
- default:
- if (msg == g_MsgIDSkypeControlAPIAttach) {
- switch (lp) {
- case SKYPECONTROLAPI_ATTACH_SUCCESS:
- {
- CStatusInfo si;
- {
- mir_cslock guard(g_csStatusInfo);
- si = g_CurrStatusInfo;
- }
- if (INVALID_INDEX != si.StatusIndex() && si.StatusIndex() < _countof(g_aStatusCode)) {
- const CMirandaStatus2SkypeStatus& ms = g_aStatusCode[si.StatusIndex()];
- HWND wndSkypeAPIWindow = reinterpret_cast<HWND>(wp);
-
- enum { BUFFER_SIZE = 256 };
- char szSkypeCmd[BUFFER_SIZE];
- const char szSkypeCmdSetStatus[] = "SET USERSTATUS ";
- ::strncpy_s(szSkypeCmd, szSkypeCmdSetStatus, sizeof(szSkypeCmdSetStatus) / sizeof(szSkypeCmdSetStatus[0]));
- ::strncat_s(szSkypeCmd, ms.m_pszSkypeStatus, _countof(szSkypeCmd) - mir_strlen(szSkypeCmd));
- uint32_t cLength = static_cast<uint32_t>(mir_strlen(szSkypeCmd));
-
- COPYDATASTRUCT oCopyData;
- oCopyData.dwData = 0;
- oCopyData.lpData = szSkypeCmd;
- oCopyData.cbData = cLength + 1;
- SendMessage(wndSkypeAPIWindow, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&oCopyData);
- if (g_plugin.bSyncStatusMsg) {
- wchar_t* pszStatusMsg = nullptr;
- if (ProtoServiceExists(si.Module(), PS_GETMYAWAYMSG))
- pszStatusMsg = reinterpret_cast<wchar_t*>(CallProtoService(si.Module(), PS_GETMYAWAYMSG, (WPARAM)ms.m_nMirandaStatus, SGMA_UNICODE));
-
- if ((nullptr == pszStatusMsg) || (CALLSERVICE_NOTFOUND == INT_PTR(pszStatusMsg)))
- pszStatusMsg = reinterpret_cast<wchar_t*>(CallService(MS_AWAYMSG_GETSTATUSMSGW, (WPARAM)ms.m_nMirandaStatus, 0));
-
- if (pszStatusMsg && reinterpret_cast<LPARAM>(pszStatusMsg) != CALLSERVICE_NOTFOUND) {
- T2Utf pMsg(pszStatusMsg);
- mir_free(pszStatusMsg);
-
- const char szSkypeCmdSetStatusMsg[] = "SET PROFILE MOOD_TEXT ";
- ::strncpy_s(szSkypeCmd, szSkypeCmdSetStatusMsg, sizeof(szSkypeCmdSetStatusMsg) / sizeof(szSkypeCmdSetStatusMsg[0]));
- ::strncat_s(szSkypeCmd, pMsg, _countof(szSkypeCmd) - mir_strlen(szSkypeCmd));
-
- oCopyData.dwData = 0;
- oCopyData.lpData = szSkypeCmd;
- oCopyData.cbData = static_cast<uint32_t>(mir_strlen(szSkypeCmd)) + 1;
- SendMessage(wndSkypeAPIWindow, WM_COPYDATA, (WPARAM)hWnd, (LPARAM)&oCopyData);
- }
- }
- }
- }
- break;
-
- case SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION:
- break;
-
- case SKYPECONTROLAPI_ATTACH_REFUSED:
- break;
-
- case SKYPECONTROLAPI_ATTACH_NOT_AVAILABLE:
- break;
-
- case SKYPECONTROLAPI_ATTACH_API_AVAILABLE:
- break;
- }
- lReturnCode = 1;
- }
- else bIssueDefProc = true;
- break;
- }
-
- if (true == bIssueDefProc)
- lReturnCode = DefWindowProc(hWnd, msg, wp, lp);
-
- return lReturnCode;
-}
-
-int SSC_OnPreShutdown(WPARAM/* wParam*/, LPARAM/* lParam*/)
-{
- g_bMirandaIsShutdown = true;
- BOOL b = SetEvent(g_hEventShutdown);
- assert(b && "SetEvent failed");
-
- uint32_t dwResult = ::WaitForSingleObject(g_hThread, INFINITE);
- assert(WAIT_FAILED != dwResult);
-
- b = ::CloseHandle(g_hEventShutdown);
- assert(b && "CloseHandle event");
-
- if (g_wndMainWindow) {
- b = DestroyWindow(g_wndMainWindow);
- assert(b && "DestoryWindow");
- g_wndMainWindow = nullptr;
- }
-
- UnregisterClass(g_pszSkypeWndClassName, g_plugin.getInst());
- return 0;
-}
-
-/******************************* INSTALLATION PROCEDURES *****************************/
-
-int CMPlugin::Load()
-{
- g_MsgIDSkypeControlAPIAttach = ::RegisterWindowMessage(L"SkypeControlAPIAttach");
- g_MsgIDSkypeControlAPIDiscover = ::RegisterWindowMessage(L"SkypeControlAPIDiscover");
- if ((0 == g_MsgIDSkypeControlAPIAttach) || (0 == g_MsgIDSkypeControlAPIDiscover))
- return 1;
-
- WNDCLASS oWindowClass = { 0 };
- oWindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
- oWindowClass.lpfnWndProc = (WNDPROC)&SkypeAPI_WindowProc;
- oWindowClass.hInstance = g_plugin.getInst();
- oWindowClass.lpszClassName = g_pszSkypeWndClassName;
- if (!RegisterClass(&oWindowClass))
- return 1;
-
- g_wndMainWindow = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE,
- g_pszSkypeWndClassName, L"", WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT, 128, 128, nullptr, nullptr, g_plugin.getInst(), nullptr);
- if (g_wndMainWindow == nullptr)
- return 1;
-
- g_bMirandaIsShutdown = false;
- g_hEventShutdown = ::CreateEvent(nullptr, TRUE, FALSE, nullptr);
-
- g_hThread = mir_forkthread(ThreadFunc);
-
- HookEvent(ME_PROTO_ACK, SSC_OnProtocolAck);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, SSC_OnPreShutdown);
- HookEvent(ME_OPT_INITIALISE, SSC_OptInitialise);
- return 0;
-}
diff --git a/plugins/SkypeStatusChange/src/options.cpp b/plugins/SkypeStatusChange/src/options.cpp
deleted file mode 100644
index f132ecd6db..0000000000
--- a/plugins/SkypeStatusChange/src/options.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-#include "stdafx.h"
-#include "resource.h"
-
-/////////////////////////////////////////////////////////////////////////////////////////////
-
-struct CTreeItemData
-{
- bool m_isProtocol;
- char *m_pszModule;
- int m_nStatus;
-};
-
-class CSettingsDlg : public CDlgBase
-{
- CCtrlCheck chkMsg, chkState;
- CCtrlTreeView m_tree;
-
- void DisableChildren(HTREEITEM htiParent, int iState)
- {
- TVITEMEX tvi = {};
- tvi.mask = TVIF_STATE;
- tvi.stateMask = TVIS_STATEIMAGEMASK;
- if (iState == 1) {
- tvi.mask |= TVIF_STATEEX;
- tvi.uStateEx = TVIS_EX_DISABLED;
- tvi.state = INDEXTOSTATEIMAGEMASK(2);
- }
- else tvi.state = INDEXTOSTATEIMAGEMASK(1);
-
- for (HTREEITEM hti = m_tree.GetChild(htiParent); hti; hti = m_tree.GetNextSibling(hti)) {
- tvi.hItem = hti;
- m_tree.SetItem(&tvi);
- }
- }
-
- void FreeMemory(HTREEITEM hti)
- {
- for (HTREEITEM h = m_tree.GetChild(hti); h; h = m_tree.GetNextSibling(h)) {
- FreeMemory(h);
- CTreeItemData *pData = GetItemData(h);
- if (pData)
- delete pData;
- }
- }
-
- CTreeItemData* GetItemData(HTREEITEM hti)
- {
- TVITEMEX tvi = {};
- tvi.hItem = hti;
- tvi.mask = TVIF_PARAM | TVIF_HANDLE;
- return (m_tree.GetItem(&tvi)) ? (CTreeItemData *)tvi.lParam : nullptr;
- }
-
- void SaveExclusion(HTREEITEM htiParent)
- {
- for (HTREEITEM hti = m_tree.GetChild(htiParent); hti; hti = m_tree.GetNextSibling(hti)) {
- CTreeItemData *pData = GetItemData(hti);
- bool isChecked = m_tree.IsSelected(hti);
- if (pData->m_isProtocol) {
- g_plugin.ExcludeProtocol(pData->m_pszModule, isChecked);
- SaveExclusion(hti);
- }
- else g_plugin.ExcludeProtocolStatus(pData->m_pszModule, pData->m_nStatus, isChecked);
- }
- }
-
- HTREEITEM TreeInsert(wchar_t *pName, HTREEITEM htiParent, bool bSelected, CTreeItemData *pData)
- {
- TVINSERTSTRUCT tvi = {};
- tvi.hParent = htiParent;
- tvi.hInsertAfter = TVI_LAST;
- tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
- tvi.item.pszText = pName;
- tvi.item.lParam = reinterpret_cast<LPARAM>(pData);
- tvi.item.stateMask = TVIS_SELECTED;
- tvi.item.state = (bSelected) ? TVIS_SELECTED : 0;
- return m_tree.InsertItem(&tvi);
- }
-
-public:
- CSettingsDlg() :
- CDlgBase(g_plugin, IDD_DIALOG_SETTINGS),
- m_tree(this, IDC_TREE_PROTOCOLS),
- chkMsg(this, IDC_CHECK_SYNCK_STATUS_MSG),
- chkState(this, IDC_CHECK_STATUSES)
- {
- CreateLink(chkMsg, g_plugin.bSyncStatusMsg);
- CreateLink(chkState, g_plugin.bSyncStatusState);
-
- m_tree.OnItemChanged = Callback(this, &CSettingsDlg::onItemChanged_Tree);
- }
-
- bool OnInitDialog() override
- {
- for (auto &pAccount : Accounts()) {
- if (mir_strcmpi(pAccount->szProtoName, "SKYPE")) {
- g_plugin.ExcludeProtocol(pAccount->szModuleName, true);
- continue;
- }
-
- CTreeItemData *pItemData = new CTreeItemData;
- pItemData->m_isProtocol = true;
- pItemData->m_pszModule = pAccount->szModuleName;
-
- bool bProtocolExcluded = g_plugin.IsProtocolExcluded(pAccount->szModuleName);
- HTREEITEM hti = TreeInsert(pAccount->tszAccountName, TVI_ROOT, bProtocolExcluded, pItemData);
- if (hti) {
- int nStatusBits = CallProtoService(pAccount->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0);
- int nStatusExcluded = CallProtoService(pAccount->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0);
- pItemData = new CTreeItemData;
- pItemData->m_isProtocol = false;
- pItemData->m_pszModule = pAccount->szModuleName;
- pItemData->m_nStatus = ID_STATUS_OFFLINE;
- bool bStatusExcluded = g_plugin.IsProtocolStatusExcluded(pAccount->szModuleName, pItemData->m_nStatus);
- TreeInsert(TranslateW(g_aStatusCode[5].m_ptszStatusName), hti, bStatusExcluded, pItemData);
- for (size_t k = 0; k < _countof(g_aStatusCode); ++k) {
- const CMirandaStatus2SkypeStatus &m2s = g_aStatusCode[k];
- unsigned long statusFlags = Proto_Status2Flag(m2s.m_nMirandaStatus);
- if ((m2s.m_nMirandaStatus != ID_STATUS_OFFLINE) && (nStatusBits & statusFlags) && !(nStatusExcluded & statusFlags)) {
- pItemData = new CTreeItemData;
- pItemData->m_isProtocol = false;
- pItemData->m_pszModule = pAccount->szModuleName;
- pItemData->m_nStatus = m2s.m_nMirandaStatus;
- bStatusExcluded = g_plugin.IsProtocolStatusExcluded(pAccount->szModuleName, pItemData->m_nStatus);
- TreeInsert(TranslateW(m2s.m_ptszStatusName), hti, bStatusExcluded, pItemData);
- }
- }
-
- m_tree.Expand(hti, TVE_EXPAND);
- }
- }
- return true;
- }
-
- bool OnApply() override
- {
- SaveExclusion(TVI_ROOT);
- return true;
- }
-
- void OnDestroy() override
- {
- FreeMemory(TVI_ROOT);
- }
-
- void onItemChanged_Tree(CCtrlTreeView::TEventInfo *ev)
- {
- DisableChildren(ev->hItem, m_tree.GetItemState(ev->hItem, TVIS_STATEIMAGEMASK) >> 12);
- }
-};
-
-int SSC_OptInitialise(WPARAM wp, LPARAM)
-{
- OPTIONSDIALOGPAGE odp = {};
- odp.position = 910000000;
- odp.szTitle.a = LPGEN("Change Skype status");
- odp.szGroup.a = LPGEN("Plugins");
- odp.pDialog = new CSettingsDlg();
- g_plugin.addOptions(wp, &odp);
- return 0;
-}
diff --git a/plugins/SkypeStatusChange/src/resource.h b/plugins/SkypeStatusChange/src/resource.h
deleted file mode 100644
index d46ce54239..0000000000
--- a/plugins/SkypeStatusChange/src/resource.h
+++ /dev/null
@@ -1,21 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by SkypeStatusChange.rc
-//
-#define IDD_DIALOG_SETTINGS 101
-#define IDB_BITMAP1 102
-#define IDC_CHECK_SYNCK_STATUS_MSG 1001
-#define IDC_TREE_PROTOCOLS 1003
-#define IDC_CHECK1 1004
-#define IDC_CHECK_STATUSES 1004
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 103
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1005
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/plugins/SkypeStatusChange/src/stdafx.cxx b/plugins/SkypeStatusChange/src/stdafx.cxx
deleted file mode 100644
index f111565f38..0000000000
--- a/plugins/SkypeStatusChange/src/stdafx.cxx
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org)
-
-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 version 2
-of the License.
-
-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, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h" \ No newline at end of file
diff --git a/plugins/SkypeStatusChange/src/stdafx.h b/plugins/SkypeStatusChange/src/stdafx.h
deleted file mode 100644
index 3a9b5d8242..0000000000
--- a/plugins/SkypeStatusChange/src/stdafx.h
+++ /dev/null
@@ -1,132 +0,0 @@
-#pragma once
-
-#include <windows.h>
-#include <stdio.h>
-#include <assert.h>
-#include <commctrl.h>
-
-#include <newpluginapi.h>
-#include <m_database.h>
-#include <m_protocols.h>
-#include <m_protosvc.h>
-#include <m_awaymsg.h>
-#include <m_options.h>
-#include <m_langpack.h>
-#include <m_utils.h>
-
-struct PrevStatus
-{
- PrevStatus(const char *_proto, int _status) :
- szProto(mir_strdup(_proto)),
- iStatus(_status)
- {}
-
- ptrA szProto;
- int iStatus;
-};
-
-struct CMPlugin : public PLUGIN<CMPlugin>
-{
- CMPlugin();
-
- CMOption<bool> bSyncStatusMsg, bSyncStatusState;
-
- int Load() override;
-
- enum
- {
- cssOnline = 0x00000001,
- cssOffline = 0x00000002,
- cssInvisible = 0x00000004,
- cssShortAway = 0x00000008,
- cssLongAway = 0x00000010,
- cssLightDND = 0x00000020,
- cssHeavyDND = 0x00000040,
- cssFreeChat = 0x00000080,
- 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_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 cssFreeChat;
- case ID_STATUS_IDLE: return cssIdle;
- }
- return 0;
- }
-
- OBJLIST<PrevStatus> m_aProtocol2Status;
-
- bool IsProtocolExcluded(const char *pszProtocol)const
- {
- uint32_t dwSettings = db_get_dw(NULL, pszProtocol, "ChangeSkypeStatus_Exclusions", 0);
- return ((dwSettings & cssAll) ? true : false);
- }
-
- bool IsProtocolStatusExcluded(const char *pszProtocol, int nStatus)const
- {
- uint32_t dwSettings = db_get_dw(NULL, pszProtocol, "ChangeSkypeStatus_Exclusions", 0);
- return ((dwSettings & Status2Flag(nStatus)) ? true : false);
- }
-
- void ExcludeProtocol(const char *pszProtocol, bool bExclude)
- {
- uint32_t 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)
- {
- uint32_t 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 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));
- }
-};
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMirandaStatus2SkypeStatus
-{
- int m_nMirandaStatus;
- LPCSTR m_pszSkypeStatus;
- LPCTSTR m_ptszStatusName;
-};
-
-extern const CMirandaStatus2SkypeStatus g_aStatusCode[MAX_STATUS_COUNT];
diff --git a/plugins/SkypeStatusChange/src/version.h b/plugins/SkypeStatusChange/src/version.h
deleted file mode 100644
index c7cbddebe0..0000000000
--- a/plugins/SkypeStatusChange/src/version.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 0
-#define __RELEASE_NUM 0
-#define __BUILD_NUM 18
-
-#include <stdver.h>
-
-#define __PLUGIN_NAME "Skype status change"
-#define __FILENAME "SkypeStatusChange.dll"
-#define __DESCRIPTION "Skype status change according to Miranda status."
-#define __AUTHOR "Dioksin"
-#define __AUTHORWEB "https://miranda-ng.org/p/SkypeStatusChange"
-#define __COPYRIGHT "© 2009-2010 Dioksin"