예제 #1
0
파일: ircbuffer.cpp 프로젝트: Mudlet/Mudlet
bool IrcBufferPrivate::isMonitorable() const
{
    Q_Q(const IrcBuffer);
    IrcNetwork* n = q->network();
    IrcConnection* c = q->connection();
    if (!sticky && !name.startsWith(QLatin1String("*")) && c && c->isConnected() && n && n->numericLimit(IrcNetwork::MonitorCount) >= 0 && !n->isChannel(q->title()))
        return true;
    return false;
}
예제 #2
0
void tst_IrcNetwork::testDefaults()
{
    IrcConnection connection;
    IrcNetwork* network = connection.network();
    QVERIFY(!network->isInitialized());
    QVERIFY(network->name().isNull());
    QVERIFY(network->modes().isEmpty());
    QVERIFY(network->prefixes().isEmpty());
    QVERIFY(network->channelTypes().isEmpty());
    QVERIFY(network->availableCapabilities().isEmpty());
    QVERIFY(network->requestedCapabilities().isEmpty());
    QVERIFY(network->activeCapabilities().isEmpty());
}
예제 #3
0
void SplitView::addBuffer(IrcBuffer* buffer)
{
    IrcConnection* connection = buffer->connection();
    if (connection) {
        const QString uuid = connection->userData().value("uuid").toString();
        if (!uuid.isEmpty()) {
            // TODO: optimize
            QList<BufferView*> views = findChildren<BufferView*>("__unrestored__");
            foreach (BufferView* bv, views) {
                if (bv->property("__uuid__").toString() == uuid &&
                        bv->property("__buffer__").toString() == buffer->title()) {
                    bv->setBuffer(buffer);
                    bv->setObjectName(QString());
                    bv->setProperty("__buffer__", QVariant());
                    bv->setProperty("__uuid__", QVariant());
                }
            }
        }
    }
예제 #4
0
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);
}
예제 #5
0
bool ModuleManager::onServerConnect(IrcConnection& connection) {
	connection.registerEventHandler(this);
	return true;
}