diff options
author | George Hazan <george.hazan@gmail.com> | 2013-04-07 20:25:38 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-04-07 20:25:38 +0000 |
commit | 920aa970afa086a3a143b39005747210b94f237b (patch) | |
tree | 10e5bdc77f6a533772e4509e4a56ba3f7dc46722 /plugins/StatusPlugins | |
parent | 097c52ad9a2928422084bf76cebee58958341574 (diff) |
Trigger plugin's support removed, cause this plugin is dead
git-svn-id: http://svn.miranda-ng.org/main/trunk@4374 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins')
14 files changed, 0 insertions, 596 deletions
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;
-}
|