37 lines
906 B
Java
37 lines
906 B
Java
package org.mercury_im.messenger.xmpp_core;
|
|
|
|
import org.jivesoftware.smack.XMPPConnection;
|
|
import org.jivesoftware.smack.roster.Roster;
|
|
|
|
public class MercuryConnection {
|
|
|
|
private final XMPPConnection connection;
|
|
private final long accountId;
|
|
private final Roster roster;
|
|
|
|
public MercuryConnection(XMPPConnection connection, long accountId) {
|
|
this.connection = connection;
|
|
this.accountId = accountId;
|
|
|
|
this.roster = Roster.getInstanceFor(connection);
|
|
roster.setRosterLoadedAtLogin(true);
|
|
}
|
|
|
|
public XMPPConnection getConnection() {
|
|
return connection;
|
|
}
|
|
|
|
public void setRosterHandler(RosterHandler handler) {
|
|
roster.addRosterListener(handler);
|
|
roster.addRosterLoadedListener(handler);
|
|
}
|
|
|
|
public long getAccountId() {
|
|
return accountId;
|
|
}
|
|
|
|
public Roster getRoster() {
|
|
return roster;
|
|
}
|
|
}
|