summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/CmdLine/src/mimcmd_handlers.cpp15
-rw-r--r--plugins/CmdLine/src/services.cpp7
2 files changed, 6 insertions, 16 deletions
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp
index 0d1fa34368..97266a83b4 100644
--- a/plugins/CmdLine/src/mimcmd_handlers.cpp
+++ b/plugins/CmdLine/src/mimcmd_handlers.cpp
@@ -1423,15 +1423,13 @@ int ContactMatchSearch(MCONTACT hContact, char *contact, char *id, char *account
return matches;
}
-DWORD WINAPI OpenMessageWindowThread(void *data)
+void __cdecl OpenMessageWindowThread(void *data)
{
MCONTACT hContact = (MCONTACT) data;
if (hContact)
{
CallServiceSync(MS_MSG_SENDMESSAGET, hContact, 0);
}
-
- return 0;
}
@@ -1493,10 +1491,7 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r
char *contact = GetContactName(hContact, protocol);
char *id = GetContactID(hContact, protocol);
if (ContactMatchSearch(hContact, contact, id, protocol, &argv[3], argc - 3))
- {
- DWORD threadID;
- HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, (void*)hContact, NULL, &threadID);
- }
+ HANDLE thread = mir_forkthread(OpenMessageWindowThread, (void*)hContact);
free(contact);
free(id);
@@ -1508,10 +1503,8 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
MEVENT hUnreadEvent = db_event_firstUnread(hContact);
- if (hUnreadEvent != NULL) {
- DWORD threadID;
- HANDLE thread = CreateThread(NULL, NULL, OpenMessageWindowThread, (void*)hContact, NULL, &threadID);
- }
+ if (hUnreadEvent != NULL)
+ HANDLE thread = mir_forkthread(OpenMessageWindowThread, (void*)hContact);
}
}
else HandleWrongParametersCount(command, reply);
diff --git a/plugins/CmdLine/src/services.cpp b/plugins/CmdLine/src/services.cpp
index 9e006a0046..6a82974be5 100644
--- a/plugins/CmdLine/src/services.cpp
+++ b/plugins/CmdLine/src/services.cpp
@@ -37,7 +37,7 @@ extern "C" __declspec(dllexport) void ProcessConsoleCommand(PCommand command, TA
HandleCommand(command, arguments, count, reply);
}
-DWORD WINAPI ServerWorkerThread(void *data)
+void __cdecl ServerWorkerThread(void *data)
{
int done = FALSE;
const HANDLE events[] = {heServerExec, heServerClose};
@@ -63,8 +63,6 @@ DWORD WINAPI ServerWorkerThread(void *data)
}
}
}
-
- return 0;
}
int StartServer()
@@ -74,8 +72,7 @@ int StartServer()
{
if (sdCmdLine->instances == 0)
{
- DWORD threadID;
- HANDLE server = CreateThread(NULL, NULL, ServerWorkerThread, NULL, 0, &threadID);
+ HANDLE server = mir_forkthread(ServerWorkerThread, 0);
if (server)
{
char path[MIMFOLDER_SIZE];