mirror of
https://github.com/znc/znc.git
synced 2026-05-05 21:12:37 +02:00
Added SendBuffer and ClearBuffer client commands
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@745 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
38
Chan.cpp
38
Chan.cpp
@@ -102,23 +102,7 @@ void CChan::JoinUser(bool bForce, const CString& sKey, CClient* pClient) {
|
||||
m_bDetached = false;
|
||||
|
||||
// Send Buffer
|
||||
if (m_pUser->IsUserAttached()) {
|
||||
const vector<CString>& vsBuffer = GetBuffer();
|
||||
|
||||
if (vsBuffer.size()) {
|
||||
m_pUser->PutUser(":***!znc@znc.com PRIVMSG " + GetName() + " :Buffer Playback...", pClient);
|
||||
|
||||
for (unsigned int a = 0; a < vsBuffer.size(); a++) {
|
||||
m_pUser->PutUser(vsBuffer[a], pClient);
|
||||
}
|
||||
|
||||
if (!KeepBuffer()) {
|
||||
ClearBuffer();
|
||||
}
|
||||
|
||||
m_pUser->PutUser(":***!znc@znc.com PRIVMSG " + GetName() + " :Playback Complete.", pClient);
|
||||
}
|
||||
}
|
||||
SendBuffer(pClient);
|
||||
}
|
||||
|
||||
void CChan::DetachUser() {
|
||||
@@ -507,3 +491,23 @@ int CChan::AddBuffer(const CString& sLine) {
|
||||
void CChan::ClearBuffer() {
|
||||
m_vsBuffer.clear();
|
||||
}
|
||||
|
||||
void CChan::SendBuffer(CClient* pClient) {
|
||||
if (m_pUser && m_pUser->IsUserAttached()) {
|
||||
const vector<CString>& vsBuffer = GetBuffer();
|
||||
|
||||
if (vsBuffer.size()) {
|
||||
m_pUser->PutUser(":***!znc@znc.com PRIVMSG " + GetName() + " :Buffer Playback...", pClient);
|
||||
|
||||
for (unsigned int a = 0; a < vsBuffer.size(); a++) {
|
||||
m_pUser->PutUser(vsBuffer[a], pClient);
|
||||
}
|
||||
|
||||
if (!KeepBuffer()) {
|
||||
ClearBuffer();
|
||||
}
|
||||
|
||||
m_pUser->PutUser(":***!znc@znc.com PRIVMSG " + GetName() + " :Playback Complete.", pClient);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1
Chan.h
1
Chan.h
@@ -82,6 +82,7 @@ public:
|
||||
// Buffer
|
||||
int AddBuffer(const CString& sLine);
|
||||
void ClearBuffer();
|
||||
void SendBuffer(CClient* pClient);
|
||||
// !Buffer
|
||||
|
||||
// m_Nick wrappers
|
||||
|
||||
50
Client.cpp
50
Client.cpp
@@ -1078,6 +1078,54 @@ void CClient::UserCommand(const CString& sLine) {
|
||||
|
||||
m_pUser->SetVHost(sVHost);
|
||||
PutStatus("Set VHost to [" + m_pUser->GetVHost() + "]");
|
||||
} else if (sCommand.CaseCmp("PLAYBUFFER") == 0) {
|
||||
CString sChan = sLine.Token(1);
|
||||
|
||||
if (sChan.empty()) {
|
||||
PutStatus("Usage: PlayBuffer <#chan>");
|
||||
return;
|
||||
}
|
||||
|
||||
CChan* pChan = m_pUser->FindChan(sChan);
|
||||
|
||||
if (!pChan) {
|
||||
PutStatus("You are not on [" + sChan + "]");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pChan->IsOn()) {
|
||||
PutStatus("You are not on [" + sChan + "] [trying]");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pChan->GetBuffer().empty()) {
|
||||
PutStatus("The buffer for [" + sChan + "] is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
pChan->SendBuffer(this);
|
||||
} else if (sCommand.CaseCmp("CLEARBUFFER") == 0) {
|
||||
CString sChan = sLine.Token(1);
|
||||
|
||||
if (sChan.empty()) {
|
||||
PutStatus("Usage: ClearBuffer <#chan>");
|
||||
return;
|
||||
}
|
||||
|
||||
CChan* pChan = m_pUser->FindChan(sChan);
|
||||
|
||||
if (!pChan) {
|
||||
PutStatus("You are not on [" + sChan + "]");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pChan->IsOn()) {
|
||||
PutStatus("You are not on [" + sChan + "] [trying]");
|
||||
return;
|
||||
}
|
||||
|
||||
pChan->ClearBuffer();
|
||||
PutStatus("The buffer for [" + sChan + "] has been cleared");
|
||||
} else if (sCommand.CaseCmp("SETBUFFER") == 0) {
|
||||
CString sChan = sLine.Token(1);
|
||||
|
||||
@@ -1147,6 +1195,8 @@ void CClient::HelpUser() {
|
||||
Table.AddRow(); Table.SetCell("Command", "AddServer"); Table.SetCell("Arguments", "<host> [[+]port] [pass]"); Table.SetCell("Description", "Add a server to the list");
|
||||
Table.AddRow(); Table.SetCell("Command", "RemServer"); Table.SetCell("Arguments", "<host>"); Table.SetCell("Description", "Remove a server from the list");
|
||||
Table.AddRow(); Table.SetCell("Command", "Topics"); Table.SetCell("Arguments", ""); Table.SetCell("Description", "Show topics in all channels");
|
||||
Table.AddRow(); Table.SetCell("Command", "PlayBuffer"); Table.SetCell("Arguments", "<#chan>"); Table.SetCell("Description", "Play back the buffer for a given channel");
|
||||
Table.AddRow(); Table.SetCell("Command", "ClearBuffer");Table.SetCell("Arguments", "<#chan>"); Table.SetCell("Description", "Clear the buffer for a given channel");
|
||||
Table.AddRow(); Table.SetCell("Command", "SetBuffer"); Table.SetCell("Arguments", "<#chan> [linecount]"); Table.SetCell("Description", "Set the buffer count for a channel");
|
||||
Table.AddRow(); Table.SetCell("Command", "SetVHost"); Table.SetCell("Arguments", "<vhost (ip preferred)>");Table.SetCell("Description", "Set the VHost for this connection");
|
||||
Table.AddRow(); Table.SetCell("Command", "Jump"); Table.SetCell("Arguments", ""); Table.SetCell("Description", "Jump to the next server in the list");
|
||||
|
||||
Reference in New Issue
Block a user