예제 #1
0
파일: client.py 프로젝트: ckx/pyBurlyBot
 def calcAvailableMsgLength(self, command):
     if self.prefixlen:
         # 510 = line terminator 508 = something else I'm not knowing about
         return 508 - self.prefixlen - len(
             lowQuote(command.encode(self.settings.encoding)))
     else:
         return self._safeMaximumLineLength(
             lowQuote(command.encode(
                 self.settings.encoding))) - 2  #line terminator
예제 #2
0
파일: irclogd.py 프로젝트: Valodim/irclogd
    def topic(self, t = None):
        if t is not None:
            self.topicmsg = str(t) if len(t) > 0 else None
            # for some reason, RPL_NOTOPIC is not a valid reply here! yeah... ask the rfc :P
            # we'll send this so there is at least an empty topic instead of none on clients which don't handle RPL_NOTOPIC here
            if len(t) == 0:
                self.server.sendMessage(irc.RPL_TOPIC, self.name, irc.lowQuote(str(t)))

        if self.topicmsg is not None:
            self.server.sendMessage(irc.RPL_TOPIC, self.name, irc.lowQuote(self.topicmsg))
        else:
            self.server.sendMessage(irc.RPL_NOTOPIC, self.name, irc.lowQuote("no topic is set"))
예제 #3
0
 def write(self, data):
   if data.split(' ')[0] == "ENBOT":
     self.enableBOT()
     return
  
   if self.__botIsEnable:
     database.client.write(self.__nickname, data)
   
   self.transport.write("%s\r\n" % irc.lowQuote(data.encode("utf-8")))
예제 #4
0
    def write(self, data):
        if data.split(' ')[0] == "ENBOT":
            self.enableBOT()
            return

        if self.__botIsEnable:
            database.client.write(self.__nickname, data)

        self.transport.write("%s\r\n" % irc.lowQuote(data.encode("utf-8")))
예제 #5
0
파일: peerchat.py 프로젝트: zdmccune/eaEmu
   def receive(self, sender, recipient, message):
      '''
      This is an override of the regular receive that always assumes
      it has been triggered by the PRIVMSG command. This one differs in that
      it checks for  the 'command' key in the message dict for UTM etc. and sends
      that command instead.

      Remember that sender and recipient are IChatClients, so use .user to get User
      '''
      if iwords.IGroup.providedBy(recipient):
         recipientName = '#' + recipient.name
      else:
         recipientName = recipient.name

      text = message.get('text', '<an unrepresentable message>')
      for line in text.splitlines():
         if 'command' not in message:
            assert False, 'need key: "command"'
         prefix = message.get('prefix', sender.avatar.getClientPrefix(message['command']))
         self.sendLine(":{0} {1} {2} {3}".format(prefix, message['command'],
                                                 recipientName,
                                                 line if 'raw' in message else ':'+lowQuote(line)))
예제 #6
0
 def write(self, data):
     self.transport.write(bytes("%s\r\n" % irc.lowQuote(data), 'utf-8'))
예제 #7
0
파일: client.py 프로젝트: ckx/pyBurlyBot
	def _reallySendLine(self, line):
		if self.debug >= 2: print "REALLY SENDING LINE:", repr(lowQuote(line) + self.delimiter)
		return LineReceiver.sendLine(self, lowQuote(line) + self.delimiter)
예제 #8
0
파일: client.py 프로젝트: ckx/pyBurlyBot
	def calcAvailableMsgLength(self, command):
		if self.prefixlen:
			# 510 = line terminator 508 = something else I'm not knowing about
			return 508 - self.prefixlen - len(lowQuote(command.encode(self.settings.encoding)))
		else:
			return self._safeMaximumLineLength(lowQuote(command.encode(self.settings.encoding))) - 2 #line terminator
예제 #9
0
 def test_lowquoteSanity(self):
     """Testing client-server level quote/dequote"""
     for s in stringSubjects:
         self.failUnlessEqual(s, irc.lowDequote(irc.lowQuote(s)))
예제 #10
0
 def write(self, data):
     self.transport.write("%s\r\n" % irc.lowQuote(data.encode("utf-8")))
예제 #11
0
 def test_lowquoteSanity(self):
     """Testing client-server level quote/dequote"""
     for s in stringSubjects:
         self.failUnlessEqual(s, irc.lowDequote(irc.lowQuote(s)))
예제 #12
0
 def write(self, data):
   self.transport.write("%s\r\n" % irc.lowQuote(data.encode("utf-8")))
예제 #13
0
	def _reallySendLine(self, line):
		return LineReceiver.sendLine(self, lowQuote(line) + self.delimiter)
예제 #14
0
파일: client.py 프로젝트: ckx/pyBurlyBot
 def _reallySendLine(self, line):
     if self.debug >= 2:
         print "REALLY SENDING LINE:", repr(lowQuote(line) + self.delimiter)
     return LineReceiver.sendLine(self, lowQuote(line) + self.delimiter)
예제 #15
0
파일: irclogd.py 프로젝트: Valodim/irclogd
 def notice(self, msg, prefix):
     self.server.sendMessage('NOTICE', irc.lowQuote(msg), frm=self.name, prefix=prefix)
예제 #16
0
파일: irclogd.py 프로젝트: Valodim/irclogd
 def msg(self, msg, prefix = None):
     self.server.sendMessage('PRIVMSG', irc.lowQuote(msg), frm=self.name, prefix=prefix if prefix is not None else self.server.hostname)
예제 #17
0
파일: irclogd.py 프로젝트: Valodim/irclogd
 def names(self):
     self.server.sendMessage(irc.RPL_NAMREPLY, self.name, irc.lowQuote(','.join([self.server.nick] + self.pusers.keys() )))
     self.server.sendMessage(irc.RPL_ENDOFNAMES, self.name, irc.lowQuote("End of /NAMES list"))