Rewrite Buffer to store a format string.

Will use this to allow more parameters to be inserted at the time the
buffers are flushed to the client.
This commit is contained in:
Stéphan Kochen
2011-10-16 17:31:43 +02:00
parent 2fdf54d43d
commit 948ae2510c
8 changed files with 70 additions and 75 deletions

View File

@@ -344,13 +344,16 @@ void CIRCNetwork::ClientConnected(CClient *pClient) {
m_vClients.push_back(pClient);
unsigned int uIdx;
CString sLine;
MCString msParams;
msParams["target"] = GetIRCNick().GetNick();
if (m_RawBuffer.IsEmpty()) {
pClient->PutClient(":irc.znc.in 001 " + pClient->GetNick() + " :- Welcome to ZNC -");
} else {
unsigned int uIdx = 0;
CString sLine;
while (m_RawBuffer.GetLine(GetIRCNick().GetNick(), sLine, uIdx++)) {
uIdx = 0;
while (m_RawBuffer.GetLine(uIdx++, sLine, msParams)) {
pClient->PutClient(sLine);
}
@@ -359,10 +362,8 @@ void CIRCNetwork::ClientConnected(CClient *pClient) {
}
// Send the cached MOTD
unsigned int uIdx = 0;
CString sLine;
while (m_MotdBuffer.GetLine(GetIRCNick().GetNick(), sLine, uIdx++)) {
uIdx = 0;
while (m_MotdBuffer.GetLine(uIdx++, sLine, msParams)) {
pClient->PutClient(sLine);
}
@@ -391,10 +392,9 @@ void CIRCNetwork::ClientConnected(CClient *pClient) {
}
}
CString sBufLine;
while (m_QueryBuffer.GetNextLine(GetIRCNick().GetNick(), sBufLine)) {
NETWORKMODULECALL(OnPrivBufferPlayLine(*pClient, sBufLine), m_pUser, this, NULL, continue);
pClient->PutClient(sBufLine);
while (m_QueryBuffer.GetNextLine(sLine, msParams)) {
NETWORKMODULECALL(OnPrivBufferPlayLine(*pClient, sLine), m_pUser, this, NULL, continue);
pClient->PutClient(sLine);
}
// Tell them why they won't connect