/// <summary> /// Initializes a new instance of the <see cref="MatrixSDK.Client.MatrixClient"/> class for testing. /// </summary> public MatrixClient() { try{ api = new MatrixAPI(); api.SyncJoinEvent += MatrixClient_OnEvent; api.SyncInviteEvent += MatrixClient_OnInvite; } catch (MatrixException e) { throw new MatrixException("An exception occured while trying to connect", e); } }
public MatrixAppservice(ServiceRegistration registration, string domain, string url = "http://localhost", int maxrequests = DEFAULT_MAXREQUESTS) { HsUrl = url; Domain = domain; MaximumRequests = maxrequests; Registration = registration; AsUrl = registration.URL; _botuserId = "@" + registration.Localpart + ":" + Domain; _urlMatcher = new Regex("\\/(rooms|transactions|users)\\/(.+)\\?access_token=(.+)", RegexOptions.Compiled | RegexOptions.ECMAScript); _api = new MatrixAPI(url, registration.AppServiceToken, ""); }
/// <summary> /// Initializes a new instance of the <see cref="Matrix.Client.MatrixClient"/> class. /// This intended for Application Services only who want to preform actions as another user. /// Sync is not preformed. /// </summary> /// <param name="URL">URL before /_matrix/</param> /// <param name="application_token">Application token for the AS.</param> /// <param name="userid">Userid as the user you intend to go as.</param> public MatrixClient(string URL, string application_token, string userid) { api = new MatrixAPI(URL, application_token, userid); try{ string[] versions = api.ClientVersions(); if (!MatrixAPI.IsVersionSupported(versions)) { Console.WriteLine("Warning: Client version is not supported by the server"); Console.WriteLine("Client supports up to " + MatrixAPI.VERSION); } } catch (MatrixException e) { throw new MatrixException("An exception occured while trying to connect", e); } }
/// <summary> /// Initializes a new instance of the <see cref="MatrixSDK.MatrixClient"/> class. /// The client will preform a connection and try to retrieve version information. /// If this fails, a MatrixUnsuccessfulConnection Exception will be thrown. /// </summary> /// <param name="URL">URL before /_matrix/</param> /// <param name="syncToken"> If you stored the sync token before, you can set it for the API here</param> public MatrixClient(string URL, string syncToken = "") { api = new MatrixAPI(URL, syncToken); try{ string[] versions = api.ClientVersions(); if (!MatrixAPI.IsVersionSupported(versions)) { Console.WriteLine("Warning: Client version is not supported by the server"); Console.WriteLine("Client supports up to " + MatrixAPI.VERSION); } api.SyncJoinEvent += MatrixClient_OnEvent; api.SyncInviteEvent += MatrixClient_OnInvite; } catch (MatrixException e) { throw new MatrixException("An exception occured while trying to connect", e); } }
/// <summary> /// This constructor is intended for the API only. /// Initializes a new instance of the <see cref="Matrix.Client.MatrixRoom"/> class. /// </summary> /// <param name="API">The API to send/recieve requests from</param> /// <param name="roomid">Roomid</param> public MatrixRoom(MatrixAPI API, string roomid) { ID = roomid; api = API; Members = new SortedDictionary <string, MatrixMRoomMember>(); }
public MatrixMediaFile(MatrixAPI api, string MXCUrl, string ContentType) { baseurl = api.BaseURL; mxcurl = MXCUrl; contenttype = ContentType; }
public void OnHostAdded(MatrixAPI.Data.HostInfo newHost) { matrixPortal.LaunchNode<ILoginNode>(newHost); matrixPortal.LaunchNode<ILauncherNode>(newHost); }
public void Initialize(MatrixAPI.Interfaces.IControllerPortal portal) { matrixPortal = portal; log.Info("Node controller initialized."); }
public Keys(MatrixAPI api) { }
/// <summary> /// Initializes a new instance of the <see cref="Matrix.Client.MatrixClient"/> class for testing. /// </summary> public MatrixClient(MatrixAPI api) { this.api = api; api.SyncJoinEvent += MatrixClient_OnEvent; api.SyncInviteEvent += MatrixClient_OnInvite; }