From 4bb570c54585b258adac3c63f6e2e138533d17ca Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 12 Jun 2015 18:17:54 +0100 Subject: [PATCH] messages arrive! --- src/organisms/RoomView.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/organisms/RoomView.js b/src/organisms/RoomView.js index bf921b06..bc23fc01 100644 --- a/src/organisms/RoomView.js +++ b/src/organisms/RoomView.js @@ -11,12 +11,27 @@ module.exports = React.createClass({ } }, + componentWillMount: function() { + MatrixClientPeg.get().on("Room.timeline", this.onRoomTimeline); + }, + + componentWillUnmount: function() { + MatrixClientPeg.get().removeListener("Room.timeline", this.onRoomTimeline); + }, + componentWillReceiveProps: function(props) { this.setState({ room: MatrixClientPeg.get().getRoom(props.room_id) }); }, + onRoomTimeline: function(ev, room, toStartOfTimeline) { + if (room.roomId != this.props.room_id) return; + this.setState({ + room: MatrixClientPeg.get().getRoom(this.props.room_id) + }); + }, + getMessageTiles: function() { return this.state.room.timeline.map(function(mxEv) { return (