Example #1
0
    def action_cb(self, time, server, from_str, target, action):
        nick = from_str.split("!")[0]
        own_nick = self.get_nick(server)

        if own_nick:
            own_nick = own_nick.lower()

        if not own_nick:
            return
        elif own_nick == nick.lower():
            return

        def in_notify():
            self.notify(target, "%s %s" % (nick, self.escape(action)))

        if own_nick == target.lower():
            self.notify(nick, self.escape(action))
        elif self.has_highlight(action, own_nick):
            in_notify()
        elif self.notify_target(server, target):
            self.notify("%s:%s:%s" % (server, target, nick),
                        self.escape(action))
        else:
            for word in config.get_list("chatting", "highlight_words", []):
                if self.has_highlight(action, word):
                    in_notify()
                    break
Example #2
0
	def action_cb (self, time, server, from_str, target, action):
		nick = from_str.split("!")[0]
		own_nick = self.get_nick(server)

		if own_nick:
			own_nick = own_nick.lower()

		if not own_nick:
			return
		elif own_nick == nick.lower():
			return

		def in_notify():
			self.notify(target, "%s %s" % (nick, self.escape(action)))

		if own_nick == target.lower():
			self.notify(nick, self.escape(action))
		elif self.has_highlight(action, own_nick):
			in_notify()
		elif self.notify_target(server, target):
			self.notify("%s:%s:%s" % (server, target, nick),
						self.escape(action))
		else:
			for word in config.get_list("chatting","highlight_words",[]):
				if self.has_highlight(action, word):
					in_notify()
					break
Example #3
0
def _hide_output(tab, what, own=False):
    """ Returns bool.
		Check if the message type determined by "what"
		shall be hidden or not.
		tab should be a TekkaServer, -Channel or -Query
	"""
    if type(tab) == gui.tabs.TekkaChannel:
        cat = "channel_%s_%s" % (tab.server.name.lower(), tab.name.lower())
    elif type(tab) == gui.tabs.TekkaQuery:
        cat = "query_%s_%s" % (tab.server.name.lower(), tab.name.lower())
    else:
        return False

    hide = what in config.get_list(cat, "hide", [])
    hideOwn = what in config.get_list(cat, "hide_own", [])

    return (hide and not own) or (own and hideOwn) or (hide and own and not hideOwn)
Example #4
0
def _hide_output(tab, what, own=False):
    """ Returns bool.
		Check if the message type determined by "what"
		shall be hidden or not.
		tab should be a TekkaServer, -Channel or -Query
	"""
    if type(tab) == gui.tabs.TekkaChannel:
        cat = "channel_%s_%s" % (tab.server.name.lower(), tab.name.lower())
    elif type(tab) == gui.tabs.TekkaQuery:
        cat = "query_%s_%s" % (tab.server.name.lower(), tab.name.lower())
    else:
        return False

    hide = what in config.get_list(cat, "hide", [])
    hideOwn = what in config.get_list(cat, "hide_own", [])

    return ((hide and not own) or (own and hideOwn)
            or (hide and own and not hideOwn))
Example #5
0
def isHighlighted(server_tab, text):
    def has_highlight(text, needle):
        punctuation = string.punctuation + " \n\t"
        needle = needle.lower()
        ln = len(needle)
        for line in text.split("\n"):
            line = line.lower()
            i = line.find(needle)
            if i >= 0:
                if line[i - 1 : i] in punctuation and line[ln + i : ln + i + 1] in punctuation:
                    return True
        return False

    highlightwords = config.get_list("chatting", "highlight_words", [])
    highlightwords.append(server_tab.nick)

    for word in highlightwords:
        if has_highlight(text, word):
            return True
    return False
Example #6
0
def isHighlighted(server_tab, text):
    def has_highlight(text, needle):
        punctuation = string.punctuation + " \n\t"
        needle = needle.lower()
        ln = len(needle)
        for line in text.split("\n"):
            line = line.lower()
            i = line.find(needle)
            if i >= 0:
                if (line[i - 1:i] in punctuation
                        and line[ln + i:ln + i + 1] in punctuation):
                    return True
        return False

    highlightwords = config.get_list("chatting", "highlight_words", [])
    highlightwords.append(server_tab.nick)

    for word in highlightwords:
        if has_highlight(text, word):
            return True
    return False