function onPrefChanged()

in suite/chatzilla/content/prefs.js [660:849]


function onPrefChanged(prefName, newValue, oldValue) {
  if (newValue == oldValue) {
    return;
  }

  switch (prefName) {
    case "awayIdleTime":
      uninitIdleAutoAway(oldValue);
      initIdleAutoAway(newValue);
      break;

    case "bugKeyword":
      client.munger.delRule("bugzilla-link");
      addBugzillaLinkMungerRule(newValue, 10, 10);
      break;

    case "channelMaxLines":
      CIRCChannel.prototype.MAX_MESSAGES = newValue;
      break;

    case "charset":
      client.charset = newValue;
      break;

    case "clientMaxLines":
      client.MAX_MESSAGES = newValue;
      break;

    case "connectTries":
      CIRCNetwork.prototype.MAX_CONNECT_ATTEMPTS = newValue;
      break;

    case "dcc.listenPorts":
      CIRCDCC.prototype.listenPorts = newValue;
      break;

    case "dccUserMaxLines":
      CIRCDCCFileTransfer.prototype.MAX_MESSAGES = newValue;
      CIRCDCCChat.prototype.MAX_MESSAGES = newValue;
      break;

    case "font.family":
    case "font.size":
      client.dispatch("sync-font");
      break;

    case "proxy.typeOverride":
      CIRCNetwork.prototype.PROXY_TYPE_OVERRIDE = newValue;
      break;

    case "reconnect":
      CIRCNetwork.prototype.stayingPower = newValue;
      break;

    case "showModeSymbols":
      if (newValue) {
        setListMode("symbol");
      } else {
        setListMode("graphic");
      }
      break;

    case "sasl.plain.enabled":
      CIRCNetwork.prototype.USE_SASL = newValue;
      break;

    case "upgrade-insecure":
      CIRCNetwork.prototype.UPGRADE_INSECURE = newValue;
      break;

    case "sts.enabled":
      CIRCNetwork.prototype.STS_MODULE.ENABLED = newValue;
      break;

    case "nickname":
      CIRCNetwork.prototype.INITIAL_NICK = newValue;
      break;

    case "username":
      CIRCNetwork.prototype.INITIAL_NAME = newValue;
      break;

    case "usermode":
      CIRCNetwork.prototype.INITIAL_UMODE = newValue;
      break;

    case "userMaxLines":
      CIRCUser.prototype.MAX_MESSAGES = newValue;
      break;

    case "userlistLeft":
      updateUserlistSide(newValue);
      break;

    case "debugMode":
      setDebugMode(newValue);
      break;

    case "desc":
      CIRCNetwork.prototype.INITIAL_DESC = newValue;
      break;

    case "stalkWholeWords":
    case "stalkWords":
      updateAllStalkExpressions();
      break;

    case "sortUsersByMode":
      if (client.currentObject.TYPE == "IRCChannel") {
        client.currentObject.updateUserList(true);
      }

    case "motif.current":
      client.dispatch("sync-motif");
      break;

    case "multiline":
      multilineInputMode(newValue);
      delete client.multiLineForPaste;
      break;

    case "munger.colorCodes":
      client.enableColors = newValue;
      break;

    case "networkMaxLines":
      CIRCNetwork.prototype.MAX_MESSAGES = newValue;
      break;

    case "displayHeader":
      client.dispatch("sync-header");
      break;

    case "tabLabel":
      onTabLabelUpdate(client, newValue);
      break;

    case "timestamps":
    case "timestamps.display":
    case "collapseActions":
    case "collapseMsgs":
      client.dispatch("sync-timestamp");
      break;

    case "log":
      client.dispatch("sync-log");
      break;

    case "alert.globalEnabled":
      updateAlertIcon(false);
      break;

    case "alert.floodDensity":
      if (client.alert && client.alert.floodProtector) {
        client.alert.floodProtector.floodDensity = newValue;
      }
      break;

    case "alert.floodDispersion":
      if (client.alert && client.alert.floodProtector) {
        client.alert.floodProtector.floodDispersion = newValue;
      }
      break;

    case "aliases":
      updateAliases();
      break;

    case "inputSpellcheck":
      updateSpellcheck(newValue);
      break;

    case "urls.store.max":
      if (client.urlLogger) {
        client.urlLogger.autoLimit = newValue;
        client.urlLogger.limit(newValue);
      }
      break;

    default:
      // Make munger prefs apply without a restart
      var m, rule;
      if (
        (m = prefName.match(/^munger\.(\S+)$/)) &&
        (rule = client.munger.getRule(m[1]))
      ) {
        rule.enabled = newValue;
      }
  }
}