本文整理汇总了C++中ChatChannel::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ ChatChannel::isValid方法的具体用法?C++ ChatChannel::isValid怎么用?C++ ChatChannel::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChatChannel
的用法示例。
在下文中一共展示了ChatChannel::isValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: auth
/*!
* Авторизация пользователя, если пользователь не существует, будет создан новый.
*/
AuthResult ExternalAuthTask::auth(const QVariantMap &data)
{
QByteArray id = SimpleID::decode(data.value(LS("id")).toByteArray());
if (SimpleID::typeOf(id) != SimpleID::UserId)
return AuthResult(Notice::Forbidden, m_data.id);
AuthResult result = AnonymousAuth::isCollision(id, m_data.nick, m_data.id, Storage::value(STORAGE_NICK_OVERRIDE).toBool());
if (result.action == AuthResult::Reject) {
if (result.status == Notice::NickAlreadyUse)
m_cache[m_data.id + m_data.cookie] = data;
return result;
}
ChatChannel channel = Ch::channel(id, SimpleID::UserId);
bool created = false;
if (!channel) {
channel = ChatChannel(new ServerChannel(id, m_data.nick));
created = true;
channel->setAccount();
channel->account()->provider = data.value(LS("provider")).toString();
channel->account()->groups += LS("registered");
channel->account()->setDate(DateTime::utc());
channel->setName(m_data.nick);
channel->gender().setRaw(m_data.gender);
channel->user()->set(User(data.value(LS("user")).toMap()));
}
if (channel->status().value() == Status::Offline) {
channel->setDate();
channel->status().set(m_data.status);
}
if (!channel->isValid())
return AuthResult(Notice::BadRequest, m_data.id);
Core::add(channel);
Ch::userChannel(channel, m_data, m_host, created, m_socket);
LOG_INFO("N3010", "Core/ExternalAuth", channel->name() << "@" << m_host + "/" + ChatId(channel->id()).toString() << ", " << m_data.host)
m_cache.remove(m_data.id + m_data.cookie);
return AuthResult(id, m_data.id);
}