From 931a7dc1ac0dbc7e6c1083583ced915e572f5b47 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 2 Mar 2019 12:32:44 +0300 Subject: all protocols (even virtual ones) moved to the Protocols folder --- plugins/Non-IM Contact/src/timer.cpp | 85 ------------------------------------ 1 file changed, 85 deletions(-) delete mode 100644 plugins/Non-IM Contact/src/timer.cpp (limited to 'plugins/Non-IM Contact/src/timer.cpp') diff --git a/plugins/Non-IM Contact/src/timer.cpp b/plugins/Non-IM Contact/src/timer.cpp deleted file mode 100644 index 6e34352f2e..0000000000 --- a/plugins/Non-IM Contact/src/timer.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "stdafx.h" - -static UINT_PTR timerId = 0; - -//===================================================== -// Name : timerProc -// Parameters: none -// Returns : void -// Description : called when the timer interval occurs -//===================================================== -// -void timerFunc(void*) -{ - char text[512], fn[16], szFileName[MAX_PATH], temp[MAX_PATH]; - - int timerCount = g_plugin.getWord("timerCount", 1) + 1; - - if (LCStatus == ID_STATUS_OFFLINE) { - killTimer(); - return; - } - g_plugin.setWord("timerCount", (WORD)timerCount); - - /* update the web pages*/ - for (int i = 0;; i++) { - mir_snprintf(fn, "fn%d", i); - if (db_get_static(NULL, MODNAME, fn, text, _countof(text))) - break; - - if (!strncmp("http://", text, mir_strlen("http://")) || !strncmp("https://", text, mir_strlen("https://"))) { - mir_snprintf(fn, "fn%d_timer", i); - int timer = g_plugin.getWord(fn, 60); - if (timer && !(timerCount % timer)) { - if (!InternetDownloadFile(text)) { - mir_snprintf(szFileName, "%s\\plugins\\fn%d.html", getMimDir(temp), i); - savehtml(szFileName); - } - } - } - } - - /* update all the contacts */ - for (auto &hContact : Contacts(MODNAME)) { - int timer = g_plugin.getWord(hContact, "Timer", 15); - if (timer && !(timerCount % timer)) - if (!db_get_static(hContact, MODNAME, "Name", text, _countof(text))) - replaceAllStrings(hContact); - } -} - -void CALLBACK timerProc(HWND, UINT, UINT_PTR, DWORD) -{ - // new thread for the timer... - mir_forkthread(timerFunc); -} - -//===================================================== -// Name : startTimer -// Parameters: int interval -// Returns : int -// Description : starts the timer -//===================================================== -// -int startTimer(int interval) -{ - timerId = SetTimer(nullptr, 0, interval, timerProc); - return 0; -} - -//===================================================== -// Name : killTimer -// Parameters: none -// Returns : int -// Description : stops the timer -//===================================================== -// -int killTimer() -{ - if (timerId != 0) { - g_plugin.setWord("timerCount", 0); - KillTimer(nullptr, timerId); - timerId = 0; - } - return 0; -} -- cgit v1.2.3