MCPcopy Create free account
hub / github.com/davidar/tensor / changeRoom

Method changeRoom

client/models/messageeventmodel.cpp:45–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45void MessageEventModel::changeRoom(QMatrixClient::Room* room)
46{
47 beginResetModel();
48 if( m_currentRoom )
49 {
50 disconnect( m_currentRoom, &QMatrixClient::Room::newMessage, this, &MessageEventModel::newMessage );
51 }
52 m_currentRoom = room;
53 if( room )
54 {
55 m_currentMessages = room->messageEvents();
56 std::reverse(std::begin(m_currentMessages), std::end(m_currentMessages));
57 connect( room, &QMatrixClient::Room::newMessage, this, &MessageEventModel::newMessage );
58 qDebug() << "connected" << room;
59 }
60 else
61 {
62 m_currentMessages = QList<QMatrixClient::Event*>();
63 }
64 endResetModel();
65}
66
67void MessageEventModel::setConnection(QMatrixClient::Connection* connection)
68{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected