| Home · All Classes · All Namespaces · Modules · Functions · Files

simple-stream-tube-handler.h
1
23 #ifndef _TelepathyQt_simple_stream_tube_handler_h_HEADER_GUARD_
24 #define _TelepathyQt_simple_stream_tube_handler_h_HEADER_GUARD_
25
26 #include <TelepathyQt/AbstractClientHandler>
27 #include <TelepathyQt/ChannelRequestHints>
28 #include <TelepathyQt/RefCounted>
29 #include <TelepathyQt/Types>
30
31 #include <QDateTime>
32 #include <QLinkedList>
33 #include <QHash>
34 #include <QQueue>
35 #include <QSet>
36
37 namespace Tp
38 {
39
40 class PendingOperation;
41
42 class TP_QT_NO_EXPORT SimpleStreamTubeHandler : public QObject,
43 public AbstractClientHandler
44 {
45 Q_OBJECT
46 Q_DISABLE_COPY(SimpleStreamTubeHandler)
47
48 public:
49 static SharedPtr<SimpleStreamTubeHandler> create(
50 const QStringList &p2pServices,
51 const QStringList &roomServices,
52 bool requested,
53 bool monitorConnections,
54 bool bypassApproval = false);
55 ~SimpleStreamTubeHandler();
56
57 bool monitorsConnections() const
58 {
59 return mMonitorConnections;
60 }
61
62 bool bypassApproval() const
63 {
64 return mBypassApproval;
65 }
66
67 void handleChannels(const MethodInvocationContextPtr<> &context,
68 const AccountPtr &account,
69 const ConnectionPtr &connection,
70 const QList<ChannelPtr> &channels,
71 const QList<ChannelRequestPtr> &requestsSatisfied,
72 const QDateTime &userActionTime,
73 const HandlerInfo &handlerInfo);
74
75 Q_SIGNALS:
76 void invokedForTube(
77 const Tp::AccountPtr &account,
78 const Tp::StreamTubeChannelPtr &tube,
79 const QDateTime &userActionTime,
80 const Tp::ChannelRequestHints &requestHints);
81 void tubeInvalidated(
82 const Tp::AccountPtr &account,
83 const Tp::StreamTubeChannelPtr &tube,
84 const QString &errorName,
85 const QString &errorMessage);
86
87 private Q_SLOTS:
88 void onReadyOpFinished(Tp::PendingOperation *);
89 void onTubeInvalidated(Tp::DBusProxy *, const QString &, const QString &);
90
91 private:
92 SimpleStreamTubeHandler(
93 const QStringList &p2pServices,
94 const QStringList &roomServices,
95 bool requested,
96 bool monitorConnections,
97 bool bypassApproval);
98
99 bool mMonitorConnections;
100
101 struct InvocationData : RefCounted {
102 InvocationData() : readyOp(0) {}
103
104 PendingOperation *readyOp;
105 QString error, message;
106
107 MethodInvocationContextPtr<> ctx;
108 AccountPtr acc;
109 QList<StreamTubeChannelPtr> tubes;
110 QDateTime time;
111 ChannelRequestHints hints;
112 };
113 QLinkedList<SharedPtr<InvocationData> > mInvocations;
114 QHash<StreamTubeChannelPtr, AccountPtr> mTubes;
115 bool mBypassApproval;
116 };
117
118 } // Tp
119
120 #endif
Tp::PendingOperation
The PendingOperation class is a base class for pending asynchronous operations.
Definition: pending-operation.h:45
Tp
Definition: abstract-adaptor.cpp:31
Tp::AbstractClientHandler
The AbstractClientHandler class represents a Telepathy handler.
Definition: abstract-client.h:140
Tp::DBusProxy
The DBusProxy class is a base class representing a remote object available over D-Bus.
Definition: dbus-proxy.h:42
QLinkedList
QHash< StreamTubeChannelPtr, AccountPtr >
Tp::SimpleStreamTubeHandler
Definition: simple-stream-tube-handler.h:42
QObject
Tp::ChannelRequestHints
The ChannelRequestHints class represents a dictionary of metadata provided by the channel requester w...
Definition: channel-request.h:121
QString
QList< ChannelPtr >
QStringList
Tp::SimpleStreamTubeHandler::bypassApproval
bool bypassApproval() const
Definition: simple-stream-tube-handler.h:62
Tp::SimpleStreamTubeHandler::monitorsConnections
bool monitorsConnections() const
Definition: simple-stream-tube-handler.h:57
Tp::RefCounted
The RefCounted class is a base class for shared objects used by SharedPtr.
Definition: shared-ptr.h:42
Tp::SharedPtr
The SharedPtr class is a pointer to an explicitly shared object.
Definition: shared-ptr.h:39
QDateTime