get rid of special self presence object and incorporate that into roster
This commit is contained in:
parent
ce4848f742
commit
1517641713
|
@ -116,10 +116,9 @@ public class Account extends AbstractEntity {
|
|||
protected boolean online = false;
|
||||
private OtrEngine otrEngine = null;
|
||||
private XmppConnection xmppConnection = null;
|
||||
private Presences presences = new Presences();
|
||||
private long mEndGracePeriod = 0L;
|
||||
private String otrFingerprint;
|
||||
private Roster roster = null;
|
||||
private final Roster roster = new Roster(this);
|
||||
private List<Bookmark> bookmarks = new CopyOnWriteArrayList<>();
|
||||
|
||||
public Account() {
|
||||
|
@ -328,20 +327,8 @@ public class Account extends AbstractEntity {
|
|||
this.rosterVersion = version;
|
||||
}
|
||||
|
||||
public void updatePresence(String resource, int status) {
|
||||
this.presences.updatePresence(resource, status);
|
||||
}
|
||||
|
||||
public void removePresence(String resource) {
|
||||
this.presences.removePresence(resource);
|
||||
}
|
||||
|
||||
public void clearPresences() {
|
||||
this.presences = new Presences();
|
||||
}
|
||||
|
||||
public int countPresences() {
|
||||
return this.presences.size();
|
||||
return this.getRoster().getContact(this.getJid().toBareJid()).getPresences().size();
|
||||
}
|
||||
|
||||
public String getPgpSignature() {
|
||||
|
@ -357,9 +344,6 @@ public class Account extends AbstractEntity {
|
|||
}
|
||||
|
||||
public Roster getRoster() {
|
||||
if (this.roster == null) {
|
||||
this.roster = new Roster(this);
|
||||
}
|
||||
return this.roster;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,17 +45,6 @@ public class PresenceParser extends AbstractParser implements
|
|||
}
|
||||
final Jid from = packet.getFrom();
|
||||
String type = packet.getAttribute("type");
|
||||
if (from.toBareJid().equals(account.getJid().toBareJid())) {
|
||||
if (!from.isBareJid()) {
|
||||
if (type == null) {
|
||||
account.updatePresence(from.getResourcepart(),
|
||||
Presences.parseShow(packet.findChild("show")));
|
||||
} else if (type.equals("unavailable")) {
|
||||
account.removePresence(from.getResourcepart());
|
||||
account.deactivateGracePeriod();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Contact contact = account.getRoster().getContact(packet.getFrom());
|
||||
if (type == null) {
|
||||
String presence;
|
||||
|
@ -107,7 +96,6 @@ public class PresenceParser extends AbstractParser implements
|
|||
if (nick != null) {
|
||||
contact.setPresenceName(nick.getContent());
|
||||
}
|
||||
}
|
||||
mXmppConnectionService.updateRosterUi();
|
||||
}
|
||||
|
||||
|
|
|
@ -241,7 +241,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
|
|||
@Override
|
||||
public void onBind(final Account account) {
|
||||
account.getRoster().clearPresences();
|
||||
account.clearPresences(); // self presences
|
||||
account.pendingConferenceJoins.clear();
|
||||
account.pendingConferenceLeaves.clear();
|
||||
fetchRosterFromServer(account);
|
||||
|
|
Loading…
Reference in New Issue