1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 14:22:05 +01:00

Make connect() return a self-reference

This commit is contained in:
Florian Schmaus 2015-01-25 19:48:52 +01:00
parent 780872f2ef
commit 1407f10f7f
2 changed files with 5 additions and 3 deletions

View file

@ -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() {

View file

@ -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;
}
/**