Moved UI interfaces to ui.h

This commit is contained in:
James Booth
2015-06-15 20:11:34 +01:00
parent 38ed9188d3
commit 5cdd69f478
11 changed files with 208 additions and 139 deletions

View File

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