connect(bufferSyncer(), SIGNAL(buffersPermanentlyMerged(BufferId, BufferId)), this, SLOT(buffersPermanentlyMerged(BufferId, BufferId)));
connect(bufferSyncer(), SIGNAL(buffersPermanentlyMerged(BufferId, BufferId)), _messageModel, SLOT(buffersPermanentlyMerged(BufferId, BufferId)));
connect(bufferSyncer(), SIGNAL(bufferMarkedAsRead(BufferId)), SIGNAL(bufferMarkedAsRead(BufferId)));
+ connect(bufferSyncer(), SIGNAL(bufferActivityChange(BufferId, const Message::Types)), _networkModel, SLOT(bufferActivityChanged(BufferId, const Message::Types)));
connect(networkModel(), SIGNAL(requestSetLastSeenMsg(BufferId, MsgId)), bufferSyncer(), SLOT(requestSetLastSeenMsg(BufferId, const MsgId &)));
SignalProxy *p = signalProxy();
}
// trigger backlog request once all active bufferviews are initialized
- connect(bufferViewOverlay(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog()));
+ connect(bufferViewOverlay(), SIGNAL(initDone()), this, SLOT(finishConnectionInitialization()));
_connected = true;
emit connected();
emit coreConnectionStateChanged(true);
}
-
-void Client::requestInitialBacklog()
+void Client::finishConnectionInitialization()
{
// usually it _should_ take longer until the bufferViews are initialized, so that's what
// triggers this slot. But we have to make sure that we know all buffers yet.
// so we check the BufferSyncer and in case it wasn't initialized we wait for that instead
if (!bufferSyncer()->isInitialized()) {
- disconnect(bufferViewOverlay(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog()));
- connect(bufferSyncer(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog()));
+ disconnect(bufferViewOverlay(), SIGNAL(initDone()), this, SLOT(finishConnectionInitialization()));
+ connect(bufferSyncer(), SIGNAL(initDone()), this, SLOT(finishConnectionInitialization()));
return;
}
- disconnect(bufferViewOverlay(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog()));
- disconnect(bufferSyncer(), SIGNAL(initDone()), this, SLOT(requestInitialBacklog()));
+ disconnect(bufferViewOverlay(), SIGNAL(initDone()), this, SLOT(finishConnectionInitialization()));
+ disconnect(bufferSyncer(), SIGNAL(initDone()), this, SLOT(finishConnectionInitialization()));
+
+ requestInitialBacklog();
+ bufferSyncer()->markActivitiesChanged();
+}
+
+void Client::requestInitialBacklog()
+{
_backlogManager->requestInitialBacklog();
}
void corePasswordChanged(PeerPtr, bool success);
- void requestInitialBacklog();
+ void finishConnectionInitialization();
void sendBufferedUserInput();
virtual ~Client();
void init();
+ void requestInitialBacklog();
+
static void addNetwork(Network *);
static inline BufferSyncer *bufferSyncer() { return instance()->_bufferSyncer; }
void BufferItem::updateActivityLevel(const Message &msg)
{
+ if (Client::coreFeatures().testFlag(Quassel::Feature::BufferActivitySync)) {
+ return;
+ }
+
if (isCurrentBuffer()) {
return;
}
_firstUnreadMsgId = msg.msgId();
}
+ if (addActivity(Message::Types(msg.type()), msg.flags().testFlag(Message::Highlight)) || stateChanged) {
+ emit dataChanged();
+ }
+}
+
+void BufferItem::setActivity(Message::Types type, bool highlight) {
BufferInfo::ActivityLevel oldLevel = activityLevel();
- _activity |= BufferInfo::OtherActivity;
- if (msg.type() & (Message::Plain | Message::Notice | Message::Action))
+ _activity = BufferInfo::Activity();
+ addActivity(type, highlight);
+
+ if (_activity != oldLevel) {
+ emit dataChanged();
+ }
+}
+
+bool BufferItem::addActivity(Message::Types type, bool highlight) {
+ auto oldActivity = activityLevel();
+
+ if (type != 0)
+ _activity |= BufferInfo::OtherActivity;
+
+ if (type.testFlag(Message::Plain) || type.testFlag(Message::Notice) || type.testFlag(Message::Action))
_activity |= BufferInfo::NewMessage;
- if (msg.flags() & Message::Highlight)
+ if (highlight)
_activity |= BufferInfo::Highlight;
- stateChanged |= (oldLevel != _activity);
-
- if (stateChanged)
- emit dataChanged();
+ return oldActivity != _activity;
}
_serverNoticesTarget = bufferSettings.serverNoticesTarget();
_errorMsgsTarget = bufferSettings.errorMsgsTarget();
}
+
+void NetworkModel::bufferActivityChanged(BufferId bufferId, const Message::Types activity) {
+ auto bufferItem = findBufferItem(bufferId);
+ if (!bufferItem) {
+ qDebug() << "NetworkModel::clearBufferActivity(): buffer is unknown:" << bufferId;
+ return;
+ }
+ auto hiddenTypes = BufferSettings(bufferId).messageFilter();
+ auto visibleTypes = ~hiddenTypes;
+ auto activityVisibleTypesIntersection = activity & visibleTypes;
+ bufferItem->setActivity(activityVisibleTypesIntersection, false);
+}
void setActivityLevel(BufferInfo::ActivityLevel level);
void clearActivityLevel();
void updateActivityLevel(const Message &msg);
+ void setActivity(Message::Types msg, bool highlight);
+ bool addActivity(Message::Types msg, bool highlight);
inline const MsgId &firstUnreadMsgId() const { return _firstUnreadMsgId; }
void clearBufferActivity(const BufferId &bufferId);
void updateBufferActivity(Message &msg);
void networkRemoved(const NetworkId &networkId);
+ void bufferActivityChanged(BufferId, Message::Types);
signals:
void requestSetLastSeenMsg(BufferId buffer, MsgId msg);
MsgId markerLine(BufferId buffer) const;
Message::Types activity(BufferId buffer) const;
+ void markActivitiesChanged() {
+ for (auto buffer : _bufferActivities.keys()) {
+ emit bufferActivityChange(buffer, activity(buffer));
+ }
+ }
+
public slots:
QVariantList initLastSeenMsg() const;
void initSetLastSeenMsg(const QVariantList &);
virtual inline void requestSetMarkerLine(BufferId buffer, const MsgId &msgId) { REQUEST(ARG(buffer), ARG(msgId)) setMarkerLine(buffer, msgId); }
virtual inline void setBufferActivity(BufferId buffer, const int &activity) {
+ auto flags = Message::Types(activity);
SYNC(ARG(buffer), ARG(activity));
- _bufferActivities[buffer] = Message::Types(activity);
+ _bufferActivities[buffer] = flags;
+ emit bufferActivityChange(buffer, flags);
}
virtual inline void requestRemoveBuffer(BufferId buffer) { REQUEST(ARG(buffer)) }
void bufferRenamed(BufferId buffer, QString newName);
void buffersPermanentlyMerged(BufferId buffer1, BufferId buffer2);
void bufferMarkedAsRead(BufferId buffer);
+ void bufferActivityChange(BufferId, Message::Types);
protected slots:
bool setLastSeenMsg(BufferId buffer, const MsgId &msgId);
CustomRateLimits = 0x0080, /// IRC server custom message rate limits
DccFileTransfer = 0x0100,
AwayFormatTimestamp = 0x0200, /// Timestamp formatting in away (e.g. %%hh:mm%%)
- // Whether or not the core supports auth backends.
- Authenticators = 0x0400,
+ Authenticators = 0x0400, /// Whether or not the core supports auth backends.
+ BufferActivitySync = 0x0800, /// Sync buffer activity status
- NumFeatures = 0x0400
+ NumFeatures = 0x0800
};
Q_DECLARE_FLAGS(Features, Feature)
virtual void requestPurgeBufferIds();
virtual inline void requestMarkBufferAsRead(BufferId buffer) {
- setLastSeenMsg(buffer, (int) Message::Types());
+ setBufferActivity(buffer, (int) Message::Types());
markBufferAsRead(buffer);
}
_currentBuffer = bufferId;
showChatView(bufferId);
- Client::networkModel()->clearBufferActivity(bufferId);
+ if (!Client::coreFeatures().testFlag(Quassel::Feature::BufferActivitySync)) {
+ Client::networkModel()->clearBufferActivity(bufferId);
+ }
Client::setBufferLastSeenMsg(bufferId, _chatViews[bufferId]->lastMsgId());
Client::backlogManager()->checkForBacklog(bufferId);
setFocus();