示例#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)])
示例#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
         ])
示例#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)])
示例#4
0
 def destroy(cls, room_jid):
     # muc:room(room):destroy()
     return cls._call_room_method(ast.LiteralString(room_jid),
                                  ast.Var('destroy'), [])
示例#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)])
示例#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))])
示例#7
0
 def create(cls, room_jid):
     # muc:create(room)
     return cls(
         ast.MethodCall(ast.Var('muc'), ast.Var('create'),
                        [ast.LiteralString(room_jid)]))
示例#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))