slitaz-forge annotate irc/src/org/jibble/logbot/LogBotMain.java @ rev 230

Add search.sh used on pkgs.slitaz.org
author Christophe Lincoln <pankso@slitaz.org>
date Thu Apr 05 18:29:07 2012 +0200 (2012-04-05)
parents
children efd18dbda796
rev   line source
slaxemulator@91 1 package org.jibble.logbot;
slaxemulator@91 2
slaxemulator@91 3 import java.io.*;
slaxemulator@91 4 import java.util.*;
slaxemulator@91 5
slaxemulator@91 6 public class LogBotMain {
slaxemulator@91 7
slaxemulator@91 8 public static void main(String[] args) throws Exception {
slaxemulator@91 9
slaxemulator@91 10 Properties p = new Properties();
slaxemulator@91 11 p.load(new FileInputStream(new File("./config.ini")));
slaxemulator@91 12
slaxemulator@91 13 String server = p.getProperty("Server", "localhost");
slaxemulator@91 14 String channel = p.getProperty("Channel", "#test");
slaxemulator@91 15 String nick = p.getProperty("Nick", "LogBot");
slaxemulator@91 16 String joinMessage = p.getProperty("JoinMessage", "This channel is logged.");
slaxemulator@91 17
slaxemulator@91 18 File outDir = new File(p.getProperty("OutputDir", "./output/"));
slaxemulator@91 19 outDir.mkdirs();
slaxemulator@91 20 if (!outDir.isDirectory()) {
slaxemulator@91 21 System.out.println("Cannot make output directory (" + outDir + ")");
slaxemulator@91 22 System.exit(1);
slaxemulator@91 23 }
slaxemulator@91 24
slaxemulator@91 25 LogBot.copy(new File("html/style.css"), new File(outDir, "style.css"));
slaxemulator@91 26 LogBot.copy(new File("html/index.php"), new File(outDir, "index.php"));
slaxemulator@91 27
slaxemulator@91 28 BufferedWriter writer = new BufferedWriter(new FileWriter(new File(outDir, "config.inc.php")));
slaxemulator@91 29 writer.write("<?php");
slaxemulator@91 30 writer.newLine();
slaxemulator@91 31 writer.write(" $server = \"" + server + "\";");
slaxemulator@91 32 writer.newLine();
slaxemulator@91 33 writer.write(" $channel = \"" + channel + "\";");
slaxemulator@91 34 writer.newLine();
slaxemulator@91 35 writer.write(" $nick = \"" + nick + "\";");
slaxemulator@91 36 writer.newLine();
slaxemulator@91 37 writer.write("?>");
slaxemulator@91 38 writer.flush();
slaxemulator@91 39 writer.close();
slaxemulator@91 40
slaxemulator@91 41 LogBot bot = new LogBot(nick, outDir, joinMessage);
slaxemulator@91 42 bot.connect(server);
slaxemulator@91 43 bot.joinChannel(channel);
slaxemulator@91 44 }
slaxemulator@91 45
slaxemulator@91 46 }