org.elite.jdcbot.framework
Class UserManager

java.lang.Object
  extended by org.elite.jdcbot.framework.UserManager

public class UserManager
extends java.lang.Object

An user menager class.

This class holds all data about all users present on the hub like description, e-mail... You shoudn't use this class directly, idea is to have only ine instance and that one is in jDCBot class. You should rather add methods in jDCBot (example is GetRandomUser in jDCBot class)

Since:
0.6
Version:
0.7.1
Author:
Kokanovic Branko, AppleGrew

Nested Class Summary
private  class UserManager.SendingAll
           
 
Field Summary
private  jDCBot _bot
           
private  java.util.Vector<User> users
           
 
Constructor Summary
UserManager(jDCBot bot)
           
 
Method Summary
 void addOps(java.lang.String user_list)
          Sets the users (including the bot) in the list as operators.
 void addUsers(java.lang.String user_list)
          Add all users from the user list (user nick are delimited with '$$')
Note: When this methos is called then all pre-existing users will be lost.
 User[] getAllUsers()
           
 User getRandomUser()
          Gets random user from the hub
 User getUser(java.lang.String user)
          Gets everything about user.
private  java.util.ArrayList<java.lang.String> parseDoubleDollarList(java.lang.String list)
          Parses double dollar delimited list.
 void SendAll(java.lang.String pm, long timeout)
          Sends message to all user on the hub
 void SetInfo(java.lang.String info)
          Sets user info (description, e-mail...)
 void updateUserIPs(java.lang.String list)
           
 boolean userExist(java.lang.String user)
           
 void userJoin(java.lang.String user)
          Add user to our list since user joined hub
 void userQuit(java.lang.String user)
          Throw out user from our list since he quited
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

users

private java.util.Vector<User> users

_bot

private jDCBot _bot
Constructor Detail

UserManager

public UserManager(jDCBot bot)
Method Detail

addUsers

public void addUsers(java.lang.String user_list)
Add all users from the user list (user nick are delimited with '$$')
Note: When this methos is called then all pre-existing users will be lost.

Parameters:
user_list - List of all users delimited with '$$'

updateUserIPs

public void updateUserIPs(java.lang.String list)

addOps

public void addOps(java.lang.String user_list)
Sets the users (including the bot) in the list as operators. If the user is not in the internal data structure then it is automatically added.

Parameters:
user_list -

parseDoubleDollarList

private java.util.ArrayList<java.lang.String> parseDoubleDollarList(java.lang.String list)
Parses double dollar delimited list. e.g. username1$$username2$$username3...

Parameters:
list - The list (only).
Returns:

userQuit

public void userQuit(java.lang.String user)
Throw out user from our list since he quited

Parameters:
user - Nick of the user who quited

userJoin

public void userJoin(java.lang.String user)
Add user to our list since user joined hub

Parameters:
user - Nick of the user who joined

userExist

public boolean userExist(java.lang.String user)
Parameters:
user - Nick of the user to find out is he on the hub
Returns:
true if user is n the hub, false otherwise

getUser

public User getUser(java.lang.String user)
Gets everything about user.

Parameters:
user - Nick of the user
Returns:
User class if user exist, null otherwise

getRandomUser

public User getRandomUser()
Gets random user from the hub

Returns:
Random user

getAllUsers

public User[] getAllUsers()

SetInfo

public void SetInfo(java.lang.String info)
Sets user info (description, e-mail...)

Parameters:
info - Info from the user that will be parsed

SendAll

public void SendAll(java.lang.String pm,
                    long timeout)
Sends message to all user on the hub

Parameters:
pm - Message to be sent
timeout - Timeout inteval in milliseconds between to private messages