diff options
author | louiz <louiz@louiz.org> | 2017-07-16 01:13:04 +0200 |
---|---|---|
committer | louiz <louiz@louiz.org> | 2017-07-16 01:13:04 +0200 |
commit | 9131e63b74412ca75a26de27a308a1843984a43f (patch) | |
tree | 15fc0c2cd67651a0bf938cdd787e50e793cf946e /src/database/database.hpp | |
parent | b2334707107e65dd15590b7472c990bbf79549eb (diff) | |
parent | 88770979c3a46f3dde76fa2756e3e07ff79c3e12 (diff) | |
download | biboumi-9131e63b74412ca75a26de27a308a1843984a43f.tar.gz biboumi-9131e63b74412ca75a26de27a308a1843984a43f.tar.bz2 biboumi-9131e63b74412ca75a26de27a308a1843984a43f.tar.xz biboumi-9131e63b74412ca75a26de27a308a1843984a43f.zip |
Merge branch 'biboumi_jid_in_users_rosters' into 'master'
Use a db roster to manage biboumi’s presence with the contacts
Closes #3217
See merge request !13
Diffstat (limited to 'src/database/database.hpp')
-rw-r--r-- | src/database/database.hpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/database/database.hpp b/src/database/database.hpp index b5f2ff0..c00c938 100644 --- a/src/database/database.hpp +++ b/src/database/database.hpp @@ -72,6 +72,11 @@ class Database struct Persistent: Column<bool> { static constexpr auto name = "persistent_"; Persistent(): Column<bool>(false) {} }; + struct LocalJid: Column<std::string> { static constexpr auto name = "local"; }; + + struct RemoteJid: Column<std::string> { static constexpr auto name = "remote"; }; + + using MucLogLineTable = Table<Id, Uuid, Owner, IrcChanName, IrcServerName, Date, Body, Nick>; using MucLogLine = MucLogLineTable::RowType; @@ -84,6 +89,9 @@ class Database using IrcChannelOptionsTable = Table<Id, Owner, Server, Channel, EncodingOut, EncodingIn, MaxHistoryLength, Persistent, RecordHistoryOptional>; using IrcChannelOptions = IrcChannelOptionsTable::RowType; + using RosterTable = Table<LocalJid, RemoteJid>; + using RosterItem = RosterTable::RowType; + Database() = default; ~Database() = default; @@ -109,6 +117,12 @@ class Database static std::string store_muc_message(const std::string& owner, const std::string& chan_name, const std::string& server_name, time_point date, const std::string& body, const std::string& nick); + static void add_roster_item(const std::string& local, const std::string& remote); + static bool has_roster_item(const std::string& local, const std::string& remote); + static void delete_roster_item(const std::string& local, const std::string& remote); + static std::vector<Database::RosterItem> get_contact_list(const std::string& local); + static std::vector<Database::RosterItem> get_full_roster(); + static void close(); static void open(const std::string& filename); @@ -123,6 +137,7 @@ class Database static GlobalOptionsTable global_options; static IrcServerOptionsTable irc_server_options; static IrcChannelOptionsTable irc_channel_options; + static RosterTable roster; static sqlite3* db; private: |