35 lines
895 B
Java
35 lines
895 B
Java
package org.mercury_im.messenger.xmpp;
|
|
|
|
import org.jivesoftware.smack.XMPPConnection;
|
|
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
|
|
import org.jxmpp.stringprep.XmppStringprepException;
|
|
import org.mercury_im.messenger.entity.Account;
|
|
|
|
public class MercuryConnection {
|
|
|
|
private final Account account;
|
|
|
|
private XMPPConnection connection;
|
|
|
|
public MercuryConnection(Account account) {
|
|
this.account = account;
|
|
try {
|
|
this.connection = new XMPPTCPConnection(account.getAddress(), account.getPassword());
|
|
} catch (XmppStringprepException e) {
|
|
throw new AssertionError("Account has invalid address: " + account.getAddress(), e);
|
|
}
|
|
}
|
|
|
|
public Account getAccount() {
|
|
return account;
|
|
}
|
|
|
|
public XMPPConnection getConnection() {
|
|
return connection;
|
|
}
|
|
|
|
public void ensureAuthenticated() {
|
|
|
|
}
|
|
}
|