diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-01 22:14:30 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-01 22:14:30 +0200 |
commit | 0c9ba838e10d75713c2b51c22fb53a8ceb2f408c (patch) | |
tree | 7c07321883a10780f031b12c90bf65ecc557f678 /src/main/java/de/pixart/messenger/services/XmppConnectionService.java | |
parent | 6dae9982e26a8ddcb0856f641acb247607c70143 (diff) |
finished 'Set Status Message' dialog
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 06311c441..716a39434 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -3833,15 +3833,16 @@ public class XmppConnectionService extends Service { } public void sendPresence(final Account account, final boolean includeIdleTimestamp) { - PresencePacket packet; + Presence.Status status; if (manuallyChangePresence()) { - packet = mPresenceGenerator.selfPresence(account, account.getPresenceStatus()); - String message = account.getPresenceStatusMessage(); - if (message != null && !message.isEmpty()) { - packet.addChild(new Element("status").setContent(message)); - } + status = account.getPresenceStatus(); } else { - packet = mPresenceGenerator.selfPresence(account, getTargetPresence()); + status = getTargetPresence(); + } + PresencePacket packet = mPresenceGenerator.selfPresence(account, status); + String message = account.getPresenceStatusMessage(); + if (message != null && !message.isEmpty()) { + packet.addChild(new Element("status").setContent(message)); } if (mLastActivity > 0 && includeIdleTimestamp) { long since = Math.min(mLastActivity, System.currentTimeMillis()); //don't send future dates @@ -4139,29 +4140,15 @@ public class XmppConnectionService extends Service { return pending; } - public void changeStatus(Account account, Presence.Status status, String statusMessage, boolean send) { - if (!statusMessage.isEmpty()) { - databaseBackend.insertPresenceTemplate(new PresenceTemplate(status, statusMessage)); + public void changeStatus(Account account, PresenceTemplate template, String signature) { + if (!template.getStatusMessage().isEmpty()) { + databaseBackend.insertPresenceTemplate(template); } - changeStatusReal(account, status, statusMessage, send); - } - - private void changeStatusReal(Account account, Presence.Status status, String statusMessage, boolean send) { - account.setPresenceStatus(status); - account.setPresenceStatusMessage(statusMessage); + account.setPgpSignature(signature); + account.setPresenceStatus(template.getStatus()); + account.setPresenceStatusMessage(template.getStatusMessage()); databaseBackend.updateAccount(account); - if (account.isEnabled() && send) { - sendPresence(account); - } - } - - public void changeStatus(Presence.Status status, String statusMessage) { - if (!statusMessage.isEmpty()) { - databaseBackend.insertPresenceTemplate(new PresenceTemplate(status, statusMessage)); - } - for (Account account : getAccounts()) { - changeStatusReal(account, status, statusMessage, true); - } + sendPresence(account); } public List<PresenceTemplate> getPresenceTemplates(Account account) { |