From 4751295a3f25b94e81d677f69fe147dd9679847b Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sun, 7 Nov 2010 00:22:46 +0000 Subject: [PATCH] Fixed History Browser for group chat and private chat. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3758 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/PeersDialog.cpp | 11 +++++++---- retroshare-gui/src/gui/chat/PopupChatDialog.cpp | 5 ++++- retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp | 5 ----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index 2908abe4a..05eb57c12 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -187,10 +187,13 @@ PeersDialog::PeersDialog(QWidget *parent) if (Settings->valueFromGroup("Chat", QString::fromUtf8("GroupChat_History"), true).toBool()) { historyKeeper.init(QString::fromStdString(RsInit::RsProfileConfigDirectory()) + "/chatPublic.xml"); - QList historyItems; - historyKeeper.getMessages(historyItems, Settings->getPublicChatHistoryCount()); - foreach(IMHistoryItem item, historyItems) { - addChatMsg(item.incoming, true, item.name, item.recvTime, item.messageText); + int messageCount = Settings->getPublicChatHistoryCount(); + if (messageCount > 0) { + QList historyItems; + historyKeeper.getMessages(historyItems, messageCount); + foreach(IMHistoryItem item, historyItems) { + addChatMsg(item.incoming, true, item.name, item.recvTime, item.messageText); + } } } diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp index 5b3a56a46..de2bc3b2a 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp @@ -210,7 +210,10 @@ PopupChatDialog::PopupChatDialog(std::string id, const QString name, QWidget *pa rsMsgs->getPrivateChatQueueCount(false) && rsMsgs->getPrivateChatQueue(false, dialogId, offlineChat); QList historyItems; - historyKeeper.getMessages(historyItems, Settings->getPrivateChatHistoryCount()); + int messageCount = Settings->getPrivateChatHistoryCount(); + if (messageCount > 0) { + historyKeeper.getMessages(historyItems, messageCount); + } foreach(IMHistoryItem item, historyItems) { for(offineChatIt = offlineChat.begin(); offineChatIt != offlineChat.end(); offineChatIt++) { /* are they public? */ diff --git a/retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp b/retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp index 2f653f94e..aeebe0f5b 100644 --- a/retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp +++ b/retroshare-gui/src/gui/im_history/IMHistoryKeeper.cpp @@ -132,11 +132,6 @@ bool IMHistoryKeeper::getMessages(QList &historyItems, const int historyItems.clear(); - if (messagesCount == 0) { - /* nothing to do */ - return true; - } - QListIterator hii(hitems); hii.toBack(); while (hii.hasPrevious()) {