NAME

messageHandler


DESCRIPTION

messageHandler copes with all messages that are meant to be localized, notably the actions of the bot, e.g. the toutou mode. New mechanism taking xml formalism to save and load the reactions. 2 hashes are set up to be able to fetch a command from a token, and a token from a trigger...

The ressource files are fetched from configpath/ressources/* if the given ressource name doesn't begin with a /


COPYRIGHT and LICENCE

  Copyright (c) 2002 Bruno Boettcher
  messageHandler 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; version 2
  of the License.
  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.


Methods of this class

init
Initiaize, means set up this module

help
issue the help for this module

isa
return the type of thie module

version
return the version of this module

load
load the file with the basic reactions of the bot

dumpLangs
make a listing of the actual loaded language ressources

dumpLang
dumps the ressources for 1 language

dumpXml
rebuild the xml structure from the data structure n sight of saving it t a file...

2 structures hidden inside: the emotes, where the toke has a validity range, and the messages, which use the same grammar but without a validity range.

dumpEmote
take a lang token entry and produce some XML code for it

2 structures hidden inside: the emotes, where the toke has a validity range, and the messages, which use the same grammar but without a validity range.

sysdata
getter for for the holder instance with the global data and methods

shutdown
closing operations, saving emotes!

save
save the datastructures if needed, preparation of a shutdown, or a saveguard point...

getMesg
return for the given token a translation into a localized string this method takes the arguments in the following order: token to be translated, language (defautet to an existing lang), the mode of the actual message (defaultet to 'default' a default string in case the token couldn't be found (default lower case toekn)

getEmote
return for the given localized trigger a translation into a localized string this method takes the arguments in the following order: trigger to be searched, language, the mode of the actual message

PRIVMSGaction
This module accepts also some commands, and is thus active also for private messages send to the bot. this way a more dynmaic handling of the mesages and the emotes is given. since writing by hand xml code isn't at all so fun....

Thus just add the needed tokens into the code, and then give them a real text through the bot shell

fetchChannelLang
small function that retrieves the language of a channel

addEmote
small function that retrieves the language of a channel

listTriggers
fetch the triggers in a given language for a given activation type

completeMsg
The message returned by getMesg or getEmote might contain some tags that need to be exchanged against the real data, the data hash is submitted through reference.

the stuff to be replaced is generally speaking taken from the html entities, since the & is a special perl char, it was replaced with standard +. otherwise... i implemented only the signs i might use, thus if you need other ones feel free to extend this list...

  %sender       $data->{"usernick"}/g;
  %realname     $data->{"username"}/g;
  %host         $data->{"userhost"}/g;
  %target       $data->{"target"}/g;
  %channel      $data->{"channel"}/g;
  %rest         $data->{"line"}/g;
  %C             #mirc style color codes
  +copy;        ©
  +reg;         ®
  +Auml;        Ä
  +Ouml;        Ö
  +Uuml;        Ü
  +auml;        ä
  +ouml;        ö
  +uuml;        ü
  +szlig;       ß
  +Egrave;      È
  +Eacute;      É
  +Ecirc;       Ê
  +egrave;      è
  +eacute;      é
  +ecirc;       ê
  +Ucirc;       Û
  +ucirc;       û
  +Ugrave;      Ù
  +ugrave;      ú
  +agrave;      à
  +Agrave;      À
  +acirc;       â
  +aelig;       æ
  +ccedil;      ç
  +iuml;        ï
  +Iuml;        ï
  +ocirc;       ô
  +Ocirc;       Ô


AUTHOR

Bruno Böttcher <bboett at adlp.org>


SEE ALSO

zebot home page http://www.freesoftware.fsf.org/zebot/ POD documentation of zebot