mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-18 18:56:21 +00:00
security(CWE-134): fix format string injections + add CI check fix(ui): subwindow lifecycle, newwin/newpad guards, fallback timestamps fix(db): sqlite cleanup on failures, sqlite3_close_v2 fix(xmpp): queued_messages loop, barejid leak perf(core): g_hash_table_iter_init instead of g_hash_table_get_keys refactor(ui): CLAMP macro in _check_subwin_width test: XEP-0012 and XEP-0045 functional tests Author: jabber.developer2 Closes #58, #85
64 lines
1.7 KiB
C
64 lines
1.7 KiB
C
/*
|
|
* test_lastactivity.c
|
|
* Functional tests for Last Activity (XEP-0012)
|
|
*/
|
|
#include <glib.h>
|
|
#include "prof_cmocka.h"
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include <stabber.h>
|
|
|
|
#include "proftest.h"
|
|
|
|
void
|
|
responds_to_last_activity_request(void **state)
|
|
{
|
|
prof_connect();
|
|
|
|
// Send incoming last activity request
|
|
stbbr_send(
|
|
"<iq id='last1' type='get' to='stabber@localhost/profanity' from='buddy1@localhost/mobile'>"
|
|
"<query xmlns='jabber:iq:last'/>"
|
|
"</iq>"
|
|
);
|
|
|
|
// Verify that CProof responds with last activity info
|
|
// The 'seconds' attribute indicates idle time
|
|
assert_true(stbbr_received(
|
|
"<iq id='last1' type='result' to='buddy1@localhost/mobile'>"
|
|
"<query xmlns='jabber:iq:last' seconds='*'/>"
|
|
"</iq>"
|
|
));
|
|
}
|
|
|
|
void
|
|
last_activity_request_to_contact(void **state)
|
|
{
|
|
prof_connect();
|
|
|
|
stbbr_send(
|
|
"<presence to='stabber@localhost' from='buddy1@localhost/mobile'>"
|
|
"<priority>10</priority>"
|
|
"<status>I'm here</status>"
|
|
"</presence>"
|
|
);
|
|
assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""));
|
|
|
|
// Register response for last activity query
|
|
stbbr_for_query("jabber:iq:last",
|
|
"<iq id='*' type='result' from='buddy1@localhost/mobile' to='stabber@localhost/profanity'>"
|
|
"<query xmlns='jabber:iq:last' seconds='120'/>"
|
|
"</iq>"
|
|
);
|
|
|
|
prof_input("/lastactivity get buddy1@localhost/mobile");
|
|
|
|
// Verify the request was sent
|
|
assert_true(stbbr_received(
|
|
"<iq id='*' to='buddy1@localhost/mobile' type='get'>"
|
|
"<query xmlns='jabber:iq:last'/>"
|
|
"</iq>"
|
|
));
|
|
}
|