File: chat_api.h

package info (click to toggle)
freespace2 24.2.0%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 43,716 kB
  • sloc: cpp: 595,001; ansic: 21,741; python: 1,174; sh: 457; makefile: 248; xml: 181
file content (81 lines) | stat: -rw-r--r-- 2,540 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 * Copyright (C) Volition, Inc. 2005.  All rights reserved.
 * 
 * All source code herein is the property of Volition, Inc. You may not sell 
 * or otherwise commercially exploit the source or things you created based on the 
 * source.
 *
*/

#ifndef PXO_CHAT_API_HEADER_FILE
#define PXO_CHAT_API_HEADER_FILE

#include "globalincs/pstypes.h"

// chat server port
#define PXO_CHAT_PORT		7711

// motd prefix
#define PXO_CHAT_MOTD_PREFIX				"!MOTD$#!"
#define PXO_CHAT_END_OF_MOTD_PREFIX		"!EMOTD$#!"

//Commands
#define CC_USER_JOINING		1	//A user had joined this channel (add him/her from the user listbox if any)
#define CC_USER_LEAVING		2	//A user has left the channel (remove him/her from the user listbox if any)
#define CC_DISCONNECTED		3	//We have been disconnected from the server (close the chat screen down)
#define CC_KICKED				4	//We were kicked out of the channel! (close the chat screen down?)
#define CC_NICKCHANGED		5	//Informing that your nickname has changed (data = "oldnick newnick")
#define CC_YOURCHANNEL		6	//data = name of the channel you are in. Only generated when you are joining #autoselect

#define MAXLOCALSTRING 600
#define MSG_REMOTE 0
#define MSG_LOCAL  1

typedef struct _Chat_user {
	char nick_name[33];
	_Chat_user *next;
} Chat_user;

typedef struct _Chat_channel {
	char channel_name[33];
	unsigned short users;
	char topic[100];
	_Chat_channel *next;
} Chat_channel;


typedef struct _Chat_command {
	short command;
	char	data[100];
	_Chat_command *next;
} Chat_command;

// For returning a player's channel when searching by player name
extern char User_req_channel[100];

//Prototypes
void ChatInit(void);
int ConnectToChatServer(char *serveraddr, char *nickname, char *trackerid);
void DisconnectFromChatServer();
char *GetChatText();
const char *SendChatString(const char *line, int raw = 0);
Chat_command *GetChatCommand();
char *GetChatUserList();
int SetNewChatChannel(char *channel);
char *GetChannelList(void);
char *GetTrackerIdByUser(char *nickname);
char *GetChannelByUser(const char *nickname);

char *ChatGetString(void);
const char *GetWordNum(int num, const char *l_String);
char *ParseIRCMessage(char *Line, int iMode);
int AddChatUser(const char *nickname);
int RemoveChatUser(const char *nickname);
void RemoveAllChatUsers(void);
void AddChatCommandToQueue(int command, const void *data, size_t len);
Chat_command *GetChatCommandFromQueue(void);
void FlushChatCommandQueue(void);
void AddChannel(char *channel, ushort numusers, char *topic);
void FlushChannelList(void);

#endif