diff options
author | steckbrief <steckbrief@chefmail.de> | 2016-01-15 21:57:36 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2016-01-15 21:57:36 +0100 |
commit | d44debab6726edbac07901a2b94a07f2ef4771ee (patch) | |
tree | dda34feb85f53996cb5aa68063365ae3e8403195 /src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java | |
parent | 1f40166b3105ab78ce02339b16c9cb9eea921ec7 (diff) |
Introducing some specialized IqPacketGenerators
- IqPacketGenerator
- PubSubPacketGenerator
- AvatarPacketGenerator
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java b/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java index 63e94c03..1cbda222 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/AvatarService.java @@ -23,7 +23,6 @@ import de.thedevstack.conversationsplus.entities.Conversation; import de.thedevstack.conversationsplus.entities.ListItem; import de.thedevstack.conversationsplus.entities.MucOptions; import de.thedevstack.conversationsplus.generator.IqGenerator; -import de.thedevstack.conversationsplus.parser.IqParser; import de.thedevstack.conversationsplus.persistance.DatabaseBackend; import de.thedevstack.conversationsplus.ui.UiCallback; import de.thedevstack.conversationsplus.utils.AvatarUtil; @@ -33,6 +32,8 @@ import de.thedevstack.conversationsplus.utils.UiUpdateHelper; import de.thedevstack.conversationsplus.utils.XmppSendUtil; import de.thedevstack.conversationsplus.xml.Element; import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; +import de.thedevstack.conversationsplus.xmpp.avatar.AvatarPacketGenerator; +import de.thedevstack.conversationsplus.xmpp.avatar.AvatarPacketParser; import de.thedevstack.conversationsplus.xmpp.pep.Avatar; import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; @@ -323,13 +324,13 @@ public class AvatarService { callback.error(R.string.error_saving_avatar, avatar); return; } - final IqPacket packet = IqGenerator.publishAvatar(avatar); + final IqPacket packet = AvatarPacketGenerator.generatePublishAvatarPacket(avatar); XmppSendUtil.sendIqPacket(account, packet, new OnIqPacketReceived() { @Override public void onIqPacketReceived(Account account, IqPacket result) { if (result.getType() == IqPacket.TYPE.RESULT) { - final IqPacket packet = IqGenerator.publishAvatarMetadata(avatar); + final IqPacket packet = AvatarPacketGenerator.generatePublishAvatarMetadataPacket(avatar); XmppSendUtil.sendIqPacket(account, packet, new OnIqPacketReceived() { @Override @@ -385,7 +386,7 @@ public class AvatarService { } private void fetchAvatarPep(final Account account, final Avatar avatar, final UiCallback<Avatar> callback) { - IqPacket packet = IqGenerator.retrievePepAvatar(avatar); + IqPacket packet = AvatarPacketGenerator.generateRetrieveAvatarPacket(avatar); XmppSendUtil.sendIqPacket(account, packet, new OnIqPacketReceived() { @Override @@ -396,7 +397,7 @@ public class AvatarService { final String ERROR = account.getJid().toBareJid() + ": fetching avatar for " + avatar.owner + " failed "; if (result.getType() == IqPacket.TYPE.RESULT) { - avatar.image = IqParser.avatarData(result); + avatar.image = AvatarPacketParser.parseAvatarData(result); if (avatar.image != null) { if (AvatarUtil.save(avatar)) { if (account.getJid().toBareJid().equals(avatar.owner)) { @@ -472,7 +473,7 @@ public class AvatarService { } public void checkForAvatar(Account account, final UiCallback<Avatar> callback) { - IqPacket packet = IqGenerator.retrieveAvatarMetaData(null); + IqPacket packet = AvatarPacketGenerator.generateRetrieveAvatarMetadataPacket(null); XmppSendUtil.sendIqPacket(account, packet, new OnIqPacketReceived() { @Override |