mirror of
https://github.com/tijder/SmsMatrix.git
synced 2024-10-27 18:24:01 +00:00
Join and Leave rooms
Join a room if invited by user Leave the room when the user leaves
This commit is contained in:
parent
4efdf09f7b
commit
38b6720a90
@ -255,6 +255,8 @@ public class Matrix {
|
|||||||
SmsManager smsManager = SmsManager.getDefault();
|
SmsManager smsManager = SmsManager.getDefault();
|
||||||
JsonObject json = event.getContent().getAsJsonObject();
|
JsonObject json = event.getContent().getAsJsonObject();
|
||||||
|
|
||||||
|
if (event.type.equals("m.room.message")) {
|
||||||
|
|
||||||
if (json.get("msgtype").getAsString().equals(MESSAGE_TYPE_TEXT)) {
|
if (json.get("msgtype").getAsString().equals(MESSAGE_TYPE_TEXT)) {
|
||||||
String body = json.get("body").getAsString();
|
String body = json.get("body").getAsString();
|
||||||
smsManager.sendTextMessage(room.getTopic(), null, body, null, null);
|
smsManager.sendTextMessage(room.getTopic(), null, body, null, null);
|
||||||
@ -262,6 +264,16 @@ public class Matrix {
|
|||||||
String url = session.getContentManager().getDownloadableUrl(json.get("url").getAsString());
|
String url = session.getContentManager().getDownloadableUrl(json.get("url").getAsString());
|
||||||
smsManager.sendTextMessage(room.getTopic(), null, url, null, null);
|
smsManager.sendTextMessage(room.getTopic(), null, url, null, null);
|
||||||
}
|
}
|
||||||
|
} else if (event.type.equals("m.room.member")) {
|
||||||
|
if (json.get("membership").getAsString().equals("leave")) {
|
||||||
|
room.leave(new SimpleApiCallback<Void>());
|
||||||
|
} else if (json.get("membership").getAsString().equals("invite")) {
|
||||||
|
room.join(new SimpleApiCallback<Void>());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "sendEvent: Event type not supported ");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
room.markAllAsRead(new SimpleApiCallback<Void>());
|
room.markAllAsRead(new SimpleApiCallback<Void>());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user