本文整理汇总了C++中PutIRC函数的典型用法代码示例。如果您正苦于以下问题:C++ PutIRC函数的具体用法?C++ PutIRC怎么用?C++ PutIRC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PutIRC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PutIRC
bool TwitchGroupChat::OnLoad(const CString& sArgsi, CString& sMessage)
{
PutIRC("CAP REQ :twitch.tv/commands");
PutIRC("CAP REQ :twitch.tv/tags");
return true;
}
示例2: strlen
void CIRCNetwork::JoinChans(set<CChan*>& sChans) {
CString sKeys, sJoin;
bool bHaveKey = false;
size_t uiJoinLength = strlen("JOIN ");
while (!sChans.empty()) {
set<CChan*>::iterator it = sChans.begin();
const CString& sName = (*it)->GetName();
const CString& sKey = (*it)->GetKey();
size_t len = sName.length() + sKey.length();
len += 2; // two comma
if (!sKeys.empty() && uiJoinLength + len >= 512)
break;
if (!sJoin.empty()) {
sJoin += ",";
sKeys += ",";
}
uiJoinLength += len;
sJoin += sName;
if (!sKey.empty()) {
sKeys += sKey;
bHaveKey = true;
}
sChans.erase(it);
}
if (bHaveKey)
PutIRC("JOIN " + sJoin + " " + sKeys);
else
PutIRC("JOIN " + sJoin);
}
示例3: OverrideCommand
void OverrideCommand(const CString& sLine) {
m_bTemporaryAcceptMotd = true;
const CString sServer = sLine.Token(1);
if (sServer.empty()) {
PutIRC("motd");
} else {
PutIRC("motd " + sServer);
}
}
示例4: Authenticate
void Authenticate(const CString& sLine) {
if (m_Mechanisms.GetCurrent().Equals("PLAIN") && sLine.Equals("+")) {
CString sAuthLine = GetNV("username") + '\0' + GetNV("username") +
'\0' + GetNV("password");
sAuthLine.Base64Encode();
PutIRC("AUTHENTICATE " + sAuthLine);
} else {
/* Send blank authenticate for other mechanisms (like EXTERNAL). */
PutIRC("AUTHENTICATE +");
}
}
示例5: OnUserCTCP
virtual EModRet OnUserCTCP(CString& sTarget, CString& sMessage) {
if (sMessage.Equals("DCC ", false, 4)) {
CString sType = sMessage.Token(1);
CString sFile = sMessage.Token(2);
unsigned long uLongIP = sMessage.Token(3).ToULong();
unsigned short uPort = sMessage.Token(4).ToUShort();
unsigned long uFileSize = sMessage.Token(5).ToULong();
CString sIP = GetLocalDCCIP();
if (!UseClientIP()) {
uLongIP = CUtils::GetLongIP(m_pClient->GetRemoteIP());
}
if (sType.Equals("CHAT")) {
unsigned short uBNCPort = CDCCBounce::DCCRequest(sTarget, uLongIP, uPort, "", true, this, "");
if (uBNCPort) {
PutIRC("PRIVMSG " + sTarget + " :\001DCC CHAT chat " + CString(CUtils::GetLongIP(sIP)) + " " + CString(uBNCPort) + "\001");
}
} else if (sType.Equals("SEND")) {
// DCC SEND readme.txt 403120438 5550 1104
unsigned short uBNCPort = CDCCBounce::DCCRequest(sTarget, uLongIP, uPort, sFile, false, this, "");
if (uBNCPort) {
PutIRC("PRIVMSG " + sTarget + " :\001DCC SEND " + sFile + " " + CString(CUtils::GetLongIP(sIP)) + " " + CString(uBNCPort) + " " + CString(uFileSize) + "\001");
}
} else if (sType.Equals("RESUME")) {
// PRIVMSG user :DCC RESUME "znc.o" 58810 151552
unsigned short uResumePort = sMessage.Token(3).ToUShort();
set<CSocket*>::const_iterator it;
for (it = BeginSockets(); it != EndSockets(); ++it) {
CDCCBounce* pSock = (CDCCBounce*) *it;
if (pSock->GetLocalPort() == uResumePort) {
PutIRC("PRIVMSG " + sTarget + " :\001DCC " + sType + " " + sFile + " " + CString(pSock->GetUserPort()) + " " + sMessage.Token(4) + "\001");
}
}
} else if (sType.Equals("ACCEPT")) {
// Need to lookup the connection by port, filter the port, and forward to the user
set<CSocket*>::const_iterator it;
for (it = BeginSockets(); it != EndSockets(); ++it) {
CDCCBounce* pSock = (CDCCBounce*) *it;
if (pSock->GetUserPort() == sMessage.Token(3).ToUShort()) {
PutIRC("PRIVMSG " + sTarget + " :\001DCC " + sType + " " + sFile + " " + CString(pSock->GetLocalPort()) + " " + sMessage.Token(4) + "\001");
}
}
}
return HALTCORE;
}
return CONTINUE;
}
示例6: Close
void CIRCSock::Quit(const CString& sQuitMsg) {
if (!m_bAuthed) {
Close(CLT_NOW);
return;
}
if (!sQuitMsg.empty()) {
PutIRC("QUIT :" + sQuitMsg);
} else {
PutIRC("QUIT :" + m_pNetwork->ExpandString(m_pNetwork->GetUser()->GetQuitMsg()));
}
Close(CLT_AFTERWRITE);
}
示例7: OnIRCRegistration
virtual EModRet OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName) {
CString fake = GetFake(m_pUser->GetUserName());
PutIRC("WEBIRC " + m_pPass + " ZNC " + CleanHostname(m_pUser->GetCleanUserName()) + CGIIRC_HOSTNAME_SUFFIX + " " + fake);
sIdent = m_pUser->GetCleanUserName();
return CONTINUE;
}
示例8: OnUserNotice
EModRet OnUserNotice(CString& sTarget, CString& sMessage) override {
sTarget.TrimPrefix(NickPrefix());
if (sMessage.TrimPrefix("``")) {
return CONTINUE;
}
MCString::iterator it = FindNV(sTarget.AsLower());
if (it != EndNV()) {
CChan* pChan = GetNetwork()->FindChan(sTarget);
CString sNickMask = GetNetwork()->GetIRCNick().GetNickMask();
if (pChan) {
if (!pChan->AutoClearChanBuffer())
pChan->AddBuffer(":" + NickPrefix() + _NAMEDFMT(sNickMask) + " NOTICE " + _NAMEDFMT(sTarget) + " :{text}", sMessage);
GetUser()->PutUser(":" + NickPrefix() + sNickMask + " NOTICE " + sTarget + " :" + sMessage, NULL, GetClient());
}
CString sMsg = MakeIvec() + sMessage;
sMsg.Encrypt(it->second);
sMsg.Base64Encode();
sMsg = "+OK *" + sMsg;
PutIRC("NOTICE " + sTarget + " :" + sMsg);
return HALTCORE;
}
return CONTINUE;
}
示例9: SetBack
void SetBack() {
RemTimer("simple_away");
if (m_bWeSetAway) {
PutIRC("AWAY");
m_bWeSetAway = false;
}
}
示例10: OnModCommand
virtual void OnModCommand( const CString& sCommand )
{
CString sCmdName = sCommand.Token(0).AsLower();
if(sCmdName == "set") {
CString sPass = sCommand.Token(1, true) + " ";
m_sAuth = sPass;
PutModule("Auth set");
} else if(sCmdName == "auth") {
if (m_sAuth.empty())
PutModule("No auth set");
else {
PutIRC("PRIVMSG [email protected] :auth " + m_sAuth);
PutModule("Authing!");
}
} else if(sCmdName == "show") {
if (m_sAuth.empty())
PutModule("No auth set");
else
PutModule("Current user and password: " + m_sAuth);
} else if(sCmdName == "save") {
SetNV("Auth", m_sAuth);
PutModule("Saved!");
} else {
PutModule("Commands: set <user password>, show, save");
}
}
示例11: Cloak
void Cloak() {
if (m_bCloaked)
return;
PutModule("Cloak: Trying to cloak your hostname, setting +x...");
PutIRC("MODE " + GetUser()->GetIRCSock()->GetNick() + " +x");
}
示例12: SendRequest
void SendRequest() {
requestQueue::iterator it;
if (m_pDoing || m_pReplies) return;
if (m_vsPending.empty()) return;
it = m_vsPending.begin();
if (it->second.empty()) {
m_vsPending.erase(it);
SendRequest();
return;
}
// When we are called from the timer, we need to remove it.
// We can't delete it (segfault on return), thus we
// just stop it. The main loop will delete it.
CTimer* pTimer = FindTimer("RouteTimeout");
if (pTimer) {
pTimer->Stop();
UnlinkTimer(pTimer);
}
AddTimer(
new CRouteTimeout(this, 60, 1, "RouteTimeout",
"Recover from missing / wrong server replies"));
m_pDoing = it->first;
m_pReplies = it->second[0].reply;
m_sLastRequest = it->second[0].sLine;
PutIRC(it->second[0].sLine);
it->second.erase(it->second.begin());
}
示例13: Authenticate
void Authenticate(const CString& sLine) {
if (m_Mechanisms.GetCurrent().Equals("PLAIN") && sLine.Equals("+")) {
CString sAuthLine = GetNV("username") + '\0' + GetNV("username") + '\0' + GetNV("password");
sAuthLine.Base64Encode();
PutIRC("AUTHENTICATE " + sAuthLine);
#ifdef HAVE_SASL_MECHANISM
} else if (m_Mechanisms.GetCurrent().Equals("DH-BLOWFISH")) {
AuthenticateBlowfish(sLine);
} else if (m_Mechanisms.GetCurrent().Equals("DH-AES")) {
AuthenticateAES(sLine);
#endif
} else {
/* Send blank authenticate for other mechanisms (like EXTERNAL). */
PutIRC("AUTHENTICATE +");
}
}
示例14: RunJob
virtual void RunJob()
{
if (!m_pUser->GetIRCSock())
return;
for (MCString::iterator it = BeginNV(); it != EndNV(); ++it)
{
CChan *pChan = m_pUser->FindChan(it->first);
if (!pChan) {
pChan = new CChan(it->first, m_pUser, true);
if (!it->second.empty())
pChan->SetKey(it->second);
if (!m_pUser->AddChan(pChan)) {
/* AddChan() deleted that channel */
PutModule("Could not join [" + it->first
+ "] (# prefix missing?)");
continue;
}
}
if (!pChan->IsOn()) {
PutModule("Joining [" + pChan->GetName() + "]");
PutIRC("JOIN " + pChan->GetName() + (pChan->GetKey().empty()
? "" : " " + pChan->GetKey()));
}
}
}
示例15: HandleMessage
void HandleMessage(CNick& Nick, const CString& sMessage) {
CString sNickServName = (!GetNV("NickServName").empty())
? GetNV("NickServName")
: "NickServ";
if (!GetNV("Password").empty() && Nick.NickEquals(sNickServName) &&
(sMessage.find("msg") != CString::npos ||
sMessage.find("authenticate") != CString::npos ||
sMessage.find("choose a different nickname") != CString::npos ||
sMessage.find("please choose a different nick") != CString::npos ||
sMessage.find("If this is your nick, identify yourself with") !=
CString::npos ||
sMessage.find("If this is your nick, type") != CString::npos ||
sMessage.find("This is a registered nickname, please identify") !=
CString::npos ||
sMessage.StripControls_n().find(
"type /NickServ IDENTIFY password") != CString::npos ||
sMessage.StripControls_n().find(
"type /msg NickServ IDENTIFY password") != CString::npos) &&
sMessage.AsUpper().find("IDENTIFY") != CString::npos &&
sMessage.find("help") == CString::npos) {
MCString msValues;
msValues["password"] = GetNV("Password");
PutIRC(CString::NamedFormat(GetNV("IdentifyCmd"), msValues));
}
}