cmdclient: Now works correctly with user localpart login. Default to 8008 not 8080.

This commit is contained in:
Kegan Dougal 2014-09-03 09:53:09 +01:00
parent ddc16d8642
commit 8166ebd91a

View File

@ -88,6 +88,8 @@ class SynapseCmd(cmd.Cmd):
return False return False
def _domain(self): def _domain(self):
if "user" not in self.config or not self.config["user"]:
return None
return self.config["user"].split(":")[1] return self.config["user"].split(":")[1]
def do_config(self, line): def do_config(self, line):
@ -191,7 +193,9 @@ class SynapseCmd(cmd.Cmd):
p = getpass.getpass("Enter your password: ") p = getpass.getpass("Enter your password: ")
user = args["user_id"] user = args["user_id"]
if self._is_on("complete_usernames") and not user.startswith("@"): if self._is_on("complete_usernames") and not user.startswith("@"):
user = "@" + user + ":" + self._domain() domain = self._domain()
if domain:
user = "@" + user + ":" + domain
reactor.callFromThread(self._do_login, user, p) reactor.callFromThread(self._do_login, user, p)
#print " got %s " % p #print " got %s " % p
@ -700,7 +704,7 @@ def main(server_url, identity_server_url, username, token, config_path):
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser("Starts a synapse client.") parser = argparse.ArgumentParser("Starts a synapse client.")
parser.add_argument( parser.add_argument(
"-s", "--server", dest="server", default="http://localhost:8080", "-s", "--server", dest="server", default="http://localhost:8008",
help="The URL of the home server to talk to.") help="The URL of the home server to talk to.")
parser.add_argument( parser.add_argument(
"-i", "--identity-server", dest="identityserver", default="http://localhost:8090", "-i", "--identity-server", dest="identityserver", default="http://localhost:8090",