~ubuntu-branches/ubuntu/oneiric/irssi/oneiric

« back to all changes in this revision

Viewing changes to src/fe-common/core/hilight-text.c

  • Committer: Bazaar Package Importer
  • Author(s): Andres Rodriguez
  • Date: 2009-05-05 15:50:50 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090505155050-aoqlnpes7che9rtd
Tags: 0.8.13-1ubuntu1
* Merge from debian unstable (LP: #372411), remaining changes:
  - debian/patches: 03firsttimer_text
    + Adapt it so it tells you about connecting to irc.ubuntu.com and
      joining #ubuntu instead of irc.debian.org and #debian.
  - debian/patches: 90irc-ubuntu-com
* Fixed debian/patches/90irc-ubuntu-com for new irssi.conf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
static int never_hilight_level, default_hilight_level;
41
41
GSList *hilights;
42
42
 
43
 
static void reset_cache(void)
 
43
static void reset_level_cache(void)
44
44
{
45
45
        GSList *tmp;
46
46
 
51
51
                if (never_hilight_level & rec->level)
52
52
                        never_hilight_level &= ~rec->level;
53
53
        }
 
54
}
54
55
 
 
56
static void reset_cache(void)
 
57
{
 
58
        reset_level_cache();
55
59
        nickmatch_rebuild(nickmatch);
56
60
}
57
61
 
353
357
        } else {
354
358
                /* hilight part of the line */
355
359
                GString *tmp;
356
 
                char *middle, *lastcolor;
 
360
                char *middle;
357
361
                int pos, color_pos, color_len;
358
362
 
359
363
                tmp = g_string_new(NULL);
377
381
                pos = strip_real_length(text, hilight_end,
378
382
                                        &color_pos, &color_len);
379
383
                if (color_pos > 0)
380
 
                        lastcolor = g_strndup(text+color_pos, color_len);
 
384
                        g_string_append_len(tmp, text+color_pos, color_len);
381
385
                else {
382
386
                        /* no colors in line, change back to default */
383
 
                        lastcolor = g_malloc0(3);
384
 
                        lastcolor[0] = 4;
385
 
                        lastcolor[1] = FORMAT_STYLE_DEFAULTS;
 
387
                        g_string_append_c(tmp, 4);
 
388
                        g_string_append_c(tmp, FORMAT_STYLE_DEFAULTS);
386
389
                }
387
 
                g_string_append(tmp, lastcolor);
388
390
                g_string_append(tmp, text+pos);
389
 
                g_free(lastcolor);
390
391
 
391
392
                newstr = tmp->str;
392
393
                g_string_free(tmp, FALSE);
479
480
                if (rec->word) g_string_append(options, "-word ");
480
481
        }
481
482
 
482
 
        if (rec->nickmask) g_string_append(options, "-nickmask ");
483
 
        if (rec->fullword) g_string_append(options, "-fullword ");
 
483
        if (rec->nickmask) g_string_append(options, "-mask ");
 
484
        if (rec->fullword) g_string_append(options, "-full ");
484
485
        if (rec->regexp) {
485
486
                g_string_append(options, "-regexp ");
486
487
#ifdef HAVE_REGEX_H
490
491
        }
491
492
 
492
493
        if (rec->priority != 0)
493
 
                g_string_sprintfa(options, "-priority %d ", rec->priority);
 
494
                g_string_append_printf(options, "-priority %d ", rec->priority);
494
495
        if (rec->color != NULL)
495
 
                g_string_sprintfa(options, "-color %s ", rec->color);
 
496
                g_string_append_printf(options, "-color %s ", rec->color);
496
497
        if (rec->act_color != NULL)
497
 
                g_string_sprintfa(options, "-actcolor %s ", rec->act_color);
 
498
                g_string_append_printf(options, "-actcolor %s ", rec->act_color);
498
499
 
499
500
        chans = rec->channels == NULL ? NULL :
500
501
                g_strjoinv(",", rec->channels);
558
559
        if (*text == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
559
560
 
560
561
        channels = (chanarg == NULL || *chanarg == '\0') ? NULL :
561
 
                g_strsplit(replace_chars(chanarg, ',', ' '), " ", -1);
 
562
                g_strsplit(chanarg, ",", -1);
562
563
 
563
564
        rec = hilight_find(text, channels);
564
565
        if (rec == NULL) {
575
576
        }
576
577
 
577
578
        rec->level = (levelarg == NULL || *levelarg == '\0') ? 0 :
578
 
                level2bits(replace_chars(levelarg, ',', ' '));
 
579
                level2bits(replace_chars(levelarg, ',', ' '), NULL);
579
580
        rec->priority = priorityarg == NULL ? 0 : atoi(priorityarg);
580
581
 
581
582
        if (g_hash_table_lookup(optlist, "line") != NULL) {
675
676
static void read_settings(void)
676
677
{
677
678
        default_hilight_level = settings_get_level("hilight_level");
 
679
        reset_level_cache();
678
680
}
679
681
 
680
682
void hilight_text_init(void)