mirror of
https://codeberg.org/Mercury-IM/Mercury-IM
synced 2024-06-15 16:14:52 +02:00
30 lines
1 KiB
Java
30 lines
1 KiB
Java
package org.mercury_im.xmpp.connection;
|
|
|
|
import org.jivesoftware.smack.ConnectionConfiguration;
|
|
import org.jivesoftware.smack.XMPPConnection;
|
|
import org.mercury_im.core.ConnectionFactory;
|
|
import org.mercury_im.core.Messenger;
|
|
import org.mercury_im.messenger.xmpp.entity.XmppAccount;
|
|
import org.mercury_im.messenger.xmpp.entity.XmppAddress;
|
|
import org.mercury_im.messenger.xmpp.entity.XmppAuthMethod;
|
|
|
|
public abstract class XmppConnectionFactory implements ConnectionFactory<XmppConnectionMethod, XmppAccount, XmppAddress.XmppUserAddress, XmppAuthMethod> {
|
|
|
|
protected final Messenger messenger;
|
|
|
|
public XmppConnectionFactory(Messenger messenger) {
|
|
this.messenger = messenger;
|
|
}
|
|
|
|
public Messenger getMessenger() {
|
|
return messenger;
|
|
}
|
|
|
|
@Override
|
|
public XmppConnectionMethod provideConnection(XmppAccount account) {
|
|
return new XmppConnectionMethod(account, getMessenger(), createXmppConnection());
|
|
}
|
|
|
|
protected abstract XMPPConnection createXmppConnection(ConnectionConfiguration connectionConfiguration);
|
|
}
|