From 6fec36cbfda43027dfe3d9c826fb33bdbf8efd80 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sun, 29 Nov 2015 08:39:56 -0800 Subject: [PATCH] Autojoin on invite from Xena --- main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index f8aa107..76af82b 100644 --- a/main.py +++ b/main.py @@ -39,7 +39,7 @@ rooms = client.get_rooms() def room_callback(event): room = rooms[event[u'room_id']] reload() - if u'user_id' in event and event[u'type'] == "m.room.message": + if event[u'type'] == "m.room.message": print room.name, "<"+event[u'user_id']+">", event[u'content'][u'body'] if event[u'user_id'] == config["me"]["user"]: return @@ -60,6 +60,13 @@ def room_callback(event): m = args['re'].search(body) if m: room.send_text(func(m)) + elif u'invite_room_state' in event: + for user in config["masters"]: + if event[u'user_id'] == user: + client.join_room(event[u'room_id']) + print user, "asked me to join", event[u'room_id'] + #else: + # print dump(event) for room in rooms: rooms[room].add_listener(room_callback)