From 0ef7c1d7471ce20fe54729c27858db864aedee91 Mon Sep 17 00:00:00 2001 From: me_desk Date: Fri, 30 Aug 2013 13:34:02 +0000 Subject: updated pica-client to make it handle new id format. quint32 type for id is replaced with QByteArray in most places. Implemented verification callbacks in client and node that allow self-signed certificates git-svn-id: svn://localhost/project_picapica/trunk@266 fb96df88-216d-11de-830c-f3023f12d8ac --- pica-client/history.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'pica-client/history.cpp') diff --git a/pica-client/history.cpp b/pica-client/history.cpp index 31a4e22..b3883dd 100644 --- a/pica-client/history.cpp +++ b/pica-client/history.cpp @@ -1,7 +1,7 @@ #include "history.h" #include -History::History(QString storage, quint32 my_id) +History::History(QString storage, QByteArray my_id) : me_(my_id) { dbconn=QSqlDatabase::addDatabase("QSQLITE"); @@ -20,7 +20,7 @@ History::History(QString storage, quint32 my_id) //check result, if foreign keys support is on } -void History::Add(quint32 peer_id, QString message, bool is_me) +void History::Add(QByteArray peer_id, QString message, bool is_me) { QSqlQuery query; @@ -50,7 +50,7 @@ void History::Add(quint32 peer_id, QString message, bool is_me) lasterr=query.lastError(); } -void History::SetDelivered(quint32 peer_id) +void History::SetDelivered(QByteArray peer_id) { QSqlQuery query; @@ -66,7 +66,7 @@ void History::SetDelivered(quint32 peer_id) lasterr=query.lastError(); } -QList History::GetMessages(quint32 peer_id, quint32 start_timestamp, quint32 end_timestamp) +QList History::GetMessages(QByteArray peer_id, quint32 start_timestamp, quint32 end_timestamp) { QList L; HistoryRecord r; @@ -90,7 +90,7 @@ QList History::GetMessages(quint32 peer_id, quint32 star while(query.next()) { - r.peer_id = query.value(0).toUInt(); + r.peer_id = query.value(0).toByteArray(); r.is_me = query.value(1).toBool(); r.is_delivered = query.value(2).toBool(); r.timestamp = query.value(3).toUInt(); @@ -102,9 +102,9 @@ QList History::GetMessages(quint32 peer_id, quint32 star return L; } -QMap > History::GetUndeliveredMessages() +QMap > History::GetUndeliveredMessages() { - QMap > M; + QMap > M; QSqlQuery query; query.setForwardOnly(true); @@ -122,7 +122,7 @@ QMap > History::GetUndeliveredMessages() while(query.next()) { - M[query.value(0).toUInt()] << query.value(1).toString(); + M[query.value(0).toByteArray()] << query.value(1).toString(); } return M; -- cgit v1.2.1