PutStatus("Hello. How may I help you?");
return;
} else if (sCommand.CaseCmp("DETACH") == 0) {
- if (m_pUser) {
- CString sChan = sLine.Token(1);
-
- if (sChan.empty()) {
- PutStatusNotice("Usage: /detach <#chan>");
- return;
- }
+ CString sChan = sLine.Token(1);
- CChan* pChan = m_pUser->FindChan(sChan);
- if (!pChan) {
- PutStatusNotice("You are not on [" + sChan + "]");
- return;
- }
+ if (sChan.empty()) {
+ PutStatusNotice("Usage: /detach <#chan>");
+ return;
+ }
- pChan->DetachUser();
- PutStatusNotice("Detached from [" + sChan + "]");
+ CChan* pChan = m_pUser->FindChan(sChan);
+ if (!pChan) {
+ PutStatusNotice("You are not on [" + sChan + "]");
return;
}
+
+ pChan->DetachUser();
+ PutStatusNotice("Detached from [" + sChan + "]");
+ return;
} else if (sCommand.CaseCmp("PING") == 0) {
CString sTarget = sLine.Token(1);
sChans.LeftChomp();
}
- if (m_pUser) {
- VCString vChans;
- sChans.Split(",", vChans, false);
- sChans.clear();
-
- for (unsigned int a = 0; a < vChans.size(); a++) {
- CString sChannel = vChans[a];
- MODULECALL(OnUserJoin(sChannel, sKey), m_pUser, this, continue);
+ VCString vChans;
+ sChans.Split(",", vChans, false);
+ sChans.clear();
- CChan* pChan = m_pUser->FindChan(sChannel);
+ for (unsigned int a = 0; a < vChans.size(); a++) {
+ CString sChannel = vChans[a];
+ MODULECALL(OnUserJoin(sChannel, sKey), m_pUser, this, continue);
- if (pChan) {
- pChan->JoinUser(false, sKey);
- continue;
- }
+ CChan* pChan = m_pUser->FindChan(sChannel);
- if (!sChannel.empty()) {
- sChans += (sChans.empty()) ? sChannel : CString("," + sChannel);
- }
+ if (pChan) {
+ pChan->JoinUser(false, sKey);
+ continue;
}
- if (sChans.empty()) {
- return;
+ if (!sChannel.empty()) {
+ sChans += (sChans.empty()) ? sChannel : CString("," + sChannel);
}
+ }
+
+ if (sChans.empty()) {
+ return;
+ }
- sLine = "JOIN " + sChans;
+ sLine = "JOIN " + sChans;
- if (!sKey.empty()) {
- sLine += " " + sKey;
- }
+ if (!sKey.empty()) {
+ sLine += " " + sKey;
}
} else if (sCommand.CaseCmp("PART") == 0) {
CString sChan = sLine.Token(1);
MODULECALL(OnUserPart(sChan, sMessage), m_pUser, this, return);
- if (m_pUser) {
- CChan* pChan = m_pUser->FindChan(sChan);
+ CChan* pChan = m_pUser->FindChan(sChan);
- if (pChan && !pChan->IsOn()) {
- PutStatusNotice("Removing channel [" + sChan + "]");
- m_pUser->DelChan(sChan);
- return;
- }
+ if (pChan && !pChan->IsOn()) {
+ PutStatusNotice("Removing channel [" + sChan + "]");
+ m_pUser->DelChan(sChan);
+ return;
}
sLine = "PART " + sChan;
CString sTarget = sLine.Token(1);
CString sModes = sLine.Token(2, true);
- if (m_pUser && m_pUser->IsChan(sTarget)) {
+ if (m_pUser->IsChan(sTarget)) {
CChan *pChan = m_pUser->FindChan(sTarget);
if (pChan && sModes.empty()) {
}
}
} else if (sCommand.CaseCmp("QUIT") == 0) {
- if (m_pUser) {
- m_pUser->UserDisconnected(this);
- }
+ m_pUser->UserDisconnected(this);
Close(); // Treat a client quit as a detach
return; // Don't forward this msg. We don't want the client getting us disconnected.
sMsg.LeftChomp();
}
- if ((!m_pUser) || (sTarget.CaseCmp(CString(m_pUser->GetStatusPrefix() + "status"))) == 0) {
+ if (sTarget.CaseCmp(CString(m_pUser->GetStatusPrefix() + "status")) == 0) {
return;
}
if (strncasecmp(sTarget.c_str(), m_pUser->GetStatusPrefix().c_str(), m_pUser->GetStatusPrefix().length()) == 0) {
#ifdef _MODULES
- if (m_pUser) {
- CString sModule = sTarget;
- sModule.LeftChomp(m_pUser->GetStatusPrefix().length());
+ CString sModule = sTarget;
+ sModule.LeftChomp(m_pUser->GetStatusPrefix().length());
- CALLMOD(sModule, this, m_pUser, OnModNotice(sMsg));
- }
+ CALLMOD(sModule, this, m_pUser, OnModNotice(sMsg));
#endif
return;
}
}
// Relay to the rest of the clients that may be connected to this user
- if (m_pUser && m_pUser->IsChan(sTarget)) {
+ if (m_pUser->IsChan(sTarget)) {
vector<CClient*>& vClients = m_pUser->GetClients();
for (unsigned int a = 0; a < vClients.size(); a++) {
sCTCP.LeftChomp();
sCTCP.RightChomp();
- if (strncasecmp(sCTCP.c_str(), "DCC ", 4) == 0 && m_pUser && m_pUser->BounceDCCs()) {
+ if (strncasecmp(sCTCP.c_str(), "DCC ", 4) == 0 && m_pUser->BounceDCCs()) {
CString sType = sCTCP.Token(1);
CString sFile = sCTCP.Token(2);
unsigned long uLongIP = strtoul(sCTCP.Token(3).c_str(), NULL, 10);
// DCC SEND readme.txt 403120438 5550 1104
if (strncasecmp(sTarget.c_str(), m_pUser->GetStatusPrefix().c_str(), m_pUser->GetStatusPrefix().length()) == 0) {
- if ((!m_pUser) || (sTarget.CaseCmp(CString(m_pUser->GetStatusPrefix() + "status")) == 0)) {
- if (!m_pUser) {
- return;
- }
-
+ if (sTarget.CaseCmp(CString(m_pUser->GetStatusPrefix() + "status")) == 0) {
CString sPath = m_pUser->GetDLPath();
if (!CFile::Exists(sPath)) {
PutStatus("Could not create [" + sPath + "] directory.");
CString sLocalFile = sPath + "/" + sFile;
- if (m_pUser) {
- m_pUser->GetFile(GetNick(), CUtils::GetIP(uLongIP), uPort, sLocalFile, uFileSize);
- }
+ m_pUser->GetFile(GetNick(), CUtils::GetIP(uLongIP), uPort, sLocalFile, uFileSize);
} else {
MODULECALL(OnDCCUserSend(sTarget, uLongIP, uPort, sFile, uFileSize), m_pUser, this, return);
}
// Need to lookup the connection by port, filter the port, and forward to the user
if (strncasecmp(sTarget.c_str(), m_pUser->GetStatusPrefix().c_str(), m_pUser->GetStatusPrefix().length()) == 0) {
- if ((m_pUser) && (m_pUser->ResumeFile(uResumePort, uResumeSize))) {
+ if (m_pUser->ResumeFile(uResumePort, uResumeSize)) {
PutClient(":" + sTarget + "!znc@znc.in PRIVMSG " + GetNick() + " :\001DCC ACCEPT " + sFile + " " + CString(uResumePort) + " " + CString(uResumeSize) + "\001");
} else {
PutStatus("DCC -> [" + GetNick() + "][" + sFile + "] Unable to find send to initiate resume.");
}
// Relay to the rest of the clients that may be connected to this user
- if (m_pUser && m_pUser->IsChan(sTarget)) {
+ if (m_pUser->IsChan(sTarget)) {
vector<CClient*>& vClients = m_pUser->GetClients();
for (unsigned int a = 0; a < vClients.size(); a++) {
return;
}
- if ((m_pUser) && (sTarget.CaseCmp(CString(m_pUser->GetStatusPrefix() + "status")) == 0)) {
+ if (sTarget.CaseCmp(CString(m_pUser->GetStatusPrefix() + "status")) == 0) {
MODULECALL(OnStatusCommand(sMsg), m_pUser, this, return);
UserCommand(sMsg);
return;
if (strncasecmp(sTarget.c_str(), m_pUser->GetStatusPrefix().c_str(), m_pUser->GetStatusPrefix().length()) == 0) {
#ifdef _MODULES
- if (m_pUser) {
- CString sModule = sTarget;
- sModule.LeftChomp(m_pUser->GetStatusPrefix().length());
+ CString sModule = sTarget;
+ sModule.LeftChomp(m_pUser->GetStatusPrefix().length());
- CALLMOD(sModule, this, m_pUser, OnModCommand(sMsg));
- }
+ CALLMOD(sModule, this, m_pUser, OnModCommand(sMsg));
#endif
return;
}
// Relay to the rest of the clients that may be connected to this user
- if (m_pUser && m_pUser->IsChan(sTarget)) {
+ if (m_pUser->IsChan(sTarget)) {
vector<CClient*>& vClients = m_pUser->GetClients();
for (unsigned int a = 0; a < vClients.size(); a++) {