How to use the matrix-js-sdk.MatrixClient function in matrix-js-sdk

To help you get started, we’ve selected a few matrix-js-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FabricLabs / fabric / src / components / structures / LoggedInView.js View on Github external
page_type: PropTypes.string.isRequired,
        onRoomCreated: PropTypes.func,

        // Called with the credentials of a registered user (if they were a ROU that
        // transitioned to PWLU)
        onRegistered: PropTypes.func,
        collapsedRhs: PropTypes.bool,

        // Used by the RoomView to handle joining rooms
        viaServers: PropTypes.arrayOf(PropTypes.string),

        // and lots and lots of other stuff.
    },

    childContextTypes: {
        matrixClient: PropTypes.instanceOf(Matrix.MatrixClient),
        authCache: PropTypes.object,
    },

    getChildContext: function() {
        return {
            matrixClient: this._matrixClient,
            authCache: {
                auth: {},
                lastUpdate: 0,
            },
        };
    },

    getInitialState: function() {
        return {
            // use compact timeline view
github FabricLabs / fabric / src / components / structures / LoggedInView.js View on Github external
const MAX_PINNED_NOTICES_PER_ROOM = 2;

/**
 * This is what our MatrixChat shows when we are logged in. The precise view is
 * determined by the page_type property.
 *
 * Currently it's very tightly coupled with MatrixChat. We should try to do
 * something about that.
 *
 * Components mounted below us can access the matrix client via the react context.
 */
const LoggedInView = React.createClass({
    displayName: 'LoggedInView',

    propTypes: {
        matrixClient: PropTypes.instanceOf(Matrix.MatrixClient).isRequired,
        page_type: PropTypes.string.isRequired,
        onRoomCreated: PropTypes.func,

        // Called with the credentials of a registered user (if they were a ROU that
        // transitioned to PWLU)
        onRegistered: PropTypes.func,
        collapsedRhs: PropTypes.bool,

        // Used by the RoomView to handle joining rooms
        viaServers: PropTypes.arrayOf(PropTypes.string),

        // and lots and lots of other stuff.
    },

    childContextTypes: {
        matrixClient: PropTypes.instanceOf(Matrix.MatrixClient),
github FabricLabs / fabric / src / async-components / views / dialogs / ExportE2eKeysDialog.js View on Github external
import FileSaver from 'file-saver';
import React from 'react';
import { _t } from '../../../languageHandler';

import * as Matrix from 'matrix-js-sdk';
import * as MegolmExportEncryption from '../../../utils/MegolmExportEncryption';
import sdk from '../../../index';

const PHASE_EDIT = 1;
const PHASE_EXPORTING = 2;

export default React.createClass({
    displayName: 'ExportE2eKeysDialog',

    propTypes: {
        matrixClient: React.PropTypes.instanceOf(Matrix.MatrixClient).isRequired,
        onFinished: React.PropTypes.func.isRequired,
    },

    getInitialState: function() {
        return {
            phase: PHASE_EDIT,
            errStr: null,
        };
    },

    componentWillMount: function() {
        this._unmounted = false;
    },

    componentWillUnmount: function() {
        this._unmounted = true;
github FabricLabs / fabric / src / async-components / views / dialogs / ImportE2eKeysDialog.js View on Github external
resolve(e.target.result);
        };
        reader.onerror = reject;

        reader.readAsArrayBuffer(file);
    });
}

const PHASE_EDIT = 1;
const PHASE_IMPORTING = 2;

export default React.createClass({
    displayName: 'ImportE2eKeysDialog',

    propTypes: {
        matrixClient: React.PropTypes.instanceOf(Matrix.MatrixClient).isRequired,
        onFinished: React.PropTypes.func.isRequired,
    },

    getInitialState: function() {
        return {
            enableSubmit: false,
            phase: PHASE_EDIT,
            errStr: null,
        };
    },

    componentWillMount: function() {
        this._unmounted = false;
    },

    componentWillUnmount: function() {
github FabricLabs / fabric / src / wrappers / withMatrixClient.js View on Github external
export default function(WrappedComponent) {
    return React.createClass({
        displayName: "withMatrixClient<" + WrappedComponent.displayName + ">",

        contextTypes: {
            matrixClient: React.PropTypes.instanceOf(Matrix.MatrixClient).isRequired,
        },

        render: function() {
            return ;
        },
    });
}
github matrix-org / matrix-appservice-bridge / lib / components / prometheusmetrics.js View on Github external
labels: ["method"],
    });

    /*
     * We'll now annotate a bunch of the methods in MatrixClient to keep counts
     * of every time they're called. This seems to be neater than trying to
     * intercept all HTTP requests and try to intuit what internal method was
     * invoked based on the HTTP URL.
     * It's kindof messy to do this because we have to maintain a list of
     * client SDK method names, but the only other alternative is to hook the
     * 'request' function and attempt to parse methods out by inspecting the
     * underlying client API HTTP URLs, and that is even messier. So this is
     * the lesser of two evils.
     */

    var matrixClientPrototype = require("matrix-js-sdk").MatrixClient.prototype;

    var CLIENT_METHODS = [
        "ban",
        "createAlias",
        "createRoom",
        "getProfileInfo",
        "getStateEvent",
        "invite",
        "joinRoom",
        "kick",
        "leave",
        "register",
        "roomState",
        "sendEvent",
        "sendReceipt",
        "sendStateEvent",