Пример #1
0
 def remind(self, id=0):
     if not id in self.tasks:
         return
     self.api.information('Task %s: %s' % (id, self.tasks[id][1]), 'Info')
     if self.config.get('beep', '') == 'true':
         curses.beep()
     timed_event = timed_events.DelayedEvent(self.tasks[id][0], self.remind,
                                             id)
     self.api.add_timed_event(timed_event)
Пример #2
0
    def command_delayed(self, args):
        if args is None:
            return
        delay_str, txt = args
        delay = common.parse_str_to_secs(delay_str)
        if not delay_str:
            return

        tab = self.api.current_tab()
        timed_event = timed_events.DelayedEvent(delay, self.say, (tab, txt))
        self.api.add_timed_event(timed_event)
Пример #3
0
    def command_delayed(self, arg):
        args = common.shell_split(arg)
        if len(args) != 2:
            return
        delay = common.parse_str_to_secs(args[0])
        if not delay:
            return

        tab = self.api.current_tab()
        timed_event = timed_events.DelayedEvent(delay, self.say,
                                                (tab, args[1]))
        self.api.add_timed_event(timed_event)
Пример #4
0
 def set_paused_delay(self, composing):
     """
     we create a timed event that will put us to paused
     in a few seconds
     """
     if not config.get_by_tabname('send_chat_states', self.general_jid):
         return
     # First, cancel the delay if it already exists, before rescheduling
     # it at a new date
     self.cancel_paused_delay()
     new_event = timed_events.DelayedEvent(4, self.send_chat_state,
                                           'paused')
     self.core.add_timed_event(new_event)
     self.timed_event_paused = new_event
Пример #5
0
    def command_remind(self, arg):
        args = common.shell_split(arg)
        if len(args) < 2:
            return
        time = common.parse_str_to_secs(args[0])
        if not time:
            return

        self.tasks[self.count] = (time, args[1])
        timed_event = timed_events.DelayedEvent(time, self.remind, self.count)
        self.api.add_timed_event(timed_event)
        self.api.information(
            'Task %s added: %s every %s.' %
            (self.count, args[1], common.parse_secs_to_str(time)), 'Info')
        self.count += 1