Fixed bug with non-existing chat (when creating chat name was long JID)

This commit is contained in:
ChronosX88 2019-05-25 12:44:12 +04:00
parent 82bd46f306
commit 5c42a2304f

View File

@ -42,7 +42,7 @@ public class NetworkHandler implements IncomingChatMessageListener, PresenceEven
public void newIncomingMessage(EntityBareJid from, Message message, Chat chat) { public void newIncomingMessage(EntityBareJid from, Message message, Chat chat) {
String chatID = chat.getXmppAddressOfChatPartner().asUnescapedString(); String chatID = chat.getXmppAddressOfChatPartner().asUnescapedString();
if(LocalDBWrapper.getChatByChatID(from.asEntityBareJidString()) == null) { 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); long messageID = LocalDBWrapper.createMessageEntry(chatID, from.asUnescapedString(), TrueTime.now().getTime(), message.getBody(), true, false);
int newUnreadMessagesCount = LocalDBWrapper.getChatByChatID(chatID).unreadMessagesCount + 1; int newUnreadMessagesCount = LocalDBWrapper.getChatByChatID(chatID).unreadMessagesCount + 1;