summaryrefslogtreecommitdiffstats
path: root/EssentialsUpdate/src/f00f/net/irc/martyr/replies/WhoisIdleReply.java
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsUpdate/src/f00f/net/irc/martyr/replies/WhoisIdleReply.java')
-rw-r--r--EssentialsUpdate/src/f00f/net/irc/martyr/replies/WhoisIdleReply.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/replies/WhoisIdleReply.java b/EssentialsUpdate/src/f00f/net/irc/martyr/replies/WhoisIdleReply.java
new file mode 100644
index 000000000..aba98205d
--- /dev/null
+++ b/EssentialsUpdate/src/f00f/net/irc/martyr/replies/WhoisIdleReply.java
@@ -0,0 +1,68 @@
+package f00f.net.irc.martyr.replies;
+
+import f00f.net.irc.martyr.InCommand;
+import f00f.net.irc.martyr.util.ParameterIterator;
+import java.util.Date;
+
+//import org.apache.log4j.Logger;
+
+public class WhoisIdleReply extends AbstractWhoisReply
+{
+ //static Logger log = Logger.getLogger(WhoisIdleReply.class);
+
+ private int idleTime;
+ private Date loginTime;
+
+ /**
+ * Factory constructor.
+ * */
+ public WhoisIdleReply()
+ {
+ }
+
+ public WhoisIdleReply( String params )
+ {
+ super( params );
+ }
+
+ public String getIrcIdentifier()
+ {
+ return "317";
+ }
+
+ /**
+ * @return seconds idle
+ * */
+ public int getIdleTime()
+ {
+ return idleTime;
+ }
+
+ /**
+ * @return login time, if provided, null otherwise
+ * */
+ public Date getLoginTime()
+ {
+ return loginTime;
+ }
+
+ protected void parseParams( ParameterIterator pi )
+ {
+ String idleTimeStr = (String)pi.next(); // Idle name
+ idleTime = Integer.parseInt( idleTimeStr );
+ if( pi.hasNext() && ! pi.nextIsLast() )
+ {
+ String loginTimeStr = (String)pi.next(); // Idle description
+ loginTime = new Date( Long.parseLong( loginTimeStr ) * 1000 );
+ }
+ //log.debug("WhoisIdleReply: idle: " + idleTime);
+ //log.debug("WhoisIdleReply: login: " + loginTime);
+ }
+
+ public InCommand parse( String prefix, String identifier, String params )
+ {
+ return new WhoisIdleReply( params );
+ }
+
+}
+