示例#1
0
文件: inbound.c 项目: TheWug/hexchat
static int
is_hilight (char *from, char *text, session *sess, server *serv)
{
	if (alert_match_word (from, prefs.hex_irc_no_hilight))
		return 0;

	text = strip_color (text, -1, STRIP_ALL);

	if (alert_match_text (text, serv->nick) ||
		 alert_match_text (text, prefs.hex_irc_extra_hilight) ||
		 alert_match_word (from, prefs.hex_irc_nick_hilight))
	{
		g_free (text);
		if (sess != current_tab)
		{
			sess->nick_said = TRUE;
			lastact_update (sess);
		}
		fe_set_hilight (sess);
		return 1;
	}

	g_free (text);
	return 0;
}
示例#2
0
static void
tray_priv (char *from, char *text)
{
	const char *network;

	if (alert_match_word (from, prefs.hex_irc_no_hilight))
		return;

	tray_set_flash (ICON_MSG);

	network = hexchat_get_info (ph, "network");
	if (!network)
		network = hexchat_get_info (ph, "server");

	tray_priv_count++;
	if (tray_priv_count == 1)
		tray_set_tipf (_(DISPLAY_NAME": Private message from: %s (%s)"),
							from, network);
	else
		tray_set_tipf (_(DISPLAY_NAME": %u private messages, latest from: %s (%s)"),
							tray_priv_count, from, network);

	if (prefs.hex_input_balloon_priv)
		tray_set_balloonf (text, _("Private message from: %s (%s)"),
								 from, network);
}
示例#3
0
文件: inbound.c 项目: arinity/gchat
gboolean
alert_match_text (char *text, char *masks)
{
    unsigned char *p = text;
    unsigned char endchar;
    int res;

    if (masks[0] == 0)
        return FALSE;

    while (1)
    {
        if (*p >= '0' && *p <= '9')
        {
            p++;
            continue;
        }

        /* if it's RFC1459 <special>, it can be inside a word */
        switch (*p)
        {
        case '-':
        case '[':
        case ']':
        case '\\':
        case '`':
        case '^':
        case '{':
        case '}':
        case '_':
        case '|':
            p++;
            continue;
        }

        /* if it's a 0, space or comma, the word has ended. */
        if (*p == 0 || *p == ' ' || *p == ',' ||
                /* if it's anything BUT a letter, the word has ended. */
                (!g_unichar_isalpha (g_utf8_get_char (p))))
        {
            endchar = *p;
            *p = 0;
            res = alert_match_word (text, masks);
            *p = endchar;

            if (res)
                return TRUE;        /* yes, matched! */

            text = p + g_utf8_skip[p[0]];
            if (*p == 0)
                return FALSE;
        }

        p += g_utf8_skip[p[0]];
    }
}
static gboolean
is_ignored (char *nick)
{
	const char *no_hilight;

	if (hexchat_get_prefs (ph, "irc_no_hilight", &no_hilight, NULL) == 1 && no_hilight)
	{
		return alert_match_word (nick, (char*)no_hilight);
	}
	return FALSE;
}