From bff97731deed4c599dcb6c3a2887c9f47165dd3f Mon Sep 17 00:00:00 2001 From: steckbrief Date: Fri, 11 May 2018 19:49:27 +0200 Subject: introduces JidUtil for Jid creation, fixes duplication of childs while adding childs with xmlns and name --- .../conversationsplus/services/XmppConnectionService.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java') diff --git a/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java b/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java index 2285a29d..a6dff1f0 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java @@ -55,7 +55,6 @@ import java.util.concurrent.CopyOnWriteArrayList; import de.thedevstack.android.logcat.Logging; import de.thedevstack.conversationsplus.ConversationsPlusApplication; import de.thedevstack.conversationsplus.ConversationsPlusPreferences; -import de.thedevstack.conversationsplus.enums.MessageDirection; import de.thedevstack.conversationsplus.enums.MessageStatus; import de.thedevstack.conversationsplus.services.avatar.AvatarCache; import de.thedevstack.conversationsplus.services.avatar.AvatarService; @@ -83,6 +82,7 @@ import de.thedevstack.conversationsplus.xmpp.openpgp.OpenPgpXep; import de.thedevstack.conversationsplus.xmpp.ping.PingXep; import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacketReceiver; import de.thedevstack.conversationsplus.xmpp.time.EntityTimeXep; +import de.thedevstack.conversationsplus.xmpp.jid.JidUtil; import de.tzur.conversations.Settings; import de.thedevstack.conversationsplus.Config; import de.thedevstack.conversationsplus.R; @@ -406,7 +406,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa case ACTION_DISABLE_ACCOUNT: try { String jid = intent.getStringExtra("account"); - Account account = jid == null ? null : findAccountByJid(Jid.fromString(jid)); + Account account = jid == null ? null : findAccountByJid(JidUtil.fromString(jid)); if (account != null) { account.setOption(Account.OPTION_DISABLED, true); updateAccount(account); @@ -795,7 +795,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa SessionImpl otrSession = conversation.getOtrSession(); if (otrSession != null && otrSession.getSessionStatus() == SessionStatus.ENCRYPTED) { try { - message.setCounterpart(Jid.fromSessionID(otrSession.getSessionID())); + message.setCounterpart(JidUtil.fromSessionID(otrSession.getSessionID())); } catch (InvalidJidException e) { break; } @@ -992,7 +992,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } Jid jid; try { - jid = Jid.fromString(phoneContact.getString("jid")); + jid = JidUtil.fromString(phoneContact.getString("jid")); } catch (final InvalidJidException e) { continue; } @@ -1789,7 +1789,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa return; } String name = new BigInteger(75, ConversationsPlusApplication.getSecureRandom()).toString(32); - Jid jid = Jid.fromParts(name, server, null); + Jid jid = JidUtil.fromParts(name, server, null); final Conversation conversation = findOrCreateConversation(account, jid, true); joinMuc(conversation, new OnConferenceJoined() { @Override @@ -2002,7 +2002,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa public void onMessageFound(Message message) { SessionID id = otrSession.getSessionID(); try { - message.setCounterpart(Jid.fromString(id.getAccountID() + "/" + id.getUserID())); + message.setCounterpart(JidUtil.fromString(id.getAccountID() + "/" + id.getUserID())); } catch (InvalidJidException e) { return; } -- cgit v1.2.3