mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-09 18:29:45 +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:
parent
69f387b344
commit
c81cd34561
24 changed files with 760 additions and 708 deletions
|
@ -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();
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue