Beispiel #1
0
def queryNotice_cb(time, server, from_str, message):
    """
		A user sends a notice directly to the maki user.
	"""
    nick = parse_from(from_str)[0]

    (server_tab, tab) = gui.tabs.search_tabs(server, nick)

    if tab:
        if tab.name != nick:
            # correct notation of tab name
            tab.name = nick

    if tab:
        tab.write(
            time, "-<font foreground='%s' weight='bold'>%s</font>- "
            "<font foreground='%s'>%s</font>" %
            (color.get_nick_color(nick), markup.escape(nick),
             color.get_text_color(nick), markup.escape(message)))
    else:
        server_tab.current_write(
            time, "-<font foreground='%s' weight='bold'>%s</font>- "
            "<font foreground='%s'>%s</font>" %
            (color.get_nick_color(nick), markup.escape(nick),
             color.get_text_color(nick), markup.escape(message)))
Beispiel #2
0
def queryNotice_cb(time, server, from_str, message):
    """
		A user sends a notice directly to the maki user.
	"""
    nick = parse_from(from_str)[0]

    (server_tab, tab) = gui.tabs.search_tabs(server, nick)

    if tab:
        if tab.name != nick:
            # correct notation of tab name
            tab.name = nick

    if tab:
        tab.write(
            time,
            "-<font foreground='%s' weight='bold'>%s</font>- "
            "<font foreground='%s'>%s</font>"
            % (color.get_nick_color(nick), markup.escape(nick), color.get_text_color(nick), markup.escape(message)),
        )
    else:
        server_tab.current_write(
            time,
            "-<font foreground='%s' weight='bold'>%s</font>- "
            "<font foreground='%s'>%s</font>"
            % (color.get_nick_color(nick), markup.escape(nick), color.get_text_color(nick), markup.escape(message)),
        )
Beispiel #3
0
def ownNotice_cb(time, server, target, message):
    """
		if query channel with ``target`` exists, print
		the notice there, else print it on the current
		channel of the network which is identified by
		`server`
	"""
    server_tab, tab = gui.tabs.search_tabs(server, target)
    ownNickColor = color.get_color_by_key("own_nick")
    ownNick = server_tab.nick

    if tab:
        tab.write(
            time,
            "&gt;<font foreground='%s' weight='bold'>%s</font>&lt; "
            "<font foreground='%s'>%s</font>"
            % (
                color.get_nick_color(target),
                markup.escape(target),
                color.get_text_color(target),
                markup.escape(message),
            ),
        )
    else:
        server_tab.current_write(
            time,
            "&gt;<font foreground='%s' weight='bold'>%s</font>&lt; "
            "<font foreground='%s'>%s</font>"
            % (
                color.get_nick_color(target),
                markup.escape(target),
                color.get_text_color(target),
                markup.escape(message),
            ),
        )
Beispiel #4
0
def userAction_cb(time, server, from_str, channel, action):
    """ normal action """

    nick = parse_from(from_str)[0]
    (server_tab, channel_tab) = gui.tabs.search_tabs(server, channel)

    if nick.lower() == server_tab.nick.lower():
        ownAction_cb(time, server, channel, action)
        return

    elif channel.lower() == server_tab.nick.lower():
        actionQuery_cb(time, server, from_str, action)
        return

    action = markup.escape(action)

    if isHighlighted(server_tab, action):
        type = gui.tabs.HIGHACTION
        actionString = action
        gui.mgmt.set_urgent(True)

    else:
        type = gui.tabs.ACTION
        actionString = "<font foreground='%s'>%s</font>" % (
            color.get_text_color(nick), action)

    channel_tab.write(time,
                      "<font foreground='%s' weight='bold'>%s</font> %s" %
                      (color.get_nick_color(nick), nick, actionString),
                      type,
                      group_string=nick)
