71
|
1 #ifndef __HBUF_H__ |
|
2 #define __HBUF_H__ 1 |
|
3 |
184
|
4 #include <time.h> |
71
|
5 #include <glib.h> |
|
6 |
106
|
7 // With current implementation a message must fit in a hbuf block, |
|
8 // so we shouldn't choose a too small size. |
186
|
9 #define HBB_BLOCKSIZE 4096 // > 20 please |
71
|
10 |
|
11 // Flags: |
|
12 // - ALLOC: the ptr data has been allocated, it can be freed |
|
13 // - PERSISTENT: this is a new history line |
|
14 #define HBB_FLAG_ALLOC 1 |
|
15 #define HBB_FLAG_PERSISTENT 2 |
184
|
16 |
|
17 #define HBB_PREFIX_IN 1 |
|
18 #define HBB_PREFIX_OUT 2 |
|
19 #define HBB_PREFIX_STATUS 4 |
|
20 #define HBB_PREFIX_AUTH 8 |
|
21 #define HBB_PREFIX_INFO 16 |
71
|
22 |
184
|
23 typedef struct { |
|
24 time_t timestamp; |
|
25 guchar flags; |
|
26 char *text; |
|
27 } hbb_line; |
|
28 |
|
29 void hbuf_add_line(GList **p_hbuf, const char *text, time_t timestamp, |
|
30 guint prefix_flags, guint width); |
71
|
31 void hbuf_free(GList **p_hbuf); |
|
32 void hbuf_rebuild(GList **p_hbuf, unsigned int width); |
|
33 |
184
|
34 hbb_line **hbuf_get_lines(GList *hbuf, unsigned int n); |
71
|
35 |
|
36 #endif /* __HBUF_H__ */ |