diff --git a/modules/autoop.cpp b/modules/autoop.cpp index 96ddfe8a..1c61475c 100644 --- a/modules/autoop.cpp +++ b/modules/autoop.cpp @@ -53,7 +53,7 @@ public: CAutoOpUser(const CString& sUsername, const CString& sUserKey, const CString& sHostmasks, const CString& sChannels) : m_sUsername(sUsername), m_sUserKey(sUserKey) { - AddHostmasks(sHostmasks); + AddHostmasks(sHostmasks); AddChans(sChannels); } @@ -82,31 +82,11 @@ public: } CString GetHostmasks() const { - CString sRet; - - for (set::const_iterator it = m_ssHostmasks.begin(); it != m_ssHostmasks.end(); ++it) { - if (!sRet.empty()) { - sRet += ","; - } - - sRet += *it; - } - - return sRet; + return CString(",").Join(m_ssHostmasks.begin(), m_ssHostmasks.end()); } CString GetChannels() const { - CString sRet; - - for (set::const_iterator it = m_ssChans.begin(); it != m_ssChans.end(); ++it) { - if (!sRet.empty()) { - sRet += " "; - } - - sRet += *it; - } - - return sRet; + return CString(" ").Join(m_ssChans.begin(), m_ssChans.end()); } void DelHostmasks(const CString& sHostmasks) { @@ -149,21 +129,8 @@ public: CString sChans; CString sHostmasks; - for (set::const_iterator it = m_ssHostmasks.begin(); it != m_ssHostmasks.end(); ++it) { - if (!sHostmasks.empty()) { - sHostmasks += ","; - } - - sHostmasks += *it; - } - - for (set::const_iterator it = m_ssChans.begin(); it != m_ssChans.end(); ++it) { - if (!sChans.empty()) { - sChans += " "; - } - - sChans += *it; - } + sHostmasks = CString(",").Join(m_ssHostmasks.begin(), m_ssHostmasks.end()); + sChans = CString(" ").Join(m_ssChans.begin(), m_ssChans.end()); return m_sUsername + "\t" + sHostmasks + "\t" + m_sUserKey + "\t" + sChans; } @@ -280,7 +247,7 @@ public: if (sCommand.Equals("ADDUSER")) { if (sHost.empty()) { - PutModule("Usage: " + sCommand + " [channels]"); + PutModule("Usage: " + sCommand + " [channels]"); } else { CAutoOpUser* pUser = AddUser(sUser, sKey, sHost, sLine.Token(4, true)); @@ -301,16 +268,28 @@ public: CTable Table; Table.AddColumn("User"); - Table.AddColumn("Hostmask"); + Table.AddColumn("Hostmasks"); Table.AddColumn("Key"); Table.AddColumn("Channels"); for (map::iterator it = m_msUsers.begin(); it != m_msUsers.end(); ++it) { - Table.AddRow(); - Table.SetCell("User", it->second->GetUsername()); - Table.SetCell("Hostmask", it->second->GetHostmasks()); - Table.SetCell("Key", it->second->GetUserKey()); - Table.SetCell("Channels", it->second->GetChannels()); + VCString vsHostmasks; + it->second->GetHostmasks().Split(",", vsHostmasks); + for (unsigned int a = 0; a < vsHostmasks.size(); a++) { + Table.AddRow(); + if(a == 0) { + Table.SetCell("User", it->second->GetUsername()); + Table.SetCell("Key", it->second->GetUserKey()); + Table.SetCell("Channels", it->second->GetChannels()); + } + else if(a == vsHostmasks.size()-1) { + Table.SetCell("User", "`-"); + } + else { + Table.SetCell("User", "|-"); + } + Table.SetCell("Hostmasks", vsHostmasks[a]); + } } PutModule(Table); @@ -344,7 +323,7 @@ public: CString sHostmasks = sLine.Token(2, true); if (sHostmasks.empty()) { - PutModule("Usage: " + sCommand + " [mask] ..."); + PutModule("Usage: " + sCommand + " ,[mask] ..."); return; }