+void AbstractBufferContainer::setCurrentBuffer(BufferId bufferId)
+{
+ BufferId prevBufferId = currentBuffer();
+ if (prevBufferId.isValid() && _chatViews.contains(prevBufferId)) {
+ MsgId msgId = _chatViews.value(prevBufferId)->lastMsgId();
+ Client::setBufferLastSeenMsg(prevBufferId, msgId);
+ }
+
+ if (!bufferId.isValid()) {
+ _currentBuffer = 0;
+ showChatView(0);
+ return;
+ }
+
+ if (!_chatViews.contains(bufferId))
+ _chatViews[bufferId] = createChatView(bufferId);
+
+ _currentBuffer = bufferId;
+ showChatView(bufferId);
+ Client::networkModel()->clearBufferActivity(bufferId);