Changeset 122:1c21cf10bb60 for wokkel/muc.py
- Timestamp:
- Oct 20, 2008, 10:41:53 PM (14 years ago)
- Branch:
- wokkel-muc-client-support-24
- Convert:
- svn:b33ecbfc-034c-dc11-8662-000475d9059e/branches/wokkel-muc-client-support-24@118
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wokkel/muc.py
r121 r122 279 279 280 280 281 281 class RoleRequest(AdminRequest): 282 def __init__(self, xs, method='get', role='none', a_jid=None, reason=None): 283 AdminRequest.__init__(self, xs, method) 284 285 i = self.query.addElement('item') 286 287 i['role'] = role 288 if a_jid: 289 i['jid'] = a_jid.full() 290 291 if reason: 292 i.addElement('reason', None, reason) 282 293 283 294 class GroupChat(domish.Element): … … 368 379 a = getattr(self, key, a) 369 380 if a is not None: 370 h[key] = str(a) 381 if key == 'since': 382 h[key] = a.strftime('%Y%m%dT%H:%M:%S') 383 else: 384 h[key] = str(a) 371 385 372 386 return h … … 1069 1083 1070 1084 1085 1071 1086 def history(self, to, message_list): 1072 1087 """ … … 1085 1100 self.xmlstream.send(m) 1086 1101 1087 def ban(self, to, ban_jid, frm, reason=None): 1088 1102 def _setAffiliation(self, frm, room_jid, affiliation, reason=None, a_jid=None): 1089 1103 iq = AffiliationRequest(self.xmlstream, 1090 1104 method='set', 1091 affiliation= 'outcast',1092 a_jid= ban_jid,1105 affiliation=affiliation, 1106 a_jid=a_jid, 1093 1107 reason=reason) 1094 iq['to'] = to.userhost() # this is a room jid, only send to room1108 iq['to'] = room_jid.userhost() # this is a room jid, only send to room 1095 1109 iq['from'] = frm.full() 1096 1110 return iq.send() 1097 1111 1098 1099 def kick(self, to, kick_jid, frm, reason=None): 1100 1101 iq = AffiliationRequest(self.xmlstream, 1102 method='set', 1103 a_jid=kick_jid, 1104 reason=reason) 1105 iq['to'] = to.userhost() # this is a room jid, only send to room 1112 def _setRole(self, frm, room_jid, a_jid=None, reason=None, role='none'): 1113 iq = RoleRequest(self.xmlstream, 1114 method='set', 1115 a_jid=a_jid, 1116 role=role, 1117 reason=reason) 1118 iq['to'] = room_jid.userhost() # this is a room jid, only send to room 1106 1119 iq['from'] = frm.full() 1107 1120 return iq.send() 1121 1122 def grantVoice(self, frm, room_jid, reason=None): 1123 return self._setAffiliation(frm, room_jid, 'participant', reason=reason) 1124 1125 1126 def ban(self, to, ban_jid, frm, reason=None): 1127 return self._setAffiliation(frm, to, 'outcast', a_jid=ban_jid, reason=reason) 1128 1129 1130 def kick(self, to, kick_jid, frm, reason=None): 1131 return self._setAffiliation(frm, to, 'none', a_jid=kick_jid, reason=reason) 1132
Note: See TracChangeset
for help on using the changeset viewer.