本文整理汇总了C++中CIRCNetwork::GetIRCSock方法的典型用法代码示例。如果您正苦于以下问题:C++ CIRCNetwork::GetIRCSock方法的具体用法?C++ CIRCNetwork::GetIRCSock怎么用?C++ CIRCNetwork::GetIRCSock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIRCNetwork
的用法示例。
在下文中一共展示了CIRCNetwork::GetIRCSock方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunJob
virtual void RunJob() {
vector<CIRCNetwork*> vNetworks = m_pUser->GetNetworks();
for (size_t a = 0; a < vNetworks.size(); a++) {
CIRCNetwork* pNetwork = vNetworks[a];
CIRCSock* pIRCSock = pNetwork->GetIRCSock();
if (pIRCSock && pIRCSock->GetTimeSinceLastDataTransaction() >= 270) {
pIRCSock->PutIRC("PING :ZNC");
}
if (pNetwork->IsIRCConnected()) {
pNetwork->JoinChans();
}
vector<CClient*>& vClients = pNetwork->GetClients();
for (size_t b = 0; b < vClients.size(); b++) {
CClient* pClient = vClients[b];
if (pClient->GetTimeSinceLastDataTransaction() >= 270) {
pClient->PutClient("PING :ZNC");
}
}
}
}
示例2: Block
bool Block(const CString& sUser) {
CUser *pUser = CZNC::Get().FindUser(sUser);
if (!pUser)
return false;
// Disconnect all clients
vector<CClient*> vpClients = pUser->GetAllClients();
vector<CClient*>::iterator it;
for (it = vpClients.begin(); it != vpClients.end(); ++it) {
(*it)->PutStatusNotice(MESSAGE);
(*it)->Close(Csock::CLT_AFTERWRITE);
}
// Disconnect all networks from irc
vector<CIRCNetwork*> vNetworks = pUser->GetNetworks();
for (vector<CIRCNetwork*>::iterator it2 = vNetworks.begin(); it2 != vNetworks.end(); ++it2) {
CIRCNetwork *pNetwork = *it2;
CIRCSock *pIRCSock = pNetwork->GetIRCSock();
if (pIRCSock) {
pIRCSock->Quit();
}
}
// ...and don't reconnect
pUser->SetIRCConnectEnabled(false);
SetNV(pUser->GetUserName(), "");
return true;
}
示例3: RunJob
virtual void RunJob()
{
CIRCNetwork* pNetwork = GetNetwork();
if (!pNetwork->GetIRCSock())
return;
for (MCString::iterator it = BeginNV(); it != EndNV(); ++it)
{
CChan *pChan = pNetwork->FindChan(it->first);
if (!pChan) {
pChan = new CChan(it->first, pNetwork, true);
if (!it->second.empty())
pChan->SetKey(it->second);
if (!pNetwork->AddChan(pChan)) {
/* AddChan() deleted that channel */
PutModule("Could not join [" + it->first
+ "] (# prefix missing?)");
continue;
}
}
if (!pChan->IsOn() && pNetwork->IsIRCConnected()) {
PutModule("Joining [" + pChan->GetName() + "]");
PutIRC("JOIN " + pChan->GetName() + (pChan->GetKey().empty()
? "" : " " + pChan->GetKey()));
}
}
}
示例4: GetLocalDCCIP
CString CUser::GetLocalDCCIP() {
if (!GetDCCBindHost().empty())
return GetDCCBindHost();
for (vector<CIRCNetwork*>::iterator it = m_vIRCNetworks.begin(); it != m_vIRCNetworks.end(); ++it) {
CIRCNetwork *pNetwork = *it;
CIRCSock* pIRCSock = pNetwork->GetIRCSock();
if (pIRCSock) {
return pIRCSock->GetLocalIP();
}
}
if (!GetAllClients().empty()) {
return GetAllClients()[0]->GetLocalIP();
}
return "";
}
示例5: UserCommand
void CClient::UserCommand(CString& sLine) {
if (!m_pUser) {
return;
}
if (sLine.empty()) {
return;
}
NETWORKMODULECALL(OnStatusCommand(sLine), m_pUser, m_pNetwork, this, return);
const CString sCommand = sLine.Token(0);
if (sCommand.Equals("HELP")) {
HelpUser();
} else if (sCommand.Equals("LISTNICKS")) {
if (!m_pNetwork) {
PutStatus("You must be connected with a network to use this command");
return;
}
CString sChan = sLine.Token(1);
if (sChan.empty()) {
PutStatus("Usage: ListNicks <#chan>");
return;
}
CChan* pChan = m_pNetwork->FindChan(sChan);
if (!pChan) {
PutStatus("You are not on [" + sChan + "]");
return;
}
if (!pChan->IsOn()) {
PutStatus("You are not on [" + sChan + "] [trying]");
return;
}
const map<CString,CNick>& msNicks = pChan->GetNicks();
CIRCSock* pIRCSock = m_pNetwork->GetIRCSock();
const CString& sPerms = (pIRCSock) ? pIRCSock->GetPerms() : "";
if (!msNicks.size()) {
PutStatus("No nicks on [" + sChan + "]");
return;
}
CTable Table;
for (unsigned int p = 0; p < sPerms.size(); p++) {
CString sPerm;
sPerm += sPerms[p];
Table.AddColumn(sPerm);
}
Table.AddColumn("Nick");
Table.AddColumn("Ident");
Table.AddColumn("Host");
for (map<CString,CNick>::const_iterator a = msNicks.begin(); a != msNicks.end(); ++a) {
Table.AddRow();
for (unsigned int b = 0; b < sPerms.size(); b++) {
if (a->second.HasPerm(sPerms[b])) {
CString sPerm;
sPerm += sPerms[b];
Table.SetCell(sPerm, sPerm);
}
}
Table.SetCell("Nick", a->second.GetNick());
Table.SetCell("Ident", a->second.GetIdent());
Table.SetCell("Host", a->second.GetHost());
}
PutStatus(Table);
} else if (sCommand.Equals("DETACH")) {
if (!m_pNetwork) {
PutStatus("You must be connected with a network to use this command");
return;
}
CString sChan = sLine.Token(1);
if (sChan.empty()) {
PutStatus("Usage: Detach <#chan>");
return;
}
const vector<CChan*>& vChans = m_pNetwork->GetChans();
vector<CChan*>::const_iterator it;
unsigned int uMatches = 0, uDetached = 0;
for (it = vChans.begin(); it != vChans.end(); ++it) {
if (!(*it)->GetName().WildCmp(sChan))
continue;
uMatches++;
if ((*it)->IsDetached())
//.........这里部分代码省略.........