Esempio n. 1
0
 def save_function(cls, room_jid, force):
     # there was a bug in 0.10 series so save method was replaced with.. function
     room = ast.MethodCall(ast.Var('muc'), ast.Var('room'),
                           [ast.LiteralString(room_jid)])
     return cls._call_room_method(ast.LiteralString(room_jid),
                                  ast.Var('save'),
                                  [room, ast.Boolean(force)])
Esempio n. 2
0
 def set_affiliation(cls, room_jid, jid, affiliation=None):
     # muc:room(room):set_affiliation(actor, jid, affiliation)
     return cls._call_room_method(
         ast.LiteralString(room_jid), ast.Var('set_affiliation'), [
             ast.Boolean(True),
             ast.LiteralString(jid),
             ast.LiteralString(affiliation) if affiliation else ast.nil
         ])
Esempio n. 3
0
 def save(cls, room_jid, force):
     # muc:room(room):save(force)
     return cls._call_room_method(ast.LiteralString(room_jid),
                                  ast.Var('save'), [ast.Boolean(force)])
Esempio n. 4
0
 def destroy(cls, room_jid):
     # muc:room(room):destroy()
     return cls._call_room_method(ast.LiteralString(room_jid),
                                  ast.Var('destroy'), [])
Esempio n. 5
0
 def get_role(cls, room_jid, nick):
     # muc:room(room):get_role(nick)
     return cls._call_room_method(ast.LiteralString(room_jid),
                                  ast.Var('get_role'),
                                  [ast.LiteralString(nick)])
Esempio n. 6
0
 def get_affiliation(cls, room_jid, jid):
     # muc:room(room):get_affiliation(jid)
     return cls._call_room_method(ast.LiteralString(room_jid),
                                  ast.Var('get_affiliation'),
                                  [ast.Var(ast.LiteralString(jid))])
Esempio n. 7
0
 def create(cls, room_jid):
     # muc:create(room)
     return cls(
         ast.MethodCall(ast.Var('muc'), ast.Var('create'),
                        [ast.LiteralString(room_jid)]))
Esempio n. 8
0
 def _call_room_method(cls, room_jid, method_name, method_args):
     """Helper constructor - use other constructors!"""
     room = ast.MethodCall(ast.Var('muc'), ast.Var('room'), [room_jid])
     return cls(ast.MethodCall(room, method_name, method_args))