The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

SYNOPSIS

  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

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

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

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

  - 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

Net::CyanChat

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

AUTHOR

Noah Petherbridge, http://www.kirsle.net/

COPYRIGHT AND LICENSE

    Net::CyanChat - Perl interface to CyanChat.
    Copyright (C) 2007-2015  Noah Petherbridge

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA