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
This commit is contained in:
psychon
2007-05-16 22:13:17 +00:00
parent 6a6ae0ed94
commit f601db2cd8
19 changed files with 541 additions and 123 deletions

View File

@@ -37,6 +37,8 @@ CUser::CUser(const CString& sUserName) {
m_bKeepBuffer = false;
m_bAutoCycle = true;
m_bBeingDeleted = false;
m_sTimestampFormat = "[%H:%M:%S]";
m_bAppendTimestamp = false;
m_pKeepNickTimer = new CKeepNickTimer(this);
m_pJoinTimer = new CJoinTimer(this);
m_pMiscTimer = new CMiscTimer(this);
@@ -125,6 +127,31 @@ CString& CUser::ExpandString(const CString& sStr, CString& sRet) const {
return sRet;
}
CString CUser::AddTimestamp(const CString& sStr) const {
CString sRet;
return AddTimestamp(sStr, sRet);
}
CString& CUser::AddTimestamp(const CString& sStr, CString& sRet) const {
char szTimestamp[1024];
time_t tm;
if(GetTimestampFormat().empty()) {
sRet = sStr;
} else {
time(&tm);
strftime(szTimestamp, sizeof(szTimestamp) / sizeof(char), GetTimestampFormat().c_str(), localtime(&tm));
if(m_bAppendTimestamp) {
sRet = sStr + " ";
sRet += szTimestamp;
} else {
sRet = szTimestamp;
sRet += " " + sStr;
}
}
return sRet;
}
void CUser::BounceAllClients() {
for (unsigned int a = 0; a < m_vClients.size(); a++) {
m_vClients[a]->BouncedOff();
@@ -164,6 +191,18 @@ void CUser::UserConnected(CClient* pClient) {
}
}
if(GetIRCSock() != NULL) {
CString sUserMode("");
const set<unsigned char>& scUserModes = GetIRCSock()->GetUserModes();
for (set<unsigned char>::iterator it = scUserModes.begin();
it != scUserModes.end(); it++) {
sUserMode += *it;
}
if(!sUserMode.empty()) {
pClient->PutClient(":" + GetIRCNick().GetNick() + " MODE " + GetIRCNick().GetNick() + " :+" + sUserMode);
}
}
const vector<CChan*>& vChans = GetChans();
for (unsigned int a = 0; a < vChans.size(); a++) {
if ((vChans[a]->IsOn()) && (!vChans[a]->IsDetached())) {
@@ -347,6 +386,8 @@ bool CUser::Clone(const CUser& User, CString& sErrorRet) {
SetUseClientIP(User.UseClientIP());
SetDenyLoadMod(User.DenyLoadMod());
SetAdmin(User.IsAdmin());
SetTimestampAppend(User.GetTimestampAppend());
SetTimestampFormat(User.GetTimestampFormat());
// !Flags
return true;
@@ -376,6 +417,9 @@ bool CUser::IsHostAllowed(const CString& sHostMask) {
return false;
}
const CString& CUser::GetTimestampFormat() const { return m_sTimestampFormat; }
bool CUser::GetTimestampAppend() const { return m_bAppendTimestamp; }
bool CUser::IsValidUserName(const CString& sUserName) {
const char* p = sUserName.c_str();
@@ -485,6 +529,8 @@ bool CUser::WriteConfig(CFile& File) {
PrintLine(File, "DenyLoadMod", CString((DenyLoadMod()) ? "true" : "false"));
PrintLine(File, "Admin", CString((IsAdmin()) ? "true" : "false"));
PrintLine(File, "DCCLookupMethod", CString((UseClientIP()) ? "client" : "default"));
PrintLine(File, "TimestampFormat", GetTimestampFormat());
PrintLine(File, "AppendTimestamp", CString((GetTimestampAppend()) ? "yes" : "no"));
File.Write("\r\n");
// Allow Hosts
@@ -981,7 +1027,7 @@ const vector<CChan*>& CUser::GetChans() const { return m_vChans; }
const vector<CServer*>& CUser::GetServers() const { return m_vServers; }
const CNick& CUser::GetIRCNick() const { return m_IRCNick; }
const CString& CUser::GetIRCServer() const { return m_sIRCServer; }
CString CUser::GetQuitMsg() const { return (!m_sQuitMsg.empty()) ? m_sQuitMsg : "ZNC by prozac - http://znc.sourceforge.net"; }
CString CUser::GetQuitMsg() const { return (!m_sQuitMsg.empty()) ? m_sQuitMsg : CZNC::GetTag(false); }
const MCString& CUser::GetCTCPReplies() const { return m_mssCTCPReplies; }
unsigned int CUser::GetBufferCount() const { return m_uBufferCount; }
bool CUser::KeepBuffer() const { return m_bKeepBuffer; }