From 051e83582b1964db2937b626a1cb6c1b4a047dd8 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 11 Jan 2016 18:23:07 +0000 Subject: [PATCH] add a cli.getDomain() method rather than react-sdk maintaining its own (multiple) implementations --- lib/client.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/client.js b/lib/client.js index 8ea601f7e..2468e2de5 100644 --- a/lib/client.js +++ b/lib/client.js @@ -191,6 +191,14 @@ MatrixClient.prototype.getIdentityServerUrl = function() { return this.idBaseUrl; }; +/** + * Get the domain for this client's MXID + * @return {string} Domain of this MXID + */ +MatrixClient.prototype.getDomain = function() { + return this.credentials.userId.replace(/^.*:/, ''); +}; + /** * Check if the runtime environment supports VoIP calling. * @return {boolean} True if VoIP is supported.