本文整理汇总了C++中VCString类的典型用法代码示例。如果您正苦于以下问题:C++ VCString类的具体用法?C++ VCString怎么用?C++ VCString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VCString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DelChans
void DelChans(const CString& sChans) {
VCString vsChans;
sChans.Split(" ", vsChans);
for (unsigned int a = 0; a < vsChans.size(); a++) {
m_ssChans.erase(vsChans[a].AsLower());
}
}
开发者ID:sorbits,项目名称:znc,代码行数:8,代码来源:autovoice.cpp
示例2: JoinRules
CString CLogMod::JoinRules(const CString& sSeparator) const
{
VCString vsRules;
for (const CLogRule& Rule : m_vRules) {
vsRules.push_back(Rule.ToString());
}
return sSeparator.Join(vsRules.begin(), vsRules.end());
}
开发者ID:James-TR,项目名称:znc,代码行数:9,代码来源:log.cpp
示例3: OnJoinMessage
bool CClient::OnJoinMessage(CJoinMessage& Message) {
CString sChans = Message.GetTarget();
CString sKeys = Message.GetKey();
VCString vsChans;
sChans.Split(",", vsChans, false);
sChans.clear();
VCString vsKeys;
sKeys.Split(",", vsKeys, true);
sKeys.clear();
for (unsigned int a = 0; a < vsChans.size(); a++) {
Message.SetTarget(vsChans[a]);
Message.SetKey((a < vsKeys.size()) ? vsKeys[a] : "");
if (m_pNetwork) {
// May be nullptr.
Message.SetChan(m_pNetwork->FindChan(vsChans[a]));
}
bool bContinue = false;
NETWORKMODULECALL(OnUserJoinMessage(Message), m_pUser, m_pNetwork, this,
&bContinue);
if (bContinue) continue;
CString sChannel = Message.GetTarget();
CString sKey = Message.GetKey();
if (m_pNetwork) {
CChan* pChan = m_pNetwork->FindChan(sChannel);
if (pChan) {
if (pChan->IsDetached())
pChan->AttachUser(this);
else
pChan->JoinUser(sKey);
continue;
} else if (!sChannel.empty()) {
pChan = new CChan(sChannel, m_pNetwork, false);
if (m_pNetwork->AddChan(pChan)) {
pChan->SetKey(sKey);
}
}
}
if (!sChannel.empty()) {
sChans += (sChans.empty()) ? sChannel : CString("," + sChannel);
if (!vsKeys.empty()) {
sKeys += (sKeys.empty()) ? sKey : CString("," + sKey);
}
}
}
Message.SetTarget(sChans);
Message.SetKey(sKeys);
return sChans.empty();
}
开发者ID:bradleysepos,项目名称:znc,代码行数:57,代码来源:Client.cpp
示例4: ParseURI
void CHTTPSock::ReadLine(const CString& sData) {
if (m_bGotHeader) {
return;
}
CString sLine = sData;
sLine.TrimRight("\r\n");
CString sName = sLine.Token(0);
if (sName.Equals("GET")) {
m_bPost = false;
m_sURI = sLine.Token(1);
m_bHTTP10Client = sLine.Token(2).Equals("HTTP/1.0");
ParseURI();
} else if (sName.Equals("POST")) {
m_bPost = true;
m_sURI = sLine.Token(1);
ParseURI();
} else if (sName.Equals("Cookie:")) {
VCString vsNV;
sLine.Token(1, true).Split(";", vsNV, false, "", "", true, true);
for (unsigned int a = 0; a < vsNV.size(); a++) {
CString s(vsNV[a]);
m_msRequestCookies[s.Token(0, false, "=").Escape_n(CString::EURL, CString::EASCII)] =
s.Token(1, true, "=").Escape_n(CString::EURL, CString::EASCII);
}
} else if (sName.Equals("Authorization:")) {
CString sUnhashed;
sLine.Token(2).Base64Decode(sUnhashed);
m_sUser = sUnhashed.Token(0, false, ":");
m_sPass = sUnhashed.Token(1, true, ":");
m_bLoggedIn = OnLogin(m_sUser, m_sPass);
} else if (sName.Equals("Content-Length:")) {
m_uPostLen = sLine.Token(1).ToULong();
if (m_uPostLen > MAX_POST_SIZE)
PrintErrorPage(413, "Request Entity Too Large", "The request you sent was too large.");
} else if (sName.Equals("If-None-Match:")) {
// this is for proper client cache support (HTTP 304) on static files:
m_sIfNoneMatch = sLine.Token(1, true);
} else if (sLine.empty()) {
m_bGotHeader = true;
if (m_bPost) {
m_sPostData = GetInternalReadBuffer();
CheckPost();
} else {
GetPage();
}
DisableReadLine();
}
}
开发者ID:NeilHanlon,项目名称:znc,代码行数:56,代码来源:HTTPSock.cpp
示例5: ParseISupport
void CIRCSock::ParseISupport(const CMessage& Message) {
const VCString vsParams = Message.GetParams();
for (size_t i = 1; i < vsParams.size() - 1; ++i) {
const CString& sParam = vsParams[i];
CString sName = sParam.Token(0, false, "=");
CString sValue = sParam.Token(1, true, "=");
if (0 < sName.length() && ':' == sName[0]) {
break;
}
m_mISupport[sName] = sValue;
if (sName.Equals("PREFIX")) {
CString sPrefixes = sValue.Token(1, false, ")");
CString sPermModes = sValue.Token(0, false, ")");
sPermModes.TrimLeft("(");
if (!sPrefixes.empty() && sPermModes.size() == sPrefixes.size()) {
m_sPerms = sPrefixes;
m_sPermModes = sPermModes;
}
} else if (sName.Equals("CHANTYPES")) {
m_pNetwork->SetChanPrefixes(sValue);
} else if (sName.Equals("NICKLEN")) {
unsigned int uMax = sValue.ToUInt();
if (uMax) {
m_uMaxNickLen = uMax;
}
} else if (sName.Equals("CHANMODES")) {
if (!sValue.empty()) {
m_mueChanModes.clear();
for (unsigned int a = 0; a < 4; a++) {
CString sModes = sValue.Token(a, false, ",");
for (unsigned int b = 0; b < sModes.size(); b++) {
m_mueChanModes[sModes[b]] = (EChanModeArgs) a;
}
}
}
} else if (sName.Equals("NAMESX")) {
if (m_bNamesx)
continue;
m_bNamesx = true;
PutIRC("PROTOCTL NAMESX");
} else if (sName.Equals("UHNAMES")) {
if (m_bUHNames)
continue;
m_bUHNames = true;
PutIRC("PROTOCTL UHNAMES");
}
}
}
开发者ID:qermit,项目名称:znc,代码行数:56,代码来源:IRCSock.cpp
示例6: GetDirs
void CWebSock::SetPaths(CModule* pModule, bool bIsTemplate) {
m_Template.ClearPaths();
VCString vsDirs = GetDirs(pModule, bIsTemplate);
for (size_t i = 0; i < vsDirs.size(); ++i) {
m_Template.AppendPath(vsDirs[i]);
}
m_bPathsSet = true;
}
开发者ID:notry4n,项目名称:znc,代码行数:10,代码来源:WebModules.cpp
示例7: SplitRules
void CLogMod::SetRulesCmd(const CString& sLine) {
VCString vsRules = SplitRules(sLine.Token(1, true));
if (vsRules.empty()) {
PutModule("Usage: SetRules <rules>");
PutModule("Wildcards are allowed");
} else {
SetRules(vsRules);
SetNV("rules", JoinRules(","));
ListRulesCmd();
}
}
开发者ID:Adam-,项目名称:znc,代码行数:12,代码来源:log.cpp
示例8: CheckLineForLink
void CUrlBufferModule::CheckLineForLink(const CString& sMessage, const CString& sOrigin)
{
if(sOrigin != m_pUser->GetUserName() && GetNV("enable").ToBool() )
{
VCString words;
CString output;
sMessage.Split(" ", words, false, "", "", true, true);
for (size_t a = 0; a < words.size(); a++)
{
CString& word = words[a];
if(word.Left(4) == "http" || word.Left(4) == "www.")
{
//if you find an image download it, save it in the www directory and keep the new link in buffer
VCString tokens;
word.Split("/", tokens, false, "", "", true, true);
CString name = tokens[tokens.size()-1];
word.Split(".", tokens, false, "", "", true, true);
//if it's an image link download/upload it else just keep the link
time_t curtime;
time(&curtime);
CString dir = GetNV("directory") + CUtils::FormatTime(curtime,"%Y-%m-%d", m_pUser->GetTimezone()) + "/";
CString nickname = (sOrigin.empty())? m_pUser->GetUserName() : sOrigin;
if(!CFile::Exists(dir) && !CFile::IsDir(dir, false))
{
CDir::MakeDir(dir, 0775);
}
if(isValidExtension( tokens[tokens.size()-1] ))
{
std::stringstream ss;
if( GetNV("enablelocal").ToBool())
{
ss << "wget -b -O " << dir.c_str() << name <<" -q " << word.c_str() << " 2>&1";
getStdoutFromCommand(ss.str());
}
ss.str("");
if (!word.WildCmp("*imgur*") && GetNV("reupload").ToBool()) {
ss << "curl -d \"image=" << word.c_str() << "\" -d \"key=5ce86e7f95d8e58b18931bf290f387be\" http://api.imgur.com/2/upload.xml | sed -n 's/.*<original>\\(.*\\)<\\/original>.*/\\1/p' 2>&1";
output = getStdoutFromCommand(ss.str());
lastUrls.push_back(output);
} else {
lastUrls.push_back(word);
}
} else if(GetNV("bufferalllinks").ToBool()){
lastUrls.push_back(word);
//append nick:link to file
CString filename = dir + "links.txt";
std::ofstream log(filename.c_str() , std::ios_base::app | std::ios_base::out);
log << nickname << ": " << word << "\n";
}
nicks.push_back( nickname );
}
}
}
}
开发者ID:ChaoticDividend,项目名称:znc-modules,代码行数:57,代码来源:urlbuffer.cpp
示例9: ParseParams
void CHTTPSock::ParseParams(const CString& sParams, map<CString, VCString> &msvsParams) {
msvsParams.clear();
VCString vsPairs;
sParams.Split("&", vsPairs, true);
for (unsigned int a = 0; a < vsPairs.size(); a++) {
const CString& sPair = vsPairs[a];
CString sName = sPair.Token(0, false, "=").Escape_n(CString::EURL, CString::EASCII);
CString sValue = sPair.Token(1, true, "=").Escape_n(CString::EURL, CString::EASCII);
msvsParams[sName].push_back(sValue);
}
}
开发者ID:NeilHanlon,项目名称:znc,代码行数:14,代码来源:HTTPSock.cpp
示例10: SHCreateDirectoryEx
bool CDir::MakeDir(const CString& sPath, mode_t iMode) {
#ifdef _WIN32
if (sPath.empty())
return false;
CString sFixedPath = sPath;
sFixedPath.Replace("/", "\\");
int iResult = SHCreateDirectoryEx(0, sFixedPath.c_str(), NULL);
return (iResult == ERROR_SUCCESS || iResult == ERROR_FILE_EXISTS || iResult == ERROR_ALREADY_EXISTS);
#else
CString sDir;
VCString dirs;
VCString::iterator it;
// Just in case someone tries this...
if (sPath.empty())
return false;
// If this is an absolute path, we need to handle this now!
if (sPath.Left(1) == "/")
sDir = "/";
// For every single subpath, do...
sPath.Split("/", dirs, false);
for (it = dirs.begin(); it != dirs.end(); ++it) {
// Add this to the path we already created
sDir += *it;
int i = mkdir(sDir.c_str(), iMode);
if (i != 0) {
// All errors except EEXIST are fatal
if (errno != EEXIST)
return false;
// If it's EEXIST we have to make sure it's a dir
if (!CFile::IsDir(sDir))
return false;
}
sDir += "/";
}
// All went well
return true;
#endif
}
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:49,代码来源:FileUtils.cpp
示例11: AddNicks
int CChan::AddNicks(const CString& sNicks) {
int iRet = 0;
VCString vsNicks;
VCString::iterator it;
sNicks.Split(" ", vsNicks, false);
for (it = vsNicks.begin(); it != vsNicks.end(); ++it) {
if (AddNick(*it)) {
iRet++;
}
}
return iRet;
}
开发者ID:jimloco,项目名称:znc,代码行数:15,代码来源:Chan.cpp
示例12: BootStrap
bool BootStrap(CChan *pChan)
{
CString sFile;
if (DecryptChannel(pChan->GetName(), sFile))
{
if (!pChan->GetBuffer().IsEmpty())
return(true); // reloaded a module probably in this case, so just verify we can decrypt the file
VCString vsLines;
VCString::iterator it;
sFile.Split("\n", vsLines);
for (it = vsLines.begin(); it != vsLines.end(); ++it) {
CString sLine(*it);
sLine.Trim();
if (sLine[0] == '@' && it+1 != vsLines.end())
{
CString sTimestamp = sLine.Token(0);
sTimestamp.TrimLeft("@");
timeval ts;
ts.tv_sec = sTimestamp.Token(0, false, ",").ToLongLong();
ts.tv_usec = sTimestamp.Token(1, false, ",").ToLong();
CString sFormat = sLine.Token(1, true);
CString sText(*++it);
sText.Trim();
pChan->AddBuffer(sFormat, sText, &ts);
} else
{
// Old format, escape the line and use as is.
pChan->AddBuffer(_NAMEDFMT(sLine));
}
}
} else
{
m_sPassword = "";
CUtils::PrintError("[" + GetModName() + ".so] Failed to Decrypt [" + pChan->GetName() + "]");
return(false);
}
return(true);
}
开发者ID:FooBarWidget,项目名称:znc,代码行数:45,代码来源:savebuff.cpp
示例13: OnLoad
virtual bool OnLoad(const CString& sArgs, CString& sMessage) {
VCString vsChans;
sArgs.Split(" ", vsChans, false);
for (VCString::const_iterator it = vsChans.begin(); it != vsChans.end(); ++it) {
if (!Add(*it)) {
PutModule("Unable to add [" + *it + "]");
}
}
// Load our saved settings, ignore errors
MCString::iterator it;
for (it = BeginNV(); it != EndNV(); ++it) {
Add(it->first);
}
return true;
}
开发者ID:stevestreza,项目名称:ZNC-Node,代码行数:18,代码来源:autoattach.cpp
示例14: GetParamValues
size_t CHTTPSock::GetParamValues(const CString& sName, VCString& vsRet, const map<CString, VCString>& msvsParams, const CString& sFilter) {
vsRet.clear();
map<CString, VCString>::const_iterator it = msvsParams.find(sName);
if (it != msvsParams.end()) {
for (CString sParam : it->second) {
sParam.Trim();
for (size_t i = 0; i < sFilter.length(); i++) {
sParam.Replace(CString(sFilter.at(i)), "");
}
vsRet.push_back(sParam);
}
}
return vsRet.size();
}
开发者ID:KielBNC,项目名称:znc,代码行数:18,代码来源:HTTPSock.cpp
示例15: OnLoad
bool CStickyChan::OnLoad(const CString& sArgs, CString& sMessage)
{
VCString vsChans;
VCString::iterator it;
sArgs.Split(",", vsChans, false);
for (it = vsChans.begin(); it != vsChans.end(); ++it) {
CString sChan = it->Token(0);
CString sKey = it->Token(1, true);
SetNV(sChan, sKey);
}
// Since we now have these channels added, clear the argument list
SetArgs("");
AddTimer(RunTimer, "StickyChanTimer", 15);
return(true);
}
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:18,代码来源:stickychan.cpp
示例16: OnUserRaw
virtual EModRet OnUserRaw(CString& sLine) {
//Handle ISON
if (sLine.Token(0).Equals("ison")) {
VCString vsNicks;
VCString::const_iterator it;
// Get the list of nicks which are being asked for
sLine.Token(1, true).TrimLeft_n(":").Split(" ", vsNicks, false);
CString sBNCNicks;
for (it = vsNicks.begin(); it != vsNicks.end(); ++it) {
if (IsOnlineModNick(*it)) {
sBNCNicks += " " + *it;
}
}
// Remove the leading space
sBNCNicks.LeftChomp();
if (!m_pNetwork->GetIRCSock()) {
// if we are not connected to any IRC server, send
// an empty or module-nick filled response.
PutUser(":irc.znc.in 303 " + m_pClient->GetNick() + " :" + sBNCNicks);
} else {
// We let the server handle this request and then act on
// the 303 response from the IRC server.
m_ISONRequests.push_back(sBNCNicks);
}
}
//Handle WHOIS
if (sLine.Token(0).Equals("whois")) {
CString sNick = sLine.Token(1);
if (IsOnlineModNick(sNick)) {
PutUser(":znc.in 311 " + m_pNetwork->GetCurNick() + " " + sNick + " " + sNick + " znc.in * :" + sNick);
PutUser(":znc.in 312 " + m_pNetwork->GetCurNick() + " " + sNick + " *.znc.in :Bouncer");
PutUser(":znc.in 318 " + m_pNetwork->GetCurNick() + " " + sNick + " :End of /WHOIS list.");
return HALT;
}
}
return CONTINUE;
}
开发者ID:KTE,项目名称:znc,代码行数:44,代码来源:fakeonline.cpp
示例17: Replay
void Replay(const CString & sChan)
{
CString sFile;
PutUser(":***[email protected] PRIVMSG " + sChan + " :Buffer Playback...");
if (DecryptChannel(sChan, sFile))
{
VCString vsLines;
VCString::iterator it;
sFile.Split("\n", vsLines);
for (it = vsLines.begin(); it != vsLines.end(); ++it) {
CString sLine(*it);
sLine.Trim();
PutUser(sLine);
}
}
PutUser(":***[email protected] PRIVMSG " + sChan + " :Playback Complete.");
}
开发者ID:FooBarWidget,项目名称:znc,代码行数:19,代码来源:savebuff.cpp
示例18: SetMechanismCommand
void SetMechanismCommand(const CString& sLine) {
CString sMechanisms = sLine.Token(1, true).AsUpper();
if (!sMechanisms.empty()) {
VCString vsMechanisms;
sMechanisms.Split(" ", vsMechanisms);
for (VCString::const_iterator it = vsMechanisms.begin(); it != vsMechanisms.end(); ++it) {
if (!SupportsMechanism(*it)) {
PutModule("Unsupported mechanism: " + *it);
return;
}
}
SetNV(NV_MECHANISMS, sMechanisms);
}
PutModule("Current mechanisms set: " + GetMechanismsString());
}
开发者ID:ConorOG,项目名称:znc,代码行数:19,代码来源:sasl.cpp
示例19: ConvertCharset
bool ConvertCharset(const VCString& vsFrom, const CString& sTo, CString& sData)
{
CString sDataCopy(sData);
if(!m_bForce)
{
// check whether sData already is encoded with the right charset:
iconv_t icTest = iconv_open(sTo.c_str(), sTo.c_str());
if(icTest != (iconv_t)-1)
{
size_t uTest = GetConversionLength(icTest, sData);
iconv_close(icTest);
if(uTest != (size_t)-1 && uTest != (size_t)-2)
{
DEBUG("charset: [" + sData.Escape_n(CString::EURL) + "] is valid [" + sTo + "] already.");
return true;
}
}
}
bool bConverted = false;
// try all possible source charsets:
for(VCString::const_iterator itf = vsFrom.begin(); itf != vsFrom.end(); ++itf)
{
if(ConvertCharset(*itf, sTo, sDataCopy))
{
// conversion successful!
sData = sDataCopy;
bConverted = true;
break;
}
else
{
// reset string and try the next charset:
sDataCopy = sData;
}
}
return bConverted;
}
开发者ID:Siyo92,项目名称:znc,代码行数:42,代码来源:charset.cpp
示例20: GetParamsColon
CString CMessage::GetParamsColon(unsigned int uIdx, unsigned int uLen) const {
if (m_vsParams.empty() || uLen == 0) {
return "";
}
if (uLen > m_vsParams.size() - uIdx - 1) {
uLen = m_vsParams.size() - uIdx;
}
VCString vsParams;
unsigned uParams = m_vsParams.size();
for (unsigned int i = uIdx; i < uIdx + uLen; ++i) {
CString sParam = m_vsParams[i];
if (i == uParams - 1 &&
(m_bColon || sParam.empty() || sParam.StartsWith(":") ||
sParam.Contains(" "))) {
sParam = ":" + sParam;
}
vsParams.push_back(sParam);
}
return CString(" ").Join(vsParams.begin(), vsParams.end());
}
开发者ID:BtbN,项目名称:znc,代码行数:20,代码来源:Message.cpp
注:本文中的VCString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论