Added remaining chat states
This commit is contained in:
@@ -272,6 +272,13 @@ ui_handle_stanza(const char * const msg)
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
ui_chat_win_exists(const char * const barejid)
|
||||
{
|
||||
ProfChatWin *chatwin = wins_get_chat(barejid);
|
||||
return (chatwin != NULL);
|
||||
}
|
||||
|
||||
void
|
||||
ui_contact_typing(const char * const barejid)
|
||||
{
|
||||
@@ -691,6 +698,7 @@ ui_close_connected_win(int index)
|
||||
otr_end_session(chatwin->barejid);
|
||||
}
|
||||
#endif
|
||||
chat_state_gone(chatwin->barejid, chatwin->state);
|
||||
chat_session_remove(chatwin->barejid);
|
||||
}
|
||||
}
|
||||
@@ -1365,9 +1373,9 @@ ui_outgoing_chat_msg(const char * const from, const char * const barejid,
|
||||
// create new window
|
||||
if (window == NULL) {
|
||||
window = wins_new_chat(barejid);
|
||||
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||
#ifdef HAVE_LIBOTR
|
||||
if (otr_is_secure(barejid)) {
|
||||
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||
chatwin->is_otr = TRUE;
|
||||
}
|
||||
#endif
|
||||
@@ -1389,6 +1397,8 @@ ui_outgoing_chat_msg(const char * const from, const char * const barejid,
|
||||
} else {
|
||||
num = wins_get_num(window);
|
||||
}
|
||||
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||
chat_state_active(chatwin->state);
|
||||
|
||||
win_save_print(window, '-', NULL, 0, THEME_TEXT_ME, from, message);
|
||||
ui_switch_win(num);
|
||||
@@ -2234,6 +2244,46 @@ ui_chat_win_contact_offline(PContact contact, char *resource, char *status)
|
||||
free(display_str);
|
||||
}
|
||||
|
||||
void
|
||||
ui_contact_offline(char *barejid, char *resource, char *status)
|
||||
{
|
||||
char *show_console = prefs_get_string(PREF_STATUSES_CONSOLE);
|
||||
char *show_chat_win = prefs_get_string(PREF_STATUSES_CHAT);
|
||||
Jid *jid = jid_create_from_bare_and_resource(barejid, resource);
|
||||
PContact contact = roster_get_contact(barejid);
|
||||
if (p_contact_subscription(contact) != NULL) {
|
||||
if (strcmp(p_contact_subscription(contact), "none") != 0) {
|
||||
|
||||
// show in console if "all"
|
||||
if (g_strcmp0(show_console, "all") == 0) {
|
||||
cons_show_contact_offline(contact, resource, status);
|
||||
|
||||
// show in console of "online"
|
||||
} else if (g_strcmp0(show_console, "online") == 0) {
|
||||
cons_show_contact_offline(contact, resource, status);
|
||||
}
|
||||
|
||||
// show in chat win if "all"
|
||||
if (g_strcmp0(show_chat_win, "all") == 0) {
|
||||
ui_chat_win_contact_offline(contact, resource, status);
|
||||
|
||||
// show in char win if "online" and presence online
|
||||
} else if (g_strcmp0(show_chat_win, "online") == 0) {
|
||||
ui_chat_win_contact_offline(contact, resource, status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProfChatWin *chatwin = wins_get_chat(barejid);
|
||||
if (chatwin && chatwin->resource_override && (g_strcmp0(resource, chatwin->resource_override) == 0)) {
|
||||
FREE_SET_NULL(chatwin->resource_override);
|
||||
}
|
||||
|
||||
prefs_free_string(show_console);
|
||||
prefs_free_string(show_chat_win);
|
||||
jid_destroy(jid);
|
||||
}
|
||||
|
||||
void
|
||||
ui_clear_win_title(void)
|
||||
{
|
||||
|
||||
@@ -145,18 +145,18 @@ inp_get_char(char *input, int *size, int *result)
|
||||
noecho();
|
||||
*result = wget_wch(inp_win, &ch);
|
||||
|
||||
// gboolean in_command = FALSE;
|
||||
// if ((display_size > 0 && input[0] == '/') ||
|
||||
// (display_size == 0 && ch == '/')) {
|
||||
// in_command = TRUE;
|
||||
// }
|
||||
gboolean in_command = FALSE;
|
||||
if ((display_size > 0 && input[0] == '/') ||
|
||||
(display_size == 0 && ch == '/')) {
|
||||
in_command = TRUE;
|
||||
}
|
||||
|
||||
// if (*result == ERR) {
|
||||
// prof_handle_idle();
|
||||
// }
|
||||
// if ((*result != ERR) && (*result != KEY_CODE_YES) && !in_command && _printable(ch)) {
|
||||
// prof_handle_activity();
|
||||
// }
|
||||
if (*result == ERR) {
|
||||
prof_handle_idle();
|
||||
}
|
||||
if ((*result != ERR) && (*result != KEY_CODE_YES) && !in_command && _printable(ch)) {
|
||||
prof_handle_activity();
|
||||
}
|
||||
|
||||
// if it wasn't an arrow key etc
|
||||
if (!_handle_edit(*result, ch, input, size)) {
|
||||
|
||||
@@ -186,6 +186,7 @@ void ui_group_added(const char * const contact, const char * const group);
|
||||
void ui_group_removed(const char * const contact, const char * const group);
|
||||
void ui_chat_win_contact_online(PContact contact, Resource *resource, GDateTime *last_activity);
|
||||
void ui_chat_win_contact_offline(PContact contact, char *resource, char *status);
|
||||
void ui_contact_offline(char *barejid, char *resource, char *status);
|
||||
void ui_handle_recipient_not_found(const char * const recipient, const char * const err_msg);
|
||||
void ui_handle_recipient_error(const char * const recipient, const char * const err_msg);
|
||||
void ui_handle_error(const char * const err_msg);
|
||||
@@ -213,6 +214,7 @@ void ui_show_lines(ProfWin *window, const gchar** lines);
|
||||
void ui_redraw_all_room_rosters(void);
|
||||
void ui_show_all_room_rosters(void);
|
||||
void ui_hide_all_room_rosters(void);
|
||||
gboolean ui_chat_win_exists(const char * const barejid);
|
||||
|
||||
void ui_tidy_wins(void);
|
||||
void ui_prune_wins(void);
|
||||
|
||||
@@ -137,6 +137,7 @@ win_create_chat(const char * const barejid)
|
||||
new_win->is_trusted = FALSE;
|
||||
new_win->history_shown = FALSE;
|
||||
new_win->unread = 0;
|
||||
new_win->state = chat_state_new();
|
||||
|
||||
new_win->memcheck = PROFCHATWIN_MEMCHECK;
|
||||
|
||||
@@ -334,6 +335,7 @@ win_free(ProfWin* window)
|
||||
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||
free(chatwin->barejid);
|
||||
free(chatwin->resource_override);
|
||||
free(chatwin->state);
|
||||
}
|
||||
|
||||
if (window->type == WIN_MUC) {
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "muc.h"
|
||||
#include "ui/buffer.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "chat_state.h"
|
||||
|
||||
#define NO_ME 1
|
||||
#define NO_DATE 2
|
||||
@@ -109,6 +110,7 @@ typedef struct prof_chat_win_t {
|
||||
ProfWin window;
|
||||
char *barejid;
|
||||
int unread;
|
||||
ChatState *state;
|
||||
gboolean is_otr;
|
||||
gboolean is_trusted;
|
||||
char *resource_override;
|
||||
|
||||
Reference in New Issue
Block a user