From 5c42a2304f23d6b0bc90abd1f31f2a8c4ef8cae7 Mon Sep 17 00:00:00 2001 From: ChronosX88 Date: Sat, 25 May 2019 12:44:12 +0400 Subject: [PATCH] Fixed bug with non-existing chat (when creating chat name was long JID) --- .../io/github/chronosx88/influence/helpers/NetworkHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/chronosx88/influence/helpers/NetworkHandler.java b/app/src/main/java/io/github/chronosx88/influence/helpers/NetworkHandler.java index adb0369..a7d1698 100644 --- a/app/src/main/java/io/github/chronosx88/influence/helpers/NetworkHandler.java +++ b/app/src/main/java/io/github/chronosx88/influence/helpers/NetworkHandler.java @@ -42,7 +42,7 @@ public class NetworkHandler implements IncomingChatMessageListener, PresenceEven public void newIncomingMessage(EntityBareJid from, Message message, Chat chat) { String chatID = chat.getXmppAddressOfChatPartner().asUnescapedString(); if(LocalDBWrapper.getChatByChatID(from.asEntityBareJidString()) == null) { - LocalDBWrapper.createChatEntry(chatID, chat.getXmppAddressOfChatPartner().asBareJid().asUnescapedString()); + LocalDBWrapper.createChatEntry(chatID, chat.getXmppAddressOfChatPartner().asBareJid().asUnescapedString().split("@")[0]); } long messageID = LocalDBWrapper.createMessageEntry(chatID, from.asUnescapedString(), TrueTime.now().getTime(), message.getBody(), true, false); int newUnreadMessagesCount = LocalDBWrapper.getChatByChatID(chatID).unreadMessagesCount + 1;