1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 09:09:38 +02:00

Apply builder pattern to ConnectionConfiguration

Introducing a clean split between the constant connection configuration
parameters, which are now all in ConnectionConfiguration and the dynamic
connection state (e.g. hostAddresses) which are now in
AbstractXMPPConnection.

Also removed all arguments of login() since the username, password,
resource and callback handler need now to be configured via
ConnectionConfiguration.

Also remove documentation/extensions/messageevents.md, as it's already
in documentation/legacy
This commit is contained in:
Florian Schmaus 2014-11-09 18:30:16 +01:00
parent 69f387b344
commit c81cd34561
24 changed files with 760 additions and 708 deletions

View file

@ -28,18 +28,21 @@ Connect and Disconnect
----------------------
```
// Create the configuration for this new connection_
ConnectionConfiguration config = new ConnectionConfiguration("jabber.org", 5222);
// Create the configuration for this new connection
XMPPTCPConnectionConfigurationBuilder configBuilder = XMPPTCPConnectionConfiguration.builder();
configBuilder.setUsernameAndPassword("username", "password");
configBuilder.setResource("SomeResource");
configBuilder.setServiceName("jabber.org");
AbstractXMPPConnection connection = new XMPPTCPConnection(config);
// Connect to the server_
AbstractXMPPConnection connection = new XMPPTCPConnection(configBuilder.build());
// Connect to the server
connection.connect();
// Log into the server_
connection.login("username", "password", "SomeResource");
// Log into the server
connection.login();
...
// Disconnect from the server_
// Disconnect from the server
connection.disconnect();
```