Autojoin on invite from Xena
This commit is contained in:
parent
072b9205d7
commit
6fec36cbfd
9
main.py
9
main.py
|
@ -39,7 +39,7 @@ rooms = client.get_rooms()
|
||||||
def room_callback(event):
|
def room_callback(event):
|
||||||
room = rooms[event[u'room_id']]
|
room = rooms[event[u'room_id']]
|
||||||
reload()
|
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']
|
print room.name, "<"+event[u'user_id']+">", event[u'content'][u'body']
|
||||||
if event[u'user_id'] == config["me"]["user"]:
|
if event[u'user_id'] == config["me"]["user"]:
|
||||||
return
|
return
|
||||||
|
@ -60,6 +60,13 @@ def room_callback(event):
|
||||||
m = args['re'].search(body)
|
m = args['re'].search(body)
|
||||||
if m:
|
if m:
|
||||||
room.send_text(func(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:
|
for room in rooms:
|
||||||
rooms[room].add_listener(room_callback)
|
rooms[room].add_listener(room_callback)
|
||||||
|
|
Loading…
Reference in New Issue