comparison mcabber/src/hbuf.h @ 184:b5aa2b9c425a

[/trunk] Changeset 196 by mikael * Don't use a char* as prefix, but split it to timestamp + flags. * Don't use a boolean for timestamp, use a time_t (actually we always use a timestamp so the bool made no sense...).
author mikael
date Thu, 05 May 2005 19:38:44 +0000
parents 9a31028e8095
children 888ad9f15346
comparison
equal deleted inserted replaced
183:c658c131ea10 184:b5aa2b9c425a
1 #ifndef __HBUF_H__ 1 #ifndef __HBUF_H__
2 #define __HBUF_H__ 1 2 #define __HBUF_H__ 1
3 3
4 #include <time.h>
4 #include <glib.h> 5 #include <glib.h>
5 6
6 // With current implementation a message must fit in a hbuf block, 7 // With current implementation a message must fit in a hbuf block,
7 // so we shouldn't choose a too small size. 8 // so we shouldn't choose a too small size.
8 #define HBB_BLOCKSIZE 2048 // > 20 please 9 #define HBB_BLOCKSIZE 2048 // > 20 please
10 // Flags: 11 // Flags:
11 // - ALLOC: the ptr data has been allocated, it can be freed 12 // - ALLOC: the ptr data has been allocated, it can be freed
12 // - PERSISTENT: this is a new history line 13 // - PERSISTENT: this is a new history line
13 #define HBB_FLAG_ALLOC 1 14 #define HBB_FLAG_ALLOC 1
14 #define HBB_FLAG_PERSISTENT 2 15 #define HBB_FLAG_PERSISTENT 2
15 // #define HBB_FLAG_FREE 4
16 16
17 void hbuf_add_line(GList **p_hbuf, const char *text, const char *prefix, 17 #define HBB_PREFIX_IN 1
18 unsigned int width); 18 #define HBB_PREFIX_OUT 2
19 #define HBB_PREFIX_STATUS 4
20 #define HBB_PREFIX_AUTH 8
21 #define HBB_PREFIX_INFO 16
22
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);
19 void hbuf_free(GList **p_hbuf); 31 void hbuf_free(GList **p_hbuf);
20 void hbuf_rebuild(GList **p_hbuf, unsigned int width); 32 void hbuf_rebuild(GList **p_hbuf, unsigned int width);
21 33
22 char **hbuf_get_lines(GList *hbuf, unsigned int n); 34 hbb_line **hbuf_get_lines(GList *hbuf, unsigned int n);
23 35
24 #endif /* __HBUF_H__ */ 36 #endif /* __HBUF_H__ */