diff options
author | George Hazan <george.hazan@gmail.com> | 2023-12-18 16:59:37 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-12-18 16:59:37 +0300 |
commit | 62ef4ddccfd98ae1a572af51fee6417e5f445035 (patch) | |
tree | 23b8c01a39ec0d932278beb01c6433997f80f04f /protocols/IRCG/src | |
parent | 02e206c830a95cc898741f9394702f4b58c78dca (diff) |
fixes #4060 (Crash: Miranda crashes after /part command)
Diffstat (limited to 'protocols/IRCG/src')
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 4 | ||||
-rw-r--r-- | protocols/IRCG/src/input.cpp | 3 | ||||
-rw-r--r-- | protocols/IRCG/src/services.cpp | 28 |
3 files changed, 15 insertions, 20 deletions
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 3055624192..daccc47cb9 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -387,8 +387,10 @@ bool CIrcProto::OnIrc_PART(const CIrcMessage *pmsg) if (pmsg->parameters.getCount() > 0 && pmsg->m_bIncoming) {
CMStringW host = pmsg->prefix.sUser + L"@" + pmsg->prefix.sHost;
DoEvent(GC_EVENT_PART, pmsg->parameters[0], pmsg->prefix.sNick, pmsg->parameters.getCount() > 1 ? pmsg->parameters[1].c_str() : nullptr, nullptr, host, NULL, true, false);
- if (pmsg->prefix.sNick == m_info.sNick)
+ if (pmsg->prefix.sNick == m_info.sNick) {
Chat_Control(pmsg->parameters[0], SESSION_OFFLINE);
+ Chat_Terminate(Chat_Find(pmsg->parameters[0], m_szModuleName));
+ }
}
else ShowMessage(pmsg);
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index 386f1c1270..4245d8764f 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -844,9 +844,6 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha continue;
}
- if (!W0.CompareNoCase(L"/PART"))
- Chat_Terminate(Chat_Find(GetWord(DoThis, 1), m_szModuleName));
-
// Do this if the message is not a command
if ((W0[0] != '/') || // not a command
(W0[0] == '/' && W0[1] == '/') || // or double backslash at the beginning
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index c0d7a2a2e7..9d2d5a8cb2 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -170,20 +170,18 @@ bool CIrcProto::OnContactDeleted(MCONTACT hContact) if (!hContact)
return false;
- DBVARIANT dbv;
- if (!getWString(hContact, "Nick", &dbv)) {
- int type = getByte(hContact, "ChatRoom", 0);
- if (type != 0) {
- CMStringW S;
- if (type == GCW_CHATROOM)
- S = dbv.pwszVal;
- if (type == GCW_SERVER)
- S = SERVERWINDOW;
- int i = Chat_Terminate(Chat_Find(S, m_szModuleName));
- if (i && type == GCW_CHATROOM)
- PostIrcMessage(L"/PART %s %s", dbv.pwszVal, m_userInfo);
- }
- else {
+ ptrW wszNick(getWStringA(hContact, "Nick"));
+ if (wszNick)
+ switch (getByte(hContact, "ChatRoom")) {
+ case GCW_CHATROOM:
+ PostIrcMessage(L"/PART %s %s", wszNick.get(), m_userInfo);
+ break;
+
+ case GCW_SERVER:
+ Chat_Terminate(Chat_Find(SERVERWINDOW, m_szModuleName));
+ break;
+
+ case 0:
uint8_t bDCC = getByte(hContact, "DCC", 0);
if (bDCC) {
CDccSession *dcc = FindDCCSession(hContact);
@@ -192,8 +190,6 @@ bool CIrcProto::OnContactDeleted(MCONTACT hContact) }
}
- db_free(&dbv);
- }
return true;
}
|