本文整理汇总了C++中IrcMessage::property方法的典型用法代码示例。如果您正苦于以下问题:C++ IrcMessage::property方法的具体用法?C++ IrcMessage::property怎么用?C++ IrcMessage::property使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IrcMessage
的用法示例。
在下文中一共展示了IrcMessage::property方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testNoticeMessage
void tst_IrcMessage::testNoticeMessage()
{
QFETCH(bool, valid);
QFETCH(QByteArray, data);
QFETCH(QString, target);
QFETCH(QString, content);
QFETCH(bool, priv);
QFETCH(bool, reply);
IrcConnection connection;
connection.setNickName("communi");
IrcMessage* message = IrcMessage::fromData(data, &connection);
QCOMPARE(message->type(), IrcMessage::Notice);
QCOMPARE(message->command(), QString("NOTICE"));
QCOMPARE(message->property("valid").toBool(), valid);
QCOMPARE(message->property("target").toString(), target);
QCOMPARE(message->property("content").toString(), content);
QCOMPARE(message->property("private").toBool(), priv);
QCOMPARE(message->property("reply").toBool(), reply);
IrcNoticeMessage* noticeMessage = qobject_cast<IrcNoticeMessage*>(message);
QVERIFY(noticeMessage);
QCOMPARE(noticeMessage->isValid(), valid);
QCOMPARE(noticeMessage->target(), target);
QCOMPARE(noticeMessage->content(), content);
QCOMPARE(noticeMessage->isPrivate(), priv);
QCOMPARE(noticeMessage->isReply(), reply);
}
示例2: testPongMessage
void tst_IrcMessage::testPongMessage()
{
IrcConnection connection;
IrcMessage* message = IrcMessage::fromData("PONG tgt :arg", &connection);
QCOMPARE(message->type(), IrcMessage::Pong);
QCOMPARE(message->command(), QString("PONG"));
QCOMPARE(message->property("command").toString(), QString("PONG"));
QVERIFY(message->property("valid").toBool());
QCOMPARE(message->property("argument").toString(), QString("arg"));
IrcPongMessage* pongMessage = qobject_cast<IrcPongMessage*>(message);
QVERIFY(pongMessage);
QVERIFY(pongMessage->isValid());
QCOMPARE(pongMessage->argument(), QString("arg"));
}
示例3: fromData
/*!
Creates a new message from \a data and \a parent.
*/
IrcMessage* IrcMessage::fromData(const QByteArray& data, QObject* parent)
{
IrcMessage* message = 0;
IrcParser parser;
if (parser.parse(data))
{
const QMetaObject* metaObject = irc_command_meta_object(parser.command());
Q_ASSERT(metaObject);
message = qobject_cast<IrcMessage*>(metaObject->newInstance(Q_ARG(QObject*, parent)));
Q_ASSERT(message);
message->d_ptr->parser = parser;
IrcSession* session = qobject_cast<IrcSession*>(parent);
if (session)
{
IrcSender sender = message->sender();
if (sender.isValid() && sender.name() == session->nickName())
message->d_ptr->flags |= Own;
if (session->d_ptr->capabilities.contains("identify-msg") &&
(message->d_ptr->type == Private || message->d_ptr->type == Notice))
{
QString msg = message->property("message").toString();
if (msg.startsWith("+"))
message->d_ptr->flags |= Identified;
else if (msg.startsWith("-"))
message->d_ptr->flags |= Unidentified;
}
}
}
return message;
}
示例4: testQuitMessage
void tst_IrcMessage::testQuitMessage()
{
QFETCH(bool, valid);
QFETCH(QByteArray, data);
QFETCH(QString, reason);
IrcConnection connection;
IrcMessage* message = IrcMessage::fromData(data, &connection);
QCOMPARE(message->type(), IrcMessage::Quit);
QCOMPARE(message->command(), QString("QUIT"));
QCOMPARE(message->property("valid").toBool(), valid);
QCOMPARE(message->property("reason").toString(), reason);
IrcQuitMessage* quitMessage = qobject_cast<IrcQuitMessage*>(message);
QVERIFY(quitMessage);
QCOMPARE(quitMessage->isValid(), valid);
QCOMPARE(quitMessage->reason(), reason);
}
示例5: testNumericMessage
void tst_IrcMessage::testNumericMessage()
{
QFETCH(bool, valid);
QFETCH(QByteArray, data);
QFETCH(int, code);
IrcConnection connection;
IrcMessage* message = IrcMessage::fromData(data, &connection);
QCOMPARE(message->type(), IrcMessage::Numeric);
QVERIFY(message->command().toInt() > 0);
QCOMPARE(message->property("valid").toBool(), valid);
QCOMPARE(message->property("code").toInt(), code);
IrcNumericMessage* numericMessage = qobject_cast<IrcNumericMessage*>(message);
QVERIFY(numericMessage);
QCOMPARE(numericMessage->isValid(), valid);
QCOMPARE(numericMessage->code(), code);
}
示例6: testJoinMessage
void tst_IrcMessage::testJoinMessage()
{
QFETCH(bool, valid);
QFETCH(QByteArray, data);
QFETCH(QString, channel);
IrcConnection connection;
IrcMessage* message = IrcMessage::fromData(data, &connection);
QCOMPARE(message->type(), IrcMessage::Join);
QCOMPARE(message->command(), QString("JOIN"));
QCOMPARE(message->property("valid").toBool(), valid);
QCOMPARE(message->property("channel").toString(), channel);
IrcJoinMessage* joinMessage = qobject_cast<IrcJoinMessage*>(message);
QVERIFY(joinMessage);
QCOMPARE(joinMessage->isValid(), valid);
QCOMPARE(joinMessage->channel(), channel);
}
示例7: testErrorMessage
void tst_IrcMessage::testErrorMessage()
{
QFETCH(bool, valid);
QFETCH(QByteArray, data);
QFETCH(QString, error);
IrcConnection connection;
IrcMessage* message = IrcMessage::fromData(data, &connection);
QCOMPARE(message->type(), IrcMessage::Error);
QCOMPARE(message->command(), QString("ERROR"));
QCOMPARE(message->property("valid").toBool(), valid);
QCOMPARE(message->property("error").toString(), error);
IrcErrorMessage* errorMessage = qobject_cast<IrcErrorMessage*>(message);
QVERIFY(errorMessage);
QCOMPARE(errorMessage->isValid(), valid);
QCOMPARE(errorMessage->error(), error);
}
示例8: testPartMessage
void tst_IrcMessage::testPartMessage()
{
QFETCH(bool, valid);
QFETCH(QByteArray, data);
QFETCH(QString, channel);
QFETCH(QString, reason);
IrcConnection connection;
IrcMessage* message = IrcMessage::fromData(data, &connection);
QCOMPARE(message->type(), IrcMessage::Part);
QCOMPARE(message->command(), QString("PART"));
QCOMPARE(message->property("valid").toBool(), valid);
QCOMPARE(message->property("channel").toString(), channel);
QCOMPARE(message->property("reason").toString(), reason);
IrcPartMessage* partMessage = qobject_cast<IrcPartMessage*>(message);
QVERIFY(partMessage);
QCOMPARE(partMessage->isValid(), valid);
QCOMPARE(partMessage->channel(), channel);
QCOMPARE(partMessage->reason(), reason);
}
示例9: testNickMessage
void tst_IrcMessage::testNickMessage()
{
QFETCH(bool, valid);
QFETCH(QByteArray, data);
QFETCH(QString, oldNick);
QFETCH(QString, newNick);
IrcConnection connection;
IrcMessage* message = IrcMessage::fromData(data, &connection);
QCOMPARE(message->type(), IrcMessage::Nick);
QCOMPARE(message->command(), QString("NICK"));
QCOMPARE(message->property("valid").toBool(), valid);
QCOMPARE(message->property("oldNick").toString(), oldNick);
QCOMPARE(message->property("newNick").toString(), newNick);
IrcNickMessage* nickMessage = qobject_cast<IrcNickMessage*>(message);
QVERIFY(nickMessage);
QCOMPARE(nickMessage->isValid(), valid);
QCOMPARE(nickMessage->oldNick(), oldNick);
QCOMPARE(nickMessage->newNick(), newNick);
}
示例10: testInviteMessage
void tst_IrcMessage::testInviteMessage()
{
QFETCH(bool, valid);
QFETCH(QByteArray, data);
QFETCH(QString, channel);
QFETCH(QString, user);
IrcConnection connection;
IrcMessage* message = IrcMessage::fromData(data, &connection);
QCOMPARE(message->type(), IrcMessage::Invite);
QCOMPARE(message->command(), QString("INVITE"));
QCOMPARE(message->property("valid").toBool(), valid);
QCOMPARE(message->property("channel").toString(), channel);
QCOMPARE(message->property("user").toString(), user);
IrcInviteMessage* inviteMessage = qobject_cast<IrcInviteMessage*>(message);
QVERIFY(inviteMessage);
QCOMPARE(inviteMessage->isValid(), valid);
QCOMPARE(inviteMessage->channel(), channel);
QCOMPARE(inviteMessage->user(), user);
}
示例11: testCapabilityMessage
void tst_IrcMessage::testCapabilityMessage()
{
QFETCH(bool, valid);
QFETCH(QByteArray, data);
QFETCH(QString, subCommand);
QFETCH(QStringList, capabilities);
IrcConnection connection;
IrcMessage* message = IrcMessage::fromData(data, &connection);
QCOMPARE(message->type(), IrcMessage::Capability);
QCOMPARE(message->command(), QString("CAP"));
QCOMPARE(message->property("valid").toBool(), valid);
QCOMPARE(message->property("subCommand").toString(), subCommand);
QCOMPARE(message->property("capabilities").toStringList(), capabilities);
IrcCapabilityMessage* capabilityMessage = qobject_cast<IrcCapabilityMessage*>(message);
QVERIFY(capabilityMessage);
QCOMPARE(capabilityMessage->isValid(), valid);
QCOMPARE(capabilityMessage->subCommand(), subCommand);
QCOMPARE(capabilityMessage->capabilities(), capabilities);
}
示例12: testTopicMessage
void tst_IrcMessage::testTopicMessage()
{
QFETCH(bool, valid);
QFETCH(QByteArray, data);
QFETCH(QString, channel);
QFETCH(QString, topic);
QFETCH(bool, reply);
IrcConnection connection;
IrcMessage* message = IrcMessage::fromData(data, &connection);
QCOMPARE(message->type(), IrcMessage::Topic);
QCOMPARE(message->command(), QString("TOPIC"));
QCOMPARE(message->property("valid").toBool(), valid);
QCOMPARE(message->property("channel").toString(), channel);
QCOMPARE(message->property("topic").toString(), topic);
QCOMPARE(message->property("reply").toBool(), reply);
IrcTopicMessage* topicMessage = qobject_cast<IrcTopicMessage*>(message);
QVERIFY(topicMessage);
QCOMPARE(topicMessage->isValid(), valid);
QCOMPARE(topicMessage->channel(), channel);
QCOMPARE(topicMessage->topic(), topic);
QCOMPARE(topicMessage->isReply(), reply);
}
示例13: testModeMessage
void tst_IrcMessage::testModeMessage()
{
QFETCH(bool, valid);
QFETCH(QByteArray, data);
QFETCH(QString, target);
QFETCH(QString, mode);
QFETCH(QString, argument);
IrcConnection connection;
IrcMessage* message = IrcMessage::fromData(data, &connection);
QCOMPARE(message->type(), IrcMessage::Mode);
QCOMPARE(message->command(), QString("MODE"));
QCOMPARE(message->property("valid").toBool(), valid);
QCOMPARE(message->property("target").toString(), target);
QCOMPARE(message->property("mode").toString(), mode);
QCOMPARE(message->property("argument").toString(), argument);
IrcModeMessage* modeMessage = qobject_cast<IrcModeMessage*>(message);
QVERIFY(modeMessage);
QCOMPARE(modeMessage->isValid(), valid);
QCOMPARE(modeMessage->target(), target);
QCOMPARE(modeMessage->mode(), mode);
QCOMPARE(modeMessage->argument(), argument);
}
示例14: testKickMessage
void tst_IrcMessage::testKickMessage()
{
QFETCH(bool, valid);
QFETCH(QByteArray, data);
QFETCH(QString, channel);
QFETCH(QString, user);
QFETCH(QString, reason);
IrcConnection connection;
IrcMessage* message = IrcMessage::fromData(data, &connection);
QCOMPARE(message->type(), IrcMessage::Kick);
QCOMPARE(message->command(), QString("KICK"));
QCOMPARE(message->property("valid").toBool(), valid);
QCOMPARE(message->property("channel").toString(), channel);
QCOMPARE(message->property("user").toString(), user);
QCOMPARE(message->property("reason").toString(), reason);
IrcKickMessage* kickMessage = qobject_cast<IrcKickMessage*>(message);
QVERIFY(kickMessage);
QCOMPARE(kickMessage->isValid(), valid);
QCOMPARE(kickMessage->channel(), channel);
QCOMPARE(kickMessage->user(), user);
QCOMPARE(kickMessage->reason(), reason);
}
示例15: testPrivateMessage
void tst_IrcMessage::testPrivateMessage()
{
QFETCH(bool, valid);
QFETCH(QString, cap);
QFETCH(QByteArray, data);
QFETCH(QString, target);
QFETCH(QString, content);
QFETCH(bool, priv);
QFETCH(bool, action);
QFETCH(bool, request);
QFETCH(uint, flags);
IrcConnection connection;
connection.setNickName("communi");
TestProtocol protocol(cap, &connection);
static_cast<FriendConnection*>(&connection)->setProtocol(&protocol);
IrcMessage* message = IrcMessage::fromData(data, &connection);
QCOMPARE(message->type(), IrcMessage::Private);
QCOMPARE(message->command(), QString("PRIVMSG"));
QCOMPARE(message->property("valid").toBool(), valid);
QCOMPARE(message->property("target").toString(), target);
QCOMPARE(message->property("content").toString(), content);
QCOMPARE(message->property("private").toBool(), priv);
QCOMPARE(message->property("action").toBool(), action);
QCOMPARE(message->property("request").toBool(), request);
QCOMPARE(message->property("flags").toUInt(), flags);
IrcPrivateMessage* privateMessage = qobject_cast<IrcPrivateMessage*>(message);
QVERIFY(privateMessage);
QCOMPARE(privateMessage->isValid(), valid);
QCOMPARE(privateMessage->target(), target);
QCOMPARE(privateMessage->content(), content);
QCOMPARE(privateMessage->isPrivate(), priv);
QCOMPARE(privateMessage->isAction(), action);
QCOMPARE(privateMessage->isRequest(), request);
QCOMPARE(static_cast<uint>(privateMessage->flags()), flags);
}