How to use the m.room.avatar function in m

To help you get started, we’ve selected a few m 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 turt2live / matrix-voyager-bot / src / MatrixHandler.js View on Github external
var domainEvent = aliasEvent[domain];
                                var aliases = domainEvent.event.content.aliases;
                                if (aliases && aliases.indexOf(itemId) !== -1) {
                                    room = knownRoom;
                                    break;
                                }
                            }
                            if (room)break;
                        }
                    }

                    if (!room)
                        reject();
                }

                var avatarEvent = room.currentState.events['m.room.avatar'];
                if (!avatarEvent) {
                    reject();
                    return;
                }

                var mxcUrl = avatarEvent[''].event.content.url;
                if (mxcUrl) this._downloadMxcContent(mxcUrl).then(resolve, reject);
                else reject();
            } else if (itemId[0] == '@') {
                var user = this._client.getUser(itemId);
                if (!user.avatarUrl)
                    reject();
                else this._downloadMxcContent(user.avatarUrl).then(resolve, reject);
            } else reject();
        });
    }
github vector-im / riot-web / src / skins / vector / views / molecules / RoomSettings.js View on Github external
var send_level = 0;
            var state_level = 0;
            var default_user_level = 0;

            var user_levels = [];
            var events_levels = [];

            var current_user_level = 0;

            var power_level_level = 0;

            var can_change_levels = false;
        }

        var room_avatar_level = parseInt(power_levels.state_default || 0);
        if (events_levels['m.room.avatar'] !== undefined) {
            room_avatar_level = events_levels['m.room.avatar'];
        }
        var can_set_room_avatar = current_user_level >= room_avatar_level;

        var change_avatar;
        if (can_set_room_avatar) {
            change_avatar = <div>
                <h3>Room Icon</h3>
                
            </div>;
        }

        var banned = this.props.room.getMembersWithMembership("ban");

        return (
            <div></div>
github vector-im / riot-web / src / skins / vector / views / molecules / RoomSettings.js View on Github external
var state_level = 0;
            var default_user_level = 0;

            var user_levels = [];
            var events_levels = [];

            var current_user_level = 0;

            var power_level_level = 0;

            var can_change_levels = false;
        }

        var room_avatar_level = parseInt(power_levels.state_default || 0);
        if (events_levels['m.room.avatar'] !== undefined) {
            room_avatar_level = events_levels['m.room.avatar'];
        }
        var can_set_room_avatar = current_user_level &gt;= room_avatar_level;

        var change_avatar;
        if (can_set_room_avatar) {
            change_avatar = <div>
                <h3>Room Icon</h3>
                
            </div>;
        }

        var banned = this.props.room.getMembersWithMembership("ban");

        return (
            <div>
                <textarea placeholder="Topic"> &lt;br/&gt;</textarea></div>