Ejemplo n.º 1
0
 def handle_presence_subscribe(self, stanza):
     self.logger.info(u"{0} join us".format(stanza.from_jid))
     frm = stanza.from_jid
     presence = Presence(to_jid = frm, stanza_type = "subscribe")
     add_member(frm)
     set_online(frm, stanza.show)
     r =[stanza.make_accept_response(), presence]
     self.message_bus.send_sys_msg(stanza, new_member(frm))
     self.message_bus.send_back_msg(stanza, welcome(frm))
     return r
Ejemplo n.º 2
0
 def send_offline_message(self, stanza):
     """ 发送离线消息 """
     show = stanza.show
     frm = stanza.from_jid
     offline_message = get_info('offline_message', frm)
     if offline_message:
         offline_message = "离线期间的消息:\n" + offline_message
         m = self.make_message(frm, 'normal', offline_message)
         self._stream.send(m)
         set_online(frm, show)
         add_info('offline_message', '', frm)
Ejemplo n.º 3
0
 def handle_presence_available(self, stanza):
     self.logger.info(r"{0} has been online".format(stanza.from_jid))
     set_online(stanza.from_jid, stanza.show)
     self.message_bus.send_offline_message(stanza)