swpchat.server
Class FriendsCollection
java.lang.Object
|
+--swpchat.server.FriendsCollection
- public class FriendsCollection
- extends java.lang.Object
FriendsCollection manages lists of nicks, who want to be notified of
state-changes of others, that is join, leave, online, offline,.. .
It also manages lists of channels where a user is member in.
- Since:
- 31.1.2000
- Author:
- David Kensche, Dirk Hesse
Field Summary |
private static java.util.HashMap |
nickMap
|
Method Summary |
static void |
addChannel(java.lang.String nick,
java.lang.String channel)
Add a channel to the list of 'nick'. |
static void |
addFriend(java.lang.String nick,
java.lang.String friend)
Add a friend to the list of 'nick'. |
static boolean |
containsNick(java.lang.String nick)
Just whether a user has friends OR has joined channels yet. |
static java.util.Iterator |
getChannels(java.lang.String nick)
Get list of channels joined by 'nick' up to now. |
static java.util.Iterator |
getFriends(java.lang.String nick)
Get list of users who want to be notified of 'nick's state-changes. |
static void |
removeChannel(java.lang.String nick,
java.lang.String channel)
Remove a channel from the list of 'nick'. |
static void |
removeFriend(java.lang.String nick,
java.lang.String friend)
Remove a friend from the list of 'nick'. |
static void |
setNick(java.lang.String oldNick,
java.lang.String newNick)
Changes the name of a user in this list, user's friends are now
the people who wanted to be notified of 'newNick' whereas
the channels joined up to now. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
nickMap
private static java.util.HashMap nickMap
FriendsCollection
public FriendsCollection()
addFriend
public static void addFriend(java.lang.String nick,
java.lang.String friend)
- Add a friend to the list of 'nick'.
- Parameters:
nick
- String
specifying the nick of the user
who got a new friend.friend
- String
specifying the nick of the new
friend.
removeFriend
public static void removeFriend(java.lang.String nick,
java.lang.String friend)
- Remove a friend from the list of 'nick'.
- Parameters:
nick
- String
specifying the nick of the user
who doesn't want to be notified anymore of state-changes of
'friend'..friend
- String
specifying the nick of the user,
who used to be a friend.
addChannel
public static void addChannel(java.lang.String nick,
java.lang.String channel)
- Add a channel to the list of 'nick'.
- Parameters:
nick
- String
specifying the user who joined a
channel.channel
- String
specifying the channel joined.
removeChannel
public static void removeChannel(java.lang.String nick,
java.lang.String channel)
- Remove a channel from the list of 'nick'.
- Parameters:
nick
- String
specifying the user who left a
channel.friend
- String
specifying the channel left.
getFriends
public static java.util.Iterator getFriends(java.lang.String nick)
- Get list of users who want to be notified of 'nick's state-changes.
- Parameters:
nick
- String
specifying the user whose
information is requested.- Returns:
Iterator
containing a list of
String
s specifying users who
requested to be notified.
getChannels
public static java.util.Iterator getChannels(java.lang.String nick)
- Get list of channels joined by 'nick' up to now.
- Parameters:
nick
- String
specifying the user whose
information is requested.- Returns:
Iterator
containing a list of
String
s specifying the channels
joined.
setNick
public static void setNick(java.lang.String oldNick,
java.lang.String newNick)
- Changes the name of a user in this list, user's friends are now
the people who wanted to be notified of 'newNick' whereas
the channels joined up to now.
- Parameters:
oldNick
- String
specifying the old nickname.newNick
- String
specifying the new nickname.
containsNick
public static boolean containsNick(java.lang.String nick)
- Just whether a user has friends OR has joined channels yet.
- Returns:
- true, iff any information about friends or channels is
stored, else false.