diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-04 10:07:08 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-04 10:07:08 +0000 |
commit | e0479eb78e0016c46bac506efe0a75c3def28a88 (patch) | |
tree | a448fea8ab81d35894f1826c961c7a8e20a27de8 /plugins/StatusPlugins | |
parent | e88689f3d0032dddfb2c4ac8f65ba2a22a7de571 (diff) |
fix for the last status saving in StartupStatus
git-svn-id: http://svn.miranda-ng.org/main/trunk@5575 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins')
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/startupstatus.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp index c5c167f0c4..1483286278 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp @@ -279,34 +279,33 @@ static VOID CALLBACK SetStatusTimed(HWND hwnd,UINT message, UINT_PTR idEvent,DWO CallService(MS_CS_SETSTATUSEX, (WPARAM)&startupSettings, 0);
}
-static int OnShutdown(WPARAM wParam, LPARAM lParam)
+static int OnOkToExit(WPARAM, LPARAM)
{
- DeinitProfilesModule();
-
// save last protocolstatus
int count;
PROTOACCOUNT** protos;
ProtoEnumAccounts( &count, &protos );
for ( int i=0; i < count; i++ ) {
- if ( !IsSuitableProto( protos[i] ))
+ PROTOACCOUNT *pa = protos[i];
+ if ( !IsSuitableProto(pa))
continue;
char lastName[128], lastMsg[128];
- mir_snprintf(lastName, sizeof(lastName), "%s%s", PREFIX_LAST, protos[i]->szModuleName);
- if (CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)protos[i]->szModuleName)) {
- db_set_w(NULL, MODULENAME, lastName, (WORD)CallProtoService(protos[i]->szModuleName, PS_GETSTATUS, 0, 0));
- mir_snprintf(lastMsg, sizeof(lastMsg), "%s%s", PREFIX_LASTMSG, protos[i]->szModuleName);
+ mir_snprintf(lastName, sizeof(lastName), "%s%s", PREFIX_LAST, pa->szModuleName);
+ if (CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)pa->szModuleName)) {
+ db_set_w(NULL, MODULENAME, lastName, (WORD)CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0));
+ mir_snprintf(lastMsg, sizeof(lastMsg), "%s%s", PREFIX_LASTMSG, pa->szModuleName);
db_unset(NULL, MODULENAME, lastMsg);
- int status = CallProtoService(protos[i]->szModuleName, PS_GETSTATUS, 0, 0);
- if ( !CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)protos[i]->szModuleName))
+ int status = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
+ if ( !CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)pa->szModuleName))
continue;
- if ( !(CallProtoService(protos[i]->szModuleName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0) & PF1_MODEMSGSEND & ~PF1_INDIVMODEMSG ))
+ if ( !(CallProtoService(pa->szModuleName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0) & PF1_MODEMSGSEND & ~PF1_INDIVMODEMSG ))
continue;
- if ( !(CallProtoService(protos[i]->szModuleName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(status)))
+ if ( !(CallProtoService(pa->szModuleName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(status)))
continue;
} }
@@ -317,6 +316,13 @@ static int OnShutdown(WPARAM wParam, LPARAM lParam) log_debugA("StartupStatus: MS_CLIST_SETSTATUSMODE not available!");
}
+ return 0;
+}
+
+static int OnShutdown(WPARAM wParam, LPARAM lParam)
+{
+ DeinitProfilesModule();
+
// set windowstate and docked for next startup
if (db_get_b(NULL, MODULENAME, SETTING_SETWINSTATE, 0)) {
int state = db_get_b(NULL, MODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
@@ -384,6 +390,7 @@ int CSModuleLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_OPT_INITIALISE, OptionsInit);
/* shutdown hook for normal shutdown */
+ HookEvent(ME_SYSTEM_OKTOEXIT, OnOkToExit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);
/* message window for poweroff */
hMessageWindow = CreateWindowEx(0, _T("STATIC"), NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
|