All pastes #443528 Raw Edit

Stuff

public java v1 · immutable
·published 2007-04-16 21:17 UTC
rendered paste body
-- In UserManager.java :	public void exec(final String channel, final String sender,			final String login, final String hostname, final String message) throws SQLException {		if (message.startsWith("!adduser ")) {			final int userLevel = DataBaseManager.getUserLevel(hostname);			if (1000 <= userLevel) {				String[] args = message.split("\\s+");				final String username = args[1];				final int level = Integer.parseInt(args[2]);				String uhostname = Bot.getUserHost(username, level);				_bot.sendNotice(sender, "User " + username + " added to database with level" + level + ".");			}		}	}-- In Bot.Java :	static HashMap whoisRef = new HashMap();	public void getUserHost(final String userName, int level) {		whoisRef.put(userName.toLowerCase(), null);		sendRawLine("WHOIS "+ userName);	}	public void onServerResponse(int code, String response) {		if(code == RPL_WHOISUSER) {			String parts[] = response.split(" ");			String userName = parts[1].toLowerCase();			if(whoisRef.containsKey(userName)) {  // nick				whoisRef.remove(userName);				int level = whoisRef.get(userName);				DataBaseManager.addUser(userName, parts[3], level);				whoisRef.remove(userName);			}		}	}