|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.wilko.jaim.JaimConnection
The JaimConnection object is the primary interface into the Jaim library.
Programs should instantiate a JaimConnection (in most cases the simple constructor should be used).
Once JaimConnection has been instantiated, call connect()
followed by logIn(java.lang.String, java.lang.String, int)
.
Constructor Summary | |
JaimConnection()
Creates new JaimConnection that connects to the default host and port. |
|
JaimConnection(java.lang.String host,
int port)
Creates a new Jaim Connection to the specified host/port. |
Method Summary | |
void |
addBlock(java.lang.String buddy)
Adds the specified buddy to your block list. |
void |
addBuddy(java.lang.String buddy)
Deprecated. the watchBuddy(java.lang.String) method should be used instead |
Buddy |
addBuddy(java.lang.String buddyName,
java.lang.String groupName)
Add a buddy to a group. |
Buddy |
addBuddy(java.lang.String buddyName,
java.lang.String groupName,
int pos)
Add a buddy to a group. |
void |
addEventListener(JaimEventListener l)
Add an EventListener object. |
void |
addPermit(java.lang.String buddy)
Adds the specified buddy to your permit list. |
void |
connect()
Initiate a connection to the TOC server |
void |
deleteBuddy(java.lang.String buddy)
Deprecated. use unwatchBuddy(java.lang.String) instead |
void |
disconnect()
Disconnect from the TOC server |
protected void |
Dispatch(FLAPFrame fr)
|
Group |
getGroupBy(java.lang.String name)
Return a group, given its name |
java.util.Collection |
getGroups()
Return the set of groups that have been stored in the TOC server The information returned from this method is only valid if isConfigValid() returns true |
void |
getInfo(java.lang.String username)
Get the information for the specified user |
long |
getInterMessageDelay()
Deprecated. This function is no longer used |
java.lang.String |
getNickName()
Get the formatted Nick Name for this connection. |
java.io.InputStream |
getURL(java.lang.String file)
Get an Input stream associated with a URL returned by the "GOTO_URL" toc response |
protected void |
HandleTocResponse(TocResponse tr)
|
boolean |
isConfigValid()
Indicate whether configuration information has been received from the TOC server. |
boolean |
isLoginComplete()
Check if the TOC login process has completed |
void |
logIn(java.lang.String username,
java.lang.String password,
int waitTime)
login to the TOC server. |
void |
logOut()
Log out from the TOC server |
void |
removeEventListener(JaimEventListener l)
Remove an EventListener object. |
void |
run()
The run method for the dispatcher thread |
void |
saveConfig()
Save group/buddy list configuration to the TOC server |
void |
sendEvil(java.lang.String buddy,
boolean anonymous)
Send a warning or "Evil" to another user. |
void |
sendIM(java.lang.String recipient,
java.lang.String msg)
Send an instant message |
void |
sendIM(java.lang.String recipient,
java.lang.String msg,
boolean auto)
Send an instant message |
void |
setAway(java.lang.String awayMsg)
Set the information for the logged in user |
void |
setDebug(boolean debug)
Enable/Disable debugging messages to stdout |
void |
setEventListener(JaimEventListener l)
Deprecated. replaced by addEventListener(com.wilko.jaim.JaimEventListener) |
void |
setIdle(int idleSecs)
Set the idle time for this user |
void |
setInfo(java.lang.String information)
Set the information for the logged in user |
void |
setInterMessageDelay(long msec)
Deprecated. This function is no longer used - send throttling is automatic |
void |
unwatchBuddy(java.lang.String buddy)
Delete a buddy from the buddy watch list. |
void |
watchBuddy(java.lang.String buddy)
Add a buddy to the watch list for this connection. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JaimConnection()
public JaimConnection(java.lang.String host, int port)
host
- The hostname or IP address of the TOC serverport
- The port number to connect to on the hostMethod Detail |
public void setDebug(boolean debug)
debug
- true if debugging messages should be outputpublic void setInterMessageDelay(long msec)
sendIM(java.lang.String, java.lang.String)
method will ensure that at least this amount of time has elapsed between messages
msec
- The delay period in millisecondspublic long getInterMessageDelay()
public void setEventListener(JaimEventListener l) throws java.util.TooManyListenersException
addEventListener(com.wilko.jaim.JaimEventListener)
l
- The listener class to be notified
java.util.TooManyListenersException
public void addEventListener(JaimEventListener l)
l
- The listener class to be notifiedpublic void removeEventListener(JaimEventListener l)
l
- The listener class to be removedpublic void connect() throws java.io.IOException
java.io.IOException
- If an underlying network communication failspublic void disconnect() throws java.io.IOException
java.io.IOException
- if a network transport error occurspublic boolean isLoginComplete()
public void logOut()
public java.lang.String getNickName()
public void logIn(java.lang.String username, java.lang.String password, int waitTime) throws JaimException, java.io.IOException
connect()
method should be called first
username
- The username to log in withpassword
- the password for the specified usernamewaitTime
- time in milliseconds for successful login before declaring an error
java.io.IOException
- If a network error occurs
JaimException
- If a login failure occurs or login fails to complete before waittime expirespublic void run()
run
in interface java.lang.Runnable
protected void Dispatch(FLAPFrame fr)
protected void HandleTocResponse(TocResponse tr)
public void sendIM(java.lang.String recipient, java.lang.String msg) throws java.io.IOException
recipient
- The nickname of the message recipientmsg
- The message to send
java.io.IOException
- if a network error occurspublic void sendIM(java.lang.String recipient, java.lang.String msg, boolean auto) throws java.io.IOException
recipient
- The nickname of the message recipientmsg
- The message to sendauto
- true if this is an automatic response (eg. away message)
java.io.IOException
- if a network error occurspublic Buddy addBuddy(java.lang.String buddyName, java.lang.String groupName, int pos)
saveConfig()
buddyName
- The normalised buddy name to addgroupName
- The name of the group to add this buddy topos
- the position in the group at which to add the buddy.
Buddy
object that represents the specified buddy name.public Buddy addBuddy(java.lang.String buddyName, java.lang.String groupName)
saveConfig()
The buddy is added to the end of the group
buddyName
- The normalised buddy name to addgroupName
- The name of the group to add this buddy to
Buddy
object that represents the specified buddy name.public void addBuddy(java.lang.String buddy) throws JaimException
watchBuddy(java.lang.String)
method should be used instead
connect()
It also appears that the login process will not complete unless at least one buddy is added to the watch list
buddy
- The nickname to add to the watch list
JaimException
- if the method is called at the wrong timeJaimEventListener
public void watchBuddy(java.lang.String buddy) throws JaimException
connect()
It also appears that the login process will not complete unless at least one buddy is added to the watch list
buddy
- The nickname to add to the watch list
JaimException
- if the method is called at the wrong timeJaimEventListener
public void saveConfig() throws java.io.IOException
java.io.IOException
- if a network error occurspublic java.util.Collection getGroups()
isConfigValid()
returns true
Group
Objectspublic Group getGroupBy(java.lang.String name)
Group
Object corresponding to the string namepublic boolean isConfigValid()
getGroups()
is valid
public void sendEvil(java.lang.String buddy, boolean anonymous) throws java.io.IOException
buddy
- The nickname of the buddy to warnanonymous
- true if the warning should be sent anonymously
java.io.IOException
- if a network error occurspublic void setInfo(java.lang.String information) throws java.io.IOException
information
- The information for this user (May contain HTML)
java.io.IOException
- if a network error occurspublic void getInfo(java.lang.String username) throws java.io.IOException
username
- The screenname for whom info is requested (May contain HTML)
java.io.IOException
- if a network error occurspublic java.io.InputStream getURL(java.lang.String file) throws java.io.IOException, java.net.MalformedURLException
file
- The "file" returned by calling GotoTocResponse#getURL
java.io.IOException
- if an IO error occurs
java.net.MalformedURLException
- if there is an error building the URLpublic void setAway(java.lang.String awayMsg) throws java.io.IOException
awayMsg
- The away message for this user. May contain HTML. To cancel "away" status set the awayMsg to ""
java.io.IOException
- if a network error occurspublic void addPermit(java.lang.String buddy) throws JaimException
buddy
- The buddy to add to your block list. If this is an empty string, mode is changed to "permit none"
JaimException
- if a network error occurspublic void addBlock(java.lang.String buddy) throws JaimException
buddy
- The buddy to add to your block list. If this is an empty string, mode is changed to "deny none"
JaimException
- if a network error occurspublic void setIdle(int idleSecs) throws java.io.IOException
idleSecs
- The number of seconds the user has been idle for. Set to 0 to indicate current activity. The server will increment the idle time if non-zero
java.io.IOException
- if a network error occurspublic void deleteBuddy(java.lang.String buddy)
unwatchBuddy(java.lang.String)
instead
addBuddy(java.lang.String, java.lang.String, int)
first.
The buddy list can only be modified after connect()
is called.
buddy
- The buddy name to be deleted\public void unwatchBuddy(java.lang.String buddy)
addBuddy(java.lang.String, java.lang.String, int)
first.
The buddy list can only be modified after connect()
is called.
buddy
- The buddy name to be deleted
|
jaimlib.sourceforge.net | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |