From 920aa970afa086a3a143b39005747210b94f237b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 7 Apr 2013 20:25:38 +0000 Subject: Trigger plugin's support removed, cause this plugin is dead git-svn-id: http://svn.miranda-ng.org/main/trunk@4374 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Variables/src/action_variables.cpp | 155 ----------------- plugins/Variables/src/condition_variables.cpp | 127 -------------- plugins/Variables/src/main.cpp | 12 -- plugins/Variables/src/trigger_variables.cpp | 228 -------------------------- plugins/Variables/src/trigger_variables.h | 37 ----- plugins/Variables/src/variables.h | 4 - 6 files changed, 563 deletions(-) delete mode 100644 plugins/Variables/src/action_variables.cpp delete mode 100644 plugins/Variables/src/condition_variables.cpp delete mode 100644 plugins/Variables/src/trigger_variables.cpp delete mode 100644 plugins/Variables/src/trigger_variables.h (limited to 'plugins/Variables/src') diff --git a/plugins/Variables/src/action_variables.cpp b/plugins/Variables/src/action_variables.cpp deleted file mode 100644 index deb9a1b3fb..0000000000 --- a/plugins/Variables/src/action_variables.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* - Variables Plugin for Miranda-IM (www.miranda-im.org) - Copyright 2003-2006 P. Boon - - This program is mir_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; either version 2 of the License, or - (at your option) any later version. - - 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, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -// This file has not been converted to unicode yet - -#include "variables.h" - -static void parseStringThread(void *arg) { - - TCHAR *tszParsed; - FORMATINFO *fi; - - fi = (FORMATINFO *)arg; - if (arg == NULL) { - return; - } - tszParsed = (TCHAR*)CallService(MS_VARS_FORMATSTRING, (WPARAM)fi, 0); - log_debugA("parseStringThread: %s > %s", fi->tszFormat, tszParsed); - if (tszParsed != NULL) { - mir_free(tszParsed); - } - if (fi->tszFormat != NULL) { - mir_free(fi->tszFormat); - } - if (fi->tszExtraText != NULL) { - mir_free(fi->tszExtraText); - } - mir_free(fi); -} - - -int ParseStringAction(DWORD actionID, REPORTINFO *ri) { - - if (ri->flags&ACT_PERFORM) { - DBVARIANT dbv; - - if (!DBGetActionSettingTString(actionID, NULL, MODULENAME, SETTING_PARSESTRING, &dbv)) { - if (DBGetActionSettingByte(actionID, NULL, MODULENAME, SETTING_PARSEASYNC, 0)) { - FORMATINFO *fi; - - fi = ( FORMATINFO* )mir_alloc(sizeof(FORMATINFO)); - ZeroMemory(fi, sizeof(FORMATINFO)); - fi->cbSize = sizeof(FORMATINFO); - fi->tszFormat = mir_tstrdup(dbv.ptszVal); - fi->tszExtraText = ((ri->td!=NULL)&&(ri->td->dFlags&DF_TEXT))?mir_tstrdup(ri->td->tszText):NULL; - fi->hContact = ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL; - fi->flags |= FIF_TCHAR; - //forkthread(parseStringThread, 0, fi); - mir_forkthread(parseStringThread, fi); - } - else { - mir_free(variables_parsedup(dbv.ptszVal, ((ri->td!=NULL)&&(ri->td->dFlags&DF_TEXT))?ri->td->tszText:NULL, ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL)); - } - db_free(&dbv); - } - } - if (ri->flags&ACT_CLEANUP) { - REMOVETRIGGERSETTINGS ras; - - ras.cbSize = sizeof(REMOVETRIGGERSETTINGS); - ras.prefix = PREFIX_ACTIONID; - ras.id = actionID; - ras.szModule = MODULENAME; - ras.hContact = NULL; - CallService(MS_TRIGGER_REMOVESETTINGS, 0, (LPARAM)&ras); - } - - return 0; -} - -INT_PTR CALLBACK DlgProcOptsParseString(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - - switch (msg) { - case WM_INITDIALOG: { - DBVARIANT dbv; - DWORD actionID; - - TranslateDialogDefault(hwndDlg); - actionID = (DWORD)lParam; - if (!DBGetActionSettingTString(actionID, NULL, MODULENAME, SETTING_PARSESTRING, &dbv)) { - SetDlgItemText(hwndDlg, IDC_PARSESTRING, dbv.ptszVal); - db_free(&dbv); - } - CheckDlgButton(hwndDlg, IDC_PARSEASYNC, DBGetActionSettingByte(actionID, NULL, MODULENAME, SETTING_PARSEASYNC, 0)?BST_CHECKED:BST_UNCHECKED); - variables_skin_helpbutton(hwndDlg, IDC_SHOWHELP); - break; - } - - case WM_COMMAND: - switch(LOWORD(wParam)) { - case IDC_SHOWHELP: { - int flags; - VARHELPINFO vhi; - TRIGGERINFO ti; - - ZeroMemory(&ti, sizeof(TRIGGERINFO)); - SendMessage(GetParent(hwndDlg), TM_GETTRIGGERINFO, 0, (LPARAM)&ti); - ZeroMemory(&vhi, sizeof(VARHELPINFO)); - vhi.cbSize = sizeof(VARHELPINFO); - vhi.flags = VHF_INPUT; - if (ti.dFlags&DF_TEXT) { - vhi.flags |= VHF_EXTRATEXT; - vhi.szExtraTextDesc = "TriggerData: Text"; - } - else { - flags |= VHF_HIDESUBJECTTOKEN; - } - if (ti.dFlags&DF_CONTACT) { - flags |= VHF_SUBJECT; - vhi.szSubjectDesc = "TriggerData: Contact"; - } - else { - flags |= VHF_HIDEEXTRATEXTTOKEN; - } - vhi.hwndCtrl = GetDlgItem(hwndDlg, IDC_PARSESTRING); - CallService(MS_VARS_SHOWHELPEX, (WPARAM)hwndDlg, (LPARAM)&vhi); - break; - } - } - break; - - case TM_ADDACTION: { - // wParam = action ID - // lParam = 0 - DWORD actionID = (DWORD)wParam; - TCHAR *tszText = Hlp_GetDlgItemText(hwndDlg, IDC_PARSESTRING); - if (tszText != NULL) { - DBWriteActionSettingTString(actionID, NULL, MODULENAME, SETTING_PARSESTRING, tszText); - mir_free(tszText); - } - DBWriteActionSettingByte(actionID, NULL, MODULENAME, SETTING_PARSEASYNC, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PARSEASYNC)); - break; - } - - case WM_DESTROY: - break; - } - - return FALSE; -} \ No newline at end of file diff --git a/plugins/Variables/src/condition_variables.cpp b/plugins/Variables/src/condition_variables.cpp deleted file mode 100644 index 964e34bec7..0000000000 --- a/plugins/Variables/src/condition_variables.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - Variables Plugin for Miranda-IM (www.miranda-im.org) - Copyright 2003-2006 P. Boon - - This program is mir_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; either version 2 of the License, or - (at your option) any later version. - - 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, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ -// This file has not been converted to unicode yet - -#include "variables.h" - -int ParseStringCondition(DWORD conditionID, REPORTINFO *ri) { - - int res; - - res = CRV_TRUE; - if (ri->flags&CND_PERFORM) { - DBVARIANT dbv; - - if (!DBGetConditionSettingTString(conditionID, NULL, MODULENAME, SETTING_PARSESTRING, &dbv)) { - FORMATINFO fi; - - ZeroMemory(&fi, sizeof(FORMATINFO)); - fi.cbSize = sizeof(FORMATINFO); - fi.tszFormat = dbv.ptszVal; - fi.tszExtraText = ((ri->td!=NULL)&&(ri->td->dFlags&DF_TEXT))?ri->td->tszText:NULL; - fi.hContact = ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL; - fi.flags |= FIF_TCHAR; - mir_free((TCHAR*)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0)); - log_debugA("err: %d", fi.eCount); - res = fi.eCount==0?CRV_TRUE:CRV_FALSE; - db_free(&dbv); - } - } - if (ri->flags&CND_CLEANUP) { - REMOVETRIGGERSETTINGS ras; - - ras.cbSize = sizeof(REMOVETRIGGERSETTINGS); - ras.prefix = PREFIX_CONDITIONID; - ras.id = conditionID; - ras.szModule = MODULENAME; - ras.hContact = NULL; - CallService(MS_TRIGGER_REMOVESETTINGS, 0, (LPARAM)&ras); - } - - return res; -} - -INT_PTR CALLBACK DlgProcOptsCondition(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - - switch (msg) { - case WM_INITDIALOG: { - DBVARIANT dbv; - DWORD conditionID; - - TranslateDialogDefault(hwndDlg); - conditionID = (DWORD)lParam; - if (!DBGetConditionSettingTString(conditionID, NULL, MODULENAME, SETTING_PARSESTRING, &dbv)) { - SetDlgItemText(hwndDlg, IDC_PARSESTRING, dbv.ptszVal); - db_free(&dbv); - } - break; - } - - case WM_COMMAND: - switch(LOWORD(wParam)) { - case IDC_SHOWHELP: { - int flags; - VARHELPINFO vhi; - TRIGGERINFO ti; - - ZeroMemory(&vhi, sizeof(VARHELPINFO)); - vhi.cbSize = sizeof(VARHELPINFO); - ZeroMemory(&ti, sizeof(TRIGGERINFO)); - SendMessage(GetParent(hwndDlg), TM_GETTRIGGERINFO, 0, (LPARAM)&ti); - vhi.flags = VHF_INPUT; - if (ti.dFlags&DF_TEXT) { - vhi.flags |= VHF_EXTRATEXT; - vhi.szExtraTextDesc = "TriggerData: Text"; - } - else { - flags |= VHF_HIDEEXTRATEXTTOKEN; - } - if (ti.dFlags&DF_CONTACT) { - flags |= VHF_SUBJECT; - vhi.szSubjectDesc = "TriggerData: Contact"; - } - else { - flags |= VHF_HIDESUBJECTTOKEN; - } - vhi.hwndCtrl = GetDlgItem(hwndDlg, IDC_PARSESTRING); - CallService(MS_VARS_SHOWHELPEX, (WPARAM)hwndDlg, (LPARAM)&vhi); - break; - } - } - break; - - case TM_ADDCONDITION: { - DWORD conditionID; - TCHAR *tszText; - - conditionID = (DWORD)wParam; - tszText = Hlp_GetDlgItemText(hwndDlg, IDC_PARSESTRING); - if (tszText != NULL) { - DBWriteConditionSettingTString(conditionID, NULL, MODULENAME, SETTING_PARSESTRING, tszText); - mir_free(tszText); - } - break; - } - - case WM_DESTROY: - break; - } - - return FALSE; -} \ No newline at end of file diff --git a/plugins/Variables/src/main.cpp b/plugins/Variables/src/main.cpp index b107d12023..1df2b3ac41 100644 --- a/plugins/Variables/src/main.cpp +++ b/plugins/Variables/src/main.cpp @@ -23,16 +23,6 @@ HINSTANCE hInst; DWORD g_mirandaVersion; int hLangpack = 0; -static int ModulesLoaded(WPARAM wParam, LPARAM lParam) -{ - // trigger plugin -#if !defined(WINE) - initTriggerModule(); -#endif - - return 0; -} - BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { hInst = hinstDLL; @@ -69,9 +59,7 @@ extern "C" int __declspec(dllexport) Load(void) { mir_getLP( &pluginInfoEx ); - HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); LoadVarModule(); - return 0; } diff --git a/plugins/Variables/src/trigger_variables.cpp b/plugins/Variables/src/trigger_variables.cpp deleted file mode 100644 index 75920eb453..0000000000 --- a/plugins/Variables/src/trigger_variables.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/* - Variables Plugin for Miranda-IM (www.miranda-im.org) - Copyright 2003-2006 P. Boon - - This program is mir_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; either version 2 of the License, or - (at your option) any later version. - - 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, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "variables.h" - -static TRG_VAR_CACHE *tvc = NULL; -static int tvcCount = 0; -static unsigned int stringChangeTimerID = 0; - -static int addToCache(DWORD triggerID) -{ - /* triggerID must be in the DB */ - DBVARIANT dbv; - - for (int i=0; i < tvcCount; i++) { - if (tvc[i].triggerID == triggerID) { - mir_free(tvc[i].parsedText); - MoveMemory(&tvc[i], &tvc[tvcCount-1], sizeof(TRG_VAR_CACHE)); - tvcCount -= 1; - } - } - if ( DBGetTriggerSettingTString(triggerID, NULL, MODULENAME, SETTING_TRIGGERTEXT, &dbv)) - return -1; - - tvc = ( TRG_VAR_CACHE* )mir_realloc(tvc, (tvcCount+1)*sizeof(TRG_VAR_CACHE)); - if (tvc == NULL) - return -1; - - tvc[tvcCount].triggerID = triggerID; - tvc[tvcCount].parsedText = variables_parsedup(dbv.ptszVal, NULL, NULL); - // it stays in our own mem space! - if (tvc[tvcCount].parsedText == NULL) - return -1; - - tvcCount += 1; - db_free(&dbv); - return 0; -} - -static int removeFromCache(DWORD triggerID) { - - int i; - - for (i=0;i #include -#include #include #include "..\helpers\gen_helpers.h" @@ -64,7 +63,6 @@ #include "resource.h" #include "version.h" #include "contact.h" -#include "trigger_variables.h" #include "enumprocs.h" #include "parse_alias.h" #include "parse_external.h" @@ -196,8 +194,6 @@ int registerRegExpTokens(); int registerInetTokens(); // xml int registerXsltTokens(); -// trigger -int initTriggerModule(); // help INT_PTR showHelpService(WPARAM wParam, LPARAM lParam); INT_PTR showHelpExService(WPARAM wParam, LPARAM lParam); -- cgit v1.2.3