Exemple #1
0
void
ping_multiple(void **state)
{
    stbbr_for_id("prof_ping_2",
        "<iq id='prof_ping_2' type='result' to='stabber@localhost/profanity'/>"
    );
    stbbr_for_id("prof_ping_3",
        "<iq id='prof_ping_3' type='result' to='stabber@localhost/profanity'/>"
    );

    prof_connect();

    prof_input("/ping");
    assert_true(stbbr_received(
        "<iq id='prof_ping_2' type='get'>"
            "<ping xmlns='urn:xmpp:ping'/>"
        "</iq>"
    ));
    assert_true(prof_output_exact("Ping response from server"));

    prof_input("/ping");
    assert_true(stbbr_received(
        "<iq id='prof_ping_3' type='get'>"
            "<ping xmlns='urn:xmpp:ping'/>"
        "</iq>"
    ));
    assert_true(prof_output_exact("Ping response from server"));
}
Exemple #2
0
void
new_session_when_message_received_from_different_fulljid(void **state)
{
    prof_connect();

    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
            "<priority>10</priority>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 (mobile) is online"));

    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
            "<priority>8</priority>"
            "<show>away</show>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 (laptop) is away"));

    stbbr_send(
        "<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
            "<body>From first resource</body>"
        "</message>"
    );
    assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));

    prof_input("/msg buddy1@localhost Outgoing 1");
    assert_true(stbbr_received(
        "<message id='*' to='buddy1@localhost/mobile' type='chat'>"
            "<body>Outgoing 1</body>"
        "</message>"
    ));

    stbbr_send(
        "<message id='message1' to='stabber@localhost' from='buddy1@localhost/laptop' type='chat'>"
            "<body>From second resource</body>"
        "</message>"
    );
    assert_true(prof_output_regex("Buddy1/laptop:.+From second resource"));

    prof_input("/msg buddy1@localhost Outgoing 2");
    assert_true(stbbr_received(
        "<message id='*' to='buddy1@localhost/laptop' type='chat'>"
            "<body>Outgoing 2</body>"
        "</message>"
    ));
}
Exemple #3
0
void
sends_message_to_fulljid_when_received_from_fulljid(void **state)
{
    prof_connect();

    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
            "<priority>10</priority>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 (mobile) is online"));

    stbbr_send(
        "<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
            "<body>First message</body>"
        "</message>"
    );
    assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));

    prof_input("/msg buddy1@localhost Hi there");

    assert_true(stbbr_received(
        "<message id='*' to='buddy1@localhost/mobile' type='chat'>"
            "<body>Hi there</body>"
        "</message>"
    ));
}
Exemple #4
0
void
receive_self_carbon(void **state)
{
    prof_input("/carbons on");

    prof_connect();
    assert_true(stbbr_received(
        "<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"
    ));

    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
            "<priority>10</priority>"
            "<status>On my mobile</status>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
    prof_input("/msg Buddy1");
    assert_true(prof_output_exact("unencrypted"));

    stbbr_send(
        "<message type='chat' to='stabber@localhost/profanity' from='stabber@localhost'>"
            "<sent xmlns='urn:xmpp:carbons:2'>"
                "<forwarded xmlns='urn:xmpp:forward:0'>"
                    "<message id='59' xmlns='jabber:client' type='chat' to='buddy1@localhost/mobile' lang='en' from='stabber@localhost/profanity'>"
                        "<body>self sent carbon</body>"
                    "</message>"
                "</forwarded>"
            "</sent>"
        "</message>"
    );

    assert_true(prof_output_regex("me: .+self sent carbon"));
}
Exemple #5
0
void
receive_private_carbon(void **state)
{
    prof_input("/carbons on");

    prof_connect();
    assert_true(stbbr_received(
        "<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"
    ));

    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
            "<priority>10</priority>"
            "<status>On my mobile</status>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\""));
    prof_input("/msg Buddy1");
    assert_true(prof_output_exact("unencrypted"));

    stbbr_send(
        "<message type='chat' to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>"
            "<body>Private carbon</body>"
            "<private xmlns='urn:xmpp:carbons:2'/>"
        "</message>"
    );

    assert_true(prof_output_regex("Buddy1/mobile: .+Private carbon"));
}
Exemple #6
0
void
connect_with_carbons_enabled(void **state)
{
    prof_input("/carbons on");

    prof_connect();

    assert_true(stbbr_received(
        "<iq id='*' type='set'><enable xmlns='urn:xmpp:carbons:2'/></iq>"
    ));
}
Exemple #7
0
void
resets_to_barejid_after_presence_received(void **state)
{
    prof_connect();

    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
            "<priority>10</priority>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 (mobile) is online"));

    stbbr_send(
        "<message id='message1' to='stabber@localhost' from='buddy1@localhost/mobile' type='chat'>"
            "<body>First message</body>"
        "</message>"
    );
    assert_true(prof_output_exact("<< chat message: Buddy1/mobile (win 2)"));

    prof_input("/msg buddy1@localhost Outgoing 1");
    assert_true(stbbr_received(
        "<message id='*' to='buddy1@localhost/mobile' type='chat'>"
            "<body>Outgoing 1</body>"
        "</message>"
    ));

    stbbr_send(
        "<presence to='stabber@localhost' from='buddy1@localhost/laptop'>"
            "<priority>5</priority>"
            "<show>dnd</show>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 (laptop) is dnd"));

    prof_input("/msg buddy1@localhost Outgoing 2");
    assert_true(stbbr_received(
        "<message id='*' to='buddy1@localhost' type='chat'>"
            "<body>Outgoing 2</body>"
        "</message>"
    ));
}
Exemple #8
0
void
sends_message_to_barejid_when_contact_offline(void **state)
{
    prof_connect();

    prof_input("/msg buddy1@localhost Hi there");

    assert_true(stbbr_received(
        "<message id='*' to='buddy1@localhost' type='chat'>"
            "<body>Hi there</body>"
        "</message>"
    ));
}
Exemple #9
0
void
send_disable_carbons(void **state)
{
    prof_input("/carbons on");

    prof_connect();

    prof_input("/carbons off");

    assert_true(stbbr_received(
        "<iq id='*' type='set'><disable xmlns='urn:xmpp:carbons:2'/></iq>"
    ));
}
Exemple #10
0
void
ping_responds(void **state)
{
    prof_connect();

    stbbr_send(
        "<iq id='pingtest1' type='get' to='stabber@localhost/profanity' from='localhost'>"
            "<ping xmlns='urn:xmpp:ping'/>"
        "</iq>"
    );

    assert_true(stbbr_received(
        "<iq id='pingtest1' type='result' from='stabber@localhost/profanity' to='localhost'/>"
    ));
}
Exemple #11
0
void
send_receipt_request(void **state)
{
    prof_input("/receipts request on");

    prof_connect();

    prof_input("/msg [email protected] Hi there");

    assert_true(stbbr_received(
        "<message id=\"*\" type=\"chat\" to=\"[email protected]\">"
            "<body>Hi there</body>"
            "<request xmlns=\"urn:xmpp:receipts\"/>"
        "</message>"
    ));
}
Exemple #12
0
void
send_software_version_request(void **state)
{
    prof_connect();
    stbbr_send(
        "<presence to=\"stabber@localhost\" from=\"buddy1@localhost/mobile\">"
            "<priority>10</priority>"
            "<status>I'm here</status>"
        "</presence>"
    );
    prof_output_exact("Buddy1 (mobile) is online, \"I'm here\"");
    prof_input("/software buddy1@localhost/mobile");

    stbbr_received(
        "<iq id=\"*\" to=\"buddy1@localhost/mobile\" type=\"get\">"
            "<query xmlns=\"jabber:iq:version\"/>"
        "</iq>"
    );
}
Exemple #13
0
void
send_receipt_on_request(void **state)
{
    prof_input("/receipts send on");

    prof_connect();

    stbbr_send(
        "<message id=\"msg12213\" type=\"chat\" to=\"stabber@localhost/profanity\" from=\"[email protected]/profanity\">"
            "<body>Wants a receipt</body>"
            "<request xmlns=\"urn:xmpp:receipts\"/>"
        "</message>"
    );

    assert_true(stbbr_received(
        "<message id=\"*\" to=\"[email protected]/profanity\">"
            "<received id=\"msg12213\" xmlns=\"urn:xmpp:receipts\"/>"
        "</message>"
    ));
}
Exemple #14
0
void
sends_message_to_barejid_when_contact_online(void **state)
{
    prof_connect();

    stbbr_send(
        "<presence to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>"
            "<priority>10</priority>"
        "</presence>"
    );
    assert_true(prof_output_exact("Buddy1 (mobile) is online"));

    prof_input("/msg buddy1@localhost Hi there");

    assert_true(stbbr_received(
        "<message id='*' to='buddy1@localhost' type='chat'>"
            "<body>Hi there</body>"
        "</message>"
    ));
}