wanha - your pesky URL-guardian for IRC 1. Introduction wanha is combination of a Perl-script to run as a bot on IRC to watch the channel for URLs and another script to run as a web-interface on an HTTP-server. The bot will watch over the channel, friendly and warmly keeping the conversation going, discreetly discouraging people not to paste already pasted URLs again. The web-interface can be used to track to see what URLs have already been pasted and by whom -- this greatly enhances Your and Your friends' IRC-experience. 2. Requirements wanha currently uses PostgreSQL as a database for persistent information, and module "Pg" as the API. Using any other SQL-database should be trivial by modifying db.pl which houses the API to access the data. In addition to Pg, wanha also uses module "Socket". Both should be trivial to find and install if not installed already. The web-interface obviously requires a set-up HTTP-server that can run external application (CGI). Only the "Pg" module should be required for the web-interface. The web-interface can take advantage for mod_rewrite.c for pretty URLs but this is not required. 3. Features wanha will keep track of pasted links for given channels. The bot remembers who pasted the link first and when. When pasted again, constructive guidance to avoid making the same mistake again is given discreetly to the user. If a link is known to be already seen, this can be told to the bot by placing "w:" or "w!" on front of the link (like "w! http://www.google.com/intl/en/"). 3.1. Counting score: fame, shame, cheat, wanha When a URL is first pasted it will be inserted in the database. When the same URL is pasted again, things get nasty. a) User who originally pasted the URL will be rewarded with a fame point. b) If the URL was pasted without "w!" marker, user who pasted the URL again will receive a shame point. c) If the URL was pasted with "w!" marker, user will receive a wanha point. Exceptions: - To prevent abuse of using "w!" marker, pasting previously unseen URL with the "w!" marker will be awarded with a cheat score. - User who originally pasted the URL can be repaste it again as many times as (s)he wants. No points are accumulated by this. 3.2. wanha's URLs All URLs without URL-rewrite also work when URL-rewrite is enabled. 3.2.1. Channel summary With URL-rewrite Without URL-rewrite http://base.url/chan-$N http://base.url/chan.pl?chan=$N http://base.url/s/$C http://base.url/go.pl?s=$C Where $N is channel number and $C is channel name, optionally without leading hash ('#'). Leaving out the channel identifier only works with channels beginning with a hash. 3.2.2. Link history per channel With URL-rewrite Without URL-rewrite http://base.url/chan-$C-$N http://base.url/chan.pl?chan=$C&n=$N http://base.url/chan-$C-$N-$S http://base.url/chan.pl?chan=$C&n=$N&seek=$S Where $C is channel number, $N is number of links to show, and $S is number of links to skip. 3.2.3. Channel statistics With URL-rewrite Without URL-rewrite http://base.url/chanstat-$C http://base.url/chanstat.pl?chan=$C Where $C is channel number. 3.2.4. User summary With URL-rewrite Without url-rewrite http://base.url/user-$N http://base.url/user.pl&user=$N http://base.url/$U http://base.url/go.pl&s=$U Where $N is user number and $U is user nickname. 3.2.5. Statistics generator http://base.url/stat.pl?chan=$C&str=$S&min_a=$L&max_a=$U Where $C is channel name or number, $S is string to search, $L is link minimum age in days, and $U is link maximum age in days. 3.2.6. Sanity check http://base.url/sanity.pl 3.3. Atom Syndication wanha is also capable to offer latest links as Atom feed! 4. Installation 4.1. Database and configuration 1. Create username and database for wanha. 2. Set up the database by running commands in file "sql". 3. Edit "Wanha/Config.pm" and fill in database host address, database name, database user name, and database password. 4. Edit IRC-related configuration in "Wanha/Config.pm". 5. If you intend to use the web-interface, you can set "rewrite" option to "1" in "Wanha/Config.pm" if you have mod_rewrite enabled on the HTTP-server. 4.2. The bot 1. Copy wanha.pl and Wanha-directory to where you intend to run the bot. 4.3. The web-interface 1. Copy *.pl except wanha.pl and Wanha-directory to the target. 2. Copy htaccess to the target (as .htaccess) and edit "RewriteBase" rule if you need to. Set the file permissions to 644. 3. Configure your HTTP-server to allow executing the script. You may want to set the server to use chan.pl as index-page. 5. Running the bot Just run "wanha.pl". Putting it to background is recommended. When bot is no longer wanted on the channel, sending SIGINT or SIGTERM will quit the bot from IRC and exit the process. 6. Interacting with the bot While the bot should work entirely independent, it also recognizes some commands issued over IRC. wanha recognizes limited set of commands when talked to. All commands issued must begin with the bot's nick, followed by a space, comma, or colon (e.g. "wanha scores", "wanha, scores", or "wanha: scores"). This applies even when talking privately with the bot. 6.1. Normal interaction 6.1.1. scores The bot will print top-5 and bottom-5 for the channel. Usage: wanha, scores 6.1.2. quiet, stfu If user cannot handle constructive feedback, he can request the bot not to talk to him. This means the bot will not instruct user not to paste old links and not to mention his name when someone else pastes an old link. This command can reversed with "verbose". Usage: wanha, quiet 6.1.3. verbose, speak This command makes the bot talk to user again. Also see "quiet". Usage: wanha, verbose 6.2. Special markers for URLs 6.2.1. w:, w! This prefix can be used when pasting URLs that are known to have been seen. If the bot has not seen the URL yet, user will be awarded a cheat-score, and an announcement is made. Usage: w: http://www.google.com/intl/en/ Usage: w! http://www.google.com/intl/en/ w: http://katei.fi/wanha/ 6.3. Maintenance 6.3.1. learn: The bot can be taught URLs that it missed for some reason. Usage: wanha, learn PASSWORD: #CHANNEL DATA where #CHANNEL is the channel where the message was originally written DATA is the message line. The line is assumed to be as follows: "Year Mon DD HH:MM:SS message". PASSWORD must match password give in Wanha/Config.pl. 7. Improvements and errors If you find this documentation insufficient, erroneous, or have improvement suggestions, please let me know. Feedback, bugfixes, and such for the scripts are also warmyl welcomed. 8. Contact Tommi Saviranta For up to date information see http://wnd.katei.fi/contact.html