1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Added stubbed implementations

This commit is contained in:
James Booth 2014-12-23 19:26:45 +00:00
parent 9d94ac5c63
commit 5be9ac3243
12 changed files with 769 additions and 33 deletions

View File

@ -40,7 +40,6 @@ tests_sources = \
src/chat_session.h src/muc.c src/muc.h src/jid.h src/jid.c \
src/resource.c src/resource.h \
src/roster_list.c src/roster_list.h \
src/xmpp/form.c src/xmpp/form.h \
src/xmpp/xmpp.h \
src/ui/ui.h \
src/command/command.h src/command/command.c src/command/history.c \
@ -61,34 +60,13 @@ tests_sources = \
src/ui/titlebar.c src/ui/statusbar.c src/ui/inputwin.c \
src/ui/titlebar.h src/ui/statusbar.h src/ui/inputwin.h \
src/server_events.c src/server_events.h \
tests/xmpp/mock_xmpp.h tests/xmpp/mock_xmpp.c \
tests/otr/mock_otr.h tests/otr/mock_otr.c \
tests/ui/mock_ui.h tests/ui/mock_ui.c \
tests/config/mock_accounts.h tests/config/mock_accounts.c \
tests/xmpp/stub_xmpp.c tests/xmpp/stub_xmpp.h \
tests/otr/stub_otr.c \
tests/ui/stub_ui.c tests/ui/stub_ui.h \
tests/config/stub_accounts.c \
tests/log/stub_log.c \
tests/helpers.c tests/helpers.h \
tests/log/mock_log.c \
tests/test_autocomplete.c tests/test_autocomplete.h \
tests/test_common.c tests/test_common.h \
tests/test_contact.c tests/test_contact.h \
tests/test_cmd_connect.c tests/test_cmd_connect.h \
tests/test_cmd_account.c tests/test_cmd_account.h \
tests/test_cmd_rooms.c tests/test_cmd_rooms.h \
tests/test_cmd_sub.c tests/test_cmd_sub.h \
tests/test_cmd_alias.c tests/test_cmd_alias.h \
tests/test_cmd_statuses.c tests/test_cmd_statuses.h \
tests/test_cmd_bookmark.c tests/test_cmd_bookmark.h \
tests/test_cmd_otr.c tests/test_cmd_otr.h \
tests/test_cmd_join.c tests/test_cmd_join.h \
tests/test_history.c tests/test_history.h \
tests/test_jid.c tests/test_jid.h \
tests/test_parser.c tests/test_parser.h \
tests/test_roster_list.c tests/test_roster_list.h \
tests/test_preferences.c tests/test_preferences.h \
tests/test_server_events.c tests/test_server_events.h \
tests/test_muc.c tests/test_muc.h \
tests/test_cmd_roster.c tests/test_cmd_roster.h \
tests/test_cmd_win.c tests/test_cmd_win.h \
tests/test_form.c tests/test_form.h \
tests/testsuite.c
main_source = src/main.c

View File

@ -0,0 +1,92 @@
#include "common.h"
#include "config/account.h"
void accounts_load(void) {}
void accounts_close(void) {}
char * accounts_find_all(char *prefix)
{
return NULL;
}
char * accounts_find_enabled(char *prefix)
{
return NULL;
}
void accounts_reset_all_search(void) {}
void accounts_reset_enabled_search(void) {}
void accounts_add(const char *jid, const char *altdomain, const int port) {}
int accounts_remove(const char *jid)
{
return 0;
}
gchar** accounts_get_list(void)
{
return NULL;
}
ProfAccount* accounts_get_account(const char * const name)
{
return NULL;
}
gboolean accounts_enable(const char * const name)
{
return FALSE;
}
gboolean accounts_disable(const char * const name)
{
return FALSE;
}
gboolean accounts_rename(const char * const account_name,
const char * const new_name)
{
return FALSE;
}
gboolean accounts_account_exists(const char * const account_name)
{
return FALSE;
}
void accounts_set_jid(const char * const account_name, const char * const value) {}
void accounts_set_server(const char * const account_name, const char * const value) {}
void accounts_set_port(const char * const account_name, const int value) {}
void accounts_set_resource(const char * const account_name, const char * const value) {}
void accounts_set_password(const char * const account_name, const char * const value) {}
void accounts_set_muc_service(const char * const account_name, const char * const value) {}
void accounts_set_muc_nick(const char * const account_name, const char * const value) {}
void accounts_set_otr_policy(const char * const account_name, const char * const value) {}
void accounts_set_last_presence(const char * const account_name, const char * const value) {}
void accounts_set_login_presence(const char * const account_name, const char * const value) {}
resource_presence_t accounts_get_login_presence(const char * const account_name)
{
return RESOURCE_ONLINE;
}
resource_presence_t accounts_get_last_presence(const char * const account_name)
{
return RESOURCE_ONLINE;
}
void accounts_set_priority_online(const char * const account_name, const gint value) {}
void accounts_set_priority_chat(const char * const account_name, const gint value) {}
void accounts_set_priority_away(const char * const account_name, const gint value) {}
void accounts_set_priority_xa(const char * const account_name, const gint value) {}
void accounts_set_priority_dnd(const char * const account_name, const gint value) {}
void accounts_set_priority_all(const char * const account_name, const gint value) {}
gint accounts_get_priority_for_presence_type(const char * const account_name,
resource_presence_t presence_type)
{
return 0;
}
void accounts_clear_password(const char * const account_name) {}
void accounts_clear_server(const char * const account_name) {}
void accounts_clear_port(const char * const account_name) {}
void accounts_clear_otr(const char * const account_name) {}
void accounts_add_otr_policy(const char * const account_name, const char * const contact_jid, const char * const policy) {}

