Removed functions from windows.c

This commit is contained in:
James Booth
2014-12-22 00:28:03 +00:00
parent 86dc29d8e8
commit 1c71cf0037
3 changed files with 42 additions and 78 deletions

View File

@@ -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);