From 078eef5ba9c5250c000afa3e28bb32a877bfb273 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 11 Aug 2015 15:16:12 +0200 Subject: [PATCH] partyline: send RPL_ISUPPORT regardless of network or IRC connection The behavior of IRC clients is unpredictable if they don't get the appropriate CHANTYPES for partyline channels. Thus, send RPL_ISUPPORT with the appropriate CHANTYPES also when a client is not connected to a network, or when the network is not connected to IRC. --- modules/partyline.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/partyline.cpp b/modules/partyline.cpp index 834b2c15..30960791 100644 --- a/modules/partyline.cpp +++ b/modules/partyline.cpp @@ -114,12 +114,10 @@ public: for (map::const_iterator it = msUsers.begin(); it != msUsers.end(); ++it) { CUser* pUser = it->second; - for (vector::const_iterator i = pUser->GetNetworks().begin(); i != pUser->GetNetworks().end(); ++i) { - CIRCNetwork* pNetwork = *i; - if (pNetwork->GetIRCSock()) { - if (pNetwork->GetChanPrefixes().find(CHAN_PREFIX_1) == CString::npos) { - pNetwork->PutUser(":" + GetIRCServer(pNetwork) + " 005 " + pNetwork->GetIRCNick().GetNick() + " CHANTYPES=" + pNetwork->GetChanPrefixes() + CHAN_PREFIX_1 " :are supported by this server."); - } + for (CClient* pClient : pUser->GetAllClients()) { + CIRCNetwork* pNetwork = pClient->GetNetwork(); + if (!pNetwork || !pNetwork->IsIRCConnected() || !pNetwork->GetChanPrefixes().Contains(CHAN_PREFIX_1)) { + pClient->PutClient(":" + GetIRCServer(pNetwork) + " 005 " + pClient->GetNick() + " CHANTYPES=" + (pNetwork ? pNetwork->GetChanPrefixes() : "") + CHAN_PREFIX_1 " :are supported by this server."); } } } @@ -213,8 +211,8 @@ public: CUser* pUser = GetUser(); CClient* pClient = GetClient(); CIRCNetwork* pNetwork = GetNetwork(); - if (m_spInjectedPrefixes.find(pNetwork) == m_spInjectedPrefixes.end() && pNetwork && !pNetwork->GetChanPrefixes().empty()) { - pClient->PutClient(":" + GetIRCServer(pNetwork) + " 005 " + pClient->GetNick() + " CHANTYPES=" + pNetwork->GetChanPrefixes() + CHAN_PREFIX_1 " :are supported by this server."); + if (!pNetwork || !pNetwork->IsIRCConnected()) { + pClient->PutClient(":" + GetIRCServer(pNetwork) + " 005 " + pClient->GetNick() + " CHANTYPES=" + CHAN_PREFIX_1 " :are supported by this server."); } // Make sure this user is in the default channels