public String nickComplete(String pnick, String channel) {
		if (getChannel(channel) == null) {
			return pnick;
		}

		Set users = getChannel(channel).getAllUsers();

		if (isUser(pnick) && users.contains(getUser(pnick))) {
			return pnick;
		}

		String possible = null;

		Iterator i = users.iterator();
		while (i.hasNext()) {
			User temp = (User) i.next();
			if (temp.getNick().length() >= pnick.length()) {
				if (temp.getNick().toLowerCase().substring(0, pnick.length()).equals(pnick.toLowerCase())) {
					return temp.getNick();
				}

				if (temp.getNick().toLowerCase().indexOf(pnick.toLowerCase()) > -1 && (!temp.getNick().toLowerCase().equals(getMyNick().toLowerCase()))) {
					possible = temp.getNick();
				}
			}
		}

		if (possible != null) {
			return possible;
		}

		return pnick;
	}