本文整理汇总了C++中CClient::PutClient方法的典型用法代码示例。如果您正苦于以下问题:C++ CClient::PutClient方法的具体用法?C++ CClient::PutClient怎么用?C++ CClient::PutClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClient
的用法示例。
在下文中一共展示了CClient::PutClient方法的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");
}
}
}
vector<CClient*>& vUserClients = m_pUser->GetUserClients();
for (size_t c = 0; c < vUserClients.size(); ++c) {
CClient* pUserClient = vUserClients[c];
if (pUserClient->GetTimeSinceLastDataTransaction() >= 270) {
pUserClient->PutClient("PING :ZNC");
}
}
}
示例2: RunJob
virtual void RunJob() {
vector<CClient*>& vUserClients = m_pUser->GetUserClients();
for (size_t c = 0; c < vUserClients.size(); ++c) {
CClient* pUserClient = vUserClients[c];
if (pUserClient->GetTimeSinceLastDataTransaction() >= CIRCNetwork::PING_FREQUENCY) {
pUserClient->PutClient("PING :ZNC");
}
}
}
示例3: RunJob
virtual void RunJob() {
vector<CClient*>& vClients = m_pUser->GetClients();
CIRCSock* pIRCSock = m_pUser->GetIRCSock();
if (pIRCSock && pIRCSock->GetTimeSinceLastDataTransaction() >= 270) {
pIRCSock->PutIRC("PING :ZNC");
}
for (size_t a = 0; a < vClients.size(); a++) {
CClient* pClient = vClients[a];
if (pClient->GetTimeSinceLastDataTransaction() >= 270) {
pClient->PutClient("PING :ZNC");
}
}
if (m_pUser->IsIRCConnected()) {
m_pUser->JoinChans();
}
}
示例4: ReadLine
void CIRCSock::ReadLine(const CString& sData) {
CString sLine = sData;
sLine.TrimRight("\n\r");
DEBUG("(" << m_pUser->GetUserName() << ") IRC -> ZNC [" << sLine << "]");
MODULECALL(OnRaw(sLine), m_pUser, NULL, return);
if (sLine.Equals("PING ", false, 5)) {
// Generate a reply and don't forward this to any user,
// we don't want any PING forwarded
PutIRC("PONG " + sLine.substr(5));
return;
} else if (sLine.Token(1).Equals("PONG")) {
// Block PONGs, we already responded to the pings
return;
} else if (sLine.Equals("ERROR ", false, 6)) {
//ERROR :Closing Link: nick[24.24.24.24] (Excess Flood)
CString sError(sLine.substr(6));
if (sError.Left(1) == ":") {
sError.LeftChomp();
}
m_pUser->PutStatus("Error from Server [" + sError + "]");
return;
}
CString sCmd = sLine.Token(1);
if ((sCmd.length() == 3) && (isdigit(sCmd[0])) && (isdigit(sCmd[1])) && (isdigit(sCmd[2]))) {
CString sServer = sLine.Token(0); sServer.LeftChomp();
unsigned int uRaw = sCmd.ToUInt();
CString sNick = sLine.Token(2);
CString sRest = sLine.Token(3, true);
switch (uRaw) {
case 1: { // :irc.server.com 001 nick :Welcome to the Internet Relay Network nick
if (m_bAuthed && sServer == "irc.znc.in") {
// m_bAuthed == true => we already received another 001 => we might be in a traffic loop
m_pUser->PutStatus("ZNC seems to be connected to itself, disconnecting...");
Quit();
return;
}
m_pUser->SetIRCServer(sServer);
SetTimeout(240, TMO_READ); // Now that we are connected, let nature take its course
PutIRC("WHO " + sNick);
m_bAuthed = true;
m_pUser->PutStatus("Connected!");
vector<CClient*>& vClients = m_pUser->GetClients();
for (unsigned int a = 0; a < vClients.size(); a++) {
CClient* pClient = vClients[a];
CString sClientNick = pClient->GetNick(false);
if (!sClientNick.Equals(sNick)) {
// If they connected with a nick that doesn't match the one we got on irc, then we need to update them
pClient->PutClient(":" + sClientNick + "!" + m_Nick.GetIdent() + "@" + m_Nick.GetHost() + " NICK :" + sNick);
}
}
SetNick(sNick);
MODULECALL(OnIRCConnected(), m_pUser, NULL, );
m_pUser->ClearRawBuffer();
m_pUser->AddRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
CZNC::Get().ReleaseISpoof();
m_bISpoofReleased = true;
break;
}
case 5:
ParseISupport(sRest);
m_pUser->UpdateExactRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
break;
case 2:
case 3:
case 4:
case 250: // highest connection count
case 251: // user count
case 252: // oper count
case 254: // channel count
case 255: // client count
case 265: // local users
case 266: // global users
m_pUser->UpdateRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
break;
case 305:
m_pUser->SetIRCAway(false);
break;
case 306:
m_pUser->SetIRCAway(true);
break;
case 324: { // MODE
//.........这里部分代码省略.........
示例5: ReadLine
void CIRCSock::ReadLine(const CString& sData) {
CString sLine = sData;
sLine.TrimRight("\n\r");
DEBUG("(" << m_pNetwork->GetUser()->GetUserName() << "/" << m_pNetwork->GetName() << ") IRC -> ZNC [" << sLine << "]");
NETWORKMODULECALL(OnRaw(sLine), m_pNetwork->GetUser(), m_pNetwork, NULL, return);
if (sLine.Equals("PING ", false, 5)) {
// Generate a reply and don't forward this to any user,
// we don't want any PING forwarded
PutIRC("PONG " + sLine.substr(5));
return;
} else if (sLine.Token(1).Equals("PONG")) {
// Block PONGs, we already responded to the pings
return;
} else if (sLine.Equals("ERROR ", false, 6)) {
//ERROR :Closing Link: nick[24.24.24.24] (Excess Flood)
CString sError(sLine.substr(6));
sError.TrimPrefix();
m_pNetwork->PutStatus("Error from Server [" + sError + "]");
return;
}
CString sCmd = sLine.Token(1);
if ((sCmd.length() == 3) && (isdigit(sCmd[0])) && (isdigit(sCmd[1])) && (isdigit(sCmd[2]))) {
CString sServer = sLine.Token(0).LeftChomp_n();
unsigned int uRaw = sCmd.ToUInt();
CString sNick = sLine.Token(2);
CString sRest = sLine.Token(3, true);
switch (uRaw) {
case 1: { // :irc.server.com 001 nick :Welcome to the Internet Relay Network nick
if (m_bAuthed && sServer == "irc.znc.in") {
// m_bAuthed == true => we already received another 001 => we might be in a traffic loop
m_pNetwork->PutStatus("ZNC seems to be connected to itself, disconnecting...");
Quit();
return;
}
m_pNetwork->SetIRCServer(sServer);
SetTimeout(540, TMO_READ); // Now that we are connected, let nature take its course
PutIRC("WHO " + sNick);
m_bAuthed = true;
m_pNetwork->PutStatus("Connected!");
vector<CClient*>& vClients = m_pNetwork->GetClients();
for (unsigned int a = 0; a < vClients.size(); a++) {
CClient* pClient = vClients[a];
CString sClientNick = pClient->GetNick(false);
if (!sClientNick.Equals(sNick)) {
// If they connected with a nick that doesn't match the one we got on irc, then we need to update them
pClient->PutClient(":" + sClientNick + "!" + m_Nick.GetIdent() + "@" + m_Nick.GetHost() + " NICK :" + sNick);
}
}
SetNick(sNick);
NETWORKMODULECALL(OnIRCConnected(), m_pNetwork->GetUser(), m_pNetwork, NULL, NOTHING);
m_pNetwork->ClearRawBuffer();
m_pNetwork->AddRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
break;
}
case 5:
ParseISupport(sRest);
m_pNetwork->UpdateExactRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
break;
case 10: { // :irc.server.com 010 nick <hostname> <port> :<info>
CString sHost = sRest.Token(0);
CString sPort = sRest.Token(1);
CString sInfo = sRest.Token(2, true).TrimPrefix_n();
m_pNetwork->PutStatus("Server [" + m_pNetwork->GetCurrentServer()->GetString(false) +
"] redirects us to [" + sHost + ":" + sPort + "] with reason [" + sInfo + "]");
m_pNetwork->PutStatus("Perhaps you want to add it as a new server.");
// Don't send server redirects to the client
return;
}
case 2:
case 3:
case 4:
case 250: // highest connection count
case 251: // user count
case 252: // oper count
case 254: // channel count
case 255: // client count
case 265: // local users
case 266: // global users
m_pNetwork->UpdateRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest);
break;
case 305:
m_pNetwork->SetIRCAway(false);
break;
case 306:
//.........这里部分代码省略.........