aboutsummaryrefslogtreecommitdiff
path: root/room.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'room.cpp')
-rw-r--r--room.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/room.cpp b/room.cpp
index 07128844..c5b674ae 100644
--- a/room.cpp
+++ b/room.cpp
@@ -71,14 +71,14 @@ Room::Room(Connection* connection, QString id)
d->connection = connection;
d->joinState = JoinState::Join;
d->gettingNewContent = false;
- qDebug() << "New Room: " << id;
+ qDebug() << "New Room:" << id;
//connection->getMembers(this); // I don't think we need this anymore in r0.0.1
}
Room::~Room()
{
- qDebug() << "deconstructing room " << this;
+ qDebug() << "deconstructing room" << this;
delete d;
}
@@ -284,15 +284,7 @@ Connection* Room::connection()
void Room::processMessageEvent(Event* event)
{
- for( int i=0; i<d->messageEvents.count(); i++ )
- {
- if( event->timestamp() < d->messageEvents.at(i)->timestamp() )
- {
- d->messageEvents.insert(i, event);
- return;
- }
- }
- d->messageEvents.append(event);
+ d->messageEvents.insert(findInsertionPos(d->messageEvents, event), event);
}
void Room::processStateEvent(Event* event)
@@ -302,7 +294,7 @@ void Room::processStateEvent(Event* event)
if (RoomNameEvent* nameEvent = static_cast<RoomNameEvent*>(event))
{
d->name = nameEvent->name();
- qDebug() << "room name: " << d->name;
+ qDebug() << "room name:" << d->name;
emit namesChanged(this);
} else
{
@@ -314,14 +306,14 @@ void Room::processStateEvent(Event* event)
{
RoomAliasesEvent* aliasesEvent = static_cast<RoomAliasesEvent*>(event);
d->aliases = aliasesEvent->aliases();
- qDebug() << "room aliases: " << d->aliases;
+ qDebug() << "room aliases:" << d->aliases;
emit namesChanged(this);
}
if( event->type() == EventType::RoomCanonicalAlias )
{
RoomCanonicalAliasEvent* aliasEvent = static_cast<RoomCanonicalAliasEvent*>(event);
d->canonicalAlias = aliasEvent->alias();
- qDebug() << "room canonical alias: " << d->canonicalAlias;
+ qDebug() << "room canonical alias:" << d->canonicalAlias;
emit namesChanged(this);
}
if( event->type() == EventType::RoomTopic )
@@ -334,7 +326,6 @@ void Room::processStateEvent(Event* event)
{
RoomMemberEvent* memberEvent = static_cast<RoomMemberEvent*>(event);
User* u = d->connection->user(memberEvent->userId());
- if( !u ) qDebug() << "addState: invalid user!" << u << memberEvent->userId();
u->processEvent(event);
if( memberEvent->membership() == MembershipType::Join and !d->users.contains(u) )
{