
simple chat protocol
version 1.4
grelminar@yahoo.com

--------------------

the protocol is ascii over tcp. each message contains several fields,
the first of which a type field that determines the meaning of the
remaining ones. fields are separated by a colon (':', ascii 58). each
message is terminated by either a CR (ascii 13), a LF (ascii 10) or any
combination of those two.

either side can close the connection at any time. the other side should
respond to this by closing their end of the connection also.

for each message type, the last field is allowed to contain colons.

player names are used to differentiate players. case is insignificant
when comparing player names, but the server is required to use the same
capitalization for all instances of the same player in the same session
(i.e., if someone logs out and logs in again, the case of their name
might change).


login:

client sends:
	LOGIN:version:name:password
		(version is an integer specifying the version of this protocol
		that this client supports. it should be 1 for now.)

server will respond:
	LOGINBAD:message
		(disconnect)
or
	LOGINOK:yourname
		(the server/biller can rename clients, so the new name must be
		sent back to the client)


entering arenas:

client sends:
	GO:name
		(use an empty name to mean "first public arena". note that even
		if name is empty, the colon is still required.)


server may reply:
	INARENA:arenaname:freq
		(client should clear its player list when it gets this. freq is
		the freq that the client has been assigned.)
	PLAYER:name:ship:freq
		(one line for each player who's in the arena at the time when it
		is entered.)


enter/leave notification:

server sends:
	ENTERING:name:ship:freq
		(when a player enters an arena)
	LEAVING:name
		(when a player leaves)


ship/freq changes:

client sends:
	CHANGEFREQ:freq

server sends:
	SHIPFREQCHANGE:name:ship:freq
		(ships are numbered from 0 (warbird) to 8 (spectator))


kills:

server sends:
	KILL:killername:killedname:bounty:flagscarried


chat (the important part):

client sends:
	SEND:PUB:msg
	SEND:PRIV:name:msg
		(the same message type works for both regular and remove priv msgs)
	SEND:FREQ:freq:msg
		(freq is the number of the destination freq)
	SEND:CHAT:line
		(line is either "msg" or "channelnum;msg")
	SEND:MOD:msg
	SEND:CMD:cmd
	SEND:PRIVCMD:name:msg
	SEND:SQUAD:squad:msg

server sends:
	MSG:ARENA:msg
	MSG:CMD:msg
	MSG:PUB:name:msg
	MSG:PRIV:name:msg
	MSG:FREQ:name:msg
	MSG:CHAT:channelnum:msg
	MSG:MOD:name:msg
	MSG:SYSOP:msg
	MSG:SQUAD:squad:sender:msg


# dist: public

