summaryrefslogtreecommitdiff
path: root/src/database/database.cpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-06-28 14:41:33 +0200
committerlouiz’ <louiz@louiz.org>2017-06-28 14:41:33 +0200
commit13a1ab1878fd6312aea485ded3f5bad59c36f17f (patch)
tree071b90523126d677f714cbf13346507f2e500d69 /src/database/database.cpp
parenta1349361d2c15929e8260536c9091f2a4c2048a4 (diff)
parent7e69d0387e85eeed10d605349feeba595c3fa0ee (diff)
downloadbiboumi-13a1ab1878fd6312aea485ded3f5bad59c36f17f.tar.gz
biboumi-13a1ab1878fd6312aea485ded3f5bad59c36f17f.tar.bz2
biboumi-13a1ab1878fd6312aea485ded3f5bad59c36f17f.tar.xz
biboumi-13a1ab1878fd6312aea485ded3f5bad59c36f17f.zip
Merge remote-tracking branch 'remotes/debian/master' into debian
Diffstat (limited to 'src/database/database.cpp')
-rw-r--r--src/database/database.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/database/database.cpp b/src/database/database.cpp
index cb0c78f..9f310da 100644
--- a/src/database/database.cpp
+++ b/src/database/database.cpp
@@ -20,7 +20,7 @@ void Database::open(const std::string& filename, const std::string& db_type)
"database="s + filename);
if (new_db->needsUpgrade())
new_db->upgrade();
- Database::db.reset(new_db.release());
+ Database::db = std::move(new_db);
} catch (const litesql::DatabaseError& e) {
log_error("Failed to open database ", filename, ". ", e.what());
throw;
@@ -119,14 +119,16 @@ db::IrcChannelOptions Database::get_irc_channel_options_with_server_and_global_d
return coptions;
}
-void Database::store_muc_message(const std::string& owner, const Iid& iid,
- Database::time_point date,
- const std::string& body,
- const std::string& nick)
+std::string Database::store_muc_message(const std::string& owner, const Iid& iid,
+ Database::time_point date,
+ const std::string& body,
+ const std::string& nick)
{
db::MucLogLine line(*Database::db);
- line.uuid = Database::gen_uuid();
+ auto uuid = Database::gen_uuid();
+
+ line.uuid = uuid;
line.owner = owner;
line.ircChanName = iid.get_local();
line.ircServerName = iid.get_server();
@@ -135,6 +137,8 @@ void Database::store_muc_message(const std::string& owner, const Iid& iid,
line.nick = nick;
line.update();
+
+ return uuid;
}
std::vector<db::MucLogLine> Database::get_muc_logs(const std::string& owner, const std::string& chan_name, const std::string& server,