コード例 #1
0
	def irc_PRIVMSG(self, prefix, params):
		"""
		Called when we get a message.
		"""
		user = prefix
		channel = params[0]
		message = params[-1]

		if not message:
			# Don't raise an exception if we get blank message.
			return

		if message[0] == X_DELIM:
			m = ctcpExtract(message)
			if m['extended']:
				self.ctcpQuery(user, channel, m['extended'], params)

			if not m['normal']:
				return

			message = ' '.join(m['normal'])
		
		nick, ident, host = processHostmask(prefix)
		if nick == self.nickname:
			# take note of our prefix! (for message length calculation
			self.prefixlen = len(prefix)
		# These are actually messages, ctcp's aren't dispatched here
		self.dispatch(self, "privmsged", prefix=prefix, params=params, hostmask=user, target=channel, msg=message, 
			nick=nick, ident=ident, host=host)
コード例 #2
0
ファイル: client.py プロジェクト: ckx/pyBurlyBot
	def irc_PRIVMSG(self, prefix, params):
		"""
		Called when we get a message.
		"""
		if self.debug >= 2: print "INCOMING PRIVMSG:", prefix, params
		user = prefix
		channel = params[0]
		message = params[-1]
		if not message:
			# Don't raise an exception if we get blank message.
			return

		if message[0] == X_DELIM:
			m = ctcpExtract(message)
			if m['extended']:
				self.ctcpQuery(user, channel, m['extended'], params)

			if not m['normal']:
				return

			message = ' '.join(m['normal'])
		
		nick, ident, host = processHostmask(prefix)
		if nick == self.nickname:
			# take note of our prefix! (for message length calculation
			self.prefixlen = len(prefix)
		# These are actually messages, ctcp's aren't dispatched here
		self.dispatch(self, "privmsged", prefix=prefix, params=params, hostmask=user, target=channel, msg=message, 
			nick=nick, ident=ident, host=host)
コード例 #3
0
ファイル: client.py プロジェクト: ckx/pyBurlyBot
    def irc_NOTICE(self, prefix, params):
        """
		Called when a user gets a notice.
		"""
        if self.debug >= 2: print "INCOMING NOTICE:", prefix, params
        user = prefix
        channel = params[0]
        message = params[-1]

        if message[0] == X_DELIM:
            m = ctcpExtract(message)
            if m['extended']:
                self.ctcpReply(user, channel, m['extended'], params)
            if not m['normal']:
                return
            message = ' '.join(m['normal'])

        nick, ident, host = processHostmask(prefix)
        if nick == self.nickname:
            # take note of our prefix! (for message length calculation
            self.prefixlen = len(prefix)
        self.dispatch(self,
                      "noticed",
                      prefix=prefix,
                      params=params,
                      hostmask=user,
                      target=channel,
                      msg=message,
                      nick=nick,
                      ident=ident,
                      host=host)
コード例 #4
0
ファイル: client.py プロジェクト: mmattice/tx-ts6
 def _privmsg(self, source, dest, message):
     if (len(message) > 0) and (message[0] == '\x01') and (message[-1] == '\x01'):
         m = ctcpExtract(message)
         if m['extended']:
             self.ctcpQuery(str(source), str(dest), m['extended'])
         if not m['normal']:
             return
         message = string.join(m['normal'], ' ')
     self.privmsg(str(source), str(dest), message)
コード例 #5
0
    def irc_PRIVMSG(self, prefix, params):
        channel = params[0]
        nickname = prefix.split("!")[0]
        d = irc.ctcpExtract(params[1])
        if d["extended"] != []:
            message = d["extended"][0][1]
            self.emit("me-command", channel, nickname, message)

        else:
            irc.IRCClient.irc_PRIVMSG(self, prefix, params)
コード例 #6
0
 def _privmsg(self, source, dest, message):
     if (len(message) > 0) and (message[0] == '\x01') and (message[-1]
                                                           == '\x01'):
         m = ctcpExtract(message)
         if m['extended']:
             self.ctcpQuery(str(source), str(dest), m['extended'])
         if not m['normal']:
             return
         message = string.join(m['normal'], ' ')
     self.privmsg(str(source), str(dest), message)
コード例 #7
0
ファイル: parser.py プロジェクト: kxz/omnipresence
def parse_ctcpable_directed_message(command, params):
    kwargs = parse_directed_message(command, params)
    if params[1].startswith(X_DELIM):
        # CTCP extended message quoting is pathologically designed, but
        # nobody actually sends more than one at a time.  Thankfully.
        tag, data = ctcpExtract(params[1])['extended'][0]
        kwargs['content'] = data
        if tag.lower() == 'action':
            kwargs['action'] = 'action'
        else:
            kwargs['action'] = ('ctcpquery' if command == 'PRIVMSG'
                                else 'ctcpreply')
            kwargs['subaction'] = tag
    return kwargs
コード例 #8
0
ファイル: core.py プロジェクト: B-Rich/hackabot
    def notice(self, to, msg):
        irc.IRCClient.notice(self, to, msg)

        if msg and msg[0] == irc.X_DELIM:
            # Ignore any CTCP stuff
            ctcp = irc.ctcpExtract(msg)
            if not ctcp['normal']:
                return
            msg = " ".join(ctcp['normal'])

        event = {
                'internal': True,
                'type': 'notice',
                'sent_by': self.nickname,
                'sent_to': to,
                'reply_to': None,
                'text': msg,
                'time': time.time()
                }

        self.manager.plugins.hook(self, event)
コード例 #9
0
    def notice(self, to, msg):
        irc.IRCClient.notice(self, to, msg)

        if msg and msg[0] == irc.X_DELIM:
            # Ignore any CTCP stuff
            ctcp = irc.ctcpExtract(msg)
            if not ctcp['normal']:
                return
            msg = " ".join(ctcp['normal'])

        event = {
            'internal': True,
            'type': 'notice',
            'sent_by': self.nickname,
            'sent_to': to,
            'reply_to': None,
            'text': msg,
            'time': time.time()
        }

        self.manager.plugins.hook(self, event)
コード例 #10
0
ファイル: client.py プロジェクト: ckx/pyBurlyBot
	def irc_NOTICE(self, prefix, params):
		"""
		Called when a user gets a notice.
		"""
		if self.debug >= 2: print "INCOMING NOTICE:", prefix, params
		user = prefix
		channel = params[0]
		message = params[-1]

		if message[0] == X_DELIM:
			m = ctcpExtract(message)
			if m['extended']:
				self.ctcpReply(user, channel, m['extended'], params)
			if not m['normal']:
				return
			message = ' '.join(m['normal'])
		
		nick, ident, host = processHostmask(prefix)
		if nick == self.nickname:
			# take note of our prefix! (for message length calculation
			self.prefixlen = len(prefix)
		self.dispatch(self, "noticed", prefix=prefix, params=params, hostmask=user, target=channel, msg=message,
			nick=nick, ident=ident, host=host)