aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2016-01-13 16:10:09 +0100
committersteckbrief <steckbrief@chefmail.de>2016-01-13 16:10:09 +0100
commit8644c4676a5fda9d642244ff70e72c5fe524a24d (patch)
treeaa3638db5eb30c25cbd250f675a5a1e61b2a99ab /src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java
parent0fe5ce481fe72d3821a93b2792d6ae16b04bec7d (diff)
Moved all avatar related work to AvatarService
- fetchAvatar, fetchAvatarPep, fetchAvatarVcard, checkForAvatar moved from XmppConnectionService to AvatarService - Several unused imports removed - XmppSendUtil introduced to enable presencePacket and iqPacket sending without using XmppConnectionService since the account has everything needed - UiUpdateHelper introduced to enable UI updates without using XmppConnectionService directly
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java b/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java
index ce52bbeb..8bc5ec89 100644
--- a/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java
+++ b/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java
@@ -9,8 +9,10 @@ import de.thedevstack.conversationsplus.entities.Conversation;
import de.thedevstack.conversationsplus.entities.MucOptions;
import de.thedevstack.conversationsplus.entities.Presences;
import de.thedevstack.conversationsplus.generator.PresenceGenerator;
+import de.thedevstack.conversationsplus.services.AvatarService;
import de.thedevstack.conversationsplus.services.XmppConnectionService;
import de.thedevstack.conversationsplus.utils.AvatarUtil;
+import de.thedevstack.conversationsplus.utils.UiUpdateHelper;
import de.thedevstack.conversationsplus.xml.Element;
import de.thedevstack.conversationsplus.xmpp.OnPresencePacketReceived;
import de.thedevstack.conversationsplus.xmpp.jid.Jid;
@@ -35,12 +37,12 @@ public class PresenceParser extends AbstractParser implements
mucOptions.processPacket(packet, mPgpEngine);
final ArrayList<MucOptions.User> tileUserAfter = new ArrayList<>(mucOptions.getUsers().subList(0,Math.min(mucOptions.getUsers().size(),5)));
if (!tileUserAfter.equals(tileUserBefore)) {
- mXmppConnectionService.getAvatarService().clear(conversation);
+ AvatarService.getInstance().clear(conversation);
}
if (before != mucOptions.online() || (mucOptions.online() && count != mucOptions.getUsers().size())) {
- mXmppConnectionService.updateConversationUi();
+ UiUpdateHelper.updateConversationUi();
} else if (mucOptions.online()) {
- mXmppConnectionService.updateMucRosterUi();
+ UiUpdateHelper.updateMucRosterUi();
}
}
}
@@ -61,12 +63,12 @@ public class PresenceParser extends AbstractParser implements
avatar.owner = from.toBareJid();
if (AvatarUtil.isAvatarCached(avatar)) {
if (contact.setAvatar(avatar)) {
- mXmppConnectionService.getAvatarService().clear(contact);
- mXmppConnectionService.updateConversationUi();
- mXmppConnectionService.updateRosterUi();
+ AvatarService.getInstance().clear(contact);
+ UiUpdateHelper.updateConversationUi();
+ UiUpdateHelper.updateRosterUi();
}
} else {
- mXmppConnectionService.fetchAvatar(account, avatar);
+ AvatarService.getInstance().fetchAvatar(account, avatar);
}
}
int sizeBefore = contact.getPresences().size();
@@ -96,7 +98,7 @@ public class PresenceParser extends AbstractParser implements
contact.setOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST);
}
}
- mXmppConnectionService.updateRosterUi();
+ UiUpdateHelper.updateRosterUi();
}
@Override