diff options
Diffstat (limited to 'metacontacts/meta_services.c')
-rw-r--r-- | metacontacts/meta_services.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/metacontacts/meta_services.c b/metacontacts/meta_services.c index f713bc7..0a3b91e 100644 --- a/metacontacts/meta_services.c +++ b/metacontacts/meta_services.c @@ -66,6 +66,8 @@ HANDLE hExtraImage[MAX_PROTOCOLS * 2]; // online and offline icons char proto_names[MAX_PROTOCOLS * 128];
HANDLE hProtoIcons[MAX_PROTOCOLS * 2]; // online and offline icons
+UINT_PTR setStatusTimerId = 0;
+
/** Get the capabilities of the "MetaContacts" protocol.
*
* @param wParam : equals to one of the following values :\n
@@ -157,17 +159,18 @@ int Meta_LoadIcon(WPARAM wParam,LPARAM lParam) }
-static DWORD CALLBACK sttSetStatusThread( LPVOID param )
+//static DWORD CALLBACK SetStatusThread( LPVOID param )
+void CALLBACK SetStatusThread(HWND hWnd, UINT msg, UINT_PTR ip, DWORD dw)
{
previousMode = mcStatus;
Sleep(options.set_status_from_offline_delay);
- mcStatus = (int)param;
+ mcStatus = (int)ID_STATUS_OFFLINE;
ProtoBroadcastAck(META_PROTO,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS, (HANDLE)previousMode, mcStatus);
- return 0;
+ //return 0;
}
/** Changes the status and notifies everybody
@@ -177,8 +180,9 @@ static DWORD CALLBACK sttSetStatusThread( LPVOID param ) int Meta_SetStatus(WPARAM wParam,LPARAM lParam)
{
if(mcStatus == ID_STATUS_OFFLINE) {
- DWORD dwThreadId;
- CloseHandle( CreateThread( NULL, 0, sttSetStatusThread, (void *)wParam, 0, &dwThreadId ));
+ // causes crash on exit if miranda is closed in under options.set_status_from_offline milliseconds!
+ //CloseHandle( CreateThread( NULL, 0, SetStatusThread, (void *)wParam, 0, 0 ));
+ setStatusTimerId = SetTimer(0, 0, options.set_status_from_offline_delay, SetStatusThread);
} else {
previousMode = mcStatus;
mcStatus = (int)wParam;
@@ -1844,6 +1848,9 @@ int Meta_PreShutdown(WPARAM wParam, LPARAM lParam) { Meta_SuppressStatus(FALSE);
//MessageBox(0, "Status is OFFLINE", "MC", MB_OK);
//MessageBox(0, "Preshutdown complete", "MC", MB_OK);
+
+ if(setStatusTimerId) KillTimer(0, setStatusTimerId);
+
return 0;
}
|