Beispiel #5
0
def userNotice_cb(time, server, from_str, target, message):
    """ An incoming notice """
    nick = parse_from(from_str)[0]
    (server_tab, target_tab) = gui.tabs.search_tabs(server, target)

    if nick.lower() == server_tab.nick.lower():
        # we wrote that notice
        ownNotice_cb(time, server, target, message)
        return

    elif target.lower() == server_tab.nick.lower():
        # it's supposed to be a private (query) message
        queryNotice_cb(time, server, from_str, message)
        return

    message = "-<font foreground='%s' weight='bold'>%s</font>- "\
        "<font foreground='%s'>%s</font>" % (
       color.get_nick_color(nick),
       markup.escape(nick),
       color.get_text_color(nick),
       markup.escape(message))

    if target_tab == None:
        # global notice
        server_tab.current_write(time, message)
    else:
        # channel/query notice
        target_tab.write(time, message)
Beispiel #6
0
def userAction_cb(time, server, from_str, channel, action):
    """ normal action """

    nick = parse_from(from_str)[0]
    (server_tab, channel_tab) = gui.tabs.search_tabs(server, channel)

    if nick.lower() == server_tab.nick.lower():
        ownAction_cb(time, server, channel, action)
        return

    elif channel.lower() == server_tab.nick.lower():
        actionQuery_cb(time, server, from_str, action)
        return

    action = markup.escape(action)

    if isHighlighted(server_tab, action):
        type = gui.tabs.HIGHACTION
        actionString = action
        gui.mgmt.set_urgent(True)

    else:
        type = gui.tabs.ACTION
        actionString = "<font foreground='%s'>%s</font>" % (color.get_text_color(nick), action)

    channel_tab.write(
        time,
        "<font foreground='%s' weight='bold'>%s</font> %s" % (color.get_nick_color(nick), nick, actionString),
        type,
        group_string=nick,
    )
Beispiel #7
0
def userNotice_cb(time, server, from_str, target, message):
    """ An incoming notice """
    nick = parse_from(from_str)[0]
    (server_tab, target_tab) = gui.tabs.search_tabs(server, target)

    if nick.lower() == server_tab.nick.lower():
        # we wrote that notice
        ownNotice_cb(time, server, target, message)
        return

    elif target.lower() == server_tab.nick.lower():
        # it's supposed to be a private (query) message
        queryNotice_cb(time, server, from_str, message)
        return

    message = "-<font foreground='%s' weight='bold'>%s</font>- " "<font foreground='%s'>%s</font>" % (
        color.get_nick_color(nick),
        markup.escape(nick),
        color.get_text_color(nick),
        markup.escape(message),
    )

    if target_tab == None:
        # global notice
        server_tab.current_write(time, message)
    else:
        # channel/query notice
        target_tab.write(time, message)
Beispiel #8
0
def queryCTCP_cb(time, server, from_str, message):
    """
		A user sends us a CTCP request over a query.

		If no query window is open, send it to the server tab.
	"""
    nick = parse_from(from_str)[0]
    (server_tab, tab) = gui.tabs.search_tabs(server, nick)

    if tab:
        tab.write(
            time, "&lt;CTCP:<font foreground='%s' weight='bold'>%s"
            "</font>&gt; <font foreground='%s'>%s</font>" %
            (color.get_nick_color(nick), markup.escape(nick),
             color.get_text_color(nick), markup.escape(message)))
    else:
        server_tab.current_write(
            time, "&lt;CTCP:<font foreground='%s' weight='bold'>%s"
            "</font>&gt; <font foreground='%s'>%s</font>" %
            (color.get_nick_color(nick), markup.escape(nick),
             color.get_text_color(nick), markup.escape(message)))
Beispiel #9
0
def ownNotice_cb(time, server, target, message):
    """
		if query channel with ``target`` exists, print
		the notice there, else print it on the current
		channel of the network which is identified by
		`server`
	"""
    server_tab, tab = gui.tabs.search_tabs(server, target)
    ownNickColor = color.get_color_by_key("own_nick")
    ownNick = server_tab.nick

    if tab:
        tab.write(
            time, "&gt;<font foreground='%s' weight='bold'>%s</font>&lt; "
            "<font foreground='%s'>%s</font>" %
            (color.get_nick_color(target), markup.escape(target),
             color.get_text_color(target), markup.escape(message)))
    else:
        server_tab.current_write(
            time, "&gt;<font foreground='%s' weight='bold'>%s</font>&lt; "
            "<font foreground='%s'>%s</font>" %
            (color.get_nick_color(target), markup.escape(target),
             color.get_text_color(target), markup.escape(message)))
