summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-01-28 19:58:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-01-28 19:58:25 +0300
commit3e00af6e0b04bca9e5398f250c7dd4280da608cc (patch)
treec435ee6859581a5226a9af4bcc989cf07196d115 /protocols
parent11fbe8d4d458c856dcbf7e6d18561b467ef368d3 (diff)
IRC: fix for event broadcasting
Diffstat (limited to 'protocols')
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp4
-rw-r--r--protocols/IRCG/src/ircproto.cpp140
-rw-r--r--protocols/IRCG/src/stdafx.h2
-rw-r--r--protocols/IRCG/src/tools.cpp25
4 files changed, 87 insertions, 84 deletions
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index eb846b07af..5e0705dfe8 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -371,7 +371,7 @@ bool CIrcProto::OnIrc_QUIT(const CIrcMessage *pmsg)
CONTACT user = { pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, false, false, false };
CList_SetOffline(&user);
if (pmsg->prefix.sNick == m_info.sNick)
- setAllContactStatuses(SESSION_OFFLINE, false);
+ ::Chat_Control(m_szModuleName, SESSION_OFFLINE);
}
else ShowMessage(pmsg);
@@ -2277,7 +2277,7 @@ void CIrcProto::OnIrcDisconnected()
sDisconn += TranslateT("*Disconnected*");
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, nullptr, sDisconn, nullptr, nullptr, NULL, true, false);
- setAllContactStatuses(SESSION_OFFLINE, false);
+ ::Chat_Control(m_szModuleName, SESSION_OFFLINE);
if (!Miranda_IsTerminated())
CList_SetAllOffline(m_disconnectDCCChats);
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index 5c7d9fb3ef..205dab708d 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -76,76 +76,76 @@ CIrcProto::CIrcProto(const char* szModuleName, const wchar_t* tszUserName) :
HookProtoEvent(ME_GC_EVENT, &CIrcProto::GCEventHook);
HookProtoEvent(ME_GC_BUILDMENU, &CIrcProto::GCMenuHook);
- IRC_MAP_ENTRY("PING", PING)
- IRC_MAP_ENTRY("JOIN", JOIN)
- IRC_MAP_ENTRY("QUIT", QUIT)
- IRC_MAP_ENTRY("KICK", KICK)
- IRC_MAP_ENTRY("MODE", MODE)
- IRC_MAP_ENTRY("NICK", NICK)
- IRC_MAP_ENTRY("PART", PART)
- IRC_MAP_ENTRY("PRIVMSG", PRIVMSG)
- IRC_MAP_ENTRY("TOPIC", TOPIC)
- IRC_MAP_ENTRY("NOTICE", NOTICE)
- IRC_MAP_ENTRY("PING", PINGPONG)
- IRC_MAP_ENTRY("PONG", PINGPONG)
- IRC_MAP_ENTRY("CAP", CAP)
- IRC_MAP_ENTRY("AUTHENTICATE", AUTHENTICATE)
- IRC_MAP_ENTRY("INVITE", INVITE)
- IRC_MAP_ENTRY("ERROR", ERROR)
- IRC_MAP_ENTRY("001", WELCOME)
- IRC_MAP_ENTRY("002", YOURHOST)
- IRC_MAP_ENTRY("005", SUPPORT)
- IRC_MAP_ENTRY("223", WHOIS_OTHER) //CodePage info
- IRC_MAP_ENTRY("254", NOOFCHANNELS)
- IRC_MAP_ENTRY("263", TRYAGAIN)
- IRC_MAP_ENTRY("264", WHOIS_OTHER) //Encryption info (SSL connect)
- IRC_MAP_ENTRY("301", WHOIS_AWAY)
- IRC_MAP_ENTRY("302", USERHOST_REPLY)
- IRC_MAP_ENTRY("305", BACKFROMAWAY)
- IRC_MAP_ENTRY("306", SETAWAY)
- IRC_MAP_ENTRY("307", WHOIS_AUTH)
- IRC_MAP_ENTRY("310", WHOIS_OTHER)
- IRC_MAP_ENTRY("311", WHOIS_NAME)
- IRC_MAP_ENTRY("312", WHOIS_SERVER)
- IRC_MAP_ENTRY("313", WHOIS_OTHER)
- IRC_MAP_ENTRY("315", WHO_END)
- IRC_MAP_ENTRY("317", WHOIS_IDLE)
- IRC_MAP_ENTRY("318", WHOIS_END)
- IRC_MAP_ENTRY("319", WHOIS_CHANNELS)
- IRC_MAP_ENTRY("320", WHOIS_AUTH)
- IRC_MAP_ENTRY("321", LISTSTART)
- IRC_MAP_ENTRY("322", LIST)
- IRC_MAP_ENTRY("323", LISTEND)
- IRC_MAP_ENTRY("324", MODEQUERY)
- IRC_MAP_ENTRY("330", WHOIS_AUTH)
- IRC_MAP_ENTRY("332", INITIALTOPIC)
- IRC_MAP_ENTRY("333", INITIALTOPICNAME)
- IRC_MAP_ENTRY("352", WHO_REPLY)
- IRC_MAP_ENTRY("353", NAMES)
- IRC_MAP_ENTRY("366", ENDNAMES)
- IRC_MAP_ENTRY("367", BANLIST)
- IRC_MAP_ENTRY("368", BANLISTEND)
- IRC_MAP_ENTRY("346", BANLIST)
- IRC_MAP_ENTRY("347", BANLISTEND)
- IRC_MAP_ENTRY("348", BANLIST)
- IRC_MAP_ENTRY("349", BANLISTEND)
- IRC_MAP_ENTRY("371", WHOIS_OTHER)
- IRC_MAP_ENTRY("376", ENDMOTD)
- IRC_MAP_ENTRY("401", WHOIS_NO_USER)
- IRC_MAP_ENTRY("403", JOINERROR)
- IRC_MAP_ENTRY("416", WHOTOOLONG)
- IRC_MAP_ENTRY("421", UNKNOWN)
- IRC_MAP_ENTRY("422", ENDMOTD)
- IRC_MAP_ENTRY("433", NICK_ERR)
- IRC_MAP_ENTRY("471", JOINERROR)
- IRC_MAP_ENTRY("473", JOINERROR)
- IRC_MAP_ENTRY("474", JOINERROR)
- IRC_MAP_ENTRY("475", JOINERROR)
- IRC_MAP_ENTRY("671", WHOIS_OTHER) //Encryption info (SSL connect)
- IRC_MAP_ENTRY("903", AUTH_OK)
- IRC_MAP_ENTRY("904", AUTH_FAIL)
- IRC_MAP_ENTRY("905", AUTH_FAIL)
- IRC_MAP_ENTRY("906", AUTH_FAIL)
+ IRC_MAP_ENTRY("PING", OnIrc_PING)
+ IRC_MAP_ENTRY("JOIN", OnIrc_JOIN)
+ IRC_MAP_ENTRY("QUIT", OnIrc_QUIT)
+ IRC_MAP_ENTRY("KICK", OnIrc_KICK)
+ IRC_MAP_ENTRY("MODE", OnIrc_MODE)
+ IRC_MAP_ENTRY("NICK", OnIrc_NICK)
+ IRC_MAP_ENTRY("PART", OnIrc_PART)
+ IRC_MAP_ENTRY("PRIVMSG", OnIrc_PRIVMSG)
+ IRC_MAP_ENTRY("TOPIC", OnIrc_TOPIC)
+ IRC_MAP_ENTRY("NOTICE", OnIrc_NOTICE)
+ IRC_MAP_ENTRY("PING", OnIrc_PINGPONG)
+ IRC_MAP_ENTRY("PONG", OnIrc_PINGPONG)
+ IRC_MAP_ENTRY("CAP", OnIrc_CAP)
+ IRC_MAP_ENTRY("AUTHENTICATE", OnIrc_AUTHENTICATE)
+ IRC_MAP_ENTRY("INVITE", OnIrc_INVITE)
+ IRC_MAP_ENTRY("ERROR", OnIrc_ERROR)
+ IRC_MAP_ENTRY("001", OnIrc_WELCOME)
+ IRC_MAP_ENTRY("002", OnIrc_YOURHOST)
+ IRC_MAP_ENTRY("005", OnIrc_SUPPORT)
+ IRC_MAP_ENTRY("223", OnIrc_WHOIS_OTHER) //CodePage info
+ IRC_MAP_ENTRY("254", OnIrc_NOOFCHANNELS)
+ IRC_MAP_ENTRY("263", OnIrc_TRYAGAIN)
+ IRC_MAP_ENTRY("264", OnIrc_WHOIS_OTHER) //Encryption info (SSL connect)
+ IRC_MAP_ENTRY("301", OnIrc_WHOIS_AWAY)
+ IRC_MAP_ENTRY("302", OnIrc_USERHOST_REPLY)
+ IRC_MAP_ENTRY("305", OnIrc_BACKFROMAWAY)
+ IRC_MAP_ENTRY("306", OnIrc_SETAWAY)
+ IRC_MAP_ENTRY("307", OnIrc_WHOIS_AUTH)
+ IRC_MAP_ENTRY("310", OnIrc_WHOIS_OTHER)
+ IRC_MAP_ENTRY("311", OnIrc_WHOIS_NAME)
+ IRC_MAP_ENTRY("312", OnIrc_WHOIS_SERVER)
+ IRC_MAP_ENTRY("313", OnIrc_WHOIS_OTHER)
+ IRC_MAP_ENTRY("315", OnIrc_WHO_END)
+ IRC_MAP_ENTRY("317", OnIrc_WHOIS_IDLE)
+ IRC_MAP_ENTRY("318", OnIrc_WHOIS_END)
+ IRC_MAP_ENTRY("319", OnIrc_WHOIS_CHANNELS)
+ IRC_MAP_ENTRY("320", OnIrc_WHOIS_AUTH)
+ IRC_MAP_ENTRY("321", OnIrc_LISTSTART)
+ IRC_MAP_ENTRY("322", OnIrc_LIST)
+ IRC_MAP_ENTRY("323", OnIrc_LISTEND)
+ IRC_MAP_ENTRY("324", OnIrc_MODEQUERY)
+ IRC_MAP_ENTRY("330", OnIrc_WHOIS_AUTH)
+ IRC_MAP_ENTRY("332", OnIrc_INITIALTOPIC)
+ IRC_MAP_ENTRY("333", OnIrc_INITIALTOPICNAME)
+ IRC_MAP_ENTRY("352", OnIrc_WHO_REPLY)
+ IRC_MAP_ENTRY("353", OnIrc_NAMES)
+ IRC_MAP_ENTRY("366", OnIrc_ENDNAMES)
+ IRC_MAP_ENTRY("367", OnIrc_BANLIST)
+ IRC_MAP_ENTRY("368", OnIrc_BANLISTEND)
+ IRC_MAP_ENTRY("346", OnIrc_BANLIST)
+ IRC_MAP_ENTRY("347", OnIrc_BANLISTEND)
+ IRC_MAP_ENTRY("348", OnIrc_BANLIST)
+ IRC_MAP_ENTRY("349", OnIrc_BANLISTEND)
+ IRC_MAP_ENTRY("371", OnIrc_WHOIS_OTHER)
+ IRC_MAP_ENTRY("376", OnIrc_ENDMOTD)
+ IRC_MAP_ENTRY("401", OnIrc_WHOIS_NO_USER)
+ IRC_MAP_ENTRY("403", OnIrc_JOINERROR)
+ IRC_MAP_ENTRY("416", OnIrc_WHOTOOLONG)
+ IRC_MAP_ENTRY("421", OnIrc_UNKNOWN)
+ IRC_MAP_ENTRY("422", OnIrc_ENDMOTD)
+ IRC_MAP_ENTRY("433", OnIrc_NICK_ERR)
+ IRC_MAP_ENTRY("471", OnIrc_JOINERROR)
+ IRC_MAP_ENTRY("473", OnIrc_JOINERROR)
+ IRC_MAP_ENTRY("474", OnIrc_JOINERROR)
+ IRC_MAP_ENTRY("475", OnIrc_JOINERROR)
+ IRC_MAP_ENTRY("671", OnIrc_WHOIS_OTHER) //Encryption info (SSL connect)
+ IRC_MAP_ENTRY("903", OnIrc_AUTH_OK)
+ IRC_MAP_ENTRY("904", OnIrc_AUTH_FAIL)
+ IRC_MAP_ENTRY("905", OnIrc_AUTH_FAIL)
+ IRC_MAP_ENTRY("906", OnIrc_AUTH_FAIL)
}
CIrcProto::~CIrcProto()
diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h
index 26b290438b..d690634e4f 100644
--- a/protocols/IRCG/src/stdafx.h
+++ b/protocols/IRCG/src/stdafx.h
@@ -183,7 +183,7 @@ using namespace irc;
// map actual member functions to their associated IRC command.
// put any number of this macro in the class's constructor.
#define IRC_MAP_ENTRY(name, member) \
- m_handlers.insert( new CIrcHandler( L##name, &CIrcProto::OnIrc_##member ));
+ m_handlers.insert( new CIrcHandler( L##name, &CIrcProto::##member ));
/////////////////////////////////////////////////////////////////////////////////////////
// Functions
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index 4748f34534..89dff93034 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -378,26 +378,31 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t *pszWindow, const wchar_t *
const wchar_t *pszText, const wchar_t *pszStatus, const wchar_t *pszUserInfo,
DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp)
{
- CMStringW sID;
- CMStringW sText;
-
if (iEvent == GC_EVENT_INFORMATION && bIsMe && !bEcho)
return false;
+ CMStringW sText;
if (pszText)
sText = DoColorCodes(pszText, FALSE, TRUE);
- GCEVENT gce = { 0, iEvent };
- if (pszWindow) {
- sID = pszWindow;
- gce.si = Chat_Find(sID.c_str(), m_szModuleName);
+ GCEVENT gce = {};
+ if (pszWindow)
+ gce.si = Chat_Find(pszWindow, m_szModuleName);
+ else {
+ gce.pszModule = m_szModuleName;
+ gce.dwFlags |= GCEF_BROADCAST;
}
- else gce.si = nullptr;
+ if (bAddToLog)
+ gce.dwFlags |= GCEF_ADDTOLOG;
+
+ gce.iType = iEvent;
gce.pszStatus.w = pszStatus;
- gce.dwFlags = (bAddToLog) ? GCEF_ADDTOLOG : 0;
gce.pszNick.w = pszNick;
gce.pszUID.w = pszNick;
+ gce.dwItemData = dwItemData;
+ gce.bIsMe = bIsMe;
+
if (iEvent == GC_EVENT_TOPIC)
gce.pszUserInfo.w = pszUserInfo;
else
@@ -406,12 +411,10 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t *pszWindow, const wchar_t *
if (!sText.IsEmpty())
gce.pszText.w = sText.c_str();
- gce.dwItemData = dwItemData;
if (timestamp == 1)
gce.time = time(0);
else
gce.time = timestamp;
- gce.bIsMe = bIsMe;
return Chat_Event(&gce);
}