1 /* 2 * file chat.h - managing chat data for both client and server 3 * 4 * $Id: chat.h,v 1.11 2006/02/24 21:29:16 fzago Exp $ 5 * 6 * Program XBLAST 7 * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net) 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published 11 * by the Free Software Foundation; either version 2; or (at your option) 12 * any later version 13 * 14 * This program is distributed in the hope that it will be entertaining, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 17 * Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License along 20 * with this program; if not, write to the Free Software Foundation, Inc. 21 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 */ 23 #ifndef XBLAST_CHAT_H 24 #define XBLAST_CHAT_H 25 26 #define CHAT_LINE_SIZE 50 27 28 /* 29 * type declarations 30 */ 31 typedef struct _xb_chat XBChat; 32 33 typedef enum 34 { 35 XBCM_Public, 36 XBCM_Team, 37 XBCM_Private, 38 XBCM_System, 39 } XBChatMode; 40 41 typedef enum 42 { 43 XBCS_Created, 44 XBCS_Input, 45 XBCS_Inactive, 46 XBCS_Sent, 47 XBCS_Received, 48 } XBChatStatus; 49 50 /* 51 * global prototypes 52 */ 53 54 /* init */ 55 extern void Chat_Clear (void); 56 57 /* start/stop chat handling */ 58 extern void Chat_Listen (XBBool); 59 extern XBBool Chat_isListening (void); 60 61 /* create */ 62 extern XBChat *Chat_Create (void); 63 extern XBChat *Chat_CreateSys (void); 64 65 /* modify */ 66 extern void Chat_Set (XBChat * chat, unsigned char fh, unsigned char fp, unsigned char th, 67 unsigned char tp, unsigned char how, const char *txt); 68 extern void Chat_SetText (XBChat * chat, const char *txt); 69 70 /* get */ 71 extern void Chat_Receive (XBChat *); 72 extern XBChat *Chat_Pop (void); 73 74 /* packing/unpacking */ 75 extern size_t Chat_PackData (XBChat * chat, char **data, unsigned *iob); 76 extern XBChat *Chat_UnpackData (const char *data, size_t len, unsigned iob); 77 78 /* chat events */ 79 extern void Chat_AddEventCode (unsigned local, XBEventCode ev); 80 extern XBEventCode Chat_GetCurrentCode (void); 81 extern unsigned char Chat_FindCode (XBEventCode); 82 extern XBBool Chat_Event (XBEventCode, XBEventData); 83 84 #endif 85 /* 86 * end of file chat.h 87 */ 88