View File

@ -11,6 +11,16 @@
#include "helpers.h"
#include "config/preferences.h"
#include "ui/stub_ui.h"
#include "xmpp/stub_xmpp.h"
void
reset_mocks(void **state)
{
reset_ui_mocks();
reset_xmpp_mocks();
}
void create_config_dir(void **state)
{
setenv("XDG_CONFIG_HOME", "./tests/files/xdg_config_home", 1);

View File

@ -5,3 +5,5 @@ void close_preferences(void **state);
void glist_set_cmp(GCompareFunc func);
int glist_contents_equal(const void *actual, const void *expected);
void reset_mocks(void **state);

0
tests/otr/stub_otr.c Normal file
View File

View File

@ -7,19 +7,17 @@
#include <glib.h>
#include "xmpp/xmpp.h"
#include "xmpp/mock_xmpp.h"
#include "xmpp/stub_xmpp.h"
#include "ui/ui.h"
#include "ui/mock_ui.h"
#include "ui/stub_ui.h"
#include "config/accounts.h"
#include "config/mock_accounts.h"
#include "command/commands.h"
void cmd_account_shows_usage_when_not_connected_and_no_args(void **state)
{
mock_cons_show();
CommandHelp *help = malloc(sizeof(CommandHelp));
help->usage = "some usage";
gchar *args[] = { NULL };
@ -34,6 +32,7 @@ void cmd_account_shows_usage_when_not_connected_and_no_args(void **state)
free(help);
}
/*
void cmd_account_shows_account_when_connected_and_no_args(void **state)
{
mock_cons_show_account();
@ -1138,3 +1137,4 @@ void cmd_account_clear_shows_message_when_invalid_property(void **state)
free(help);
}
*/

View File

@ -35,6 +35,7 @@
int main(int argc, char* argv[]) {
const UnitTest all_tests[] = {
/*
unit_test(replace_one_substr),
unit_test(replace_one_substr_beginning),
unit_test(replace_one_substr_end),
@ -237,8 +238,11 @@ int main(int argc, char* argv[]) {
unit_test(cmd_rooms_shows_message_when_undefined),
unit_test(cmd_rooms_uses_account_default_when_no_arg),
unit_test(cmd_rooms_arg_used_when_passed),
unit_test(cmd_account_shows_usage_when_not_connected_and_no_args),
*/
unit_test_setup_teardown(cmd_account_shows_usage_when_not_connected_and_no_args,
reset_mocks,
reset_mocks),
/*
unit_test(cmd_account_shows_account_when_connected_and_no_args),
unit_test(cmd_account_list_shows_accounts),
unit_test(cmd_account_show_shows_usage_when_no_arg),
@ -552,6 +556,7 @@ int main(int argc, char* argv[]) {
unit_test(remove_text_multi_value_does_nothing_when_doesnt_exist),
unit_test(remove_text_multi_value_removes_when_one),
unit_test(remove_text_multi_value_removes_when_many),
*/
};
return run_tests(all_tests);

387
tests/ui/stub_ui.c Normal file
View File

@ -0,0 +1,387 @@
#include <glib.h>
#include <wchar.h>
#include <setjmp.h>
#include <cmocka.h>
#include "ui/window.h"
#include "tests/ui/stub_ui.h"
// mock state
static gboolean mock_cons_show = FALSE;
static char output[256];
void reset_ui_mocks(void)
{
mock_cons_show = FALSE;
}
void
expect_cons_show(char *expected)
{
mock_cons_show = TRUE;
expect_string(cons_show, output, expected);
}
// stubs
void ui_init(void) {}
void ui_load_colours(void) {}
void ui_update(void) {}
void ui_close(void) {}
void ui_redraw(void) {}
void ui_resize(void) {}
GSList* ui_get_recipients(void)
{
return NULL;
}
void ui_handle_special_keys(const wint_t * const ch, const int result) {}
gboolean ui_switch_win(const int i)
{
return FALSE;
}
void ui_next_win(void) {}
void ui_previous_win(void) {}
void ui_gone_secure(const char * const barejid, gboolean trusted) {}
void ui_gone_insecure(const char * const barejid) {}
void ui_trust(const char * const barejid) {}
void ui_untrust(const char * const barejid) {}
void ui_smp_recipient_initiated(const char * const barejid) {}
void ui_smp_recipient_initiated_q(const char * const barejid, const char *question) {}
void ui_smp_successful(const char * const barejid) {}
void ui_smp_unsuccessful_sender(const char * const barejid) {}
void ui_smp_unsuccessful_receiver(const char * const barejid) {}
void ui_smp_aborted(const char * const barejid) {}
void ui_smp_answer_success(const char * const barejid) {}
void ui_smp_answer_failure(const char * const barejid) {}
void ui_otr_authenticating(const char * const barejid) {}
void ui_otr_authetication_waiting(const char * const recipient) {}
unsigned long ui_get_idle_time(void)
{
return 0;
}
void ui_reset_idle_time(void) {}
void ui_new_chat_win(const char * const barejid) {}
void ui_new_private_win(const char * const fulljid) {}
void ui_print_system_msg_from_recipient(const char * const barejid, const char *message) {}
gint ui_unread(void)
{
return 0;
}
void ui_close_connected_win(int index) {}
int ui_close_all_wins(void)
{
return 0;
}
int ui_close_read_wins(void)
{
return 0;
}
// current window actions
void ui_clear_current(void) {}
win_type_t ui_current_win_type(void)
{
return WIN_CONSOLE;
}
int ui_current_win_index(void)
{
return 0;
}
gboolean ui_current_win_is_otr(void)
{
return FALSE;
}
ProfChatWin *ui_get_current_chat(void)
{
return NULL;
}
void ui_current_print_line(const char * const msg, ...) {}
void ui_current_print_formatted_line(const char show_char, int attrs, const char * const msg, ...) {}
void ui_current_error_line(const char * const msg) {}
win_type_t ui_win_type(int index)
{
return WIN_CONSOLE;
}
void ui_close_win(int index) {}
gboolean ui_win_exists(int index)
{
return FALSE;
}
int ui_win_unread(int index)
{
return 0;
}
char * ui_ask_password(void)
{
return NULL;
}
void ui_handle_stanza(const char * const msg) {}
// ui events
void ui_contact_typing(const char * const from) {}
void ui_incoming_msg(const char * const from, const char * const message, GTimeVal *tv_stamp) {}
void ui_incoming_private_msg(const char * const fulljid, const char * const message, GTimeVal *tv_stamp) {}
void ui_disconnected(void) {}
void ui_recipient_gone(const char * const barejid) {}
void ui_outgoing_chat_msg(const char * const from, const char * const barejid,
const char * const message) {}
void ui_outgoing_private_msg(const char * const from, const char * const fulljid,
const char * const message) {}
void ui_room_join(const char * const roomjid, gboolean focus) {}
void ui_switch_to_room(const char * const roomjid) {}
void ui_room_role_change(const char * const roomjid, const char * const role, const char * const actor,
const char * const reason) {}
void ui_room_affiliation_change(const char * const roomjid, const char * const affiliation, const char * const actor,
const char * const reason) {}
void ui_room_role_and_affiliation_change(const char * const roomjid, const char * const role,
const char * const affiliation, const char * const actor, const char * const reason) {}
void ui_room_occupant_role_change(const char * const roomjid, const char * const nick, const char * const role,
const char * const actor, const char * const reason) {}
void ui_room_occupant_affiliation_change(const char * const roomjid, const char * const nick, const char * const affiliation,
const char * const actor, const char * const reason) {}
void ui_room_occupant_role_and_affiliation_change(const char * const roomjid, const char * const nick, const char * const role,
const char * const affiliation, const char * const actor, const char * const reason) {}
void ui_room_roster(const char * const roomjid, GList *occupants, const char * const presence) {}
void ui_room_history(const char * const roomjid, const char * const nick,
GTimeVal tv_stamp, const char * const message) {}
void ui_room_message(const char * const roomjid, const char * const nick,
const char * const message) {}
void ui_room_subject(const char * const roomjid, const char * const nick, const char * const subject) {}
void ui_room_requires_config(const char * const roomjid) {}
void ui_room_destroy(const char * const roomjid) {}
void ui_show_room_info(ProfMucWin *mucwin) {}
void ui_show_room_role_list(ProfMucWin *mucwin, muc_role_t role) {}
void ui_show_room_affiliation_list(ProfMucWin *mucwin, muc_affiliation_t affiliation) {}
void ui_handle_room_info_error(const char * const roomjid, const char * const error) {}
void ui_show_room_disco_info(const char * const roomjid, GSList *identities, GSList *features) {}
void ui_room_destroyed(const char * const roomjid, const char * const reason, const char * const new_jid,
const char * const password) {}
void ui_room_kicked(const char * const roomjid, const char * const actor, const char * const reason) {}
void ui_room_member_kicked(const char * const roomjid, const char * const nick, const char * const actor,
const char * const reason) {}
void ui_room_banned(const char * const roomjid, const char * const actor, const char * const reason) {}
void ui_room_member_banned(const char * const roomjid, const char * const nick, const char * const actor,
const char * const reason) {}
void ui_leave_room(const char * const roomjid) {}
void ui_room_broadcast(const char * const roomjid,
const char * const message) {}
void ui_room_member_offline(const char * const roomjid, const char * const nick) {}
void ui_room_member_online(const char * const roomjid, const char * const nick, const char * const roles,
const char * const affiliation, const char * const show, const char * const status) {}
void ui_room_member_nick_change(const char * const roomjid,
const char * const old_nick, const char * const nick) {}
void ui_room_nick_change(const char * const roomjid, const char * const nick) {}
void ui_room_member_presence(const char * const roomjid,
const char * const nick, const char * const show, const char * const status) {}
void ui_room_show_occupants(const char * const roomjid) {}
void ui_room_hide_occupants(const char * const roomjid) {}
void ui_show_roster(void) {}
void ui_hide_roster(void) {}
void ui_roster_add(const char * const barejid, const char * const name) {}
void ui_roster_remove(const char * const barejid) {}
void ui_contact_already_in_group(const char * const contact, const char * const group) {}
void ui_contact_not_in_group(const char * const contact, const char * const group) {}
void ui_group_added(const char * const contact, const char * const group) {}
void ui_group_removed(const char * const contact, const char * const group) {}
void ui_chat_win_contact_online(PContact contact, Resource *resource, GDateTime *last_activity) {}
void ui_chat_win_contact_offline(PContact contact, char *resource, char *status) {}
void ui_handle_recipient_not_found(const char * const recipient, const char * const err_msg) {}
void ui_handle_recipient_error(const char * const recipient, const char * const err_msg) {}
void ui_handle_error(const char * const err_msg) {}
void ui_clear_win_title(void) {}
void ui_handle_room_join_error(const char * const roomjid, const char * const err) {}
void ui_handle_room_configuration(const char * const roomjid, DataForm *form) {}
void ui_handle_room_configuration_form_error(const char * const roomjid, const char * const message) {}
void ui_handle_room_config_submit_result(const char * const roomjid) {}
void ui_handle_room_config_submit_result_error(const char * const roomjid, const char * const message) {}
void ui_handle_room_affiliation_list_error(const char * const roomjid, const char * const affiliation,
const char * const error) {}
void ui_handle_room_affiliation_list(const char * const roomjid, const char * const affiliation, GSList *jids) {}
void ui_handle_room_affiliation_set_error(const char * const roomjid, const char * const jid,
const char * const affiliation, const char * const error) {}
void ui_handle_room_role_set_error(const char * const roomjid, const char * const nick, const char * const role,
const char * const error) {}
void ui_handle_room_role_list_error(const char * const roomjid, const char * const role, const char * const error) {}
void ui_handle_room_role_list(const char * const roomjid, const char * const role, GSList *nicks) {}
void ui_handle_room_kick_error(const char * const roomjid, const char * const nick, const char * const error) {}
void ui_show_form(ProfMucConfWin *confwin) {}
void ui_show_form_field(ProfWin *window, DataForm *form, char *tag) {}
void ui_show_form_help(ProfMucConfWin *confwin) {}
void ui_show_form_field_help(ProfMucConfWin *confwin, char *tag) {}
void ui_show_lines(ProfWin *window, const gchar** lines) {}
void ui_redraw_all_room_rosters(void) {}
void ui_show_all_room_rosters(void) {}
void ui_hide_all_room_rosters(void) {}
void ui_tidy_wins(void) {}
void ui_prune_wins(void) {}
gboolean ui_swap_wins(int source_win, int target_win)
{
return FALSE;
}
void ui_auto_away(void) {}
void ui_end_auto_away(void) {}
void ui_titlebar_presence(contact_presence_t presence) {}
void ui_handle_login_account_success(ProfAccount *account) {}
void ui_update_presence(const resource_presence_t resource_presence,
const char * const message, const char * const show) {}
void ui_about(void) {}
void ui_statusbar_new(const int win) {}
wint_t ui_get_char(char *input, int *size, int *result)
{
return 0;
}
void ui_input_clear(void) {}
void ui_input_nonblocking(void) {}
void ui_replace_input(char *input, const char * const new_input, int *size) {}
void ui_invalid_command_usage(const char * const usage, void (*setting_func)(void)) {}
void ui_create_xmlconsole_win(void) {}
gboolean ui_xmlconsole_exists(void)
{
return FALSE;
}
void ui_open_xmlconsole_win(void) {}
gboolean ui_win_has_unsaved_form(int num)
{
return FALSE;
}
// console window actions
void cons_show(const char * const msg, ...)
{
if (mock_cons_show) {
va_list args;
va_start(args, msg);
vsnprintf(output, sizeof(output), msg, args);
check_expected(output);
va_end(args);
}
}
void cons_about(void) {}
void cons_help(void) {}
void cons_navigation_help(void) {}
void cons_prefs(void) {}
void cons_show_ui_prefs(void) {}
void cons_show_desktop_prefs(void) {}
void cons_show_chat_prefs(void) {}
void cons_show_log_prefs(void) {}
void cons_show_presence_prefs(void) {}
void cons_show_connection_prefs(void) {}
void cons_show_otr_prefs(void) {}
void cons_show_account(ProfAccount *account) {}
void cons_debug(const char * const msg, ...) {}
void cons_show_time(void) {}
void cons_show_word(const char * const word) {}
void cons_show_error(const char * const cmd, ...) {}
void cons_show_contacts(GSList * list) {}
void cons_show_roster(GSList * list) {}
void cons_show_roster_group(const char * const group, GSList * list) {}
void cons_show_wins(void) {}
void cons_show_status(const char * const barejid) {}
void cons_show_info(PContact pcontact) {}
void cons_show_caps(const char * const fulljid, resource_presence_t presence) {}
void cons_show_themes(GSList *themes) {}
void cons_show_aliases(GList *aliases) {}
void cons_show_login_success(ProfAccount *account) {}
void cons_show_software_version(const char * const jid,
const char * const presence, const char * const name,
const char * const version, const char * const os) {}
void cons_show_account_list(gchar **accounts) {}
void cons_show_room_list(GSList *room, const char * const conference_node) {}
void cons_show_bookmarks(const GList *list) {}
void cons_show_disco_items(GSList *items, const char * const jid) {}
void cons_show_disco_info(const char *from, GSList *identities, GSList *features) {}
void cons_show_room_invite(const char * const invitor, const char * const room,
const char * const reason) {}
void cons_check_version(gboolean not_available_msg) {}
void cons_show_typing(const char * const barejid) {}
void cons_show_incoming_message(const char * const short_from, const int win_index) {}
void cons_show_room_invites(GSList *invites) {}
void cons_show_received_subs(void) {}
void cons_show_sent_subs(void) {}
void cons_alert(void) {}
void cons_theme_setting(void) {}
void cons_privileges_setting(void) {}
void cons_beep_setting(void) {}
void cons_flash_setting(void) {}
void cons_splash_setting(void) {}
void cons_vercheck_setting(void) {}
void cons_occupants_setting(void) {}
void cons_roster_setting(void) {}
void cons_presence_setting(void) {}
void cons_wrap_setting(void) {}
void cons_time_setting(void) {}
void cons_mouse_setting(void) {}
void cons_statuses_setting(void) {}
void cons_titlebar_setting(void) {}
void cons_notify_setting(void) {}
void cons_states_setting(void) {}
void cons_outtype_setting(void) {}
void cons_intype_setting(void) {}
void cons_gone_setting(void) {}
void cons_history_setting(void) {}
void cons_log_setting(void) {}
void cons_chlog_setting(void) {}
void cons_grlog_setting(void) {}
void cons_autoaway_setting(void) {}
void cons_reconnect_setting(void) {}
void cons_autoping_setting(void) {}
void cons_priority_setting(void) {}
void cons_autoconnect_setting(void) {}
void cons_inpblock_setting(void) {}
void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *last_activity) {}
void cons_show_contact_offline(PContact contact, char *resource, char *status) {}
void cons_theme_colours(void) {}
// roster window
void rosterwin_roster(void) {}
// occupants window
void occupantswin_occupants(const char * const room) {}
// desktop notifier actions
void notifier_uninit(void) {}
void notify_typing(const char * const handle) {}
void notify_message(const char * const handle, int win, const char * const text) {}
void notify_room_message(const char * const handle, const char * const room,
int win, const char * const text) {}
void notify_remind(void) {}
void notify_invite(const char * const from, const char * const room,
const char * const reason) {}
void notify_subscription(const char * const from) {}

4
tests/ui/stub_ui.h Normal file
View File

@ -0,0 +1,4 @@
#include <glib.h>
void expect_cons_show(char *expected);
void reset_ui_mocks(void);

254
tests/xmpp/stub_xmpp.c Normal file
View File

@ -0,0 +1,254 @@
#include "xmpp/xmpp.h"
// mock state
static jabber_conn_status_t connection_status = JABBER_CONNECTED;
void
reset_xmpp_mocks(void)
{
connection_status = JABBER_CONNECTED;
}
// stubs
// connection functions
void jabber_init(const int disable_tls) {}
jabber_conn_status_t jabber_connect_with_details(const char * const jid,
const char * const passwd, const char * const altdomain, const int port)
{
return JABBER_CONNECTED;
}
jabber_conn_status_t jabber_connect_with_account(const ProfAccount * const account)
{
return JABBER_CONNECTED;
}
void jabber_disconnect(void) {}
void jabber_shutdown(void) {}
void jabber_process_events(void) {}
const char * jabber_get_fulljid(void)
{
return NULL;
}
const char * jabber_get_domain(void)
{
return NULL;
}
void
mock_connection_status(jabber_conn_status_t given_connection_status)
{
connection_status = given_connection_status;
}
jabber_conn_status_t jabber_get_connection_status(void)
{
return connection_status;
}
char* jabber_get_presence_message(void)
{
return NULL;
}
char* jabber_get_account_name(void)
{
return NULL;
}
GList * jabber_get_available_resources(void)
{
return NULL;
}
// message functions
void message_send_chat(const char * const barejid, const char * const msg) {}
void message_send_private(const char * const fulljid, const char * const msg) {}
void message_send_groupchat(const char * const roomjid, const char * const msg) {}
void message_send_groupchat_subject(const char * const roomjid, const char * const subject) {}
void message_send_inactive(const char * const barejid) {}
void message_send_composing(const char * const barejid) {}
void message_send_paused(const char * const barejid) {}
void message_send_gone(const char * const barejid) {}
void message_send_invite(const char * const room, const char * const contact,
const char * const reason) {}
// presence functions
void presence_subscription(const char * const jid, const jabber_subscr_t action) {}
GSList* presence_get_subscription_requests(void)
{
return NULL;
}
gint presence_sub_request_count(void)
{
return 0;
}
void presence_reset_sub_request_search(void) {}
char * presence_sub_request_find(char * search_str)
{
return NULL;
}
void presence_join_room(char *room, char *nick, char * passwd) {}
void presence_change_room_nick(const char * const room, const char * const nick) {}
void presence_leave_chat_room(const char * const room_jid) {}
void presence_update(resource_presence_t status, const char * const msg,
int idle) {}
gboolean presence_sub_request_exists(const char * const bare_jid)
{
return FALSE;
}
// iq functions
void iq_send_software_version(const char * const fulljid) {}
void iq_room_list_request(gchar *conferencejid) {}
void iq_disco_info_request(gchar *jid) {}
void iq_disco_items_request(gchar *jid) {}
void iq_set_autoping(int seconds) {}
void iq_confirm_instant_room(const char * const room_jid) {}
void iq_destroy_room(const char * const room_jid) {}
void iq_request_room_config_form(const char * const room_jid) {}
void iq_submit_room_config(const char * const room, DataForm *form) {}
void iq_room_config_cancel(const char * const room_jid) {}
void iq_send_ping(const char * const target) {}
void iq_send_caps_request(const char * const to, const char * const id,
const char * const node, const char * const ver) {}
void iq_send_caps_request_for_jid(const char * const to, const char * const id,
const char * const node, const char * const ver) {}
void iq_send_caps_request_legacy(const char * const to, const char * const id,
const char * const node, const char * const ver) {}
void iq_room_info_request(gchar *room) {}
void iq_room_affiliation_list(const char * const room, char *affiliation) {}
void iq_room_affiliation_set(const char * const room, const char * const jid, char *affiliation,
const char * const reason) {}
void iq_room_kick_occupant(const char * const room, const char * const nick, const char * const reason) {}
void iq_room_role_set(const char * const room, const char * const nick, char *role,
const char * const reason) {}
void iq_room_role_list(const char * const room, char *role) {}
// caps functions
Capabilities* caps_lookup(const char * const jid)
{
return NULL;
}
void caps_close(void) {}
void caps_destroy(Capabilities *caps) {}
gboolean bookmark_add(const char *jid, const char *nick, const char *password, const char *autojoin_str)
{
return FALSE;
}
gboolean bookmark_update(const char *jid, const char *nick, const char *password, const char *autojoin_str)
{
return FALSE;
}
gboolean bookmark_remove(const char *jid)
{
return FALSE;
}
gboolean bookmark_join(const char *jid)
{
return FALSE;
}
const GList * bookmark_get_list(void)
{
return NULL;
}
char * bookmark_find(char *search_str)
{
return NULL;
}
void bookmark_autocomplete_reset(void) {}
void roster_send_name_change(const char * const barejid, const char * const new_name, GSList *groups) {}
void roster_send_add_to_group(const char * const group, PContact contact) {}
void roster_send_remove_from_group(const char * const group, PContact contact) {}
void roster_send_add_new(const char * const barejid, const char * const name) {}
void roster_send_remove(const char * const barejid) {}
void form_destroy(DataForm *form) {}
char * form_get_form_type_field(DataForm *form)
{
return NULL;
}
void form_set_value(DataForm *form, const char * const tag, char *value) {}
gboolean form_add_unique_value(DataForm *form, const char * const tag, char *value)
{
return FALSE;
}
void form_add_value(DataForm *form, const char * const tag, char *value) {}
gboolean form_remove_value(DataForm *form, const char * const tag, char *value)
{
return FALSE;
}
gboolean form_remove_text_multi_value(DataForm *form, const char * const tag, int index)
{
return FALSE;
}
gboolean form_tag_exists(DataForm *form, const char * const tag)
{
return FALSE;
}
form_field_type_t form_get_field_type(DataForm *form, const char * const tag)
{
return FIELD_BOOLEAN;
}
gboolean form_field_contains_option(DataForm *form, const char * const tag, char *value)
{
return FALSE;
}
int form_get_value_count(DataForm *form, const char * const tag)
{
return 0;
}
FormField* form_get_field_by_tag(DataForm *form, const char * const tag)
{
return NULL;
}
Autocomplete form_get_value_ac(DataForm *form, const char * const tag)
{
return NULL;
}
void form_reset_autocompleters(DataForm *form) {}
GSList * form_get_non_form_type_fields_sorted(DataForm *form)
{
return NULL;
}
GSList * form_get_field_values_sorted(FormField *field)
{
return NULL;
}

4
tests/xmpp/stub_xmpp.h Normal file
View File

@ -0,0 +1,4 @@
#include "xmpp/xmpp.h"
void mock_connection_status(jabber_conn_status_t given_connection_status);
void reset_xmpp_mocks(void);