mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 22:32:06 +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
|
```java
|
||||||
AbstractXMPPConnection connection = new XMPPTCPConnection("mtucker", "password", "jabber.org");
|
AbstractXMPPConnection connection = new XMPPTCPConnection("mtucker", "password", "jabber.org");
|
||||||
connection.connect();
|
connection.connect().login();
|
||||||
connection.login();
|
|
||||||
Chat chat = ChatManager.getInstanceFor(connection)
|
Chat chat = ChatManager.getInstanceFor(connection)
|
||||||
.createChat("jsmith@jivesoftware.com", new MessageListener() {
|
.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 SmackException if an error occurs somewhere else besides XMPP protocol level.
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws ConnectionException with detailed information about the failed connection.
|
* @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();
|
throwAlreadyConnectedExceptionIfAppropriate();
|
||||||
saslAuthentication.init();
|
saslAuthentication.init();
|
||||||
saslFeatureReceived.init();
|
saslFeatureReceived.init();
|
||||||
lastFeaturesReceived.init();
|
lastFeaturesReceived.init();
|
||||||
connectInternal();
|
connectInternal();
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue