diff options
author | James Booth <boothj5@gmail.com> | 2015-04-28 23:38:56 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-04-28 23:38:56 +0100 |
commit | 8aba52f4fe20a126c59322fe8e6ab7479ab83633 (patch) | |
tree | 72e411270e12007b8b053769abeb784d28698291 | |
parent | 403e9b47fe985cb7b1e1644bf8d3bfb0cc4eb829 (diff) | |
download | profani-tty-8aba52f4fe20a126c59322fe8e6ab7479ab83633.tar.gz |
Renamed event functions
-rw-r--r-- | src/command/commands.c | 32 | ||||
-rw-r--r-- | src/event/client_events.c | 14 | ||||
-rw-r--r-- | src/event/client_events.h | 14 | ||||
-rw-r--r-- | src/event/server_events.c | 130 | ||||
-rw-r--r-- | src/event/server_events.h | 130 | ||||
-rw-r--r-- | src/xmpp/connection.c | 10 | ||||
-rw-r--r-- | src/xmpp/iq.c | 56 | ||||
-rw-r--r-- | src/xmpp/message.c | 42 | ||||
-rw-r--r-- | src/xmpp/presence.c | 34 | ||||
-rw-r--r-- | src/xmpp/roster.c | 12 | ||||
-rw-r--r-- | tests/test_server_events.c | 28 |
11 files changed, 251 insertions, 251 deletions
diff --git a/src/command/commands.c b/src/command/commands.c index 2d9e1dfc..9eaa6e9b 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -109,19 +109,19 @@ cmd_execute_default(const char * inp) case WIN_CHAT: { ProfChatWin *chatwin = wins_get_current_chat(); - client_send_msg(chatwin->barejid, inp); + cl_ev_send_msg(chatwin->barejid, inp); break; } case WIN_PRIVATE: { ProfPrivateWin *privatewin = wins_get_current_private(); - client_send_priv_msg(privatewin->fulljid, inp); + cl_ev_send_priv_msg(privatewin->fulljid, inp); break; } case WIN_MUC: { ProfMucWin *mucwin = wins_get_current_muc(); - client_send_muc_msg(mucwin->roomjid, inp); + cl_ev_send_muc_msg(mucwin->roomjid, inp); break; } default: @@ -208,13 +208,13 @@ cmd_connect(gchar **args, struct cmd_help_t help) if (account) { // use password if set if (account->password) { - conn_status = client_connect_account(account); + conn_status = cl_ev_connect_account(account); // use eval_password if set } else if (account->eval_password) { gboolean res = account_eval_password(account); if (res) { - conn_status = client_connect_account(account); + conn_status = cl_ev_connect_account(account); free(account->password); account->password = NULL; } else { @@ -226,7 +226,7 @@ cmd_connect(gchar **args, struct cmd_help_t help) // no account password setting, prompt } else { account->password = ui_ask_password(); - conn_status = client_connect_account(account); + conn_status = cl_ev_connect_account(account); free(account->password); account->password = NULL; } @@ -237,7 +237,7 @@ cmd_connect(gchar **args, struct cmd_help_t help) } else { jid = strdup(lower); char *passwd = ui_ask_password(); - conn_status = client_connect_jid(jid, passwd, altdomain, port); + conn_status = cl_ev_connect_jid(jid, passwd, altdomain, port); free(passwd); } @@ -1306,7 +1306,7 @@ cmd_msg(gchar **args, struct cmd_help_t help) g_string_append(full_jid, usr); if (msg) { - client_send_priv_msg(full_jid->str, msg); + cl_ev_send_priv_msg(full_jid->str, msg); } else { ui_new_private_win(full_jid->str); } @@ -1327,14 +1327,14 @@ cmd_msg(gchar **args, struct cmd_help_t help) } if (msg) { - client_send_msg(barejid, msg); + cl_ev_send_msg(barejid, msg); return TRUE; } else { ProfWin *window = (ProfWin*)wins_get_chat(barejid); if (window) { - client_focus_win(window); + ui_ev_focus_win(window); } else { - client_new_chat_win(barejid); + ui_ev_new_chat_win(barejid); } #ifdef HAVE_LIBOTR @@ -3141,19 +3141,19 @@ cmd_tiny(gchar **args, struct cmd_help_t help) case WIN_CHAT: { ProfChatWin *chatwin = wins_get_current_chat(); - client_send_msg(chatwin->barejid, tiny); + cl_ev_send_msg(chatwin->barejid, tiny); break; } case WIN_PRIVATE: { ProfPrivateWin *privatewin = wins_get_current_private(); - client_send_priv_msg(privatewin->fulljid, tiny); + cl_ev_send_priv_msg(privatewin->fulljid, tiny); break; } case WIN_MUC: { ProfMucWin *mucwin = wins_get_current_muc(); - client_send_muc_msg(mucwin->roomjid, tiny); + cl_ev_send_muc_msg(mucwin->roomjid, tiny); break; } default: @@ -4171,9 +4171,9 @@ cmd_otr(gchar **args, struct cmd_help_t help) ProfWin *window = (ProfWin*)wins_get_chat(barejid); if (window) { - client_focus_win(window); + ui_ev_focus_win(window); } else { - client_new_chat_win(barejid); + ui_ev_new_chat_win(barejid); } if (ui_current_win_is_otr()) { diff --git a/src/event/client_events.c b/src/event/client_events.c index 2aa66d08..6ee3c832 100644 --- a/src/event/client_events.c +++ b/src/event/client_events.c @@ -43,14 +43,14 @@ #endif jabber_conn_status_t -client_connect_jid(const char * const jid, const char * const passwd, const char * const altdomain, const int port) +cl_ev_connect_jid(const char * const jid, const char * const passwd, const char * const altdomain, const int port) { cons_show("Connecting as %s", jid); return jabber_connect_with_details(jid, passwd, altdomain, port); } jabber_conn_status_t -client_connect_account(ProfAccount *account) +cl_ev_connect_account(ProfAccount *account) { char *jid = account_create_full_jid(account); cons_show("Connecting with account %s as %s", account->name, jid); @@ -60,7 +60,7 @@ client_connect_account(ProfAccount *account) } void -client_send_msg(const char * const barejid, const char * const msg) +cl_ev_send_msg(const char * const barejid, const char * const msg) { #ifdef HAVE_LIBOTR otr_on_message_send(barejid, msg); @@ -73,26 +73,26 @@ client_send_msg(const char * const barejid, const char * const msg) } void -client_send_muc_msg(const char * const roomjid, const char * const msg) +cl_ev_send_muc_msg(const char * const roomjid, const char * const msg) { message_send_groupchat(roomjid, msg); } void -client_send_priv_msg(const char * const fulljid, const char * const msg) +cl_ev_send_priv_msg(const char * const fulljid, const char * const msg) { message_send_private(fulljid, msg); ui_outgoing_private_msg(fulljid, msg); } void -client_focus_win(ProfWin *win) +ui_ev_focus_win(ProfWin *win) { ui_switch_win(win); } void -client_new_chat_win(const char * const barejid) +ui_ev_new_chat_win(const char * const barejid) { ProfWin *win = ui_new_chat_win(barejid); ui_switch_win(win); diff --git a/src/event/client_events.h b/src/event/client_events.h index efa535c9..55f2b477 100644 --- a/src/event/client_events.h +++ b/src/event/client_events.h @@ -35,14 +35,14 @@ #ifndef CLIENT_EVENTS_H #define CLIENT_EVENTS_H -jabber_conn_status_t client_connect_jid(const char * const jid, const char * const passwd, const char * const altdomain, const int port); -jabber_conn_status_t client_connect_account(ProfAccount *account); +jabber_conn_status_t cl_ev_connect_jid(const char * const jid, const char * const passwd, const char * const altdomain, const int port); +jabber_conn_status_t cl_ev_connect_account(ProfAccount *account); -void client_send_msg(const char * const barejid, const char * const msg); -void client_send_muc_msg(const char * const roomjid, const char * const msg); -void client_send_priv_msg(const char * const fulljid, const char * const msg); +void cl_ev_send_msg(const char * const barejid, const char * const msg); +void cl_ev_send_muc_msg(const char * const roomjid, const char * const msg); +void cl_ev_send_priv_msg(const char * const fulljid, const char * const msg); -void client_focus_win(ProfWin *win); -void client_new_chat_win(const char * const barejid); +void ui_ev_focus_win(ProfWin *win); +void ui_ev_new_chat_win(const char * const barejid); #endif \ No newline at end of file diff --git a/src/event/server_events.c b/src/event/server_events.c index 514835ba..56d5b11f 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -51,7 +51,7 @@ #include "ui/ui.h" void -srv_room_join_error(const char * const room, const char * const err) +sv_ev_room_join_error(const char * const room, const char * const err) { if (muc_active(room)) { muc_leave(room); @@ -61,7 +61,7 @@ srv_room_join_error(const char * const room, const char * const err) // handle presence stanza errors void -srv_presence_error(const char *from, const char * const type, +sv_ev_presence_error(const char *from, const char * const type, const char *err_msg) { // handle error from recipient @@ -76,7 +76,7 @@ srv_presence_error(const char *from, const char * const type, // handle message stanza errors void -srv_message_error(const char * const jid, const char * const type, +sv_ev_message_error(const char * const jid, const char * const type, const char * const err_msg) { // handle errors from no recipient @@ -96,7 +96,7 @@ srv_message_error(const char * const jid, const char * const type, } void -srv_login_account_success(char *account_name) +sv_ev_login_account_success(char *account_name) { ProfAccount *account = accounts_get_account(account_name); @@ -123,7 +123,7 @@ srv_login_account_success(char *account_name) } void -srv_roster_received(void) +sv_ev_roster_received(void) { if (prefs_get_boolean(PREF_ROSTER)) { ui_show_roster(); @@ -131,7 +131,7 @@ srv_roster_received(void) } void -srv_lost_connection(void) +sv_ev_lost_connection(void) { cons_show_error("Lost connection."); roster_clear(); @@ -141,27 +141,27 @@ srv_lost_connection(void) } void -srv_failed_login(void) +sv_ev_failed_login(void) { cons_show_error("Login failed."); log_info("Login failed"); } void -srv_software_version_result(const char * const jid, const char * const presence, +sv_ev_software_version_result(const char * const jid, const char * const presence, const char * const name, const char * const version, const char * const os) { cons_show_software_version(jid, presence, name, version, os); } void -srv_disco_info(const char *from, GSList *identities, GSList *features) +sv_ev_disco_info(const char *from, GSList *identities, GSList *features) { cons_show_disco_info(from, identities, features); } void -srv_room_disco_info(const char * const room, GSList *identities, GSList *features, gboolean display) +sv_ev_room_disco_info(const char * const room, GSList *identities, GSList *features, gboolean display) { muc_set_features(room, features); if (display) { @@ -170,7 +170,7 @@ srv_room_disco_info(const char * const room, GSList *identities, GSList *feature } void -srv_disco_info_error(const char * const from, const char * const error) +sv_ev_disco_info_error(const char * const from, const char * const error) { if (from) { cons_show_error("Service discovery failed for %s: %s", from, error); @@ -180,31 +180,31 @@ srv_disco_info_error(const char * const from, const char * const error) } void -srv_enable_carbons_error(const char * const error) +sv_ev_enable_carbons_error(const char * const error) { cons_show_error("Server error enabling message carbons: %s", error); } void -srv_disable_carbons_error(const char * const error) +sv_ev_disable_carbons_error(const char * const error) { cons_show_error("Server error disabling message carbons: %s", error); } void -srv_room_info_error(const char * const room, const char * const error) +sv_ev_room_info_error(const char * const room, const char * const error) { ui_handle_room_info_error(room, error); } void -srv_room_list(GSList *rooms, const char *conference_node) +sv_ev_room_list(GSList *rooms, const char *conference_node) { cons_show_room_list(rooms, conference_node); } void -srv_room_affiliation_list_result_error(const char * const room, const char * const affiliation, +sv_ev_room_affiliation_list_result_error(const char * const room, const char * const affiliation, const char * const error) { log_debug("Error retrieving %s list for room %s: %s", affiliation, room, error); @@ -212,14 +212,14 @@ srv_room_affiliation_list_result_error(const char * const room, const char * con } void -srv_room_affiliation_list(const char * const room, const char * const affiliation, GSList *jids) +sv_ev_room_affiliation_list(const char * const room, const char * const affiliation, GSList *jids) { muc_jid_autocomplete_add_all(room, jids); ui_handle_room_affiliation_list(room, affiliation, jids); } void -srv_room_role_set_error(const char * const room, const char * const nick, const char * const role, +sv_ev_room_role_set_error(const char * const room, const char * const nick, const char * const role, const char * const error) { log_debug("Error setting role %s list for room %s, user %s: %s", role, room, nick, error); @@ -227,20 +227,20 @@ srv_room_role_set_error(const char * const room, const char * const nick, const } void -srv_room_role_list_result_error(const char * const room, const char * const role, const char * const error) +sv_ev_room_role_list_result_error(const char * const room, const char * const role, const char * const error) { log_debug("Error retrieving %s list for room %s: %s", role, room, error); ui_handle_room_role_list_error(room, role, error); } void -srv_room_role_list(const char * const room, const char * const role, GSList *nicks) +sv_ev_room_role_list(const char * const room, const char * const role, GSList *nicks) { ui_handle_room_role_list(room, role, nicks); } void -srv_room_affiliation_set_error(const char * const room, const char * const jid, const char * const affiliation, +sv_ev_room_affiliation_set_error(const char * const room, const char * const jid, const char * const affiliation, const char * const error) { log_debug("Error setting affiliation %s list for room %s, user %s: %s", affiliation, room, jid, error); @@ -248,13 +248,13 @@ srv_room_affiliation_set_error(const char * const room, const char * const jid, } void -srv_disco_items(GSList *items, const char *jid) +sv_ev_disco_items(GSList *items, const char *jid) { cons_show_disco_items(items, jid); } void -srv_room_invite(jabber_invite_t invite_type, +sv_ev_room_invite(jabber_invite_t invite_type, const char * const invitor, const char * const room, const char * const reason, const char * const password) { @@ -265,7 +265,7 @@ srv_room_invite(jabber_invite_t invite_type, } void -srv_room_broadcast(const char *const room_jid, +sv_ev_room_broadcast(const char *const room_jid, const char * const message) { if (muc_roster_complete(room_jid)) { @@ -276,7 +276,7 @@ srv_room_broadcast(const char *const room_jid, } void -srv_room_subject(const char * const room, const char * const nick, const char * const subject) +sv_ev_room_subject(const char * const room, const char * const nick, const char * const subject) { muc_set_subject(room, subject); if (muc_roster_complete(room)) { @@ -285,14 +285,14 @@ srv_room_subject(const char * const room, const char * const nick, const char * } void -srv_room_history(const char * const room_jid, const char * const nick, +sv_ev_room_history(const char * const room_jid, const char * const nick, GTimeVal tv_stamp, const char * const message) { ui_room_history(room_jid, nick, tv_stamp, message); } void -srv_room_message(const char * const room_jid, const char * const nick, +sv_ev_room_message(const char * const room_jid, const char * const nick, const char * const message) { ui_room_message(room_jid, nick, message); @@ -305,19 +305,19 @@ srv_room_message(const char * const room_jid, const char * const nick, } void -srv_incoming_private_message(char *fulljid, char *message) +sv_ev_incoming_private_message(char *fulljid, char *message) { ui_incoming_private_msg(fulljid, message, NULL); } void -srv_carbon(char *barejid, char *message) +sv_ev_carbon(char *barejid, char *message) { ui_outgoing_chat_msg_carbon(barejid, message); } void -srv_incoming_message(char *barejid, char *resource, char *message) +sv_ev_incoming_message(char *barejid, char *resource, char *message) { #ifdef HAVE_LIBOTR otr_on_message_recv(barejid, resource, message); @@ -328,26 +328,26 @@ srv_incoming_message(char *barejid, char *resource, char *message) } void -srv_delayed_private_message(char *fulljid, char *message, GTimeVal tv_stamp) +sv_ev_delayed_private_message(char *fulljid, char *message, GTimeVal tv_stamp) { ui_incoming_private_msg(fulljid, message, &tv_stamp); } void -srv_delayed_message(char *barejid, char *message, GTimeVal tv_stamp) +sv_ev_delayed_message(char *barejid, char *message, GTimeVal tv_stamp) { ui_incoming_msg(barejid, NULL, message, &tv_stamp); chat_log_msg_in_delayed(barejid, message, &tv_stamp); } void -srv_message_receipt(char *barejid, char *id) +sv_ev_message_receipt(char *barejid, char *id) { ui_message_receipt(barejid, id); } void -srv_typing(char *barejid, char *resource) +sv_ev_typing(char *barejid, char *resource) { ui_contact_typing(barejid, resource); if (ui_chat_win_exists(barejid)) { @@ -356,7 +356,7 @@ srv_typing(char *barejid, char *resource) } void -srv_paused(char *barejid, char *resource) +sv_ev_paused(char *barejid, char *resource) { if (ui_chat_win_exists(barejid)) { chat_session_recipient_paused(barejid, resource); @@ -364,7 +364,7 @@ srv_paused(char *barejid, char *resource) } void -srv_inactive(char *barejid, char *resource) +sv_ev_inactive(char *barejid, char *resource) { if (ui_chat_win_exists(barejid)) { chat_session_recipient_inactive(barejid, resource); @@ -372,7 +372,7 @@ srv_inactive(char *barejid, char *resource) } void -srv_gone(const char * const barejid, const char * const resource) +sv_ev_gone(const char * const barejid, const char * const resource) { ui_recipient_gone(barejid, resource); if (ui_chat_win_exists(barejid)) { @@ -381,7 +381,7 @@ srv_gone(const char * const barejid, const char * const resource) } void -srv_activity(const char * const barejid, const char * const resource, gboolean send_states) +sv_ev_activity(const char * const barejid, const char * const resource, gboolean send_states) { if (ui_chat_win_exists(barejid)) { chat_session_recipient_active(barejid, resource, send_states); @@ -389,7 +389,7 @@ srv_activity(const char * const barejid, const char * const resource, gboolean s } void -srv_subscription(const char *barejid, jabber_subscr_t type) +sv_ev_subscription(const char *barejid, jabber_subscr_t type) { switch (type) { case PRESENCE_SUBSCRIBE: @@ -418,7 +418,7 @@ srv_subscription(const char *barejid, jabber_subscr_t type) } void -srv_contact_offline(char *barejid, char *resource, char *status) +sv_ev_contact_offline(char *barejid, char *resource, char *status) { gboolean updated = roster_contact_offline(barejid, resource, status); @@ -431,7 +431,7 @@ srv_contact_offline(char *barejid, char *resource, char *status) } void -srv_contact_online(char *barejid, Resource *resource, +sv_ev_contact_online(char *barejid, Resource *resource, GDateTime *last_activity) { gboolean updated = roster_update_presence(barejid, resource, last_activity); @@ -474,21 +474,21 @@ srv_contact_online(char *barejid, Resource *resource, } void -srv_leave_room(const char * const room) +sv_ev_leave_room(const char * const room) { muc_leave(room); ui_leave_room(room); } void -srv_room_destroy(const char * const room) +sv_ev_room_destroy(const char * const room) { muc_leave(room); ui_room_destroy(room); } void -srv_room_destroyed(const char * const room, const char * const new_jid, const char * const password, +sv_ev_room_destroyed(const char * const room, const char * const new_jid, const char * const password, const char * const reason) { muc_leave(room); @@ -496,51 +496,51 @@ srv_room_destroyed(const char * const room, const char * const new_jid, const ch } void -srv_room_kicked(const char * const room, const char * const actor, const char * const reason) +sv_ev_room_kicked(const char * const room, const char * const actor, const char * const reason) { muc_leave(room); ui_room_kicked(room, actor, reason); } void -srv_room_banned(const char * const room, const char * const actor, const char * const reason) +sv_ev_room_banned(const char * const room, const char * const actor, const char * const reason) { muc_leave(room); ui_room_banned(room, actor, reason); } void -srv_room_configure(const char * const room, DataForm *form) +sv_ev_room_configure(const char * const room, DataForm *form) { ui_handle_room_configuration(room, form); } void -srv_room_configuration_form_error(const char * const room, const char * const message) +sv_ev_room_configuration_form_error(const char * const room, const char * const message) { ui_handle_room_configuration_form_error(room, message); } void -srv_room_config_submit_result(const char * const room) +sv_ev_room_config_submit_result(const char * const room) { ui_handle_room_config_submit_result(room); } void -srv_room_config_submit_result_error(const char * const room, const char * const message) +sv_ev_room_config_submit_result_error(const char * const room, const char * const message) { ui_handle_room_config_submit_result_error(room, message); } void -srv_room_kick_result_error(const char * const room, const char * const nick, const char * const error) +sv_ev_room_kick_result_error(const char * const room, const char * const nick, const char * const error) { ui_handle_room_kick_error(room, nick, error); } void -srv_room_occupant_offline(const char * const room, const char * const nick, +sv_ev_room_occupant_offline(const char * const room, const char * const nick, const char * const show, const char * const status) { muc_roster_remove(room, nick); @@ -554,7 +554,7 @@ srv_room_occupant_offline(const char * const room, const char * const nick, } void -srv_room_occupent_kicked(const char * const room, const char * const nick, const char * const actor, +sv_ev_room_occupent_kicked(const char * const room, const char * const nick, const char * const actor, const char * const reason) { muc_roster_remove(room, nick); @@ -563,7 +563,7 @@ srv_room_occupent_kicked(const char * const room, const char * const nick, const } void -srv_room_occupent_banned(const char * const room, const char * const nick, const char * const actor, +sv_ev_room_occupent_banned(const char * const room, const char * const nick, const char * const actor, const char * const reason) { muc_roster_remove(room, nick); @@ -572,33 +572,33 @@ srv_room_occupent_banned(const char * const room, const char * const nick, const } void -srv_group_add(const char * const contact, +sv_ev_group_add(const char * const contact, const char * const group) { ui_group_added(contact, group); } void -srv_group_remove(const char * const contact, +sv_ev_group_remove(const char * const contact, const char * const group) { ui_group_removed(contact, group); } void -srv_roster_remove(const char * const barejid) +sv_ev_roster_remove(const char * const barejid) { ui_roster_remove(barejid); } void -srv_roster_add(const char * const barejid, const char * const name) +sv_ev_roster_add(const char * const barejid, const char * const name) { ui_roster_add(barejid, name); } void -srv_roster_update(const char * const barejid, const char * const name, +sv_ev_roster_update(const char * const barejid, const char * const name, GSList *groups, const char * const subscription, gboolean pending_out) { roster_update(barejid, name, groups, subscription, pending_out); @@ -606,20 +606,20 @@ srv_roster_update(const char * const barejid, const char * const name, } void -srv_autoping_cancel(void) +sv_ev_autoping_cancel(void) { prefs_set_autoping(0); cons_show_error("Server ping not supported, autoping disabled."); } void -srv_xmpp_stanza(const char * const msg) +sv_ev_xmpp_stanza(const char * const msg) { ui_handle_stanza(msg); } void -srv_ping_result(const char * const from, int millis) +sv_ev_ping_result(const char * const from, int millis) { if (from == NULL) { cons_show("Ping response from server: %dms.", millis); @@ -629,7 +629,7 @@ srv_ping_result(const char * const from, int millis) } void -srv_ping_error_result(const char * const from, const char * const error) +sv_ev_ping_error_result(const char * const from, const char * const error) { if (error == NULL) { cons_show_error("Error returned from pinging %s.", from); @@ -639,7 +639,7 @@ srv_ping_error_result(const char * const from, const char * const error) } void -srv_muc_self_online(const char * const room, const char * const nick, gboolean config_required, +sv_ev_muc_self_online(const char * const room, const char * const nick, gboolean config_required, const char * const role, const char * const affiliation, const char * const actor, const char * const reason, const char * const jid, const char * const show, const char * const status) { @@ -716,7 +716,7 @@ srv_muc_self_online(const char * const room, const char * const nick, gboolean c } void -srv_muc_occupant_online(const char * const room, const char * const nick, const char * const jid, +sv_ev_muc_occupant_online(const char * const room, const char * const nick, const char * const jid, const char * const role, const char * const affiliation, const char * const actor, const char * const reason, const char * const show, const char * const status) { diff --git a/src/event/server_events.h b/src/event/server_events.h index acba1391..daf885b3 100644 --- a/src/event/server_events.h +++ b/src/event/server_events.h @@ -37,93 +37,93 @@ #include "xmpp/xmpp.h" -void srv_login_account_success(char *account_name); -void srv_lost_connection(void); -void srv_failed_login(void); -void srv_software_version_result(const char * const jid, const char * const presence, +void sv_ev_login_account_success(char *account_name); +void sv_ev_lost_connection(void); +void sv_ev_failed_login(void); +void sv_ev_software_version_result(const char * const jid, const char * const presence, const char * const name, const char * const version, const char * const os); -void srv_disco_info(const char *from, GSList *identities, GSList *features); -void srv_disco_info_error(const char * const from, const char * const error); -void srv_room_list(GSList *rooms, const char *conference_node); -void srv_disco_items(GSList *items, const char *jid); -void srv_room_invite(jabber_invite_t invite_type, +void sv_ev_disco_info(const char *from, GSList *identities, GSList *features); +void sv_ev_disco_info_error(const char * const from, const char * const error); +void sv_ev_room_list(GSList *rooms, const char *conference_node); +void sv_ev_disco_items(GSList *items, const char *jid); +void sv_ev_room_invite(jabber_invite_t invite_type, const char * const invitor, const char * const room, const char * const reason, const char * const password); -void srv_room_broadcast(const char *const room_jid, +void sv_ev_room_broadcast(const char *const room_jid, const char * const message); -void srv_room_subject(const char * const room, const char * const nick, const char * const subject); -void srv_room_history(const char * const room_jid, const char * const nick, +void sv_ev_room_subject(const char * const room, const char * const nick, const char * const subject); +void sv_ev_room_history(const char * const room_jid, const char * const nick, GTimeVal tv_stamp, const char * const message); -void srv_room_message(const char * const room_jid, const char * const nick, +void sv_ev_room_message(const char * const room_jid, const char * const nick, const char * const message); -void srv_room_join_error(const char * const room, const char * const err); -void srv_room_info_error(const char * const room, const char * const error); -void srv_room_disco_info(const char * const room, GSList *identities, GSList *features, gboolean display); -void srv_room_affiliation_list_result_error(const char * const room, const char * const affiliation, +void sv_ev_room_join_error(const char * const room, const char * const err); +void sv_ev_room_info_error(const char * const room, const char * const error); +void sv_ev_room_disco_info(const char * const room, GSList *identities, GSList *features, gboolean display); +void sv_ev_room_affiliation_list_result_error(const char * const room, const char * const affiliation, const char * const error); -void srv_room_affiliation_list(const char * const room, const char * const affiliation, GSList *jids); -void srv_room_affiliation_set_error(const char * const room, const char * const jid, const char * const affiliation, +void sv_ev_room_affiliation_list(const char * const room, const char * const affiliation, GSList *jids); +void sv_ev_room_affiliation_set_error(const char * const room, const char * const jid, const char * const affiliation, const char * const error); -void srv_room_role_list_result_error(const char * const from, const char * const role, const char * const error); -void srv_room_role_list(const char * const from, const char * const role, GSList *nicks); -void srv_room_role_set_error(const char * const room, const char * const nick, const char * const role, +void sv_ev_room_role_list_result_error(const char * const from, const char * const role, const char * const error); +void sv_ev_room_role_list(const char * const from, const char * const role, GSList *nicks); +void sv_ev_room_role_set_error(const char * const room, const char * const nick, const char * const role, const char * const error); -void srv_room_kick_result_error(const char * const room, const char * const nick, const char * const error); -void srv_incoming_message(char *barejid, char *resource, char *message); -void srv_incoming_private_message(char *fulljid, char *message); -void srv_delayed_message(char *fulljid, char *message, GTimeVal tv_stamp); -void srv_delayed_private_message(char *fulljid, char *message, GTimeVal tv_stamp); -void srv_typing(char *barejid, char *resource); -void srv_paused(char *barejid, char *resource); -void srv_inactive(char *barejid, char *resource); -void srv_activity(char *barejid, char *resource, gboolean send_states); -void srv_gone(const char * const barejid, const char * const resource); -void srv_subscription(const char *from, jabber_subscr_t type); -void srv_message_receipt(char *barejid, char *id); -void srv_contact_offline(char *contact, char *resource, char *status); -void srv_contact_online(char *contact, Resource *resource, +void sv_ev_room_kick_result_error(const char * const room, const char * const nick, const char * const error); +void sv_ev_incoming_message(char *barejid, char *resource, char *message); +void sv_ev_incoming_private_message(char *fulljid, char *message); +void sv_ev_delayed_message(char *fulljid, char *message, GTimeVal tv_stamp); +void sv_ev_delayed_private_message(char *fulljid, char *message, GTimeVal tv_stamp); +void sv_ev_typing(char *barejid, char *resource); +void sv_ev_paused(char *barejid, char *resource); +void sv_ev_inactive(char *barejid, char *resource); +void sv_ev_activity(char *barejid, char *resource, gboolean send_states); +void sv_ev_gone(const char * const barejid, const char * const resource); +void sv_ev_subscription(const char *from, jabber_subscr_t type); +void sv_ev_message_receipt(char *barejid, char *id); +void sv_ev_contact_offline(char *contact, char *resource, char *status); +void sv_ev_contact_online(char *contact, Resource *resource, GDateTime *last_activity); -void srv_leave_room(const char * const room); -void srv_room_destroy(const char * const room); -void srv_room_occupant_offline(const char * const room, const char * const nick, +void sv_ev_leave_room(const char * const room); +void sv_ev_room_destroy(const char * const room); +void sv_ev_room_occupant_offline(const char * const room, const char * const nick, const char * const show, const char * const status); -void srv_room_destroyed(const char * const room, const char * const new_jid, const char * const password, +void sv_ev_room_destroyed(const char * const room, const char * const new_jid, const char * const password, const char * const reason); -void srv_room_kicked(const char * const room, const char * const actor, const char * const reason); -void srv_room_occupent_kicked(const char * const room, const char * const nick, const char * const actor, +void sv_ev_room_kicked(const char * const room, const char * const actor, const char * const reason); +void sv_ev_room_occupent_kicked(const char * const room, const char * const nick, const char * const actor, const char * const reason); -void srv_room_banned(const char * const room, const char * const actor, const char * const reason); -void srv_room_occupent_banned(const char * const room, const char * const nick, const char * const actor, +void sv_ev_room_banned(const char * const room, const char * const actor, const char * const reason); +void sv_ev_room_occupent_banned(const char * const room, const char * const nick, const char * const actor, const char * const reason); -void srv_group_add(const char * const contact, +void sv_ev_group_add(const char * const contact, const char * const group); -void srv_group_remove(const char * const contact, +void sv_ev_group_remove(const char * const contact, const char * const group); -void srv_roster_remove(const char * const barejid); -void srv_roster_add(const char * const barejid, const char * const name); -void srv_autoping_cancel(void); -void srv_carbon(char *barejid, char *message); -void srv_message_error(const char * const from, const char * const type, +void sv_ev_roster_remove(const char * const barejid); +void sv_ev_roster_add(const char * const barejid, const char * const name); +void sv_ev_autoping_cancel(void); +void sv_ev_carbon(char *barejid, char *message); +void sv_ev_message_error(const char * const from, const char * const type, const char * const err_msg); -void srv_presence_error(const char *from, const char * const type, +void sv_ev_presence_error(const char *from, const char * const type, const char *err_msg); -void srv_xmpp_stanza(const char * const msg); -void srv_ping_result(const char * const from, int millis); -void srv_ping_error_result(const char * const from, const char * const error); -void srv_room_configure(const char * const room, DataForm *form); -void srv_room_configuration_form_error(const char * const from, const char * const message); -void srv_room_config_submit_result(const char * const room); -void srv_room_config_submit_result_error(const char * const room, const char * const message); -void srv_muc_self_online(const char * const room, const char * const nick, gboolean config_required, +void sv_ev_xmpp_stanza(const char * const msg); +void sv_ev_ping_result(const char * const from, int millis); +void sv_ev_ping_error_result(const char * const from, const char * const error); +void sv_ev_room_configure(const char * const room, DataForm *form); +void sv_ev_room_configuration_form_error(const char * const from, const char * const message); +void sv_ev_room_config_submit_result(const char * const room); +void sv_ev_room_config_submit_result_error(const char * const room, const char * const message); +void sv_ev_muc_self_online(const char * const room, const char * const nick, gboolean config_required, const char * const role, const char * const affiliation, const char * const actor, const char * const reason, const char * const jid, const char * const show, const char * const status); -void srv_muc_occupant_online(const char * const room, const char * const nick, const char * const jid, +void sv_ev_muc_occupant_online(const char * const room, const char * const nick, const char * const jid, const char * const role, const char * const affiliation, const char * const actor, const char * const reason, const char * const show_str, const char * const status_str); -void srv_roster_update(const char * const barejid, const char * const name, +void sv_ev_roster_update(const char * const barejid, const char * const name, GSList *groups, const char * const subscription, gboolean pending_out); -void srv_roster_received(void); -void srv_enable_carbons_error(const char * const error); -void srv_disable_carbons_error(const char * const error); +void sv_ev_roster_received(void); +void sv_ev_enable_carbons_error(const char * const error); +void sv_ev_disable_carbons_error(const char * const error); #endif diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 295c8f2f..f2596f14 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -438,7 +438,7 @@ _connection_handler(xmpp_conn_t * const conn, // logged in with account if (saved_account.name != NULL) { log_debug("Connection handler: logged in with account name: %s", saved_account.name); - srv_login_account_success(saved_account.name); + sv_ev_login_account_success(saved_account.name); // logged in without account, use details to create new account } else { @@ -446,7 +446,7 @@ _connection_handler(xmpp_conn_t * const conn, accounts_add(saved_details.name, saved_details.altdomain, saved_details.port); accounts_set_jid(saved_details.name, saved_details.jid); - srv_login_account_success(saved_details.name); + sv_ev_login_account_success(saved_details.name); saved_account.name = strdup(saved_details.name); saved_account.passwd = strdup(saved_details.passwd); @@ -486,7 +486,7 @@ _connection_handler(xmpp_conn_t * const conn, // lost connection for unknown reason if (jabber_conn.conn_status == JABBER_CONNECTED) { log_debug("Connection handler: Lost connection for unknown reason"); - srv_lost_connection(); + sv_ev_lost_connection(); if (prefs_get_reconnect() != 0) { assert(reconnect_timer == NULL); reconnect_timer = g_timer_new(); @@ -503,7 +503,7 @@ _connection_handler(xmpp_conn_t * const conn, log_debug("Connection handler: Login failed"); if (reconnect_timer == NULL) { log_debug("Connection handler: No reconnect timer"); - srv_failed_login(); + sv_ev_failed_login(); _connection_free_saved_account(); _connection_free_saved_details(); _connection_free_session_data(); @@ -563,7 +563,7 @@ _xmpp_file_logger(void * const userdata, const xmpp_log_level_t level, log_level_t prof_level = _get_log_level(level); log_msg(prof_level, area, msg); if ((g_strcmp0(area, "xmpp") == 0) || (g_strcmp0(area, "conn")) == 0) { - srv_xmpp_stanza(msg); + sv_ev_xmpp_stanza(msg); } } diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 71876cdc..75286bf8 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -515,7 +515,7 @@ _pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, if (errtype != NULL) { if (strcmp(errtype, "cancel") == 0) { log_warning("Server ping (id=%s) error type 'cancel', disabling autoping.", id); - srv_autoping_cancel(); + sv_ev_autoping_cancel(); xmpp_timed_handler_delete(conn, _ping_timed_handler); } } @@ -739,7 +739,7 @@ _enable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, char *type = xmpp_stanza_get_type(stanza); if (g_strcmp0(type, "error") == 0) { char *error_message = stanza_get_error_message(stanza); - srv_enable_carbons_error(error_message); + sv_ev_enable_carbons_error(error_message); log_debug("Error enabling carbons: %s", error_message); } else { log_debug("Message carbons enabled."); @@ -754,7 +754,7 @@ _disable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, char *type = xmpp_stanza_get_type(stanza); if (g_strcmp0(type, "error") == 0) { char *error_message = stanza_get_error_message(stanza); - srv_disable_carbons_error(error_message); + sv_ev_disable_carbons_error(error_message); log_debug("Error disabling carbons: %s", error_message); } else { log_debug("Message carbons disabled."); @@ -774,7 +774,7 @@ _manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, // handle error responses if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { char *error_message = stanza_get_error_message(stanza); - srv_ping_error_result(from, error_message); + sv_ev_ping_error_result(from, error_message); free(error_message); g_date_time_unref(sent); return 0; @@ -788,7 +788,7 @@ _manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, g_date_time_unref(sent); g_date_time_unref(now); - srv_ping_result(from, elapsed_millis); + sv_ev_ping_result(from, elapsed_millis); return 0; } @@ -865,7 +865,7 @@ _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, presence = string_from_resource_presence(resource->presence); } - srv_software_version_result(jid, presence, name_str, version_str, os_str); + sv_ev_software_version_result(jid, presence, name_str, version_str, os_str); jid_destroy(jidp); @@ -1062,7 +1062,7 @@ _destroy_room_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const sta if (from == NULL) { log_error("No from attribute for IQ destroy room result"); } else { - srv_room_destroy(from); + sv_ev_room_destroy(from); } return 0; @@ -1085,40 +1085,40 @@ _room_config_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, // handle error responses if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { char *error_message = stanza_get_error_message(stanza); - srv_room_configuration_form_error(from, error_message); + sv_ev_room_configuration_form_error(from, error_message); free(error_message); return 0; } if (from == NULL) { log_warning("No from attribute for IQ config request result"); - srv_room_configuration_form_error(from, "No from attribute for room cofig response."); + sv_ev_room_configuration_form_error(from, "No from attribute for room cofig response."); return 0; } xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); if (query == NULL) { log_warning("No query element found parsing room config response"); - srv_room_configuration_form_error(from, "No query element found parsing room config response"); + sv_ev_room_configuration_form_error(from, "No query element found parsing room config response"); return 0; } xmpp_stanza_t *x = xmpp_stanza_get_child_by_ns(query, STANZA_NS_DATA); if (x == NULL) { log_warning("No x element found with %s namespace parsing room config response", STANZA_NS_DATA); - srv_room_configuration_form_error(from, "No form configuration options available"); + sv_ev_room_configuration_form_error(from, "No form configuration options available"); return 0; } char *form_type = xmpp_stanza_get_attribute(x, STANZA_ATTR_TYPE); if (g_strcmp0(form_type, "form") != 0) { log_warning("x element not of type 'form' parsing room config response"); - srv_room_configuration_form_error(from, "Form not of type 'form' parsing room config response."); + sv_ev_room_configuration_form_error(from, "Form not of type 'form' parsing room config response."); return 0; } DataForm *form = form_create(x); - srv_room_configure(from, form); + sv_ev_room_configure(from, form); return 0; } @@ -1140,7 +1140,7 @@ static int _room_affiliation_set_result_handler(xmpp_conn_t * const conn, xmpp_s // handle error responses if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { char *error_message = stanza_get_error_message(stanza); - srv_room_affiliation_set_error(from, affiliation_set->item, affiliation_set->privilege, error_message); + sv_ev_room_affiliation_set_error(from, affiliation_set->item, affiliation_set->privilege, error_message); free(error_message); } @@ -1168,7 +1168,7 @@ static int _room_role_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t // handle error responses if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { char *error_message = stanza_get_error_message(stanza); - srv_room_role_set_error(from, role_set->item, role_set->privilege, error_message); + sv_ev_room_role_set_error(from, role_set->item, role_set->privilege, error_message); free(error_message); } @@ -1196,7 +1196,7 @@ _room_affiliation_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * // handle error responses if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { char *error_message = stanza_get_error_message(stanza); - srv_room_affiliation_list_result_error(from, affiliation, error_message); + sv_ev_room_affiliation_list_result_error(from, affiliation, error_message); free(error_message); free(affiliation); return 0; @@ -1218,7 +1218,7 @@ _room_affiliation_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * } } - srv_room_affiliation_list(from, affiliation, jids); + sv_ev_room_affiliation_list(from, affiliation, jids); free(affiliation); g_slist_free(jids); @@ -1242,7 +1242,7 @@ _room_role_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const s // handle error responses if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { char *error_message = stanza_get_error_message(stanza); - srv_room_role_list_result_error(from, role, error_message); + sv_ev_room_role_list_result_error(from, role, error_message); free(error_message); free(role); return 0; @@ -1264,7 +1264,7 @@ _room_role_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const s } } - srv_room_role_list(from, role, nicks); + sv_ev_room_role_list(from, role, nicks); free(role); g_slist_free(nicks); @@ -1288,12 +1288,12 @@ _room_config_submit_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stan // handle error responses if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { char *error_message = stanza_get_error_message(stanza); - srv_room_config_submit_result_error(from, error_message); + sv_ev_room_config_submit_result_error(from, error_message); free(error_message); return 0; } - srv_room_config_submit_result(from); + sv_ev_room_config_submit_result(from); return 0; } @@ -1315,7 +1315,7 @@ _room_kick_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza // handle error responses if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { char *error_message = stanza_get_error_message(stanza); - srv_room_kick_result_error(from, nick, error_message); + sv_ev_room_kick_result_error(from, nick, error_message); free(error_message); free(nick); return 0; @@ -1359,7 +1359,7 @@ _room_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stan if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { if (cb_data->display) { char *error_message = stanza_get_error_message(stanza); - srv_room_info_error(cb_data->room, error_message); + sv_ev_room_info_error(cb_data->room, error_message); free(error_message); } free(cb_data->room); @@ -1411,7 +1411,7 @@ _room_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stan child = xmpp_stanza_get_next(child); } - srv_room_disco_info(cb_data->room, identities, features, cb_data->display); + sv_ev_room_disco_info(cb_data->room, identities, features, cb_data->display); g_slist_free_full(features, free); g_slist_free_full(identities, (GDestroyNotify)_identity_destroy); @@ -1439,7 +1439,7 @@ _disco_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const sta // handle error responses if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) { char *error_message = stanza_get_error_message(stanza); - srv_disco_info_error(from, error_message); + sv_ev_disco_info_error(from, error_message); free(error_message); return 0; } @@ -1488,7 +1488,7 @@ _disco_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const sta child = xmpp_stanza_get_next(child); } - srv_disco_info(from, identities, features); + sv_ev_disco_info(from, identities, features); g_slist_free_full(features, free); g_slist_free_full(identities, (GDestroyNotify)_identity_destroy); @@ -1536,9 +1536,9 @@ _disco_items_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stan } if (g_strcmp0(id, "confreq") == 0) { - srv_room_list(items, from); + sv_ev_room_list(items, from); } else if (g_strcmp0(id, "discoitemsreq") == 0) { - srv_disco_items(items, from); + sv_ev_disco_items(items, from); } g_slist_free_full(items, (GDestroyNotify)_item_destroy); diff --git a/src/xmpp/message.c b/src/xmpp/message.c index 8febbe11..c9464e2f 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -299,7 +299,7 @@ _message_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, g_string_free(log_msg, TRUE); - srv_message_error(jid, type, err_msg); + sv_ev_message_error(jid, type, err_msg); free(err_msg); @@ -346,7 +346,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, password = xmpp_stanza_get_text(password_st); } - srv_room_invite(INVITE_MEDIATED, invitor, room, reason, password); + sv_ev_room_invite(INVITE_MEDIATED, invitor, room, reason, password); jid_destroy(jidp); if (reason) { xmpp_free(ctx, reason); @@ -390,7 +390,7 @@ _conference_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, reason = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_REASON); password = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_PASSWORD); - srv_room_invite(INVITE_DIRECT, invitor, room, reason, password); + sv_ev_room_invite(INVITE_DIRECT, invitor, room, reason, password); jid_destroy(jidp); @@ -414,7 +414,7 @@ _captcha_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, if (body != NULL) { char *message = xmpp_stanza_get_text(body); if (message != NULL) { - srv_room_broadcast(from, message); + sv_ev_room_broadcast(from, message); xmpp_free(ctx, message); } } @@ -435,7 +435,7 @@ _groupchat_handler(xmpp_conn_t * const conn, xmpp_stanza_t *subject = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_SUBJECT); if (subject != NULL) { message = xmpp_stanza_get_text(subject); - srv_room_subject(jid->barejid, jid->resourcepart, message); + sv_ev_room_subject(jid->barejid, jid->resourcepart, message); xmpp_free(ctx, message); jid_destroy(jid); @@ -448,7 +448,7 @@ _groupchat_handler(xmpp_conn_t * const conn, if (body != NULL) { message = xmpp_stanza_get_text(body); if (message != NULL) { - srv_room_broadcast(room_jid, message); + sv_ev_room_broadcast(room_jid, message); xmpp_free(ctx, message); } } @@ -480,9 +480,9 @@ _groupchat_handler(xmpp_conn_t * const conn, message = xmpp_stanza_get_text(body); if (message != NULL) { if (delayed) { - srv_room_history(jid->barejid, jid->resourcepart, tv_stamp, message); + sv_ev_room_history(jid->barejid, jid->resourcepart, tv_stamp, message); } else { - srv_room_message(jid->barejid, jid->resourcepart, message); + sv_ev_room_message(jid->barejid, jid->resourcepart, message); } xmpp_free(ctx, message); } @@ -536,7 +536,7 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, char *fulljid = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); if (fulljid) { Jid *jidp = jid_create(fulljid); - srv_message_receipt(jidp->barejid, id); + sv_ev_message_receipt(jidp->barejid, id); jid_destroy(jidp); return 1; } @@ -573,11 +573,11 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, if (message != NULL) { // if we are the recipient, treat as standard incoming message if(g_strcmp0(my_jid->barejid, jid_to->barejid) == 0){ - srv_incoming_message(jid_from->barejid, jid_from->resourcepart, message); + sv_ev_incoming_message(jid_from->barejid, jid_from->resourcepart, message); } // else treat as a sent message else{ - srv_carbon(jid_to->barejid, message); + sv_ev_carbon(jid_to->barejid, message); } xmpp_free(ctx, message); } @@ -615,9 +615,9 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, char *message = xmpp_stanza_get_text(body); if (message != NULL) { if (delayed) { - srv_delayed_private_message(jid->str, message, tv_stamp); + sv_ev_delayed_private_message(jid->str, message, tv_stamp); } else { - srv_incoming_private_message(jid->str, message); + sv_ev_incoming_private_message(jid->str, message); } xmpp_free(ctx, message); } @@ -639,9 +639,9 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, char *message = xmpp_stanza_get_text(body); if (message != NULL) { if (delayed) { - srv_delayed_message(jid->barejid, message, tv_stamp); + sv_ev_delayed_message(jid->barejid, message, tv_stamp); } else { - srv_incoming_message(jid->barejid, jid->resourcepart, message); + sv_ev_incoming_message(jid->barejid, jid->resourcepart, message); } if (id && prefs_get_boolean(PREF_RECEIPTS_SEND)) { xmpp_stanza_t *receipts = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_RECEIPTS); @@ -663,17 +663,17 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, gboolean paused = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_PAUSED) != NULL; gboolean inactive = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_INACTIVE) != NULL; if (gone) { - srv_gone(jid->barejid, jid->resourcepart); + sv_ev_gone(jid->barejid, jid->resourcepart); } else if (typing) { - srv_typing(jid->barejid, jid->resourcepart); + sv_ev_typing(jid->barejid, jid->resourcepart); } else if (paused) { - srv_paused(jid->barejid, jid->resourcepart); + sv_ev_paused(jid->barejid, jid->resourcepart); } else if (inactive) { - srv_inactive(jid->barejid, jid->resourcepart); + sv_ev_inactive(jid->barejid, jid->resourcepart); } else if (stanza_contains_chat_state(stanza)) { - srv_activity(jid->barejid, jid->resourcepart, TRUE); + sv_ev_activity(jid->barejid, jid->resourcepart, TRUE); } else { - srv_activity(jid->barejid, jid->resourcepart, FALSE); + sv_ev_activity(jid->barejid, jid->resourcepart, FALSE); } } diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c index 403ddc4e..123717cc 100644 --- a/src/xmpp/presence.c +++ b/src/xmpp/presence.c @@ -372,7 +372,7 @@ _presence_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } log_info("Error joining room: %s, reason: %s", fulljid->barejid, error_cond); - srv_room_join_error(fulljid->barejid, error_cond); + sv_ev_room_join_error(fulljid->barejid, error_cond); jid_destroy(fulljid); return 1; } @@ -400,7 +400,7 @@ _presence_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, g_string_free(log_msg, TRUE); - srv_presence_error(from, type, err_msg); + sv_ev_presence_error(from, type, err_msg); free(err_msg); @@ -416,7 +416,7 @@ _unsubscribed_handler(xmpp_conn_t * const conn, Jid *from_jid = jid_create(from); log_debug("Unsubscribed presence handler fired for %s", from); - srv_subscription(from_jid->barejid, PRESENCE_UNSUBSCRIBED); + sv_ev_subscription(from_jid->barejid, PRESENCE_UNSUBSCRIBED); autocomplete_remove(sub_requests_ac, from_jid->barejid); jid_destroy(from_jid); @@ -432,7 +432,7 @@ _subscribed_handler(xmpp_conn_t * const conn, Jid *from_jid = jid_create(from); log_debug("Subscribed presence handler fired for %s", from); - srv_subscription(from_jid->barejid, PRESENCE_SUBSCRIBED); + sv_ev_subscription(from_jid->barejid, PRESENCE_SUBSCRIBED); autocomplete_remove(sub_requests_ac, from_jid->barejid); jid_destroy(from_jid); @@ -452,7 +452,7 @@ _subscribe_handler(xmpp_conn_t * const conn, return 1; } - srv_subscription(from_jid->barejid, PRESENCE_SUBSCRIBE); + sv_ev_subscription(from_jid->barejid, PRESENCE_SUBSCRIBE); autocomplete_add(sub_requests_ac, from_jid->barejid); jid_destroy(from_jid); @@ -480,11 +480,11 @@ _unavailable_handler(xmpp_conn_t * const conn, if (strcmp(my_jid->barejid, from_jid->barejid) !=0) { if (from_jid->resourcepart != NULL) { - srv_contact_offline(from_jid->barejid, from_jid->resourcepart, status_str); + sv_ev_contact_offline(from_jid->barejid, from_jid->resourcepart, status_str); // hack for servers that do not send full jid with unavailable presence } else { - srv_contact_offline(from_jid->barejid, "__prof_default", status_str); + sv_ev_contact_offline(from_jid->barejid, "__prof_default", status_str); } } else { if (from_jid->resourcepart != NULL) { @@ -596,7 +596,7 @@ _available_handler(xmpp_conn_t * const conn, if (g_strcmp0(xmpp_presence->jid->barejid, my_jid->barejid) == 0) { connection_add_available_resource(resource); } else { - srv_contact_online(xmpp_presence->jid->barejid, resource, xmpp_presence->last_activity); + sv_ev_contact_online(xmpp_presence->jid->barejid, resource, xmpp_presence->last_activity); } jid_destroy(my_jid); @@ -682,7 +682,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * char *new_jid = stanza_get_muc_destroy_alternative_room(stanza); char *password = stanza_get_muc_destroy_alternative_password(stanza); char *reason = stanza_get_muc_destroy_reason(stanza); - srv_room_destroyed(room, new_jid, password, reason); + sv_ev_room_destroyed(room, new_jid, password, reason); free(password); free(reason); @@ -690,19 +690,19 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * } else if (g_slist_find_custom(status_codes, "307", (GCompareFunc)g_strcmp0) != NULL) { char *actor = stanza_get_actor(stanza); char *reason = stanza_get_reason(stanza); - srv_room_kicked(room, actor, reason); + sv_ev_room_kicked(room, actor, reason); free(reason); // banned from room } else if (g_slist_find_custom(status_codes, "301", (GCompareFunc)g_strcmp0) != NULL) { char *actor = stanza_get_actor(stanza); char *reason = stanza_get_reason(stanza); - srv_room_banned(room, actor, reason); + sv_ev_room_banned(room, actor, reason); free(reason); // normal exit } else { - srv_leave_room(room); + sv_ev_leave_room(room); } g_slist_free_full(status_codes, free); @@ -713,7 +713,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * gboolean config_required = stanza_muc_requires_config(stanza); char *actor = stanza_get_actor(stanza); char *reason = stanza_get_reason(stanza); - srv_muc_self_online(room, nick, config_required, role, affiliation, actor, reason, jid, show_str, status_str); + sv_ev_muc_self_online(room, nick, config_required, role, affiliation, actor, reason, jid, show_str, status_str); } // handle presence from room members @@ -735,19 +735,19 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * if (g_slist_find_custom(status_codes, "307", (GCompareFunc)g_strcmp0) != NULL) { char *actor = stanza_get_actor(stanza); char *reason = stanza_get_reason(stanza); - srv_room_occupent_kicked(room, nick, actor, reason); + sv_ev_room_occupent_kicked(room, nick, actor, reason); free(reason); // banned from room } else if (g_slist_find_custom(status_codes, "301", (GCompareFunc)g_strcmp0) != NULL) { char *actor = stanza_get_actor(stanza); char *reason = stanza_get_reason(stanza); - srv_room_occupent_banned(room, nick, actor, reason); + sv_ev_room_occupent_banned(room, nick, actor, reason); free(reason); // normal exit } else { - srv_room_occupant_offline(room, nick, "offline", status_str); + sv_ev_room_occupant_offline(room, nick, "offline", status_str); } g_slist_free_full(status_codes, free); @@ -765,7 +765,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * char *actor = stanza_get_actor(stanza); char *reason = stanza_get_reason(stanza); - srv_muc_occupant_online(room, nick, jid, role, affiliation, actor, reason, show_str, status_str); + sv_ev_muc_occupant_online(room, nick, jid, role, affiliation, actor, reason, show_str, status_str); } } diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c index 51880d77..91330f1b 100644 --- a/src/xmpp/roster.c +++ b/src/xmpp/roster.c @@ -163,7 +163,7 @@ _group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, { if (userdata != NULL) { GroupData *data = userdata; - srv_group_add(data->name, data->group); + sv_ev_group_add(data->name, data->group); free(data->name); free(data->group); free(userdata); @@ -210,7 +210,7 @@ _group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, { if (userdata != NULL) { GroupData *data = userdata; - srv_group_remove(data->name, data->group); + sv_ev_group_remove(data->name, data->group); free(data->name); free(data->group); free(userdata); @@ -260,7 +260,7 @@ _roster_set_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, roster_remove(name, barejid_lower); - srv_roster_remove(barejid_lower); + sv_ev_roster_remove(barejid_lower); // otherwise update local roster } else { @@ -278,10 +278,10 @@ _roster_set_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, if (contact == NULL) { gboolean added = roster_add(barejid_lower, name, groups, sub, pending_out); if (added) { - srv_roster_add(barejid_lower, name); + sv_ev_roster_add(barejid_lower, name); } } else { - srv_roster_update(barejid_lower, name, groups, sub, pending_out); + sv_ev_roster_update(barejid_lower, name, groups, sub, pending_out); } } @@ -330,7 +330,7 @@ _roster_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, item = xmpp_stanza_get_next(item); } - srv_roster_received(); + sv_ev_roster_received(); resource_presence_t conn_presence = accounts_get_login_presence(jabber_get_account_name()); presence_update(conn_presence, NULL, 0); diff --git a/tests/test_server_events.c b/tests/test_server_events.c index 29290203..ffff74f9 100644 --- a/tests/test_server_events.c +++ b/tests/test_server_events.c @@ -21,7 +21,7 @@ void console_doesnt_show_online_presence_when_set_none(void **state) roster_add("test1@server", "bob", NULL, "both", FALSE); Resource *resource = resource_new("resource", RESOURCE_ONLINE, NULL, 10); - srv_contact_online("test1@server", resource, NULL); + sv_ev_contact_online("test1@server", resource, NULL); roster_clear(); } @@ -38,7 +38,7 @@ void console_shows_online_presence_when_set_online(void **state) expect_memory(cons_show_contact_online, resource, resource, sizeof(resource)); expect_value(cons_show_contact_online, last_activity, NULL); - srv_contact_online("test1@server", resource, NULL); + sv_ev_contact_online("test1@server", resource, NULL); roster_clear(); } @@ -55,7 +55,7 @@ void console_shows_online_presence_when_set_all(void **state) expect_memory(cons_show_contact_online, resource, resource, sizeof(resource)); expect_value(cons_show_contact_online, last_activity, NULL); - srv_contact_online("test1@server", resource, NULL); + sv_ev_contact_online("test1@server", resource, NULL); roster_clear(); } @@ -67,7 +67,7 @@ void console_doesnt_show_dnd_presence_when_set_none(void **state) roster_add("test1@server", "bob", NULL, "both", FALSE); Resource *resource = resource_new("resource", RESOURCE_DND, NULL, 10); - srv_contact_online("test1@server", resource, NULL); + sv_ev_contact_online("test1@server", resource, NULL); roster_clear(); } @@ -79,7 +79,7 @@ void console_doesnt_show_dnd_presence_when_set_online(void **state) roster_add("test1@server", "bob", NULL, "both", FALSE); Resource *resource = resource_new("resource", RESOURCE_DND, NULL, 10); - srv_contact_online("test1@server", resource, NULL); + sv_ev_contact_online("test1@server", resource, NULL); roster_clear(); } @@ -96,7 +96,7 @@ void console_shows_dnd_presence_when_set_all(void **state) expect_memory(cons_show_contact_online, resource, resource, sizeof(resource)); expect_value(cons_show_contact_online, last_activity, NULL); - srv_contact_online("test1@server", resource, NULL); + sv_ev_contact_online("test1@server", resource, NULL); roster_clear(); } @@ -109,7 +109,7 @@ void handle_message_error_when_no_recipient(void **state) expect_string(ui_handle_error, err_msg, err_msg); - srv_message_error(from, type, err_msg); + sv_ev_message_error(from, type, err_msg); } void handle_message_error_when_recipient_cancel(void **state) @@ -121,7 +121,7 @@ void handle_message_error_when_recipient_cancel(void **state) prefs_set_boolean(PREF_STATES, FALSE); chat_sessions_init(); - srv_message_error(from, type, err_msg); + sv_ev_message_error(from, type, err_msg); } void handle_message_error_when_recipient_cancel_disables_chat_session(void **state) @@ -135,7 +135,7 @@ void handle_message_error_when_recipient_cancel_disables_chat_session(void **sta chat_sessions_init(); chat_session_recipient_active(barejid, resource, FALSE); - srv_message_error(barejid, type, err_msg); + sv_ev_message_error(barejid, type, err_msg); ChatSession *session = chat_session_get(barejid); assert_null(session); @@ -151,7 +151,7 @@ void handle_message_error_when_recipient_and_no_type(void **state) expect_string(ui_handle_recipient_error, recipient, from); expect_string(ui_handle_recipient_error, err_msg, err_msg); - srv_message_error(from, type, err_msg); + sv_ev_message_error(from, type, err_msg); } void handle_presence_error_when_no_recipient(void **state) @@ -162,7 +162,7 @@ void handle_presence_error_when_no_recipient(void **state) expect_string(ui_handle_error, err_msg, err_msg); - srv_presence_error(from, type, err_msg); + sv_ev_presence_error(from, type, err_msg); } void handle_presence_error_when_from_recipient(void **state) @@ -174,7 +174,7 @@ void handle_presence_error_when_from_recipient(void **state) expect_string(ui_handle_recipient_error, recipient, from); expect_string(ui_handle_recipient_error, err_msg, err_msg); - srv_presence_error(from, type, err_msg); + sv_ev_presence_error(from, type, err_msg); } void handle_offline_removes_chat_session(void **state) @@ -187,7 +187,7 @@ void handle_offline_removes_chat_session(void **state) Resource *resourcep = resource_new(resource, RESOURCE_ONLINE, NULL, 10); roster_update_presence(barejid, resourcep, NULL); chat_session_recipient_active(barejid, resource, FALSE); - srv_contact_offline(barejid, resource, NULL); + sv_ev_contact_offline(barejid, resource, NULL); ChatSession *session = chat_session_get(barejid); assert_null(session); @@ -203,7 +203,7 @@ void lost_connection_clears_chat_sessions(void **state) chat_session_recipient_active("steve@server.org", "mobile", FALSE); expect_any_cons_show_error(); - srv_lost_connection(); + sv_ev_lost_connection(); ChatSession *session1 = chat_session_get("bob@server.org"); ChatSession *session2 = chat_session_get("steve@server.org"); |