Esempio n. 1
0
void
fe_checkurl (char *buf)
{
	char t, *po, *urltext = nocasestrstr (buf, "http:");
	if (!urltext)
		urltext = nocasestrstr (buf, "www.");
	if (!urltext)
		urltext = nocasestrstr (buf, "ftp.");
	if (!urltext)
		urltext = nocasestrstr (buf, "ftp:");
	if (!urltext)
		urltext = nocasestrstr (buf, "irc://");
	if (!urltext)
		urltext = nocasestrstr (buf, "irc.");
	if (urltext)
	{
		po = strchr (urltext, ' ');
		if (po)
		{
			t = *po;
			*po = 0;
			url_addurl (urltext);
			*po = t;
		} else
			url_addurl (urltext);
	}
}
Esempio n. 2
0
static gboolean
chanlist_match (server *serv, const char *str)
{
	switch (serv->gui->chanlist_search_type)
	{
	case 1:
		return match (GTK_ENTRY (serv->gui->chanlist_wild)->text, str);
#ifndef WIN32
	case 2:
		if (!serv->gui->have_regex)
			return 0;
		/* regex returns 0 if it's a match: */
		return !regexec (&serv->gui->chanlist_match_regex, str, 1, NULL, REG_NOTBOL);
#endif
	default:	/* case 0: */
		return nocasestrstr (str, GTK_ENTRY (serv->gui->chanlist_wild)->text) ? 1 : 0;
	}
}
Esempio n. 3
0
void
fe_lastlog (session *sess, session *lastlog_sess, char *sstr)
{
    textentry *ent;

    ent = GTK_XTEXT(sess->gui->textgad)->text_first;
    if (!ent)
    {
        PrintText (lastlog_sess, "Search buffer is empty.\n");
    } else
    {
        do
        {
            if (nocasestrstr (ent->str, sstr))
                PrintText (lastlog_sess, ent->str);
            ent = ent->next;
        }
        while (ent);
    }
}
Esempio n. 4
0
static int
SearchNick (char *text, char *nicks)
{
	char S[300];	/* size of bluestring in xchatprefs */
	char *n;
	char *p;
	char *t;
	int ns;

	if (nicks == NULL)
		return 0;

	text = strip_color (text);

	safe_strcpy (S, nicks, sizeof (S));
	n = strtok (S, ",");
	while (n != NULL)
	{
		t = text;
		ns = strlen (n);
		while ((p = nocasestrstr (t, n)))
		{
			if ((p == text || !isalnum (*(p - 1))) && !isalnum (*(p + ns)))
			{
				free (text);
				return 1;
			}

			t = p + 1;
		}

		n = strtok (NULL, ",");
	}
	free (text);
	return 0;
}