!752
!1002672 // pircbot library

import org.jibble.pircbot.*;

static S server = "irc.freenode.net";
static S channel = "##linux";
static S name = "Cumulate";

p {
  new MyBot bot;
  bot.setVerbose(true);
  bot.connect(server);
  bot.joinChannel(channel);
}

static class MyBot extends PircBot {
  MyBot() {
    setName(name);
    setAutoNickChange(true);
  }
  
  public void onMessage(String channel, String sender,
                        String login, String hostname, String message) {
    logMap(channel + ".log", litmap("type", "public", "channel", channel, "sender", sender, "login", login, "hostname", hostname, "msg", message);
  }
  
  public void onPrivateMessage(String sender,
                               String login,
                               String hostname,
                               String message) {
    logMap(channel + ".log", litmap("type", "private", "sender", sender, "login", login, "hostname", hostname, "msg", message);
 }
 
  public void onNotice(String sourceNick,
                        String sourceLogin,
                        String sourceHostname,
                        String target,
                        String notice) {
    logMap(channel + ".log", litmap("type", "notice", "sourceNick", sourceNick, "sourceLogin", sourceLogin, "sourceHostname", sourceHostname, "target", target, "notice", notice);
 }
}