mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
Make connect() return a self-reference
This commit is contained in:
parent
780872f2ef
commit
1407f10f7f
2 changed files with 5 additions and 3 deletions
|
@ -13,8 +13,8 @@ Smack Key Advantages
|
|||
|
||||
```java
|
||||
AbstractXMPPConnection connection = new XMPPTCPConnection("mtucker", "password", "jabber.org");
|
||||
connection.connect();
|
||||
connection.login();
|
||||
connection.connect().login();
|
||||
|
||||
Chat chat = ChatManager.getInstanceFor(connection)
|
||||
.createChat("jsmith@jivesoftware.com", new MessageListener() {
|
||||
|
||||
|
|
|
@ -378,13 +378,15 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
* @throws SmackException if an error occurs somewhere else besides XMPP protocol level.
|
||||
* @throws IOException
|
||||
* @throws ConnectionException with detailed information about the failed connection.
|
||||
* @return a reference to this object, to chain <code>connect()</code> with <code>login()</code>.
|
||||
*/
|
||||
public synchronized void connect() throws SmackException, IOException, XMPPException {
|
||||
public synchronized AbstractXMPPConnection connect() throws SmackException, IOException, XMPPException {
|
||||
throwAlreadyConnectedExceptionIfAppropriate();
|
||||
saslAuthentication.init();
|
||||
saslFeatureReceived.init();
|
||||
lastFeaturesReceived.init();
|
||||
connectInternal();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue