comparison libnnchat.h @ 325:c086345d176b

Move some functions to libnnchat and rename nn_find_window to findWindow()
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 11 Jun 2011 10:03:44 +0300
parents b765f15f9895
children a8bda904846c
comparison
equal deleted inserted replaced
324:ba4cc7ebe311 325:c086345d176b
28 #define NN_TMPBUF_SIZE (4096) 28 #define NN_TMPBUF_SIZE (4096)
29 #define NN_ALLOC_SIZE (128) 29 #define NN_ALLOC_SIZE (128)
30 #define NN_CONNBUF_SIZE (64 * 1024) 30 #define NN_CONNBUF_SIZE (64 * 1024)
31 #define NN_NUM_BUCKETS (256) 31 #define NN_NUM_BUCKETS (256)
32 #define NN_DELAY_USEC (15 * 1000) 32 #define NN_DELAY_USEC (15 * 1000)
33 #define NN_BACKBUF_LEN (512) /* Backbuffer size (in lines) */
33 34
34 typedef struct { 35 typedef struct {
35 ssize_t pos, len, size; 36 ssize_t pos, len, size;
36 char *data; 37 char *data;
37 } nn_editbuf_t; 38 } nn_editbuf_t;
68 69
69 char buf[NN_CONNBUF_SIZE + 16]; 70 char buf[NN_CONNBUF_SIZE + 16];
70 char *ptr; 71 char *ptr;
71 ssize_t got; 72 ssize_t got;
72 } nn_conn_t; 73 } nn_conn_t;
74
75
76 typedef struct {
77 qringbuf_t *data; /* "Backbuffer" data for this window */
78 int pos; /* Current position in the window, 0 = real time */
79 BOOL dirty;
80
81 char *id; /* Chatter ID, NULL = main window */
82 int num; /* Window number */
83
84 char *buf;
85 size_t len, bufsize;
86 } nn_window_t;
73 87
74 88
75 const char *nn_get_errstr(int err); 89 const char *nn_get_errstr(int err);
76 BOOL nn_network_init(void); 90 BOOL nn_network_init(void);
77 void nn_network_close(void); 91 void nn_network_close(void);
117 nn_editbuf_t * nn_editbuf_copy(nn_editbuf_t *src); 131 nn_editbuf_t * nn_editbuf_copy(nn_editbuf_t *src);
118 void nn_editbuf_setpos(nn_editbuf_t *buf, ssize_t pos); 132 void nn_editbuf_setpos(nn_editbuf_t *buf, ssize_t pos);
119 char * nn_editbuf_get_string(nn_editbuf_t *buf, ssize_t start, ssize_t end); 133 char * nn_editbuf_get_string(nn_editbuf_t *buf, ssize_t start, ssize_t end);
120 134
121 135
136 nn_window_t *nn_window_new(const char *);
137 void nn_window_free(nn_window_t *);
138
122 #endif 139 #endif