From c72a0b6171fca66ba363ec7148a1cc03459a0c2f Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 28 Sep 2013 18:23:38 +0000 Subject: ac.dll support removed coz nobody use it and it is too old git-svn-id: http://svn.miranda-ng.org/main/trunk@6261 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Variables/src/parse_external.cpp | 111 ------------------------------- 1 file changed, 111 deletions(-) (limited to 'plugins/Variables/src/parse_external.cpp') diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp index 2cb408c777..152684dc5b 100644 --- a/plugins/Variables/src/parse_external.cpp +++ b/plugins/Variables/src/parse_external.cpp @@ -19,13 +19,6 @@ #include "variables.h" -static int (WINAPI *acEval)(const char *, char *) = NULL; -static int (WINAPI *acFormat)(const char *, char *) = NULL; -static int (WINAPI *acInitClient)(const char *, int, int, int, int) = NULL; -static void (WINAPI *acUninit)() = NULL; - -static unsigned int lastAMIPFailure = -1; - static TCHAR *getFullWinampTitleText() { HWND hwndWinamp = FindWindow(_T("STUDIO"), NULL); @@ -109,114 +102,10 @@ static TCHAR *parseWinampState(ARGUMENTSINFO *ai) return mir_tstrdup(_T("Playing")); } -static unsigned int checkAMIP() -{ - if (lastAMIPFailure == 0) { - log_debugA("AMIP initialized"); - return 0; - } - if (GetTickCount() - lastAMIPFailure < AMIP_TIMEOUT) { - log_debugA("AMIP not initialized, not attempting"); - return -1; - } - if (acInitClient("127.0.0.1", 60333, 1000, 5, 1)) { - lastAMIPFailure = 0; - log_debugA("AMIP now initialized"); - return 0; // success - } - log_debugA("AMIP failed to initialized"); - - /* if this is the first failure after a succesful init, call uninit for a cleanup (maybe it'll help for the next try ;)) */ - if (lastAMIPFailure == 0) - acUninit(); - - lastAMIPFailure = GetTickCount(); - return -1; -} - -static TCHAR *parseAMIPEval(ARGUMENTSINFO *ai) -{ - if (ai->argc != 2) - return NULL; - - char *cmd = mir_t2a(ai->targv[1]); - if (checkAMIP() != 0) { - log_debugA("checkAMIP failed"); - return NULL; - } - - TCHAR *tszRes = NULL; - char szRes[AC_BUFFER_SIZE]; - ZeroMemory(&szRes, sizeof(szRes)); - if (AC_ERR_NOERROR == acEval(cmd, szRes)) - tszRes = mir_a2t(szRes); - else - lastAMIPFailure = GetTickCount(); - - mir_free(cmd); - return tszRes; -} - -static TCHAR *parseAMIPFormat(ARGUMENTSINFO *ai) -{ - if (ai->argc != 2) - return NULL; - - char *cmd = mir_t2a(ai->targv[1]); - if (checkAMIP() != 0) - return NULL; - - TCHAR *tszRes = NULL; - char szRes[AC_BUFFER_SIZE]; - if (AC_ERR_NOERROR == acFormat(cmd, szRes)) - tszRes = mir_a2t(szRes); - else - lastAMIPFailure = GetTickCount(); - - mir_free(cmd); - return tszRes; -} - -static int initAMIP() -{ - HMODULE hModule = LoadLibrary(_T("ac.dll")); - if (hModule == NULL) { - TCHAR path[MAX_PATH]; - GetModuleFileName(NULL, path, MAX_PATH); - TCHAR *cur = _tcsrchr(path, '\\'); - if (cur != NULL) - _tcscpy(cur+1, _T("ac.dll")); - else - _tcscpy(cur, _T("ac.dll")); - hModule = LoadLibrary(path); - } - if (hModule == NULL) - return -1; - - acInitClient = (int (__stdcall *)(const char *,int ,int ,int ,int ))GetProcAddress(hModule, "ac_init_client"); - acEval = (int (__stdcall *)(const char *,char *))GetProcAddress(hModule, "ac_eval"); - acFormat = (int (__stdcall *)(const char *,char *))GetProcAddress(hModule, "ac_format"); - acUninit = (void (__stdcall *)())GetProcAddress(hModule, "ac_uninit"); - return 0; -} - int registerExternalTokens() { registerIntToken(_T(WINAMPSONG), parseWinampSong, TRF_FIELD, LPGEN("External Applications")"\t"LPGEN("retrieves song name of the song currently playing in Winamp")); registerIntToken(_T(WINAMPSTATE), parseWinampState, TRF_FIELD, LPGEN("External Applications")"\t"LPGEN("retrieves current Winamp state (Playing/Paused/Stopped)")); - if (!initAMIP()) { - registerIntToken(_T(AMIPEVAL), parseAMIPEval, TRF_FUNCTION, LPGEN("External Applications")"\t(x)\t"LPGEN("retrieves info from AMIP (x is var_ with any AMIP variable)")); - registerIntToken(_T(AMIPFORMAT), parseAMIPFormat, TRF_FUNCTION|TRF_UNPARSEDARGS, LPGEN("External Applications")"\t(x)\t"LPGEN("retrieves info from AMIP (x is AMIP format string)")); - } - else log_infoA("Variables: ac.dll for AMIP not found"); - return 0; -} - -int deInitExternal() -{ - if (acUninit != NULL) - acUninit(); - return 0; } \ No newline at end of file -- cgit v1.2.3