mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Only send chat states when preference set
This commit is contained in:
parent
7982d7061b
commit
81dd0a1556
@ -1009,6 +1009,8 @@ static gboolean
|
||||
_cmd_close(const char * const inp, struct cmd_help_t help)
|
||||
{
|
||||
if (win_in_chat()) {
|
||||
|
||||
if (prefs_get_states()) {
|
||||
char *recipient = win_get_recipient();
|
||||
|
||||
// send <gone/> chat state before closing
|
||||
@ -1017,6 +1019,7 @@ _cmd_close(const char * const inp, struct cmd_help_t help)
|
||||
jabber_send_gone(recipient);
|
||||
chat_session_end(recipient);
|
||||
}
|
||||
}
|
||||
|
||||
win_close_win();
|
||||
|
||||
|
@ -137,6 +137,8 @@ inp_get_char(int *ch, char *input, int *size)
|
||||
noecho();
|
||||
*ch = wgetch(inp_win);
|
||||
|
||||
if (prefs_get_states()) {
|
||||
|
||||
// if not got char, and in chat window, flag as no activity
|
||||
// send inactive or gone, depending how long inactive
|
||||
if (*ch == ERR) {
|
||||
@ -161,6 +163,7 @@ inp_get_char(int *ch, char *input, int *size)
|
||||
chat_session_set_active(recipient);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if it wasn't an arrow key etc
|
||||
if (!_handle_edit(*ch, input, size)) {
|
||||
|
@ -137,9 +137,11 @@ jabber_process_events(void)
|
||||
void
|
||||
jabber_send(const char * const msg, const char * const recipient)
|
||||
{
|
||||
if (prefs_get_states()) {
|
||||
if (!chat_session_exists(recipient)) {
|
||||
chat_session_start(recipient, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
char *coded_msg = str_replace(msg, "&", "&");
|
||||
char *coded_msg2 = str_replace(coded_msg, "<", "<");
|
||||
@ -158,6 +160,8 @@ jabber_send(const char * const msg, const char * const recipient)
|
||||
text = xmpp_stanza_new(jabber_conn.ctx);
|
||||
xmpp_stanza_set_text(text, coded_msg3);
|
||||
|
||||
if (prefs_get_states()) {
|
||||
|
||||
// always send <active/> with messages when recipient supports chat states
|
||||
if (chat_session_get_recipient_supports(recipient)) {
|
||||
active = xmpp_stanza_new(jabber_conn.ctx);
|
||||
@ -165,6 +169,7 @@ jabber_send(const char * const msg, const char * const recipient)
|
||||
xmpp_stanza_set_ns(active, "http://jabber.org/protocol/chatstates");
|
||||
xmpp_stanza_add_child(reply, active);
|
||||
}
|
||||
}
|
||||
|
||||
xmpp_stanza_add_child(body, text);
|
||||
xmpp_stanza_add_child(reply, body);
|
||||
|
Loading…
Reference in New Issue
Block a user