]> git.pond.sub.org Git - empserver/blobdiff - include/tel.h
Factor out code to read mailboxes, and make read more robust
[empserver] / include / tel.h
index 91883c7e510991c617493fe2ea83652d0d8aa4ec..0df505c78c139020d1c088601ae65bceb36e0ce9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
  *
  *  ---
  *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
+ *  See files README, COPYING and CREDITS in the root of the source
+ *  tree for related information and legal notices.  It is expected
+ *  that future projects/authors will amend these files as needed.
  *
  *  ---
  *
  *  tel.h: Definitions for things having to do with telegrams
- * 
+ *
  *  Known contributors to this file:
- *     
+ *
  */
 
-#ifndef _TEL_H_
-#define _TEL_H_
+#ifndef TEL_H
+#define TEL_H
+
+#include <stdio.h>
+#include <time.h>
+#include "types.h"
 
 #define        MAXTELSIZE      1024    /* doesn't apply to TEL_UPDATE */
 
 #define TEL_UPDATE     3       /* update message */
 #define TEL_LAST        3
 
-#define TEL_SECONDS 5 /* how many seconds before starting a new telegram */
+#define TEL_SECONDS 5          /* how many seconds before starting a new telegram */
 
-struct telstr {
-       natid   tel_from;       /* sender */
-       s_char  tel_type;
-       long    tel_length;     /* how long */
-       time_t  tel_date;       /* when sent */
+struct telstr {
+    natid tel_from;            /* sender */
+    unsigned char tel_type;
+    unsigned tel_length;       /* how long */
+    time_t tel_date;           /* when sent */
 };
 
-extern s_char *mailbox(s_char *buf, natid cn);
-
-extern s_char *teldir, *telfil;
-
-extern  s_char *annfil;
-
+extern char *mailbox(char *buf, natid cn);
+extern int tel_read_header(FILE *, char *, struct telstr *);
+extern int tel_read_body(FILE *, char *, struct telstr *,
+                        int (*sink)(char *, size_t, void *),
+                        void *);
 
-#endif /* _TEL_H_ */
+#endif