aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command/commands.c2
-rw-r--r--src/otr/otr.h2
-rw-r--r--src/ui/core.c6
-rw-r--r--src/ui/inputwin.c1
-rw-r--r--src/ui/statusbar.h6
-rw-r--r--src/ui/ui.h141
-rw-r--r--src/ui/window.h125
-rw-r--r--src/window_list.c1
-rw-r--r--src/window_list.h2
9 files changed, 151 insertions, 135 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index e439c198..106ef4c8 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -3230,7 +3230,7 @@ gboolean
cmd_clear(gchar **args, struct cmd_help_t help)
{
ProfWin *win = wins_get_current();
- win_clear(win);
+ ui_clear_win(win);
return TRUE;
}
diff --git a/src/otr/otr.h b/src/otr/otr.h
index e020c0c8..3c46ac3d 100644
--- a/src/otr/otr.h
+++ b/src/otr/otr.h
@@ -39,7 +39,7 @@
#include <libotr/message.h>
#include "config/accounts.h"
-#include "ui/window.h"
+#include "ui/ui.h"
typedef enum {
PROF_OTRPOLICY_MANUAL,
diff --git a/src/ui/core.c b/src/ui/core.c
index 78a5e026..127405f6 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -2217,6 +2217,12 @@ ui_clear_win_title(void)
}
void
+ui_clear_win(ProfWin *window)
+{
+ win_clear(window);
+}
+
+void
ui_goodbye_title(void)
{
int result = system("/bin/echo -ne \"\033]0;Thanks for using Profanity\007\"");
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c
index 1cbf5249..57814414 100644
--- a/src/ui/inputwin.c
+++ b/src/ui/inputwin.c
@@ -62,6 +62,7 @@
#include "ui/ui.h"
#include "ui/statusbar.h"
#include "ui/inputwin.h"
+#include "ui/window.h"
#include "window_list.h"
#include "event/ui_events.h"
#include "xmpp/xmpp.h"
diff --git a/src/ui/statusbar.h b/src/ui/statusbar.h
index 7d2c5ea0..c37f43f3 100644
--- a/src/ui/statusbar.h
+++ b/src/ui/statusbar.h
@@ -42,10 +42,6 @@ void status_bar_clear(void);
void status_bar_clear_message(void);
void status_bar_get_password(void);
void status_bar_print_message(const char * const msg);
-void status_bar_inactive(const int win);
-void status_bar_active(const int win);
-void status_bar_new(const int win);
-void status_bar_set_all_inactive(void);
void status_bar_current(int i);
-#endif \ No newline at end of file
+#endif
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 8e5ca6ab..434fab24 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -38,13 +38,118 @@
#include "config.h"
#include <wchar.h>
-
#include <glib.h>
+#ifdef HAVE_NCURSESW_NCURSES_H
+#include <ncursesw/ncurses.h>
+#elif HAVE_NCURSES_H
+#include <ncurses.h>
+#endif
#include "contact.h"
#include "jid.h"
-#include "ui/window.h"
#include "xmpp/xmpp.h"
+#include "ui/buffer.h"
+#include "chat_state.h"
+#include "muc.h"
+
+#define LAYOUT_SPLIT_MEMCHECK 12345671
+#define PROFCHATWIN_MEMCHECK 22374522
+#define PROFMUCWIN_MEMCHECK 52345276
+#define PROFPRIVATEWIN_MEMCHECK 77437483
+#define PROFCONFWIN_MEMCHECK 64334685
+#define PROFXMLWIN_MEMCHECK 87333463
+
+#define NO_ME 1
+#define NO_DATE 2
+#define NO_EOL 4
+#define NO_COLOUR_FROM 8
+#define NO_COLOUR_DATE 16
+
+typedef enum {
+ LAYOUT_SIMPLE,
+ LAYOUT_SPLIT
+} layout_type_t;
+
+typedef struct prof_layout_t {
+ layout_type_t type;
+ WINDOW *win;
+ ProfBuff buffer;
+ int y_pos;
+ int paged;
+} ProfLayout;
+
+typedef struct prof_layout_simple_t {
+ ProfLayout base;
+} ProfLayoutSimple;
+
+typedef struct prof_layout_split_t {
+ ProfLayout base;
+ WINDOW *subwin;
+ int sub_y_pos;
+ unsigned long memcheck;
+} ProfLayoutSplit;
+
+typedef enum {
+ WIN_CONSOLE,
+ WIN_CHAT,
+ WIN_MUC,
+ WIN_MUC_CONFIG,
+ WIN_PRIVATE,
+ WIN_XML
+} win_type_t;
+
+typedef enum {
+ PROF_ENC_NONE,
+ PROF_ENC_OTR
+} prof_enc_t;
+
+typedef struct prof_win_t {
+ win_type_t type;
+ ProfLayout *layout;
+} ProfWin;
+
+typedef struct prof_console_win_t {
+ ProfWin window;
+} ProfConsoleWin;
+
+typedef struct prof_chat_win_t {
+ ProfWin window;
+ char *barejid;
+ int unread;
+ ChatState *state;
+ prof_enc_t enc_mode;
+ gboolean otr_is_trusted;
+ char *resource_override;
+ gboolean history_shown;
+ unsigned long memcheck;
+} ProfChatWin;
+
+typedef struct prof_muc_win_t {
+ ProfWin window;
+ char *roomjid;
+ int unread;
+ gboolean showjid;
+ unsigned long memcheck;
+} ProfMucWin;
+
+typedef struct prof_mucconf_win_t {
+ ProfWin window;
+ char *roomjid;
+ DataForm *form;
+ unsigned long memcheck;
+} ProfMucConfWin;
+
+typedef struct prof_private_win_t {
+ ProfWin window;
+ char *fulljid;
+ int unread;
+ unsigned long memcheck;
+} ProfPrivateWin;
+
+typedef struct prof_xml_win_t {
+ ProfWin window;
+ unsigned long memcheck;
+} ProfXMLWin;
// ui startup and control
void ui_init(void);
@@ -218,6 +323,7 @@ void ui_page_up(void);
void ui_page_down(void);
void ui_subwin_page_up(void);
void ui_subwin_page_down(void);
+void ui_clear_win(ProfWin *window);
void ui_auto_away(void);
void ui_end_auto_away(void);
@@ -326,12 +432,43 @@ void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *l
void cons_show_contact_offline(PContact contact, char *resource, char *status);
void cons_theme_colours(void);
+// status bar
+void status_bar_inactive(const int win);
+void status_bar_active(const int win);
+void status_bar_new(const int win);
+void status_bar_set_all_inactive(void);
+
// roster window
void rosterwin_roster(void);
// occupants window
void occupantswin_occupants(const char * const room);
+// window interface
+ProfWin* win_create_console(void);
+ProfWin* win_create_xmlconsole(void);
+ProfWin* win_create_chat(const char * const barejid);
+ProfWin* win_create_muc(const char * const roomjid);
+ProfWin* win_create_muc_config(const char * const title, DataForm *form);
+ProfWin* win_create_private(const char * const fulljid);
+
+void win_update_virtual(ProfWin *window);
+void win_free(ProfWin *window);
+int win_unread(ProfWin *window);
+void win_resize(ProfWin *window);
+void win_hide_subwin(ProfWin *window);
+void win_show_subwin(ProfWin *window);
+void win_refresh_without_subwin(ProfWin *window);
+void win_refresh_with_subwin(ProfWin *window);
+void win_print(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, theme_item_t theme_item, const char * const from, const char * const message);
+void win_vprint(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, ...);
+char* win_get_title(ProfWin *window);
+void win_show_occupant(ProfWin *window, Occupant *occupant);
+void win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occupant);
+void win_show_contact(ProfWin *window, PContact contact);
+void win_show_info(ProfWin *window, PContact contact);
+void win_println(ProfWin *window, const char * const message);
+
// desktop notifier actions
void notifier_initialise(void);
void notifier_uninit(void);
diff --git a/src/ui/window.h b/src/ui/window.h
index 6678da07..4b11ade0 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -41,6 +41,7 @@
#include "contact.h"
#include "muc.h"
+#include "ui/ui.h"
#include "ui/buffer.h"
#include "xmpp/xmpp.h"
#include "chat_state.h"
@@ -51,152 +52,28 @@
#include <ncurses.h>
#endif
-#define NO_ME 1
-#define NO_DATE 2
-#define NO_EOL 4
-#define NO_COLOUR_FROM 8
-#define NO_COLOUR_DATE 16
-
#define PAD_SIZE 1000
-#define LAYOUT_SPLIT_MEMCHECK 12345671
-#define PROFCHATWIN_MEMCHECK 22374522
-#define PROFMUCWIN_MEMCHECK 52345276
-#define PROFPRIVATEWIN_MEMCHECK 77437483
-#define PROFCONFWIN_MEMCHECK 64334685
-#define PROFXMLWIN_MEMCHECK 87333463
-
-typedef enum {
- LAYOUT_SIMPLE,
- LAYOUT_SPLIT
-} layout_type_t;
-
-typedef struct prof_layout_t {
- layout_type_t type;
- WINDOW *win;
- ProfBuff buffer;
- int y_pos;
- int paged;
-} ProfLayout;
-
-typedef struct prof_layout_simple_t {
- ProfLayout base;
-} ProfLayoutSimple;
-
-typedef struct prof_layout_split_t {
- ProfLayout base;
- WINDOW *subwin;
- int sub_y_pos;
- unsigned long memcheck;
-} ProfLayoutSplit;
-
-typedef enum {
- WIN_CONSOLE,
- WIN_CHAT,
- WIN_MUC,
- WIN_MUC_CONFIG,
- WIN_PRIVATE,
- WIN_XML
-} win_type_t;
-
-typedef enum {
- PROF_ENC_NONE,
- PROF_ENC_OTR
-} prof_enc_t;
-
-typedef struct prof_win_t {
- win_type_t type;
- ProfLayout *layout;
-} ProfWin;
-
-typedef struct prof_console_win_t {
- ProfWin window;
-} ProfConsoleWin;
-
-typedef struct prof_chat_win_t {
- ProfWin window;
- char *barejid;
- int unread;
- ChatState *state;
- prof_enc_t enc_mode;
- gboolean otr_is_trusted;
- char *resource_override;
- gboolean history_shown;
- unsigned long memcheck;
-} ProfChatWin;
-
-typedef struct prof_muc_win_t {
- ProfWin window;
- char *roomjid;
- int unread;
- gboolean showjid;
- unsigned long memcheck;
-} ProfMucWin;
-
-typedef struct prof_mucconf_win_t {
- ProfWin window;
- char *roomjid;
- DataForm *form;
- unsigned long memcheck;
-} ProfMucConfWin;
-
-typedef struct prof_private_win_t {
- ProfWin window;
- char *fulljid;
- int unread;
- unsigned long memcheck;
-} ProfPrivateWin;
-
-typedef struct prof_xml_win_t {
- ProfWin window;
- unsigned long memcheck;
-} ProfXMLWin;
-
-ProfWin* win_create_console(void);
-ProfWin* win_create_chat(const char * const barejid);
-ProfWin* win_create_muc(const char * const roomjid);
-ProfWin* win_create_muc_config(const char * const title, DataForm *form);
-ProfWin* win_create_private(const char * const fulljid);
-ProfWin* win_create_xmlconsole(void);
-
-char *win_get_title(ProfWin *window);
-
-void win_free(ProfWin *window);
-void win_update_virtual(ProfWin *window);
void win_move_to_end(ProfWin *window);
-void win_show_contact(ProfWin *window, PContact contact);
-void win_show_occupant(ProfWin *window, Occupant *occupant);
void win_show_status_string(ProfWin *window, const char * const from,
const char * const show, const char * const status,
GDateTime *last_activity, const char * const pre,
const char * const default_show);
void win_print_incoming_message(ProfWin *window, GTimeVal *tv_stamp,
const char * const from, const char * const message);
-void win_show_info(ProfWin *window, PContact contact);
-void win_show_occupant_info(ProfWin *window, const char * const room, Occupant *occupant);
-void win_vprint(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, theme_item_t theme_item, const char * const from, const char * const message, ...);
-void win_print(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags, theme_item_t theme_item, const char * const from, const char * const message);
void win_print_with_receipt(ProfWin *window, const char show_char, GTimeVal *tstamp, int flags,
theme_item_t theme_item, const char * const from, const char * const message, char *id);
-void win_println(ProfWin *window, const char * const message);
void win_newline(ProfWin *window);
void win_redraw(ProfWin *window);
-void win_hide_subwin(ProfWin *window);
-void win_show_subwin(ProfWin *window);
int win_roster_cols(void);
int win_occpuants_cols(void);
void win_printline_nowrap(WINDOW *win, char *msg);
void win_mouse(ProfWin *current, const wint_t ch, const int result);
void win_mark_received(ProfWin *window, const char * const id);
-int win_unread(ProfWin *window);
gboolean win_has_active_subwin(ProfWin *window);
void win_clear(ProfWin *window);
-void win_resize(ProfWin *window);
-
-void win_refresh_without_subwin(ProfWin *window);
-void win_refresh_with_subwin(ProfWin *window);
void win_page_up(ProfWin *window);
void win_page_down(ProfWin *window);
diff --git a/src/window_list.c b/src/window_list.c
index 40bc30e2..ff040d63 100644
--- a/src/window_list.c
+++ b/src/window_list.c
@@ -45,7 +45,6 @@
#include "config/theme.h"
#include "ui/ui.h"
#include "ui/statusbar.h"
-#include "ui/window.h"
#include "window_list.h"
#include "event/ui_events.h"
diff --git a/src/window_list.h b/src/window_list.h
index 48910461..8e8e72eb 100644
--- a/src/window_list.h
+++ b/src/window_list.h
@@ -35,7 +35,7 @@
#ifndef WINDOW_LIST_H
#define WINDOW_LIST_H
-#include "ui/window.h"
+#include "ui/ui.h"
void wins_init(void);