本文整理汇总了C++中AdcCommand::hasFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ AdcCommand::hasFlag方法的具体用法?C++ AdcCommand::hasFlag怎么用?C++ AdcCommand::hasFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdcCommand
的用法示例。
在下文中一共展示了AdcCommand::hasFlag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on
void UploadManager::on(AdcCommand::GET, UserConnection* aSource, const AdcCommand& c) throw() {
int64_t aBytes = Util::toInt64(c.getParam(3));
int64_t aStartPos = Util::toInt64(c.getParam(2));
const string& fname = c.getParam(1);
const string& type = c.getParam(0);
if(prepareFile(*aSource, type, fname, aStartPos, aBytes, c.hasFlag("RE", 4))) {
Upload* u = aSource->getUpload();
dcassert(u != NULL);
AdcCommand cmd(AdcCommand::CMD_SND);
cmd.addParam(type).addParam(fname)
.addParam(Util::toString(u->getPos()))
.addParam(Util::toString(u->getSize() - u->getPos()));
if(c.hasFlag("ZL", 4)) {
u->setStream(new FilteredInputStream<ZFilter, true>(u->getStream()));
u->setFlag(Upload::FLAG_ZUPLOAD);
cmd.addParam("ZL1");
}
aSource->send(cmd);
u->setStart(GET_TICK());
aSource->setState(UserConnection::STATE_RUNNING);
aSource->transmitFile(u->getStream());
fire(UploadManagerListener::Starting(), u);
}
}
示例2: handlePM
void UserConnection::handlePM(const AdcCommand& c, bool echo) noexcept{
const string& message = c.getParam(0);
OnlineUserPtr peer = nullptr;
OnlineUserPtr me = nullptr;
auto cm = ClientManager::getInstance();
{
RLock l(cm->getCS());
peer = cm->findOnlineUser(user->getCID(), getHubUrl());
//try to use the same hub so nicks match to a hub, not the perfect solution for CCPM, nicks keep changing when hubs go offline.
if(peer && peer->getHubUrl() != hubUrl)
setHubUrl(peer->getHubUrl());
me = cm->findOnlineUser(cm->getMe()->getCID(), getHubUrl());
}
if (!me || !peer){ //ChatMessage cant be formatted without the OnlineUser!
disconnect(true);
return;
}
if (echo) {
std::swap(peer, me);
}
string tmp;
auto msg = make_shared<ChatMessage>(message, peer, me, peer);
if (c.getParam("TS", 1, tmp)) {
msg->setTime(Util::toInt64(tmp));
}
msg->setThirdPerson(c.hasFlag("ME", 1));
fire(UserConnectionListener::PrivateMessage(), this, msg);
}
示例3: on
void MessageManager::on(AdcCommand::PMI, UserConnection* uc, const AdcCommand& cmd) noexcept {
if (cmd.hasFlag("QU", 0)) {
RLock l(cs);
auto i = ccpms.find(uc->getUser());
if (i != ccpms.end())
uc->disconnect(true);
}
}
示例4: on
void DownloadManager::on(AdcCommand::SND, UserConnection* aSource, const AdcCommand& cmd) noexcept {
if(aSource->getState() != UserConnection::STATE_SND) {
dcdebug("DM::onFileLength Bad state, ignoring\n");
return;
}
const string& type = cmd.getParam(0);
int64_t start = Util::toInt64(cmd.getParam(2));
int64_t bytes = Util::toInt64(cmd.getParam(3));
if(type != Transfer::names[aSource->getDownload()->getType()]) {
// Uhh??? We didn't ask for this...
aSource->disconnect();
return;
}
startData(aSource, start, bytes, cmd.hasFlag("ZL", 4));
}
示例5: handlePM
void UserConnection::handlePM(const AdcCommand& c, bool echo) noexcept {
auto message = c.getParam(0);
auto cm = ClientManager::getInstance();
auto lock = cm->lock();
auto peer = cm->findOnlineUser(user->getCID(), hubUrl);
auto me = cm->findOnlineUser(cm->getMe()->getCID(), hubUrl);
// null pointers allowed here as the conn may be going on without hubs.
if(echo) {
std::swap(peer, me);
}
if(peer && peer->getIdentity().noChat())
return;
if(PluginManager::getInstance()->runHook(HOOK_CHAT_PM_IN, peer, message))
return;
string tmp;
fire(UserConnectionListener::PrivateMessage(), this, ChatMessage(message, peer, me, peer,
c.hasFlag("ME", 1), c.getParam("TS", 1, tmp) ? Util::toInt64(tmp) : 0));
}