diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-08-27 22:54:06 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2023-08-30 02:46:41 +0200 |
| commit | e3c11fd05496bb2953e4dfe031afb1c180604d30 (patch) | |
| tree | 73450c857c97126feaa3651ac6edb789997f483c | |
| parent | 78d9bd40849a39db1fbdbfc87b2c45e9d3e73d06 (diff) | |
jiddb: Remove 'get' from public functions
| -rw-r--r-- | jiddb.cpp | 20 | ||||
| -rw-r--r-- | jiddb.h | 4 | ||||
| -rw-r--r-- | xxcc.cpp | 4 |
3 files changed, 14 insertions, 14 deletions
@@ -84,7 +84,7 @@ int JidDb::ensureContactDb(const QString &jid) const return 0; } -QList<JidDb::Message> JidDb::getMessages(const QString &jid, +QList<JidDb::Message> JidDb::messages(const QString &jid, const int tail) const { QSqlQuery q(db); @@ -95,14 +95,14 @@ QList<JidDb::Message> JidDb::getMessages(const QString &jid, { if (!q.exec("select * from '" + jid + "' order by time;")) { - std::cerr << "JidDb::getMessages: query exec failed"; + std::cerr << "JidDb::messages: query exec failed"; return QList<Message>(); } } else if (!q.exec("select * from '" + jid + "' order by time desc limit " + QString::number(tail) + ";")) { - std::cerr << "JidDb::getMessages: query exec failed" << std::endl; + std::cerr << "JidDb::messages: query exec failed" << std::endl; return QList<Message>(); } @@ -116,7 +116,7 @@ QList<JidDb::Message> JidDb::getMessages(const QString &jid, if (!ok) { - std::cerr << "JidDb::getMessages: invalid time" << std::endl; + std::cerr << "JidDb::messages: invalid time" << std::endl; // Attempt to read other messages. continue; } @@ -132,7 +132,7 @@ QList<JidDb::Message> JidDb::getMessages(const QString &jid, m.direction = Direction::Out; else { - std::cerr << "JidDb::getMessages: invalid direction" << std::endl; + std::cerr << "JidDb::messages: invalid direction" << std::endl; // Attempt to read other messages. continue; } @@ -181,7 +181,7 @@ QStringList JidDb::tables() const if (!q.exec("select name from sqlite_schema where " "type = 'table' and name not like 'sqlite_%'")) { - std::cerr << "JidDb::getConversations: query failed" << std::endl; + std::cerr << "JidDb::conversations: query failed" << std::endl; return QStringList(); } @@ -193,7 +193,7 @@ QStringList JidDb::tables() const return ret; } -QList<JidDb::Conversation> JidDb::getConversations() const +QList<JidDb::Conversation> JidDb::conversations() const { const auto conversations = tables(); QList<Conversation> ret; @@ -201,11 +201,11 @@ QList<JidDb::Conversation> JidDb::getConversations() const for (const auto &jid : conversations) if (jid.contains('@')) { - const auto messages = getMessages(jid, 1); + const auto msgs = messages(jid, 1); - if (!messages.isEmpty()) + if (!msgs.isEmpty()) { - const auto &m = messages.first(); + const auto &m = msgs.first(); ret << Conversation(jid, m.body, m.dt); } @@ -35,8 +35,8 @@ public: const QString jid; public Q_SLOTS: - QList<Conversation> getConversations() const; - QList<Message> getMessages(const QString &jid, + QList<Conversation> conversations() const; + QList<Message> messages(const QString &jid, int tail = -1) const; int storeMessage(const Message &msg) const; int addToRoster(const QString &jid); @@ -81,7 +81,7 @@ xxcc::xxcc(QWidget *const parent) : { const auto &db = selected->database(); static const auto n_messages = 20; - const auto messages = db.getMessages(conv->to, n_messages); + const auto messages = db.messages(conv->to, n_messages); for (auto it = messages.rbegin(); it != messages.rend(); it++) new Message(it->body, it->dt, it->direction, ui.messages); @@ -250,7 +250,7 @@ void xxcc::retrieveConversations() { const auto &db = c->database(); - for (const auto &conv : db.getConversations()) + for (const auto &conv : db.conversations()) new Conversation(db.jid, conv.to, ui.conversations_list, conv.last_msg, conv.dt); } |
