示例#1
0
 def OnBlipSubmitted(self, event, wavelet):
     """ new blip added. here is where the command dispatching takes place. """
     wevent = WaveEvent()
     wevent.parse(self, event, wavelet)
     wevent.auth = wevent.userhost
     wave = wevent.chan
     #wave.data.seenblips += 1
     wave.data.lastedited = time.time()
     self.doevent(wevent)
示例#2
0
文件: bot.py 项目: melmothx/jsonbot
 def OnBlipSubmitted(self, event, wavelet):
     """ new blip added. here is where the command dispatching takes place. """
     wevent = WaveEvent()
     wevent.parse(self, event, wavelet)
     wevent.auth = wevent.userhost
     wave = wevent.chan
     #wave.data.seenblips += 1
     wave.data.lastedited = time.time()
     self.doevent(wevent)
示例#3
0
文件: bot.py 项目: melmothx/jsonbot
 def OnSelfAdded(self, event, wavelet):
     """ invoked when the robot has been added. """
     logging.warn('wave - joined "%s" (%s) wave' % (wavelet._wave_id, wavelet._title))
     wevent = WaveEvent()
     wevent.parse(self, event, wavelet)
     logging.debug("wave - owner is %s" % wevent.chan.data.owner)
     wevent.chan.data.json_data = wavelet.serialize()
     wevent.chan.save()
     wevent.reply("Welcome to %s (see !help) or http://jsonbot.appspot.com/docs/html/index.html" % getversion())
     callbacks.check(self, wevent)
示例#4
0
文件: bot.py 项目: melmothx/jsonbot
 def OnParticipantsChanged(self, event, wavelet):
     """ invoked when any participants have been added/removed. """
     wevent = WaveEvent()
     wevent.parse(self, event, wavelet)
     whitelist = wevent.chan.data.whitelist
     if not whitelist: whitelist = wevent.chan.data.whitelist = []
     participants = event.participants_added
     logging.warning("wave - %s - %s joined" % (wevent.chan.data.title, participants))
     if wevent.chan.data.protected:
         for target in participants:
             if target not in whitelist and target != '*****@*****.**' and target != wevent.chan.data.owner:
                 logging.warn("wave - %s - setting %s to read-only" % (wevent.chan.data.title, target))
                 wevent.root.participants.set_role(target, waveapi.wavelet.Participants.ROLE_READ_ONLY)
     callbacks.check(self, wevent)
示例#5
0
 def OnParticipantsChanged(self, event, wavelet):
     """ invoked when any participants have been added/removed. """
     wevent = WaveEvent()
     wevent.parse(self, event, wavelet)
     whitelist = wevent.chan.data.whitelist
     if not whitelist: whitelist = wevent.chan.data.whitelist = []
     participants = event.participants_added
     logging.warning("wave - %s - %s joined" %
                     (wevent.chan.data.title, participants))
     if wevent.chan.data.protected:
         for target in participants:
             if target not in whitelist and target != '*****@*****.**' and target != wevent.chan.data.owner:
                 logging.warn("wave - %s - setting %s to read-only" %
                              (wevent.chan.data.title, target))
                 wevent.root.participants.set_role(
                     target, waveapi.wavelet.Participants.ROLE_READ_ONLY)
     callbacks.check(self, wevent)
示例#6
0
 def OnSelfAdded(self, event, wavelet):
     """ invoked when the robot has been added. """
     logging.warn('wave - joined "%s" (%s) wave' %
                  (wavelet._wave_id, wavelet._title))
     wevent = WaveEvent()
     wevent.parse(self, event, wavelet)
     logging.debug("wave - owner is %s" % wevent.chan.data.owner)
     wevent.chan.data.json_data = wavelet.serialize()
     wevent.chan.save()
     wevent.reply(
         "Welcome to %s (see !help) or http://jsonbot.appspot.com/docs/html/index.html"
         % getversion())
     callbacks.check(self, wevent)