File: Inbox.h

package info (click to toggle)
js8call 2.5.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,720 kB
  • sloc: cpp: 562,651; sh: 898; python: 132; ansic: 102; makefile: 4
file content (58 lines) | stat: -rw-r--r-- 1,538 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef INBOX_H
#define INBOX_H

/**
 * (C) 2018 Jordan Sherer <kn4crd@gmail.com> - All Rights Reserved
 **/

#include <QObject>
#include <QPair>
#include <QString>
#include <QVariant>

#include "sqlite3.h"

#include "Message.h"

class Inbox {
  public:
    explicit Inbox(QString path);
    ~Inbox();

    // Low-Level Interface
    bool isOpen();
    bool open();
    void close();
    QString error();
    int count(QString type, QString query, QString match);
    QList<QPair<int, Message>> values(QString type, QString query,
                                      QString match, int offset, int limit);
    Message value(int key);
    int append(Message value);
    bool set(int key, Message value);
    bool del(int key);

    // High-Level Interface
    int countUnreadFrom(QString from);
    QPair<int, Message> firstUnreadFrom(QString from);
    int getLookaheadMessageIdForCallsign(const QString &callsign,
                                         int afterMsgId);

    QMap<QString, int> getGroupMessageCounts();
    int getNextGroupMessageIdForCallsign(const QString &group_name,
                                         const QString &callsign);
    int getLookaheadGroupMessageIdForCallsign(const QString &group_name,
                                              const QString &callsign,
                                              int afterMsgId);
    bool markGroupMsgDeliveredForCallsign(int msgId, QString callsign);

  signals:

  public slots:

  private:
    QString path_;
    sqlite3 *db_;
};

#endif // INBOX_H