Added SILC Thread Queue API
[runtime.git] / apps / irssi / src / fe-common / core / formats.h
index 86c53e69f28921ca167dfe920346cb24fdbf2cf1..7dbdd90423ff0860bd773fa40194acc607d6a604 100644 (file)
@@ -4,13 +4,16 @@
 #include "themes.h"
 #include "fe-windows.h"
 
-#define PRINTFLAG_BOLD          0x01
-#define PRINTFLAG_REVERSE       0x02
-#define PRINTFLAG_UNDERLINE     0x04
-#define PRINTFLAG_BLINK         0x08
-#define PRINTFLAG_MIRC_COLOR    0x10
-#define PRINTFLAG_INDENT        0x20
-#define PRINTFLAG_NEWLINE       0x40
+#define GUI_PRINT_FLAG_BOLD          0x0001
+#define GUI_PRINT_FLAG_REVERSE       0x0002
+#define GUI_PRINT_FLAG_UNDERLINE     0x0004
+#define GUI_PRINT_FLAG_BLINK         0x0008
+#define GUI_PRINT_FLAG_MIRC_COLOR    0x0010
+#define GUI_PRINT_FLAG_INDENT        0x0020
+#define GUI_PRINT_FLAG_INDENT_FUNC   0x0040
+#define GUI_PRINT_FLAG_NEWLINE       0x0080
+#define GUI_PRINT_FLAG_CLRTOEOL      0x0100
+#define GUI_PRINT_FLAG_MONOSPACE     0x0200
 
 #define MAX_FORMAT_PARAMS 10
 #define DEFAULT_FORMAT_ARGLIST_SIZE 200
@@ -30,16 +33,32 @@ struct _FORMAT_REC {
        int paramtypes[MAX_FORMAT_PARAMS];
 };
 
-typedef struct {
+#define PRINT_FLAG_SET_LINE_START      0x0001
+#define PRINT_FLAG_SET_LINE_START_IRSSI        0x0002
+#define PRINT_FLAG_UNSET_LINE_START    0x0003
+
+#define PRINT_FLAG_SET_TIMESTAMP       0x0004
+#define PRINT_FLAG_UNSET_TIMESTAMP     0x0008
+
+#define PRINT_FLAG_SET_SERVERTAG       0x0010
+#define PRINT_FLAG_UNSET_SERVERTAG     0x0020
+
+typedef struct _TEXT_DEST_REC {
        WINDOW_REC *window;
        SERVER_REC *server;
+        const char *server_tag; /* if server is non-NULL, must be server->tag */
        const char *target;
        int level;
 
        int hilight_priority;
        char *hilight_color;
+        int flags;
 } TEXT_DEST_REC;
 
+#define window_get_theme(window) \
+       (window != NULL && (window)->theme != NULL ? \
+       (window)->theme : current_theme)
+
 int format_find_tag(const char *module, const char *tag);
 
 /* Return length of text part in string (ie. without % codes) */
@@ -49,7 +68,7 @@ int format_get_length(const char *str);
    handles %codes. */
 int format_real_length(const char *str, int len);
 
-char *format_string_expand(const char *text);
+char *format_string_expand(const char *text, int *flags);
 
 char *format_get_text(const char *module, WINDOW_REC *window,
                      void *server, const char *target,
@@ -68,9 +87,10 @@ char *format_get_text_theme_charargs(THEME_REC *theme, const char *module,
                                     TEXT_DEST_REC *dest, int formatnum,
                                     char **args);
 
-/* add `linestart' to start of each line in `text'. `text' may contain
+/* add `linestart' to start/end of each line in `text'. `text' may contain
    multiple lines separated with \n. */
 char *format_add_linestart(const char *text, const char *linestart);
+char *format_add_lineend(const char *text, const char *linestart);
 
 /* return the "-!- " text at the start of the line */
 char *format_get_level_tag(THEME_REC *theme, TEXT_DEST_REC *dest);
@@ -83,6 +103,9 @@ char *format_get_line_start(THEME_REC *theme, TEXT_DEST_REC *dest, time_t t);
 void format_create_dest(TEXT_DEST_REC *dest,
                        void *server, const char *target,
                        int level, WINDOW_REC *window);
+void format_create_dest_tag(TEXT_DEST_REC *dest, void *server,
+                           const char *server_tag, const char *target,
+                           int level, WINDOW_REC *window);
 
 void format_newline(WINDOW_REC *window);
 
@@ -106,8 +129,11 @@ void format_send_to_gui(TEXT_DEST_REC *dest, const char *text);
 #define FORMAT_STYLE_BOLD      (0x03 + FORMAT_STYLE_SPECIAL)
 #define FORMAT_STYLE_REVERSE   (0x04 + FORMAT_STYLE_SPECIAL)
 #define FORMAT_STYLE_INDENT    (0x05 + FORMAT_STYLE_SPECIAL)
-#define FORMAT_STYLE_DEFAULTS  (0x06 + FORMAT_STYLE_SPECIAL)
-int format_expand_styles(GString *out, char format);
+#define FORMAT_STYLE_INDENT_FUNC (0x06 + FORMAT_STYLE_SPECIAL)
+#define FORMAT_STYLE_DEFAULTS  (0x07 + FORMAT_STYLE_SPECIAL)
+#define FORMAT_STYLE_CLRTOEOL  (0x08 + FORMAT_STYLE_SPECIAL)
+#define FORMAT_STYLE_MONOSPACE (0x09 + FORMAT_STYLE_SPECIAL)
+int format_expand_styles(GString *out, const char **format, int *flags);
 
 void formats_init(void);
 void formats_deinit(void);