libqutim
0.3.2.0
Main Page
Related Pages
Namespaces
Classes
Globals
Globals
File List
history.h
Go to the documentation of this file.
1
/****************************************************************************
2
**
3
** qutIM - instant messenger
4
**
5
** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru>
6
**
7
*****************************************************************************
8
**
9
** $QUTIM_BEGIN_LICENSE$
10
** This program is free software: you can redistribute it and/or modify
11
** it under the terms of the GNU General Public License as published by
12
** the Free Software Foundation, either version 3 of the License, or
13
** (at your option) any later version.
14
**
15
** This program is distributed in the hope that it will be useful,
16
** but WITHOUT ANY WARRANTY; without even the implied warranty of
17
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18
** See the GNU General Public License for more details.
19
**
20
** You should have received a copy of the GNU General Public License
21
** along with this program. If not, see http://www.gnu.org/licenses/.
22
** $QUTIM_END_LICENSE$
23
**
24
****************************************************************************/
25
26
#ifndef HISTORY_H
27
#define HISTORY_H
28
29
#include "
message.h
"
30
#include <QDateTime>
31
32
namespace
qutim_sdk_0_3
33
{
34
class
ChatUnit;
35
36
#ifdef EXPERIMENTAL_HISTORY_API
37
class
HistoryRequestPrivate;
38
class
HistoryReplyPrivate;
39
class
HistoryRequest;
40
41
class
HistoryReply :
public
QObject
42
{
43
Q_OBJECT
44
Q_DECLARE_PRIVATE(HistoryReply)
45
public:
46
HistoryReply();
47
~HistoryReply();
48
49
HistoryRequest request() const;
50
MessageList
messages() const;
51
int
totalCount() const;
52
int
firstIndex() const;
53
int
lastIndex() const;
54
signals:
55
void
ready();
56
protected:
57
void
setMessages(const
MessageList
&messages);
58
void
setCount(
int
count);
59
void
setBoundaries(
int
first,
int
last);
60
private:
61
QScopedPointer<HistoryReplyPrivate> d_ptr;
62
};
63
64
class HistoryRequest
65
{
66
public
:
67
HistoryRequest(ChatUnit *unit);
68
HistoryRequest(
const
HistoryRequest &other);
69
~HistoryRequest();
70
HistoryRequest &operator =(
const
HistoryRequest &other);
71
// enum Type { MessagesCount, };
72
73
HistoryReply *send();
74
private
:
75
QSharedDataPointer<HistoryRequestPrivate> d_ptr;
76
};
77
78
class
LIBQUTIM_EXPORT
HistoryEngine :
public
QObject
79
{
80
Q_OBJECT
81
public
:
82
HistoryEngine();
83
virtual
~HistoryEngine();
84
virtual
HistoryReply *store(
const
Message &msg) = 0;
85
virtual
HistoryReply *request(
const
HistoryRequest &rule) = 0;
86
};
87
#endif // EXPERIMENTAL_HISTORY_API
88
89
class
LIBQUTIM_EXPORT
History
:
public
QObject
90
{
91
Q_OBJECT
92
public
:
93
History
();
94
virtual
~
History
();
95
static
History
*instance();
96
virtual
void
store(
const
Message
&message);
97
virtual
MessageList
read(
const
ChatUnit
*unit,
const
QDateTime &from,
const
QDateTime &to,
int
max_num);
98
MessageList
read
(
const
ChatUnit
*unit,
const
QDateTime &to,
int
max_num) {
return
read
(unit, QDateTime(), to, max_num); }
99
MessageList
read
(
const
ChatUnit
*unit,
int
max_num) {
return
read
(unit, QDateTime(), QDateTime::currentDateTime(), max_num); }
100
public
slots:
101
virtual
void
showHistory(
const
ChatUnit
*unit);
102
virtual
void
virtual_hook(
int
id
,
void
*data);
103
};
104
}
105
106
#endif // HISTORY_H
107
qutim_sdk_0_3::History::read
MessageList read(const ChatUnit *unit, int max_num)
Definition:
history.h:99
qutim_sdk_0_3::Message
Definition:
message.h:41
LIBQUTIM_EXPORT
#define LIBQUTIM_EXPORT
Definition:
libqutim_global.h:45
qutim_sdk_0_3
Definition:
abstractsearchrequest.h:33
message.h
qutim_sdk_0_3::History
Definition:
history.h:89
qutim_sdk_0_3::MessageList
QList< Message > MessageList
Definition:
message.h:95
qutim_sdk_0_3::History::read
MessageList read(const ChatUnit *unit, const QDateTime &to, int max_num)
Definition:
history.h:98
qutim_sdk_0_3::ChatUnit
ChatUnit is base class for all chat members.
Definition:
chatunit.h:57
Generated by Doxygen