1 #include "svc-channel-proxy.h"
2
3 #include <TelepathyQt/Constants>
4 #include <TelepathyQt/MethodInvocationContext>
5
6 namespace Tp
7 {
8 namespace Service
9 {
10
ChannelProxyInterfaceOTRAdaptor(const QDBusConnection & bus,QObject * adaptee,QObject * parent)11 ChannelProxyInterfaceOTRAdaptor::ChannelProxyInterfaceOTRAdaptor(const QDBusConnection& bus, QObject* adaptee, QObject* parent)
12 : Tp::AbstractAdaptor(bus, adaptee, parent)
13 {
14 connect(adaptee, SIGNAL(messageSent(const Tp::MessagePartList&, uint, const QString&)), SIGNAL(MessageSent(const Tp::MessagePartList&, uint, const QString&)));
15 connect(adaptee, SIGNAL(messageReceived(const Tp::MessagePartList&)), SIGNAL(MessageReceived(const Tp::MessagePartList&)));
16 connect(adaptee, SIGNAL(pendingMessagesRemoved(const Tp::UIntList&)), SIGNAL(PendingMessagesRemoved(const Tp::UIntList&)));
17 connect(adaptee, SIGNAL(peerAuthenticationRequested(const QString&)), SIGNAL(PeerAuthenticationRequested(const QString&)));
18 connect(adaptee, SIGNAL(peerAuthenticationConcluded(bool)), SIGNAL(PeerAuthenticationConcluded(bool)));
19 connect(adaptee, SIGNAL(peerAuthenticationInProgress()), SIGNAL(PeerAuthenticationInProgress()));
20 connect(adaptee, SIGNAL(peerAuthenticationAborted()), SIGNAL(PeerAuthenticationAborted()));
21 connect(adaptee, SIGNAL(peerAuthenticationError()), SIGNAL(PeerAuthenticationError()));
22 connect(adaptee, SIGNAL(peerAuthenticationCheated()), SIGNAL(PeerAuthenticationCheated()));
23 connect(adaptee, SIGNAL(sessionRefreshed()), SIGNAL(SessionRefreshed()));
24 connect(adaptee, SIGNAL(trustLevelChanged(uint)), SIGNAL(TrustLevelChanged(uint)));
25 }
26
~ChannelProxyInterfaceOTRAdaptor()27 ChannelProxyInterfaceOTRAdaptor::~ChannelProxyInterfaceOTRAdaptor()
28 {
29 }
30
WrappedChannel() const31 QDBusObjectPath ChannelProxyInterfaceOTRAdaptor::WrappedChannel() const
32 {
33 return qvariant_cast< QDBusObjectPath >(adaptee()->property("wrappedChannel"));
34 }
35
Connected() const36 bool ChannelProxyInterfaceOTRAdaptor::Connected() const
37 {
38 return qvariant_cast< bool >(adaptee()->property("connected"));
39 }
40
PendingMessages() const41 Tp::MessagePartListList ChannelProxyInterfaceOTRAdaptor::PendingMessages() const
42 {
43 return qvariant_cast< Tp::MessagePartListList >(adaptee()->property("pendingMessages"));
44 }
45
TrustLevel() const46 uint ChannelProxyInterfaceOTRAdaptor::TrustLevel() const
47 {
48 return qvariant_cast< uint >(adaptee()->property("trustLevel"));
49 }
50
LocalFingerprint() const51 QString ChannelProxyInterfaceOTRAdaptor::LocalFingerprint() const
52 {
53 return qvariant_cast< QString >(adaptee()->property("localFingerprint"));
54 }
55
RemoteFingerprint() const56 QString ChannelProxyInterfaceOTRAdaptor::RemoteFingerprint() const
57 {
58 return qvariant_cast< QString >(adaptee()->property("remoteFingerprint"));
59 }
60
ConnectProxy(const QDBusMessage & dbusMessage)61 void ChannelProxyInterfaceOTRAdaptor::ConnectProxy(const QDBusMessage& dbusMessage)
62 {
63 if (adaptee()->metaObject()->indexOfMethod("connectProxy(Tp::Service::ChannelProxyInterfaceOTRAdaptor::ConnectProxyContextPtr)") < 0) {
64 dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
65 return;
66 }
67
68 ConnectProxyContextPtr ctx = ConnectProxyContextPtr(
69 new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
70 QMetaObject::invokeMethod(adaptee(), "connectProxy",
71 Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::ConnectProxyContextPtr, ctx));
72 }
73
DisconnectProxy(const QDBusMessage & dbusMessage)74 void ChannelProxyInterfaceOTRAdaptor::DisconnectProxy(const QDBusMessage& dbusMessage)
75 {
76 if (adaptee()->metaObject()->indexOfMethod("disconnectProxy(Tp::Service::ChannelProxyInterfaceOTRAdaptor::DisconnectProxyContextPtr)") < 0) {
77 dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
78 return;
79 }
80
81 DisconnectProxyContextPtr ctx = DisconnectProxyContextPtr(
82 new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
83 QMetaObject::invokeMethod(adaptee(), "disconnectProxy",
84 Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::DisconnectProxyContextPtr, ctx));
85 }
86
SendMessage(const Tp::MessagePartList & message,uint flags,const QDBusMessage & dbusMessage)87 QString ChannelProxyInterfaceOTRAdaptor::SendMessage(const Tp::MessagePartList& message, uint flags, const QDBusMessage& dbusMessage)
88 {
89 if (adaptee()->metaObject()->indexOfMethod("sendMessage(Tp::MessagePartList,uint,Tp::Service::ChannelProxyInterfaceOTRAdaptor::SendMessageContextPtr)") < 0) {
90 dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
91 return QString();
92 }
93
94 SendMessageContextPtr ctx = SendMessageContextPtr(
95 new Tp::MethodInvocationContext< QString >(dbusConnection(), dbusMessage));
96 QMetaObject::invokeMethod(adaptee(), "sendMessage",
97 Q_ARG(Tp::MessagePartList, message), Q_ARG(uint, flags),
98 Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::SendMessageContextPtr, ctx));
99 return QString();
100 }
101
AcknowledgePendingMessages(const Tp::UIntList & IDs,const QDBusMessage & dbusMessage)102 void ChannelProxyInterfaceOTRAdaptor::AcknowledgePendingMessages(const Tp::UIntList& IDs, const QDBusMessage& dbusMessage)
103 {
104 if (adaptee()->metaObject()->indexOfMethod("acknowledgePendingMessages(Tp::UIntList,Tp::Service::ChannelProxyInterfaceOTRAdaptor::AcknowledgePendingMessagesContextPtr)") < 0) {
105 dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
106 return;
107 }
108
109 AcknowledgePendingMessagesContextPtr ctx = AcknowledgePendingMessagesContextPtr(
110 new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
111 QMetaObject::invokeMethod(adaptee(), "acknowledgePendingMessages",
112 Q_ARG(Tp::UIntList, IDs),
113 Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::AcknowledgePendingMessagesContextPtr, ctx));
114 }
115
Initialize(const QDBusMessage & dbusMessage)116 void ChannelProxyInterfaceOTRAdaptor::Initialize(const QDBusMessage& dbusMessage)
117 {
118 if (adaptee()->metaObject()->indexOfMethod("initialize(Tp::Service::ChannelProxyInterfaceOTRAdaptor::InitializeContextPtr)") < 0) {
119 dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
120 return;
121 }
122
123 InitializeContextPtr ctx = InitializeContextPtr(
124 new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
125 QMetaObject::invokeMethod(adaptee(), "initialize",
126 Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::InitializeContextPtr, ctx));
127 }
128
Stop(const QDBusMessage & dbusMessage)129 void ChannelProxyInterfaceOTRAdaptor::Stop(const QDBusMessage& dbusMessage)
130 {
131 if (adaptee()->metaObject()->indexOfMethod("stop(Tp::Service::ChannelProxyInterfaceOTRAdaptor::StopContextPtr)") < 0) {
132 dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
133 return;
134 }
135
136 StopContextPtr ctx = StopContextPtr(
137 new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
138 QMetaObject::invokeMethod(adaptee(), "stop",
139 Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::StopContextPtr, ctx));
140 }
141
TrustFingerprint(const QString & fingerprint,bool trust,const QDBusMessage & dbusMessage)142 void ChannelProxyInterfaceOTRAdaptor::TrustFingerprint(const QString& fingerprint, bool trust, const QDBusMessage& dbusMessage)
143 {
144 if (adaptee()->metaObject()->indexOfMethod("trustFingerprint(QString,bool,Tp::Service::ChannelProxyInterfaceOTRAdaptor::TrustFingerprintContextPtr)") < 0) {
145 dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
146 return;
147 }
148
149 TrustFingerprintContextPtr ctx = TrustFingerprintContextPtr(
150 new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
151 QMetaObject::invokeMethod(adaptee(), "trustFingerprint",
152 Q_ARG(QString, fingerprint), Q_ARG(bool, trust),
153 Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::TrustFingerprintContextPtr, ctx));
154 }
155
StartPeerAuthentication(const QString & question,const QString & secret,const QDBusMessage & dbusMessage)156 void ChannelProxyInterfaceOTRAdaptor::StartPeerAuthentication(const QString& question, const QString& secret, const QDBusMessage& dbusMessage)
157 {
158 if (adaptee()->metaObject()->indexOfMethod("startPeerAuthentication(QString,QString,Tp::Service::ChannelProxyInterfaceOTRAdaptor::StartPeerAuthenticationContextPtr)") < 0) {
159 dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
160 return;
161 }
162
163 StartPeerAuthenticationContextPtr ctx = StartPeerAuthenticationContextPtr(
164 new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
165 QMetaObject::invokeMethod(adaptee(), "startPeerAuthentication",
166 Q_ARG(QString, question), Q_ARG(QString, secret),
167 Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::StartPeerAuthenticationContextPtr, ctx));
168 }
169
RespondPeerAuthentication(const QString & secret,const QDBusMessage & dbusMessage)170 void ChannelProxyInterfaceOTRAdaptor::RespondPeerAuthentication(const QString& secret, const QDBusMessage& dbusMessage)
171 {
172 if (adaptee()->metaObject()->indexOfMethod("respondPeerAuthentication(QString,Tp::Service::ChannelProxyInterfaceOTRAdaptor::RespondPeerAuthenticationContextPtr)") < 0) {
173 dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
174 return;
175 }
176
177 RespondPeerAuthenticationContextPtr ctx = RespondPeerAuthenticationContextPtr(
178 new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
179 QMetaObject::invokeMethod(adaptee(), "respondPeerAuthentication",
180 Q_ARG(QString, secret),
181 Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::RespondPeerAuthenticationContextPtr, ctx));
182 }
183
AbortPeerAuthentication(const QDBusMessage & dbusMessage)184 void ChannelProxyInterfaceOTRAdaptor::AbortPeerAuthentication(const QDBusMessage& dbusMessage)
185 {
186 if (adaptee()->metaObject()->indexOfMethod("abortPeerAuthentication(Tp::Service::ChannelProxyInterfaceOTRAdaptor::AbortPeerAuthenticationContextPtr)") < 0) {
187 dbusConnection().send(dbusMessage.createErrorReply(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented")));
188 return;
189 }
190
191 AbortPeerAuthenticationContextPtr ctx = AbortPeerAuthenticationContextPtr(
192 new Tp::MethodInvocationContext< >(dbusConnection(), dbusMessage));
193 QMetaObject::invokeMethod(adaptee(), "abortPeerAuthentication",
194 Q_ARG(Tp::Service::ChannelProxyInterfaceOTRAdaptor::AbortPeerAuthenticationContextPtr, ctx));
195 }
196
197 }
198 }
199