switch to datastore
This commit is contained in:
@@ -37,6 +37,42 @@ std::map<QString, ChatItem> ChatDataStore::getAllRawChatItems()
|
||||
return this->data;
|
||||
}
|
||||
|
||||
std::map<QString, ChatItem> ChatDataStore::getAllContactRequests()
|
||||
{
|
||||
std::map<QString, ChatItem> filteredItems;
|
||||
for(auto &c: this->data)
|
||||
{
|
||||
if (
|
||||
(c.second.getType() == "cont") &&
|
||||
(c.second.isOutgoing() == false) &&
|
||||
(c.second.getMemo().startsWith("{"))
|
||||
)
|
||||
{
|
||||
filteredItems[c.first] = c.second;
|
||||
}
|
||||
}
|
||||
return filteredItems;
|
||||
}
|
||||
|
||||
|
||||
std::map<QString, ChatItem> ChatDataStore::getAllMemos()
|
||||
{
|
||||
std::map<QString, ChatItem> filteredItems;
|
||||
for(auto &c: this->data)
|
||||
{
|
||||
if (
|
||||
|
||||
(c.second.getMemo().startsWith("{") == false) &&
|
||||
(c.second.getMemo().isEmpty() == false)
|
||||
|
||||
)
|
||||
{
|
||||
filteredItems[c.first] = c.second;
|
||||
}
|
||||
}
|
||||
return filteredItems;
|
||||
}
|
||||
|
||||
|
||||
ChatDataStore* ChatDataStore::instance = nullptr;
|
||||
bool ChatDataStore::instanced = false;
|
||||
@@ -8,6 +8,8 @@ class ChatDataStore
|
||||
private:
|
||||
static bool instanced;
|
||||
static ChatDataStore* instance;
|
||||
Ui::MainWindow* ui;
|
||||
MainWindow* main;
|
||||
std::map<QString, ChatItem> data;
|
||||
ChatDataStore()
|
||||
{
|
||||
@@ -20,6 +22,8 @@ class ChatDataStore
|
||||
void setData(QString key, ChatItem value);
|
||||
ChatItem getData(QString key);
|
||||
std::map<QString, ChatItem> getAllRawChatItems();
|
||||
std::map<QString, ChatItem> getAllContactRequests();
|
||||
std::map<QString, ChatItem> getAllMemos();
|
||||
QString dump();
|
||||
|
||||
~ChatDataStore()
|
||||
|
||||
Reference in New Issue
Block a user