Chat-O-Matic/application/views/RoomListRow.cpp
Jaidyn Ann 6a160ced88 Sort room directory by account, 'Category' column
The room directory window now has an accounts menu, to allow the user to
filter rooms by account― and a "category" column has been added, which can
optionally be filled by the protocol for more semantic sorting of rooms
(Through "category" slot of IM_ROOM_DIRECTORY).
2021-08-31 20:31:39 -05:00

36 lines
838 B
C++

/*
* Copyright 2021, Jaidyn Levesque <jadedctrl@teknik.io>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#include "RoomListRow.h"
#include <ColumnTypes.h>
RoomListRow::RoomListRow(BMessage* msg)
:
BRow(),
fMessage(new BMessage(*msg)),
fInstance(-1)
{
int64 proto = msg->FindInt64("instance");
BString id = msg->FindString("chat_id");
BString name = msg->GetString("chat_name", id);
BString desc = msg->FindString("subject");
BString category = msg->FindString("category");
int32 user_n = msg->GetInt32("user_count", -1);
SetField(new BStringField(name), kNameColumn);
SetField(new BStringField(desc), kDescColumn);
SetField(new BStringField(category), kCatColumn);
if (user_n > -1)
SetField(new BIntegerField(user_n), kUserColumn);
}
RoomListRow::~RoomListRow()
{
delete fMessage;
}