Files
znc/Buffer.cpp
psychon f601db2cd8 merge with rev 932 psychon branch:
- module call for /me's
- timestamps for playback and query buffer
- WALLOP stuff / fix
- properly join channels _after_ namesx or uhnames were set up
- dont screw up raws on reconnect when you ran /lusers
- change default quit msg and version reply to CZNC::GetTag(false)
- change CZNC::GetTag() to point to sf.net
- kind of an rewrite for partyline, added fixed channels (this doesnt work on irssi,
		did it ever work?)
- add the timestamp support to webadmin too
- add ConnectDelay config option to avoid being killed because we connected too fast
- make znc handle usermodes correctly


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@799 726aef4b-f618-498e-8847-2d620e286838
2007-05-16 22:13:17 +00:00

71 lines
1.3 KiB
C++

//! @author prozac@rottenboy.com
#include "Buffer.h"
CBufLine::CBufLine(const CString& sPre, const CString& sPost, bool bIncNick=true) {
m_sPre = sPre;
m_sPost = sPost;
m_bIncNick = bIncNick;
}
CBufLine::~CBufLine() {}
void CBufLine::GetLine(const CString& sTarget, CString& sRet) {
if(m_bIncNick)
sRet = m_sPre + sTarget + m_sPost;
else
sRet = m_sPre + m_sPost;
}
CBuffer::CBuffer(unsigned int uLineCount) {
m_uLineCount = uLineCount;
}
CBuffer::~CBuffer() {}
int CBuffer::AddLine(const CString& sPre, const CString& sPost, bool bIncNick) {
if (!m_uLineCount) {
return 0;
}
if (size() >= m_uLineCount) {
erase(begin());
}
push_back(CBufLine(sPre, sPost, bIncNick));
return size();
}
int CBuffer::UpdateLine(const CString& sPre, const CString& sPost, bool bIncNick) {
for(iterator it = begin(); it != end(); it++) {
if(it->GetPre() == sPre) {
it->SetPost(sPost);
it->SetIncNick(bIncNick);
return size();
}
}
return AddLine(sPre, sPost, bIncNick);
}
bool CBuffer::GetLine(const CString& sTarget, CString& sRet, unsigned int uIdx) {
if (uIdx >= size()) {
return false;
}
(*this)[uIdx].GetLine(sTarget, sRet);
return true;
}
bool CBuffer::GetNextLine(const CString& sTarget, CString& sRet) {
sRet = "";
if (!size()) {
return false;
}
begin()->GetLine(sTarget, sRet);
erase(begin());
return true;
}