コード例 #1
0
 def writeout(self):
     # Write to socket/server
     while True:
         try:
             (priority, sent, line) = self.output.get(True, 1)
         except Empty:
             if self.quitting:
                 break
             else:
                 continue
         try:
             while self.last + Config.getfloat("Connection", "antiflood") * (1 + (len(line) > 300) + (priority > 10)) >= time.time():
                 time.sleep(0.5)
             # Warn admins if the wait is too long
             if priority < 10 and time.time() > sent + Config.getint("Connection", "maxdelay"):
                 if time.time() > self.wait_warned + 300:
                     self.wait_warned = time.time()
                     admin_msg("Message output message delay is too long: %.1f seconds" % (time.time() - sent))
             self.sock.send(encode(line) + CRLF)
             self.last = time.time()
             print "%s >>> %s" % (time.asctime(),encode(line),)
             self.output.task_done()
             if line[:4].upper() == "QUIT":
                 break
         except socket.error as exc:
             raise Reboot(exc)
コード例 #2
0
 def writeout(self):
     # Write to socket/server
     while True:
         try:
             (priority, sent, line) = self.output.get(True, 1)
         except Empty:
             if self.quitting:
                 break
             else:
                 continue
         try:
             while self.last + Config.getfloat(
                     "Connection",
                     "antiflood") * (1 + (len(line) > 300) +
                                     (priority > 10)) >= time.time():
                 time.sleep(0.5)
             # Warn admins if the wait is too long
             if priority < 10 and time.time() > sent + Config.getint(
                     "Connection", "maxdelay"):
                 if time.time() > self.wait_warned + 300:
                     self.wait_warned = time.time()
                     admin_msg(
                         "Message output message delay is too long: %.1f seconds"
                         % (time.time() - sent))
             self.sock.send(encode(line) + CRLF)
             self.last = time.time()
             print "%s >> %s" % (
                 time.strftime("%Y%m%d %H:%M:%S |"),
                 encode(line),
             )
             self.output.task_done()
             if line[:4].upper() == "QUIT":
                 break
         except socket.error as exc:
             raise Reboot(exc)
コード例 #3
0
 def write(self, line, priority=10):
     # Write to output queue
     self.output.put((priority, time.time(), line))
     # Warn admins if the queue is too long
     if self.output.qsize() > Config.getint("Connection", "maxqueue"):
         if time.time() > self.queue_warned + 300:
             self.queue_warned = time.time()
             admin_msg("Message output queue length is too long: %s messages" % self.output.qsize())
コード例 #4
0
 def write(self, line, priority=10):
     # Write to output queue
     self.output.put((priority, time.time(), line))
     # Warn admins if the queue is too long
     if self.output.qsize() > Config.getint("Connection", "maxqueue"):
         if time.time() > self.queue_warned + 300:
             self.queue_warned = time.time()
             admin_msg(
                 "Message output queue length is too long: %s messages" %
                 self.output.qsize())
コード例 #5
0
ファイル: tick.py プロジェクト: berten/merlin
 def current(self, message, user, params):
     tick = Updates.load()
     if tick is None:
         if time.time() > GameSetup.getint("round_start_time"):
             tdiff = abs(int(GameSetup.getint("round_start_time") - time.time())) / GameSetup.getint("tick_speed") + 1
             message.reply("It *should* be tick %s, but I'm not ticking. Did someone forget to press the magic button?" % tdiff)
             if tdiff > 1:
                 admin_msg("It should be tick %s, but I'm not ticking!" % tdiff)
         else:
             message.reply("Ticks haven't started yet, go back to masturbating.")
     else:
         message.reply(str(tick))
コード例 #6
0
ファイル: tick.py プロジェクト: berten/merlin
 def current(self, message, user, params):
     tick = Updates.load()
     if tick is None:
         if time.time() > GameSetup.getint("round_start_time"):
             tdiff = abs(
                 int(GameSetup.getint("round_start_time") -
                     time.time())) / GameSetup.getint("tick_speed") + 1
             message.reply(
                 "It *should* be tick %s, but I'm not ticking. Did someone forget to press the magic button?"
                 % tdiff)
             if tdiff > 1:
                 admin_msg("It should be tick %s, but I'm not ticking!" %
                           tdiff)
         else:
             message.reply(
                 "Ticks haven't started yet, go back to masturbating.")
     else:
         message.reply(str(tick))
コード例 #7
0
ファイル: adminmsg.py プロジェクト: JDD/merlin
 def execute(self, message, user, params):
     admin_msg("%s (%s)" % (params.group(1), user.name))
コード例 #8
0
ファイル: adminmsg.py プロジェクト: JDD/merlin
 def robocop(self, message, text):
     if text[:3] == "!#!":
         text = text[3:].replace("!#!", " ")
     admin_msg(text)
コード例 #9
0
ファイル: adminmsg.py プロジェクト: berten/merlin
 def execute(self, message, user, params):
     admin_msg("%s (%s)" % (params.group(1), user.name))
コード例 #10
0
ファイル: adminmsg.py プロジェクト: berten/merlin
 def robocop(self, message, text):
     if text[:3] == "!#!":
         text = text[3:].replace("!#!", " ")
     admin_msg(text)