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,14 +255,26 @@ public class Matrix {
|
|||||||
SmsManager smsManager = SmsManager.getDefault();
|
SmsManager smsManager = SmsManager.getDefault();
|
||||||
JsonObject json = event.getContent().getAsJsonObject();
|
JsonObject json = event.getContent().getAsJsonObject();
|
||||||
|
|
||||||
if (json.get("msgtype").getAsString().equals(MESSAGE_TYPE_TEXT)) {
|
if (event.type.equals("m.room.message")) {
|
||||||
String body = json.get("body").getAsString();
|
|
||||||
smsManager.sendTextMessage(room.getTopic(), null, body, null, null);
|
if (json.get("msgtype").getAsString().equals(MESSAGE_TYPE_TEXT)) {
|
||||||
|
String body = json.get("body").getAsString();
|
||||||
|
smsManager.sendTextMessage(room.getTopic(), null, body, null, null);
|
||||||
|
} else {
|
||||||
|
String url = session.getContentManager().getDownloadableUrl(json.get("url").getAsString());
|
||||||
|
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 {
|
} else {
|
||||||
String url = session.getContentManager().getDownloadableUrl(json.get("url").getAsString());
|
Log.e(TAG, "sendEvent: Event type not supported ");
|
||||||
smsManager.sendTextMessage(room.getTopic(), null, url, null, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
room.markAllAsRead(new SimpleApiCallback<Void>());
|
room.markAllAsRead(new SimpleApiCallback<Void>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user