From 9099d8f0df64e27ed2d902eddda67fed273fd56a Mon Sep 17 00:00:00 2001 From: Gerben Droogers Date: Sat, 9 Dec 2017 22:23:42 +0100 Subject: [PATCH] Dont create a new room for a incomming call --- .../java/eu/droogers/smsmatrix/Matrix.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/eu/droogers/smsmatrix/Matrix.java b/app/src/main/java/eu/droogers/smsmatrix/Matrix.java index ef6a45f..4e5b6ea 100644 --- a/app/src/main/java/eu/droogers/smsmatrix/Matrix.java +++ b/app/src/main/java/eu/droogers/smsmatrix/Matrix.java @@ -145,17 +145,19 @@ public class Matrix { if (session != null && session.isAlive()) { Room room = getRoomByPhonenumber(phoneNumber); if (room == null) { - Log.e(TAG, "sendMessage: not found" ); - session.createRoomDirectMessage(realUserid, new SimpleApiCallback() { - @Override - public void onSuccess(String info) { - super.onSuccess(info); - session.getRoomsApiClient().updateTopic(info, phoneNumber, new SimpleApiCallback()); - changeDisplayname(info, getContactName(phoneNumber, context)); - Room room = store.getRoom(info); - SendMesageToRoom(room, body, type); - } - }); + if (!type.equals("m.notice")) { + Log.e(TAG, "sendMessage: not found" ); + session.createRoomDirectMessage(realUserid, new SimpleApiCallback() { + @Override + public void onSuccess(String info) { + super.onSuccess(info); + session.getRoomsApiClient().updateTopic(info, phoneNumber, new SimpleApiCallback()); + changeDisplayname(info, getContactName(phoneNumber, context)); + Room room = store.getRoom(info); + SendMesageToRoom(room, body, type); + } + }); + } } else { changeDisplayname(room.getRoomId(), getContactName(phoneNumber, context)); SendMesageToRoom(room, body, type);