Example #1
0
    def commit(self):
        """Called when the user clicks the "OK" button in the preferences
        dialog to actually apply the configuration.

        This method is only called if no `validate()' method returns a false
        value.
        """
        _kc.set_bool("chat", "notices_to_chan", self._notice_chan_var.get())
        _kc.set_bool("chat", "highlights_to_chan", self._hilite_chan_var.get())
        _kc.set("chat", "nick_complete_suffix", self._nickomplete_var.get())
Example #2
0
    def commit(self):
        """Called when the user clicks the "OK" button in the preferences
        dialog to actually apply the configuration.

        This method is only called if no `validate()' method returns a false
        value.
        """
        text = self._textbox.get('0.0', Tix.END)
        cfg = _kc.config
        if not cfg.has_section("ctcp"):
            cfg.add_section("ctcp")
        for line in text.splitlines():
            line = line.strip()
            if line:
                l = line.split(' ', 1)
                if len(l) == 2:
                    query, reply = l
                else:
                    query, reply = l[0], ""
                query, reply = query.rstrip().lower(), reply.lstrip()
                _kc.set("ctcp", query, reply)
Example #3
0
def save_networks():
    """Save the network list.

    This function stores the `networks' mapping to the (in-memory)
    configuration file.
    """
    for netid in networks:
        sect = "networks/" + netid
        net = networks[netid]
        _kc.set(sect, "name", net.name)
        _kc.set(sect, "address", "%s/%d" % net.address)
        if net.username:
            _kc.set(sect, "username", net.username)
        if net.realname:
            _kc.set(sect, "realname", net.realname)
        if net.nicks:
            _kc.set_list(sect, "nicks", net.nicks)
        _kc.set_bool(sect, "autoconnect", net.autoconnect)
        if net.channels:
            _kc.set_list(sect, "channels", net.channels)
    _kc.save()