diff options
author | James Booth <boothj5@gmail.com> | 2015-04-19 17:33:35 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-04-19 17:33:35 +0100 |
commit | d612b9695a762db2264113b9cc73ecc8adf685d2 (patch) | |
tree | 59a5e730ec86d83a1658e4ad07f839e62f07c99e | |
parent | 60f94722d469d24b51634ad09134ce5424e4219f (diff) | |
parent | e688dd7d289a3d26c9e1dc340f9cbb24e526a9bd (diff) | |
download | profani-tty-d612b9695a762db2264113b9cc73ecc8adf685d2.tar.gz |
Merge branch 'master' into pgp
Conflicts: src/xmpp/message.c
-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 | 46 | ||||
-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 |
8 files changed, 223 insertions, 223 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c index fe942680..bd4634e5 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -52,7 +52,7 @@ #include "ui/ui.h" void -handle_room_join_error(const char * const room, const char * const err) +srv_room_join_error(const char * const room, const char * const err) { if (muc_active(room)) { muc_leave(room); @@ -62,7 +62,7 @@ handle_room_join_error(const char * const room, const char * const err) // handle presence stanza errors void -handle_presence_error(const char *from, const char * const type, +srv_presence_error(const char *from, const char * const type, const char *err_msg) { // handle error from recipient @@ -77,7 +77,7 @@ handle_presence_error(const char *from, const char * const type, // handle message stanza errors void -handle_message_error(const char * const jid, const char * const type, +srv_message_error(const char * const jid, const char * const type, const char * const err_msg) { // handle errors from no recipient @@ -97,7 +97,7 @@ handle_message_error(const char * const jid, const char * const type, } void -handle_login_account_success(char *account_name) +srv_login_account_success(char *account_name) { ProfAccount *account = accounts_get_account(account_name); @@ -124,7 +124,7 @@ handle_login_account_success(char *account_name) } void -handle_roster_received(void) +srv_roster_received(void) { if (prefs_get_boolean(PREF_ROSTER)) { ui_show_roster(); @@ -132,7 +132,7 @@ handle_roster_received(void) } void -handle_lost_connection(void) +srv_lost_connection(void) { cons_show_error("Lost connection."); roster_clear(); @@ -142,27 +142,27 @@ handle_lost_connection(void) } void -handle_failed_login(void) +srv_failed_login(void) { cons_show_error("Login failed."); log_info("Login failed"); } void -handle_software_version_result(const char * const jid, const char * const presence, +srv_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 -handle_disco_info(const char *from, GSList *identities, GSList *features) +srv_disco_info(const char *from, GSList *identities, GSList *features) { cons_show_disco_info(from, identities, features); } void -handle_room_disco_info(const char * const room, GSList *identities, GSList *features, gboolean display) +srv_room_disco_info(const char * const room, GSList *identities, GSList *features, gboolean display) { muc_set_features(room, features); if (display) { @@ -171,7 +171,7 @@ handle_room_disco_info(const char * const room, GSList *identities, GSList *feat } void -handle_disco_info_error(const char * const from, const char * const error) +srv_disco_info_error(const char * const from, const char * const error) { if (from) { cons_show_error("Service discovery failed for %s: %s", from, error); @@ -181,31 +181,31 @@ handle_disco_info_error(const char * const from, const char * const error) } void -handle_enable_carbons_error(const char * const error) +srv_enable_carbons_error(const char * const error) { cons_show_error("Server error enabling message carbons: %s", error); } void -handle_disable_carbons_error(const char * const error) +srv_disable_carbons_error(const char * const error) { cons_show_error("Server error disabling message carbons: %s", error); } void -handle_room_info_error(const char * const room, const char * const error) +srv_room_info_error(const char * const room, const char * const error) { ui_handle_room_info_error(room, error); } void -handle_room_list(GSList *rooms, const char *conference_node) +srv_room_list(GSList *rooms, const char *conference_node) { cons_show_room_list(rooms, conference_node); } void -handle_room_affiliation_list_result_error(const char * const room, const char * const affiliation, +srv_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); @@ -213,14 +213,14 @@ handle_room_affiliation_list_result_error(const char * const room, const char * } void -handle_room_affiliation_list(const char * const room, const char * const affiliation, GSList *jids) +srv_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 -handle_room_role_set_error(const char * const room, const char * const nick, const char * const role, +srv_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); @@ -228,20 +228,20 @@ handle_room_role_set_error(const char * const room, const char * const nick, con } void -handle_room_role_list_result_error(const char * const room, const char * const role, const char * const error) +srv_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 -handle_room_role_list(const char * const room, const char * const role, GSList *nicks) +srv_room_role_list(const char * const room, const char * const role, GSList *nicks) { ui_handle_room_role_list(room, role, nicks); } void -handle_room_affiliation_set_error(const char * const room, const char * const jid, const char * const affiliation, +srv_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); @@ -249,13 +249,13 @@ handle_room_affiliation_set_error(const char * const room, const char * const ji } void -handle_disco_items(GSList *items, const char *jid) +srv_disco_items(GSList *items, const char *jid) { cons_show_disco_items(items, jid); } void -handle_room_invite(jabber_invite_t invite_type, +srv_room_invite(jabber_invite_t invite_type, const char * const invitor, const char * const room, const char * const reason, const char * const password) { @@ -266,7 +266,7 @@ handle_room_invite(jabber_invite_t invite_type, } void -handle_room_broadcast(const char *const room_jid, +srv_room_broadcast(const char *const room_jid, const char * const message) { if (muc_roster_complete(room_jid)) { @@ -277,7 +277,7 @@ handle_room_broadcast(const char *const room_jid, } void -handle_room_subject(const char * const room, const char * const nick, const char * const subject) +srv_room_subject(const char * const room, const char * const nick, const char * const subject) { muc_set_subject(room, subject); if (muc_roster_complete(room)) { @@ -286,14 +286,14 @@ handle_room_subject(const char * const room, const char * const nick, const char } void -handle_room_history(const char * const room_jid, const char * const nick, +srv_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 -handle_room_message(const char * const room_jid, const char * const nick, +srv_room_message(const char * const room_jid, const char * const nick, const char * const message) { ui_room_message(room_jid, nick, message); @@ -306,19 +306,19 @@ handle_room_message(const char * const room_jid, const char * const nick, } void -handle_incoming_private_message(char *fulljid, char *message) +srv_incoming_private_message(char *fulljid, char *message) { ui_incoming_private_msg(fulljid, message, NULL); } void -handle_carbon(char *barejid, char *message) +srv_carbon(char *barejid, char *message) { ui_outgoing_chat_msg_carbon(barejid, message); } void -handle_incoming_message(char *barejid, char *resource, char *message) +srv_incoming_message(char *barejid, char *resource, char *message) { #ifdef HAVE_LIBOTR gboolean was_decrypted = FALSE; @@ -367,26 +367,26 @@ handle_incoming_message(char *barejid, char *resource, char *message) } void -handle_delayed_private_message(char *fulljid, char *message, GTimeVal tv_stamp) +srv_delayed_private_message(char *fulljid, char *message, GTimeVal tv_stamp) { ui_incoming_private_msg(fulljid, message, &tv_stamp); } void -handle_delayed_message(char *barejid, char *message, GTimeVal tv_stamp) +srv_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 -handle_message_receipt(char *barejid, char *id) +srv_message_receipt(char *barejid, char *id) { ui_message_receipt(barejid, id); } void -handle_typing(char *barejid, char *resource) +srv_typing(char *barejid, char *resource) { ui_contact_typing(barejid, resource); if (ui_chat_win_exists(barejid)) { @@ -395,7 +395,7 @@ handle_typing(char *barejid, char *resource) } void -handle_paused(char *barejid, char *resource) +srv_paused(char *barejid, char *resource) { if (ui_chat_win_exists(barejid)) { chat_session_recipient_paused(barejid, resource); @@ -403,7 +403,7 @@ handle_paused(char *barejid, char *resource) } void -handle_inactive(char *barejid, char *resource) +srv_inactive(char *barejid, char *resource) { if (ui_chat_win_exists(barejid)) { chat_session_recipient_inactive(barejid, resource); @@ -411,7 +411,7 @@ handle_inactive(char *barejid, char *resource) } void -handle_gone(const char * const barejid, const char * const resource) +srv_gone(const char * const barejid, const char * const resource) { ui_recipient_gone(barejid, resource); if (ui_chat_win_exists(barejid)) { @@ -420,7 +420,7 @@ handle_gone(const char * const barejid, const char * const resource) } void -handle_activity(const char * const barejid, const char * const resource, gboolean send_states) +srv_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); @@ -428,7 +428,7 @@ handle_activity(const char * const barejid, const char * const resource, gboolea } void -handle_subscription(const char *barejid, jabber_subscr_t type) +srv_subscription(const char *barejid, jabber_subscr_t type) { switch (type) { case PRESENCE_SUBSCRIBE: @@ -457,7 +457,7 @@ handle_subscription(const char *barejid, jabber_subscr_t type) } void -handle_contact_offline(char *barejid, char *resource, char *status) +srv_contact_offline(char *barejid, char *resource, char *status) { gboolean updated = roster_contact_offline(barejid, resource, status); @@ -470,7 +470,7 @@ handle_contact_offline(char *barejid, char *resource, char *status) } void -handle_contact_online(char *barejid, Resource *resource, +srv_contact_online(char *barejid, Resource *resource, GDateTime *last_activity) { gboolean updated = roster_update_presence(barejid, resource, last_activity); @@ -513,21 +513,21 @@ handle_contact_online(char *barejid, Resource *resource, } void -handle_leave_room(const char * const room) +srv_leave_room(const char * const room) { muc_leave(room); ui_leave_room(room); } void -handle_room_destroy(const char * const room) +srv_room_destroy(const char * const room) { muc_leave(room); ui_room_destroy(room); } void -handle_room_destroyed(const char * const room, const char * const new_jid, const char * const password, +srv_room_destroyed(const char * const room, const char * const new_jid, const char * const password, const char * const reason) { muc_leave(room); @@ -535,51 +535,51 @@ handle_room_destroyed(const char * const room, const char * const new_jid, const } void -handle_room_kicked(const char * const room, const char * const actor, const char * const reason) +srv_room_kicked(const char * const room, const char * const actor, const char * const reason) { muc_leave(room); ui_room_kicked(room, actor, reason); } void -handle_room_banned(const char * const room, const char * const actor, const char * const reason) +srv_room_banned(const char * const room, const char * const actor, const char * const reason) { muc_leave(room); ui_room_banned(room, actor, reason); } void -handle_room_configure(const char * const room, DataForm *form) +srv_room_configure(const char * const room, DataForm *form) { ui_handle_room_configuration(room, form); } void -handle_room_configuration_form_error(const char * const room, const char * const message) +srv_room_configuration_form_error(const char * const room, const char * const message) { ui_handle_room_configuration_form_error(room, message); } void -handle_room_config_submit_result(const char * const room) +srv_room_config_submit_result(const char * const room) { ui_handle_room_config_submit_result(room); } void -handle_room_config_submit_result_error(const char * const room, const char * const message) +srv_room_config_submit_result_error(const char * const room, const char * const message) { ui_handle_room_config_submit_result_error(room, message); } void -handle_room_kick_result_error(const char * const room, const char * const nick, const char * const error) +srv_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 -handle_room_occupant_offline(const char * const room, const char * const nick, +srv_room_occupant_offline(const char * const room, const char * const nick, const char * const show, const char * const status) { muc_roster_remove(room, nick); @@ -593,7 +593,7 @@ handle_room_occupant_offline(const char * const room, const char * const nick, } void -handle_room_occupent_kicked(const char * const room, const char * const nick, const char * const actor, +srv_room_occupent_kicked(const char * const room, const char * const nick, const char * const actor, const char * const reason) { muc_roster_remove(room, nick); @@ -602,7 +602,7 @@ handle_room_occupent_kicked(const char * const room, const char * const nick, co } void -handle_room_occupent_banned(const char * const room, const char * const nick, const char * const actor, +srv_room_occupent_banned(const char * const room, const char * const nick, const char * const actor, const char * const reason) { muc_roster_remove(room, nick); @@ -611,33 +611,33 @@ handle_room_occupent_banned(const char * const room, const char * const nick, co } void -handle_group_add(const char * const contact, +srv_group_add(const char * const contact, const char * const group) { ui_group_added(contact, group); } void -handle_group_remove(const char * const contact, +srv_group_remove(const char * const contact, const char * const group) { ui_group_removed(contact, group); } void -handle_roster_remove(const char * const barejid) +srv_roster_remove(const char * const barejid) { ui_roster_remove(barejid); } void -handle_roster_add(const char * const barejid, const char * const name) +srv_roster_add(const char * const barejid, const char * const name) { ui_roster_add(barejid, name); } void -handle_roster_update(const char * const barejid, const char * const name, +srv_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); @@ -645,20 +645,20 @@ handle_roster_update(const char * const barejid, const char * const name, } void -handle_autoping_cancel(void) +srv_autoping_cancel(void) { prefs_set_autoping(0); cons_show_error("Server ping not supported, autoping disabled."); } void -handle_xmpp_stanza(const char * const msg) +srv_xmpp_stanza(const char * const msg) { ui_handle_stanza(msg); } void -handle_ping_result(const char * const from, int millis) +srv_ping_result(const char * const from, int millis) { if (from == NULL) { cons_show("Ping response from server: %dms.", millis); @@ -668,7 +668,7 @@ handle_ping_result(const char * const from, int millis) } void -handle_ping_error_result(const char * const from, const char * const error) +srv_ping_error_result(const char * const from, const char * const error) { if (error == NULL) { cons_show_error("Error returned from pinging %s.", from); @@ -678,7 +678,7 @@ handle_ping_error_result(const char * const from, const char * const error) } void -handle_muc_self_online(const char * const room, const char * const nick, gboolean config_required, +srv_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) { @@ -755,7 +755,7 @@ handle_muc_self_online(const char * const room, const char * const nick, gboolea } void -handle_muc_occupant_online(const char * const room, const char * const nick, const char * const jid, +srv_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 85d75ac3..acba1391 100644 --- a/src/event/server_events.h +++ b/src/event/server_events.h @@ -37,93 +37,93 @@ #include "xmpp/xmpp.h" -void handle_login_account_success(char *account_name); -void handle_lost_connection(void); -void handle_failed_login(void); -void handle_software_version_result(const char * const jid, const char * const presence, +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, const char * const name, const char * const version, const char * const os); -void handle_disco_info(const char *from, GSList *identities, GSList *features); -void handle_disco_info_error(const char * const from, const char * const error); -void handle_room_list(GSList *rooms, const char *conference_node); -void handle_disco_items(GSList *items, const char *jid); -void handle_room_invite(jabber_invite_t invite_type, +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, const char * const invitor, const char * const room, const char * const reason, const char * const password); -void handle_room_broadcast(const char *const room_jid, +void srv_room_broadcast(const char *const room_jid, const char * const message); -void handle_room_subject(const char * const room, const char * const nick, const char * const subject); -void handle_room_history(const char * const room_jid, const char * const nick, +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, GTimeVal tv_stamp, const char * const message); -void handle_room_message(const char * const room_jid, const char * const nick, +void srv_room_message(const char * const room_jid, const char * const nick, const char * const message); -void handle_room_join_error(const char * const room, const char * const err); -void handle_room_info_error(const char * const room, const char * const error); -void handle_room_disco_info(const char * const room, GSList *identities, GSList *features, gboolean display); -void handle_room_affiliation_list_result_error(const char * const room, const char * const affiliation, +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, const char * const error); -void handle_room_affiliation_list(const char * const room, const char * const affiliation, GSList *jids); -void handle_room_affiliation_set_error(const char * const room, const char * const jid, const char * const affiliation, +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, const char * const error); -void handle_room_role_list_result_error(const char * const from, const char * const role, const char * const error); -void handle_room_role_list(const char * const from, const char * const role, GSList *nicks); -void handle_room_role_set_error(const char * const room, const char * const nick, const char * const role, +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, const char * const error); -void handle_room_kick_result_error(const char * const room, const char * const nick, const char * const error); -void handle_incoming_message(char *barejid, char *resource, char *message); -void handle_incoming_private_message(char *fulljid, char *message); -void handle_delayed_message(char *fulljid, char *message, GTimeVal tv_stamp); -void handle_delayed_private_message(char *fulljid, char *message, GTimeVal tv_stamp); -void handle_typing(char *barejid, char *resource); -void handle_paused(char *barejid, char *resource); -void handle_inactive(char *barejid, char *resource); -void handle_activity(char *barejid, char *resource, gboolean send_states); -void handle_gone(const char * const barejid, const char * const resource); -void handle_subscription(const char *from, jabber_subscr_t type); -void handle_message_receipt(char *barejid, char *id); -void handle_contact_offline(char *contact, char *resource, char *status); -void handle_contact_online(char *contact, Resource *resource, +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, GDateTime *last_activity); -void handle_leave_room(const char * const room); -void handle_room_destroy(const char * const room); -void handle_room_occupant_offline(const char * const room, const char * const nick, +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, const char * const show, const char * const status); -void handle_room_destroyed(const char * const room, const char * const new_jid, const char * const password, +void srv_room_destroyed(const char * const room, const char * const new_jid, const char * const password, const char * const reason); -void handle_room_kicked(const char * const room, const char * const actor, const char * const reason); -void handle_room_occupent_kicked(const char * const room, const char * const nick, const char * const actor, +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, const char * const reason); -void handle_room_banned(const char * const room, const char * const actor, const char * const reason); -void handle_room_occupent_banned(const char * const room, const char * const nick, const char * const actor, +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, const char * const reason); -void handle_group_add(const char * const contact, +void srv_group_add(const char * const contact, const char * const group); -void handle_group_remove(const char * const contact, +void srv_group_remove(const char * const contact, const char * const group); -void handle_roster_remove(const char * const barejid); -void handle_roster_add(const char * const barejid, const char * const name); -void handle_autoping_cancel(void); -void handle_carbon(char *barejid, char *message); -void handle_message_error(const char * const from, const char * const type, +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, const char * const err_msg); -void handle_presence_error(const char *from, const char * const type, +void srv_presence_error(const char *from, const char * const type, const char *err_msg); -void handle_xmpp_stanza(const char * const msg); -void handle_ping_result(const char * const from, int millis); -void handle_ping_error_result(const char * const from, const char * const error); -void handle_room_configure(const char * const room, DataForm *form); -void handle_room_configuration_form_error(const char * const from, const char * const message); -void handle_room_config_submit_result(const char * const room); -void handle_room_config_submit_result_error(const char * const room, const char * const message); -void handle_muc_self_online(const char * const room, const char * const nick, gboolean config_required, +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, 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 handle_muc_occupant_online(const char * const room, const char * const nick, const char * const jid, +void srv_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 handle_roster_update(const char * const barejid, const char * const name, +void srv_roster_update(const char * const barejid, const char * const name, GSList *groups, const char * const subscription, gboolean pending_out); -void handle_roster_received(void); -void handle_enable_carbons_error(const char * const error); -void handle_disable_carbons_error(const char * const error); +void srv_roster_received(void); +void srv_enable_carbons_error(const char * const error); +void srv_disable_carbons_error(const char * const error); #endif diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index c51652fa..295c8f2f 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); - handle_login_account_success(saved_account.name); + srv_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); - handle_login_account_success(saved_details.name); + srv_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"); - handle_lost_connection(); + srv_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"); - handle_failed_login(); + srv_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) { - handle_xmpp_stanza(msg); + srv_xmpp_stanza(msg); } } diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index adee07b8..71876cdc 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); - handle_autoping_cancel(); + srv_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); - handle_enable_carbons_error(error_message); + srv_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); - handle_disable_carbons_error(error_message); + srv_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); - handle_ping_error_result(from, error_message); + srv_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); - handle_ping_result(from, elapsed_millis); + srv_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); } - handle_software_version_result(jid, presence, name_str, version_str, os_str); + srv_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 { - handle_room_destroy(from); + srv_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); - handle_room_configuration_form_error(from, error_message); + srv_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"); - handle_room_configuration_form_error(from, "No from attribute for room cofig response."); + srv_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"); - handle_room_configuration_form_error(from, "No query element found parsing room config response"); + srv_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); - handle_room_configuration_form_error(from, "No form configuration options available"); + srv_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"); - handle_room_configuration_form_error(from, "Form not of type 'form' parsing room config response."); + srv_room_configuration_form_error(from, "Form not of type 'form' parsing room config response."); return 0; } DataForm *form = form_create(x); - handle_room_configure(from, form); + srv_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); - handle_room_affiliation_set_error(from, affiliation_set->item, affiliation_set->privilege, error_message); + srv_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); - handle_room_role_set_error(from, role_set->item, role_set->privilege, error_message); + srv_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); - handle_room_affiliation_list_result_error(from, affiliation, error_message); + srv_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 * } } - handle_room_affiliation_list(from, affiliation, jids); + srv_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); - handle_room_role_list_result_error(from, role, error_message); + srv_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 } } - handle_room_role_list(from, role, nicks); + srv_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); - handle_room_config_submit_result_error(from, error_message); + srv_room_config_submit_result_error(from, error_message); free(error_message); return 0; } - handle_room_config_submit_result(from); + srv_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); - handle_room_kick_result_error(from, nick, error_message); + srv_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); - handle_room_info_error(cb_data->room, error_message); + srv_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); } - handle_room_disco_info(cb_data->room, identities, features, cb_data->display); + srv_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); - handle_disco_info_error(from, error_message); + srv_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); } - handle_disco_info(from, identities, features); + srv_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) { - handle_room_list(items, from); + srv_room_list(items, from); } else if (g_strcmp0(id, "discoitemsreq") == 0) { - handle_disco_items(items, from); + srv_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 c06ff89d..aa5e55d9 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -329,7 +329,7 @@ _message_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, g_string_free(log_msg, TRUE); - handle_message_error(jid, type, err_msg); + srv_message_error(jid, type, err_msg); free(err_msg); @@ -376,7 +376,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, password = xmpp_stanza_get_text(password_st); } - handle_room_invite(INVITE_MEDIATED, invitor, room, reason, password); + srv_room_invite(INVITE_MEDIATED, invitor, room, reason, password); jid_destroy(jidp); if (reason) { xmpp_free(ctx, reason); @@ -420,7 +420,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); - handle_room_invite(INVITE_DIRECT, invitor, room, reason, password); + srv_room_invite(INVITE_DIRECT, invitor, room, reason, password); jid_destroy(jidp); @@ -444,7 +444,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) { - handle_room_broadcast(from, message); + srv_room_broadcast(from, message); xmpp_free(ctx, message); } } @@ -465,7 +465,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); - handle_room_subject(jid->barejid, jid->resourcepart, message); + srv_room_subject(jid->barejid, jid->resourcepart, message); xmpp_free(ctx, message); jid_destroy(jid); @@ -478,7 +478,7 @@ _groupchat_handler(xmpp_conn_t * const conn, if (body != NULL) { message = xmpp_stanza_get_text(body); if (message != NULL) { - handle_room_broadcast(room_jid, message); + srv_room_broadcast(room_jid, message); xmpp_free(ctx, message); } } @@ -510,9 +510,9 @@ _groupchat_handler(xmpp_conn_t * const conn, message = xmpp_stanza_get_text(body); if (message != NULL) { if (delayed) { - handle_room_history(jid->barejid, jid->resourcepart, tv_stamp, message); + srv_room_history(jid->barejid, jid->resourcepart, tv_stamp, message); } else { - handle_room_message(jid->barejid, jid->resourcepart, message); + srv_room_message(jid->barejid, jid->resourcepart, message); } xmpp_free(ctx, message); } @@ -566,7 +566,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); - handle_message_receipt(jidp->barejid, id); + srv_message_receipt(jidp->barejid, id); jid_destroy(jidp); return 1; } @@ -603,11 +603,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){ - handle_incoming_message(jid_from->barejid, jid_from->resourcepart, message); + srv_incoming_message(jid_from->barejid, jid_from->resourcepart, message); } // else treat as a sent message else{ - handle_carbon(jid_to->barejid, message); + srv_carbon(jid_to->barejid, message); } xmpp_free(ctx, message); } @@ -645,9 +645,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) { - handle_delayed_private_message(jid->str, message, tv_stamp); + srv_delayed_private_message(jid->str, message, tv_stamp); } else { - handle_incoming_private_message(jid->str, message); + srv_incoming_private_message(jid->str, message); } xmpp_free(ctx, message); } @@ -669,7 +669,7 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, char *message = xmpp_stanza_get_text(body); if (message != NULL) { if (delayed) { - handle_delayed_message(jid->barejid, message, tv_stamp); + srv_delayed_message(jid->barejid, message, tv_stamp); } else { #ifdef HAVE_LIBGPGME gboolean handled = FALSE; @@ -678,15 +678,15 @@ _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, char *enc_message = xmpp_stanza_get_text(x); char *decrypted = p_gpg_decrypt(jid->barejid, enc_message); if (decrypted) { - handle_incoming_message(jid->barejid, jid->resourcepart, decrypted); + srv_incoming_message(jid->barejid, jid->resourcepart, decrypted); handled = TRUE; } } if (!handled) { - handle_incoming_message(jid->barejid, jid->resourcepart, message); + srv_incoming_message(jid->barejid, jid->resourcepart, message); } #else - handle_incoming_message(jid->barejid, jid->resourcepart, message); + srv_incoming_message(jid->barejid, jid->resourcepart, message); #endif } if (id && prefs_get_boolean(PREF_RECEIPTS_SEND)) { @@ -709,17 +709,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) { - handle_gone(jid->barejid, jid->resourcepart); + srv_gone(jid->barejid, jid->resourcepart); } else if (typing) { - handle_typing(jid->barejid, jid->resourcepart); + srv_typing(jid->barejid, jid->resourcepart); } else if (paused) { - handle_paused(jid->barejid, jid->resourcepart); + srv_paused(jid->barejid, jid->resourcepart); } else if (inactive) { - handle_inactive(jid->barejid, jid->resourcepart); + srv_inactive(jid->barejid, jid->resourcepart); } else if (stanza_contains_chat_state(stanza)) { - handle_activity(jid->barejid, jid->resourcepart, TRUE); + srv_activity(jid->barejid, jid->resourcepart, TRUE); } else { - handle_activity(jid->barejid, jid->resourcepart, FALSE); + srv_activity(jid->barejid, jid->resourcepart, FALSE); } } diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c index 98c5109e..b704b49c 100644 --- a/src/xmpp/presence.c +++ b/src/xmpp/presence.c @@ -399,7 +399,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); - handle_room_join_error(fulljid->barejid, error_cond); + srv_room_join_error(fulljid->barejid, error_cond); jid_destroy(fulljid); return 1; } @@ -427,7 +427,7 @@ _presence_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, g_string_free(log_msg, TRUE); - handle_presence_error(from, type, err_msg); + srv_presence_error(from, type, err_msg); free(err_msg); @@ -443,7 +443,7 @@ _unsubscribed_handler(xmpp_conn_t * const conn, Jid *from_jid = jid_create(from); log_debug("Unsubscribed presence handler fired for %s", from); - handle_subscription(from_jid->barejid, PRESENCE_UNSUBSCRIBED); + srv_subscription(from_jid->barejid, PRESENCE_UNSUBSCRIBED); autocomplete_remove(sub_requests_ac, from_jid->barejid); jid_destroy(from_jid); @@ -459,7 +459,7 @@ _subscribed_handler(xmpp_conn_t * const conn, Jid *from_jid = jid_create(from); log_debug("Subscribed presence handler fired for %s", from); - handle_subscription(from_jid->barejid, PRESENCE_SUBSCRIBED); + srv_subscription(from_jid->barejid, PRESENCE_SUBSCRIBED); autocomplete_remove(sub_requests_ac, from_jid->barejid); jid_destroy(from_jid); @@ -479,7 +479,7 @@ _subscribe_handler(xmpp_conn_t * const conn, return 1; } - handle_subscription(from_jid->barejid, PRESENCE_SUBSCRIBE); + srv_subscription(from_jid->barejid, PRESENCE_SUBSCRIBE); autocomplete_add(sub_requests_ac, from_jid->barejid); jid_destroy(from_jid); @@ -507,11 +507,11 @@ _unavailable_handler(xmpp_conn_t * const conn, if (strcmp(my_jid->barejid, from_jid->barejid) !=0) { if (from_jid->resourcepart != NULL) { - handle_contact_offline(from_jid->barejid, from_jid->resourcepart, status_str); + srv_contact_offline(from_jid->barejid, from_jid->resourcepart, status_str); // hack for servers that do not send full jid with unavailable presence } else { - handle_contact_offline(from_jid->barejid, "__prof_default", status_str); + srv_contact_offline(from_jid->barejid, "__prof_default", status_str); } } else { if (from_jid->resourcepart != NULL) { @@ -633,7 +633,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 { - handle_contact_online(xmpp_presence->jid->barejid, resource, xmpp_presence->last_activity); + srv_contact_online(xmpp_presence->jid->barejid, resource, xmpp_presence->last_activity); } jid_destroy(my_jid); @@ -719,7 +719,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); - handle_room_destroyed(room, new_jid, password, reason); + srv_room_destroyed(room, new_jid, password, reason); free(password); free(reason); @@ -727,19 +727,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); - handle_room_kicked(room, actor, reason); + srv_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); - handle_room_banned(room, actor, reason); + srv_room_banned(room, actor, reason); free(reason); // normal exit } else { - handle_leave_room(room); + srv_leave_room(room); } g_slist_free_full(status_codes, free); @@ -750,7 +750,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); - handle_muc_self_online(room, nick, config_required, role, affiliation, actor, reason, jid, show_str, status_str); + srv_muc_self_online(room, nick, config_required, role, affiliation, actor, reason, jid, show_str, status_str); } // handle presence from room members @@ -772,19 +772,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); - handle_room_occupent_kicked(room, nick, actor, reason); + srv_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); - handle_room_occupent_banned(room, nick, actor, reason); + srv_room_occupent_banned(room, nick, actor, reason); free(reason); // normal exit } else { - handle_room_occupant_offline(room, nick, "offline", status_str); + srv_room_occupant_offline(room, nick, "offline", status_str); } g_slist_free_full(status_codes, free); @@ -802,7 +802,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); - handle_muc_occupant_online(room, nick, jid, role, affiliation, actor, reason, show_str, status_str); + srv_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 2e9d461b..51880d77 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; - handle_group_add(data->name, data->group); + srv_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; - handle_group_remove(data->name, data->group); + srv_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); - handle_roster_remove(barejid_lower); + srv_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) { - handle_roster_add(barejid_lower, name); + srv_roster_add(barejid_lower, name); } } else { - handle_roster_update(barejid_lower, name, groups, sub, pending_out); + srv_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); } - handle_roster_received(); + srv_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 5df7c243..29290203 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); - handle_contact_online("test1@server", resource, NULL); + srv_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); - handle_contact_online("test1@server", resource, NULL); + srv_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); - handle_contact_online("test1@server", resource, NULL); + srv_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); - handle_contact_online("test1@server", resource, NULL); + srv_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); - handle_contact_online("test1@server", resource, NULL); + srv_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); - handle_contact_online("test1@server", resource, NULL); + srv_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); - handle_message_error(from, type, err_msg); + srv_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(); - handle_message_error(from, type, err_msg); + srv_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); - handle_message_error(barejid, type, err_msg); + srv_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); - handle_message_error(from, type, err_msg); + srv_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); - handle_presence_error(from, type, err_msg); + srv_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); - handle_presence_error(from, type, err_msg); + srv_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); - handle_contact_offline(barejid, resource, NULL); + srv_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(); - handle_lost_connection(); + srv_lost_connection(); ChatSession *session1 = chat_session_get("bob@server.org"); ChatSession *session2 = chat_session_get("steve@server.org"); |