Applied patches from psychon

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@791 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2007-03-21 16:13:08 +00:00
parent 0a62274975
commit e8c3ebf477
3 changed files with 39 additions and 24 deletions
+33 -21
View File
@@ -86,30 +86,42 @@ void CChan::JoinUser(bool bForce, const CString& sKey, CClient* pClient) {
CString sLine = sPre;
CString sPerm, sNick;
for (map<CString,CNick*>::iterator a = m_msNicks.begin(); a != m_msNicks.end(); a++) {
if(pClient->HasNamesx()) {
sPerm = a->second->GetPermStr();
} else {
char c = a->second->GetPermChar();
sPerm = "";
if (c != '\0') {
sPerm += c;
vector<CClient*>& vpClients = m_pUser->GetClients();
for (vector<CClient*>::iterator it = vpClients.begin(); it != vpClients.end(); it++) {
CClient* pThisClient;
if (!pClient)
pThisClient = *it;
else
pThisClient = pClient;
for (map<CString,CNick*>::iterator a = m_msNicks.begin(); a != m_msNicks.end(); a++) {
if(pThisClient->HasNamesx()) {
sPerm = a->second->GetPermStr();
} else {
char c = a->second->GetPermChar();
sPerm = "";
if (c != '\0') {
sPerm += c;
}
}
if(pThisClient->HasUHNames() && !a->second->GetIdent().empty() && a->second->GetHost().empty()) {
sNick = a->first + "!" + a->second->GetIdent() + "@" + a->second->GetHost();
} else {
sNick = a->first;
}
sLine += sPerm + sNick;
if (sLine.size() >= 490 || a == (--m_msNicks.end())) {
m_pUser->PutUser(sLine, pThisClient);
sLine = sPre;
} else {
sLine += " ";
}
}
if(pClient->HasUHNames() && !a->second->GetIdent().empty() && a->second->GetHost().empty()) {
sNick = a->first + "!" + a->second->GetIdent() + "@" + a->second->GetHost();
} else {
sNick = a->first;
}
sLine += sPerm + sNick;
if (sLine.size() >= 490 || a == (--m_msNicks.end())) {
m_pUser->PutUser(sLine, pClient);
sLine = sPre;
} else {
sLine += " ";
}
if (pClient) // We only want to do this for one client
break;
}
m_pUser->PutUser(":" + m_pUser->GetIRCServer() + " 366 " + m_pUser->GetIRCNick().GetNick() + " " + GetName() + " :End of /NAMES list.", pClient);
+4 -2
View File
@@ -574,7 +574,8 @@ void CClient::UserCommand(const CString& sLine) {
}
const map<CString,CNick*>& msNicks = pChan->GetNicks();
const CString& sPerms = m_pUser->GetIRCSock()->GetPerms();
CIRCSock* pIRCSock = (!m_pUser) ? NULL : m_pUser->GetIRCSock();
const CString& sPerms = (pIRCSock) ? pIRCSock->GetPerms() : "";
if (!msNicks.size()) {
PutStatus("No nicks on [" + sChan + "]");
@@ -763,7 +764,8 @@ void CClient::UserCommand(const CString& sLine) {
} else if (sCommand.CaseCmp("LISTCHANS") == 0) {
if (m_pUser) {
const vector<CChan*>& vChans = m_pUser->GetChans();
const CString& sPerms = m_pUser->GetIRCSock()->GetPerms();
CIRCSock* pIRCSock = (!m_pUser) ? NULL : m_pUser->GetIRCSock();
const CString& sPerms = (pIRCSock) ? pIRCSock->GetPerms() : "";
if (!vChans.size()) {
PutStatus("You have no channels defined");
+2 -1
View File
@@ -102,7 +102,8 @@ bool CNick::RemPerm(unsigned char uPerm) {
}
void CNick::UpdatePermChar() {
const CString& sChanPerms = (!m_pUser) ? "@+" : m_pUser->GetIRCSock()->GetPerms();
CIRCSock* pIRCSock = (!m_pUser) ? NULL : m_pUser->GetIRCSock();
const CString& sChanPerms = (!pIRCSock) ? "@+" : pIRCSock->GetPerms();
m_cPerm = 0;
for (unsigned int a = 0; a < sChanPerms.size(); a++) {