From 928d8538b2bc1c42e377def8466f50f0ed91291e Mon Sep 17 00:00:00 2001 From: me_desk Date: Sun, 20 Jan 2013 16:08:48 +0000 Subject: delivering undelivered messages from history git-svn-id: svn://localhost/project_picapica/trunk@222 fb96df88-216d-11de-830c-f3023f12d8ac --- pica-client/msguirouter.cpp | 7 +++++++ pica-client/skynet.cpp | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pica-client/msguirouter.cpp b/pica-client/msguirouter.cpp index efa080c..d032bb1 100644 --- a/pica-client/msguirouter.cpp +++ b/pica-client/msguirouter.cpp @@ -1,5 +1,6 @@ #include "msguirouter.h" #include "dialogs/forgedcertdialog.h" +#include "history.h" /* @@ -84,6 +85,12 @@ void MsgUIRouter::delivered(quint32 to) { chatwindows[to]->msg_delivered(); } + else + { + History h(config_dbname, account_id); + + h.SetDelivered(to); + } } void MsgUIRouter::scary_cert_message(quint32 peer_id, QString received_cert, QString stored_cert) diff --git a/pica-client/skynet.cpp b/pica-client/skynet.cpp index 44f0101..942cdd0 100644 --- a/pica-client/skynet.cpp +++ b/pica-client/skynet.cpp @@ -7,7 +7,7 @@ //#include //debug //#include "dialogs/forgedcertdialog.h" #include - +#include "history.h" SkyNet::SkyNet() : nodes(config_dbname), QObject(0) @@ -62,6 +62,14 @@ void SkyNet::nodethread_connected(QString addr, quint16 port, NodeThread *thread //restore old peer connections, if any QList c2c_peer_ids; + //load undelivered messages from history + if (msgqueues.isEmpty()) + { + History h(config_dbname, account_id); + + msgqueues = h.GetUndeliveredMessages(); + } + c2c_peer_ids = msgqueues.keys(); for (int i = 0; i < c2c_peer_ids.size(); i++) -- cgit v1.2.1