|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IGateway
Provides a callback mechanism for receiving messages and events the IM server. The IClient will invoke these methods from its listener thread as it receives events from the server.
It is important that your implementation of the callback methods are lightweight and return right away, in order for the client thread to continue processing events.
Field Summary | |
---|---|
static String |
AUTH_REQUEST_MESSAGE
Deprecated. As of 2.0, this constant is no longer used in the JBuddy SDK. |
Method Summary | |
---|---|
void |
adminMessage(IClient client,
IMessage message)
Handles special notifications from the server (including errors). |
void |
connectionLost(IClient client,
String reason)
Indicates that the client's connection to the server has been lost, and its listener thread has been stopped. |
void |
incomingBuddy(IClient client,
IBuddy buddy)
Handles presence updates from the server. |
void |
incomingMessage(IClient client,
IMessage message)
Handles incoming messages. |
Field Detail |
---|
static final String AUTH_REQUEST_MESSAGE
IMessage.AUTH_REQUEST
,
Constant Field ValuesMethod Detail |
---|
void adminMessage(IClient client, IMessage message) throws Exception
client
- the client that received the messagemessage
- the message
Exception
void connectionLost(IClient client, String reason) throws Exception
Since JBuddy 5.1, the reason
field has the form
[reason type] - [description]
, where
[reason type]
is an IClient reason constant such as
FAILED_LOGIN_REASON
.
The following code illustrates how to handle failed login attempts.
if (reason.startsWith(IClient.FAILED_LOGIN_REASON)) { String description = reason.substring(IClient.FAILED_LOGIN_REASON.length() + 3); System.out.println("Our login attempt failed because of " + description); }
client
- the client whose connection has been lostreason
- a description of what caused the connection to be lost
Exception
IClient.CONNECTION_CLOSED_REASON
,
IClient.DISCONNECT_REASON
,
IClient.FAILED_LOGIN_REASON
,
IClient.NETWORK_ERROR_REASON
,
IClient.SERVICE_TEMPORARILY_UNAVAILABLE_REASON
,
IClient.USER_BOOTED_REASON
,
IClient.UNKNOWN_REASON
void incomingBuddy(IClient client, IBuddy buddy) throws Exception
Presence updates are only received for users in this client's Buddy List.
client
- the client that received the presence updatebuddy
- the IBuddy instance, which holds the buddy's updated
information
Exception
void incomingMessage(IClient client, IMessage message) throws Exception
Authorization request messages may also be received via this method. An authorization request occurs when another user has added the client to their Buddy List, thus requesting presence updates on the client. Add such users to the Permit List or Deny List when receiving authorization requests.
client
- the client that received the messagemessage
- the message
Exception
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |