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

Renamed presence_update -> presence_send

This commit is contained in:
James Booth 2015-05-07 23:12:49 +01:00
parent f69ccbf0cc
commit 56cbce2ff3
7 changed files with 17 additions and 22 deletions

View File

@ -507,7 +507,7 @@ cmd_account(gchar **args, struct cmd_help_t help)
if (presence_type == last_presence) { if (presence_type == last_presence) {
char *message = jabber_get_presence_message(); char *message = jabber_get_presence_message();
presence_update(last_presence, message, 0); presence_send(last_presence, message, 0);
} }
} }
cons_show("Updated %s priority for account %s: %s", property, account_name, value); cons_show("Updated %s priority for account %s: %s", property, account_name, value);
@ -3808,7 +3808,7 @@ cmd_priority(gchar **args, struct cmd_help_t help)
if (res) { if (res) {
accounts_set_priority_all(jabber_get_account_name(), intval); accounts_set_priority_all(jabber_get_account_name(), intval);
resource_presence_t last_presence = accounts_get_last_presence(jabber_get_account_name()); resource_presence_t last_presence = accounts_get_last_presence(jabber_get_account_name());
presence_update(last_presence, jabber_get_presence_message(), 0); presence_send(last_presence, jabber_get_presence_message(), 0);
cons_show("Priority set to %d.", intval); cons_show("Priority set to %d.", intval);
} else { } else {
cons_show(err_msg); cons_show(err_msg);
@ -4330,7 +4330,7 @@ _update_presence(const resource_presence_t resource_presence,
if (conn_status != JABBER_CONNECTED) { if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected."); cons_show("You are not currently connected.");
} else { } else {
presence_update(resource_presence, msg, 0); presence_send(resource_presence, msg, 0);
ui_update_presence(resource_presence, msg, show); ui_update_presence(resource_presence, msg, show);
} }
} }

View File

@ -172,12 +172,12 @@ _check_autoaway()
// handle away mode // handle away mode
if (strcmp(pref_autoaway_mode, "away") == 0) { if (strcmp(pref_autoaway_mode, "away") == 0) {
presence_update(RESOURCE_AWAY, pref_autoaway_message, 0); presence_send(RESOURCE_AWAY, pref_autoaway_message, 0);
ui_auto_away(); ui_auto_away();
// handle idle mode // handle idle mode
} else if (strcmp(pref_autoaway_mode, "idle") == 0) { } else if (strcmp(pref_autoaway_mode, "idle") == 0) {
presence_update(RESOURCE_ONLINE, pref_autoaway_message, idle_ms / 1000); presence_send(RESOURCE_ONLINE, pref_autoaway_message, idle_ms / 1000);
} }
prefs_free_string(pref_autoaway_message); prefs_free_string(pref_autoaway_message);
@ -191,10 +191,10 @@ _check_autoaway()
// handle check // handle check
if (prefs_get_boolean(PREF_AUTOAWAY_CHECK)) { if (prefs_get_boolean(PREF_AUTOAWAY_CHECK)) {
if (strcmp(pref_autoaway_mode, "away") == 0) { if (strcmp(pref_autoaway_mode, "away") == 0) {
presence_update(RESOURCE_ONLINE, NULL, 0); presence_send(RESOURCE_ONLINE, NULL, 0);
ui_end_auto_away(); ui_end_auto_away();
} else if (strcmp(pref_autoaway_mode, "idle") == 0) { } else if (strcmp(pref_autoaway_mode, "idle") == 0) {
presence_update(RESOURCE_ONLINE, NULL, 0); presence_send(RESOURCE_ONLINE, NULL, 0);
ui_titlebar_presence(CONTACT_ONLINE); ui_titlebar_presence(CONTACT_ONLINE);
} }
} }

View File

@ -193,8 +193,7 @@ presence_reset_sub_request_search(void)
} }
void void
presence_update(const resource_presence_t presence_type, const char * const msg, presence_send(const resource_presence_t presence_type, const char * const msg, const int idle)
const int idle)
{ {
if (jabber_get_connection_status() != JABBER_CONNECTED) { if (jabber_get_connection_status() != JABBER_CONNECTED) {
log_warning("Error setting presence, not connected."); log_warning("Error setting presence, not connected.");
@ -202,18 +201,14 @@ presence_update(const resource_presence_t presence_type, const char * const msg,
} }
if (msg) { if (msg) {
log_debug("Updating presence: %s, \"%s\"", log_debug("Updating presence: %s, \"%s\"", string_from_resource_presence(presence_type), msg);
string_from_resource_presence(presence_type), msg);
} else { } else {
log_debug("Updating presence: %s", log_debug("Updating presence: %s", string_from_resource_presence(presence_type));
string_from_resource_presence(presence_type));
} }
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
const int pri = const int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(), presence_type);
accounts_get_priority_for_presence_type(jabber_get_account_name(),
presence_type);
const char *show = stanza_get_presence_string_from_type(presence_type); const char *show = stanza_get_presence_string_from_type(presence_type);
connection_set_presence_message(msg); connection_set_presence_message(msg);

View File

@ -331,7 +331,7 @@ _roster_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, v
sv_ev_roster_received(); sv_ev_roster_received();
resource_presence_t conn_presence = accounts_get_login_presence(jabber_get_account_name()); resource_presence_t conn_presence = accounts_get_login_presence(jabber_get_account_name());
presence_update(conn_presence, NULL, 0); presence_send(conn_presence, NULL, 0);
return 1; return 1;
} }

View File

@ -168,7 +168,7 @@ char * presence_sub_request_find(const char * const search_str);
void presence_join_room(char *room, char *nick, char * passwd); void presence_join_room(char *room, char *nick, char * passwd);
void presence_change_room_nick(const char * const room, const char * const nick); void presence_change_room_nick(const char * const room, const char * const nick);
void presence_leave_chat_room(const char * const room_jid); void presence_leave_chat_room(const char * const room_jid);
void presence_update(resource_presence_t status, const char * const msg, void presence_send(resource_presence_t status, const char * const msg,
int idle); int idle);
gboolean presence_sub_request_exists(const char * const bare_jid); gboolean presence_sub_request_exists(const char * const bare_jid);

View File

@ -941,9 +941,9 @@ void cmd_account_set_priority_updates_presence_when_account_connected_with_prese
will_return(jabber_get_presence_message, "Free to chat"); will_return(jabber_get_presence_message, "Free to chat");
expect_value(presence_update, status, RESOURCE_ONLINE); expect_value(presence_send, status, RESOURCE_ONLINE);
expect_string(presence_update, msg, "Free to chat"); expect_string(presence_send, msg, "Free to chat");
expect_value(presence_update, idle, 0); expect_value(presence_send, idle, 0);
expect_cons_show("Updated online priority for account a_account: 10"); expect_cons_show("Updated online priority for account a_account: 10");
expect_cons_show(""); expect_cons_show("");

View File

@ -114,7 +114,7 @@ void presence_join_room(char *room, char *nick, char * passwd)
void presence_change_room_nick(const char * const room, const char * const nick) {} void presence_change_room_nick(const char * const room, const char * const nick) {}
void presence_leave_chat_room(const char * const room_jid) {} void presence_leave_chat_room(const char * const room_jid) {}
void presence_update(resource_presence_t status, const char * const msg, int idle) void presence_send(resource_presence_t status, const char * const msg, int idle)
{ {
check_expected(status); check_expected(status);
check_expected(msg); check_expected(msg);