FS2_Open
Open source remastering of the Freespace 2 engine
chat_api.h
Go to the documentation of this file.
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 #include "globalincs/pstypes.h"
14 
15 // chat server port
16 #define PXO_CHAT_PORT 7117
17 
18 // motd prefix
19 #define PXO_CHAT_MOTD_PREFIX "!MOTD$#!"
20 #define PXO_CHAT_END_OF_MOTD_PREFIX "!EMOTD$#!"
21 
22 //Commands
23 #define CC_USER_JOINING 1 //A user had joined this channel (add him/her from the user listbox if any)
24 #define CC_USER_LEAVING 2 //A user has left the channel (remove him/her from the user listbox if any)
25 #define CC_DISCONNECTED 3 //We have been disconnected from the server (close the chat screen down)
26 #define CC_KICKED 4 //We were kicked out of the channel! (close the chat screen down?)
27 #define CC_NICKCHANGED 5 //Informing that your nickname has changed (data = "oldnick newnick")
28 #define CC_YOURCHANNEL 6 //data = name of the channel you are in. Only generated when you are joining #autoselect
29 
30 #define MAXLOCALSTRING 600
31 #define MSG_REMOTE 0
32 #define MSG_LOCAL 1
33 
34 typedef struct _Chat_user {
35  char nick_name[33];
37 } Chat_user;
38 
39 typedef struct _Chat_channel {
40  char channel_name[33];
41  unsigned short users;
42  char topic[100];
44 } Chat_channel;
45 
46 
47 typedef struct _Chat_command {
48  short command;
49  char data[100];
51 } Chat_command;
52 
53 //Prototypes
54 void ChatInit(void);
55 int ConnectToChatServer(char *serveraddr, char *nickname, char *trackerid);
57 char *GetChatText();
58 const char *SendChatString(const char *line, int raw = 0);
60 char *GetChatUserList();
61 int SetNewChatChannel(char *channel);
62 char *GetChannelList(void);
63 char *GetTrackerIdByUser(char *nickname);
64 char *GetChannelByUser(char *nickname);
65 
66 char *ChatGetString(void);
67 char *GetWordNum(int num, const char *l_String);
68 char *ParseIRCMessage(char *Line, int iMode);
69 int AddChatUser(char *nickname);
70 int RemoveChatUser(char *nickname);
71 void RemoveAllChatUsers(void);
72 void AddChatCommandToQueue(int command, void *data, int len);
74 void FlushChatCommandQueue(void);
75 void AddChannel(char *channel, ushort numusers, char *topic);
76 void FlushChannelList(void);
77 
78 #endif
char * GetChannelByUser(char *nickname)
Definition: chat_api.cpp:1301
const char * SendChatString(const char *line, int raw=0)
Definition: chat_api.cpp:305
struct _Chat_command Chat_command
char * ChatGetString(void)
Definition: chat_api.cpp:470
char * GetTrackerIdByUser(char *nickname)
Definition: chat_api.cpp:1270
void AddChannel(char *channel, ushort numusers, char *topic)
Definition: chat_api.cpp:1239
void ChatInit(void)
Definition: chat_api.cpp:74
struct _Chat_user Chat_user
void RemoveAllChatUsers(void)
Definition: chat_api.cpp:629
int SetNewChatChannel(char *channel)
Definition: chat_api.cpp:429
_Chat_command * next
Definition: chat_api.h:50
char * ParseIRCMessage(char *Line, int iMode)
Definition: chat_api.cpp:644
void AddChatCommandToQueue(int command, void *data, int len)
Definition: chat_api.cpp:1130
char * GetChatText()
Definition: chat_api.cpp:292
char * GetWordNum(int num, const char *l_String)
Definition: chat_api.cpp:525
struct _Chat_channel Chat_channel
void DisconnectFromChatServer()
Definition: chat_api.cpp:262
Chat_command * GetChatCommand()
Definition: chat_api.cpp:382
char nick_name[33]
Definition: chat_api.h:35
void FlushChatCommandQueue(void)
Definition: chat_api.cpp:1169
void FlushChannelList(void)
Definition: chat_api.cpp:1184
int RemoveChatUser(char *nickname)
Definition: chat_api.cpp:600
int ConnectToChatServer(char *serveraddr, char *nickname, char *trackerid)
Definition: chat_api.cpp:111
GLuint GLuint num
Definition: Glext.h:9089
_Chat_user * next
Definition: chat_api.h:36
unsigned short users
Definition: chat_api.h:41
char * GetChatUserList()
Definition: chat_api.cpp:391
char * GetChannelList(void)
Definition: chat_api.cpp:1199
unsigned short ushort
Definition: pstypes.h:63
_Chat_channel * next
Definition: chat_api.h:43
GLenum GLsizei GLenum GLenum const GLvoid * data
Definition: Gl.h:1509
GLenum GLsizei len
Definition: Glext.h:6283
Chat_command * GetChatCommandFromQueue(void)
Definition: chat_api.cpp:1156
char topic[100]
Definition: chat_api.h:42
char channel_name[33]
Definition: chat_api.h:40
short command
Definition: chat_api.h:48
int AddChatUser(char *nickname)
Definition: chat_api.cpp:564