本文整理汇总了C++中ChatChannel::gender方法的典型用法代码示例。如果您正苦于以下问题:C++ ChatChannel::gender方法的具体用法?C++ ChatChannel::gender怎么用?C++ ChatChannel::gender使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChatChannel
的用法示例。
在下文中一共展示了ChatChannel::gender方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add
/*!
* Добавление канала.
* Если канал уже добавлен, он будет обновлён.
*
* \param channel Указатель на канал.
* \return Ключ в таблице \b channels или -1 в случае ошибки.
*
* \sa update().
*/
qint64 DataBase::add(ChatChannel channel)
{
qint64 key = channel->key();
if (key <= 0)
key = channelKey(channel->id(), channel->type());
if (key > 0) {
if (channel->key() != key)
channel->setKey(key);
update(channel);
return key;
}
QSqlQuery query;
query.prepare(LS("INSERT INTO channels (channel, normalized, type, gender, name, data, date) "
"VALUES (:channel, :normalized, :type, :gender, :name, :data, :date);"));
query.bindValue(LS(":channel"), SimpleID::encode(channel->id()));
query.bindValue(LS(":normalized"), SimpleID::encode(channel->normalized()));
query.bindValue(LS(":type"), channel->type());
query.bindValue(LS(":gender"), channel->gender().raw());
query.bindValue(LS(":name"), channel->name());
query.bindValue(LS(":data"), JSON::generate(channel->data()));
query.bindValue(LS(":date"), channel->date());
query.exec();
if (query.numRowsAffected() <= 0) {
LOG_N6011
return -1;
}
示例2: 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);
}