summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-03-26 22:02:53 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-03-26 22:02:53 +0300
commited0b345e7696225243d808d591d29bd25d497aea (patch)
treee9c700aa9b921af12a7ed69abfa507166438adf4 /src
parentTrack invites so they can be removed outside of nheko (diff)
downloadnheko-ed0b345e7696225243d808d591d29bd25d497aea.tar.xz
Pin invites to the top of the room list
fixes #252
Diffstat (limited to 'src')
-rw-r--r--src/RoomInfoListItem.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/RoomInfoListItem.cc b/src/RoomInfoListItem.cc

index 8041915b..da896bcd 100644 --- a/src/RoomInfoListItem.cc +++ b/src/RoomInfoListItem.cc
@@ -15,6 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <QDateTime> #include <QDebug> #include <QMouseEvent> #include <QPainter> @@ -84,6 +85,15 @@ RoomInfoListItem::RoomInfoListItem(QString room_id, { init(parent); + // HACK + // We use fake message info with an old date to pin + // the invite events to the top. + // + // State events in invited rooms don't contain timestamp info, + // so we can't use them for sorting. + auto now = QDateTime::currentDateTime(); + lastMsgInfo_ = {"-", "-", "-", "-", now.addYears(10)}; + roomAvatar_ = QString::fromStdString(invitedRoom_.avatar()); roomName_ = QString::fromStdString(invitedRoom_.name()); }