mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Removed functions from windows.c
This commit is contained in:
parent
86dc29d8e8
commit
1c71cf0037
@ -245,23 +245,29 @@ _ui_win_exists(int index)
|
||||
static gboolean
|
||||
_ui_xmlconsole_exists(void)
|
||||
{
|
||||
return wins_xmlconsole_exists();
|
||||
ProfXMLWin *xmlwin = wins_get_xmlconsole();
|
||||
if (xmlwin) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_handle_stanza(const char * const msg)
|
||||
{
|
||||
if (ui_xmlconsole_exists()) {
|
||||
ProfWin *xmlconsole = wins_get_xmlconsole();
|
||||
ProfXMLWin *xmlconsole = wins_get_xmlconsole();
|
||||
ProfWin *window = (ProfWin*) xmlconsole;
|
||||
|
||||
if (g_str_has_prefix(msg, "SENT:")) {
|
||||
win_save_print(xmlconsole, '-', NULL, 0, 0, "", "SENT:");
|
||||
win_save_print(xmlconsole, '-', NULL, 0, THEME_ONLINE, "", &msg[6]);
|
||||
win_save_print(xmlconsole, '-', NULL, 0, THEME_ONLINE, "", "");
|
||||
win_save_print(window, '-', NULL, 0, 0, "", "SENT:");
|
||||
win_save_print(window, '-', NULL, 0, THEME_ONLINE, "", &msg[6]);
|
||||
win_save_print(window, '-', NULL, 0, THEME_ONLINE, "", "");
|
||||
} else if (g_str_has_prefix(msg, "RECV:")) {
|
||||
win_save_print(xmlconsole, '-', NULL, 0, 0, "", "RECV:");
|
||||
win_save_print(xmlconsole, '-', NULL, 0, THEME_AWAY, "", &msg[6]);
|
||||
win_save_print(xmlconsole, '-', NULL, 0, THEME_AWAY, "", "");
|
||||
win_save_print(window, '-', NULL, 0, 0, "", "RECV:");
|
||||
win_save_print(window, '-', NULL, 0, THEME_AWAY, "", &msg[6]);
|
||||
win_save_print(window, '-', NULL, 0, THEME_AWAY, "", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -685,23 +691,27 @@ _ui_handle_special_keys(const wint_t * const ch, const int result)
|
||||
static void
|
||||
_ui_close_connected_win(int index)
|
||||
{
|
||||
win_type_t win_type = ui_win_type(index);
|
||||
if (win_type == WIN_MUC) {
|
||||
ProfMucWin *mucwin = wins_get_muc_by_num(index);
|
||||
presence_leave_chat_room(mucwin->roomjid);
|
||||
} else if (win_type == WIN_CHAT) {
|
||||
ProfWin *window = wins_get_by_num(index);
|
||||
if (window) {
|
||||
if (window->type == WIN_MUC) {
|
||||
ProfMucWin *mucwin = (ProfMucWin*) window;
|
||||
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||
presence_leave_chat_room(mucwin->roomjid);
|
||||
} else if (window->type == WIN_CHAT) {
|
||||
ProfChatWin *chatwin = (ProfChatWin*) window;
|
||||
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||
#ifdef HAVE_LIBOTR
|
||||
ProfChatWin *chatwin = wins_get_chat_by_num(index);
|
||||
if (chatwin->is_otr) {
|
||||
otr_end_session(chatwin->barejid);
|
||||
}
|
||||
if (chatwin->is_otr) {
|
||||
otr_end_session(chatwin->barejid);
|
||||
}
|
||||
#endif
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
// send <gone/> chat state before closing
|
||||
if (chat_session_get_recipient_supports(chatwin->barejid)) {
|
||||
chat_session_set_gone(chatwin->barejid);
|
||||
message_send_gone(chatwin->barejid);
|
||||
chat_session_end(chatwin->barejid);
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
// send <gone/> chat state before closing
|
||||
if (chat_session_get_recipient_supports(chatwin->barejid)) {
|
||||
chat_session_set_gone(chatwin->barejid);
|
||||
message_send_gone(chatwin->barejid);
|
||||
chat_session_end(chatwin->barejid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1389,9 +1399,9 @@ _ui_create_xmlconsole_win(void)
|
||||
static void
|
||||
_ui_open_xmlconsole_win(void)
|
||||
{
|
||||
ProfWin *window = wins_get_xmlconsole();
|
||||
if (window != NULL) {
|
||||
int num = wins_get_num(window);
|
||||
ProfXMLWin *xmlwin = wins_get_xmlconsole();
|
||||
if (xmlwin != NULL) {
|
||||
int num = wins_get_num((ProfWin*)xmlwin);
|
||||
ui_switch_win(num);
|
||||
}
|
||||
}
|
||||
@ -2626,7 +2636,7 @@ _ui_handle_room_configuration(const char * const roomjid, DataForm *form)
|
||||
{
|
||||
ProfWin *window = wins_new_muc_config(roomjid, form);
|
||||
ProfMucConfWin *confwin = (ProfMucConfWin*)window;
|
||||
assert(confwin->memcheck = PROFCONFWIN_MEMCHECK);
|
||||
assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
|
||||
|
||||
int num = wins_get_num(window);
|
||||
ui_switch_win(num);
|
||||
|
@ -274,32 +274,6 @@ wins_get_by_num(int i)
|
||||
return g_hash_table_lookup(windows, GINT_TO_POINTER(i));
|
||||
}
|
||||
|
||||
ProfChatWin *
|
||||
wins_get_chat_by_num(int i)
|
||||
{
|
||||
ProfWin *window = g_hash_table_lookup(windows, GINT_TO_POINTER(i));
|
||||
if (window) {
|
||||
ProfChatWin *chatwin = (ProfChatWin*)window;
|
||||
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||
return chatwin;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ProfMucWin *
|
||||
wins_get_muc_by_num(int i)
|
||||
{
|
||||
ProfWin *window = g_hash_table_lookup(windows, GINT_TO_POINTER(i));
|
||||
if (window) {
|
||||
ProfMucWin *mucwin = (ProfMucWin*)window;
|
||||
assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
|
||||
return mucwin;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ProfWin *
|
||||
wins_get_next(void)
|
||||
{
|
||||
@ -575,26 +549,7 @@ wins_show_subwin(ProfWin *window)
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
wins_xmlconsole_exists(void)
|
||||
{
|
||||
GList *values = g_hash_table_get_values(windows);
|
||||
GList *curr = values;
|
||||
|
||||
while (curr != NULL) {
|
||||
ProfWin *window = curr->data;
|
||||
if (window->type == WIN_XML) {
|
||||
g_list_free(values);
|
||||
return TRUE;
|
||||
}
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
|
||||
g_list_free(values);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ProfWin *
|
||||
ProfXMLWin *
|
||||
wins_get_xmlconsole(void)
|
||||
{
|
||||
GList *values = g_hash_table_get_values(windows);
|
||||
@ -603,8 +558,10 @@ wins_get_xmlconsole(void)
|
||||
while (curr != NULL) {
|
||||
ProfWin *window = curr->data;
|
||||
if (window->type == WIN_XML) {
|
||||
ProfXMLWin *xmlwin = (ProfXMLWin*)window;
|
||||
assert(xmlwin->memcheck == PROFXMLWIN_MEMCHECK);
|
||||
g_list_free(values);
|
||||
return window;
|
||||
return xmlwin;
|
||||
}
|
||||
curr = g_list_next(curr);
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ ProfChatWin *wins_get_chat(const char * const barejid);
|
||||
ProfMucWin * wins_get_muc(const char * const roomjid);
|
||||
ProfMucConfWin * wins_get_muc_conf(const char * const roomjid);
|
||||
ProfPrivateWin *wins_get_private(const char * const fulljid);
|
||||
ProfXMLWin * wins_get_xmlconsole(void);
|
||||
|
||||
ProfWin * wins_get_current(void);
|
||||
ProfChatWin * wins_get_current_chat(void);
|
||||
@ -58,8 +59,6 @@ ProfMucConfWin * wins_get_current_muc_conf(void);
|
||||
void wins_set_current_by_num(int i);
|
||||
|
||||
ProfWin * wins_get_by_num(int i);
|
||||
ProfChatWin * wins_get_chat_by_num(int i);
|
||||
ProfMucWin * wins_get_muc_by_num(int i);
|
||||
|
||||
ProfWin * wins_get_next(void);
|
||||
ProfWin * wins_get_previous(void);
|
||||
@ -78,8 +77,6 @@ gboolean wins_tidy(void);
|
||||
GSList * wins_create_summary(void);
|
||||
void wins_destroy(void);
|
||||
GList * wins_get_nums(void);
|
||||
gboolean wins_xmlconsole_exists(void);
|
||||
ProfWin * wins_get_xmlconsole(void);
|
||||
gboolean wins_swap(int source_win, int target_win);
|
||||
void wins_hide_subwin(ProfWin *window);
|
||||
void wins_show_subwin(ProfWin *window);
|
||||
|
Loading…
x
Reference in New Issue
Block a user