()->message().body().isEmpty()))
{
@@ -5126,7 +5127,8 @@ void PsiAccount::handleEvent(const PsiEv
}
#endif
if (!isMuc) {
- logEvent(e->from(), e);
+ int type = findGCContact(e->from()) ? EDB::GroupChatContact : EDB::Contact;
+ logEvent(e->from(), e, type);
}
}
}
@@ -5827,14 +5829,16 @@ void PsiAccount::groupChatMessagesRead(c
}
#endif
-void PsiAccount::logEvent(const Jid &j, const PsiEvent::Ptr &e)
+void PsiAccount::logEvent(const Jid &j, const PsiEvent::Ptr &e, int type)
{
if (!d->acc.opt_log)
return;
+ if (type == EDB::GroupChatContact && !PsiOptions::instance()->getOption("options.history.store-muc-private").toBool())
+ return;
EDBHandle *h = new EDBHandle(d->psi->edb());
connect(h, SIGNAL(finished()), SLOT(edb_finished()));
- h->append(j, e);
+ h->append(id(), j, e, type);
}
void PsiAccount::edb_finished()
@@ -6289,7 +6293,7 @@ void PsiAccount::pgp_encryptFinished()
MessageEvent::Ptr me(new MessageEvent(m, this));
me->setOriginLocal(true);
me->setTimeStamp(QDateTime::currentDateTime());
- logEvent(m.to(), me);
+ logEvent(m.to(), me, EDB::Contact);
}
Message mwrap;
--- git.orig/src/psiaccount.h
+++ git/src/psiaccount.h
@@ -529,7 +529,7 @@ private:
void simulateRosterOffline();
void cpUpdate(const UserListItem &, const QString &rname="", bool fromPresence=false);
UserListItem* addUserListItem(const Jid& jid, const QString& nick="");
- void logEvent(const Jid &, const PsiEvent::Ptr &);
+ void logEvent(const Jid &, const PsiEvent::Ptr &, int);
void queueEvent(const PsiEvent::Ptr &e, ActivationType activationType);
void openNextEvent(const UserListItem &, ActivationType activationType);
void updateReadNext(const Jid &);
--- git.orig/src/psichatdlg.cpp
+++ git/src/psichatdlg.cpp
@@ -960,7 +960,7 @@ bool PsiChatDlg::isEncryptionEnabled() c
void PsiChatDlg::appendSysMsg(const QString &str)
{
- chatView()->dispatchMessage(MessageView::fromHtml(str, MessageView::System));
+ dispatchMessage(MessageView::fromHtml(str, MessageView::System));
}
ChatView* PsiChatDlg::chatView() const
--- git.orig/src/psicon.cpp
+++ git/src/psicon.cpp
@@ -359,8 +359,7 @@ PsiCon::PsiCon()
d->ftwin = 0;
#endif
- d->edb = new EDBFlatFile;
-
+ d->edb = 0;
d->s5bServer = 0;
d->tuneManager = 0;
d->autoUpdater = 0;
@@ -381,7 +380,8 @@ PsiCon::~PsiCon()
delete d->autoUpdater;
delete d->actionList;
- delete d->edb;
+ if (d->edb)
+ delete d->edb;
delete d->defaultMenuBar;
delete d->tabManager;
delete d->popupManager;
@@ -703,6 +703,12 @@ bool PsiCon::init()
checkAccountsEmpty();
+ // Import for SQLite history
+ EDBSqLite *edb = new EDBSqLite(this);
+ d->edb = edb;
+ if (!edb->init())
+ return false;
+
// try autologin if needed
foreach(PsiAccount* account, d->contactList->accounts()) {
account->autoLogin();
--- git.orig/src/src.pri
+++ git/src/src.pri
@@ -1,4 +1,4 @@
-QT += xml network
+QT += xml network sql
greaterThan(QT_MAJOR_VERSION, 4) {
QT += widgets multimedia concurrent
@@ -142,6 +142,7 @@ HEADERS += \
$$PWD/translationmanager.h \
$$PWD/eventdb.h \
$$PWD/historydlg.h \
+ $$PWD/historyimp.h \
$$PWD/tipdlg.h \
$$PWD/searchdlg.h \
$$PWD/registrationdlg.h \
@@ -290,6 +291,7 @@ SOURCES += \
$$PWD/translationmanager.cpp \
$$PWD/eventdb.cpp \
$$PWD/historydlg.cpp \
+ $$PWD/historyimp.cpp \
$$PWD/searchdlg.cpp \
$$PWD/registrationdlg.cpp \
$$PWD/psitoolbar.cpp \
--- git.orig/themes/chatview/psi/adapter.js
+++ git/themes/chatview/psi/adapter.js
@@ -189,7 +189,11 @@ window[chatServer.jsNamespace()].adapter
}
if (!template) {
data.nextOfGroup = false; //can't group w/o template
- template = data.local?shared.templates.sentMessage:shared.templates.receivedMessage;
+ if (data.spooled) {
+ template = shared.templates.spooledMessage;
+ } else {
+ template = data.local?shared.templates.sentMessage:shared.templates.receivedMessage;
+ }
}
break;
case "status":
--- git.orig/themes/chatview/psi/classic/index.html
+++ git/themes/chatview/psi/classic/index.html
@@ -13,6 +13,7 @@ body > div img { vertical-align:bottom;
body > div > img:first-child { vertical-align:text-bottom; }
.sent {}
.received {}
+.spooledmsg {}
.infmsg {}
.usertext {}
.alert {font-weight:bold;}
@@ -32,6 +33,7 @@ window[chatServer.jsNamespace()].theme =
var cssBody = chat.util.findStyleSheet(document.styleSheets[0], "body").style;
var cssSentMsg = chat.util.findStyleSheet(document.styleSheets[0], ".sent").style;
var cssReceivedMsg = chat.util.findStyleSheet(document.styleSheets[0], ".received").style;
+ var cssSpooledMsg = chat.util.findStyleSheet(document.styleSheets[0], ".spooledmsg").style;
var cssInfMsg = chat.util.findStyleSheet(document.styleSheets[0], ".infmsg").style;
var cssUserText = chat.util.findStyleSheet(document.styleSheets[0], ".usertext").style;
var cssChatSays = chat.util.findStyleSheet(document.styleSheets[0], ".msg>span:first").style;
@@ -46,6 +48,7 @@ window[chatServer.jsNamespace()].theme =
cssReceivedMsg.color = shared.colorOption("options.ui.look.colors.messages.received");
cssInfMsg.color = shared.colorOption("options.ui.look.colors.messages.informational");
cssUserText.color = shared.colorOption("options.ui.look.colors.messages.usertext");
+ cssSpooledMsg.color = cssUserText.color;
cssAlertMsg.color = shared.psiOption("options.ui.look.colors.messages.highlighting");
useMessageIcons = shared.psiOption("options.ui.chat.use-message-icons");
if (shared.psiOption("options.ui.chat.scaled-message-icons")) {
@@ -73,7 +76,9 @@ window[chatServer.jsNamespace()].theme =
receivedMessage: shared.isMuc?
"%icon%[%time%] %sender% %alertedmessage%
"
: null,
- spooledMessage: "%icon%[%time%] %sender% %message%
",
+ spooledMessage: shared.isMuc?
+ "%icon%[%time%] %sender% %message%
"
+ : "%icon%[%time%] %sender% %message%
",
sys: "%icon%%message%
",
sysMessage: "%icon%[%time%] *** %message%
",
sysMessageUT: "%icon%[%time%] *** %message%: %usertext%
",
@@ -97,7 +102,7 @@ window[chatServer.jsNamespace()].theme =
}
if (shared.cdata.mtype == "message") {
var template = shared.cdata.emote && shared.templates.messageNC ||
- (shared.cdata.spooled && shared.templates.message || null);
+ (shared.cdata.spooled && shared.templates.spooledMessage || null);
if (template) {
shared.appendHtml(template.toString(), shared.cdata.local?true:null);
return false;
@@ -119,8 +124,7 @@ window[chatServer.jsNamespace()].theme =
return shared.cdata.alert?""+
shared.cdata.message+"":shared.cdata.message;
},
- sentrec : function() {return shared.cdata.spooled?"infmsg":
- (shared.cdata.local?"sent":"received");},
+ sentrec : function() {return shared.cdata.local?"sent":"received";},
nickcolor : function() {
return shared.session.mucNickColor(shared.cdata.sender, shared.cdata.local);
},
@@ -129,6 +133,10 @@ window[chatServer.jsNamespace()].theme =
if (useMessageIcons) {
switch (shared.cdata.mtype) {
case "message":
+ if (shared.cdata.spooled) {
+ icon = "psi/history";
+ break;
+ }
icon = shared.cdata.local?(shared.cdata.awaitingReceipt?
"psi/notification_chat_send":"psi/notification_chat_delivery_ok")
: "psi/notification_chat_receive";