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

« back to all changes in this revision

Viewing changes to src/core/settings.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:
134
134
        const char *str;
135
135
 
136
136
        str = settings_get_str_type(key, SETTING_TYPE_LEVEL);
137
 
        return str == NULL ? 0 : level2bits(str);
 
137
        return str == NULL ? 0 : level2bits(str, NULL);
138
138
}
139
139
 
140
140
int settings_get_size(const char *key)
355
355
 
356
356
int settings_set_level(const char *key, const char *value)
357
357
{
 
358
        int iserror;
 
359
 
 
360
        (void)level2bits(value, &iserror);
 
361
        if (iserror)
 
362
                return FALSE;
 
363
 
358
364
        iconfig_node_set_str(settings_get_node(key), key, value);
359
365
        return TRUE;
360
366
}
453
459
 
454
460
        /* fe-text term_type -> fe-common/core term_charset - for 0.8.10-> */
455
461
        if (strcmp(module, "fe-text") == 0) {
456
 
                if (strcasecmp(node->key, "term_type") == 0 ||
 
462
                if (g_ascii_strcasecmp(node->key, "term_type") == 0 ||
457
463
                    /* kludge for cvs-version where term_charset was in fe-text */
458
 
                    strcasecmp(node->key, "term_charset") == 0) {
 
464
                    g_ascii_strcasecmp(node->key, "term_charset") == 0) {
459
465
                        new_module = "fe-common/core";
460
466
                        new_key = "term_charset";
461
467
                        new_value = !is_valid_charset(node->value) ? NULL :
472
478
                        g_free(new_value);
473
479
                        config_changed = TRUE;
474
480
                        return new_key != NULL;
475
 
                } else if (strcasecmp(node->key, "actlist_moves") == 0 &&
476
 
                           node->value != NULL && strcasecmp(node->value, "yes") == 0) {
 
481
                } else if (g_ascii_strcasecmp(node->key, "actlist_moves") == 0 &&
 
482
                           node->value != NULL && g_ascii_strcasecmp(node->value, "yes") == 0) {
477
483
                        config_node_set_str(mainconfig, parent, "actlist_sort", "recent");
478
484
                        config_node_set_str(mainconfig, parent, node->key, NULL);
479
485
                        config_changed = TRUE;
500
506
        if (node == NULL) return;
501
507
 
502
508
        errors = g_string_new(NULL);
503
 
        g_string_sprintf(errors, "Unknown settings in configuration "
 
509
        g_string_printf(errors, "Unknown settings in configuration "
504
510
                         "file for module %s:", module);
505
511
 
506
512
        count = 0;
515
521
                        continue;
516
522
 
517
523
                if (set == NULL || strcmp(set->module, module) != 0) {
518
 
                        g_string_sprintfa(errors, " %s", node->key);
 
524
                        g_string_append_printf(errors, " %s", node->key);
519
525
                        count++;
520
526
                }
521
527
        }
542
548
 
543
549
static int settings_compare(SETTINGS_REC *v1, SETTINGS_REC *v2)
544
550
{
545
 
        return strcmp(v1->section, v2->section);
 
551
        int cmp = strcmp(v1->section, v2->section);
 
552
        if (!cmp)
 
553
                cmp = strcmp(v1->key, v2->key);
 
554
        return cmp;
546
555
}
547
556
 
548
557
static void settings_hash_get(const char *key, SETTINGS_REC *rec,