|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcommon.User
messageServerP.ManagedUser
public class ManagedUser
A representation of a user managed by the Message Server. Any affection of a user data is backupped on the main backupper.
Field Summary | |
---|---|
private boolean |
blocked
|
private int |
downloadedMessages
|
private ContactList |
list
|
private java.util.Vector<Message> |
msgsQueue
|
private java.lang.String |
password
|
private static long |
serialVersionUID
|
Constructor Summary | |
---|---|
ManagedUser(java.lang.String nick,
java.net.InetAddress ip,
int port,
java.lang.String password)
Creates a Managed User. |
Method Summary | |
---|---|
void |
addFriend(User user)
Adds a friend to the incoming contact list of this user. |
void |
addMsgToQueue(Message ms)
Adds a message to the incoming queue of the user |
void |
block(boolean blocked)
Blocks the user to not let it perform any action. |
void |
blockFriend(User user)
Sets a contact as blocked (no more messages by this user are accepted). |
boolean |
changePassword(java.lang.String oldPw,
java.lang.String newPw)
Changes this user password. |
boolean |
checkPassword(java.lang.String pw)
Checks the password |
ManagedUser |
clone()
|
User |
copyContactTo(User user)
Copies IP and port of this user to the user passed by argument. |
void |
deleteDownloadedQueue()
Deletes the already downloaded messages. |
boolean |
equals(ManagedUser us2)
Tests if a user given as argument has the same nickname of this one. |
ContactList |
getContactList()
Gets the user's Contact List. |
java.util.Vector<Message> |
getQueue()
Returns the messagges in the queue and marks it as downloaded, ready to be deleted. |
boolean |
isBlocked()
Check if a user can perform any action. |
boolean |
isFriendOf(User user)
Checks if a user given by argument accepts messages from this managed user. |
void |
refreshBackup()
Refreshes the main backup updating it with the state of this user. |
void |
removeContact(User user)
Removes a user from this user contact list. |
Methods inherited from class common.User |
---|
compareTo, equals, getConn, getIP, getNick, getPort, isFriend, isOnline, setConn, setFriend, setIp, setName, setOnline, setPort |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private java.lang.String password
private boolean blocked
private java.util.Vector<Message> msgsQueue
private int downloadedMessages
private ContactList list
Constructor Detail |
---|
public ManagedUser(java.lang.String nick, java.net.InetAddress ip, int port, java.lang.String password)
password
- the managed user password.nick
- the user nickname.ip
- the user ip address.port
- the user port.Method Detail |
---|
public boolean checkPassword(java.lang.String pw)
pw
- the password to check
public void addMsgToQueue(Message ms)
ms
- the message to addpublic java.util.Vector<Message> getQueue()
public void deleteDownloadedQueue()
public boolean isBlocked()
public void block(boolean blocked)
blocked
- true if the user must be set to blocked, false otherwise.public void addFriend(User user) throws UserAlreadyInsertedException
user
- the user to add
UserAlreadyInsertedException
public void blockFriend(User user)
user
- the user to blockpublic void removeContact(User user)
user
- the user to remove.public boolean isFriendOf(User user)
user
- the user.
public boolean changePassword(java.lang.String oldPw, java.lang.String newPw)
oldPw
- the old password.newPw
- the new password.
public ContactList getContactList()
public User copyContactTo(User user)
user
- the user to copy the IP and port to.
public void refreshBackup()
public boolean equals(ManagedUser us2)
us2
- the user whose nickname must be checked.
public ManagedUser clone()
clone
in class User
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |