diff libnnchat.h @ 330:8e509d6546d3

Move nn_strtuple_* functions to libnnchat.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 14 Jun 2011 12:59:03 +0300
parents a8bda904846c
children b54c8545dcb0
line wrap: on
line diff
--- a/libnnchat.h	Tue Jun 14 10:45:40 2011 +0300
+++ b/libnnchat.h	Tue Jun 14 12:59:03 2011 +0300
@@ -32,23 +32,6 @@
 #define NN_DELAY_USEC     (15 * 1000)
 #define NN_BACKBUF_LEN    (512)       /* Backbuffer size (in lines) */
 
-typedef struct {
-    ssize_t pos, len, size;
-    char *data;
-} nn_editbuf_t;
-
-
-typedef struct _nn_user_t {
-    char *name;
-    time_t lastspoke, joined;
-    struct _nn_user_t *next;
-} nn_user_t;
-
-
-typedef struct {
-    nn_user_t *buckets[NN_NUM_BUCKETS];
-} nn_userhash_t;
-
 enum {
     NN_CONN_UNINIT = 0,
     NN_CONN_OPEN,
@@ -72,21 +55,6 @@
     ssize_t got;
 } nn_conn_t;
 
-
-typedef struct {
-    qringbuf_t *data;   /* "Backbuffer" data for this window */
-    int pos;            /* Current position in the window, 0 = real time */
-    BOOL dirty;
-
-    char *id;           /* Chatter ID, NULL = main window */
-    int num;		/* Window number */
-    
-    char *buf;
-    size_t len, bufsize;
-    size_t chlen;
-} nn_window_t;
-
-
 const char *nn_get_errstr(int err);
 BOOL        nn_network_init(void);
 void        nn_network_close(void);
@@ -99,6 +67,16 @@
 BOOL        nn_conn_check(nn_conn_t *);
 
 
+typedef struct _nn_user_t {
+    char *name;
+    time_t lastspoke, joined;
+    struct _nn_user_t *next;
+} nn_user_t;
+
+typedef struct {
+    nn_user_t *buckets[NN_NUM_BUCKETS];
+} nn_userhash_t;
+
 nn_userhash_t *nn_userhash_new(void);
 nn_user_t * nn_userhash_foreach(const nn_userhash_t *, int (*func)(const nn_user_t *));
 nn_user_t * nn_user_match(const nn_userhash_t *list, const char *str, const char *current, BOOL again);
@@ -123,6 +101,11 @@
 char *      nn_username_decode(char *str);
 
 
+typedef struct {
+    ssize_t pos, len, size;
+    char *data;
+} nn_editbuf_t;
+
 int         nn_editbuf_write(nn_editbuf_t *buf, ssize_t pos, int ch);
 int         nn_editbuf_insert(nn_editbuf_t *buf, ssize_t pos, int ch);
 int         nn_editbuf_delete(nn_editbuf_t *buf, ssize_t pos);
@@ -134,7 +117,30 @@
 char *      nn_editbuf_get_string(nn_editbuf_t *buf, ssize_t start, ssize_t end);
 
 
+typedef struct {
+    qringbuf_t *data;   /* "Backbuffer" data for this window */
+    int pos;            /* Current position in the window, 0 = real time */
+    BOOL dirty;
+
+    char *id;           /* Chatter ID, NULL = main window */
+    int num;		/* Window number */
+    
+    char *buf;
+    size_t len, bufsize;
+    size_t chlen;
+} nn_window_t;
+
 nn_window_t *nn_window_new(const char *);
 void        nn_window_free(nn_window_t *);
 
+
+typedef struct {
+    size_t len;
+    char *str;
+} nn_strtuple_t;
+
+
+nn_strtuple_t *nn_strtuple_new(size_t, char *);
+void nn_strtuple_free(nn_strtuple_t *);
+
 #endif