Merge pull request #904 from jpnurmi/clearqueries

Restore CIRCNetwork::ClearQueryBuffer() for convenience
This commit is contained in:
Alexey Sokolov
2015-02-28 20:15:59 -08:00
3 changed files with 10 additions and 6 deletions
+2
View File
@@ -167,6 +167,8 @@ public:
void AddNoticeBuffer(const CString& sFormat, const CString& sText = "") { m_NoticeBuffer.AddLine(sFormat, sText); }
void UpdateNoticeBuffer(const CString& sMatch, const CString& sFormat, const CString& sText = "") { m_NoticeBuffer.UpdateLine(sMatch, sFormat, sText); }
void ClearNoticeBuffer() { m_NoticeBuffer.Clear(); }
void ClearQueryBuffer();
// !Buffers
// la
+2 -6
View File
@@ -1386,9 +1386,7 @@ void CClient::UserCommand(CString& sLine) {
return;
}
for (CQuery* pQuery : m_pNetwork->GetQueries()) {
m_pNetwork->DelQuery(pQuery->GetName());
}
m_pNetwork->ClearQueryBuffer();
PutStatus("All query buffers have been cleared");
} else if (sCommand.Equals("CLEARALLBUFFERS")) {
if (!m_pNetwork) {
@@ -1399,9 +1397,7 @@ void CClient::UserCommand(CString& sLine) {
for (CChan* pChan : m_pNetwork->GetChans()) {
pChan->ClearBuffer();
}
for (CQuery* pQuery : m_pNetwork->GetQueries()) {
m_pNetwork->DelQuery(pQuery->GetName());
}
m_pNetwork->ClearQueryBuffer();
PutStatus("All buffers have been cleared");
} else if (sCommand.Equals("SETBUFFER")) {
if (!m_pNetwork) {
+6
View File
@@ -23,6 +23,7 @@
#include <znc/Chan.h>
#include <znc/Query.h>
#include <algorithm>
#include <memory>
using std::vector;
using std::set;
@@ -1279,6 +1280,11 @@ bool CIRCNetwork::PutIRC(const CString& sLine) {
return true;
}
void CIRCNetwork::ClearQueryBuffer() {
std::for_each(m_vQueries.begin(), m_vQueries.end(), std::default_delete<CQuery>());
m_vQueries.clear();
}
const CString& CIRCNetwork::GetNick(const bool bAllowDefault) const {
if (m_sNick.empty()) {
return m_pUser->GetNick(bAllowDefault);