diff options
Diffstat (limited to 'src/org/jogamp/jabot/irc/CatOut.java')
-rw-r--r-- | src/org/jogamp/jabot/irc/CatOut.java | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/org/jogamp/jabot/irc/CatOut.java b/src/org/jogamp/jabot/irc/CatOut.java index 85fac42..07e4ae5 100644 --- a/src/org/jogamp/jabot/irc/CatOut.java +++ b/src/org/jogamp/jabot/irc/CatOut.java @@ -38,7 +38,7 @@ public class CatOut extends PircBot { public static void main(String[] args) throws Exception { final String joinMessage; final boolean showHostname = false; - final String login, name, server, channelNoHash; + final String login, nick, nickPwd, server, channelNoHash; final boolean verbose; final long logrotate, logrotateStart; final String logprefix, urlprefix; @@ -46,7 +46,7 @@ public class CatOut extends PircBot { final File htmlHeader, htmlFooter; { String _joinMessage = "This channel is logged"; - String _login=null, _name=null, _server=null, _channelNoHash=null; + String _login=null, _nick=null, _nickPwd=null, _server=null, _channelNoHash=null; boolean _verbose=false; long _logrotate = 0, _logrotateStart=System.currentTimeMillis(); String _logprefix="", _urlprefix=""; @@ -59,9 +59,12 @@ public class CatOut extends PircBot { } else if(args[i].equals("-login")) { i++; _login = args[i]; - } else if(args[i].equals("-name")) { + } else if( args[i].equals("-name") || args[i].equals("-nick") ) { i++; - _name = args[i]; + _nick = args[i]; + } else if( args[i].equals("-nickpwd") ) { + i++; + _nickPwd = args[i]; } else if(args[i].equals("-server")) { i++; _server = args[i]; @@ -106,15 +109,15 @@ public class CatOut extends PircBot { } } if( null == _login || - null == _name || + null == _nick || null == _server || null == _channelNoHash || ( _htmlOut && null == _htmlHeader || null == _htmlFooter ) ) { - System.err.println("Incomplete commandline, use "+CatOut.class.getName()+" -login VAL -name VAL -server VAL -channel VAL [-verbose] [-joinMessage VAL] [-htmlHeader VAL -htmlFooter VAL] [-logrotate millis [-logrotateStart hhmm] [-logprefix VAL] [-urlprefix VAL]]"); + System.err.println("Incomplete commandline, use "+CatOut.class.getName()+" -login VAL -nick VAL -server VAL -channel VAL [-verbose] [-joinMessage VAL] [-htmlHeader VAL -htmlFooter VAL] [-logrotate millis [-logrotateStart hhmm] [-logprefix VAL] [-urlprefix VAL]]"); return; } joinMessage = _joinMessage; - login=_login; name=_name; + login=_login; nick=_nick; nickPwd=_nickPwd; server=_server; channelNoHash=_channelNoHash; verbose=_verbose; logrotate = _logrotate; @@ -144,7 +147,8 @@ public class CatOut extends PircBot { final LogBot bot = new LogBot(showHostname, joinMessage, htmlOut); bot.setVerbose(verbose); - bot.setLoginAndName(login, name); + bot.setLoginAndNick(login, nick); + LogStream logOut; if ( 0 < logrotate ) { logOut = new LogStream(bot, logprefix, urlprefix, server, channelNoHash, htmlHeader); @@ -154,6 +158,13 @@ public class CatOut extends PircBot { } else { logOut = null; } + if( null != nickPwd && nickPwd.length() > 0 ) { + bot.setPostConnectAction(new Runnable() { + public void run() { + bot.identify(nickPwd); + } + }); + } bot.connect(server); bot.joinChannel(HASH+channelNoHash); if( 0 < logrotate ) { |