diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/openslx/satserver/util/IrcClient.java | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/src/main/java/org/openslx/satserver/util/IrcClient.java b/src/main/java/org/openslx/satserver/util/IrcClient.java index 4f0c290..89c0b9b 100644 --- a/src/main/java/org/openslx/satserver/util/IrcClient.java +++ b/src/main/java/org/openslx/satserver/util/IrcClient.java @@ -108,8 +108,33 @@ public class IrcClient }; } wrapper = new Wrapper( serverAddress ); + final String finalHorst = host; IRCConfig config = IRCConfigBuilder.newBuilder().autoPong( true ).encoding( "UTF-8" ).host( host ) - .port( port ).nick( nick ).timeout( 70000 ).exceptionHandler( wrapper ).trafficLogger( IRCTrafficLogger.SYSTEM_OUT ) + .port( port ).nick( nick ).timeout( 70000 ).exceptionHandler( wrapper ).trafficLogger( new IRCTrafficLogger() { + private long deadline = System.currentTimeMillis() + 30_000; + @Override + public void out( String line ) + { + if ( deadline == 0 ) + return; + if ( deadline > System.currentTimeMillis() ) { + LOGGER.info( "< [" + finalHorst + "] " + line ); + } else { + deadline = 0; + } + } + @Override + public void in( String line ) + { + if ( deadline == 0 ) + return; + if ( deadline > System.currentTimeMillis() ) { + LOGGER.info( "> [" + finalHorst + "] " + line ); + } else { + deadline = 0; + } + } + } ) .sslSupport( sslSupport ).build(); IRCConnection connection = IRCConnectionFactory.newConnection( config ); wrapper.setConnection( connection ); @@ -213,22 +238,16 @@ public class IrcClient @Override public void onError( String msg ) { - // TODO Auto-generated method stub - } @Override public void onError( int num, String msg ) { - // TODO Auto-generated method stub - } @Override public void onInvite( String chan, IRCUser user, String passiveNick ) { - // TODO Auto-generated method stub - } @Override @@ -252,29 +271,21 @@ public class IrcClient @Override public void onMode( String chan, IRCUser user, IRCModeParser modeParser ) { - // TODO Auto-generated method stub - } @Override public void onMode( IRCUser user, String passiveNick, String mode ) { - // TODO Auto-generated method stub - } @Override public void onNick( IRCUser user, String newNick ) { - // TODO Auto-generated method stub - } @Override public void onNotice( String target, IRCUser user, String msg ) { - // TODO Auto-generated method stub - } @Override @@ -289,43 +300,31 @@ public class IrcClient @Override public void onPing( String ping ) { - // TODO Auto-generated method stub - } @Override public void onPrivmsg( String target, IRCUser user, String msg ) { - // TODO Auto-generated method stub - } @Override public void onQuit( IRCUser user, String msg ) { - // TODO Auto-generated method stub - } @Override public void onReply( int num, String value, String msg ) { - // TODO Auto-generated method stub - } @Override public void onTopic( String chan, IRCUser user, String topic ) { - // TODO Auto-generated method stub - } @Override public void unknown( String prefix, String command, String middle, String trailing ) { - // TODO Auto-generated method stub - } } |