'Show the config for this client: "config"
Edit a key value mapping: "config key value" e.g. "config token 1234"
Config variables:
user: The username to auth with.
token: The access token to auth with.
url: The url of the server.
verbose: [on|off] The verbosity of requests/responses.
complete_usernames: [on|off] Auto complete partial usernames by
assuming they are on the same homeserver as you.
E.g. name >> @name:yourhost
send_delivery_receipts: [on|off] Automatically send receipts to
messages when performing a \'stream\' command.
Additional key/values can be added and can be substituted into requests
by using $. E.g. \'config roomid room1\' then \'raw get /rooms/$roomid\'.'

def do_config(self, line):

    if (len(line) == 0):
        print json.dumps(self.config, indent=4)
        return
    try:
        args = self._parse(line, ['key', 'val'], force_keys=True)
        config_rules = [('verbose', ['on', 'off']), ('complete_usernames', ['on', 'off']), ('send_delivery_receipts', ['on', 'off'])]
        for (key, valid_vals) in config_rules:
            if ((key == args['key']) and (args['val'] not in valid_vals)):
                print ('%s    value    must    be    one    of    %s' % (args['key'], valid_vals))
                return
        if (args['key'] == 'verbose'):
            self.http_client.verbose = ('on' == args['val'])
        self.config[args['key']] = args['val']
        print json.dumps(self.config, indent=4)
        save_config(self.config)
    except Exception as e:
        print e
