def handle_presence_unsubscribe(self, stanza): self.logger.info(u"{0} canceled presence subscription" .format(stanza.from_jid)) presence = Presence(to_jid = stanza.from_jid.bare(), stanza_type = "unsubscribe") nick = get_nick(stanza.from_jid) self.message_bus.send_sys_msg(stanza, u'{0} 离开群'.format(nick)) del_member(stanza.from_jid.bare()) r =[stanza.make_accept_response(), presence] return r
def rm(self, stanza, *args): """剔除用户""" # XXX 没有效果 emails = [get_member(nick=n) for n in args] if len(emails) < 1: return self.help(stanza, "rm") for e in emails: jid = JID(e) del_member(jid) self._message_bus.send_unsubscribe(jid)
def handle_presence_unsubscribed(self, stanza): self.logger.info(u"{0!r} acknowledged our subscrption cancelation" .format(stanza.from_jid)) del_member(stanza.from_jid.bare()) return True