]> icculus.org git repositories - taylor/freespace2.git/blob - include/chat_api.h
re-add PXO sources to project files
[taylor/freespace2.git] / include / chat_api.h
1 /*
2  * Copyright (C) Volition, Inc. 2005.  All rights reserved.
3  * 
4  * All source code herein is the property of Volition, Inc. You may not sell 
5  * or otherwise commercially exploit the source or things you created based on the 
6  * source.
7  *
8 */
9
10 #ifndef PXO_CHAT_API_HEADER_FILE
11 #define PXO_CHAT_API_HEADER_FILE
12
13 // chat server port
14 #define PXO_CHAT_PORT           7117
15
16 // motd prefix
17 #define PXO_CHAT_MOTD_PREFIX                            "!MOTD$#!"
18 #define PXO_CHAT_END_OF_MOTD_PREFIX             "!EMOTD$#!"
19
20 //Commands
21 #define CC_USER_JOINING         1       //A user had joined this channel (add him/her from the user listbox if any)
22 #define CC_USER_LEAVING         2       //A user has left the channel (remove him/her from the user listbox if any)
23 #define CC_DISCONNECTED         3       //We have been disconnected from the server (close the chat screen down)
24 #define CC_KICKED                               4       //We were kicked out of the channel! (close the chat screen down?)
25 #define CC_NICKCHANGED          5       //Informing that your nickname has changed (data = "oldnick newnick")
26 #define CC_YOURCHANNEL          6       //data = name of the channel you are in. Only generated when you are joining #autoselect
27
28 #define MAXLOCALSTRING 600
29 #define MSG_REMOTE 0
30 #define MSG_LOCAL  1
31
32 typedef struct _Chat_user
33 {
34         char nick_name[33];
35          _Chat_user *next;
36 }Chat_user;
37
38 typedef struct _Chat_channel
39 {
40         char channel_name[33];
41         unsigned short users;
42         char topic[100];
43          _Chat_channel *next;
44 }Chat_channel;
45
46
47 typedef struct _Chat_command
48 {
49         short command;
50         char    data[100];
51         _Chat_command *next;
52 }Chat_command;
53
54 //Prototypes
55 void ChatInit(void);
56 int ConnectToChatServer(char *serveraddr,char *nickname,char *trackerid);
57 void DisconnectFromChatServer();
58 char * GetChatText();
59 const char *SendChatString(const char *line, int raw=0);
60 Chat_command *GetChatCommand();
61 char *GetChatUserList();
62 int SetNewChatChannel(char *channel);
63 char *GetChannelList(void);
64 char *GetTrackerIdByUser(char *nickname);
65 char *GetChannelByUser(char *nickname);
66
67 char *ChatGetString(void);
68 const char *GetWordNum(int num, const char *l_String);
69 char * ParseIRCMessage(char *Line, int iMode);
70 int AddChatUser(const char *nickname);
71 int RemoveChatUser(char *nickname);
72 void RemoveAllChatUsers(void);
73 void AddChatCommandToQueue(int command, const void *data, int len);
74 Chat_command *GetChatCommandFromQueue(void);
75 void FlushChatCommandQueue(void);
76 void AddChannel(char *channel,unsigned short numusers,char *topic);
77 void FlushChannelList(void);
78
79 #endif