Beispiel #10
0
def queryCTCP_cb(time, server, from_str, message):
    """
		A user sends us a CTCP request over a query.

		If no query window is open, send it to the server tab.
	"""
    nick = parse_from(from_str)[0]
    (server_tab, tab) = gui.tabs.search_tabs(server, nick)

    if tab:
        tab.write(
            time,
            "&lt;CTCP:<font foreground='%s' weight='bold'>%s"
            "</font>&gt; <font foreground='%s'>%s</font>"
            % (color.get_nick_color(nick), markup.escape(nick), color.get_text_color(nick), markup.escape(message)),
        )
    else:
        server_tab.current_write(
            time,
            "&lt;CTCP:<font foreground='%s' weight='bold'>%s"
            "</font>&gt; <font foreground='%s'>%s</font>"
            % (color.get_nick_color(nick), markup.escape(nick), color.get_text_color(nick), markup.escape(message)),
        )
Beispiel #11
0
def userMessage_cb(timestamp, server, from_str, channel, message):
    """
		PRIVMSGs are coming in here.
	"""
    nick = parse_from(from_str)[0]
    (server_tab, channel_tab) = gui.tabs.search_tabs(server, channel)

    if server_tab == None:
        return  # happens if the target server does not exist

    if nick.lower() == server_tab.nick.lower():
        ownMessage_cb(timestamp, server, channel, message)
        return

    elif channel.lower() == server_tab.nick.lower():
        userQuery_cb(timestamp, server, from_str, message)
        return

    message = markup.escape(message)

    if isHighlighted(server_tab, message):
        # set mode to highlight and disable setting
        # of text color for the main message (would
        # override channelPrint() highlight color)

        type = gui.tabs.HIGHMESSAGE
        messageString = message
        gui.mgmt.set_urgent(True)
    else:
        # no highlight, normal message type and
        # text color is allowed.

        type = gui.tabs.MESSAGE
        messageString = "<font foreground='%s'>%s</font>" % (
            color.get_text_color(nick), message)

    channel_tab.write(
        timestamp,
        "&lt;%s<font foreground='%s' weight='bold'>%s</font>&gt; %s" % (
            _getPrefix(server, channel, nick),
            color.get_nick_color(nick),
            markup.escape(nick),
            messageString,
        ),
        type,
        group_string=nick)
Beispiel #12
0
def userMessage_cb(timestamp, server, from_str, channel, message):
    """
		PRIVMSGs are coming in here.
	"""
    nick = parse_from(from_str)[0]
    (server_tab, channel_tab) = gui.tabs.search_tabs(server, channel)

    if server_tab == None:
        return  # happens if the target server does not exist

    if nick.lower() == server_tab.nick.lower():
        ownMessage_cb(timestamp, server, channel, message)
        return

    elif channel.lower() == server_tab.nick.lower():
        userQuery_cb(timestamp, server, from_str, message)
        return

    message = markup.escape(message)

    if isHighlighted(server_tab, message):
        # set mode to highlight and disable setting
        # of text color for the main message (would
        # override channelPrint() highlight color)

        type = gui.tabs.HIGHMESSAGE
        messageString = message
        gui.mgmt.set_urgent(True)
    else:
        # no highlight, normal message type and
        # text color is allowed.

        type = gui.tabs.MESSAGE
        messageString = "<font foreground='%s'>%s</font>" % (color.get_text_color(nick), message)

    channel_tab.write(
        timestamp,
        "&lt;%s<font foreground='%s' weight='bold'>%s</font>&gt; %s"
        % (_getPrefix(server, channel, nick), color.get_nick_color(nick), markup.escape(nick), messageString),
        type,
        group_string=nick,
    )