diff options
author | George Hazan <ghazan@miranda.im> | 2019-09-16 20:23:11 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-09-16 20:23:11 +0300 |
commit | f49237c1631ad9737171016f578b5da8a38d9d4d (patch) | |
tree | 4a5e95746d307cf5a06971ae5be9db38a8d2dd9f /protocols/IRCG | |
parent | a5fb57b36f3e5e6b063f687a0b28bcb8077e0f54 (diff) |
fixes #2067 (IRC: Perform to be executed in the separate thread)
Diffstat (limited to 'protocols/IRCG')
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 26 | ||||
-rw-r--r-- | protocols/IRCG/src/ircproto.h | 1 |
2 files changed, 18 insertions, 9 deletions
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index fdc621b4db..36ae19a469 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -2380,6 +2380,13 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*) return 0;
}
+void __cdecl CIrcProto::DoPerformThread(void *param)
+{
+ wchar_t *pwszPerform = (wchar_t *)param;
+ PostIrcMessageWnd(nullptr, NULL, pwszPerform);
+ mir_free(pwszPerform);
+}
+
static void __cdecl AwayWarningThread(LPVOID)
{
Thread_SetName("IRC: AwayWarningThread");
@@ -2391,16 +2398,17 @@ int CIrcProto::DoPerform(const char* event) CMStringA sSetting = CMStringA("PERFORM:") + event;
sSetting.MakeUpper();
- DBVARIANT dbv;
- if (!getWString(sSetting, &dbv)) {
- if (!my_strstri(dbv.pwszVal, L"/away"))
- PostIrcMessageWnd(nullptr, NULL, dbv.pwszVal);
- else
- mir_forkthread(AwayWarningThread);
- db_free(&dbv);
- return 1;
+ wchar_t *pwszPerform = getWStringA(sSetting);
+ if (pwszPerform == nullptr)
+ return 0;
+
+ if (my_strstri(pwszPerform, L"/away")) {
+ mir_free(pwszPerform);
+ mir_forkthread(AwayWarningThread);
}
- return 0;
+ else ForkThread(&CIrcProto::DoPerformThread, pwszPerform);
+
+ return 1;
}
int CIrcProto::IsIgnored(const CMStringW& nick, const CMStringW& address, const CMStringW& host, char type)
diff --git a/protocols/IRCG/src/ircproto.h b/protocols/IRCG/src/ircproto.h index 6f28678664..11f43c23b3 100644 --- a/protocols/IRCG/src/ircproto.h +++ b/protocols/IRCG/src/ircproto.h @@ -210,6 +210,7 @@ struct CIrcProto : public PROTO<CIrcProto> int AddOutgoingMessageToDB(MCONTACT hContact, const wchar_t *msg); bool DoOnConnect(const CIrcMessage *pmsg); int DoPerform(const char *event); + void __cdecl DoPerformThread(void *di); void __cdecl ResolveIPThread(void *di); bool AddIgnore(const wchar_t *mask, const wchar_t *mode, const wchar_t *network); |