summaryrefslogtreecommitdiff
path: root/protocols/IRCG
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-12 15:27:34 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-12 15:27:34 +0300
commita0b619e6a73483ef68c085a1b610aa86c8628e8f (patch)
treed206457ad8af9a4d927b4f746cc7bfe8f165d2e0 /protocols/IRCG
parent76f9fa91806fe6a47db2dd95930e4985da5b1e3f (diff)
fixes #4042 (IRC: Miranda rejoins channel if you left channel using part command)
Diffstat (limited to 'protocols/IRCG')
-rw-r--r--protocols/IRCG/src/input.cpp16
-rw-r--r--protocols/IRCG/src/services.cpp34
2 files changed, 26 insertions, 24 deletions
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index af495bfb9e..3fe1e86800 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -100,8 +100,8 @@ CMStringW CIrcProto::DoAlias(const wchar_t *text, wchar_t *window)
line = new wchar_t[S.GetLength() + 2];
mir_wstrncpy(line, S, S.GetLength() + 1);
CMStringW alias(m_alias);
- const wchar_t* p3 = wcsstr(alias, (GetWord(line, 0) + L" "));
- if (p3 != alias) {
+ const wchar_t* p3 = wcsstr(alias, GetWord(line, 0) + L" ");
+ if (p3 != alias.c_str()) {
CMStringW str = L"\r\n";
str += GetWord(line, 0) + L" ";
p3 = wcsstr(alias, str);
@@ -842,8 +842,9 @@ bool CIrcProto::PostIrcMessageWnd(wchar_t *window, MCONTACT hContact, const wcha
if (Message.Find(L"\r\n", 0) == 0)
Message.Delete(0, 2);
- //do this if it's a /raw
- if (IsConnected() && (GetWord(DoThis, 0) == L"/raw" || GetWord(DoThis, 0) == L"/quote")) {
+ // do this if it's a /raw
+ auto W0 = GetWord(DoThis, 0);
+ if (IsConnected() && (W0 == L"/raw" || W0 == L"/quote")) {
if (GetWord(DoThis, 1).IsEmpty())
continue;
@@ -852,9 +853,12 @@ 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 ((GetWord(DoThis, 0)[0] != '/') || // not a command
- ((GetWord(DoThis, 0)[0] == '/') && (GetWord(DoThis, 0)[1] == '/')) || // or double backslash at the beginning
+ if ((W0[0] != '/') || // not a command
+ (W0[0] == '/' && W0[1] == '/') || // or double backslash at the beginning
hContact) {
CMStringW S = L"/PRIVMSG ";
if (mir_wstrcmpi(window, SERVERWINDOW) == 0 && !m_info.sServerName.IsEmpty())
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index edcefa6a76..c0d7a2a2e7 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -197,31 +197,30 @@ bool CIrcProto::OnContactDeleted(MCONTACT hContact)
return true;
}
-INT_PTR __cdecl CIrcProto::OnJoinChat(WPARAM wp, LPARAM)
+INT_PTR __cdecl CIrcProto::OnJoinChat(WPARAM hContact, LPARAM)
{
- if (!wp)
+ if (!hContact)
return 0;
DBVARIANT dbv;
- if (!getWString((MCONTACT)wp, "Nick", &dbv)) {
- if (getByte((MCONTACT)wp, "ChatRoom", 0) == GCW_CHATROOM)
+ if (!getWString(hContact, "Nick", &dbv)) {
+ if (getByte(hContact, "ChatRoom", 0) == GCW_CHATROOM)
PostIrcMessage(L"/JOIN %s", dbv.pwszVal);
db_free(&dbv);
}
return 0;
}
-INT_PTR __cdecl CIrcProto::OnLeaveChat(WPARAM wp, LPARAM)
+INT_PTR __cdecl CIrcProto::OnLeaveChat(WPARAM hContact, LPARAM)
{
- if (!wp)
+ if (!hContact)
return 0;
DBVARIANT dbv;
- if (!getWString((MCONTACT)wp, "Nick", &dbv)) {
- if (getByte((MCONTACT)wp, "ChatRoom", 0) == GCW_CHATROOM) {
+ if (!getWString(hContact, "Nick", &dbv)) {
+ if (getByte(hContact, "ChatRoom", 0) == GCW_CHATROOM)
PostIrcMessage(L"/PART %s %s", dbv.pwszVal, m_userInfo);
- Chat_Terminate(Chat_Find(dbv.pwszVal, m_szModuleName));
- }
+
db_free(&dbv);
}
return 0;
@@ -241,34 +240,33 @@ INT_PTR __cdecl CIrcProto::OnMenuChanSettings(WPARAM wp, LPARAM)
return 0;
}
-INT_PTR __cdecl CIrcProto::OnMenuWhois(WPARAM wp, LPARAM)
+INT_PTR __cdecl CIrcProto::OnMenuWhois(WPARAM hContact, LPARAM)
{
- if (!wp)
+ if (!hContact)
return 0;
DBVARIANT dbv;
- if (!getWString((MCONTACT)wp, "Nick", &dbv)) {
+ if (!getWString(hContact, "Nick", &dbv)) {
PostIrcMessage(L"/WHOIS %s %s", dbv.pwszVal, dbv.pwszVal);
db_free(&dbv);
}
return 0;
}
-INT_PTR __cdecl CIrcProto::OnMenuDisconnect(WPARAM wp, LPARAM)
+INT_PTR __cdecl CIrcProto::OnMenuDisconnect(WPARAM hContact, LPARAM)
{
- CDccSession *dcc = FindDCCSession((MCONTACT)wp);
+ CDccSession *dcc = FindDCCSession(hContact);
if (dcc)
dcc->Disconnect();
return 0;
}
-INT_PTR __cdecl CIrcProto::OnMenuIgnore(WPARAM wp, LPARAM)
+INT_PTR __cdecl CIrcProto::OnMenuIgnore(WPARAM hContact, LPARAM)
{
- if (!wp)
+ if (!hContact)
return 0;
- MCONTACT hContact = (MCONTACT)wp;
DBVARIANT dbv;
if (!getWString(hContact, "Nick", &dbv)) {
if (!isChatRoom(hContact)) {