diff options
58 files changed, 45 insertions, 4010 deletions
diff --git a/plugins/Alarms/alarms_10.vcxproj b/plugins/Alarms/alarms_10.vcxproj index ca3ec877c7..bbf2b9e395 100644 --- a/plugins/Alarms/alarms_10.vcxproj +++ b/plugins/Alarms/alarms_10.vcxproj @@ -192,7 +192,6 @@ <ClCompile Include="src\icons.cpp" />
<ClCompile Include="src\options.cpp" />
<ClCompile Include="src\time_utils.cpp" />
- <ClCompile Include="src\trigger.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\alarm_win.h" />
@@ -204,7 +203,6 @@ <ClInclude Include="src\options.h" />
<ClInclude Include="src\resource.h" />
<ClInclude Include="src\time_utils.h" />
- <ClInclude Include="src\trigger.h" />
<ClInclude Include="src\Version.h" />
</ItemGroup>
<ItemGroup>
diff --git a/plugins/Alarms/alarms_10.vcxproj.filters b/plugins/Alarms/alarms_10.vcxproj.filters index eaa1d16080..103a59191d 100644 --- a/plugins/Alarms/alarms_10.vcxproj.filters +++ b/plugins/Alarms/alarms_10.vcxproj.filters @@ -36,9 +36,6 @@ <ClCompile Include="src\time_utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\trigger.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -71,9 +68,6 @@ <ClInclude Include="src\time_utils.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\trigger.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\Version.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/Alarms/alarms_11.vcxproj b/plugins/Alarms/alarms_11.vcxproj index 988030635a..78b46ef6a1 100644 --- a/plugins/Alarms/alarms_11.vcxproj +++ b/plugins/Alarms/alarms_11.vcxproj @@ -197,7 +197,6 @@ <ClCompile Include="src\icons.cpp" />
<ClCompile Include="src\options.cpp" />
<ClCompile Include="src\time_utils.cpp" />
- <ClCompile Include="src\trigger.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\alarm_win.h" />
@@ -209,7 +208,6 @@ <ClInclude Include="src\options.h" />
<ClInclude Include="src\resource.h" />
<ClInclude Include="src\time_utils.h" />
- <ClInclude Include="src\trigger.h" />
<ClInclude Include="src\Version.h" />
</ItemGroup>
<ItemGroup>
diff --git a/plugins/Alarms/alarms_11.vcxproj.filters b/plugins/Alarms/alarms_11.vcxproj.filters index eaa1d16080..103a59191d 100644 --- a/plugins/Alarms/alarms_11.vcxproj.filters +++ b/plugins/Alarms/alarms_11.vcxproj.filters @@ -36,9 +36,6 @@ <ClCompile Include="src\time_utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\trigger.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -71,9 +68,6 @@ <ClInclude Include="src\time_utils.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\trigger.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\Version.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index 15956ca62d..05a3e73d67 100644 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -32,7 +32,6 @@ void copy_alarm_data(ALARM *dest, ALARM *src) { dest->snoozer = src->snoozer;
dest->sound_num = src->sound_num;
dest->time = src->time;
- dest->trigger_id = src->trigger_id;
free_alarm_data(dest);
dest->szTitle = mir_tstrdup(src->szTitle);
@@ -241,9 +240,6 @@ void LoadAlarms() { break;
}
- sprintf(buff, "TriggerID%d", i);
- alarm.trigger_id = db_get_dw(0, MODULE, buff, 0);
-
if (UpdateAlarm(alarm.time, alarm.occurrence)) {
sprintf(buff, "ActionFlags%d", i);
alarm.action = (unsigned short)db_get_dw(0, MODULE, buff, AAF_POPUP | AAF_SOUND);
@@ -280,15 +276,6 @@ void LoadAlarms() { alarm.id = next_alarm_id++;
alarms.push_back(&alarm);
-
- } else { // else ignore it - it's an expired one-off alarm (but clean up triggers)
- if (alarm.trigger_id != 0 && ServiceExists(MS_TRIGGER_REPORTEVENT)) {
- REPORTINFO ri = {0};
- ri.cbSize = sizeof(ri);
- ri.triggerID = alarm.trigger_id;
- ri.flags = TRG_CLEANUP;
- CallService(MS_TRIGGER_REPORTEVENT, 0, (LPARAM)&ri);
- }
}
free_alarm_data(&alarm);
}
@@ -359,9 +346,6 @@ void SaveAlarms() { sprintf(buff, "Flags%d", index);
db_set_dw(0, MODULE, buff, i->flags);
-
- sprintf(buff, "TriggerID%d", index);
- db_set_dw(0, MODULE, buff, i->trigger_id);
}
db_set_w(0, MODULE, "Count", index);
@@ -440,13 +424,6 @@ void remove(unsigned short alarm_id) { ALARM *i;
for(alarms.reset(); i = alarms.current(); alarms.next()) {
if (i->id == alarm_id) {
- if (i->trigger_id != 0 && ServiceExists(MS_TRIGGER_REPORTEVENT)) {
- REPORTINFO ri = {0};
- ri.cbSize = sizeof(ri);
- ri.triggerID = i->trigger_id;
- ri.flags = TRG_CLEANUP;
- CallService(MS_TRIGGER_REPORTEVENT, 0, (LPARAM)&ri);
- }
alarms.erase();
break;
}
@@ -589,19 +566,8 @@ void DoAlarm(ALARM *alarm) }
}
- if (alarm->trigger_id != 0 && ServiceExists(MS_TRIGGER_REPORTEVENT)) {
- REPORTINFO ri = {0};
- ri.cbSize = sizeof(ri);
- ri.triggerID = alarm->trigger_id;
- ri.flags = TRG_PERFORM;
- if (alarm->occurrence == OC_ONCE)
- ri.flags |= TRG_CLEANUP;
- CallService(MS_TRIGGER_REPORTEVENT, 0, (LPARAM)&ri);
- }
-
- if (alarm->action & AAF_COMMAND) {
+ if (alarm->action & AAF_COMMAND)
ShellExecute(0, 0, alarm->szCommand, alarm->szCommandParams, 0, SW_NORMAL);
- }
if (alarm->action & AAF_SYSTRAY)
{
diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp index e0c57e81a8..6fe54250fe 100644 --- a/plugins/Alarms/src/alarms.cpp +++ b/plugins/Alarms/src/alarms.cpp @@ -179,10 +179,6 @@ static int MainInit(WPARAM wparam,LPARAM lparam) HookEvent(ME_TTB_MODULELOADED, InitTopToolbarButton);
InitFrames();
-
- // TriggerPlugin support
- LoadTriggerSupport();
-
return 0;
}
diff --git a/plugins/Alarms/src/alarms.h b/plugins/Alarms/src/alarms.h index 94b171d867..1f480e4bc0 100644 --- a/plugins/Alarms/src/alarms.h +++ b/plugins/Alarms/src/alarms.h @@ -5,7 +5,5 @@ #include "alarmlist.h"
#include "options.h"
#include "frame.h"
-#include "trigger.h"
-
#endif
diff --git a/plugins/Alarms/src/common.h b/plugins/Alarms/src/common.h index 7b95360343..c2116c679b 100644 --- a/plugins/Alarms/src/common.h +++ b/plugins/Alarms/src/common.h @@ -27,7 +27,6 @@ #include <win2k.h>
#include <m_toptoolbar.h>
-#include <m_trigger.h>
#include <m_alarms.h>
#include "resource.h"
@@ -51,7 +50,6 @@ typedef struct ALARM_tag { TCHAR *szCommandParams;
BYTE sound_num;
int flags;
- DWORD trigger_id;
} ALARM;
#endif
diff --git a/plugins/Alarms/src/trigger.cpp b/plugins/Alarms/src/trigger.cpp deleted file mode 100644 index 532b98920c..0000000000 --- a/plugins/Alarms/src/trigger.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include "common.h"
-#include "trigger.h"
-
-AlarmList alist;
-//SPECIFICTRIGGERINFO sti;
-TRIGGERDATA td;
-
-unsigned short last_selected_id = 0;
-
-static INT_PTR CALLBACK DlgProcTriggerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch(msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- copy_list(alist);
- ALARM *i;
- for(alist.reset(); i = alist.current(); alist.next()) {
- int pos = SendDlgItemMessage(hwndDlg, IDC_LST_TRIGLIST, LB_ADDSTRING, (WPARAM)-1, (LPARAM)i->szTitle);
- SendDlgItemMessage(hwndDlg, IDC_LST_TRIGLIST, LB_SETITEMDATA, (WPARAM)pos, (LPARAM)i->id);
- if (i->trigger_id == (unsigned int)lParam)
- SendDlgItemMessage(hwndDlg, IDC_LST_TRIGLIST, LB_SETCURSEL, (WPARAM)pos, 0);
- }
- }
- return FALSE;
-
- case WM_COMMAND:
- if (HIWORD( wParam ) == LBN_SELCHANGE) {
- int pos = SendDlgItemMessage(hwndDlg, IDC_LST_TRIGLIST, LB_GETCURSEL, 0, 0);
- if (pos != LB_ERR) {
- last_selected_id = (unsigned short)SendDlgItemMessage(hwndDlg, IDC_LST_TRIGLIST, LB_GETITEMDATA, pos, 0);
- }
- return TRUE;
- }
- break;
- case TM_GETTRIGGERINFO:
- {
- //memset(&sti, sizeof(sti), 0);
- memset(&td, sizeof(td), 0);
-
- ALARM *i;
- for(alist.reset(); i = alist.current(); alist.next()) {
- if (i->trigger_id == wParam) {
- //sti.cbSize = sizeof(sti);
- //sti.triggerID = wParam;
- //sti.pszSummary = i->szTitle;
- //sti.td = &td;
-
- td.cbSize = sizeof(td);
- td.dFlags = DF_TEXT;
- td.tszText = i->szDesc;
- //*(SPECIFICTRIGGERINFO **)lParam = &sti;
- break;
- }
- }
- }
- return TRUE;
- case TM_ADDTRIGGER:
- {
- ALARM *i;
- for(alist.reset(); i = alist.current(); alist.next()) {
- if (i->id == last_selected_id) {
- i->trigger_id = wParam;
- alter_alarm_list(i);
- break;
- }
- }
- }
- return TRUE;
- case TM_DELTRIGGER:
- {
- ALARM *i;
- for(alist.reset(); i = alist.current(); alist.next()) {
- if (i->trigger_id == wParam) {
- i->trigger_id = 0;
- alter_alarm_list(i);
- break;
- }
- }
- }
- return TRUE;
-
- case WM_DESTROY:
- // it seems this is called before the TM_ADDTRIGGER messsage is passed to us....tsk,tsk :P
- //alist.clear();
- break;
-
- }
- return FALSE;
-}
-
-int LoadTriggerSupport() {
- if (ServiceExists(MS_TRIGGER_REGISTERTRIGGER)) {
- TRIGGERREGISTER treg = {0};
-
- treg.cbSize = sizeof(treg);
- treg.pszName = Translate("Alarms");
- treg.hInstance = hInst;
- treg.pfnDlgProc = DlgProcTriggerOptions;
- treg.pszTemplate = MAKEINTRESOURCEA(IDD_OPTTRIGGER);
-
- CallService(MS_TRIGGER_REGISTERTRIGGER, 0, (LPARAM)&treg);
- }
-
- return 0;
-}
diff --git a/plugins/Alarms/src/trigger.h b/plugins/Alarms/src/trigger.h deleted file mode 100644 index 3b326e78a4..0000000000 --- a/plugins/Alarms/src/trigger.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _TRIGGER_INC
-#define _TRIGGER_INC
-
-#include "alarmlist.h"
-
-
-int LoadTriggerSupport();
-
-
-#endif
-
diff --git a/plugins/AutoShutdown/src/common.h b/plugins/AutoShutdown/src/common.h index 4c117f02ee..8a0ad9b66b 100644 --- a/plugins/AutoShutdown/src/common.h +++ b/plugins/AutoShutdown/src/common.h @@ -57,7 +57,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_weather.h>
#include <m_hddinfo.h>
#include <m_toptoolbar.h>
-#include <m_trigger.h>
#include <m_autoreplacer.h>
#include <m_magneticwindows.h>
#include <m_snappingwindows.h>
diff --git a/plugins/AutoShutdown/src/options.cpp b/plugins/AutoShutdown/src/options.cpp index 6b6fb3039b..2c3ce593df 100644 --- a/plugins/AutoShutdown/src/options.cpp +++ b/plugins/AutoShutdown/src/options.cpp @@ -105,8 +105,7 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,L static int ShutdownOptInit(WPARAM wParam, LPARAM lParam)
{
- OPTIONSDIALOGPAGE odp = {0};
- odp.cbSize=sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SHUTDOWN);
odp.position = 900000002;
@@ -119,60 +118,12 @@ static int ShutdownOptInit(WPARAM wParam, LPARAM lParam) return 0;
}
-/************************* Trigger ************************************/
-
-static int __stdcall ActionProc(DWORD idAction,REPORTINFO *ri,int shutdownType)
-{
- if(idAction&ACT_PERFORM) ServiceShutdown(shutdownType,TRUE);
- return 0;
-}
-#define ActionProcJmp(shutdownType) { return ActionProc(id,ri,shutdownType); }
-
-static int CloseActionProc(DWORD id,REPORTINFO *ri) ActionProcJmp(SDSDT_CLOSEMIRANDA)
-static int SetOfflineActionProc(DWORD id,REPORTINFO *ri) ActionProcJmp(SDSDT_SETMIRANDAOFFLINE)
-static int LogoffActionProc(DWORD id,REPORTINFO *ri) ActionProcJmp(SDSDT_LOGOFF)
-static int RebootActionProc(DWORD id,REPORTINFO *ri) ActionProcJmp(SDSDT_REBOOT)
-static int ShutdownActionProc(DWORD id,REPORTINFO *ri) ActionProcJmp(SDSDT_SHUTDOWN)
-static int StandbyActionProc(DWORD id,REPORTINFO *ri) ActionProcJmp(SDSDT_STANDBY)
-static int HibernateActionProc(DWORD id,REPORTINFO *ri) ActionProcJmp(SDSDT_HIBERNATE)
-static int LockActionProc(DWORD id,REPORTINFO *ri) ActionProcJmp(SDSDT_LOCKWORKSTATION)
-static int HangupActionProc(DWORD id,REPORTINFO *ri) ActionProcJmp(SDSDT_CLOSERASCONNECTIONS)
-
-static int TriggerRegisterActions(WPARAM wParam,LPARAM lParam)
-{
- /* new trigger API (0.2.0.69+) */
- if(ServiceExists(MS_TRIGGER_REGISTERCONDITION)) {
- ACTIONREGISTER ar;
- BYTE shutdownType;
- char *pszDesc,szName[138];
- ACTIONFUNCTION actionFunctions[SDSDT_MAX]={CloseActionProc,SetOfflineActionProc,LogoffActionProc,
- RebootActionProc,ShutdownActionProc,StandbyActionProc,
- HibernateActionProc,LockActionProc,HangupActionProc};
- ZeroMemory(&ar,sizeof(ar));
- ar.cbSize=sizeof(ar);
- ar.flags=ARF_TCHAR|ARF_FUNCTION;
- ar.pszName=szName;
- for(shutdownType=1;shutdownType<=SDSDT_MAX;++shutdownType)
- if(ServiceIsTypeEnabled(shutdownType,0)) {
- pszDesc=(char*)ServiceGetTypeDescription(shutdownType,GSTDF_UNTRANSLATED);
- if(pszDesc!=NULL) {
- mir_snprintf(szName,sizeof(szName),"Shutdown: %s",pszDesc); /* autotranslated */
- ar.actionFunction=actionFunctions[shutdownType-1];
- CallService(MS_TRIGGER_REGISTERACTION,0,(LPARAM)&ar);
- }
- }
- }
- return 0;
-}
-
/************************* Misc ***************************************/
void InitOptions(void)
{
/* Option Page */
hHookOptInit=HookEvent(ME_OPT_INITIALISE,ShutdownOptInit);
- /* Trigger */
- hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,TriggerRegisterActions);
}
void UninitOptions(void)
diff --git a/plugins/BossKeyPlus/BossKey_10.vcxproj b/plugins/BossKeyPlus/BossKey_10.vcxproj index f4abe8e8d0..9cb288004f 100644 --- a/plugins/BossKeyPlus/BossKey_10.vcxproj +++ b/plugins/BossKeyPlus/BossKey_10.vcxproj @@ -181,7 +181,6 @@ <ItemGroup>
<ClCompile Include="src\BossKey.cpp" />
<ClCompile Include="src\BossKeyIdle.cpp" />
- <ClCompile Include="src\BossKeyTriggers.cpp" />
<ClCompile Include="src\Options.cpp" />
<ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
diff --git a/plugins/BossKeyPlus/BossKey_10.vcxproj.filters b/plugins/BossKeyPlus/BossKey_10.vcxproj.filters index 0ed628eb54..7fe41a705c 100644 --- a/plugins/BossKeyPlus/BossKey_10.vcxproj.filters +++ b/plugins/BossKeyPlus/BossKey_10.vcxproj.filters @@ -21,9 +21,6 @@ <ClCompile Include="src\BossKeyIdle.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\BossKeyTriggers.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\Options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/plugins/BossKeyPlus/BossKey_11.vcxproj b/plugins/BossKeyPlus/BossKey_11.vcxproj index ce537fe9e5..8ca054b772 100644 --- a/plugins/BossKeyPlus/BossKey_11.vcxproj +++ b/plugins/BossKeyPlus/BossKey_11.vcxproj @@ -186,7 +186,6 @@ <ItemGroup>
<ClCompile Include="src\BossKey.cpp" />
<ClCompile Include="src\BossKeyIdle.cpp" />
- <ClCompile Include="src\BossKeyTriggers.cpp" />
<ClCompile Include="src\Options.cpp" />
<ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
diff --git a/plugins/BossKeyPlus/BossKey_11.vcxproj.filters b/plugins/BossKeyPlus/BossKey_11.vcxproj.filters index 0ed628eb54..7fe41a705c 100644 --- a/plugins/BossKeyPlus/BossKey_11.vcxproj.filters +++ b/plugins/BossKeyPlus/BossKey_11.vcxproj.filters @@ -21,9 +21,6 @@ <ClCompile Include="src\BossKeyIdle.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\BossKeyTriggers.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\Options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index df278659e4..c4ab8cbd71 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -370,9 +370,6 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) if (g_bWindowHidden || g_fOptionsOpen) // already hidden or in options, no hiding
break;
- if (ServiceExists(MS_TRIGGER_REGISTERTRIGGER))
- BossKeyEvent(g_bWindowHidden, 0);
-
DWORD dwWndPID; // remember foreground window
HWND hForegroundWnd = GetForegroundWindow();
GetWindowThreadProcessId(hForegroundWnd,&dwWndPID);
@@ -464,13 +461,8 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) }
}
- if (ServiceExists(MS_TRIGGER_REGISTERTRIGGER))
- BossKeyEvent(g_bWindowHidden, 0);
-
if (g_wMask & OPT_CHANGESTATUS && g_wMask & OPT_SETONLINEBACK) // set back to some status
- {
BackAllProtoStatuses();
- }
HWND_ITEM *pCurWnd = g_pMirWnds;
while (pCurWnd != NULL)
@@ -773,10 +765,7 @@ int MirandaLoaded(WPARAM wParam,LPARAM lParam) if (g_wMaskAdv & OPT_MENUITEM)
BossKeyMenuItemInit();
- if (ServiceExists(MS_TRIGGER_REGISTERTRIGGER))
- RegisterTrigger();
-
-// Register token for variables plugin
+ // Register token for variables plugin
if (ServiceExists(MS_VARS_REGISTERTOKEN))
{
TOKENREGISTER tr = {0};
@@ -796,8 +785,7 @@ int MirandaLoaded(WPARAM wParam,LPARAM lParam) if (g_bOldSetting && !(g_wMaskAdv & OPT_RESTORE)) // Restore settings if Miranda was crushed or killed in hidden mode and "Restore hiding on startup after failure" option is disabled
RestoreOldSettings();
- if (g_wMaskAdv & OPT_HIDEONSTART ||
- (g_wMaskAdv & OPT_RESTORE && g_bOldSetting))
+ if ((g_wMaskAdv & OPT_HIDEONSTART) || (g_wMaskAdv & OPT_RESTORE && g_bOldSetting))
BossKeyHideMiranda(0, 0);
return(0);
diff --git a/plugins/BossKeyPlus/src/BossKey.h b/plugins/BossKeyPlus/src/BossKey.h index e0f8cb61e1..6c7577afc2 100644 --- a/plugins/BossKeyPlus/src/BossKey.h +++ b/plugins/BossKeyPlus/src/BossKey.h @@ -44,7 +44,6 @@ #include <m_message.h>
#include <m_hotkeys.h>
-#include <m_trigger.h>
#include <m_variables.h>
#include <m_toptoolbar.h>
#include <m_msg_buttonsbar.h>
@@ -97,8 +96,6 @@ int OptsDlgInit(WPARAM wParam,LPARAM lParam); INT_PTR BossKeyHideMiranda(WPARAM wParam, LPARAM lParam);
void BossKeyMenuItemInit(void);
void BossKeyMenuItemUnInit(void);
-int BossKeyEvent(WPARAM wParam, LPARAM lParam);
-int RegisterTrigger(void);
TCHAR *GetBossKeyText(void);
void InitIdleTimer(void);
void UninitIdleTimer(void);
diff --git a/plugins/BossKeyPlus/src/BossKeyTriggers.cpp b/plugins/BossKeyPlus/src/BossKeyTriggers.cpp deleted file mode 100644 index bd1f39a7bd..0000000000 --- a/plugins/BossKeyPlus/src/BossKeyTriggers.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/*
- BossKey - Hide Miranda from your boss :)
- Copyright (C) 2002-2003 Goblineye Entertainment, (C) 2007-2010 Billy_Bons
-
- 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; 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 "BossKey.h"
-extern HANDLE g_hIsHiddenService;
-
-static INT_PTR CALLBACK DlgProcOptsBossKeyTrigger(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
-
- switch (msg) {
- case WM_INITDIALOG: {
- /* lParam = (LPARAM)(DWORD)triggerID, or 0 if this is a new trigger */
- DWORD triggerID;
-
- triggerID = (DWORD)lParam;
- TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_BK_HIDE, (DBGetTriggerSettingWord(triggerID, NULL, MOD_NAME, SETTING_TRIGGERON, 0)&TRIGGER_BK_HIDE)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_BK_SHOW, (DBGetTriggerSettingWord(triggerID, NULL, MOD_NAME, SETTING_TRIGGERON, 0)&TRIGGER_BK_SHOW)?BST_CHECKED:BST_UNCHECKED);
- break;
- }
-
- case TM_ADDTRIGGER: {
- DWORD triggerID;
- int flags = 0;
-
- triggerID = (DWORD)wParam;
- flags |= IsDlgButtonChecked(hwndDlg, IDC_BK_HIDE)?TRIGGER_BK_HIDE:0;
- flags |= IsDlgButtonChecked(hwndDlg, IDC_BK_SHOW)?TRIGGER_BK_SHOW:0;
- DBWriteTriggerSettingWord(triggerID, NULL, MOD_NAME, SETTING_TRIGGERON, (WORD)flags);
- break;
- }
-
- case TM_DELTRIGGER: {
- DWORD triggerID;
- REMOVETRIGGERSETTINGS rts;
-
- triggerID = (DWORD)wParam;
- rts.cbSize = sizeof(REMOVETRIGGERSETTINGS);
- rts.prefix = PREFIX_TRIGGERID;
- rts.id = triggerID;
- rts.hContact = NULL;
- rts.szModule = MOD_NAME;
- CallService(MS_TRIGGER_REMOVESETTINGS, 0, (LPARAM)&rts);
- break;
- }
- }
-
- return FALSE;
-}
-
-int BossKeyEvent(WPARAM wParam, LPARAM lParam) {
-
- DWORD triggerID = 0;
- REPORTINFO ri;
- TRIGGERDATA td;
- int flags;
-
- do {
- triggerID = (DWORD)CallService(MS_TRIGGER_FINDNEXTTRIGGERID, triggerID, (LPARAM)TRIGGERNAME);
- if (triggerID == 0) {
- continue;
- }
- ZeroMemory(&td, sizeof(TRIGGERDATA));
- td.cbSize = sizeof(TRIGGERDATA);
- flags = DBGetTriggerSettingWord(triggerID, NULL, MOD_NAME, SETTING_TRIGGERON, 0);
- switch (wParam) {
- case 0:
- if (!(flags&TRIGGER_BK_HIDE)) {
- continue;
- }
- break;
- case 1:
- if (!(flags&TRIGGER_BK_SHOW)) {
- continue;
- }
- break;
- default:
- continue;
- break;
- }
- ZeroMemory(&ri, sizeof(REPORTINFO));
- ri.cbSize = sizeof(REPORTINFO);
- ri.flags = TRG_PERFORM;
- ri.triggerID = triggerID;
- ri.td = &td;
- CallService(MS_TRIGGER_REPORTEVENT, 0, (LPARAM)&ri);
- } while (triggerID != 0);
-
- return 0;
-}
-
-INT_PTR IsMirandaHidden(WPARAM wParam, LPARAM lParam) // for trigger plugin
-{
- return (INT_PTR)g_bWindowHidden;
-}
-
-int RegisterTrigger() {
-
- g_hIsHiddenService = CreateServiceFunction(MS_BOSSKEY_ISMIRANDAHIDDEN, IsMirandaHidden);
-
- TRIGGERREGISTER tr;
- ZeroMemory(&tr, sizeof(TRIGGERREGISTER));
- tr.cbSize = sizeof(TRIGGERREGISTER);
- tr.dFlags = DF_TCHAR;
- tr.pszName = TRIGGERNAME;
- tr.hInstance = g_hInstance;
- tr.pfnDlgProc = DlgProcOptsBossKeyTrigger;
- tr.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TRIGGER);
-
- CallService(MS_TRIGGER_REGISTERTRIGGER, 0, (LPARAM)&tr);
-
- CONDITIONREGISTER cr;
- ZeroMemory(&cr, sizeof(CONDITIONREGISTER));
- cr.cbSize = sizeof(CONDITIONREGISTER);
- cr.flags = CRF_TCHAR;
- cr.pszName = "BossKey: Miranda is hidden";
- cr.pszService = MS_BOSSKEY_ISMIRANDAHIDDEN;
-
- CallService(MS_TRIGGER_REGISTERCONDITION, 0, (LPARAM)&cr);
-
- ACTIONREGISTER ar;
- ZeroMemory(&ar, sizeof(ACTIONREGISTER));
- ar.cbSize = sizeof(ACTIONREGISTER);
- ar.flags = ARF_TCHAR;
- ar.pszName = "BossKey: Hide/Show Miranda";
- ar.pszService = MS_BOSSKEY_HIDE;
-
- CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar);
-
- return 0;
-}
diff --git a/plugins/Db_autobackups/src/headers.h b/plugins/Db_autobackups/src/headers.h index 30cacb4ee5..0836239105 100644 --- a/plugins/Db_autobackups/src/headers.h +++ b/plugins/Db_autobackups/src/headers.h @@ -17,17 +17,14 @@ #include <win2k.h>
#include <m_folders.h>
-#include <m_trigger.h>
#include "options.h"
#include "resource.h"
#include "version.h"
#define MS_AB_BACKUP "AB/Backup"
-#define MS_AB_BACKUPTRGR "AB/Backuptrg"
#define MS_AB_SAVEAS "AB/SaveAs"
-
#define SUB_DIR L"\\AutoBackups"
#define DIR L"%miranda_userdata%"
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index b3122b99cb..207a5036c0 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -26,14 +26,6 @@ static IconItem iconList[] = { {LPGEN("Save Profile As..."), "saveas", IDI_ICON1 }
};
-INT_PTR BackupServiceTrgr(WPARAM wParam, LPARAM lParam)
-{
- if(wParam & ACT_PERFORM)
- mir_forkthread(BackupThread, NULL);
-
- return 0;
-}
-
static int FoldersGetBackupPath(WPARAM wParam, LPARAM lParam)
{
FoldersGetCustomPathT(hFolder, options.folder, MAX_PATH, DIR SUB_DIR);
@@ -67,16 +59,6 @@ static void MenuInit(void) Menu_AddMainMenuItem(&mi);
}
-static void TriggerActionInit(void)
-{
- ACTIONREGISTER ar = {0};
- ar.cbSize = sizeof(ACTIONREGISTER);
- ar.pszName = "Backup Database";
- ar.pszService = MS_AB_BACKUPTRGR;
-
- CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar);
-}
-
static int ModulesLoad(WPARAM wParam, LPARAM lParam)
{
profilePath = Utils_ReplaceVarsT(_T("%miranda_userdata%"));
@@ -87,10 +69,6 @@ static int ModulesLoad(WPARAM wParam, LPARAM lParam) LoadOptions();
MenuInit();
- // register trigger action for triggerplugin
- if ( ServiceExists(MS_TRIGGER_REGISTERACTION))
- TriggerActionInit();
-
HookEvent(ME_OPT_INITIALISE, OptionsInit);
if(options.backup_types & BT_START)
mir_forkthread(BackupThread, NULL);
@@ -115,7 +93,6 @@ void SysInit() OleInitialize(0);
CreateServiceFunction(MS_AB_BACKUP, ABService);
- CreateServiceFunction(MS_AB_BACKUPTRGR, BackupServiceTrgr);
CreateServiceFunction(MS_AB_SAVEAS, DBSaveAs);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
diff --git a/plugins/ExternalAPI/delphi/m_trigger.inc b/plugins/ExternalAPI/delphi/m_trigger.inc deleted file mode 100644 index 7f40d161e2..0000000000 --- a/plugins/ExternalAPI/delphi/m_trigger.inc +++ /dev/null @@ -1,986 +0,0 @@ -{$IFNDEF M_TRIGGER}
-{$DEFINE M_TRIGGER}
-
-// --------------------------------------------------------------------------
-// Triggers
-// --------------------------------------------------------------------------
-
-// This section explains how to create your own trigger. A trigger can be seen
-// as an event which can result in a set of actions that will be performed.
-// Implementing a trigger consists of two parts. First, you register a trigger
-// with MS_TRIGGER_REGISTERTRIGGER to allow a user to configure it in the
-// options dialog. Second, when the event occurs belonging to your registered
-// trigger, you inform the trigger plugin with MS_TRIGGER_REPORTEVENT. You can
-// send a 'payload' together with this notification. This payload, called
-// 'TriggerData', can consist of a certain contact, protocol, status and/or a
-// piece of text.
-
-// --------------------------------------------------------------------------
-// Triggers: Register a trigger
-// --------------------------------------------------------------------------
-const
- MS_TRIGGER_REGISTERTRIGGER = '/TriggerPlugin/RegisterTrigger';
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)0
-// lParam = (LPARAM)(TRIGGERREGISTER *)&tr
-// Pointer to a structure describing the trigger to add (see below).
-
-// Return Value:
-// ------------------------
-// Returns 0 on success, nozero otherwise. Registering an already existing
-// trigger will replace this previously registered trigger.
-
-type
- TTRIGGERREGISTER = record
- cbSize :int; // Set to sizeof(TRIGGERREGISTER).
- pszName :PAnsiChar; // Used as identifier and shown in the options dialog,
- // must be unique.
- hInstance :HINSTANCE; // Only needed when options screen is available.
- pfnDlgProc :DLGPROC; // Optional, the callback procedure for the options page.
- pszTemplate:PAnsiChar; // Optional, template for the options page; must be
- // WS_CHILD.
- flags :int; // Flags, see below.
- dFlags :int; // Specify the default DF_* flags which your trigger can
- // send (see below).
- end;
-
-const
-// Flags
- TRF_NOEXPORT = 01; // This trigger cannot be exported. Set this flag
- // in case you stored settings not using the helper
- // functions at the end of this header. On export,
- // TriggerPlugin will search for these settings
- // and export them automatically. Contact-specific
- // settings are never exported.
-
-// Please specify the dFlags to indicate what kind of data your trigger is
-// able to send as TriggerData. Please specify the maximum set, if your trigger
-// does not always send a certain data, please specify it anyway.
-
- DF_CONTACT = $01; // The trigger might send a contact handle with the
- // TriggerData.
- DF_PROTO = $02; // The trigger might send a protocol ID with the
- // TriggerData.
- DF_STATUS = $04; // The trigger might send a status code with the
- // TriggerData.
- DF_TEXT = $08; // The trigger might send a string with the
- // TriggerData.
- DF_LPARAM = $10; // The trigger might send a custom parameter with the
- // TriggerData.
- DF_UNICODE = $20; // The trigger processes WCHAR strings.
-
-// Dialog Messages
-// The following message should be processed by your options dialog procedure,
-// if available. You can create an options dialog to give the user the
-// possibility to report your event only under certain circumstances. Each
-// trigger is assigned a certain ID. This ID can be used to store the settings
-// for your trigger.
-
-// WM_INITDIALOG
-
-// Parameters:
-// ------------------------
-// lParam = (LPARAM)(DWORD)triggerID
-// The trigger ID for which the options are to be set. This can be a new ID
-// or an ID of a trigger which is being edited. Initialize your options
-// dialog accordingly. There are helper function at the end of this header
-// file to read your settings for a certain trigger ID.
-
- TM_ADDTRIGGER = WM_APP+10;
-
-// TM_ADDTRIGGER
-// 'OK' is pressed and a new trigger will be added. Save your settings using
-// the given trigger ID.
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(DWORD)triggerID
-// The trigger ID for which the settings are to be stored. There are helper
-// function at the end of this header file to store your settings with a
-// certain trigger ID.
-// lParam = 0
-
- TM_DELTRIGGER = WM_APP+11;
-
-// TM_DELTRIGGER
-// The trigger addociated with the given trigger ID will be removed.
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(DWORD)triggerID
-// The trigger ID for which the settings are to be removed. There is a
-// helper service at the end of this header file to easily cleanup settings
-// for a certain trigger ID.
-// lParam = 0
-
-// --------------------------------------------------------------------------
-// Triggers: Report the Event
-// --------------------------------------------------------------------------
-
-// When the event occurs, you report it with MS_TRIGGER_REPORTEVENT. If your
-// trigger is configurable, so it has an options screen, you might want to
-// report your trigger for certain trigger ID's only. Please use the
-// MS_TRIGGER_FINDNEXTTRIGGERID to enumerate over the trigger ID's associated
-// with your trigger in the correct order as specified by the user. It's up
-// to you to found out whether or not the trigger is to be reported for a
-// certain ID.
-
- MS_TRIGGER_FINDNEXTTRIGGERID = '/TriggerPlugin/FindNextTriggerID';
-
-// Enumerate over the associated trigger ID's for your trigger in the correct
-// order.
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(DWORD)triggerID
-// 0 to retrieve the first trigger ID for your trigger or the previous ID
-// returned by this service to get the next one.
-// lParam = 0
-
-// Return Value:
-// ------------------------
-// Returns the next trigger ID given the parameter or 0 if no more trigger IDs
-// are available.
-
- MS_TRIGGER_REPORTEVENT = '/TriggerPlugin/ReportEvent';
-
-// Report your event for further processing. This can be a general event for
-// which no individual settings exist, or a specific event for a given
-// trigger ID.
-
-// Parameters:
-// ------------------------
-// wParam = 0
-// lParam = (LPARAM)(REPORTINFO *)&ri
-// See below.
-
-// Return Value:
-// ------------------------
-// Returns CRV_TRUE if all conditions specific to this trigger hold and the
-// chain was executed. Returns CRV_FALSE if these conditions did not hold and
-// the chain were not processed.
-
-// The structure below can be used to send TriggerData with your trigger. This
-// can be used by the associated conditions and actions.
-
-type
- PTRIGGERDATA = ^TTRIGGERDATA;
- TTRIGGERDATA = record
- cbSize :int; // Set to sizeof(TRIGGERDATA)
- dFlags :int; // Indicate which members are valid using the DF_* flags
- hContact:THANDLE; // Associate a contact handle to this event.
- szProto :PAnsiChar; // Associate a protocol ID to this event.
- status :int; // Associcate a status code to this event.
- szText :TChar; // Associate a string to this event.
- lParam :LPARAM; // Associate custom data to this trigger.
- end;
-
-type
- PREPORTINFO = ^TREPORTINFO;
- TREPORTINFO = record
- cbSize :int; // Set to sizeof(REPORTINFO).
- triggerID:DWORD; // The trigger ID of the event to trigger or 0 if
- // this does not apply.
- pszName :PAnsiChar; // The name of the trigger (this may be NULL if
- // triggerID is not 0).
- flags :int; // On of the TRG_* flags, see below.
- td :PTRIGGERDATA; // Optional, the associated TriggerData, see above.
- end;
-
-const
- TRG_PERFORM = $01; // Indicates the event for this trigger actually
- // occured and needs to be processed accordingly.
- TRG_CLEANUP = $02; // Indicates the trigger instructs to remove the
- // itself and all associated information. This can
- // be used for "one time triggers". Remove your own
- // settings by yourself.
-
-// --------------------------------------------------------------------------
-// Actions
-// --------------------------------------------------------------------------
-
-// An actions might be performed as a reaction to a reported event by a
-// trigger. You first register your action so it can be associated to a
-// trigger in the options screen. Next, your provided service or function
-// will be called when necessary.
-
- MS_TRIGGER_REGISTERACTION = '/TriggerPlugin/RegisterAction';
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)0
-// lParam = (LPARAM)(ACTIONREGISTER *)&ar
-// Pointer to a structure describing the action to add (see below).
-
-// Return Value:
-// ------------------------
-// Returns 0 on success, nozero otherwise. Registering an already existing
-// action will replace this previously registered action.
-
-type
- TACTIONREGISTER = record
- cbSize :int; // Set to sizeof(ACTIONREGISTER).
- pszName :PAnsiChar; // The name of this action, it must be a unique string.
- pszService :PAnsiChar; // A service (called with wParam =
- // (WPARAM)(DWORD)actionID, lParam =
- // (LPARAM)(REPORTINFO *)&ri) or function to be called
- // when the action has to be performed.
-// or actionFunction: function (actionID:dword; ri:PREPORTINFO):int;
- hInstance :HINSTANCE;// Only needed when an options screen is available.
- pfnDlgProc :DLGPROC; // Optional, the callback procedure for the options
- // dialog.
- pszTemplate:PAnsiChar; // Optional, template for the options dialog, must be
- // WS_CHILD.
- flags :int; // One of the ARF_* flags, see below.
- end;
-
-const
- ARF_UNICODE = $01; // This action processes unicode strings.
- ARF_FUNCTION = $02; // The actionFunction will be called instead of the service.
- ARF_NOEXPORT = $04; // This action cannot be exported. Set this flag in
- // case you stored settings not using the helper
- // functions at the end of this header. On export,
- // TriggerPlugin will search for these settings
- // and export them automatically. Contact-specific
- // settings are never exported.
-
-// The service or actionFunction will be called with a pointer to a REPORTINFO
-// struct, containing information about the trigger event. If you can use
-// TriggerData from this struct, always check the ri->td->dFlags before using
-// it. It's up to you to deal with an action in case the expected TriggerData
-// is not available. It's recommened though, to cancel your action. The
-// ri->flags is a combination of the ACT_* flags, indicating how to process the
-// call, see below.
-
- ACT_PERFORM = $01; // Your action is to be performed.
- ACT_CLEANUP = $02; // The settings associated to this action should be removed.
-
-// Dialog Messages
-// The following messages are to be processed by the options dialog, if there
-// is one.
-
-// WM_INITDIALOG
-
-// Parameters:
-// ------------------------
-// lParam = (LPARAM)(DWORD)actionID
-// The action ID for which the options are to be set. This can be a new ID
-// or an ID of an action which is being edited. Initialize your options
-// dialog accordingly. There are helper function at the end of this header
-// file to read your settings for a certain action ID.
-
- TM_ADDACTION = WM_APP+12;
-
-// TM_ADDACTION
-// 'OK' is pressed and a new action will be added. Save your settings using
-// the given action ID. Helper functions can be found at the end of this
-// header file.
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(DWORD)actionID
-// The action ID for which the settings are to be saved. There are helper
-// functions at the end of this header file to store settings with a certain
-// action ID.
-// lParam = 0
-
-// Dialog Messages
-// You can send the following messages to the parent window of your dialog.
-// When initalizing your dialog, you might be interested in the TriggerData
-// the associated trigger is able to provide, you can do so by sending the
-// folowing message to the parent of your dialog.
-
- TM_GETTRIGGERINFO = WM_APP+13;
-
-// Parameters:
-// ------------------------
-// wParam = 0
-// lParam = (LPARAM)(TRIGGERINFO *)&ti
-
-// Return Value:
-// ------------------------
-// Returns 0 on success, the struct given will be filled with the requested
-// information. Returns any other value on error.
-
-type
- PTRIGGERINFO = ^TTRIGGERINFO;
- TTRIGGERINFO = record
- cbSize:int; // (in) Set to sizeof(TRIGGERINFO).
- dFlags:int; // (out) The default DF_* flags used by the trigger (as indicated
- // by its TRIGGERREGISTER).
- end;
-
-// --------------------------------------------------------------------------
-// Conditions
-// --------------------------------------------------------------------------
-
-// Depending on the configuration of the user, a condition may need to hold
-// for an action to be performed. A condition function is called and its
-// return value specifies whether or not the condition holds. A condition
-// needs to be registered. After its registered, the condition function might
-// be called to check whether or not the condition holds.
-const
- MS_TRIGGER_REGISTERCONDITION = '/TriggerPlugin/RegisterCondition';
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)0
-// lParam = (LPARAM)(CONDITIONREGISTER *)&cr
-// Pointer to a structure describing the condition to add (see below).
-
-// Return Value:
-// ------------------------
-// Returns 0 on success, nozero otherwise. Registering an already existing
-// condition will replace this previously registered condition.
-
-type
- PCONDITIONREGISTER = ^TCONDITIONREGISTER;
- TCONDITIONREGISTER = record
- cbSize :int; // Set to sizeof(CONDITIONREGISTER).
- pszName :PAnsiChar; // The name identifying this condition, must be unique.
- pszService :PAnsiChar; // The service (wParam = (WPARAM)(DWORD)conditionID,
- // lParam = (LPARAM)(REPORTINFO *)&ri) or function which
- // is called to see whether the condition holds. Must
- // return CRV_TRUE if the condition holds, CRV_FALSE
- // otherwise.
-// or conditionFunction:function(conditionID:dword; ri:PREPORTINFO):int;
- hInstance :HINSTANCE; // Only needed when an options dialog is available.
- pfnDlgProc :DLGPROC; // Optional, the dialog procedure for the options
- // dialog.
- pszTemplate:PAnsiChar; // Optional, template for the options dialog, must be
- // WS_CHILD.
- flags :int; // CRF_* flags, see below.
- end;
-
-// The flags that can be used to register the condition.
-
-const
- CRF_UNICODE = $01; // The condition function or service processes
- // unicode strings.
- CRF_FUNCTION = $02; // The conditionFunction will be called instead of
- // the service.
- CRF_NOEXPORT = $04; // This condition cannot be exported. Set this flag
- // in case you stored settings not using the helper
- // functions at the end of this header. On export,
- // TriggerPlugin will search for these settings
- // and export them automatically. Contact-specific
- // settings are never exported.
-
-// The service or conditionFunction will be called with a pointer to a
-// REPORTINFO struct, containing information about the trigger event. If you
-// can use TriggerData from this struct, always check the ri->td->dFlags before
-// using it. It's up to you to deal with an condition in case the expected
-// TriggerData is not available. It's recommened though, to return CRV_FALSE in
-// those cases. The ri->flags is a combination of the CND_* flags, indicating
-// how to process the call, see below.
-
-// Return values for the condition function or service. The condition service
-// or function is expected to return one of the following.
-
- CRV_FALSE = 0; // The condition does not hold.
- CRV_TRUE = 1; // The condition does hold.
-
-// REPORTINFO flags, received by the condition function or service. These
-// indicate how to process the call.
-
- CND_PERFORM = 01; // Perform your condition and return either
- // CRV_TRUE or CRV_FALSE to indicate whether or not
- // your condition holds at this moment.
- CND_CLEANUP = 02; // The condition is deleted. Remove your settings
- // from the DB. There is a helper service below to
- // easily remove settings given a condition ID.
-
-// Dialog Messages
-// The following messages are to be processed by the options dialog, if there
-// is one.
-
-// WM_INITDIALOG
-
-// Parameters:
-// ------------------------
-// lParam = (LPARAM)(DWORD)conditionID
-// The condition ID for which the options are to be set. This can be a new ID
-// or an ID of a condition which is being edited. Initialize your options
-// dialog accordingly. There are helper function at the end of this header
-// file to read your settings for a certain condition ID.
-
- TM_ADDCONDITION = WM_APP+14;
-
-// TM_ADDCONDITION
-// 'OK' is pressed and a new condition will be added. Save your settings using
-// the given condition ID. Helper functions can be found at the end of this
-// header file.
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(DWORD)conditionID
-// The condition ID for which the settings are to be saved. There are helper
-// functions at the end of this header file to store settings with a certain
-// condition ID.
-// lParam = 0
-
-// When initalizing your dialog, you might be interested in the TriggerData the
-// associated trigger is able to provide, you can find out by sending a
-// TM_GETTRIGGERINFO message to the parent of your dialog. See the section on
-// dialog messages for actions for more information (above).
-
-// --------------------------------------------------------------------------
-// Misc. Services
-// --------------------------------------------------------------------------
-
- MS_TRIGGER_ENABLETRIGGER = '/TriggerPlugin/EnableTrigger';
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(DWORD)triggerID
-// The triggerID to set or get the state from or 0 for the global state.
-// lParam = (LPARAM)(int)type
-// One of ETT_* (see below).
-// Pointer to a structure describing the settings to remove (see below).
-
-// Return Value:
-// ------------------------
-// Returns the state (0=disabled) if ETT_GETSTATE is given as lParam.
-// Otherwise, it returns 0 if setting the state was succesful or any other on
-// failure. The global state must be enabled if a single state is to be
-// changed.
-
- ETT_DISABLE = 0; // Disable the trigger(s).
- ETT_ENABLE = 1; // Enable the trigger(s).
- ETT_TOGGLE = 2; // Toggle the state of the trigger(s).
- ETT_GETSTATE = 3; // Retrieve the state of the trigger (0=disabled).
-
-// --------------------------------------------------------------------------
-// Database Helper Services
-// --------------------------------------------------------------------------
-
-// The rest of this header file defines helper services and functions to easily
-// store and retrieve settings for a certain trigger, action or condition.
-
- MS_TRIGGER_REMOVESETTINGS = '/TriggerPlugin/RemoveSettings';
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)0
-// lParam = (LPARAM)(REMOVETRIGGERSETTINGS *)&rts
-// Pointer to a structure describing the settings to remove (see below).
-
-// Return Value:
-// ------------------------
-// Returns the number of settings removed from the database.
-
-// This service helps you remove all settings you have written with the DB
-// helper functions, defined at the end of this header file.
-
-type
- PREMOVETRIGGERSETTINGS = ^TREMOVETRIGGERSETTINGS;
- TREMOVETRIGGERSETTINGS = record
- cbSize :int; // Set to sizeof(REMOVETRIGGERSETTINGS).
- prefix :PAnsiChar; // A string indicating what kind of setting are to be
- // removed, see below.
- id :DWORD; // The ID of the set of settings to be removed.
- szModule:PAnsiChar; // The module where the settings are stored.
- hContact:THANDLE; // The contact for which the setting are to be removed. Can
- // be INVALID_HANDLE_VALUE to remove the settings for all
- // contacts and NULL.
- end;
-
-// The following prefixes indicate what kind of settings are to be removed from
-// the database.
-const
- PREFIX_ACTIONID = 'aid'; // The prefix for a DB setting associated to
- // an action.
- PREFIX_TRIGGERID = 'tid'; // The prefix for a DB setting associated to
- // a trigger.
- PREFIX_CONDITIONID = 'cid'; // The prefix for a DB setting associated
- // to a condition.
-
-(* TRIGGER HELPER
-
-// Helper #1: RemoveAllTriggerSettings
-// ------------------------
-// Remove all settings from the DB given the triggerID and module.
-
-static __inline int RemoveAllTriggerSettings(DWORD triggerID, AnsiChar *szModule) {
-
- REMOVETRIGGERSETTINGS rts;
-
- rts.cbSize = sizeof(REMOVETRIGGERSETTINGS);
- rts.prefix = PREFIX_TRIGGERID;
- rts.id = triggerID;
- rts.szModule = szModule;
- rts.hContact = INVALID_HANDLE_VALUE;
-
- return CallService(MS_TRIGGER_REMOVESETTINGS, 0, (LPARAM)&rts);
-}
-
-// Helper #2: RemoveAllActionSettings
-// ------------------------
-// Remove all settings from the DB given the actionID and module.
-
-static __inline int RemoveAllActionSettings(DWORD actionID, AnsiChar *szModule) {
-
- REMOVETRIGGERSETTINGS rts;
-
- rts.cbSize = sizeof(REMOVETRIGGERSETTINGS);
- rts.prefix = PREFIX_ACTIONID;
- rts.id = actionID;
- rts.szModule = szModule;
- rts.hContact = INVALID_HANDLE_VALUE;
-
- return CallService(MS_TRIGGER_REMOVESETTINGS, 0, (LPARAM)&rts);
-}
-
-// Helper #1: RemoveAllConditionSettings
-// ------------------------
-// Remove all settings from the DB given the conditionID and module.
-
-static __inline int RemoveAllConditionSettings(DWORD conditionID, AnsiChar *szModule) {
-
- REMOVETRIGGERSETTINGS rts;
-
- rts.cbSize = sizeof(REMOVETRIGGERSETTINGS);
- rts.prefix = PREFIX_CONDITIONID;
- rts.id = conditionID;
- rts.szModule = szModule;
- rts.hContact = INVALID_HANDLE_VALUE;
-
- return CallService(MS_TRIGGER_REMOVESETTINGS, 0, (LPARAM)&rts);
-}
-
-// --------------------------------------------------------------------------
-// Database Helper Functions
-// --------------------------------------------------------------------------
-
-// Basically, these function work the same as Miranda's helper functions for
-// getting/setting DB settings. There is one extra parameter, the ID for the
-// trigger/action/condition. The settings are named as follows:
-
-// DBWriteTriggerSetting*(DWORD triggerID, ...) to write a setting given a
-// trigger ID.
-// DBGetTriggerSetting*(DWORD triggerID, ...) to read a setting given a
-// trigger ID.
-// DBWriteActionSetting*(DWORD actionID, ...) to write a setting given an
-// action ID.
-// DBGetActionSetting*(DWORD actionID, ...) to read a setting given an
-// action ID.
-// DBWriteConditionSetting*(DWORD conditionID, ...) to write a setting given a
-// condition ID.
-// DBGetConditionSetting*(DWORD conditionID, ...) to read a setting given a
-// condition ID.
-
-#define MAX_SETTING_LEN 255 // Max. length of a DB setting including the
- // prefix and ID.
-
-// --------------------------------------------------------------------------
-// Database Helper Functions: Triggers
-// --------------------------------------------------------------------------
-
-static int __inline DBWriteTriggerSettingByte(DWORD triggerID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,BYTE val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingByte(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteTriggerSettingWord(DWORD triggerID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,WORD val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingWord(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteTriggerSettingDword(DWORD triggerID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,DWORD val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingDword(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteTriggerSettingString(DWORD triggerID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,const AnsiChar *val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingString(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteTriggerSettingTString(DWORD triggerID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,const TCHAR *val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingTString(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteTriggerSettingWString(DWORD triggerID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,const WCHAR *val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingWString(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteTriggerSettingStringUtf(DWORD triggerID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,const AnsiChar *val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBWriteContactSettingStringUtf(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBGetTriggerSettingByte(DWORD triggerID, HANDLE hContact, const AnsiChar *szModule, const AnsiChar *szSetting, int errorValue) {
-
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingByte(hContact, szModule, dbSetting, errorValue);
-}
-
-static WORD __inline DBGetTriggerSettingWord(DWORD triggerID, HANDLE hContact, const AnsiChar *szModule, const AnsiChar *szSetting, int errorValue) {
-
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingWord(hContact, szModule, dbSetting, errorValue);
-}
-
-static DWORD __inline DBGetTriggerSettingDword(DWORD triggerID, HANDLE hContact, const AnsiChar *szModule, const AnsiChar *szSetting, int errorValue) {
-
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingDword(hContact, szModule, dbSetting, errorValue);
-}
-
-static int __inline DBGetTriggerSetting(DWORD triggerID, HANDLE hContact, const AnsiChar *szModule, const AnsiChar *szSetting, DBVARIANT *dbv) {
-
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSetting(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetTriggerSettingW(DWORD triggerID, HANDLE hContact,const AnsiChar *szModule, const AnsiChar *szSetting,DBVARIANT *dbv) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingW(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetTriggerSettingTString(DWORD triggerID, HANDLE hContact,const AnsiChar *szModule, const AnsiChar *szSetting,DBVARIANT *dbv) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingTString(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetTriggerSettingWString(DWORD triggerID, HANDLE hContact,const AnsiChar *szModule, const AnsiChar *szSetting,DBVARIANT *dbv) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingWString(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetTriggerSettingStringUtf(DWORD triggerID, HANDLE hContact,const AnsiChar *szModule, const AnsiChar *szSetting,DBVARIANT *dbv) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBGetContactSettingStringUtf(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBDeleteTriggerSetting(DWORD triggerID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return DBDeleteContactSetting(hContact, szModule, dbSetting);
-}
-
-// --------------------------------------------------------------------------
-// Database Helper Functions: Actions
-// --------------------------------------------------------------------------
-
-static int __inline DBWriteActionSettingByte(DWORD actionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,BYTE val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingByte(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteActionSettingWord(DWORD actionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,WORD val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingWord(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteActionSettingDword(DWORD actionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,DWORD val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingDword(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteActionSettingString(DWORD actionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,const AnsiChar *val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingString(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteActionSettingTString(DWORD actionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,const TCHAR *val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingTString(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteActionSettingWString(DWORD actionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,const WCHAR *val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingWString(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteActionSettingStringUtf(DWORD actionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,const AnsiChar *val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBWriteContactSettingStringUtf(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBGetActionSettingByte(DWORD actionID, HANDLE hContact, const AnsiChar *szModule, const AnsiChar *szSetting, int errorValue) {
-
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingByte(hContact, szModule, dbSetting, errorValue);
-}
-
-static WORD __inline DBGetActionSettingWord(DWORD actionID, HANDLE hContact, const AnsiChar *szModule, const AnsiChar *szSetting, int errorValue) {
-
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingWord(hContact, szModule, dbSetting, errorValue);
-}
-
-static DWORD __inline DBGetActionSettingDword(DWORD actionID, HANDLE hContact, const AnsiChar *szModule, const AnsiChar *szSetting, int errorValue) {
-
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingDword(hContact, szModule, dbSetting, errorValue);
-}
-
-static int __inline DBGetActionSetting(DWORD actionID, HANDLE hContact, const AnsiChar *szModule, const AnsiChar *szSetting, DBVARIANT *dbv) {
-
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSetting(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetActionSettingW(DWORD actionID, HANDLE hContact,const AnsiChar *szModule, const AnsiChar *szSetting,DBVARIANT *dbv) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingW(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetActionSettingTString(DWORD actionID, HANDLE hContact,const AnsiChar *szModule, const AnsiChar *szSetting,DBVARIANT *dbv) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingTString(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetActionSettingWString(DWORD actionID, HANDLE hContact,const AnsiChar *szModule, const AnsiChar *szSetting,DBVARIANT *dbv) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingWString(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetActionSettingStringUtf(DWORD actionID, HANDLE hContact,const AnsiChar *szModule, const AnsiChar *szSetting,DBVARIANT *dbv) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBGetContactSettingStringUtf(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBDeleteActionSetting(DWORD actionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return DBDeleteContactSetting(hContact, szModule, dbSetting);
-}
-
-// --------------------------------------------------------------------------
-// Database Helper Functions: Conditions
-// --------------------------------------------------------------------------
-
-static int __inline DBWriteConditionSettingByte(DWORD conditionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,BYTE val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingByte(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteConditionSettingWord(DWORD conditionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,WORD val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingWord(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteConditionSettingDword(DWORD conditionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,DWORD val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingDword(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteConditionSettingString(DWORD conditionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,const AnsiChar *val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingString(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteConditionSettingTString(DWORD conditionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,const TCHAR *val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingTString(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteConditionSettingWString(DWORD conditionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,const WCHAR *val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingWString(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteConditionSettingStringUtf(DWORD conditionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting,const AnsiChar *val) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBWriteContactSettingStringUtf(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBGetConditionSettingByte(DWORD conditionID, HANDLE hContact, const AnsiChar *szModule, const AnsiChar *szSetting, int errorValue) {
-
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingByte(hContact, szModule, dbSetting, errorValue);
-}
-
-static WORD __inline DBGetConditionSettingWord(DWORD conditionID, HANDLE hContact, const AnsiChar *szModule, const AnsiChar *szSetting, int errorValue) {
-
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingWord(hContact, szModule, dbSetting, errorValue);
-}
-
-static DWORD __inline DBGetConditionSettingDword(DWORD conditionID, HANDLE hContact, const AnsiChar *szModule, const AnsiChar *szSetting, int errorValue) {
-
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingDword(hContact, szModule, dbSetting, errorValue);
-}
-
-static int __inline DBGetConditionSetting(DWORD conditionID, HANDLE hContact, const AnsiChar *szModule, const AnsiChar *szSetting, DBVARIANT *dbv) {
-
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSetting(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetConditionSettingW(DWORD conditionID, HANDLE hContact,const AnsiChar *szModule, const AnsiChar *szSetting,DBVARIANT *dbv) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingW(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetConditionSettingTString(DWORD conditionID, HANDLE hContact,const AnsiChar *szModule, const AnsiChar *szSetting,DBVARIANT *dbv) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingTString(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetConditionSettingWString(DWORD conditionID, HANDLE hContact,const AnsiChar *szModule, const AnsiChar *szSetting,DBVARIANT *dbv) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingWString(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetConditionSettingStringUtf(DWORD conditionID, HANDLE hContact,const AnsiChar *szModule, const AnsiChar *szSetting,DBVARIANT *dbv) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBGetContactSettingStringUtf(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBDeleteConditionSetting(DWORD conditionID, HANDLE hContact,const AnsiChar *szModule,const AnsiChar *szSetting) {
-
- AnsiChar dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return DBDeleteContactSetting(hContact, szModule, dbSetting);
-}
-
-*)
-{$ENDIF}
diff --git a/plugins/ExternalAPI/m_trigger.h b/plugins/ExternalAPI/m_trigger.h deleted file mode 100644 index 7b35392aeb..0000000000 --- a/plugins/ExternalAPI/m_trigger.h +++ /dev/null @@ -1,965 +0,0 @@ -#ifndef __M_TRIGGER_H__
-#define __M_TRIGGER_H__
-
-#if !defined(_TCHAR_DEFINED)
-#include <tchar.h>
-#endif
-#include <m_utils.h>
-
-// --------------------------------------------------------------------------
-// Triggers
-// --------------------------------------------------------------------------
-
-// This section explains how to create your own trigger. A trigger can be seen
-// as an event which can result in a set of actions that will be performed.
-// Implementing a trigger consists of two parts. First, you register a trigger
-// with MS_TRIGGER_REGISTERTRIGGER to allow a user to configure it in the
-// options dialog. Second, when the event occurs belonging to your registered
-// trigger, you inform the trigger plugin with MS_TRIGGER_REPORTEVENT. You can
-// send a 'payload' together with this notification. This payload, called
-// 'TriggerData', can consist of a certain contact, protocol, status and/or a
-// piece of text.
-
-// --------------------------------------------------------------------------
-// Triggers: Register a trigger
-// --------------------------------------------------------------------------
-
-#define MS_TRIGGER_REGISTERTRIGGER "/TriggerPlugin/RegisterTrigger"
-
-// Parameters:
-// ------------------------
-// wParam = 0
-// lParam = (LPARAM)(TRIGGERREGISTER *)&tr
-// Pointer to a structure describing the trigger to add (see below).
-
-// Return Value:
-// ------------------------
-// Returns 0 on success, nozero otherwise. Registering an already existing
-// trigger will replace this previously registered trigger.
-
-typedef struct {
- int cbSize; // Set to sizeof(TRIGGERREGISTER).
- char *pszName; // Used as identifier and shown in the options dialog, must
- // be unique.
- HINSTANCE hInstance; // Only needed when options screen is available.
- DLGPROC pfnDlgProc; // Optional, the callback procedure for the options page.
- char *pszTemplate; // Optional, template for the options page; must be
- // WS_CHILD.
- int flags; // Flags, see below.
- int dFlags; // Specify the default DF_* flags which your trigger can send
- // (see below).
-} TRIGGERREGISTER;
-
-// Flags
-#define TRF_NOEXPORT 0x01 // This trigger cannot be exported. Set this flag
- // in case you stored settings not using the helper
- // functions at the end of this header. On export,
- // TriggerPlugin will search for these settings
- // and export them automatically. Contact-specific
- // settings are never exported.
-
-// Please specify the dFlags to indicate what kind of data your trigger is
-// able to send as TriggerData. Please specify the maximum set, if your trigger
-// does not always send a certain data, please specify it anyway.
-
-#define DF_CONTACT 0x01 // The trigger might send a contact handle with the
- // TriggerData.
-#define DF_PROTO 0x02 // The trigger might send a protocol ID with the
- // TriggerData.
-#define DF_STATUS 0x04 // The trigger might send a status code with the
- // TriggerData.
-#define DF_TEXT 0x08 // The trigger might send a string with the
- // TriggerData.
-#define DF_LPARAM 0x10 // The trigger might send a custom parameter with the
- // TriggerData.
-#define DF_UNICODE 0x20 // The trigger processes WCHAR strings.
-
-#if defined(UNICODE) || defined(_UNICODE)
-#define DF_TCHAR DF_UNICODE // Strings in structure are TCHAR*.
-#else
-#define DF_TCHAR 0
-#endif
-
-// Dialog Messages
-// The following message should be processed by your options dialog procedure,
-// if available. You can create an options dialog to give the user the
-// possibility to report your event only under certain circumstances. Each
-// trigger is assigned a certain ID. This ID can be used to store the settings
-// for your trigger.
-
-// WM_INITDIALOG
-
-// Parameters:
-// ------------------------
-// lParam = (LPARAM)(DWORD)triggerID
-// The trigger ID for which the options are to be set. This can be a new ID
-// or an ID of a trigger which is being edited. Initialize your options
-// dialog accordingly. There are helper function at the end of this header
-// file to read your settings for a certain trigger ID.
-
-#define TM_ADDTRIGGER WM_APP+10
-
-// TM_ADDTRIGGER
-// 'OK' is pressed and a new trigger will be added. Save your settings using
-// the given trigger ID.
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(DWORD)triggerID
-// The trigger ID for which the settings are to be stored. There are helper
-// function at the end of this header file to store your settings with a
-// certain trigger ID.
-// lParam = 0
-
-#define TM_DELTRIGGER WM_APP+11
-
-// TM_DELTRIGGER
-// The trigger addociated with the given trigger ID will be removed.
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(DWORD)triggerID
-// The trigger ID for which the settings are to be removed. There is a
-// helper service at the end of this header file to easily cleanup settings
-// for a certain trigger ID.
-// lParam = 0
-
-// --------------------------------------------------------------------------
-// Triggers: Report the Event
-// --------------------------------------------------------------------------
-
-// When the event occurs, you report it with MS_TRIGGER_REPORTEVENT. If your
-// trigger is configurable, so it has an options screen, you might want to
-// report your trigger for certain trigger ID's only. Please use the
-// MS_TRIGGER_FINDNEXTTRIGGERID to enumerate over the trigger ID's associated
-// with your trigger in the correct order as specified by the user. It's up
-// to you to found out whether or not the trigger is to be reported for a
-// certain ID.
-
-#define MS_TRIGGER_FINDNEXTTRIGGERID "/TriggerPlugin/FindNextTriggerID"
-
-// Enumerate over the associated trigger ID's for your trigger in the correct
-// order.
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(DWORD)triggerID
-// 0 to retrieve the first trigger ID for your trigger or the previous ID
-// returned by this service to get the next one.
-// lParam = 0
-
-// Return Value:
-// ------------------------
-// Returns the next trigger ID given the parameter or 0 if no more trigger IDs
-// are available.
-
-#define MS_TRIGGER_REPORTEVENT "/TriggerPlugin/ReportEvent"
-
-// Report your event for further processing. This can be a general event for
-// which no individual settings exist, or a specific event for a given
-// trigger ID.
-
-// Parameters:
-// ------------------------
-// wParam = 0
-// lParam = (LPARAM)(REPORTINFO *)&ri
-// See below.
-
-// Return Value:
-// ------------------------
-// Returns CRV_TRUE if all conditions specific to this trigger hold and the
-// chain was executed. Returns CRV_FALSE if these conditions did not hold and
-// the chain were not processed.
-
-// The structure below can be used to send TriggerData with your trigger. This
-// can be used by the associated conditions and actions.
-
-typedef struct {
- int cbSize; // Set to sizeof(TRIGGERDATA)
- int dFlags; // Indicate which members are valid using the DF_* flags (see
- // above).
- HANDLE hContact; // Associate a contact handle to this event.
- char *szProto; // Associate a protocol ID to this event.
- int status; // Associcate a status code to this event.
- union {
- char *szText; // Associate a string to this event.
- TCHAR *tszText;
- WCHAR *wszText;
- };
- LPARAM lParam; // Associate custom data to this trigger.
-} TRIGGERDATA;
-
-typedef struct {
- int cbSize; // Set to sizeof(REPORTINFO).
- DWORD triggerID; // The trigger ID of the event to trigger or 0 if this does
- // not apply.
- char *pszName; // The name of the trigger (this may be NULL if triggerID is
- // not 0).
- int flags; // On of the TRG_* flags, see below.
- TRIGGERDATA *td; // Optional, the associated TriggerData, see above.
-} REPORTINFO;
-
-#define TRG_PERFORM 0x01 // Indicates the event for this trigger actually
- // occured and needs to be processed accordingly.
-#define TRG_CLEANUP 0x02 // Indicates the trigger instructs to remove the
- // itself and all associated information. This can
- // be used for "one time triggers". Remove your own
- // settings by yourself.
-
-// --------------------------------------------------------------------------
-// Actions
-// --------------------------------------------------------------------------
-
-// An actions might be performed as a reaction to a reported event by a
-// trigger. You first register your action so it can be associated to a
-// trigger in the options screen. Next, your provided service or function
-// will be called when necessary.
-
-#define MS_TRIGGER_REGISTERACTION "/TriggerPlugin/RegisterAction"
-
-// Parameters:
-// ------------------------
-// wParam = 0
-// lParam = (LPARAM)(ACTIONREGISTER *)&ar
-// Pointer to a structure describing the action to add (see below).
-
-// Return Value:
-// ------------------------
-// Returns 0 on success, nozero otherwise. Registering an already existing
-// action will replace this previously registered action.
-
-typedef int (* ACTIONFUNCTION)(DWORD actionID, REPORTINFO* ri);
-
-typedef struct {
- int cbSize; // Set to sizeof(ACTIONREGISTER).
- char *pszName; // The name of this action, it must be a unique string.
- union {
- char *pszService; // A service (called with wParam =
- // (WPARAM)(DWORD)actionID, lParam =
- // (LPARAM)(REPORTINFO *)&ri) or function to be called
- // when the action has to be performed.
- ACTIONFUNCTION actionFunction;
- };
- HINSTANCE hInstance; // Only needed when an options screen is available.
- DLGPROC pfnDlgProc; // Optional, the callback procedure for the options
- // dialog.
- char *pszTemplate; // Optional, template for the options dialog, must be
- // WS_CHILD.
- int flags; // One of the ARF_* flags, see below.
-} ACTIONREGISTER;
-
-#define ARF_UNICODE 0x01 // This action processes unicode strings.
-#define ARF_FUNCTION 0x02 // The actionFunction will be called instead of
- // the service.
-#define ARF_NOEXPORT 0x04 // This action cannot be exported. Set this flag in
- // case you stored settings not using the helper
- // functions at the end of this header. On export,
- // TriggerPlugin will search for these settings
- // and export them automatically. Contact-specific
- // settings are never exported.
-
-#if defined(UNICODE) || defined(_UNICODE)
-#define ARF_TCHAR ARF_UNICODE
-#else
-#define ARF_TCHAR 0
-#endif
-
-// The service or actionFunction will be called with a pointer to a REPORTINFO
-// struct, containing information about the trigger event. If you can use
-// TriggerData from this struct, always check the ri->td->dFlags before using
-// it. It's up to you to deal with an action in case the expected TriggerData
-// is not available. It's recommened though, to cancel your action. The
-// ri->flags is a combination of the ACT_* flags, indicating how to process the
-// call, see below.
-
-#define ACT_PERFORM 0x01 // Your action is to be performed.
-#define ACT_CLEANUP 0x02 // The settings associated to this action should be
- // removed.
-
-// Dialog Messages
-// The following messages are to be processed by the options dialog, if there
-// is one.
-
-// WM_INITDIALOG
-
-// Parameters:
-// ------------------------
-// lParam = (LPARAM)(DWORD)actionID
-// The action ID for which the options are to be set. This can be a new ID
-// or an ID of an action which is being edited. Initialize your options
-// dialog accordingly. There are helper function at the end of this header
-// file to read your settings for a certain action ID.
-
-#define TM_ADDACTION WM_APP+12
-
-// TM_ADDACTION
-// 'OK' is pressed and a new action will be added. Save your settings using
-// the given action ID. Helper functions can be found at the end of this
-// header file.
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(DWORD)actionID
-// The action ID for which the settings are to be saved. There are helper
-// functions at the end of this header file to store settings with a certain
-// action ID.
-// lParam = 0
-
-// Dialog Messages
-// You can send the following messages to the parent window of your dialog.
-// When initalizing your dialog, you might be interested in the TriggerData
-// the associated trigger is able to provide, you can do so by sending the
-// folowing message to the parent of your dialog.
-
-#define TM_GETTRIGGERINFO WM_APP+13
-
-// Parameters:
-// ------------------------
-// wParam = 0
-// lParam = (LPARAM)(TRIGGERINFO *)&ti
-
-// Return Value:
-// ------------------------
-// Returns 0 on success, the struct given will be filled with the requested
-// information. Returns any other value on error.
-
-typedef struct {
- int cbSize; // (in) Set to sizeof(TRIGGERINFO).
- int dFlags; // (out) The default DF_* flags used by the trigger (as indicated
- // by its TRIGGERREGISTER).
-} TRIGGERINFO;
-
-// --------------------------------------------------------------------------
-// Conditions
-// --------------------------------------------------------------------------
-
-// Depending on the configuration of the user, a condition may need to hold
-// for an action to be performed. A condition function is called and its
-// return value specifies whether or not the condition holds. A condition
-// needs to be registered. After its registered, the condition function might
-// be called to check whether or not the condition holds.
-
-#define MS_TRIGGER_REGISTERCONDITION "/TriggerPlugin/RegisterCondition"
-
-// Parameters:
-// ------------------------
-// wParam = 0
-// lParam = (LPARAM)(CONDITIONREGISTER *)&cr
-// Pointer to a structure describing the condition to add (see below).
-
-// Return Value:
-// ------------------------
-// Returns 0 on success, nozero otherwise. Registering an already existing
-// condition will replace this previously registered condition.
-
-typedef int (* CONDITIONFUNCTION)(DWORD conditionID, REPORTINFO *ri);
-
-typedef struct {
- int cbSize; // Set to sizeof(CONDITIONREGISTER).
- char *pszName; // The name identifying this condition, must be unique.
- union {
- char *pszService; // The service (wParam = (WPARAM)(DWORD)conditionID,
- // lParam = (LPARAM)(REPORTINFO *)&ri) or function which
- // is called to see whether the condition holds. Must
- // return CRV_TRUE if the condition holds, CRV_FALSE
- // otherwise.
- CONDITIONFUNCTION conditionFunction;
- };
- HINSTANCE hInstance; // Only needed when an options dialog is available.
- DLGPROC pfnDlgProc; // Optional, the dialog procedure for the options
- // dialog.
- char *pszTemplate; // Optional, template for the options dialog, must be
- // WS_CHILD.
- int flags; // CRF_* flags, see below.
-} CONDITIONREGISTER;
-
-// The flags that can be used to register the condition.
-
-#define CRF_UNICODE 0x01 // The condition function or service processes
- // unicode strings.
-#define CRF_FUNCTION 0x02 // The conditionFunction will be called instead of
- // the service.
-#define CRF_NOEXPORT 0x04 // This condition cannot be exported. Set this flag
- // in case you stored settings not using the helper
- // functions at the end of this header. On export,
- // TriggerPlugin will search for these settings
- // and export them automatically. Contact-specific
- // settings are never exported.
-
-#if defined(UNICODE) || defined(_UNICODE)
-#define CRF_TCHAR CRF_UNICODE
-#else
-#define CRF_TCHAR 0
-#endif
-
-// The service or conditionFunction will be called with a pointer to a
-// REPORTINFO struct, containing information about the trigger event. If you
-// can use TriggerData from this struct, always check the ri->td->dFlags before
-// using it. It's up to you to deal with an condition in case the expected
-// TriggerData is not available. It's recommened though, to return CRV_FALSE in
-// those cases. The ri->flags is a combination of the CND_* flags, indicating
-// how to process the call, see below.
-
-// Return values for the condition function or service. The condition service
-// or function is expected to return one of the following.
-
-#define CRV_FALSE 0 // The condition does not hold.
-#define CRV_TRUE 1 // The condition does hold.
-
-// REPORTINFO flags, received by the condition function or service. These
-// indicate how to process the call.
-
-#define CND_PERFORM 0x01 // Perform your condition and return either
- // CRV_TRUE or CRV_FALSE to indicate whether or not
- // your condition holds at this moment.
-#define CND_CLEANUP 0x02 // The condition is deleted. Remove your settings
- // from the DB. There is a helper service below to
- // easily remove settings given a condition ID.
-
-// Dialog Messages
-// The following messages are to be processed by the options dialog, if there
-// is one.
-
-// WM_INITDIALOG
-
-// Parameters:
-// ------------------------
-// lParam = (LPARAM)(DWORD)conditionID
-// The condition ID for which the options are to be set. This can be a new ID
-// or an ID of a condition which is being edited. Initialize your options
-// dialog accordingly. There are helper function at the end of this header
-// file to read your settings for a certain condition ID.
-
-#define TM_ADDCONDITION WM_APP+14
-
-// TM_ADDCONDITION
-// 'OK' is pressed and a new condition will be added. Save your settings using
-// the given condition ID. Helper functions can be found at the end of this
-// header file.
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(DWORD)conditionID
-// The condition ID for which the settings are to be saved. There are helper
-// functions at the end of this header file to store settings with a certain
-// condition ID.
-// lParam = 0
-
-// When initalizing your dialog, you might be interested in the TriggerData the
-// associated trigger is able to provide, you can find out by sending a
-// TM_GETTRIGGERINFO message to the parent of your dialog. See the section on
-// dialog messages for actions for more information (above).
-
-// --------------------------------------------------------------------------
-// Misc. Services
-// --------------------------------------------------------------------------
-
-#define MS_TRIGGER_ENABLETRIGGER "/TriggerPlugin/EnableTrigger"
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(DWORD)triggerID
-// The triggerID to set or get the state from or 0 for the global state.
-// lParam = (LPARAM)(int)type
-// One of ETT_* (see below).
-
-// Return Value:
-// ------------------------
-// Returns the state (0=disabled) if ETT_GETSTATE is given as lParam.
-// Otherwise, it returns 0 if setting the state was succesful or any other on
-// failure. The global state must be enabled if a single state is to be
-// changed.
-
-#define ETT_DISABLE 0 // Disable the trigger(s).
-#define ETT_ENABLE 1 // Enable the trigger(s).
-#define ETT_TOGGLE 2 // Toggle the state of the trigger(s).
-#define ETT_GETSTATE 3 // Retrieve the state of the trigger (0=disabled).
-
-#define ME_TRIGGER_TRIGGERENABLED "/TriggerPlugin/TriggerEnabled"
-
-// Parameters:
-// ------------------------
-// wParam = (WPARAM)(DWORD)triggerID
-// The triggerID to set or get the state from or 0 for the global state.
-// lParam = (LPARAM)(int)type
-// Either ETT_DISABLE or ETT_ENABLE describing the new state.
-
-// This event is fired when one or all of the triggers enabled state is
-// changed. This can be used to (de)initialize internal variables. For
-// example if your trigger reads the triggers from the DB in memory during
-// an initialization fase. It is recommended to do this when this event is
-// fired with wParam = 0 and lParam = ETT_ENABLE (remember triggers can be
-// imported, without calling your options screen callback). This event is
-// fired upon startup and shutdown in case the module is enabled.
-
-// --------------------------------------------------------------------------
-// Database Helper Services
-// --------------------------------------------------------------------------
-
-// The rest of this header file defines helper services and functions to easily
-// store and retrieve settings for a certain trigger, action or condition.
-
-#define MS_TRIGGER_REMOVESETTINGS "/TriggerPlugin/RemoveSettings"
-
-// Parameters:
-// ------------------------
-// wParam = 0
-// lParam = (LPARAM)(REMOVETRIGGERSETTINGS *)&rts
-// Pointer to a structure describing the settings to remove (see below).
-
-// Return Value:
-// ------------------------
-// Returns the number of settings removed from the database.
-
-// This service helps you remove all settings you have written with the DB
-// helper functions, defined at the end of this header file.
-
-typedef struct {
- int cbSize; // Set to sizeof(REMOVETRIGGERSETTINGS).
- char *prefix; // A string indicating what kind of setting are to be removed,
- // see below.
- DWORD id; // The ID of the set of settings to be removed.
- char *szModule; // The module where the settings are stored.
- HANDLE hContact; // The contact for which the setting are to be removed. Can
- // be INVALID_HANDLE_VALUE to remove the settings for all
- // contacts and NULL.
-} REMOVETRIGGERSETTINGS;
-
-// The following prefixes indicate what kind of settings are to be removed from
-// the database.
-
-#define PREFIX_ACTIONID "aid" // The prefix for a DB setting associated to
- // an action.
-#define PREFIX_TRIGGERID "tid" // The prefix for a DB setting associated to
- // a trigger.
-#define PREFIX_CONDITIONID "cid" // The prefix for a DB setting associated
- // to a condition.
-
-#ifndef TRIGGER_NOHELPER
-
-// Helper #1: RemoveAllTriggerSettings
-// ------------------------
-// Remove all settings from the DB given the triggerID and module.
-
-static __inline int RemoveAllTriggerSettings(DWORD triggerID, char *szModule) {
-
- REMOVETRIGGERSETTINGS rts;
-
- rts.cbSize = sizeof(REMOVETRIGGERSETTINGS);
- rts.prefix = PREFIX_TRIGGERID;
- rts.id = triggerID;
- rts.szModule = szModule;
- rts.hContact = INVALID_HANDLE_VALUE;
-
- return CallService(MS_TRIGGER_REMOVESETTINGS, 0, (LPARAM)&rts);
-}
-
-// Helper #2: RemoveAllActionSettings
-// ------------------------
-// Remove all settings from the DB given the actionID and module.
-
-static __inline int RemoveAllActionSettings(DWORD actionID, char *szModule) {
-
- REMOVETRIGGERSETTINGS rts;
-
- rts.cbSize = sizeof(REMOVETRIGGERSETTINGS);
- rts.prefix = PREFIX_ACTIONID;
- rts.id = actionID;
- rts.szModule = szModule;
- rts.hContact = INVALID_HANDLE_VALUE;
-
- return CallService(MS_TRIGGER_REMOVESETTINGS, 0, (LPARAM)&rts);
-}
-
-// Helper #1: RemoveAllConditionSettings
-// ------------------------
-// Remove all settings from the DB given the conditionID and module.
-
-static __inline int RemoveAllConditionSettings(DWORD conditionID, char *szModule) {
-
- REMOVETRIGGERSETTINGS rts;
-
- rts.cbSize = sizeof(REMOVETRIGGERSETTINGS);
- rts.prefix = PREFIX_CONDITIONID;
- rts.id = conditionID;
- rts.szModule = szModule;
- rts.hContact = INVALID_HANDLE_VALUE;
-
- return CallService(MS_TRIGGER_REMOVESETTINGS, 0, (LPARAM)&rts);
-}
-
-// --------------------------------------------------------------------------
-// Database Helper Functions
-// --------------------------------------------------------------------------
-
-// Basically, these function work the same as Miranda's helper functions for
-// getting/setting DB settings. There is one extra parameter, the ID for the
-// trigger/action/condition. The settings are named as follows:
-
-// DBWriteTriggerSetting*(DWORD triggerID, ...) to write a setting given a
-// trigger ID.
-// DBGetTriggerSetting*(DWORD triggerID, ...) to read a setting given a
-// trigger ID.
-// DBWriteActionSetting*(DWORD actionID, ...) to write a setting given an
-// action ID.
-// DBGetActionSetting*(DWORD actionID, ...) to read a setting given an
-// action ID.
-// DBWriteConditionSetting*(DWORD conditionID, ...) to write a setting given a
-// condition ID.
-// DBGetConditionSetting*(DWORD conditionID, ...) to read a setting given a
-// condition ID.
-
-#define MAX_SETTING_LEN 255 // Max. length of a DB setting including the
- // prefix and ID.
-
-// --------------------------------------------------------------------------
-// Database Helper Functions: Triggers
-// --------------------------------------------------------------------------
-
-static int __inline DBWriteTriggerSettingByte(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,BYTE val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_set_b(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteTriggerSettingWord(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,WORD val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_set_w(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteTriggerSettingDword(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,DWORD val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_set_dw(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteTriggerSettingString(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_set_s(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteTriggerSettingTString(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,const TCHAR *val) {
-
- char dbSetting[MAX_SETTING_LEN];
-
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_set_ts(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteTriggerSettingWString(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,const WCHAR *val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_set_ws(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteTriggerSettingStringUtf(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_set_utf(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBGetTriggerSettingByte(DWORD triggerID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_get_b(hContact, szModule, dbSetting, errorValue);
-}
-
-static WORD __inline DBGetTriggerSettingWord(DWORD triggerID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_get_w(hContact, szModule, dbSetting, errorValue);
-}
-
-static DWORD __inline DBGetTriggerSettingDword(DWORD triggerID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_get_dw(hContact, szModule, dbSetting, errorValue);
-}
-
-static int __inline DBGetTriggerSetting(DWORD triggerID, HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_get(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetTriggerSettingW(DWORD triggerID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_get_s(hContact, szModule, dbSetting, dbv, 0);
-}
-
-static int __inline DBGetTriggerSettingTString(DWORD triggerID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_get_ts(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetTriggerSettingWString(DWORD triggerID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_get_ws(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetTriggerSettingStringUtf(DWORD triggerID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_get_utf(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBDeleteTriggerSetting(DWORD triggerID, HANDLE hContact,const char *szModule,const char *szSetting)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_TRIGGERID, triggerID, szSetting);
- return db_unset(hContact, szModule, dbSetting);
-}
-
-// --------------------------------------------------------------------------
-// Database Helper Functions: Actions
-// --------------------------------------------------------------------------
-
-static int __inline DBWriteActionSettingByte(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,BYTE val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_set_b(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteActionSettingWord(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,WORD val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_set_w(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteActionSettingDword(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,DWORD val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_set_dw(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteActionSettingString(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_set_s(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteActionSettingTString(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,const TCHAR *val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_set_ts(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteActionSettingWString(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,const WCHAR *val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_set_ws(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteActionSettingStringUtf(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_set_utf(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBGetActionSettingByte(DWORD actionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_get_b(hContact, szModule, dbSetting, errorValue);
-}
-
-static WORD __inline DBGetActionSettingWord(DWORD actionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_get_w(hContact, szModule, dbSetting, errorValue);
-}
-
-static DWORD __inline DBGetActionSettingDword(DWORD actionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_get_dw(hContact, szModule, dbSetting, errorValue);
-}
-
-static int __inline DBGetActionSetting(DWORD actionID, HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_get(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetActionSettingW(DWORD actionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_get_s(hContact, szModule, dbSetting, dbv, 0);
-}
-
-static int __inline DBGetActionSettingTString(DWORD actionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_get_ts(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetActionSettingWString(DWORD actionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_get_ws(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetActionSettingStringUtf(DWORD actionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_get_utf(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBDeleteActionSetting(DWORD actionID, HANDLE hContact,const char *szModule,const char *szSetting)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_ACTIONID, actionID, szSetting);
- return db_unset(hContact, szModule, dbSetting);
-}
-
-// --------------------------------------------------------------------------
-// Database Helper Functions: Conditions
-// --------------------------------------------------------------------------
-
-static int __inline DBWriteConditionSettingByte(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,BYTE val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_set_b(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteConditionSettingWord(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,WORD val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_set_w(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteConditionSettingDword(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,DWORD val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_set_dw(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteConditionSettingString(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_set_s(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteConditionSettingTString(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,const TCHAR *val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_set_ts(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteConditionSettingWString(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,const WCHAR *val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_set_ws(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBWriteConditionSettingStringUtf(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting,const char *val)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_set_utf(hContact, szModule, dbSetting, val);
-}
-
-static int __inline DBGetConditionSettingByte(DWORD conditionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_get_b(hContact, szModule, dbSetting, errorValue);
-}
-
-static WORD __inline DBGetConditionSettingWord(DWORD conditionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_get_w(hContact, szModule, dbSetting, errorValue);
-}
-
-static DWORD __inline DBGetConditionSettingDword(DWORD conditionID, HANDLE hContact, const char *szModule, const char *szSetting, int errorValue)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_get_dw(hContact, szModule, dbSetting, errorValue);
-}
-
-static int __inline DBGetConditionSetting(DWORD conditionID, HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_get(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetConditionSettingW(DWORD conditionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_get_s(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetConditionSettingTString(DWORD conditionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_get_ts(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetConditionSettingWString(DWORD conditionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_get_ws(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBGetConditionSettingStringUtf(DWORD conditionID, HANDLE hContact,const char *szModule, const char *szSetting,DBVARIANT *dbv)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_get_utf(hContact, szModule, dbSetting, dbv);
-}
-
-static int __inline DBDeleteConditionSetting(DWORD conditionID, HANDLE hContact,const char *szModule,const char *szSetting)
-{
- char dbSetting[MAX_SETTING_LEN];
- mir_snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s", PREFIX_CONDITIONID, conditionID, szSetting);
- return db_unset(hContact, szModule, dbSetting);
-}
-
-#endif // nohelper
-#endif // m_trigger
diff --git a/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj b/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj index 298d20895e..97ddab7986 100644 --- a/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj +++ b/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj @@ -184,7 +184,6 @@ <ClInclude Include="src\keypresses.h" />
<ClInclude Include="src\protolist.h" />
<ClInclude Include="src\resource.h" />
- <ClInclude Include="src\trigger.h" />
<ClInclude Include="src\utils.h" />
<ClInclude Include="src\Version.h" />
</ItemGroup>
@@ -199,7 +198,6 @@ </ClCompile>
<ClCompile Include="src\options.cpp" />
<ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\trigger.cpp" />
<ClCompile Include="src\utils.cpp" />
</ItemGroup>
<ItemGroup>
diff --git a/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj.filters b/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj.filters index f6a0fb7af4..b30f7b3ad3 100644 --- a/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj.filters +++ b/plugins/KeyboardNotify/KeyboardNotify_10.vcxproj.filters @@ -30,9 +30,6 @@ <ClInclude Include="src\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\trigger.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\utils.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -68,9 +65,6 @@ <ClCompile Include="src\options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\trigger.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj b/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj index 6ad64c9857..28a9d4f82f 100644 --- a/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj +++ b/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj @@ -189,7 +189,6 @@ <ClInclude Include="src\keypresses.h" />
<ClInclude Include="src\protolist.h" />
<ClInclude Include="src\resource.h" />
- <ClInclude Include="src\trigger.h" />
<ClInclude Include="src\utils.h" />
<ClInclude Include="src\Version.h" />
</ItemGroup>
@@ -204,7 +203,6 @@ </ClCompile>
<ClCompile Include="src\options.cpp" />
<ClCompile Include="src\main.cpp" />
- <ClCompile Include="src\trigger.cpp" />
<ClCompile Include="src\utils.cpp" />
</ItemGroup>
<ItemGroup>
diff --git a/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj.filters b/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj.filters index f6a0fb7af4..b30f7b3ad3 100644 --- a/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj.filters +++ b/plugins/KeyboardNotify/KeyboardNotify_11.vcxproj.filters @@ -30,9 +30,6 @@ <ClInclude Include="src\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\trigger.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\utils.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -68,9 +65,6 @@ <ClCompile Include="src\options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\trigger.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/plugins/KeyboardNotify/src/Common.h b/plugins/KeyboardNotify/src/Common.h index d8cef2f67c..00705df8b6 100644 --- a/plugins/KeyboardNotify/src/Common.h +++ b/plugins/KeyboardNotify/src/Common.h @@ -43,12 +43,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_kbdnotify.h>
#include <m_metacontacts.h>
-#include <m_trigger.h>
#include "flash.h"
#include "ignore.h"
#include "keyboard.h"
-#include "trigger.h"
#include "constants.h"
#include "protolist.h"
#include "EnumProc.h"
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 5383bc5acd..b44e1de20d 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -901,7 +901,6 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) hFlashingEventService = CreateServiceFunction(MS_KBDNOTIFY_FLASHINGACTIVE, IsFlashingActiveService);
hNormalizeSequenceService = CreateServiceFunction(MS_KBDNOTIFY_NORMALSEQUENCE, NormalizeSequenceService);
- RegisterAction();
if (ServiceExists("DBEditorpp/RegisterSingleModule"))
CallService("DBEditorpp/RegisterSingleModule", (WPARAM)KEYBDMODULE, 0);
@@ -912,11 +911,8 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
-
hInst = hinstDLL;
-
return TRUE;
-
}
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
@@ -926,7 +922,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda extern "C" __declspec(dllexport) int Load(void)
{
-
mir_getLP(&pluginInfo);
GetWindowsVersion();
@@ -955,9 +950,7 @@ void destroyProtocolList(void) extern "C" __declspec(dllexport) int Unload(void)
{
-
UnhookWindowsHooks();
- DeInitAction();
if (hModulesLoaded)
UnhookEvent(hModulesLoaded);
if (hMsgEventHook)
diff --git a/plugins/KeyboardNotify/src/trigger.cpp b/plugins/KeyboardNotify/src/trigger.cpp deleted file mode 100644 index 147744b96d..0000000000 --- a/plugins/KeyboardNotify/src/trigger.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/*
-
-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; 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 "Common.h"
-
-extern HINSTANCE hInst;
-
-void StartBlinkAction(char *, WORD);
-
-
-int getCustomNro(DWORD actionID, HWND hwndDlg, int nItems)
-{
- int i;
- DBVARIANT dbv;
- char theme[MAX_PATH+1];
-
- if (DBGetTriggerSetting(actionID, NULL, KEYBDMODULE, "custom", &dbv))
- return DEF_SETTING_CUSTOMTHEME;
-
- for (i=0; i < nItems; i++) {
- SendDlgItemMessage(hwndDlg, IDC_CUSTOMTHEME, CB_GETLBTEXT, (WPARAM)i, (LPARAM)theme);
- if (!strcmp(dbv.pszVal, theme)) {
- db_free(&dbv);
- return i;
- }
- }
-
- db_free(&dbv);
- return DEF_SETTING_CUSTOMTHEME;
-}
-
-static INT_PTR CALLBACK DlgProcOptsActionKbdNotify(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- DBVARIANT dbv;
- DWORD actionID;
- int i, nItems;
- char theme[MAX_PATH+1];
-
- switch (msg) {
- case WM_INITDIALOG:
- actionID = (DWORD)lParam;
- TranslateDialogDefault(hwndDlg);
-
- for (i=0; !db_get(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv); i++) {
- int index = SendDlgItemMessage(hwndDlg, IDC_CUSTOMTHEME, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbv.pszVal);
- db_free(&dbv);
- if (index != CB_ERR && index != CB_ERRSPACE)
- SendDlgItemMessage(hwndDlg, IDC_CUSTOMTHEME, CB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
- }
-
- nItems = SendDlgItemMessage(hwndDlg, IDC_CUSTOMTHEME, CB_GETCOUNT, 0, 0);
-
- CheckDlgButton(hwndDlg, IDC_USECUSTOM, nItems && DBGetTriggerSettingByte(actionID, NULL, KEYBDMODULE, "usecustom", 0) ? BST_CHECKED:BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_USECUSTOM), nItems);
-
- SendDlgItemMessage(hwndDlg, IDC_CUSTOMTHEME, CB_SETCURSEL, (WPARAM)getCustomNro(actionID, hwndDlg, nItems), 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMTHEME), IsDlgButtonChecked(hwndDlg, IDC_USECUSTOM) == BST_CHECKED);
-
- SendDlgItemMessage(hwndDlg, IDC_FORCEOPEN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_SFORCEOPEN), 0);
- SendDlgItemMessage(hwndDlg, IDC_FORCEOPEN, UDM_SETRANGE32, 1, MAKELONG(UD_MAXVAL, 0));
- SendDlgItemMessage(hwndDlg, IDC_FORCEOPEN, UDM_SETPOS, 0, MAKELONG(DBGetTriggerSettingWord(actionID, NULL, KEYBDMODULE, "forceopen", DEF_SETTING_NBLINKS), 0));
-
- break;
-
- case TM_ADDACTION: // save the settings
- actionID = (DWORD)wParam;
- DBWriteTriggerSettingByte(actionID, NULL, KEYBDMODULE, "usecustom", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_USECUSTOM) == BST_CHECKED ? 1:0));
- SendDlgItemMessage(hwndDlg, IDC_CUSTOMTHEME, CB_GETLBTEXT, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_CUSTOMTHEME, CB_GETCURSEL, 0, 0), (LPARAM)theme);
- DBWriteTriggerSettingString(actionID, NULL, KEYBDMODULE, "custom", theme);
- DBWriteTriggerSettingWord(actionID, NULL, KEYBDMODULE, "forceopen", (WORD)SendDlgItemMessage(hwndDlg, IDC_FORCEOPEN, UDM_GETPOS, 0, 0));
- break;
-
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_USECUSTOM)
- EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMTHEME), IsDlgButtonChecked(hwndDlg, IDC_USECUSTOM) == BST_CHECKED);
- break;
-
- case WM_DESTROY:
- break;
- }
-
- return FALSE;
-}
-
-char *getCustomString(DWORD actionID)
-{
- int i;
- DBVARIANT dbv, dbv2;
- static char customString[MAX_PATH+1];
-
- if (DBGetTriggerSetting(actionID, NULL, KEYBDMODULE, "custom", &dbv))
- return NULL;
-
- for (i=0; !db_get(NULL, KEYBDMODULE, fmtDBSettingName("theme%d", i), &dbv2); i++) {
- if (!strcmp(dbv.pszVal, dbv2.pszVal)) {
- db_free(&dbv);
- db_free(&dbv2);
- if(db_get(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv2))
- return NULL;
- strcpy(customString, dbv2.pszVal);
- db_free(&dbv2);
- return customString;
- }
- db_free(&dbv2);
- }
-
- db_free(&dbv);
- return NULL;
-}
-
-static int TriggerStartBlinkFunction(DWORD actionID, REPORTINFO *ri)
-{
- if (ri->flags&ACT_PERFORM) {
- char *customStr;
-
- if (!DBGetTriggerSettingByte(actionID, NULL, KEYBDMODULE, "usecustom", 0))
- customStr = NULL;
- else
- customStr = getCustomString(actionID);
- StartBlinkAction(customStr, DBGetTriggerSettingWord(actionID, NULL, KEYBDMODULE, "forceopen", DEF_SETTING_NBLINKS));
- }
- if (ri->flags&ACT_CLEANUP) { // request to delete all associated settings
- RemoveAllActionSettings(actionID, KEYBDMODULE);
- }
-
- return 0; // all ok
-}
-
-int RegisterAction()
-{
- ACTIONREGISTER ar;
-
- if (!ServiceExists(MS_TRIGGER_REGISTERACTION))
- return -1;
-
- ZeroMemory(&ar, sizeof(ar));
- ar.cbSize = sizeof(ar);
- ar.pszName = "Keyboard Flash: Start Blinking";
- ar.actionFunction = TriggerStartBlinkFunction;
- ar.hInstance = hInst;
- ar.pfnDlgProc = DlgProcOptsActionKbdNotify;
- ar.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_KN_ACTION);
- ar.flags = ARF_FUNCTION;
- return CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar);
-}
-
-int DeInitAction()
-{
- return 0;
-}
diff --git a/plugins/KeyboardNotify/src/trigger.h b/plugins/KeyboardNotify/src/trigger.h deleted file mode 100644 index 41d830938c..0000000000 --- a/plugins/KeyboardNotify/src/trigger.h +++ /dev/null @@ -1,20 +0,0 @@ -/*
-
-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; 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.
-
-*/
-
-int RegisterAction();
-int DeInitAction();
diff --git a/plugins/Nudge/src/headers.h b/plugins/Nudge/src/headers.h index 1cea468c1f..451afb77f5 100644 --- a/plugins/Nudge/src/headers.h +++ b/plugins/Nudge/src/headers.h @@ -43,7 +43,6 @@ #include <m_icolib.h>
#include <win2k.h>
-#include <m_trigger.h>
#include <m_metacontacts.h>
#include <m_nudge.h>
#include <m_msg_buttonsbar.h>
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index e675a22868..a10054abf1 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -205,65 +205,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfo;
}
-static INT_PTR CALLBACK DlgProcOptsTrigger(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- BOOL bshakeClist,bshakeChat;
- DWORD actionID = (DWORD)lParam;
-
- switch (msg) {
- case WM_INITDIALOG:
- // lParam = (LPARAM)(DWORD)actionID or 0 if this is a new trigger entry
- TranslateDialogDefault(hwnd);
- // Initialize the dialog according to the action ID
- bshakeClist = DBGetActionSettingByte(actionID, NULL, "Nudge", "ShakeClist",FALSE);
- bshakeChat = DBGetActionSettingByte(actionID, NULL, "Nudge", "ShakeChat",FALSE);
- CheckDlgButton(hwnd, IDC_TRIGGER_SHAKECLIST, bshakeClist ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwnd, IDC_TRIGGER_SHAKECHAT, bshakeChat ? BST_CHECKED : BST_UNCHECKED);
- break;
-
- case TM_ADDACTION:
- bshakeClist = (IsDlgButtonChecked(hwnd,IDC_TRIGGER_SHAKECLIST)==BST_CHECKED);
- bshakeChat = (IsDlgButtonChecked(hwnd,IDC_TRIGGER_SHAKECHAT)==BST_CHECKED);
- DBWriteActionSettingByte(actionID, NULL, "Nudge", "ShakeClist",bshakeClist);
- DBWriteActionSettingByte(actionID, NULL, "Nudge", "ShakeChat",bshakeChat);
- break;
- }
-
- return FALSE;
-}
-
-int TriggerActionRecv( DWORD actionID, REPORTINFO *ri)
-{
- // check how to process this call
- if (ri->flags&ACT_PERFORM) {
- BOOL bshakeClist,bshakeChat;
- HANDLE hContact = ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL;
- bshakeClist = DBGetActionSettingByte(actionID, NULL, "Nudge", "ShakeClist",FALSE);
- bshakeChat = DBGetActionSettingByte(actionID, NULL, "Nudge", "ShakeChat",FALSE);
-
- if(bshakeClist)
- ShakeClist(NULL,NULL);
- if(bshakeChat && (hContact != NULL))
- ShakeChat((WPARAM)hContact,NULL);
- }
-
- if (ri->flags&ACT_CLEANUP) // request to delete all associated settings
- RemoveAllActionSettings(actionID, "Nudge");
-
- return FALSE;
-}
-
-int TriggerActionSend( DWORD actionID, REPORTINFO *ri)
-{
- if (ri->flags & ACT_PERFORM) {
- HANDLE hContact = ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL;
- if(hContact != NULL)
- NudgeSend((WPARAM)hContact,NULL);
- }
-
- return FALSE;
-}
-
void LoadProtocols(void)
{
//Load the default nudge
@@ -284,37 +225,11 @@ void LoadProtocols(void) shake.Load();
}
-void RegisterToTrigger(void)
-{
- if ( ServiceExists(MS_TRIGGER_REGISTERACTION)) {
- ACTIONREGISTER ar;
- ZeroMemory(&ar, sizeof(ar));
- ar.cbSize = sizeof(ar);
- ar.hInstance = hInst;
- ar.flags = ARF_TCHAR|ARF_FUNCTION;
- ar.actionFunction = TriggerActionRecv;
- ar.pfnDlgProc = DlgProcOptsTrigger;
- ar.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TRIGGER);
- ar.pszName = Translate("Nudge : Shake contact list/chat window");
-
- // register the action
- CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar);
-
- ar.actionFunction = TriggerActionSend;
- ar.pszName = Translate("Nudge : Send a nudge");
- ar.pfnDlgProc = NULL;
- ar.pszTemplate = NULL;
-
- // register the action
- CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar);
- }
-}
-
void RegisterToDbeditorpp(void)
{
- // known modules list
- if (ServiceExists("DBEditorpp/RegisterSingleModule"))
- CallService("DBEditorpp/RegisterSingleModule", (WPARAM)"Nudge", 0);
+ // known modules list
+ if (ServiceExists("DBEditorpp/RegisterSingleModule"))
+ CallService("DBEditorpp/RegisterSingleModule", (WPARAM)"Nudge", 0);
}
static IconItem iconList[] =
@@ -380,7 +295,6 @@ static int ContactWindowOpen(WPARAM wparam,LPARAM lParam) int ModulesLoaded(WPARAM,LPARAM)
{
- RegisterToTrigger();
RegisterToDbeditorpp();
LoadProtocols();
LoadIcons();
@@ -684,7 +598,6 @@ void Nudge_AddAccount(PROTOACCOUNT *proto) void AutoResendNudge(void *wParam)
{
-
Sleep(GlobalNudge.resendDelaySec * 1000);
NudgeSend((WPARAM) wParam,NULL);
}
diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp index 5110270f3c..c7ec530e67 100644 --- a/plugins/SMS/src/functions.cpp +++ b/plugins/SMS/src/functions.cpp @@ -29,18 +29,18 @@ BOOL DB_GetStaticStringW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LP if (lpwszRetBuff && dwRetBuffSize>=sizeof(WCHAR)) (*((WCHAR*)lpwszRetBuff))=0;
if (pdwRetBuffSize) (*pdwRetBuffSize)=0;
}
-return(bRet);
+ return(bRet);
}
BOOL DB_SetStringExW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszValue,SIZE_T dwValueSize)
{
BOOL bRet=FALSE;
-
+
if (lpwszValue && dwValueSize)
{
LPWSTR lpwszValueLocal=(LPWSTR)MEMALLOC(((dwValueSize+MAX_PATH)*sizeof(WCHAR)));
-
+
if (lpwszValueLocal)
{
DBCONTACTWRITESETTING cws={0};
@@ -51,14 +51,14 @@ BOOL DB_SetStringExW(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR cws.value.pwszVal=(WCHAR*)lpwszValueLocal;
CopyMemory(lpwszValueLocal,lpwszValue,(dwValueSize*sizeof(WCHAR)));
bRet=(CallService(MS_DB_CONTACT_WRITESETTING,(WPARAM)hContact,(LPARAM)&cws)==0);
-
+
MEMFREE(lpwszValueLocal);
}
}else{
bRet=TRUE;
db_unset(hContact,lpszModule,lpszValueName);
}
-return(bRet);
+ return(bRet);
}
@@ -94,7 +94,7 @@ SIZE_T CopyNumberA(LPSTR lpszOutBuff,LPSTR lpszBuff,SIZE_T dwLen) }
(*lpbOutBuff)=0;
-return((lpbOutBuff-(LPBYTE)lpszOutBuff));
+ return((lpbOutBuff-(LPBYTE)lpszOutBuff));
}
SIZE_T CopyNumberW(LPWSTR lpcOutBuff,LPWSTR lpcBuff,SIZE_T dwLen)
@@ -109,7 +109,7 @@ SIZE_T CopyNumberW(LPWSTR lpcOutBuff,LPWSTR lpcBuff,SIZE_T dwLen) }
(*lpwszOutBuff)=0;
-return((lpwszOutBuff-lpcOutBuff));
+ return((lpwszOutBuff-lpcOutBuff));
}
@@ -173,23 +173,23 @@ BOOL IsContactPhoneParam(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueName,LP SIZE_T i,dwPhoneSizeLocal;
if ( DB_GetStaticStringW(hContact,lpszModule,lpszValueName,wszPhoneLocal,SIZEOF(wszPhoneLocal),&dwPhoneSizeLocal))
- if ( IsPhoneW(wszPhoneLocal,dwPhoneSizeLocal)) {
- dwPhoneSizeLocal = CopyNumberW(wszPhoneLocal,wszPhoneLocal,dwPhoneSizeLocal);
- if (MemoryCompare(wszPhoneLocal,dwPhoneSizeLocal,lpwszPhone,dwPhoneSize)==CSTR_EQUAL)
- return TRUE;
- }
+ if ( IsPhoneW(wszPhoneLocal,dwPhoneSizeLocal)) {
+ dwPhoneSizeLocal = CopyNumberW(wszPhoneLocal,wszPhoneLocal,dwPhoneSizeLocal);
+ if (MemoryCompare(wszPhoneLocal,dwPhoneSizeLocal,lpwszPhone,dwPhoneSize)==CSTR_EQUAL)
+ return TRUE;
+ }
- for (i=0; i <= PHONES_MIN_COUNT; i++) {
- mir_snprintf(szBuff,sizeof(szBuff),"%s%ld",lpszValueName,i);
- if ( DB_GetStaticStringW(hContact,lpszModule,szBuff,wszPhoneLocal,SIZEOF(wszPhoneLocal),&dwPhoneSizeLocal)) {
- if (IsPhoneW(wszPhoneLocal,dwPhoneSizeLocal)) {
- dwPhoneSizeLocal=CopyNumberW(wszPhoneLocal,wszPhoneLocal,dwPhoneSizeLocal);
- if (MemoryCompare(wszPhoneLocal,dwPhoneSizeLocal,lpwszPhone,dwPhoneSize) == CSTR_EQUAL)
- return TRUE;
+ for (i=0; i <= PHONES_MIN_COUNT; i++) {
+ mir_snprintf(szBuff,sizeof(szBuff),"%s%ld",lpszValueName,i);
+ if ( DB_GetStaticStringW(hContact,lpszModule,szBuff,wszPhoneLocal,SIZEOF(wszPhoneLocal),&dwPhoneSizeLocal)) {
+ if (IsPhoneW(wszPhoneLocal,dwPhoneSizeLocal)) {
+ dwPhoneSizeLocal=CopyNumberW(wszPhoneLocal,wszPhoneLocal,dwPhoneSizeLocal);
+ if (MemoryCompare(wszPhoneLocal,dwPhoneSizeLocal,lpwszPhone,dwPhoneSize) == CSTR_EQUAL)
+ return TRUE;
+ }
}
}
- }
- return FALSE;
+ return FALSE;
}
@@ -308,11 +308,11 @@ BOOL GetXMLFieldEx(LPSTR lpszXML,SIZE_T dwXMLSize,LPSTR *plpszData,SIZE_T *pdwDa }
else {
if (++thisLevel==1)
- if (CompareStringA(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,lpszFindTag,-1,lpszTagStart,((lpszTagEnd+1)-lpszTagStart))==CSTR_EQUAL) {
- lpszFindTag=va_arg(va,LPSTR);
- if (lpszFindTag==NULL) lpszDataStart=(lpszTagEnd+2);
- thisLevel=0;
- }
+ if (CompareStringA(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,lpszFindTag,-1,lpszTagStart,((lpszTagEnd+1)-lpszTagStart))==CSTR_EQUAL) {
+ lpszFindTag=va_arg(va,LPSTR);
+ if (lpszFindTag==NULL) lpszDataStart=(lpszTagEnd+2);
+ thisLevel=0;
+ }
}
}
va_end(va);
@@ -354,12 +354,12 @@ BOOL GetXMLFieldExBuff(LPSTR lpszXML,SIZE_T dwXMLSize,LPSTR lpszBuff,SIZE_T dwBu }
}else{
if (++thisLevel==1)
- if (CompareStringA(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,lpszFindTag,-1,lpszTagStart,((lpszTagEnd+1)-lpszTagStart))==CSTR_EQUAL)
- {
- lpszFindTag=va_arg(va,LPSTR);
- if (lpszFindTag==NULL) lpszDataStart=(lpszTagEnd+2);
- thisLevel=0;
- }
+ if (CompareStringA(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,lpszFindTag,-1,lpszTagStart,((lpszTagEnd+1)-lpszTagStart))==CSTR_EQUAL)
+ {
+ lpszFindTag=va_arg(va,LPSTR);
+ if (lpszFindTag==NULL) lpszDataStart=(lpszTagEnd+2);
+ thisLevel=0;
+ }
}
}else{
break;
@@ -377,82 +377,9 @@ BOOL GetXMLFieldExBuff(LPSTR lpszXML,SIZE_T dwXMLSize,LPSTR lpszBuff,SIZE_T dwBu if (pdwBuffSizeRet) (*pdwBuffSizeRet)=0;
}
-return(bRet);
+ return(bRet);
}
-
-/*BOOL GetXMLFieldExW(LPWSTR lpwszXML,SIZE_T dwXMLSize,LPWSTR *plpwszData,SIZE_T *pdwDataSize,const WCHAR *tag1,...)
-{
- BOOL bRet=FALSE;
- int thisLevel=0;
- LPWSTR lpwszFindTag=(LPWSTR)tag1,lpwszTagStart,lpwszTagEnd=lpwszXML,lpwszDataStart=NULL;
- va_list va;
-
- va_start(va,tag1);
- while (TRUE)
- {
- lpwszTagStart=(LPWSTR)MemoryFind((lpwszTagEnd-lpwszXML),lpwszXML,dwXMLSize,_T("<"),2);
- if (lpwszTagStart)
- {
- lpwszTagEnd=(LPWSTR)MemoryFind((lpwszTagStart-lpwszXML),lpwszXML,dwXMLSize,_T(">"),2);
- if (lpwszTagEnd)
- {
- lpwszTagStart++;
- lpwszTagEnd--;
- if ((*((WORD*)lpwszTagStart))==(*((WORD*)"/")))
- {
- if (--thisLevel<0)
- {
- if (lpwszDataStart)
- {
- if (plpwszData) (*plpwszData)=lpwszDataStart;
- if (pdwDataSize) (*pdwDataSize)=((lpwszTagStart-1)-lpwszDataStart);
- bRet=TRUE;
- }
- break;
- }
- }else{
- if (++thisLevel==1)
- if (CompareStringW(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,lpwszFindTag,-1,lpwszTagStart,((lpwszTagEnd+1)-lpwszTagStart))==CSTR_EQUAL)
- {
- lpwszFindTag=va_arg(va,LPWSTR);
- if (lpwszFindTag==NULL) lpwszDataStart=(lpwszTagEnd+2);
- thisLevel=0;
- }
- }
- }else{
- break;
- }
- }else{
- break;
- }
- }
- va_end(va);
-return(bRet);
-}
-
-
-BOOL GetXMLFieldExBuffW(LPWSTR lpwszXML,SIZE_T dwXMLSize,LPWSTR lpwszBuff,SIZE_T dwBuffSize,SIZE_T *pdwBuffSizeRet,const WCHAR *tag1,...)
-{
- BOOL bRet;
- LPWSTR lpwszData;
- SIZE_T dwDataSize;
-
- if ((bRet=GetXMLFieldExW(lpwszXML,dwXMLSize,&lpwszData,&dwDataSize,tag1)))
- {
- SIZE_T dwBuffSizeRet=min((dwBuffSize-2),dwDataSize);
-
- if (lpwszBuff && dwBuffSize) CopyMemory(lpwszBuff,lpwszData,dwBuffSizeRet);(*((WORD*)(lpwszBuff+dwBuffSizeRet)))=0;
- if (pdwBuffSizeRet) (*pdwBuffSizeRet)=dwBuffSizeRet;
- }else{
- if (lpwszBuff) (*((WORD*)lpwszBuff))=0;
- if (pdwBuffSizeRet) (*pdwBuffSizeRet)=0;
- }
-
-return(bRet);
-}//*/
-
-
DWORD ReplaceInBuff(LPVOID lpInBuff,SIZE_T dwInBuffSize,SIZE_T dwReplaceItemsCount,LPVOID *plpInReplaceItems,SIZE_T *pdwInReplaceItemsCounts,LPVOID *plpOutReplaceItems,SIZE_T *pdwOutReplaceItemsCounts,LPVOID lpOutBuff,SIZE_T dwOutBuffSize,SIZE_T *pdwOutBuffSize)
{
DWORD dwRetErrorCode=NO_ERROR;
@@ -513,7 +440,7 @@ DWORD ReplaceInBuff(LPVOID lpInBuff,SIZE_T dwInBuffSize,SIZE_T dwReplaceItemsCou if (pdwOutBuffSize) (*pdwOutBuffSize)=(lpszMessageConvertedCur-((LPBYTE)lpOutBuff));
-return(dwRetErrorCode);
+ return(dwRetErrorCode);
}
@@ -528,16 +455,16 @@ DWORD DecodeXML(LPTSTR lptszMessage,SIZE_T dwMessageSize,LPTSTR lptszMessageConv DWORD dwRet=ReplaceInBuff(lptszMessage,(dwMessageSize*sizeof(TCHAR)),SIZEOF(lpszXMLTags),(LPVOID*)lpszXMLTags,(SIZE_T*)dwXMLTagsCount,(LPVOID*)lpszXMLSymbols,(SIZE_T*)dwXMLSymbolsCount,lptszMessageConverted,(dwMessageConvertedBuffSize*sizeof(TCHAR)),pdwMessageConvertedSize);
if (pdwMessageConvertedSize) (*pdwMessageConvertedSize)/=sizeof(TCHAR);
-return(dwRet);
+ return(dwRet);
}
//Encode XML coded string. The function translate special saved xml characters into special characters.
DWORD EncodeXML(LPTSTR lptszMessage,SIZE_T dwMessageSize,LPTSTR lptszMessageConverted,SIZE_T dwMessageConvertedBuffSize,SIZE_T *pdwMessageConvertedSize)
{
DWORD dwRet=ReplaceInBuff(lptszMessage,(dwMessageSize*sizeof(TCHAR)),SIZEOF(lpszXMLTags),(LPVOID*)lpszXMLSymbols,(SIZE_T*)dwXMLSymbolsCount,(LPVOID*)lpszXMLTags,(SIZE_T*)dwXMLTagsCount,lptszMessageConverted,(dwMessageConvertedBuffSize*sizeof(TCHAR)),pdwMessageConvertedSize);
-
+
if (pdwMessageConvertedSize) (*pdwMessageConvertedSize)/=sizeof(TCHAR);
-return(dwRet);
+ return(dwRet);
}
@@ -634,7 +561,7 @@ int RefreshAccountList(WPARAM eventCode,LPARAM lParam) ssSMSSettings.dwSMSAccountsCount=dwSMSAccountsCount;
SendSMSWindowsUpdateAllAccountLists();
-return 0;
+ return 0;
}
//This function free the global account list.
@@ -644,23 +571,3 @@ void FreeAccountList() MEMFREE(ssSMSSettings.ppaSMSAccounts);
ssSMSSettings.dwSMSAccountsCount=0;
}
-
-//This function check if the module is in the account list that supports sms sending in miranda.
-/*BOOL IsModuleInAccountList(LPSTR lpszModule)
-{
- BOOL bRet=FALSE;
-
- if (ssSMSSettings.ppaSMSAccounts && ssSMSSettings.dwSMSAccountsCount)
- {
- for(SIZE_T i=0;i<ssSMSSettings.dwSMSAccountsCount;i++)
- {
- if (CompareStringA(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,ssSMSSettings.ppaSMSAccounts[i]->szModuleName,-1,lpszModule,-1)==CSTR_EQUAL)
- {
- bRet=TRUE;
- break;
- }
- }
- }
-return(bRet);
-}//*/
-
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_10.vcxproj b/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_10.vcxproj index 4b072d286c..e205120f39 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_10.vcxproj +++ b/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_10.vcxproj @@ -229,13 +229,11 @@ <ClCompile Include="main.cpp" />
<ClCompile Include="msgoptions.cpp" />
<ClCompile Include="options.cpp" />
- <ClCompile Include="trigger_aaa.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="advancedautoaway.h" />
<ClInclude Include="..\commonstatus.h" />
<ClInclude Include="..\resource.h" />
- <ClInclude Include="trigger_aaa.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\useronli.ico" />
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_10.vcxproj.filters b/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_10.vcxproj.filters index 4df6386e1f..fc5daed232 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_10.vcxproj.filters +++ b/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_10.vcxproj.filters @@ -36,9 +36,6 @@ <ClCompile Include="options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="trigger_aaa.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="..\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -53,9 +50,6 @@ <ClInclude Include="..\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="trigger_aaa.h">
- <Filter>Header Files</Filter>
- </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\useronli.ico">
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_11.vcxproj b/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_11.vcxproj index 1f5c689c58..a4074685fb 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_11.vcxproj +++ b/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_11.vcxproj @@ -234,13 +234,11 @@ <ClCompile Include="main.cpp" />
<ClCompile Include="msgoptions.cpp" />
<ClCompile Include="options.cpp" />
- <ClCompile Include="trigger_aaa.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="advancedautoaway.h" />
<ClInclude Include="..\commonstatus.h" />
<ClInclude Include="..\resource.h" />
- <ClInclude Include="trigger_aaa.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\useronli.ico" />
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_11.vcxproj.filters b/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_11.vcxproj.filters index 4df6386e1f..fc5daed232 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_11.vcxproj.filters +++ b/plugins/StatusPlugins/AdvancedAutoAway/AdvancedAutoAway_11.vcxproj.filters @@ -36,9 +36,6 @@ <ClCompile Include="options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="trigger_aaa.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="..\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -53,9 +50,6 @@ <ClInclude Include="..\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="trigger_aaa.h">
- <Filter>Header Files</Filter>
- </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\useronli.ico">
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp index 6e53e477f3..f08ed86d13 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp @@ -30,13 +30,6 @@ #define SECS_PER_MINUTE 60 /* default I believe */
#endif
-#define TRIGGERPLUGIN /* remove this to compile without it */
-
-#ifdef TRIGGERPLUGIN
-extern int InitTrigger();
-extern int DeInitTrigger();
-#endif
-
/////////////////////////////////////////////////////////////////////////////////////////
int CompareSettings( const TAAAProtoSetting* p1, const TAAAProtoSetting* p2 )
@@ -629,10 +622,5 @@ int CSModuleLoaded(WPARAM wParam, LPARAM lParam) ////////////////////////////////////////////////////////////////////////////////////////
LoadOptions(*autoAwaySettings, FALSE);
-
-#ifdef TRIGGERPLUGIN
- InitTrigger();
-#endif
-
return 0;
}
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/trigger_aaa.cpp b/plugins/StatusPlugins/AdvancedAutoAway/trigger_aaa.cpp deleted file mode 100644 index 47740ac56a..0000000000 --- a/plugins/StatusPlugins/AdvancedAutoAway/trigger_aaa.cpp +++ /dev/null @@ -1,161 +0,0 @@ -#include "../commonstatus.h"
-#include "advancedautoaway.h"
-#include <m_trigger.h>
-#include "trigger_aaa.h"
-#include "../resource.h"
-
-extern HINSTANCE hInst;
-static HANDLE hAAAStateChangedHook;
-
-static int AAAStateChanged(WPARAM wParam, LPARAM lParam) {
-
- AUTOAWAYSETTING *aas;
- DWORD triggerID;
- REPORTINFO ri;
- TRIGGERDATA td;
- BOOL bReport;
-
- aas = (AUTOAWAYSETTING *)lParam;
- triggerID = 0;
- do {
- triggerID = (DWORD)CallService(MS_TRIGGER_FINDNEXTTRIGGERID, triggerID, (LPARAM)TRIGGERNAME);
- if (triggerID == 0) {
- continue;
- }
- bReport = FALSE;
- switch (aas->curState) {
- case STATUS1_SET:
- if (DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_ENTERFIRST, 0)) {
- bReport = TRUE;
- }
- break;
- case STATUS2_SET:
- if (DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_ENTERSECOND, 0)) {
- bReport = TRUE;
- }
- break;
- case SET_ORGSTATUS:
- if ( (aas->oldState == STATUS1_SET) && (DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_LEAVEFIRST, 0))) {
- bReport = TRUE;;
- }
- if ( (aas->oldState == STATUS2_SET) && (DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_LEAVESECOND, 0))) {
- bReport = TRUE;;
- }
- break;
- case HIDDEN_ACTIVE:
- if (DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_BECOMEACTIVE, 0)) {
- bReport = TRUE;
- }
- break;
- case ACTIVE:
- if (aas->oldState == HIDDEN_ACTIVE) {
- char setting[128];
- char *szProto;
-
- szProto = db_get_b(NULL, MODULENAME, SETTING_SAMESETTINGS, 0)?SETTING_ALL:aas->protocolSetting->szName;
- _snprintf(setting, sizeof(setting), "%s_Lv1Status", szProto);
- if ( (aas->protocolSetting->lastStatus == db_get_w(NULL, MODULENAME, setting, ID_STATUS_AWAY)) && DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_LEAVEFIRST, 0)) {
- bReport = TRUE;
- }
-
- _snprintf(setting, sizeof(setting), "%s_Lv2Status", szProto);
- if ( (aas->protocolSetting->lastStatus == db_get_w(NULL, MODULENAME, setting, ID_STATUS_NA)) && DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_LEAVESECOND, 0)) {
- bReport = TRUE;
- }
- }
- break;
- }
- if (!bReport) {
- continue;
- }
- ZeroMemory(&td, sizeof(td));
- td.cbSize = sizeof(td);
- td.dFlags = DF_PROTO|DF_STATUS|DF_TEXT;
- td.szProto = td.szText = aas->protocolSetting->szName;
- td.status = aas->protocolSetting->status;
- ZeroMemory(&ri, sizeof(REPORTINFO));
- ri.cbSize = sizeof(REPORTINFO);
- ri.triggerID = triggerID;
- ri.pszName = TRIGGERNAME;
- ri.flags = TRG_PERFORM;
- ri.td = &td;
- CallService(MS_TRIGGER_REPORTEVENT, 0, (LPARAM)&ri);
- } while (triggerID != 0);
-
- return 0;
-}
-
-static INT_PTR CALLBACK DlgProcOptsAAAStateChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
-
- switch (msg) {
- case WM_INITDIALOG: {
- DWORD triggerID;
-
- TranslateDialogDefault(hwndDlg);
- triggerID = (DWORD)lParam;
- CheckDlgButton(hwndDlg, IDC_ENTERFIRST, DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_ENTERFIRST, 0)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ENTERSECOND, DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_ENTERSECOND, 0)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LEAVEFIRST, DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_LEAVEFIRST, 0)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LEAVESECOND, DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_LEAVESECOND, 0)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_BECOMEACTIVE, DBGetTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_BECOMEACTIVE, 0)?BST_CHECKED:BST_UNCHECKED);
- break;
- }
-
- case TM_ADDTRIGGER: {
- // wParam = trigger ID
- DWORD triggerID;
-
- triggerID = (DWORD)wParam;
- DBWriteTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_ENTERFIRST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENTERFIRST));
- DBWriteTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_ENTERSECOND, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENTERSECOND));
- DBWriteTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_LEAVEFIRST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_LEAVEFIRST));
- DBWriteTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_LEAVESECOND, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_LEAVESECOND));
- DBWriteTriggerSettingByte(triggerID, NULL, MODULENAME, SETTING_BECOMEACTIVE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BECOMEACTIVE));
- break;
- }
-
- case TM_DELTRIGGER: {
- // wParam = triggerID
- DWORD triggerID;
- REMOVETRIGGERSETTINGS rts;
-
- triggerID = (DWORD)wParam;
- rts.cbSize = sizeof(REMOVETRIGGERSETTINGS);
- rts.prefix = PREFIX_TRIGGERID;
- rts.id = triggerID;
- rts.hContact = NULL;
- rts.szModule = MODULENAME;
- CallService(MS_TRIGGER_REMOVESETTINGS, 0, (LPARAM)&rts);
- break;
- }
- }
-
- return FALSE;
-}
-
-int InitTrigger() {
-
- TRIGGERREGISTER tr;
-
- if (!ServiceExists(MS_TRIGGER_REGISTERTRIGGER)) {
- return -1;
- }
- ZeroMemory(&tr, sizeof(tr));
- tr.cbSize = sizeof(tr);
- tr.pszName = TRIGGERNAME;
- tr.hInstance = hInst;
- tr.pfnDlgProc = DlgProcOptsAAAStateChange;
- tr.pszTemplate = MAKEINTRESOURCEA(IDD_TRG_AAASTATECHANGE);
- tr.dFlags = DF_STATUS|DF_PROTO;
- CallService(MS_TRIGGER_REGISTERTRIGGER, 0, (LPARAM)&tr);
- hAAAStateChangedHook = HookEvent(ME_AAA_STATECHANGED, AAAStateChanged);
-
- return 0;
-}
-
-int DeInitTrigger() {
-
- UnhookEvent(hAAAStateChangedHook);
-
- return 0;
-}
\ No newline at end of file diff --git a/plugins/StatusPlugins/AdvancedAutoAway/trigger_aaa.h b/plugins/StatusPlugins/AdvancedAutoAway/trigger_aaa.h deleted file mode 100644 index 52b15edd00..0000000000 --- a/plugins/StatusPlugins/AdvancedAutoAway/trigger_aaa.h +++ /dev/null @@ -1,7 +0,0 @@ -#define TRIGGERNAME "Auto-Away: State change"
-
-#define SETTING_ENTERFIRST "trigger_EnterFirst"
-#define SETTING_ENTERSECOND "trigger_EnterSecond"
-#define SETTING_LEAVEFIRST "trigger_LeaveFirst"
-#define SETTING_LEAVESECOND "trigger_LeaveSecond"
-#define SETTING_BECOMEACTIVE "trigger_BecomeActive"
\ No newline at end of file diff --git a/plugins/StatusPlugins/KeepStatus/KeepStatus_10.vcxproj b/plugins/StatusPlugins/KeepStatus/KeepStatus_10.vcxproj index b8862c094d..6acc94b0cc 100644 --- a/plugins/StatusPlugins/KeepStatus/KeepStatus_10.vcxproj +++ b/plugins/StatusPlugins/KeepStatus/KeepStatus_10.vcxproj @@ -211,11 +211,9 @@ <ClCompile Include="..\..\helpers\gen_helpers.cpp">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="action_keepstatus.cpp" />
<ClCompile Include="keepstatus.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="options.cpp" />
- <ClCompile Include="trigger_keepstatus.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\commonstatus.h" />
diff --git a/plugins/StatusPlugins/KeepStatus/KeepStatus_10.vcxproj.filters b/plugins/StatusPlugins/KeepStatus/KeepStatus_10.vcxproj.filters index 93701d6b66..9d4b6dcc2d 100644 --- a/plugins/StatusPlugins/KeepStatus/KeepStatus_10.vcxproj.filters +++ b/plugins/StatusPlugins/KeepStatus/KeepStatus_10.vcxproj.filters @@ -15,9 +15,6 @@ </Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="action_keepstatus.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="..\commonstatus.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -36,9 +33,6 @@ <ClCompile Include="options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="trigger_keepstatus.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="..\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/plugins/StatusPlugins/KeepStatus/KeepStatus_11.vcxproj b/plugins/StatusPlugins/KeepStatus/KeepStatus_11.vcxproj index 79fefc9151..584e4a7aba 100644 --- a/plugins/StatusPlugins/KeepStatus/KeepStatus_11.vcxproj +++ b/plugins/StatusPlugins/KeepStatus/KeepStatus_11.vcxproj @@ -216,11 +216,9 @@ <ClCompile Include="..\..\helpers\gen_helpers.cpp">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="action_keepstatus.cpp" />
<ClCompile Include="keepstatus.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="options.cpp" />
- <ClCompile Include="trigger_keepstatus.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\commonstatus.h" />
diff --git a/plugins/StatusPlugins/KeepStatus/KeepStatus_11.vcxproj.filters b/plugins/StatusPlugins/KeepStatus/KeepStatus_11.vcxproj.filters index 93701d6b66..9d4b6dcc2d 100644 --- a/plugins/StatusPlugins/KeepStatus/KeepStatus_11.vcxproj.filters +++ b/plugins/StatusPlugins/KeepStatus/KeepStatus_11.vcxproj.filters @@ -15,9 +15,6 @@ </Filter>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="action_keepstatus.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="..\commonstatus.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -36,9 +33,6 @@ <ClCompile Include="options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="trigger_keepstatus.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="..\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
diff --git a/plugins/StatusPlugins/KeepStatus/action_keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/action_keepstatus.cpp deleted file mode 100644 index f51f258ec7..0000000000 --- a/plugins/StatusPlugins/KeepStatus/action_keepstatus.cpp +++ /dev/null @@ -1,184 +0,0 @@ -#include "../commonstatus.h"
-#include "keepstatus.h"
-#include "../resource.h"
-#include "m_trigger.h"
-
-extern HINSTANCE hInst;
-
-#define STR_PROTOFROMTRIGGER "PROTO_FT"
-#define SETTING_PROTO_ENABLED "proto_Enabled"
-
-static BOOL ProtocolEnabled(DWORD id, char *szPrefix, REPORTINFO *ri, char *szProto)
-{
- char dbSetting[128];
- _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s_%s", szPrefix, id, szProto, SETTING_PROTO_ENABLED);
- if ( db_get_b(NULL, MODULENAME, dbSetting, 0))
- return TRUE;
-
- if ( ri != NULL && ri->td != NULL && (ri->td->dFlags & DF_PROTO) && !strcmp(szProto, ri->td->szProto)) {
- _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s_%s", szPrefix, id, STR_PROTOFROMTRIGGER, SETTING_PROTO_ENABLED);
- return db_get_b(NULL, MODULENAME, dbSetting, 0);
- }
-
- return FALSE;
-}
-
-static void BuildProtoList(HWND hList, BOOL bFromTrigger, char* szPrefix, DWORD id)
-{
- ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT|LVS_EX_CHECKBOXES, LVS_EX_FULLROWSELECT|LVS_EX_CHECKBOXES);
-
- LVCOLUMN lvCol = { 0 };
- lvCol.mask = LVCF_TEXT;
- lvCol.pszText = TranslateT("Protocol");
- ListView_InsertColumn(hList, 0, &lvCol);
-
- LVITEM lvItem = { 0 };
- lvItem.mask = LVIF_TEXT|LVIF_PARAM;
- lvItem.iItem = 0;
- lvItem.iSubItem = 0;
-
- int count;
- PROTOACCOUNT** protos;
- ProtoEnumAccounts( &count, &protos );
-
- char dbSetting[128];
-
- for ( int i=0; i < count; i++ ) {
- if ( !IsSuitableProto( protos[i] ))
- continue;
-
- lvItem.pszText = Hlp_GetProtocolName( protos[i]->szModuleName );
- lvItem.lParam = (LPARAM)protos[i]->szModuleName;
- ListView_InsertItem(hList, &lvItem);
-
- _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s_%s", szPrefix, id, protos[i]->szModuleName, SETTING_PROTO_ENABLED);
- ListView_SetCheckState(hList, lvItem.iItem, db_get_b(NULL, MODULENAME, dbSetting, 0));
- ListView_SetItem(hList, &lvItem);
- lvItem.iItem++;
- if (lvItem.pszText != NULL)
- free(lvItem.pszText);
- }
- if (bFromTrigger) {
- lvItem.pszText = TranslateT("<from trigger>");
- ListView_InsertItem(hList, &lvItem);
- lvItem.lParam = (LPARAM)STR_PROTOFROMTRIGGER;
- _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s_%s", szPrefix, id, STR_PROTOFROMTRIGGER, SETTING_PROTO_ENABLED);
- ListView_SetCheckState(hList, lvItem.iItem, db_get_b(NULL, MODULENAME, dbSetting, 0));
- ListView_SetItem(hList, &lvItem);
- lvItem.iItem++;
- }
- ListView_SetColumnWidth(hList, 0, LVSCW_AUTOSIZE);
-}
-
-static void SaveProtoList(HWND hList, char *szPrefix, DWORD id)
-{
- LVITEM lvItem = { 0 };
- lvItem.mask = LVIF_PARAM;
- lvItem.iSubItem=0;
- for ( int i=0; i < ListView_GetItemCount(hList); i++ ) {
- lvItem.iItem=i;
- if (ListView_GetItem(hList, &lvItem) == FALSE)
- continue;
-
- char dbSetting[128];
- _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s_%s", szPrefix, id, (const char*)lvItem.lParam, SETTING_PROTO_ENABLED);
- if (ListView_GetCheckState(hList, lvItem.iItem))
- db_set_b(NULL, MODULENAME, dbSetting, TRUE);
- else {
- log_debugA("deleting: %s", dbSetting);
- db_unset(NULL, MODULENAME, dbSetting);
- }
- }
-}
-
-static INT_PTR CALLBACK DlgProcOptsActionKeepStatus(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
-
- switch (msg) {
- case WM_INITDIALOG: {
- DWORD actionID;
- TRIGGERINFO ti;
-
- TranslateDialogDefault(hwndDlg);
- actionID = (DWORD)lParam;
- ZeroMemory(&ti, sizeof(TRIGGERINFO));
- ti.cbSize = sizeof(TRIGGERINFO);
- SendMessage(GetParent(hwndDlg), TM_GETTRIGGERINFO, 0, (LPARAM)&ti);
- BuildProtoList(GetDlgItem(hwndDlg, IDC_PROTOLIST), ti.dFlags&DF_PROTO?TRUE:FALSE, PREFIX_ACTIONID, actionID);
- CheckRadioButton(hwndDlg, IDC_ENABLECHECKING, IDC_DISABLECHECKING, DBGetActionSettingByte(actionID, NULL, MODULENAME, SETTING_ENABLECHECKING, FALSE)?IDC_ENABLECHECKING:IDC_DISABLECHECKING);
- break;
- }
-
- case TM_ADDACTION: { // save the settings
- DWORD actionID;
-
- actionID = (DWORD)wParam;
- DBWriteActionSettingByte(actionID, NULL, MODULENAME, SETTING_ENABLECHECKING, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLECHECKING));
- SaveProtoList(GetDlgItem(hwndDlg, IDC_PROTOLIST), PREFIX_ACTIONID, actionID);
- break;
- }
-
- case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDC_ENABLECHECKING:
- case IDC_DISABLECHECKING:
- CheckRadioButton(hwndDlg, IDC_ENABLECHECKING, IDC_DISABLECHECKING, LOWORD(wParam));
- break;
- }
- break;
- }
-
- return FALSE;
-}
-
-static int TriggerChecking(DWORD actionID, REPORTINFO *ri)
-{
- if (ri->flags & ACT_PERFORM) {
- BOOL checking = DBGetActionSettingByte(actionID, NULL, MODULENAME, SETTING_ENABLECHECKING, FALSE);
-
- int count;
- PROTOACCOUNT** protos;
- ProtoEnumAccounts( &count, &protos );
-
- for ( int i=0; i <count; i++ ) {
- if ( !IsSuitableProto( protos[i] ))
- continue;
-
- if (!ProtocolEnabled(actionID, PREFIX_ACTIONID, ri, protos[i]->szModuleName))
- continue;
-
- CallService(MS_KS_ENABLEPROTOCOL, (WPARAM)checking, (LPARAM)protos[i]->szModuleName);
- }
- }
- if (ri->flags & ACT_CLEANUP) {
- REMOVETRIGGERSETTINGS ras;
- ras.cbSize = sizeof(REMOVETRIGGERSETTINGS);
- ras.prefix = PREFIX_ACTIONID;
- ras.id = actionID;
- ras.hContact = NULL;
- ras.szModule = MODULENAME;
- CallService(MS_TRIGGER_REMOVESETTINGS, 0, (LPARAM)&ras);
- }
-
- return 0;
-}
-
-int RegisterAction()
-{
- if (!ServiceExists(MS_TRIGGER_REGISTERACTION))
- return -1;
-
- ACTIONREGISTER ai;
- ai.cbSize = sizeof(ai);
- ai.pszName = "KeepStatus: Enable/disable checking";
- ai.hInstance = hInst;
- ai.pfnDlgProc = DlgProcOptsActionKeepStatus;
- ai.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_KS_ACTION);
- ai.flags = ARF_FUNCTION;
- ai.actionFunction = TriggerChecking;
- return CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ai);
-}
-
-int DeInitAction() {
-
- return 0;
-}
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 72ec8a6c05..d852cd0a0a 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -98,15 +98,6 @@ static int Exit(WPARAM wParam, LPARAM lParam); extern int OptionsInit(WPARAM wparam,LPARAM lparam);
extern int InitCommonStatus();
-#define TRIGGERPLUGIN /* remove this to compile without it */
-
-#ifdef TRIGGERPLUGIN
-extern int RegisterAction();
-extern int DeInitAction();
-extern int RegisterTrigger();
-extern int DeInitTrigger();
-#endif
-
TConnectionSettings::TConnectionSettings( PROTOACCOUNT* pa )
{
cbSize = sizeof(PROTOCOLSETTINGEX);
@@ -1294,21 +1285,11 @@ int CSModuleLoaded(WPARAM wParam,LPARAM lParam) hOptionsHook = HookEvent(ME_OPT_INITIALISE, OptionsInit);
hShutdownHook = HookEvent(ME_SYSTEM_OKTOEXIT, Exit);
hAccChangeHook = HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccChanged);
-#ifdef TRIGGERPLUGIN
- RegisterAction();
- RegisterTrigger();
-#endif
-
return 0;
}
static int Exit(WPARAM wParam, LPARAM lParam)
{
-#ifdef TRIGGERPLUGIN
- DeInitTrigger();
- DeInitAction();
-#endif
-
UnhookEvent(hOptionsHook);
UnhookEvent(hShutdownHook);
UnhookEvent(hAccChangeHook);
diff --git a/plugins/StatusPlugins/KeepStatus/trigger_keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/trigger_keepstatus.cpp deleted file mode 100644 index 8421460d2f..0000000000 --- a/plugins/StatusPlugins/KeepStatus/trigger_keepstatus.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/*
- KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- 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; 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 "../commonstatus.h"
-#include "keepstatus.h"
-#include "../resource.h"
-#include <m_trigger.h>
-
-extern HINSTANCE hInst;
-static HANDLE hKeepStatusHook;
-
-static INT_PTR CALLBACK DlgProcOptsTriggerKeepStatus(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- /* lParam = (LPARAM)(DWORD)triggerID, or 0 if this is a new trigger */
- DWORD triggerID = (DWORD)lParam;
- CheckDlgButton(hwndDlg, IDC_CONNLOST, (DBGetTriggerSettingWord(triggerID, NULL, MODULENAME, SETTING_TRIGGERON, 0)&TRIGGER_CONNLOST)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOGINERROR, (DBGetTriggerSettingWord(triggerID, NULL, MODULENAME, SETTING_TRIGGERON, 0)&TRIGGER_LOGINERROR)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_OTHERLOC, (DBGetTriggerSettingWord(triggerID, NULL, MODULENAME, SETTING_TRIGGERON, 0)&TRIGGER_OTHERLOC)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CONNRETRY, (DBGetTriggerSettingWord(triggerID, NULL, MODULENAME, SETTING_TRIGGERON, 0)&TRIGGER_CONNRETRY)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CONNSUCCESS, (DBGetTriggerSettingWord(triggerID, NULL, MODULENAME, SETTING_TRIGGERON, 0)&TRIGGER_CONNSUCCESS)?BST_CHECKED:BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CONNGIVEUP, (DBGetTriggerSettingWord(triggerID, NULL, MODULENAME, SETTING_TRIGGERON, 0)&TRIGGER_CONNGIVEUP)?BST_CHECKED:BST_UNCHECKED);
- break;
- }
-
- case WM_COMMAND:
- break;
-
- case TM_ADDTRIGGER:
- {
- // wParam = (WPARAM)(DWORD)triggerID
- DWORD triggerID;
- int flags;
-
- triggerID = (DWORD)wParam;
- flags = 0;
- flags |= IsDlgButtonChecked(hwndDlg, IDC_CONNLOST)?TRIGGER_CONNLOST:0;
- flags |= IsDlgButtonChecked(hwndDlg, IDC_LOGINERROR)?TRIGGER_LOGINERROR:0;
- flags |= IsDlgButtonChecked(hwndDlg, IDC_OTHERLOC)?TRIGGER_OTHERLOC:0;
- flags |= IsDlgButtonChecked(hwndDlg, IDC_CONNRETRY)?TRIGGER_CONNRETRY:0;
- flags |= IsDlgButtonChecked(hwndDlg, IDC_CONNSUCCESS)?TRIGGER_CONNSUCCESS:0;
- flags |= IsDlgButtonChecked(hwndDlg, IDC_CONNGIVEUP)?TRIGGER_CONNGIVEUP:0;
- DBWriteTriggerSettingWord(triggerID, NULL, MODULENAME, SETTING_TRIGGERON, (WORD)flags);
- break;
- }
-
- case TM_DELTRIGGER:
- {
- /* wParam = (WPARAM)(DWORD)triggerID */
- // wParam = triggerID
- DWORD triggerID;
- REMOVETRIGGERSETTINGS rts;
-
- triggerID = (DWORD)wParam;
- rts.cbSize = sizeof(REMOVETRIGGERSETTINGS);
- rts.prefix = PREFIX_TRIGGERID;
- rts.id = triggerID;
- rts.hContact = NULL;
- rts.szModule = MODULENAME;
- CallService(MS_TRIGGER_REMOVESETTINGS, 0, (LPARAM)&rts);
- break;
- }
-
- case WM_DESTROY:
- break;
- }
-
- return FALSE;
-}
-
-static int KeepStatusEvent(WPARAM wParam, LPARAM lParam) {
-
- DWORD triggerID;
- TRIGGERDATA td;
- int flags;
-
- triggerID = 0;
- do {
- triggerID = (DWORD)CallService(MS_TRIGGER_FINDNEXTTRIGGERID, triggerID, (LPARAM)TRIGGERNAME);
- if (triggerID == 0)
- continue;
-
- ZeroMemory(&td, sizeof(TRIGGERDATA));
- td.cbSize = sizeof(TRIGGERDATA);
- flags = DBGetTriggerSettingWord(triggerID, NULL, MODULENAME, SETTING_TRIGGERON, 0);
- switch (wParam) {
- case KS_CONN_STATE_LOST:
- if (!(flags&TRIGGER_CONNLOST))
- continue;
-
- td.dFlags |= DF_PROTO;
- td.szProto = (char *)lParam;
- break;
- case KS_CONN_STATE_LOGINERROR:
- if (!(flags&TRIGGER_LOGINERROR))
- continue;
-
- td.dFlags |= DF_PROTO;
- td.szProto = (char *)lParam;
- break;
- case KS_CONN_STATE_OTHERLOCATION:
- if (!(flags&TRIGGER_OTHERLOC))
- continue;
-
- td.dFlags |= DF_PROTO;
- td.szProto = (char *)lParam;
- break;
- case KS_CONN_STATE_RETRY:
- if (!(flags&TRIGGER_CONNRETRY))
- continue;
-
- break;
- case KS_CONN_STATE_STOPPEDCHECKING:
- if ( (lParam) && (!(flags&TRIGGER_CONNSUCCESS)))
- continue;
-
- if ( (!lParam) && (!(flags&TRIGGER_CONNGIVEUP)))
- continue;
-
- break;
-
- default:
- continue;
- }
-
- REPORTINFO ri = { 0 };
- ri.cbSize = sizeof(REPORTINFO);
- ri.flags = TRG_PERFORM;
- ri.triggerID = triggerID;
- ri.td = &td;
- CallService(MS_TRIGGER_REPORTEVENT, 0, (LPARAM)&ri);
- }
- while (triggerID != 0);
-
- return 0;
-}
-
-int RegisterTrigger()
-{
- if (!ServiceExists(MS_TRIGGER_REGISTERTRIGGER))
- return -1;
-
- hKeepStatusHook = HookEvent(ME_KS_CONNECTIONEVENT, KeepStatusEvent);
-
- TRIGGERREGISTER tr = { 0 };
- tr.cbSize = sizeof(TRIGGERREGISTER);
- tr.pszName = TRIGGERNAME;
- tr.hInstance = hInst;
- tr.pfnDlgProc = DlgProcOptsTriggerKeepStatus;
- tr.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_KS_TRIGGER);
- tr.dFlags = DF_PROTO;
- /* register the trigger at the TriggerPlugin */
- CallService(MS_TRIGGER_REGISTERTRIGGER, 0, (LPARAM)&tr);
-
- return 0;
-}
-
-int DeInitTrigger()
-{
- UnhookEvent(hKeepStatusHook);
- return 0;
-}
diff --git a/plugins/Variables/Variables_10.vcxproj b/plugins/Variables/Variables_10.vcxproj index 5685ac94c7..cd091894ee 100644 --- a/plugins/Variables/Variables_10.vcxproj +++ b/plugins/Variables/Variables_10.vcxproj @@ -204,9 +204,6 @@ <ClCompile Include="src\parse_system.cpp" />
<ClCompile Include="src\parse_variables.cpp" />
<ClCompile Include="src\parse_xml.cpp" />
- <ClCompile Include="src\action_variables.cpp" />
- <ClCompile Include="src\condition_variables.cpp" />
- <ClCompile Include="src\trigger_variables.cpp" />
<ClCompile Include="..\helpers\gen_helpers.cpp">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
@@ -229,7 +226,6 @@ <ClInclude Include="src\parse_system.h" />
<ClInclude Include="src\parse_variables.h" />
<ClInclude Include="src\parse_xml.h" />
- <ClInclude Include="src\trigger_variables.h" />
<ClInclude Include="src\Version.h" />
</ItemGroup>
<ItemGroup>
diff --git a/plugins/Variables/Variables_10.vcxproj.filters b/plugins/Variables/Variables_10.vcxproj.filters index b18679273d..b9318ce7e8 100644 --- a/plugins/Variables/Variables_10.vcxproj.filters +++ b/plugins/Variables/Variables_10.vcxproj.filters @@ -19,12 +19,6 @@ <Filter Include="Source Files\Parse">
<UniqueIdentifier>{c92d28b1-a1b2-48e8-bc84-c58d24e60e7b}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\TriggerPlugin">
- <UniqueIdentifier>{ddad588f-184c-4019-8f67-290a68fdf002}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source Files\TriggerPlugin">
- <UniqueIdentifier>{68dc4171-ed30-45bd-aaef-98c9b9bfc2f6}</UniqueIdentifier>
- </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\contact.cpp">
@@ -87,15 +81,6 @@ <ClCompile Include="src\parse_xml.cpp">
<Filter>Source Files\Parse</Filter>
</ClCompile>
- <ClCompile Include="src\action_variables.cpp">
- <Filter>Source Files\TriggerPlugin</Filter>
- </ClCompile>
- <ClCompile Include="src\condition_variables.cpp">
- <Filter>Source Files\TriggerPlugin</Filter>
- </ClCompile>
- <ClCompile Include="src\trigger_variables.cpp">
- <Filter>Source Files\TriggerPlugin</Filter>
- </ClCompile>
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -146,9 +131,6 @@ <ClInclude Include="src\parse_xml.h">
<Filter>Header Files\Parse</Filter>
</ClInclude>
- <ClInclude Include="src\trigger_variables.h">
- <Filter>Header Files\TriggerPlugin</Filter>
- </ClInclude>
<ClInclude Include="src\Version.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/Variables/Variables_11.vcxproj b/plugins/Variables/Variables_11.vcxproj index 2a3a863072..65e373c6a7 100644 --- a/plugins/Variables/Variables_11.vcxproj +++ b/plugins/Variables/Variables_11.vcxproj @@ -209,9 +209,6 @@ <ClCompile Include="src\parse_system.cpp" />
<ClCompile Include="src\parse_variables.cpp" />
<ClCompile Include="src\parse_xml.cpp" />
- <ClCompile Include="src\action_variables.cpp" />
- <ClCompile Include="src\condition_variables.cpp" />
- <ClCompile Include="src\trigger_variables.cpp" />
<ClCompile Include="..\helpers\gen_helpers.cpp">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
@@ -234,7 +231,6 @@ <ClInclude Include="src\parse_system.h" />
<ClInclude Include="src\parse_variables.h" />
<ClInclude Include="src\parse_xml.h" />
- <ClInclude Include="src\trigger_variables.h" />
<ClInclude Include="src\Version.h" />
</ItemGroup>
<ItemGroup>
diff --git a/plugins/Variables/Variables_11.vcxproj.filters b/plugins/Variables/Variables_11.vcxproj.filters index b18679273d..b9318ce7e8 100644 --- a/plugins/Variables/Variables_11.vcxproj.filters +++ b/plugins/Variables/Variables_11.vcxproj.filters @@ -19,12 +19,6 @@ <Filter Include="Source Files\Parse">
<UniqueIdentifier>{c92d28b1-a1b2-48e8-bc84-c58d24e60e7b}</UniqueIdentifier>
</Filter>
- <Filter Include="Header Files\TriggerPlugin">
- <UniqueIdentifier>{ddad588f-184c-4019-8f67-290a68fdf002}</UniqueIdentifier>
- </Filter>
- <Filter Include="Source Files\TriggerPlugin">
- <UniqueIdentifier>{68dc4171-ed30-45bd-aaef-98c9b9bfc2f6}</UniqueIdentifier>
- </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\contact.cpp">
@@ -87,15 +81,6 @@ <ClCompile Include="src\parse_xml.cpp">
<Filter>Source Files\Parse</Filter>
</ClCompile>
- <ClCompile Include="src\action_variables.cpp">
- <Filter>Source Files\TriggerPlugin</Filter>
- </ClCompile>
- <ClCompile Include="src\condition_variables.cpp">
- <Filter>Source Files\TriggerPlugin</Filter>
- </ClCompile>
- <ClCompile Include="src\trigger_variables.cpp">
- <Filter>Source Files\TriggerPlugin</Filter>
- </ClCompile>
<ClCompile Include="src\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -146,9 +131,6 @@ <ClInclude Include="src\parse_xml.h">
<Filter>Header Files\Parse</Filter>
</ClInclude>
- <ClInclude Include="src\trigger_variables.h">
- <Filter>Header Files\TriggerPlugin</Filter>
- </ClInclude>
<ClInclude Include="src\Version.h">
<Filter>Header Files</Filter>
</ClInclude>
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<tvcCount;i++) {
- if (tvc[i].triggerID == triggerID) {
- mir_free(tvc[i].parsedText);
- MoveMemory(&tvc[i], &tvc[tvcCount-1], sizeof(TRG_VAR_CACHE));
- tvcCount -= 1;
- }
- }
-
- return 0;
-}
-
-static VOID CALLBACK checkStringsTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime)
-{
- DWORD triggerID = 0;
- do {
- triggerID = (DWORD)CallService(MS_TRIGGER_FINDNEXTTRIGGERID, triggerID, (LPARAM)TRIGGERNAME);
- if (triggerID == 0) {
- continue;
- }
- for (int i=0; i < tvcCount; i++) {
- if (triggerID != tvc[i].triggerID)
- continue;
-
- DBVARIANT dbv;
- if (!DBGetTriggerSettingTString(tvc[i].triggerID, NULL, MODULENAME, SETTING_TRIGGERTEXT, &dbv)) {
- TCHAR *parsedText = variables_parsedup(dbv.ptszVal, NULL, NULL);
- if (parsedText == NULL)
- continue;
-
- if (!_tcscmp(tvc[i].parsedText, parsedText)) {
- mir_free(parsedText);
- continue;
- }
-
- TRIGGERDATA td = { 0 };
- td.cbSize = sizeof(td);
- td.dFlags = DF_TEXT;
- td.tszText = parsedText;
-
- REPORTINFO ri = { 0 };
- ri.cbSize = sizeof(REPORTINFO);
- ri.triggerID = tvc[i].triggerID;
- ri.pszName = TRIGGERNAME;
- ri.flags = TRG_PERFORM;
- ri.td = &td;
-
- CallService(MS_TRIGGER_REPORTEVENT, 0, (LPARAM)&ri);
- mir_free(tvc[i].parsedText);
- tvc[i].parsedText = parsedText;
- db_free(&dbv);
- }
- }
- }
- while (triggerID != 0);
-}
-
-INT_PTR CALLBACK DlgProcOptsStringChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- DBVARIANT dbv;
- DWORD triggerID;
-
- triggerID = (DWORD)lParam;
- if (!DBGetTriggerSetting(triggerID, NULL, MODULENAME, SETTING_TRIGGERTEXT, &dbv)) {
- SetDlgItemTextA(hwndDlg, IDC_FORMATTEXT, dbv.pszVal);
- db_free(&dbv);
- }
- variables_skin_helpbutton(hwndDlg, IDC_SHOWHELP);
- }
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDC_SHOWHELP:
- variables_showhelp(hwndDlg, IDC_FORMATTEXT, VHF_FULLDLG|VHF_SETLASTSUBJECT, NULL, NULL);
- break;
- }
- break;
-
- case TM_ADDTRIGGER:
- // wParam = trigger ID
- // lParam = (TRIGGERREGISTER *)
- {
- DWORD triggerID = (DWORD)wParam;
- TCHAR *tszFormatText = Hlp_GetDlgItemText(hwndDlg, IDC_FORMATTEXT);
- if (tszFormatText != NULL) {
- DBWriteTriggerSettingTString(triggerID, NULL, MODULENAME, SETTING_TRIGGERTEXT, tszFormatText);
- mir_free(tszFormatText);
- }
- addToCache(triggerID);
- }
- break;
-
- case TM_DELTRIGGER:
- // wParam = triggerID
- // lParam = (TRIGGEREGISTER *) may be 0
- {
- REMOVETRIGGERSETTINGS rts;
-
- DWORD triggerID = (DWORD)wParam;
- removeFromCache(triggerID);
- rts.cbSize = sizeof(REMOVETRIGGERSETTINGS);
- rts.prefix = PREFIX_TRIGGERID;
- rts.id = triggerID;
- rts.hContact = NULL;
- rts.szModule = MODULENAME;
- CallService(MS_TRIGGER_REMOVESETTINGS, 0, (LPARAM)&rts);
- }
- break;
- }
-
- return FALSE;
-}
-
-int initTriggerModule()
-{
- log_debugA("Variables: initTriggerModule");
- if (!ServiceExists(MS_TRIGGER_REGISTERTRIGGER)) {
- log_debugA("Variables: %s does not exist", MS_TRIGGER_REGISTERTRIGGER);
- return -1;
- }
-
- TRIGGERREGISTER tr = { 0 };
- tr.cbSize = sizeof(tr);
- tr.pszName = TRIGGERNAME;
- tr.hInstance = hInst;
- tr.pfnDlgProc = DlgProcOptsStringChange;
- tr.pszTemplate = MAKEINTRESOURCEA(IDD_TRG_STRINGCHANGE);
- tr.dFlags = DF_TEXT|DF_TCHAR;
- int res = CallService(MS_TRIGGER_REGISTERTRIGGER, 0, (LPARAM)&tr);
- log_debugA("Variables: %s registered (%d)", TRIGGERNAME, res);
-
- ACTIONREGISTER ar = { 0 };
- ar.cbSize = sizeof(ACTIONREGISTER);
- ar.pszName = "Variables: Parse string";
- ar.hInstance = hInst;
- ar.pfnDlgProc = DlgProcOptsParseString;
- ar.pszTemplate = MAKEINTRESOURCEA(IDD_ACT_PARSESTRING);
- ar.actionFunction = ParseStringAction;
- ar.flags = ARF_FUNCTION|ARF_TCHAR;
- CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar);
-
- CONDITIONREGISTER cr = { 0 };
- cr.cbSize = sizeof(CONDITIONREGISTER);
- cr.pszName = "Variables: Condition";
- cr.hInstance = hInst;
- cr.pfnDlgProc = DlgProcOptsCondition;
- cr.pszTemplate = MAKEINTRESOURCEA(IDD_CND_PARSESTRING);
- cr.conditionFunction = ParseStringCondition;
- cr.flags = CRF_FUNCTION|CRF_TCHAR;
- CallService(MS_TRIGGER_REGISTERCONDITION, 0, (LPARAM)&cr);
-
- // fill cache
- DWORD triggerID = 0;
- do {
- triggerID = (DWORD)CallService(MS_TRIGGER_FINDNEXTTRIGGERID, triggerID, (LPARAM)TRIGGERNAME);
- if (triggerID == 0) {
- continue;
- }
- addToCache(triggerID);
- }
- while (triggerID != 0);
-
- stringChangeTimerID = SetTimer(NULL, 0, CHECKSTRINGDELAY, checkStringsTimer);
- return res;
-}
diff --git a/plugins/Variables/src/trigger_variables.h b/plugins/Variables/src/trigger_variables.h deleted file mode 100644 index 6ebea2fbe3..0000000000 --- a/plugins/Variables/src/trigger_variables.h +++ /dev/null @@ -1,37 +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
-*/
-
-#define TRIGGERNAME "Variables: String changed"
-#define SETTING_TRIGGERTEXT "trigger_TriggerText"
-#define CHECKSTRINGDELAY 5000
-
-typedef struct {
- DWORD triggerID;
- TCHAR *parsedText;
-} TRG_VAR_CACHE;
-
-
-#define SETTING_PARSESTRING "action_ParseString"
-#define SETTING_PARSEASYNC "action_ParseAsync"
-
-int ParseStringAction(DWORD actionID, REPORTINFO *ri);
-INT_PTR CALLBACK DlgProcOptsParseString(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-
-int ParseStringCondition(DWORD actionID, REPORTINFO *ri);
-INT_PTR CALLBACK DlgProcOptsCondition(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
\ No newline at end of file diff --git a/plugins/Variables/src/variables.h b/plugins/Variables/src/variables.h index 533bc8ae98..bd92fa74cb 100644 --- a/plugins/Variables/src/variables.h +++ b/plugins/Variables/src/variables.h @@ -42,7 +42,6 @@ #include <m_clc.h>
#include <m_variables.h>
-#include <m_trigger.h>
#include <m_metacontacts.h>
#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);
|