mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Continue to send chat states when no viewing chat window
This commit is contained in:
parent
76149e1f31
commit
a775d18291
@ -51,7 +51,6 @@
|
|||||||
#include <ncurses/ncurses.h>
|
#include <ncurses/ncurses.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "chat_session.h"
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "contact_list.h"
|
#include "contact_list.h"
|
||||||
@ -145,37 +144,12 @@ inp_get_char(int *ch, char *input, int *size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (prefs_get_states()) {
|
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) {
|
if (*ch == ERR) {
|
||||||
if (win_in_chat() && !win_in_groupchat()) {
|
win_no_activity();
|
||||||
char *recipient = win_get_recipient();
|
|
||||||
chat_session_no_activity(recipient);
|
|
||||||
|
|
||||||
if (chat_session_is_gone(recipient) &&
|
|
||||||
!chat_session_get_sent(recipient)) {
|
|
||||||
jabber_send_gone(recipient);
|
|
||||||
} else if (chat_session_is_inactive(recipient) &&
|
|
||||||
!chat_session_get_sent(recipient)) {
|
|
||||||
jabber_send_inactive(recipient);
|
|
||||||
} else if (prefs_get_outtype() &&
|
|
||||||
chat_session_is_paused(recipient) &&
|
|
||||||
!chat_session_get_sent(recipient)) {
|
|
||||||
jabber_send_paused(recipient);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if got char and in chat window, chat session active
|
|
||||||
if (prefs_get_outtype() && (*ch != ERR) && win_in_chat() &&
|
|
||||||
!win_in_groupchat() && !in_command && _printable(*ch)) {
|
|
||||||
char *recipient = win_get_recipient();
|
|
||||||
chat_session_set_composing(recipient);
|
|
||||||
if (!chat_session_get_sent(recipient) ||
|
|
||||||
chat_session_is_paused(recipient)) {
|
|
||||||
jabber_send_composing(recipient);
|
|
||||||
}
|
}
|
||||||
|
if (prefs_get_outtype() && (*ch != ERR) && !in_command
|
||||||
|
&& _printable(*ch)) {
|
||||||
|
win_activity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
src/ui.h
2
src/ui.h
@ -103,6 +103,8 @@ void win_disconnected(void);
|
|||||||
void win_show(const char * const msg);
|
void win_show(const char * const msg);
|
||||||
void win_bad_show(const char * const msg);
|
void win_bad_show(const char * const msg);
|
||||||
void win_remind(void);
|
void win_remind(void);
|
||||||
|
void win_activity(void);
|
||||||
|
void win_no_activity(void);
|
||||||
|
|
||||||
void win_join_chat(const char * const room_jid, const char * const nick);
|
void win_join_chat(const char * const room_jid, const char * const nick);
|
||||||
void win_show_room_roster(const char * const room);
|
void win_show_room_roster(const char * const room);
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "chat_log.h"
|
#include "chat_log.h"
|
||||||
|
#include "chat_session.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "contact.h"
|
#include "contact.h"
|
||||||
#include "contact_list.h"
|
#include "contact_list.h"
|
||||||
@ -262,6 +263,47 @@ win_remind(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
win_activity(void)
|
||||||
|
{
|
||||||
|
if (win_in_chat() && !win_in_groupchat()) {
|
||||||
|
char *recipient = win_get_recipient();
|
||||||
|
chat_session_set_composing(recipient);
|
||||||
|
if (!chat_session_get_sent(recipient) ||
|
||||||
|
chat_session_is_paused(recipient)) {
|
||||||
|
jabber_send_composing(recipient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
win_no_activity(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// loop through regular chat windows and update states
|
||||||
|
for (i = 1; i < NUM_WINS; i++) {
|
||||||
|
if ((strcmp(_wins[i].from, "") != 0) &&
|
||||||
|
(!room_is_active(_wins[i].from))) {
|
||||||
|
char *recipient = _wins[i].from;
|
||||||
|
chat_session_no_activity(recipient);
|
||||||
|
|
||||||
|
if (chat_session_is_gone(recipient) &&
|
||||||
|
!chat_session_get_sent(recipient)) {
|
||||||
|
jabber_send_gone(recipient);
|
||||||
|
} else if (chat_session_is_inactive(recipient) &&
|
||||||
|
!chat_session_get_sent(recipient)) {
|
||||||
|
jabber_send_inactive(recipient);
|
||||||
|
} else if (prefs_get_outtype() &&
|
||||||
|
chat_session_is_paused(recipient) &&
|
||||||
|
!chat_session_get_sent(recipient)) {
|
||||||
|
jabber_send_paused(recipient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
win_show_incomming_msg(const char * const from, const char * const message,
|
win_show_incomming_msg(const char * const from, const char * const message,
|
||||||
GTimeVal *tv_stamp)
|
GTimeVal *tv_stamp)
|
||||||
|
Loading…
Reference in New Issue
Block a user