summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/History/SQLiteHistoryManager.cpp')
-rw-r--r--Swiften/History/SQLiteHistoryManager.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Swiften/History/SQLiteHistoryManager.cpp b/Swiften/History/SQLiteHistoryManager.cpp
index 57fce2f..3b90219 100644
--- a/Swiften/History/SQLiteHistoryManager.cpp
+++ b/Swiften/History/SQLiteHistoryManager.cpp
@@ -31,7 +31,7 @@ SQLiteHistoryManager::SQLiteHistoryManager(const std::string& file) : db_(0) {
}
char* errorMessage;
- int result = sqlite3_exec(db_, "CREATE TABLE IF NOT EXISTS messages('message' STRING, 'fromBare' INTEGER, 'fromResource' STRING, 'toBare' INTEGER, 'toResource' STRING, 'type' INTEGER, 'time' INTEGER)", 0, 0, &errorMessage);
+ int result = sqlite3_exec(db_, "CREATE TABLE IF NOT EXISTS messages('message' STRING, 'fromBare' INTEGER, 'fromResource' STRING, 'toBare' INTEGER, 'toResource' STRING, 'type' INTEGER, 'time' INTEGER, 'offset' INTEGER)", 0, 0, &errorMessage);
if (result != SQLITE_OK) {
std::cerr << "SQL Error: " << errorMessage << std::endl;
sqlite3_free(errorMessage);
@@ -51,14 +51,15 @@ SQLiteHistoryManager::~SQLiteHistoryManager() {
void SQLiteHistoryManager::addMessage(const HistoryMessage& message) {
int secondsSinceEpoch = (message.getTime() - boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1))).total_seconds();
- std::string statement = std::string("INSERT INTO messages('message', 'fromBare', 'fromResource', 'toBare', 'toResource', 'type', 'time') VALUES(") +
+ std::string statement = std::string("INSERT INTO messages('message', 'fromBare', 'fromResource', 'toBare', 'toResource', 'type', 'time', 'offset') VALUES(") +
"'" + getEscapedString(message.getMessage()) + "', " +
boost::lexical_cast<std::string>(getIDForJID(message.getFromJID().toBare())) + ", '" +
getEscapedString(message.getFromJID().getResource()) + "', " +
boost::lexical_cast<std::string>(getIDForJID(message.getToJID().toBare())) + ", '" +
getEscapedString(message.getToJID().getResource()) + "', " +
boost::lexical_cast<std::string>(message.getType()) + ", " +
- boost::lexical_cast<std::string>(secondsSinceEpoch) + ")";
+ boost::lexical_cast<std::string>(secondsSinceEpoch) + ", " +
+ boost::lexical_cast<std::string>(message.getOffset()) + ")";
char* errorMessage;
int result = sqlite3_exec(db_, statement.c_str(), 0, 0, &errorMessage);
if (result != SQLITE_OK) {