Commit f59a19b2 authored by Luke081515's avatar Luke081515

Create readoutWhois

Summary:
* Analyses the whois of a user
* Author is Morten Haan
Ref T757

Reviewers: O1 Luke081515Bot, Luke

Reviewed By: O1 Luke081515Bot, Luke

Maniphest Tasks: T757

Differential Revision: https://rcm-2.wmflabs.org/D392
parent e046bd9c
class readoutWhois {
private Hashtable<String, String[]> lines;
public readoutWhois(String whois) { // constructor
String[] _lines = whois.split("\\n");
lines = new Hashtable<String, String[]>(_lines.length());
for (int i = 0; i++; i < _lines.length()) {
String[] line = _lines[i].split(" ");
lines.put(line[2], line);
}
}
public long secondsIdle() { // idle time of the user in seconds
if (!lines.containsKey("317")) return 0;
String[] line = lines.get("317");
return (long) line[5];
}
public String loggedInAs() { // log in name of the user, otherwise ""
if (!lines.containsKey("330")) return "";
String[] line = lines.get("330");
return line[5];
}
public boolean isLoggedIn() { // Is the User logged in?
return lines.containsKey("330");
}
public boolean isAway() { // Is the user away?
return lines.containsKey("301");
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment