Send correct away status on client login

If some client now sets "us" away via /away, new clients will be sent a 306
numeric after login to inform them that they are set /away.

Thanks to nobswolf for the suggestion.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1655 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2009-11-07 14:54:45 +00:00
parent aea6c40a0e
commit ff4e09c594
3 changed files with 16 additions and 0 deletions
+6
View File
@@ -193,6 +193,12 @@ void CIRCSock::ReadLine(const CString& sData) {
}
break;
}
case 305:
m_pUser->SetIRCAway(false);
break;
case 306:
m_pUser->SetIRCAway(true);
break;
case 331: {
// :irc.server.com 331 yournick #chan :No topic is set.
CChan* pChan = m_pUser->FindChan(sLine.Token(3));
+8
View File
@@ -36,6 +36,7 @@ CUser::CUser(const CString& sUserName) {
m_bUseClientIP = false;
m_bDenyLoadMod = false;
m_bAdmin= false;
m_bIRCAway = false;
m_bDenySetVHost= false;
m_sStatusPrefix = "*";
m_sChanPrefixes = "";
@@ -147,6 +148,7 @@ void CUser::IRCDisconnected() {
}
SetIRCServer("");
m_bIRCAway = false;
// Get the reconnect going
CheckIRCConnect();
@@ -275,6 +277,12 @@ void CUser::UserConnected(CClient* pClient) {
}
}
if (m_bIRCAway) {
// If they want to know their away reason they'll have to whois
// themselves. At least we can tell them their away status...
pClient->PutClient(":irc.znc.in 306 " + GetIRCNick().GetNick() + " :You have been marked as being away");
}
const vector<CChan*>& vChans = GetChans();
for (unsigned int a = 0; a < vChans.size(); a++) {
if ((vChans[a]->IsOn()) && (!vChans[a]->IsDetached())) {
+2
View File
@@ -170,6 +170,7 @@ public:
void SetJoinTries(unsigned int i) { m_uMaxJoinTries = i; }
void SetMaxJoins(unsigned int i) { m_uMaxJoins = i; }
void SetIRCConnectEnabled(bool b) { m_bIRCConnectEnabled = b; }
void SetIRCAway(bool b) { m_bIRCAway = b; }
// !Setters
// Getters
@@ -240,6 +241,7 @@ protected:
CString m_sDefaultChanModes;
CString m_sChanPrefixes;
CNick m_IRCNick;
bool m_bIRCAway;
CString m_sIRCServer;
CString m_sQuitMsg;
MCString m_mssCTCPReplies;