|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.echomine.jabber.JabberUserService
public class JabberUserService
The user service contains all the methods needed to interact with user related services such as authentication and registration.
For authentication, there are several different ways to secure the authentication. Cleartext password and digest are the two core features (although it appears there is a new method called zero-knowledge, known as 0k). The User Service physically queries the server to see what kinds of secure authentication methods are supported, and will automatically choose the most secure way to authenticate. This means, it will choose by priority, zero-knowledge, digest, and password, in that order.
Constructor Summary | |
---|---|
JabberUserService(JabberSession session)
|
Method Summary | |
---|---|
void |
changePassword(java.lang.String newPassword)
changes the password. |
java.util.HashMap |
getRegisterFields(JID serviceJID)
Retrieves a list of fields that are required to register with a specific gateway (ie. |
int |
login()
logs in to the server using the info provided in JabberContext. |
void |
register(JID serviceJID,
java.util.HashMap fields)
Registers with a service. |
void |
removeRegisterService(JID serviceJID,
java.lang.String key)
Tries to unsubscribe/remove your account from a specific service. |
void |
removeVacationMessage()
removes the vacation message. |
VacationIQMessage |
requestVacationMessage(boolean wait)
requests for the logged in user's vacation message settings. |
void |
setVacationMessage(java.util.Calendar startDate,
java.util.Calendar endDate,
java.lang.String vacationMessage)
sets the vacation message synchronously. |
java.lang.String |
translateUserToJID(JID serviceJID,
java.lang.String user)
translates a service-specific username into a JID usable for reference. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JabberUserService(JabberSession session)
Method Detail |
---|
public int login() throws JabberMessageException, SendMessageFailedException
JabberMessageException
- when user authentication fails
SendMessageFailedException
- when message can't be sentpublic void register(JID serviceJID, java.util.HashMap fields) throws JabberMessageException, SendMessageFailedException
Registers with a service. It's used to create a new account OR update a current account. This method is synchronous and will not return until the server sends a reply. If register is successful, the method will return normally, but an exception will be thrown if error in registration occurs. This method is set to accept default information. It simply obtains a hash table of name/value pairs to add to the message. If you need more advanced control on what kind of data to pass in, you should create the register message and send the message yourself without going through this method. An exception is thrown if there is an error. Otherwise, everything went successfully.
Normally when updating data information, you will need to first request the current info first (by retrieving the register fields). In that request, there will be a "key" field that you need in order to modify any information. For any modification, you need to include that key in the HashMap that you submit.
serviceJID
- the service name to register with (ie. jabber.org, aim.jabber.org, msn.jabber.org)fields
- a set of name/value pairs that will be submitted to the server (ie. username, password, email, etc)
JabberMessageException
- when registration fails. The error message will indicate the reason.
SendMessageFailedException
- when message can't be sentpublic void changePassword(java.lang.String newPassword) throws JabberMessageException, SendMessageFailedException
JabberMessageException
- if password is not changed
SendMessageFailedException
public java.util.HashMap getRegisterFields(JID serviceJID) throws JabberMessageException, SendMessageFailedException
Retrieves a list of fields that are required to register with a specific gateway (ie. AIM, MSN, etc). You can also use this method retrieve the current information registered with the gateway (except the password). This method works for user registration as well as gateway/transport registration.
If you happen to be registered already with the gateway, this method will return the fields (with the data that you registered with) that you can modify. The information inside will contain a key that must be passed between the client and server for any changes or sets. The key acts as a security mechanism that makes sure that you're the one who is modifying the information.
You need to provide the gateway that this message goes to. This can actually be retrieved by querying for the list of agents from the server (available in the Server Service).
This method is synchronous and will not return until a reply or error is received.
serviceJID
- the JID of the gateway (ie. jabber.org, aim.jabber.org, etc)
JabberMessageException
SendMessageFailedException
public void removeRegisterService(JID serviceJID, java.lang.String key) throws JabberMessageException, SendMessageFailedException
Tries to unsubscribe/remove your account from a specific service. This is normally used to unregister yourself from a service (ie. MSN, AIM, ICQ, etc) that you were previously registered with. in order to unsubscribe from an account, you obviously need to be registered first. Thus, you muse first retrieve the list of register fields and obtain the key. Then, you can use the key to remove.
This method is synchronous and will not return until a reply or error is received
Note that the key has been obsoleted. This may mean that you do not necessarily need to pass in a key any longer depending on the server.
serviceJID
- the service JID that you will be removing yourself from.key
- the key that is sent by the server to you when you retrieved the fields (null if you don't have one).
JabberMessageException
SendMessageFailedException
public java.lang.String translateUserToJID(JID serviceJID, java.lang.String user) throws JabberMessageException, SendMessageFailedException
translates a service-specific username into a JID usable for reference. This is used to translate gateway-specific user naming convention into a Jabber JID naming convention (ie. "123456" for ICQ might be translated into "123456@icq.jabber.org").
This message is sent synchronously and will not return until an error or reply is received.
serviceJID
- the service/gateway to translate this user intouser
- the service/gateway's user name that needs to be translated
JabberMessageException
- if there is an error during translation or timeout occurs.
SendMessageFailedException
- sending the message failedpublic VacationIQMessage requestVacationMessage(boolean wait) throws SendMessageFailedException, JabberMessageException
wait
- whether to wait for the response or not
SendMessageFailedException
JabberMessageException
public void removeVacationMessage() throws SendMessageFailedException, JabberMessageException
SendMessageFailedException
JabberMessageException
public void setVacationMessage(java.util.Calendar startDate, java.util.Calendar endDate, java.lang.String vacationMessage) throws SendMessageFailedException, JabberMessageException
startDate
- the starting date for the vacationendDate
- the ending date for the vacationvacationMessage
- the message to display
SendMessageFailedException
JabberMessageException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |