Net::CyanChat::Server - Perl interface for running a CyanChat server.


Net-CyanChat documentation  | view source Contained in the Net-CyanChat distribution.

Index


NAME

Top

Net::CyanChat::Server - Perl interface for running a CyanChat server.

SYNOPSIS

Top

  use Net::CyanChat::Server;

  our $cho = new Net::CyanChat::Server (
          host  => 'localhost',
          port  => 1812,
          debug => 1,
  );

  # Start the server.
  $cho->connect();

  # Loop.
  $cho->start();

DESCRIPTION

Top

Net::CyanChat::Server is a Perl interface for running your own CyanChat server (or, rather, to run a chat server based on the CyanChat protocol that other CC clients would recognize).

METHODS

Top

new (ARGUMENTS)

Constructor for a new CyanChat server. Pass in the host, port, and debug. All are optional. host defaults to localhost, port defaults to 1812, debug defaults to 0. With debug on, all the server/client conversation is printed.

Returns a CyanChat server object.

version

Returns the version number.

debug ($MESSAGE)

Called by the module itself for debug messages.

connect

Open the server socket and listen for connections.

start

Start a loop of do_one_loop's.

do_one_loop

Perform a single loop of checking for new connections and events from existing connections.

setWelcome (@MESSAGES)

Set the Welcome Messages that are displayed when a user connects to the chat. The default messages are:

  Welcome to Net::CyanChat::Server v. <VERSION>

  There are only a few simple rules:
       1. Be respectful to other users.
       2. Keep the dialog "G" rated.
       3. And HAVE FUN!

  Termination of use can happen without warning!

setPassword ($PASS)

Define the password that is required to authenticate as a staff member. A client would use this password by sending the command below before logging in to the chat room:

  50|password

Note that this part of the protocol support is not official. The administrative commands in the CyanChat protocol is not public knowledge and so this support was just speculated on based on the gaps in the protocol documentation. This probably only works with clients using the Net::CyanChat module.

url

Returns the host/port to your CyanChat server (i.e. "localhost:1812")

reply ($SOCKET, $DATA)

Send data to the specified SOCKET object.

getSocket ($USERNAME)

Get the socket of a username signed into the chat room.

broadcast ($DATA)

Broadcasts commands to all logged-in users.

sendWhoList

Sends the Who List to all users. This should be called when a user joins or exits the room.

CHANGE LOG

Top

Version 0.03

  - Cleaned up the documentation a bit.

Version 0.02

  - Messages can contain pipes in them now.
  - Removed the "staff protocol" number; replaced it with "staff password"
  - Changed the socket end-of-lines to CrLf instead of just Lf.

Version 0.01

  - Initial release.

TO DO

Top

  - Add support for built in profanity filters and bans.
  - Add IP encryption algorythm similar to Cyan's.
  - Display user's ISP as their home Age, rather than their IP address.

SEE ALSO

Top

Net::CyanChat

CyanChat Protocol Documentation: http://cho.cyan.com/chat/programmers.html

AUTHOR

Top

Casey Kirsle, http://www.cuvou.com/

COPYRIGHT AND LICENSE

Top


Net-CyanChat documentation  | view source Contained in the Net-CyanChat distribution.