This caused the backlog replay to not work properly
void ClientBacklogManager::receiveBacklog(BufferId bufferId, MsgId first, MsgId last, int limit, int additional, QVariantList msgs) {
Q_UNUSED(first) Q_UNUSED(last) Q_UNUSED(limit) Q_UNUSED(additional)
void ClientBacklogManager::receiveBacklog(BufferId bufferId, MsgId first, MsgId last, int limit, int additional, QVariantList msgs) {
Q_UNUSED(first) Q_UNUSED(last) Q_UNUSED(limit) Q_UNUSED(additional)
- if(msgs.isEmpty())
- return;
-
emit messagesReceived(bufferId, msgs.count());
MessageList msglist;
emit messagesReceived(bufferId, msgs.count());
MessageList msglist;
* \param networkId The network id
* \param type The type of the buffer (StatusBuffer, Channel, etc.)
* \param buffer The buffer name (if empty, the net's status buffer is returned)
* \param networkId The network id
* \param type The type of the buffer (StatusBuffer, Channel, etc.)
* \param buffer The buffer name (if empty, the net's status buffer is returned)
+ * \param create Whether or not the buffer should be created if it doesnt exist
* \return The BufferInfo corresponding to the given network and buffer name, or 0 if not found
*/
* \return The BufferInfo corresponding to the given network and buffer name, or 0 if not found
*/
- static inline BufferInfo bufferInfo(UserId user, const NetworkId &networkId, BufferInfo::Type type, const QString &buffer = "") {
- return instance()->storage->getBufferInfo(user, networkId, type, buffer);
+ static inline BufferInfo bufferInfo(UserId user, const NetworkId &networkId, BufferInfo::Type type, const QString &buffer = "", bool create = true) {
+ return instance()->storage->bufferInfo(user, networkId, type, buffer, create);
}
//! Get the unique BufferInfo for a bufferId
}
//! Get the unique BufferInfo for a bufferId
// init BacklogManager
p->synchronize(_backlogManager);
// init BacklogManager
p->synchronize(_backlogManager);
+ p->dumpSyncMap(_backlogManager);
// init IrcListHelper
p->synchronize(ircListHelper());
// init IrcListHelper
p->synchronize(ircListHelper());
}
void CoreSession::renameBuffer(const NetworkId &networkId, const QString &newName, const QString &oldName) {
}
void CoreSession::renameBuffer(const NetworkId &networkId, const QString &newName, const QString &oldName) {
- BufferInfo bufferInfo = Core::bufferInfo(user(), networkId, BufferInfo::QueryBuffer, oldName);
+ BufferInfo bufferInfo = Core::bufferInfo(user(), networkId, BufferInfo::QueryBuffer, oldName, false);
_bufferSyncer->renameBuffer(bufferInfo.bufferId(), newName);
}
_bufferSyncer->renameBuffer(bufferInfo.bufferId(), newName);
}
-BufferInfo SqliteStorage::getBufferInfo(UserId user, const NetworkId &networkId, BufferInfo::Type type, const QString &buffer) {
+BufferInfo SqliteStorage::bufferInfo(UserId user, const NetworkId &networkId, BufferInfo::Type type, const QString &buffer, bool create) {
QSqlQuery query(logDb());
query.prepare(queryString("select_bufferByName"));
query.bindValue(":networkid", networkId.toInt());
QSqlQuery query(logDb());
query.prepare(queryString("select_bufferByName"));
query.bindValue(":networkid", networkId.toInt());
safeExec(query);
if(!query.first()) {
safeExec(query);
if(!query.first()) {
+ if(!create)
+ return BufferInfo();
+
createBuffer(user, networkId, type, buffer);
safeExec(query);
if(!query.first()) {
createBuffer(user, networkId, type, buffer);
safeExec(query);
if(!query.first()) {
virtual void setPersistentChannelKey(UserId user, const NetworkId &networkId, const QString &channel, const QString &key);
/* Buffer handling */
virtual void setPersistentChannelKey(UserId user, const NetworkId &networkId, const QString &channel, const QString &key);
/* Buffer handling */
- virtual BufferInfo getBufferInfo(UserId user, const NetworkId &networkId, BufferInfo::Type type, const QString &buffer = "");
+ virtual BufferInfo bufferInfo(UserId user, const NetworkId &networkId, BufferInfo::Type type, const QString &buffer = "", bool create = true);
virtual BufferInfo getBufferInfo(UserId user, const BufferId &bufferId);
virtual QList<BufferInfo> requestBuffers(UserId user);
virtual QList<BufferId> requestBufferIdsForNetwork(UserId user, NetworkId networkId);
virtual BufferInfo getBufferInfo(UserId user, const BufferId &bufferId);
virtual QList<BufferInfo> requestBuffers(UserId user);
virtual QList<BufferId> requestBufferIdsForNetwork(UserId user, NetworkId networkId);
* \param networkId The network id
* \param type The type of the buffer (StatusBuffer, Channel, etc.)
* \param buffer The buffer name (if empty, the net's status buffer is returned)
* \param networkId The network id
* \param type The type of the buffer (StatusBuffer, Channel, etc.)
* \param buffer The buffer name (if empty, the net's status buffer is returned)
+ * \param create Whether or not the buffer should be created if it doesnt exist
* \return The BufferInfo corresponding to the given network and buffer name, or an invalid BufferInfo if not found
*/
* \return The BufferInfo corresponding to the given network and buffer name, or an invalid BufferInfo if not found
*/
- virtual BufferInfo getBufferInfo(UserId user, const NetworkId &networkId, BufferInfo::Type type, const QString &buffer = "") = 0;
+ virtual BufferInfo bufferInfo(UserId user, const NetworkId &networkId, BufferInfo::Type type, const QString &buffer = "", bool create = true) = 0;
//! Get the unique BufferInfo for a bufferId
/** \param user The core user who owns this buffername
//! Get the unique BufferInfo for a bufferId
/** \param user The core user who owns this buffername