virtual EModRet OnPrivCTCP(CNick& Nick, CString& sMessage) { if (sMessage.Equals("DCC ", false, 4) && m_pUser->IsUserAttached()) { // DCC CHAT chat 2453612361 44592 CString sType = sMessage.Token(1); CString sFile = sMessage.Token(2); unsigned long uLongIP = sMessage.Token(3).ToULong(); unsigned short uPort = sMessage.Token(4).ToUShort(); unsigned long uFileSize = sMessage.Token(5).ToULong(); if (sType.Equals("CHAT")) { CNick FromNick(Nick.GetNickMask()); unsigned short uBNCPort = CDCCBounce::DCCRequest(FromNick.GetNick(), uLongIP, uPort, "", true, this, CUtils::GetIP(uLongIP)); if (uBNCPort) { CString sIP = GetLocalDCCIP(); m_pUser->PutUser(":" + Nick.GetNickMask() + " PRIVMSG " + m_pUser->GetNick() + " :\001DCC CHAT chat " + CString(CUtils::GetLongIP(sIP)) + " " + CString(uBNCPort) + "\001"); } } else if (sType.Equals("SEND")) { // DCC SEND readme.txt 403120438 5550 1104 unsigned short uBNCPort = CDCCBounce::DCCRequest(Nick.GetNick(), uLongIP, uPort, sFile, false, this, CUtils::GetIP(uLongIP)); if (uBNCPort) { CString sIP = GetLocalDCCIP(); m_pUser->PutUser(":" + Nick.GetNickMask() + " PRIVMSG " + m_pUser->GetNick() + " :\001DCC SEND " + sFile + " " + CString(CUtils::GetLongIP(sIP)) + " " + CString(uBNCPort) + " " + CString(uFileSize) + "\001"); } } else if (sType.Equals("RESUME")) { // Need to lookup the connection by port, filter the port, and forward to the user unsigned short uResumePort = sMessage.Token(3).ToUShort(); set<CSocket*>::const_iterator it; for (it = BeginSockets(); it != EndSockets(); ++it) { CDCCBounce* pSock = (CDCCBounce*) *it; if (pSock->GetLocalPort() == uResumePort) { m_pUser->PutUser(":" + Nick.GetNickMask() + " PRIVMSG " + m_pClient->GetNick() + " :\001DCC " + sType + " " + sFile + " " + CString(pSock->GetUserPort()) + " " + sMessage.Token(4) + "\001"); } } } else if (sType.Equals("ACCEPT")) { // Need to lookup the connection by port, filter the port, and forward to the user set<CSocket*>::const_iterator it; for (it = BeginSockets(); it != EndSockets(); ++it) { CDCCBounce* pSock = (CDCCBounce*) *it; if (pSock->GetUserPort() == sMessage.Token(3).ToUShort()) { m_pUser->PutUser(":" + Nick.GetNickMask() + " PRIVMSG " + m_pClient->GetNick() + " :\001DCC " + sType + " " + sFile + " " + CString(pSock->GetLocalPort()) + " " + sMessage.Token(4) + "\001"); } } } return HALTCORE; } return CONTINUE; }
virtual void OnNick(const CNick& cNick, const CString& sNewNick, const vector<CChan*>& vChans) { for (size_t a = 0; a < vChans.size(); a++) { AddBuffer(*vChans[a], SpoofChanMsg(vChans[a]->GetName(), cNick.GetNickMask() + " NICK " + sNewNick)); } }
virtual void OnNick(const CNick& OldNick, const CString& sNewNick, const vector<CChan*>& vChans) { vector<CChan*>::const_iterator it; CString sMsg = OldNick.GetNickMask() + " is now known as " + sNewNick; for (it = vChans.begin(); it != vChans.end(); ++it) { AddBuffer(**it, sMsg); } }
virtual void OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans) { vector<CChan*>::const_iterator it; CString sMsg = Nick.GetNickMask() + " quit with message: [" + sMessage + "]"; for (it = vChans.begin(); it != vChans.end(); ++it) { AddBuffer(**it, sMsg); } }
virtual void OnQuit(const CNick& cNick, const CString& sMessage, const vector<CChan*>& vChans) { for (size_t a = 0; a < vChans.size(); a++) { AddBuffer(*vChans[a], SpoofChanMsg(vChans[a]->GetName(), cNick.GetNickMask() + " QUIT " + sMessage)); } if (cNick.GetNick().Equals(m_pUser->GetNick())) SaveBufferToDisk(); // need to force a save here to see this! }
virtual void OnJoin(const CNick& cNick, CChan& cChannel) { if (cNick.GetNick().Equals(m_pUser->GetNick()) && cChannel.GetBuffer().empty()) { BootStrap((CChan *)&cChannel); if (!cChannel.GetBuffer().empty()) Replay(cChannel.GetName()); } AddBuffer(cChannel, SpoofChanMsg(cChannel.GetName(), cNick.GetNickMask() + " JOIN")); }
void HandleMessage(CNick& Nick, const CString& sMessage) { // Flip the NOTICE into PRIVMSG PutUser(":" + Nick.GetNickMask() + " PRIVMSG " + GetUser()->GetNick() + " :" + sMessage); }
virtual void OnPart(const CNick& cNick, CChan& cChannel) { AddBuffer(cChannel, SpoofChanMsg(cChannel.GetName(), cNick.GetNickMask() + " PART")); if (cNick.GetNick().Equals(m_pUser->GetNick())) SaveBufferToDisk(); // need to force a save here to see this! }
virtual void OnKick(const CNick& cNick, const CString& sOpNick, CChan& cChannel, const CString& sMessage) { AddBuffer(cChannel, SpoofChanMsg(cChannel.GetName(), sOpNick + " KICK " + cNick.GetNickMask() + " " + sMessage)); }
virtual void OnRawMode(const CNick& cOpNick, CChan& cChannel, const CString& sModes, const CString& sArgs) { AddBuffer(cChannel, SpoofChanMsg(cChannel.GetName(), cOpNick.GetNickMask() + " MODE " + sModes + " " + sArgs)); }
virtual EModRet OnTopic(CNick& Nick, CChan& Channel, CString& sTopic) { AddBuffer(Channel, Nick.GetNickMask() + " changed the topic to: " + sTopic); return CONTINUE; }
virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) { AddBuffer(Channel, Nick.GetNickMask() + " parted with message: [" + sMessage + "]"); }
virtual void OnJoin(const CNick& Nick, CChan& Channel) { AddBuffer(Channel, Nick.GetNickMask() + " joined"); }
virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) { AddBuffer(Channel, OpNick.GetNickMask() + " kicked " + sKickedNick + " Reason: [" + sMessage + "]"); }
virtual void OnRawMode(const CNick& OpNick, CChan& Channel, const CString& sModes, const CString& sArgs) { AddBuffer(Channel, OpNick.GetNickMask() + " set mode: " + sModes + " " + sArgs); }
void AddMessage(time_t iTime, const CNick & Nick, CString & sMessage) { if (m_pUser && Nick.GetNick() == m_pUser->GetIRCNick().GetNick()) return; // ignore messages from self AddMessage(CString(iTime) + ":" + Nick.GetNickMask() + ":" + sMessage); }