|
@@ -46,16 +46,16 @@ class Rooms extends Handler {
|
|
|
public function check_typing(time: Int, user: User) {
|
|
|
for(room in typing_on.keys()) {
|
|
|
if(typing_on[room] == true) {
|
|
|
- this.typing(room, user, time + 200);
|
|
|
+ this.typing(room, user, time + 200, function(t:Bool) {});
|
|
|
} else if(typing_on[room] == false) {
|
|
|
- this.typing(room, user, time, true);
|
|
|
+ this.typing(room, user, time, true, function(t:Bool) {});
|
|
|
typing_on[room] == null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- haxe.Timer.delay(time, function (){
|
|
|
+ haxe.Timer.delay(function (){
|
|
|
check_typing(time, user);
|
|
|
- });
|
|
|
+ }, time);
|
|
|
}
|
|
|
|
|
|
public inline function invite( room : Room, user : User, on_response : Void -> Void ) : Void {
|
|
@@ -64,6 +64,12 @@ class Rooms extends Handler {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ public inline function third_invite( room : Room, identity_server : String, address: String, medium: String = 'email', on_response : Void -> Void ) : Void {
|
|
|
+ this.send_request(Conection.make_request('POST', this.server + '/_matrix/client/r0/rooms/' + room + '/invite', {id_server: identity_server, address: address, medium: medium}), function( status : Int, data : Dynamic ) : Void {
|
|
|
+ on_response();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
public inline function join( room : Room, ?third_party_signed : {sender: String, mxid: String, token: String, signatures: Dynamic}, on_response : Room -> Void ) : Void {
|
|
|
this.send_request(Conection.make_request('POST', this.server + '/_matrix/client/r0/rooms/' + room + '/join', if(third_party_signed != null) {third_party_signed: third_party_signed} else null), function( status : Int, data : Dynamic ) : Void {
|
|
|
on_response(new Room(data.room_id));
|
|
@@ -150,6 +156,12 @@ class Rooms extends Handler {
|
|
|
this.get_room_events('/_matrix/client/r0/rooms/' + room + '/state', on_response);
|
|
|
}
|
|
|
|
|
|
+ public inline function get_events( room : Room, ?from_token: String, ?timeout: Int, on_response : String -> String -> Array<Event<Dynamic>> -> Void ) : Void {
|
|
|
+ this.send_request(Conection.make_request('GET', server + '/_matrix/client/r0/events?room_id=' + room + (if(timeout != null) '&timeout=' + timeout else '') + (if(from_token != null) '&from=' + from_token else ''), null),
|
|
|
+ function( status : Int, data : {start: String, end: String, chunk: Array<Event<Dynamic>>} ) : Void {
|
|
|
+ on_response(data.start, data.end, data.chunk);
|
|
|
+ });
|
|
|
+ }
|
|
|
public inline function get_members( room : Room, on_response : Array<Event<m.room.Member>> -> Void ) : Void {
|
|
|
this.send_request(Conection.make_request('GET', server + '/_matrix/client/r0/rooms/' + room + '/members', null), function( status : Int, data : Dynamic ) : Void {
|
|
|
on_response(data.chunk);
|
|
@@ -228,6 +240,29 @@ class Rooms extends Handler {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public inline function get_tags( room : Room, user: User, on_response : Array<m.Tag> -> Void ) : Void {
|
|
|
+ this.send_request(Conection.make_request('GET', server + '/_matrix/client/r0/user/' + user + '/rooms/' + room + '/tags', null), function( status : Int, data : {tags: Array<Dynamic>} ) : Void {
|
|
|
+ var result: Array<m.Tag> = [];
|
|
|
+ for(t in data.tags) {
|
|
|
+ result.push({tags: Conection.to_object_map(t)});
|
|
|
+ }
|
|
|
+ on_response(result);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ public inline function add_tag( room : Room, user: User, tag: String, order: Int, on_response : Void -> Void ) : Void {
|
|
|
+ this.send_request(Conection.make_request('PUT', server + '/_matrix/client/r0/user/' + user + '/rooms/' + room + '/tags/' + tag, {order: order}), function( status : Int, data : Dynamic ) : Void {
|
|
|
+ on_response();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ public inline function remove_tag( room : Room, user: User, tag: String, on_response : Void -> Void ) : Void {
|
|
|
+ this.send_request(Conection.make_request('DELETE', server + '/_matrix/client/r0/user/' + user + '/rooms/' + room + '/tags/' + tag, null), function( status : Int, data : Dynamic ) : Void {
|
|
|
+ on_response();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
private function get_room_events( url : String, on_response : Array<Event<Dynamic>> -> Void ) : Void {
|
|
|
this.send_request(Conection.make_request('GET', server + url, null), function( status : Int, data : Dynamic ) : Void {
|
|
|
on_response(data);
|